@@ -412,6 +412,77 @@ SepReleaseSid(
412
412
}
413
413
}
414
414
415
+ /**
416
+ * @brief
417
+ * Captures a security identifier from a
418
+ * given access control entry. This identifier
419
+ * is valid for the whole of its lifetime.
420
+ *
421
+ * @param[in] AceType
422
+ * The type of an access control entry. This
423
+ * type that is given by the calling thread
424
+ * must coincide with the actual ACE that is
425
+ * given in the second parameter otherwise this
426
+ * can potentially lead to UNDEFINED behavior!
427
+ *
428
+ * @param[in] Ace
429
+ * A pointer to an access control entry, which
430
+ * can be obtained from a DACL.
431
+ *
432
+ * @return
433
+ * Returns a pointer to a security identifier (SID),
434
+ * otherwise NULL is returned if an unsupported ACE
435
+ * type was given to the function.
436
+ */
437
+ PSID
438
+ NTAPI
439
+ SepGetSidFromAce (
440
+ _In_ UCHAR AceType ,
441
+ _In_ PACE Ace )
442
+ {
443
+ PSID Sid ;
444
+ PAGED_CODE ();
445
+
446
+ /* Sanity check */
447
+ ASSERT (Ace );
448
+
449
+ /* Initialize the SID */
450
+ Sid = NULL ;
451
+
452
+ /* Obtain the SID based upon ACE type */
453
+ switch (AceType )
454
+ {
455
+ case ACCESS_DENIED_ACE_TYPE :
456
+ {
457
+ Sid = (PSID )& ((PACCESS_DENIED_ACE )Ace )-> SidStart ;
458
+ break ;
459
+ }
460
+
461
+ case ACCESS_ALLOWED_ACE_TYPE :
462
+ {
463
+ Sid = (PSID )& ((PACCESS_ALLOWED_ACE )Ace )-> SidStart ;
464
+ break ;
465
+ }
466
+
467
+ case ACCESS_DENIED_OBJECT_ACE_TYPE :
468
+ {
469
+ Sid = (PSID )& ((PACCESS_DENIED_OBJECT_ACE )Ace )-> SidStart ;
470
+ break ;
471
+ }
472
+
473
+ case ACCESS_ALLOWED_OBJECT_ACE_TYPE :
474
+ {
475
+ Sid = (PSID )& ((PACCESS_ALLOWED_OBJECT_ACE )Ace )-> SidStart ;
476
+ break ;
477
+ }
478
+
479
+ default :
480
+ break ;
481
+ }
482
+
483
+ return Sid ;
484
+ }
485
+
415
486
/**
416
487
* @brief
417
488
* Captures a SID with attributes.
0 commit comments