Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

windows - Create a directory and get the handle by issuing one IRP -


when create file createfile, file created , handle.
createdirectory doesn't return directory's handle.

i'd handle when create directory.
want handle issuing 1 i/o request packet.

so, 'do createdirectory, createfile file_flag_backup_semantics.' won't answer.
issue 2 irps file system.

is there api can use in usermode(win32 api)?

nt can this, win32 doesn't expose it. need use nt apis this. ntcreatefile, specifically. should follow same parameters of zwcreatefile.

here's illustrative example (hacked in hurry inside web form -- ymmv):

handle createdirectoryandgethandle(pwstr pszfilename) {     ntstatus status;     unicode_string filename;     handle directoryhandle;     io_status_block iostatus;     object_attributes objectattributes;      rtlinitunicodestring(&filename, pszfilename);     initializeobjectattributes(&objectatributes, &filename, 0, null, null);      status = ntcreatefile(&directoryhandle,                           generic_read | generic_write,                           &objectattributes,                           &iostatus,                           file_attribute_normal,                           file_share_read | file_share_write | file_share_delete,                           file_create,                           file_directory_file,                           null,                           0);      if (nt_success(status))     {        return directoryhandle;     }     else     {        setlasterror(rtlntstatustodoserror(status));        return invalid_handle_value;     } } 

some things note...

  • nt paths have different conventions win32 paths... might have sanitize path.

  • when talking handles, nt apis deal null rather invalid_handle_value.

  • i didn't here, changing initializeobjectattributes call can interesting things, create relative directory handle. of course flags i've put in here might want change. consult documentation and/or web best results.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -