26 #define ACCESS_ENTRIES(Type) static PH_ACCESS_ENTRY Ph##Type##AccessEntries[] =
27 #define ACCESS_ENTRY(Type, HasSynchronize) \
28 { L#Type, Ph##Type##AccessEntries, sizeof(Ph##Type##AccessEntries), HasSynchronize }
30 typedef struct _PH_SPECIFIC_TYPE
34 ULONG SizeOfAccessEntries;
35 BOOLEAN HasSynchronize;
40 { L
"Synchronize", SYNCHRONIZE,
FALSE,
TRUE },
42 { L
"Read permissions", READ_CONTROL,
FALSE,
TRUE, L
"Read control" },
43 { L
"Change permissions", WRITE_DAC,
FALSE,
TRUE, L
"Write DAC" },
44 { L
"Take ownership", WRITE_OWNER,
FALSE,
TRUE, L
"Write owner" }
68 { L
"Enumerate", DESKTOP_ENUMERATE,
FALSE,
TRUE },
69 { L
"Read objects", DESKTOP_READOBJECTS,
FALSE,
TRUE },
70 { L
"Playback journals", DESKTOP_JOURNALPLAYBACK,
FALSE,
TRUE },
71 { L
"Write objects", DESKTOP_WRITEOBJECTS,
FALSE,
TRUE },
72 { L
"Create windows", DESKTOP_CREATEWINDOW,
FALSE,
TRUE },
73 { L
"Create menus", DESKTOP_CREATEMENU,
FALSE,
TRUE },
74 { L
"Create window hooks", DESKTOP_HOOKCONTROL,
FALSE,
TRUE },
75 { L
"Record journals", DESKTOP_JOURNALRECORD,
FALSE,
TRUE },
76 { L
"Switch desktop", DESKTOP_SWITCHDESKTOP,
FALSE,
TRUE }
81 { L
"Full control", DIRECTORY_ALL_ACCESS,
TRUE, TRUE },
82 { L
"Query", DIRECTORY_QUERY,
TRUE, TRUE},
83 { L
"Traverse", DIRECTORY_TRAVERSE,
TRUE, TRUE},
84 { L
"Create objects", DIRECTORY_CREATE_OBJECT,
TRUE, TRUE},
85 { L
"Create subdirectories", DIRECTORY_CREATE_SUBDIRECTORY,
TRUE, TRUE}
90 { L
"Full control", EVENT_ALL_ACCESS,
TRUE, TRUE },
91 { L
"Query", EVENT_QUERY_STATE,
TRUE, TRUE },
92 { L
"Modify", EVENT_MODIFY_STATE,
TRUE, TRUE }
97 { L
"Full control", EVENT_PAIR_ALL_ACCESS,
TRUE, TRUE }
102 { L
"Full control", FILE_ALL_ACCESS,
TRUE, TRUE },
103 { L
"Read & execute", FILE_GENERIC_READ | FILE_GENERIC_EXECUTE,
TRUE,
FALSE },
104 { L
"Read", FILE_GENERIC_READ,
TRUE,
FALSE },
105 { L
"Write", FILE_GENERIC_WRITE,
TRUE,
FALSE },
106 { L
"Traverse folder / execute file", FILE_EXECUTE,
FALSE,
TRUE, L
"Execute" },
107 { L
"List folder / read data", FILE_READ_DATA,
FALSE,
TRUE, L
"Read data" },
108 { L
"Read attributes", FILE_READ_ATTRIBUTES,
FALSE,
TRUE },
109 { L
"Read extended attributes", FILE_READ_EA,
FALSE,
TRUE, L
"Read EA" },
110 { L
"Create files / write data", FILE_WRITE_DATA,
FALSE,
TRUE, L
"Write data" },
111 { L
"Create folders / append data", FILE_APPEND_DATA,
FALSE,
TRUE, L
"Append data" },
112 { L
"Write attributes", FILE_WRITE_ATTRIBUTES,
FALSE,
TRUE },
113 { L
"Write extended attributes", FILE_WRITE_EA,
FALSE,
TRUE, L
"Write EA" },
114 { L
"Delete subfolders and files", FILE_DELETE_CHILD,
FALSE,
TRUE, L
"Delete child" }
125 { L
"Full control", IO_COMPLETION_ALL_ACCESS,
TRUE, TRUE },
127 { L
"Modify", IO_COMPLETION_MODIFY_STATE,
TRUE, TRUE }
142 { L
"Full control", KEY_ALL_ACCESS,
TRUE, TRUE },
145 { L
"Execute", KEY_EXECUTE,
TRUE,
FALSE },
146 { L
"Enumerate subkeys", KEY_ENUMERATE_SUB_KEYS,
FALSE,
TRUE },
147 { L
"Query values", KEY_QUERY_VALUE,
FALSE,
TRUE },
149 { L
"Set values", KEY_SET_VALUE,
FALSE,
TRUE },
150 { L
"Create subkeys", KEY_CREATE_SUB_KEY,
FALSE,
TRUE },
151 { L
"Create links", KEY_CREATE_LINK,
FALSE,
TRUE }
156 { L
"Full control", KEYEDEVENT_ALL_ACCESS,
TRUE, TRUE },
157 { L
"Wait", KEYEDEVENT_WAIT,
TRUE, TRUE },
158 { L
"Wake", KEYEDEVENT_WAKE,
TRUE, TRUE }
175 { L
"Full control", POLICY_ALL_ACCESS | POLICY_NOTIFICATION,
TRUE, TRUE },
178 { L
"Execute", POLICY_EXECUTE | POLICY_NOTIFICATION,
TRUE,
FALSE },
179 { L
"View local information", POLICY_VIEW_LOCAL_INFORMATION,
FALSE,
TRUE },
180 { L
"View audit information", POLICY_VIEW_AUDIT_INFORMATION,
FALSE,
TRUE },
181 { L
"Get private information", POLICY_GET_PRIVATE_INFORMATION,
FALSE,
TRUE },
182 { L
"Administer trust", POLICY_TRUST_ADMIN,
FALSE,
TRUE },
183 { L
"Create account", POLICY_CREATE_ACCOUNT,
FALSE,
TRUE },
184 { L
"Create secret", POLICY_CREATE_SECRET,
FALSE,
TRUE },
185 { L
"Create privilege", POLICY_CREATE_PRIVILEGE,
FALSE,
TRUE },
186 { L
"Set default quota limits", POLICY_SET_DEFAULT_QUOTA_LIMITS,
FALSE,
TRUE },
187 { L
"Set audit requirements", POLICY_SET_AUDIT_REQUIREMENTS,
FALSE,
TRUE },
188 { L
"Administer audit log", POLICY_AUDIT_LOG_ADMIN,
FALSE,
TRUE },
189 { L
"Administer server", POLICY_SERVER_ADMIN,
FALSE,
TRUE },
190 { L
"Lookup names", POLICY_LOOKUP_NAMES,
FALSE,
TRUE },
191 { L
"Get notifications", POLICY_NOTIFICATION,
FALSE,
TRUE }
221 { L
"Full control", MUTANT_ALL_ACCESS,
TRUE, TRUE },
222 { L
"Query", MUTANT_QUERY_STATE,
TRUE, TRUE }
227 { L
"Full control", STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff,
TRUE,
TRUE },
237 { L
"Duplicate handles", PROCESS_DUP_HANDLE,
TRUE, TRUE },
244 { L
"Full control", STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xffff,
TRUE,
TRUE },
255 { L
"Duplicate handles", PROCESS_DUP_HANDLE,
TRUE, TRUE },
262 { L
"Full control", PROFILE_ALL_ACCESS,
TRUE, TRUE },
263 { L
"Control", PROFILE_CONTROL,
TRUE, TRUE }
346 { L
"Full control", SECTION_ALL_ACCESS,
TRUE, TRUE },
347 { L
"Query", SECTION_QUERY,
TRUE, TRUE },
348 { L
"Map for read", SECTION_MAP_READ,
TRUE,
TRUE, L
"Map read" },
349 { L
"Map for write", SECTION_MAP_WRITE,
TRUE,
TRUE, L
"Map write" },
350 { L
"Map for execute", SECTION_MAP_EXECUTE,
TRUE,
TRUE, L
"Map execute" },
351 { L
"Map for execute (explicit)", SECTION_MAP_EXECUTE_EXPLICIT,
TRUE,
TRUE, L
"Map execute explicit" },
352 { L
"Extend size", SECTION_EXTEND_SIZE,
TRUE, TRUE }
357 { L
"Full control", SEMAPHORE_ALL_ACCESS,
TRUE, TRUE },
358 { L
"Query", SEMAPHORE_QUERY_STATE,
TRUE, TRUE },
359 { L
"Modify", SEMAPHORE_MODIFY_STATE,
TRUE, TRUE }
364 { L
"Full control", SERVICE_ALL_ACCESS,
TRUE, TRUE },
365 { L
"Query status", SERVICE_QUERY_STATUS,
TRUE, TRUE },
366 { L
"Query configuration", SERVICE_QUERY_CONFIG,
TRUE, TRUE },
367 { L
"Modify configuration", SERVICE_CHANGE_CONFIG,
TRUE, TRUE },
368 { L
"Enumerate dependents", SERVICE_ENUMERATE_DEPENDENTS,
TRUE, TRUE },
369 { L
"Start", SERVICE_START,
TRUE, TRUE },
370 { L
"Stop", SERVICE_STOP,
TRUE, TRUE },
371 { L
"Pause / continue", SERVICE_PAUSE_CONTINUE,
TRUE,
TRUE, L
"Pause/continue" },
372 { L
"Interrogate", SERVICE_INTERROGATE,
TRUE, TRUE },
373 { L
"User-defined control", SERVICE_USER_DEFINED_CONTROL,
TRUE, TRUE }
378 { L
"Full control", SESSION_ALL_ACCESS,
TRUE, TRUE },
379 { L
"Query", SESSION_QUERY_ACCESS,
TRUE, TRUE },
380 { L
"Modify", SESSION_MODIFY_ACCESS,
TRUE, TRUE }
385 { L
"Full control", SYMBOLIC_LINK_ALL_ACCESS,
TRUE, TRUE },
386 { L
"Query", SYMBOLIC_LINK_QUERY,
TRUE, TRUE }
391 { L
"Full control", STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3ff,
TRUE,
TRUE },
393 { L
"Set information", THREAD_SET_INFORMATION,
TRUE, TRUE },
394 { L
"Get context", THREAD_GET_CONTEXT,
TRUE, TRUE },
395 { L
"Set context", THREAD_SET_CONTEXT,
TRUE, TRUE },
397 { L
"Alert", THREAD_ALERT,
TRUE, TRUE },
400 { L
"Suspend / resume", THREAD_SUSPEND_RESUME,
TRUE,
TRUE, L
"Suspend/resume" },
401 { L
"Terminate", THREAD_TERMINATE,
TRUE, TRUE },
406 { L
"Full control", STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xffff,
TRUE,
TRUE },
407 { L
"Query limited information", THREAD_QUERY_LIMITED_INFORMATION,
TRUE, TRUE },
409 { L
"Set limited information", THREAD_SET_LIMITED_INFORMATION,
TRUE, TRUE },
410 { L
"Set information", THREAD_SET_INFORMATION | THREAD_SET_LIMITED_INFORMATION,
TRUE, TRUE },
411 { L
"Get context", THREAD_GET_CONTEXT,
TRUE, TRUE },
412 { L
"Set context", THREAD_SET_CONTEXT,
TRUE, TRUE },
414 { L
"Alert", THREAD_ALERT,
TRUE, TRUE },
417 { L
"Suspend / resume", THREAD_SUSPEND_RESUME,
TRUE,
TRUE, L
"Suspend/resume" },
418 { L
"Terminate", THREAD_TERMINATE,
TRUE, TRUE },
423 { L
"Full control", TIMER_ALL_ACCESS,
TRUE, TRUE },
424 { L
"Query", TIMER_QUERY_STATE,
TRUE, TRUE },
425 { L
"Modify", TIMER_MODIFY_STATE,
TRUE, TRUE }
430 { L
"Full control", ENLISTMENT_ALL_ACCESS,
TRUE, TRUE },
431 { L
"Read", ENLISTMENT_GENERIC_READ,
TRUE,
FALSE },
432 { L
"Write", ENLISTMENT_GENERIC_WRITE,
TRUE,
FALSE },
433 { L
"Execute", ENLISTMENT_GENERIC_EXECUTE,
TRUE,
FALSE },
434 { L
"Query information", ENLISTMENT_QUERY_INFORMATION,
FALSE,
TRUE },
435 { L
"Set information", ENLISTMENT_SET_INFORMATION,
FALSE,
TRUE },
436 { L
"Recover", ENLISTMENT_RECOVER,
FALSE,
TRUE },
437 { L
"Subordinate rights", ENLISTMENT_SUBORDINATE_RIGHTS,
FALSE,
TRUE },
438 { L
"Superior rights", ENLISTMENT_SUPERIOR_RIGHTS,
FALSE,
TRUE }
443 { L
"Full control", RESOURCEMANAGER_ALL_ACCESS,
TRUE, TRUE },
444 { L
"Read", RESOURCEMANAGER_GENERIC_READ,
TRUE,
FALSE },
445 { L
"Write", RESOURCEMANAGER_GENERIC_WRITE,
TRUE,
FALSE },
446 { L
"Execute", RESOURCEMANAGER_GENERIC_EXECUTE,
TRUE,
FALSE },
447 { L
"Query information", RESOURCEMANAGER_QUERY_INFORMATION,
FALSE,
TRUE },
448 { L
"Set information", RESOURCEMANAGER_SET_INFORMATION,
FALSE,
TRUE },
449 { L
"Get notifications", RESOURCEMANAGER_GET_NOTIFICATION,
FALSE,
TRUE },
450 { L
"Enlist", RESOURCEMANAGER_ENLIST,
FALSE,
TRUE },
451 { L
"Recover", RESOURCEMANAGER_RECOVER,
FALSE,
TRUE },
452 { L
"Register protocols", RESOURCEMANAGER_REGISTER_PROTOCOL,
FALSE,
TRUE },
453 { L
"Complete propagation", RESOURCEMANAGER_COMPLETE_PROPAGATION,
FALSE,
TRUE }
458 { L
"Full control", TRANSACTIONMANAGER_ALL_ACCESS,
TRUE, TRUE },
459 { L
"Read", TRANSACTIONMANAGER_GENERIC_READ,
TRUE,
FALSE },
460 { L
"Write", TRANSACTIONMANAGER_GENERIC_WRITE,
TRUE,
FALSE },
461 { L
"Execute", TRANSACTIONMANAGER_GENERIC_EXECUTE,
TRUE,
FALSE },
462 { L
"Query information", TRANSACTIONMANAGER_QUERY_INFORMATION,
FALSE,
TRUE },
463 { L
"Set information", TRANSACTIONMANAGER_SET_INFORMATION,
FALSE,
TRUE },
464 { L
"Recover", TRANSACTIONMANAGER_RECOVER,
FALSE,
TRUE },
465 { L
"Rename", TRANSACTIONMANAGER_RENAME,
FALSE,
TRUE },
466 { L
"Create resource manager", TRANSACTIONMANAGER_CREATE_RM,
FALSE,
TRUE },
467 { L
"Bind transactions", TRANSACTIONMANAGER_BIND_TRANSACTION,
FALSE,
TRUE }
472 { L
"Full control", TRANSACTION_ALL_ACCESS,
TRUE, TRUE },
473 { L
"Read", TRANSACTION_GENERIC_READ,
TRUE,
FALSE },
474 { L
"Write", TRANSACTION_GENERIC_WRITE,
TRUE,
FALSE },
475 { L
"Execute", TRANSACTION_GENERIC_EXECUTE,
TRUE,
FALSE },
476 { L
"Query information", TRANSACTION_QUERY_INFORMATION,
FALSE,
TRUE },
477 { L
"Set information", TRANSACTION_SET_INFORMATION,
FALSE,
TRUE },
478 { L
"Enlist", TRANSACTION_ENLIST,
FALSE,
TRUE },
479 { L
"Commit", TRANSACTION_COMMIT,
FALSE,
TRUE },
480 { L
"Rollback", TRANSACTION_ROLLBACK,
FALSE,
TRUE },
481 { L
"Propagate", TRANSACTION_PROPAGATE,
FALSE,
TRUE }
486 { L
"Full control", TOKEN_ALL_ACCESS,
TRUE, TRUE },
489 { L
"Execute", TOKEN_EXECUTE,
TRUE,
FALSE },
490 { L
"Adjust privileges", TOKEN_ADJUST_PRIVILEGES,
FALSE,
TRUE },
491 { L
"Adjust groups", TOKEN_ADJUST_GROUPS,
FALSE,
TRUE },
492 { L
"Adjust defaults", TOKEN_ADJUST_DEFAULT,
FALSE,
TRUE },
493 { L
"Adjust session ID", TOKEN_ADJUST_SESSIONID,
FALSE,
TRUE },
494 { L
"Assign as primary token", TOKEN_ASSIGN_PRIMARY,
FALSE,
TRUE, L
"Assign primary" },
495 { L
"Duplicate", TOKEN_DUPLICATE,
FALSE,
TRUE },
496 { L
"Impersonate", TOKEN_IMPERSONATE,
FALSE,
TRUE },
498 { L
"Query source", TOKEN_QUERY_SOURCE,
FALSE,
TRUE }
503 { L
"Full control", WORKER_FACTORY_ALL_ACCESS,
TRUE, TRUE },
504 { L
"Release worker", WORKER_FACTORY_RELEASE_WORKER,
FALSE,
TRUE },
505 { L
"Ready worker", WORKER_FACTORY_READY_WORKER,
FALSE,
TRUE },
506 { L
"Wait", WORKER_FACTORY_WAIT,
FALSE,
TRUE },
507 { L
"Set information", WORKER_FACTORY_SET_INFORMATION,
FALSE,
TRUE },
508 { L
"Query information", WORKER_FACTORY_QUERY_INFORMATION,
FALSE,
TRUE },
509 { L
"Shutdown", WORKER_FACTORY_SHUTDOWN,
FALSE,
TRUE }
514 { L
"Full control", OBJECT_TYPE_ALL_ACCESS,
TRUE, TRUE },
515 { L
"Create", OBJECT_TYPE_CREATE,
TRUE, TRUE }
520 { L
"Full control", WINSTA_ALL_ACCESS | STANDARD_RIGHTS_REQUIRED,
TRUE, TRUE },
524 { L
"Enumerate", WINSTA_ENUMERATE,
FALSE,
TRUE },
525 { L
"Enumerate desktops", WINSTA_ENUMDESKTOPS,
FALSE,
TRUE },
526 { L
"Read attributes", WINSTA_READATTRIBUTES,
FALSE,
TRUE },
527 { L
"Read screen", WINSTA_READSCREEN,
FALSE,
TRUE },
528 { L
"Access clipboard", WINSTA_ACCESSCLIPBOARD,
FALSE,
TRUE },
529 { L
"Access global atoms", WINSTA_ACCESSGLOBALATOMS,
FALSE,
TRUE },
530 { L
"Create desktop", WINSTA_CREATEDESKTOP,
FALSE,
TRUE },
531 { L
"Write attributes", WINSTA_WRITEATTRIBUTES,
FALSE,
TRUE },
532 { L
"Exit windows", WINSTA_EXITWINDOWS,
FALSE,
TRUE }
537 { L
"Full control", WMIGUID_ALL_ACCESS,
TRUE, TRUE },
541 { L
"Query information", WMIGUID_QUERY,
FALSE,
TRUE },
542 { L
"Set information", WMIGUID_SET,
FALSE,
TRUE },
543 { L
"Get notifications", WMIGUID_NOTIFICATION,
FALSE,
TRUE },
544 { L
"Read description", WMIGUID_READ_DESCRIPTION,
FALSE,
TRUE },
545 { L
"Execute", WMIGUID_EXECUTE,
FALSE,
TRUE },
546 { L
"Create real-time logs", TRACELOG_CREATE_REALTIME,
FALSE,
TRUE, L
"Create real-time" },
547 { L
"Create on disk logs", TRACELOG_CREATE_ONDISK,
FALSE,
TRUE, L
"Create on disk" },
548 { L
"Enable provider GUIDs", TRACELOG_GUID_ENABLE,
FALSE,
TRUE, L
"Enable GUIDs" },
549 { L
"Access kernel logger", TRACELOG_ACCESS_KERNEL_LOGGER,
FALSE,
TRUE },
550 { L
"Log events", TRACELOG_LOG_EVENT,
FALSE,
TRUE },
551 { L
"Access real-time events", TRACELOG_ACCESS_REALTIME,
FALSE,
TRUE, L
"Access real-time" },
552 { L
"Register provider GUIDs", TRACELOG_REGISTER_GUIDS,
FALSE,
TRUE, L
"Register GUIDs" }
615 _Out_ PULONG NumberOfAccessEntries
650 specificType = &PhSpecificTypes[i];
661 if (specificType->HasSynchronize)
662 sizeOfEntries = specificType->SizeOfAccessEntries +
sizeof(PhStandardAccessEntries);
664 sizeOfEntries = specificType->SizeOfAccessEntries +
sizeof(PhStandardAccessEntries) -
sizeof(
PH_ACCESS_ENTRY);
666 accessEntries = PhAllocate(sizeOfEntries);
667 memcpy(accessEntries, specificType->AccessEntries, specificType->SizeOfAccessEntries);
669 if (specificType->HasSynchronize)
673 PhStandardAccessEntries,
674 sizeof(PhStandardAccessEntries)
681 &PhStandardAccessEntries[1],
686 *AccessEntries = accessEntries;
691 accessEntries = PhAllocate(
sizeof(PhStandardAccessEntries));
692 memcpy(accessEntries, PhStandardAccessEntries,
sizeof(PhStandardAccessEntries));
694 *AccessEntries = accessEntries;
695 *NumberOfAccessEntries =
sizeof(PhStandardAccessEntries) /
sizeof(
PH_ACCESS_ENTRY);
701 static int __cdecl PhpAccessEntryCompare(
702 _In_
const void *elem1,
703 _In_
const void *elem2
724 _In_ ACCESS_MASK Access,
726 _In_ ULONG NumberOfAccessEntries
740 qsort(accessEntries, NumberOfAccessEntries,
sizeof(
PH_ACCESS_ENTRY), PhpAccessEntryCompare);
742 matched = PhAllocate(NumberOfAccessEntries *
sizeof(BOOLEAN));
743 memset(matched, 0, NumberOfAccessEntries *
sizeof(BOOLEAN));
745 for (i = 0; i < NumberOfAccessEntries; i++)
753 ((Access & accessEntries[i].Access) == accessEntries[i].Access)
756 if (accessEntries[i].ShortName)
764 for (j = i; j < NumberOfAccessEntries; j++)
766 if ((accessEntries[i].Access | accessEntries[j].Access) == accessEntries[i].Access)