2013-10-31 19:02:25 +04:00
|
|
|
|
|
|
|
#include <winpr/io.h>
|
|
|
|
#include <winpr/nt.h>
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/windows.h>
|
|
|
|
|
|
|
|
int TestIoDevice(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
#ifndef _WIN32
|
|
|
|
NTSTATUS NtStatus;
|
|
|
|
ANSI_STRING aString;
|
|
|
|
UNICODE_STRING uString;
|
|
|
|
PDEVICE_OBJECT_EX pDeviceObject = NULL;
|
|
|
|
|
|
|
|
_RtlInitAnsiString(&aString, "\\Device\\Example");
|
|
|
|
_RtlAnsiStringToUnicodeString(&uString, &aString, TRUE);
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
NtStatus = _IoCreateDeviceEx(NULL, 0, &uString, FILE_DEVICE_UNKNOWN, 0, FALSE, &pDeviceObject);
|
2013-10-31 19:02:25 +04:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (NtStatus != STATUS_SUCCESS)
|
|
|
|
return -1;
|
|
|
|
|
2013-10-31 19:02:25 +04:00
|
|
|
_IoDeleteDeviceEx(pDeviceObject);
|
|
|
|
|
|
|
|
_RtlFreeUnicodeString(&uString);
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|