Tech Support > Microsoft Windows > Drivers > ZwCreateFile problem
ZwCreateFile problem
Posted by Shalini on July 7th, 2004


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_FI LE,
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


Posted by Vishwa on July 8th, 2004


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"\\Do sDevices\\c:\\file.txt");

I hope the rest of ur coding is correct

Bye

"Shalini" <kandukondein@NOSPAMyahoo.com> wrote in message news:<eNegnFDZEHA.3168@TK2MSFTNGP10.phx.gbl>...