#include "precomp.h"
#include <strsafe.h>
Go to the source code of this file.
◆ GrantAccess
◆ JOB_LOCKDOWN_UI
Value:
#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD
#define JOB_OBJECT_UILIMIT_DESKTOP
#define JOB_OBJECT_UILIMIT_GLOBALATOMS
#define JOB_OBJECT_UILIMIT_HANDLES
#define JOB_OBJECT_UILIMIT_READCLIPBOARD
#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS
#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS
#define JOB_OBJECT_UILIMIT_EXITWINDOWS
Definition at line 23 of file UserHandleGrantAccess.c.
◆ QUIT_EVENT
| #define QUIT_EVENT L"user32_apitest_UserHandleGrantAccess_quit" |
◆ READY_EVENT
| #define READY_EVENT L"user32_apitest_UserHandleGrantAccess_ready" |
◆ RevokeAccess
◆ CreateRestrictedJob()
Definition at line 34 of file UserHandleGrantAccess.c.
35{
38
41 {
44 }
45
46 if (Restrictions != 0)
47 {
48 Info.UIRestrictionsClass = Restrictions;
53 {
54 skip(
"Setting restrictions 0x%lx failed with %lu\n",
58 }
59 }
60
61 return hJob;
62}
BOOL WINAPI SetInformationJobObject(_In_ HANDLE hJob, _In_ JOBOBJECTINFOCLASS JobObjectInformationClass, _In_reads_bytes_(cbJobObjectInformationLength) LPVOID lpJobObjectInformation, _In_ DWORD cbJobObjectInformationLength)
HANDLE WINAPI CreateJobObjectW(_In_ LPSECURITY_ATTRIBUTES lpJobAttributes, _In_ LPCWSTR lpName)
@ JobObjectBasicUIRestrictions
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
DWORD WINAPI GetLastError(void)
Referenced by RunProcessInJob(), and test_GrantAccess().
◆ RunChild()
Definition at line 395 of file UserHandleGrantAccess.c.
396{
398
399
401
404
406 {
409 }
410
412 {
415 }
416}
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define EVENT_MODIFY_STATE
HWND WINAPI GetDesktopWindow(void)
Referenced by START_TEST().
◆ RunProcessInJob()
Definition at line 292 of file UserHandleGrantAccess.c.
296{
301
304
307 return;
308
311 {
313 return;
314 }
315
316
319
321 {
325 {
326
327
328 skip(
"The test is already running in a job\n");
329 }
330 else
331 {
332 ok(
Success !=
FALSE,
"AssignProcessToJobObject failed with %lu\n",
334
335
336
337
338 if (!RestrictFirst)
339 {
346 ok(
Success !=
FALSE,
"Restricting a populated job failed with %lu\n",
348
349 Info.UIRestrictionsClass = 0;
355 ok(
Success !=
FALSE,
"Clearing the restrictions failed with %lu\n",
357 }
358 }
359 }
360
366
370}
static HANDLE CreateRestrictedJob(_In_ ULONG Restrictions)
static HANDLE StartChild(_Out_ PHANDLE Thread)
#define ERROR_ACCESS_DENIED
BOOL WINAPI AssignProcessToJobObject(_In_ HANDLE hJob, _In_ HANDLE hProcess)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
_In_ BOOL _In_ HANDLE hProcess
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
_In_ WDFDPC _In_ BOOLEAN Wait
Referenced by test_ProcessInJob().
◆ START_TEST()
Definition at line 418 of file UserHandleGrantAccess.c.
419{
422
425 {
427 return;
428 }
429
433}
static void test_ProcessInJob(_In_ BOOL RestrictFirst)
static void RunChild(void)
static void test_GrantAccess(void)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
int winetest_get_mainargs(char ***pargv)
◆ StartChild()
Definition at line 248 of file UserHandleGrantAccess.c.
249{
254
257 sizeof(CommandLine),
258 L"\"%ls\" UserHandleGrantAccess child",
260
261 ZeroMemory(&StartupInfo,
sizeof(StartupInfo));
262 StartupInfo.
cb =
sizeof(StartupInfo);
264
266 CommandLine,
270 0,
273 &StartupInfo,
274 &ProcessInfo))
275 {
279 }
280
283}
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
#define STARTF_USESTDHANDLES
Referenced by RunProcessInJob().
◆ test_GrantAccess()
Definition at line 66 of file UserHandleGrantAccess.c.
67{
71
74 L"UserHandleGrantAccess",
76 0, 0, 10, 10,
80 {
81 skip(
"No window to grant access to\n");
82 return;
83 }
84
85
88 {
91 ok(
Success ==
FALSE,
"Granting to an unrestricted job succeeded\n");
94 }
95
96
97
100 {
103 ok(
Success !=
FALSE,
"Granting to a restricted job failed with %lu\n",
106 }
107
110 {
114
115
119
120
124
125
129
130
133 ok(
Success ==
FALSE,
"Granting a handle that does not exist succeeded\n");
135
136 {
138
140 0, 0, 10, 10,
142 if (hWndGone !=
NULL)
143 {
145
150
151
152
153
158 }
159 }
160
161
162 {
165
167 {
169 0, 0, 10, 10,
171 if (Windows[
i] ==
NULL)
172 {
174 break;
175 }
176
180 }
181
183 {
188 }
189 }
190
191
192
193 {
196
198 {
200 0, 0, 10, 10,
202 if (Windows[
i] ==
NULL)
203 {
205 break;
206 }
207
211 }
212
213
216
217
226 }
227
228
232 }
233
234
237 ok(
Success ==
FALSE,
"Granting against a process handle succeeded\n");
238
242
244}
#define GrantAccess(handle, job)
#define RevokeAccess(handle, job)
#define ERROR_INVALID_PARAMETER
#define GetCurrentProcess()
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
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI DestroyWindow(_In_ HWND)
Referenced by START_TEST().
◆ test_ProcessInJob()
Definition at line 374 of file UserHandleGrantAccess.c.
375{
377
380
381 if (hReady !=
NULL && hQuit !=
NULL)
383 else
385
390}
static void RunProcessInJob(_In_ BOOL RestrictFirst, _In_ HANDLE hReady, _In_ HANDLE hQuit)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Referenced by START_TEST().