ZwCreateFile problem

S

Shalini

Hi All,
My ZwCreateFile does not succeed at all. I had this problem initially and i
got this suddenly again.
I am calling this function from my first ReadWrite.(IRP_MJ_READ)




RtlInitUnicodeString(&fileNameUnicodeString,L\\??\\C:\\Windows\\System32\\So
meFile.xml);

InitializeObjectAttributes(&objectAttributes,
&fileNameUnicodeString,
OBJ_CASE_INSENSITIVE,
NULL,
NULL );

rc = ZwCreateFile( &hFileHandle, SYNCHRONIZE|FILE_ANY_ACCESS,
&objectAttributes, &IoStatus, NULL, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_CREATE,
FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE,
NULL, 0 );

if(!NT_SUCCESS(rc))
KdPrint((DRIVERNAME "Error Creating the File\n"));

I always get the error code as -1073741766(ERROR_PATH_NOT_FOUND)
I get the same error code even if i change my file name to
\\SystemRoot\\System32\\Somefile.xml ..

Any ideas guys?
Regards
Shal
 
V

Vishwa

hi,

The problem in your code might be the file name u have
mention, try with this, suppose the file u wish to access
is c:\file.txt,then

RtlInitUnicodeString(&fileNameUnicodeString,L"\\DosDevices\\c:\\file.txt");

I hope the rest of ur coding is correct

Bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top