FreeRDP/winpr/libwinpr/nt/test/TestNtCreateFile.c

31 lines
765 B
C
Raw Normal View History

2013-08-22 18:18:38 +04:00
#include <winpr/crt.h>
2013-08-22 18:18:38 +04:00
#include <winpr/nt.h>
int TestNtCreateFile(int argc, char* argv[])
{
HANDLE handle;
NTSTATUS ntstatus;
ULONG CreateOptions;
ANSI_STRING aString;
UNICODE_STRING uString;
ACCESS_MASK DesiredAccess = 0;
OBJECT_ATTRIBUTES attributes;
IO_STATUS_BLOCK ioStatusBlock;
_RtlInitAnsiString(&aString, "\\Device\\FreeRDP\\TEST");
_RtlAnsiStringToUnicodeString(&uString, &aString, TRUE);
_InitializeObjectAttributes(&attributes, &uString, 0, NULL, NULL);
DesiredAccess = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE;
CreateOptions = FILE_DIRECTORY_FILE | FILE_WRITE_THROUGH;
ntstatus = _NtCreateFile(&handle, DesiredAccess, &attributes, &ioStatusBlock, 0, 0, 0, CreateOptions, 0, 0, 0);
_RtlFreeUnicodeString(&uString);
2013-08-22 18:18:38 +04:00
return 0;
}