38#define TestUserObjectInfo(Handle, Index, Buffer, Length, Ret, Error, LengthNeeded) do \
40 DWORD _LengthNeeded = NOTSET; \
41 DECLSPEC_ALIGN(16) CHAR _LengthBuffer[2 * sizeof(DWORD)]; \
45 SetLastError(0xdeadbeef); \
46 _Ret = GetUserObjectInformationW(Handle, Index, Buffer, Length, NULL); \
47 _Error = GetLastError(); \
48 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
49 xok(_Error == (Error), "Error = %lu\n", _Error); \
51 SetLastError(0xdeadbeef); \
52 _Ret = GetUserObjectInformationW(Handle, Index, Buffer, Length, &_LengthNeeded);\
53 _Error = GetLastError(); \
54 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
55 xok(_Error == (Error), "Error = %lu\n", _Error); \
56 xok(_LengthNeeded == (LengthNeeded), "LengthNeeded = %lu\n", _LengthNeeded); \
58 SetLastError(0xdeadbeef); \
59 *(PDWORD)&_LengthBuffer[1] = NOTSET; \
60 _Ret = GetUserObjectInformationW(Handle, Index, Buffer, Length, \
61 (PDWORD)&_LengthBuffer[1]); \
62 _Error = GetLastError(); \
63 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
64 xok(_Error == (Error), "Error = %lu\n", _Error); \
65 _LengthNeeded = *(PDWORD)&_LengthBuffer[1]; \
66 xok(_LengthNeeded == (LengthNeeded), "LengthNeeded = %lu\n", _LengthNeeded); \
68 SetLastError(0xdeadbeef); \
69 _Ret = GetUserObjectInformationW(Handle, Index, Buffer, Length, (PVOID)-4); \
70 _Error = GetLastError(); \
71 ok(_Ret == FALSE, "Ret = %d\n", _Ret); \
72 ok(_Error == ERROR_NOACCESS, "Error = %lu\n", _Error); \
75#define TestUserObjectInfoWithString(Handle, Index, Buffer, BufferSize, String) do \
78 SIZE_T SizeOfString = wcslen(String) * sizeof(WCHAR) + sizeof(UNICODE_NULL); \
79 TestUserObjectInfo(Handle, Index, NULL, 0, FALSE, ERROR_INSUFFICIENT_BUFFER, SizeOfString); \
80 TestUserObjectInfo(Handle, Index, UlongToPtr(1), 0, FALSE, ERROR_INSUFFICIENT_BUFFER, SizeOfString); \
81 TestUserObjectInfo(Handle, Index, NULL, 1, FALSE, ERROR_NOACCESS, NOTSET); \
82 TestUserObjectInfo(Handle, Index, UlongToPtr(1), 1, FALSE, ERROR_NOACCESS, NOTSET); \
83 RtlFillMemory(Buffer, BufferSize, 0x55); \
84 TestUserObjectInfo(Handle, Index, Buffer, SizeOfString - 2, FALSE, ERROR_INSUFFICIENT_BUFFER, SizeOfString); \
85 _Check = CheckBuffer(Buffer, BufferSize, 0x55); \
86 ok(_Check == TRUE, "CheckBuffer failed\n"); \
87 RtlFillMemory(Buffer, BufferSize, 0x55); \
88 TestUserObjectInfo(Handle, Index, Buffer, SizeOfString - 1, FALSE, ERROR_INSUFFICIENT_BUFFER, SizeOfString); \
89 _Check = CheckBuffer(Buffer, BufferSize, 0x55); \
90 ok(_Check == TRUE, "CheckBuffer failed\n"); \
91 RtlFillMemory(Buffer, BufferSize, 0x55); \
92 Buffer[BufferSize / sizeof(WCHAR) - 1] = UNICODE_NULL; \
93 TestUserObjectInfo(Handle, Index, Buffer, SizeOfString, TRUE, 0xdeadbeef, SizeOfString); \
94 ok(wcscmp(Buffer, String) == 0, "Buffer '%ls', expected '%ls'\n", Buffer, String); \
95 _Check = CheckBuffer(Buffer + SizeOfString / sizeof(Buffer[0]), BufferSize - SizeOfString - sizeof(WCHAR), 0x55); \
96 ok(_Check == TRUE, "CheckBuffer failed\n"); \
97 RtlFillMemory(Buffer, BufferSize, 0x55); \
98 Buffer[BufferSize / sizeof(WCHAR) - 1] = UNICODE_NULL; \
99 TestUserObjectInfo(Handle, Index, Buffer, BufferSize, TRUE, 0xdeadbeef, SizeOfString); \
100 ok(wcscmp(Buffer, String) == 0, "Buffer '%ls', expected '%ls'\n", Buffer, String); \
101 _Check = CheckBuffer(Buffer + SizeOfString / sizeof(Buffer[0]), BufferSize - SizeOfString - sizeof(WCHAR), 0x55); \
102 ok(_Check == TRUE, "CheckBuffer failed\n"); \
117 WCHAR WinStaName[64];
145 skip(
"Failed to get desktop handle\n");
153 skip(
"Failed to get winsta handle\n");
187 L"Service-0x%lx-%lx$",
190 trace(
"Expected autogenerated Winsta name: %ls\n", WinStaName);
206 skip(
"Failed to create winsta\n");
219 skip(
"Failed to create winsta\n");
232 skip(
"Failed to create winsta\n");
245 skip(
"Failed to create winsta\n");
250 ok(Desktop2 ==
NULL,
"CreateDesktopW succeeded\n");
254 ok(Desktop2 ==
NULL,
"CreateDesktopW succeeded\n");
266 skip(
"Failed to create winsta\n");
281#undef TestUserObjectInfo
282#define TestUserObjectInfo(Handle, Index, Buffer, Length, Ret, Error, LengthNeeded) do \
284 DWORD _LengthNeeded = NOTSET; \
285 DECLSPEC_ALIGN(16) CHAR _LengthBuffer[2 * sizeof(DWORD)]; \
289 SetLastError(0xdeadbeef); \
290 _Ret = GetUserObjectInformationA(Handle, Index, Buffer, Length, NULL); \
291 _Error = GetLastError(); \
292 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
293 xok(_Error == (Error), "Error = %lu\n", _Error); \
295 SetLastError(0xdeadbeef); \
296 _Ret = GetUserObjectInformationA(Handle, Index, Buffer, Length, &_LengthNeeded);\
297 _Error = GetLastError(); \
298 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
299 xok(_Error == (Error), "Error = %lu\n", _Error); \
300 xok(_LengthNeeded == (LengthNeeded), "LengthNeeded = %lu\n", _LengthNeeded); \
302 SetLastError(0xdeadbeef); \
303 *(PDWORD)&_LengthBuffer[1] = NOTSET; \
304 _Ret = GetUserObjectInformationA(Handle, Index, Buffer, Length, \
305 (PDWORD)&_LengthBuffer[1]); \
306 _Error = GetLastError(); \
307 ok(_Ret == (Ret), "Ret = %d\n", _Ret); \
308 xok(_Error == (Error), "Error = %lu\n", _Error); \
309 _LengthNeeded = *(PDWORD)&_LengthBuffer[1]; \
310 xok(_LengthNeeded == (LengthNeeded), "LengthNeeded = %lu\n", _LengthNeeded); \
312 SetLastError(0xdeadbeef); \
313 _Ret = GetUserObjectInformationA(Handle, Index, Buffer, Length, (PVOID)-4); \
314 _Error = GetLastError(); \
315 ok(_Ret == FALSE, "Ret = %d\n", _Ret); \
316 ok(_Error == ERROR_NOACCESS, "Error = %lu\n", _Error); \
319#undef TestUserObjectInfoWithString
320#define TestUserObjectInfoWithString(Handle, Index, Buffer, BufferSize, String) do \
323 TestUserObjectInfo(Handle, Index, NULL, 0, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
324 TestUserObjectInfo(Handle, Index, (PVOID)1, 0, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
325 TestUserObjectInfo(Handle, Index, NULL, 1, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
326 TestUserObjectInfo(Handle, Index, (PVOID)1, 1, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
327 RtlFillMemory(Buffer, BufferSize, 0x55); \
328 TestUserObjectInfo(Handle, Index, Buffer, sizeof(String) - 2, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
329 _Check = CheckBuffer(Buffer, BufferSize, 0x55); \
330 ok(_Check == TRUE, "CheckBuffer failed\n"); \
331 RtlFillMemory(Buffer, BufferSize, 0x55); \
332 TestUserObjectInfo(Handle, Index, Buffer, sizeof(String) - 1, FALSE, ERROR_INSUFFICIENT_BUFFER, sizeof(String) * sizeof(WCHAR));\
333 _Check = CheckBuffer(Buffer, BufferSize, 0x55); \
334 ok(_Check == TRUE, "CheckBuffer failed\n"); \
335 RtlFillMemory(Buffer, BufferSize, 0x55); \
336 TestUserObjectInfo(Handle, Index, Buffer, sizeof(String), TRUE, 0xdeadbeef, sizeof(String)); \
337 ok(strcmp(Buffer, String) == 0, "Buffer '%s'\n", Buffer); \
338 _Check = CheckBuffer(Buffer + sizeof(String), BufferSize - sizeof(String), 0x55); \
339 ok(_Check == TRUE, "CheckBuffer failed\n"); \
340 RtlFillMemory(Buffer, BufferSize, 0x55); \
341 TestUserObjectInfo(Handle, Index, Buffer, BufferSize, TRUE, 0xdeadbeef, sizeof(String)); \
342 ok(strcmp(Buffer, String) == 0, "Buffer '%s'\n", Buffer); \
343 _Check = CheckBuffer(Buffer + sizeof(String), BufferSize - sizeof(String), 0x55); \
344 ok(_Check == TRUE, "CheckBuffer failed\n"); \
381 skip(
"Failed to get desktop handle\n");
389 skip(
"Failed to get winsta handle\n");
static VOID FreeGuarded(_In_ PVOID Pointer)
static PVOID AllocateGuarded(_In_ SIZE_T SizeRequested)
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define ERROR_INVALID_PARAMETER
#define GetCurrentProcess()
#define ERROR_INVALID_HANDLE
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_In_ ULONG _In_ ULONG _In_ ULONG Length
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentThreadId(void)
HWINSTA WINAPI GetProcessWindowStation(void)
HDESK WINAPI GetThreadDesktop(_In_ DWORD)
#define DESKTOP_CREATEWINDOW
HWINSTA WINAPI CreateWindowStationW(_In_opt_ LPCWSTR lpwinsta, _In_ DWORD dwFlags, _In_ ACCESS_MASK dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI CloseWindowStation(_In_ HWINSTA)
#define WINSTA_READATTRIBUTES
#define DESKTOP_READOBJECTS
BOOL WINAPI CloseDesktop(_In_ HDESK)
#define GetUserObjectInformation