Re: How to open a file ? by conjonh
conjonh
Thu Oct 13 08:11:00 CDT 2005
Something like this is what you need:
UNICODE_STRING us;
IOSB iosb;
HANDLE hFile = NULL;
OBJECT_ATTRIBUTES oa;
NTSTATUS stat;
us.Buffer =L"\\??\\C:\\logfile.txt";
us.Length = wcslen(us.Buffer) * sizeof(WCHAR);
us.MaximumLength = us.Length + sizeof(WCHAR);
InitializeObjectAttributes(&oa,&us,NULL,NULL,NULL);
stat = ZwCreateFile(
&hFile,
GENERIC_WRITE,
&oa,
&iosb,
0,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN_IF,
FILE_DIRECTORY_FILE,
NULL,
0);
Look it up in the DDK doc.
Cheers,
Con