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