ReactOS 0.4.16-dev-112-g52265ae
ac.c File Reference
#include <advapi32.h>
Include dependency graph for ac.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (advapi)
 
BOOL WINAPI AddAccessAllowedObjectAce (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID *ObjectTypeGuid, GUID *InheritedObjectTypeGuid, PSID pSid)
 
BOOL WINAPI AddAccessDeniedObjectAce (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID *ObjectTypeGuid, GUID *InheritedObjectTypeGuid, PSID pSid)
 
BOOL WINAPI AddAuditAccessObjectAce (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID *ObjectTypeGuid, GUID *InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure)
 
DWORD WINAPI GetInheritanceSourceW (LPWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, BOOL Container, GUID **pObjectClassGuids OPTIONAL, DWORD GuidCount, PACL pAcl, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PGENERIC_MAPPING pGenericMapping, PINHERITED_FROMW pInheritArray)
 
DWORD WINAPI GetInheritanceSourceA (LPSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, BOOL Container, GUID **pObjectClassGuids OPTIONAL, DWORD GuidCount, PACL pAcl, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PGENERIC_MAPPING pGenericMapping, PINHERITED_FROMA pInheritArray)
 
DWORD WINAPI FreeInheritedFromArray (PINHERITED_FROMW pInheritArray, USHORT AceCnt, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL)
 
DWORD WINAPI SetEntriesInAclW (ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, PACL *NewAcl)
 
static DWORD InternalTrusteeAToW (IN PTRUSTEE_A pTrusteeA, OUT PTRUSTEE_W *pTrusteeW)
 
static __inline VOID InternalFreeConvertedTrustee (IN PTRUSTEE_W pTrusteeW, IN PTRUSTEE_A pTrusteeA)
 
static DWORD InternalExplicitAccessAToW (IN ULONG cCountOfExplicitEntries, IN PEXPLICIT_ACCESS_A pListOfExplicitEntriesA, OUT PEXPLICIT_ACCESS_W *pListOfExplicitEntriesW)
 
DWORD WINAPI SetEntriesInAclA (ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries, PACL OldAcl, PACL *NewAcl)
 
DWORD WINAPI GetExplicitEntriesFromAclW (PACL pacl, PULONG pcCountOfExplicitEntries, PEXPLICIT_ACCESS_W *pListOfExplicitEntries)
 
DWORD WINAPI GetEffectiveRightsFromAclW (IN PACL pacl, IN PTRUSTEE_W pTrustee, OUT PACCESS_MASK pAccessRights)
 
DWORD WINAPI GetEffectiveRightsFromAclA (IN PACL pacl, IN PTRUSTEE_A pTrustee, OUT PACCESS_MASK pAccessRights)
 
DWORD WINAPI GetAuditedPermissionsFromAclW (IN PACL pacl, IN PTRUSTEE_W pTrustee, OUT PACCESS_MASK pSuccessfulAuditedRights, OUT PACCESS_MASK pFailedAuditRights)
 
DWORD WINAPI GetAuditedPermissionsFromAclA (IN PACL pacl, IN PTRUSTEE_A pTrustee, OUT PACCESS_MASK pSuccessfulAuditedRights, OUT PACCESS_MASK pFailedAuditRights)
 

Function Documentation

◆ AddAccessAllowedObjectAce()

BOOL WINAPI AddAccessAllowedObjectAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  AccessMask,
GUID ObjectTypeGuid,
GUID InheritedObjectTypeGuid,
PSID  pSid 
)

Definition at line 18 of file ac.c.

25{
27
32 ObjectTypeGuid,
33 InheritedObjectTypeGuid,
34 pSid);
35 if (!NT_SUCCESS(Status))
36 {
38 return FALSE;
39 }
40
41 return TRUE;
42}
LONG NTSTATUS
Definition: precomp.h:26
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static const ACEFLAG AceFlags[]
Definition: security.c:2624
#define SetLastError(x)
Definition: compat.h:752
Status
Definition: gdiplustypes.h:25
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static PSID pSid
Definition: security.c:74
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
NTSYSAPI NTSTATUS NTAPI RtlAddAccessAllowedObjectAce(_Inout_ PACL pAcl, _In_ ULONG dwAceRevision, _In_ ULONG AceFlags, _In_ ACCESS_MASK AccessMask, _In_opt_ GUID *ObjectTypeGuid, _In_opt_ GUID *InheritedObjectTypeGuid, _In_ PSID pSid)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1153

◆ AddAccessDeniedObjectAce()

BOOL WINAPI AddAccessDeniedObjectAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  AccessMask,
GUID ObjectTypeGuid,
GUID InheritedObjectTypeGuid,
PSID  pSid 
)

Definition at line 49 of file ac.c.

56{
58
63 ObjectTypeGuid,
64 InheritedObjectTypeGuid,
65 pSid);
66 if (!NT_SUCCESS(Status))
67 {
69 return FALSE;
70 }
71
72 return TRUE;
73}
NTSYSAPI NTSTATUS NTAPI RtlAddAccessDeniedObjectAce(_Inout_ PACL pAcl, _In_ ULONG dwAceRevision, _In_ ULONG AceFlags, _In_ ACCESS_MASK AccessMask, _In_opt_ GUID *ObjectTypeGuid, _In_opt_ GUID *InheritedObjectTypeGuid, _In_ PSID pSid)

◆ AddAuditAccessObjectAce()

BOOL WINAPI AddAuditAccessObjectAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  AccessMask,
GUID ObjectTypeGuid,
GUID InheritedObjectTypeGuid,
PSID  pSid,
BOOL  bAuditSuccess,
BOOL  bAuditFailure 
)

Definition at line 80 of file ac.c.

89{
91
96 ObjectTypeGuid,
97 InheritedObjectTypeGuid,
98 pSid,
99 bAuditSuccess,
100 bAuditFailure);
101 if (!NT_SUCCESS(Status))
102 {
104 return FALSE;
105 }
106
107 return TRUE;
108}
NTSYSAPI NTSTATUS NTAPI RtlAddAuditAccessObjectAce(_Inout_ PACL Acl, _In_ ULONG Revision, _In_ ULONG Flags, _In_ ACCESS_MASK AccessMask, _In_opt_ GUID *ObjectTypeGuid, _In_opt_ GUID *InheritedObjectTypeGuid, _In_ PSID Sid, _In_ BOOLEAN Success, _In_ BOOLEAN Failure)

◆ FreeInheritedFromArray()

DWORD WINAPI FreeInheritedFromArray ( PINHERITED_FROMW  pInheritArray,
USHORT  AceCnt,
PFN_OBJECT_MGR_FUNCTS pfnArray  OPTIONAL 
)

Definition at line 175 of file ac.c.

178{
180
183 {
184 /* call the MARTA provider */
185 ErrorCode = AccFreeIndexArray(pInheritArray,
186 AceCnt,
187 pfnArray);
188 }
189
190 return ErrorCode;
191}
DWORD CheckNtMartaPresent(VOID)
Definition: misc.c:74
#define AccFreeIndexArray
Definition: advapi32.h:179
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436

Referenced by ISecurityObjectTypeInfo_fnGetInheritSource().

◆ GetAuditedPermissionsFromAclA()

DWORD WINAPI GetAuditedPermissionsFromAclA ( IN PACL  pacl,
IN PTRUSTEE_A  pTrustee,
OUT PACCESS_MASK  pSuccessfulAuditedRights,
OUT PACCESS_MASK  pFailedAuditRights 
)

Definition at line 733 of file ac.c.

737{
738 PTRUSTEE_W pTrusteeW = NULL;
740
742 &pTrusteeW);
744 {
746 pTrusteeW,
747 pSuccessfulAuditedRights,
748 pFailedAuditRights);
749
751 pTrustee);
752 }
753 else
755
756 return ErrorCode;
757}
static DWORD InternalTrusteeAToW(IN PTRUSTEE_A pTrusteeA, OUT PTRUSTEE_W *pTrusteeW)
Definition: ac.c:226
static __inline VOID InternalFreeConvertedTrustee(IN PTRUSTEE_W pTrusteeW, IN PTRUSTEE_A pTrusteeA)
Definition: ac.c:395
DWORD WINAPI GetAuditedPermissionsFromAclW(IN PACL pacl, IN PTRUSTEE_W pTrustee, OUT PACCESS_MASK pSuccessfulAuditedRights, OUT PACCESS_MASK pFailedAuditRights)
Definition: ac.c:718
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112

◆ GetAuditedPermissionsFromAclW()

DWORD WINAPI GetAuditedPermissionsFromAclW ( IN PACL  pacl,
IN PTRUSTEE_W  pTrustee,
OUT PACCESS_MASK  pSuccessfulAuditedRights,
OUT PACCESS_MASK  pFailedAuditRights 
)

Definition at line 718 of file ac.c.

722{
723 FIXME("%s() not implemented!\n", __FUNCTION__);
725}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define __FUNCTION__
Definition: types.h:116

Referenced by GetAuditedPermissionsFromAclA().

◆ GetEffectiveRightsFromAclA()

DWORD WINAPI GetEffectiveRightsFromAclA ( IN PACL  pacl,
IN PTRUSTEE_A  pTrustee,
OUT PACCESS_MASK  pAccessRights 
)

Definition at line 688 of file ac.c.

691{
692 PTRUSTEE_W pTrusteeW = NULL;
694
696 &pTrusteeW);
698 {
700 pTrusteeW,
701 pAccessRights);
702
704 pTrustee);
705 }
706 else
708
709 return ErrorCode;
710}
DWORD WINAPI GetEffectiveRightsFromAclW(IN PACL pacl, IN PTRUSTEE_W pTrustee, OUT PACCESS_MASK pAccessRights)
Definition: ac.c:672

◆ GetEffectiveRightsFromAclW()

DWORD WINAPI GetEffectiveRightsFromAclW ( IN PACL  pacl,
IN PTRUSTEE_W  pTrustee,
OUT PACCESS_MASK  pAccessRights 
)

Definition at line 672 of file ac.c.

675{
676 FIXME("%p %p %p - stub\n", pacl, pTrustee, pAccessRights);
677
678 *pAccessRights = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL;
679 return ERROR_SUCCESS;
680}
#define SPECIFIC_RIGHTS_ALL
Definition: nt_native.h:71
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69

Referenced by GetEffectiveRightsFromAclA().

◆ GetExplicitEntriesFromAclW()

DWORD WINAPI GetExplicitEntriesFromAclW ( PACL  pacl,
PULONG  pcCountOfExplicitEntries,
PEXPLICIT_ACCESS_W pListOfExplicitEntries 
)

Definition at line 648 of file ac.c.

651{
653
656 {
657 /* call the MARTA provider */
659 pcCountOfExplicitEntries,
660 pListOfExplicitEntries);
661 }
662
663 return ErrorCode;
664}
#define AccRewriteGetExplicitEntriesFromAcl
Definition: advapi32.h:176

◆ GetInheritanceSourceA()

DWORD WINAPI GetInheritanceSourceA ( LPSTR  pObjectName,
SE_OBJECT_TYPE  ObjectType,
SECURITY_INFORMATION  SecurityInfo,
BOOL  Container,
GUID **pObjectClassGuids  OPTIONAL,
DWORD  GuidCount,
PACL  pAcl,
PFN_OBJECT_MGR_FUNCTS pfnArray  OPTIONAL,
PGENERIC_MAPPING  pGenericMapping,
PINHERITED_FROMA  pInheritArray 
)

Definition at line 153 of file ac.c.

163{
164 /* That's all this function does, at least up to w2k3... Even MS was too
165 lazy to implement it... */
167}

◆ GetInheritanceSourceW()

DWORD WINAPI GetInheritanceSourceW ( LPWSTR  pObjectName,
SE_OBJECT_TYPE  ObjectType,
SECURITY_INFORMATION  SecurityInfo,
BOOL  Container,
GUID **pObjectClassGuids  OPTIONAL,
DWORD  GuidCount,
PACL  pAcl,
PFN_OBJECT_MGR_FUNCTS pfnArray  OPTIONAL,
PGENERIC_MAPPING  pGenericMapping,
PINHERITED_FROMW  pInheritArray 
)

Definition at line 115 of file ac.c.

125{
127
130 {
131 /* call the MARTA provider */
134 SecurityInfo,
135 Container,
136 pObjectClassGuids,
137 GuidCount,
138 pAcl,
139 pfnArray,
140 pGenericMapping,
141 pInheritArray);
142 }
143
144 return ErrorCode;
145}
#define AccGetInheritanceSource
Definition: advapi32.h:178
ObjectType
Definition: metafile.c:81

Referenced by ISecurityObjectTypeInfo_fnGetInheritSource().

◆ InternalExplicitAccessAToW()

static DWORD InternalExplicitAccessAToW ( IN ULONG  cCountOfExplicitEntries,
IN PEXPLICIT_ACCESS_A  pListOfExplicitEntriesA,
OUT PEXPLICIT_ACCESS_W pListOfExplicitEntriesW 
)
static

Definition at line 408 of file ac.c.

411{
412 TRUSTEE_FORM TrusteeForm;
413 SIZE_T Size;
414 ULONG i;
415 ULONG ObjectsAndNameCount = 0;
418 LPSTR lpStr;
419
420 /* NOTE: This code assumes that the size of the TRUSTEE_A and TRUSTEE_W structure matches! */
421 //ASSERT(sizeof(TRUSTEE_A) == sizeof(TRUSTEE_W));
422
423 if (cCountOfExplicitEntries != 0)
424 {
425 /* calculate the size needed */
426 Size = cCountOfExplicitEntries * sizeof(EXPLICIT_ACCESS_W);
427 for (i = 0; i != cCountOfExplicitEntries; i++)
428 {
429 TrusteeForm = GetTrusteeFormA(&pListOfExplicitEntriesA[i].Trustee);
430
431 switch (TrusteeForm)
432 {
433 case TRUSTEE_IS_NAME:
434 {
435 lpStr = GetTrusteeNameA(&pListOfExplicitEntriesA[i].Trustee);
436 if (lpStr != NULL)
437 Size += (strlen(lpStr) + 1) * sizeof(WCHAR);
438 break;
439 }
440
442 {
443 POBJECTS_AND_NAME_A oan = (POBJECTS_AND_NAME_A)GetTrusteeNameA(&pListOfExplicitEntriesA[i].Trustee);
444
447 {
448 Size += (strlen(oan->InheritedObjectTypeName) + 1) * sizeof(WCHAR);
449 }
450
451 if (oan->ptstrName != NULL)
452 Size += (strlen(oan->ptstrName) + 1) * sizeof(WCHAR);
453
454 ObjectsAndNameCount++;
455 break;
456 }
457
458 default:
459 break;
460 }
461 }
462
463 /* allocate the array */
464 peaw = RtlAllocateHeap(RtlGetProcessHeap(),
465 0,
466 Size);
467 if (peaw != NULL)
468 {
470 POBJECTS_AND_NAME_W oan = (POBJECTS_AND_NAME_W)(peaw + cCountOfExplicitEntries);
471 LPWSTR StrBuf = (LPWSTR)(oan + ObjectsAndNameCount);
472
473 /* convert the array to unicode */
474 for (i = 0; i != cCountOfExplicitEntries; i++)
475 {
476 peaw[i].grfAccessPermissions = pListOfExplicitEntriesA[i].grfAccessPermissions;
477 peaw[i].grfAccessMode = pListOfExplicitEntriesA[i].grfAccessMode;
478 peaw[i].grfInheritance = pListOfExplicitEntriesA[i].grfInheritance;
479
480 /* convert or copy the TRUSTEE structure */
481 TrusteeForm = GetTrusteeFormA(&pListOfExplicitEntriesA[i].Trustee);
482 switch (TrusteeForm)
483 {
484 case TRUSTEE_IS_NAME:
485 {
486 lpStr = GetTrusteeNameA(&pListOfExplicitEntriesA[i].Trustee);
487 if (lpStr != NULL)
488 {
489 /* convert the trustee name */
490 BufferSize = strlen(lpStr) + 1;
491
493 0,
494 lpStr,
495 -1,
496 StrBuf,
497 BufferSize) == 0)
498 {
499 goto ConvertErr;
500 }
501 peaw[i].Trustee.ptstrName = StrBuf;
502
503 StrBuf += BufferSize;
504 }
505 else
506 goto RawTrusteeCopy;
507
508 break;
509 }
510
512 {
513 POBJECTS_AND_NAME_A oanA = (POBJECTS_AND_NAME_A)GetTrusteeNameA(&pListOfExplicitEntriesA[i].Trustee);
514
515 /* copy over the parts of the TRUSTEE structure that don't need
516 to be touched */
517 RtlCopyMemory(&peaw[i].Trustee,
518 &pListOfExplicitEntriesA[i].Trustee,
520 ptstrName));
521
522 peaw[i].Trustee.ptstrName = (LPWSTR)oan;
523
524 /* convert the OBJECTS_AND_NAME_A structure */
525 oan->ObjectsPresent = oanA->ObjectsPresent;
526 oan->ObjectType = oanA->ObjectType;
527
530 {
531 /* convert inherited object type name */
533
535 0,
537 -1,
538 StrBuf,
539 BufferSize) == 0)
540 {
541 goto ConvertErr;
542 }
543 oan->InheritedObjectTypeName = StrBuf;
544
545 StrBuf += BufferSize;
546 }
547 else
549
550 if (oanA->ptstrName != NULL)
551 {
552 /* convert the trustee name */
553 BufferSize = strlen(oanA->ptstrName) + 1;
554
556 0,
557 oanA->ptstrName,
558 -1,
559 StrBuf,
560 BufferSize) == 0)
561 {
562 goto ConvertErr;
563 }
564 oan->ptstrName = StrBuf;
565
566 StrBuf += BufferSize;
567 }
568 else
569 oan->ptstrName = NULL;
570
571 /* move on to the next OBJECTS_AND_NAME_A structure */
572 oan++;
573 break;
574 }
575
576 default:
577 {
578RawTrusteeCopy:
579 /* just copy over the TRUSTEE structure, they don't contain any
580 ansi/unicode specific data */
581 RtlCopyMemory(&peaw[i].Trustee,
582 &pListOfExplicitEntriesA[i].Trustee,
583 sizeof(TRUSTEE_A));
584 break;
585 }
586 }
587 }
588
590 *pListOfExplicitEntriesW = peaw;
591 }
592 else
594 }
595
596 return ErrorCode;
597
598ConvertErr:
600
601 /* cleanup */
602 RtlFreeHeap(RtlGetProcessHeap(),
603 0,
604 peaw);
605
606 return ErrorCode;
607}
struct _OBJECTS_AND_NAME_W * POBJECTS_AND_NAME_W
enum _TRUSTEE_FORM TRUSTEE_FORM
struct _EXPLICIT_ACCESS_W EXPLICIT_ACCESS_W
@ TRUSTEE_IS_NAME
Definition: accctrl.h:190
@ TRUSTEE_IS_OBJECTS_AND_NAME
Definition: accctrl.h:193
struct _OBJECTS_AND_NAME_A * POBJECTS_AND_NAME_A
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define BufferSize
Definition: mmc.h:75
LPSTR WINAPI GetTrusteeNameA(PTRUSTEE_A pTrustee)
Definition: security.c:2433
TRUSTEE_FORM WINAPI GetTrusteeFormA(PTRUSTEEA pTrustee)
Definition: security.c:2406
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
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
Definition: glfuncs.h:248
#define ASSERT(a)
Definition: mode.c:44
DWORD grfAccessPermissions
Definition: accctrl.h:340
DWORD grfInheritance
Definition: accctrl.h:342
TRUSTEE_W Trustee
Definition: accctrl.h:343
ACCESS_MODE grfAccessMode
Definition: accctrl.h:341
DWORD ObjectsPresent
Definition: accctrl.h:356
LPSTR InheritedObjectTypeName
Definition: accctrl.h:359
SE_OBJECT_TYPE ObjectType
Definition: accctrl.h:357
LPWSTR InheritedObjectTypeName
Definition: accctrl.h:368
DWORD ObjectsPresent
Definition: accctrl.h:365
SE_OBJECT_TYPE ObjectType
Definition: accctrl.h:366
LPWSTR ptstrName
Definition: accctrl.h:217
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ACE_INHERITED_OBJECT_TYPE_PRESENT
Definition: setypes.h:806
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SetEntriesInAclA().

◆ InternalFreeConvertedTrustee()

static __inline VOID InternalFreeConvertedTrustee ( IN PTRUSTEE_W  pTrusteeW,
IN PTRUSTEE_A  pTrusteeA 
)
static

Definition at line 395 of file ac.c.

397{
398 if ((PVOID)pTrusteeW != (PVOID)pTrusteeA)
399 {
400 RtlFreeHeap(RtlGetProcessHeap(),
401 0,
402 pTrusteeW);
403 }
404}

Referenced by GetAuditedPermissionsFromAclA(), and GetEffectiveRightsFromAclA().

◆ InternalTrusteeAToW()

static DWORD InternalTrusteeAToW ( IN PTRUSTEE_A  pTrusteeA,
OUT PTRUSTEE_W pTrusteeW 
)
static

Definition at line 226 of file ac.c.

228{
229 TRUSTEE_FORM TrusteeForm;
230 INT BufferSize = 0;
231 PSTR lpStr;
233
234 //ASSERT(sizeof(TRUSTEE_W) == sizeof(TRUSTEE_A));
235
236 TrusteeForm = GetTrusteeFormA(pTrusteeA);
237 switch (TrusteeForm)
238 {
239 case TRUSTEE_IS_NAME:
240 {
241 /* directly copy the array, this works as the size of the EXPLICIT_ACCESS_A
242 structure matches the size of the EXPLICIT_ACCESS_W version */
243 lpStr = GetTrusteeNameA(pTrusteeA);
244 if (lpStr != NULL)
245 BufferSize = strlen(lpStr) + 1;
246
247 *pTrusteeW = RtlAllocateHeap(RtlGetProcessHeap(),
248 0,
249 sizeof(TRUSTEE_W) + (BufferSize * sizeof(WCHAR)));
250 if (*pTrusteeW != NULL)
251 {
252 RtlCopyMemory(*pTrusteeW,
253 pTrusteeA,
255 ptstrName));
256
257 if (lpStr != NULL)
258 {
259 (*pTrusteeW)->ptstrName = (PWSTR)((*pTrusteeW) + 1);
260
261 /* convert the trustee's name */
263 0,
264 lpStr,
265 -1,
266 (*pTrusteeW)->ptstrName,
267 BufferSize) == 0)
268 {
269 goto ConvertErr;
270 }
271 }
272 else
273 {
274 RtlFreeHeap(RtlGetProcessHeap(),
275 0,
276 *pTrusteeW);
277 goto NothingToConvert;
278 }
279 }
280 else
282 break;
283 }
284
286 {
289 PWSTR StrBuf;
290
291 /* calculate the size needed */
294 {
296 }
297 if (oanA->ptstrName != NULL)
298 {
299 BufferSize += strlen(oanA->ptstrName) + 1;
300 }
301
302 *pTrusteeW = RtlAllocateHeap(RtlGetProcessHeap(),
303 0,
304 sizeof(TRUSTEE_W) + sizeof(OBJECTS_AND_NAME_W) +
305 (BufferSize * sizeof(WCHAR)));
306
307 if (*pTrusteeW != NULL)
308 {
309 oan = (POBJECTS_AND_NAME_W)((*pTrusteeW) + 1);
310 StrBuf = (PWSTR)(oan + 1);
311
312 /* copy over the parts of the TRUSTEE structure that don't need
313 to be touched */
314 RtlCopyMemory(*pTrusteeW,
315 pTrusteeA,
317 ptstrName));
318
319 (*pTrusteeW)->ptstrName = (LPWSTR)oan;
320
321 /* convert the OBJECTS_AND_NAME_A structure */
322 oan->ObjectsPresent = oanA->ObjectsPresent;
323 oan->ObjectType = oanA->ObjectType;
324
327 {
328 /* convert inherited object type name */
330
332 0,
334 -1,
335 StrBuf,
336 BufferSize) == 0)
337 {
338 goto ConvertErr;
339 }
340 oan->InheritedObjectTypeName = StrBuf;
341
342 StrBuf += BufferSize;
343 }
344 else
346
347 if (oanA->ptstrName != NULL)
348 {
349 /* convert the trustee name */
350 BufferSize = strlen(oanA->ptstrName) + 1;
351
353 0,
354 oanA->ptstrName,
355 -1,
356 StrBuf,
357 BufferSize) == 0)
358 {
359 goto ConvertErr;
360 }
361 oan->ptstrName = StrBuf;
362 }
363 else
364 oan->ptstrName = NULL;
365 }
366 else
368 break;
369 }
370
371 default:
372 {
373NothingToConvert:
374 /* no need to convert anything to unicode */
375 *pTrusteeW = (PTRUSTEE_W)pTrusteeA;
376 break;
377 }
378 }
379
380 return ErrorCode;
381
382ConvertErr:
384
385 /* cleanup */
386 RtlFreeHeap(RtlGetProcessHeap(),
387 0,
388 *pTrusteeW);
389
390 return ErrorCode;
391}
struct _TRUSTEE_W * PTRUSTEE_W
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51

Referenced by GetAuditedPermissionsFromAclA(), and GetEffectiveRightsFromAclA().

◆ SetEntriesInAclA()

DWORD WINAPI SetEntriesInAclA ( ULONG  cCountOfExplicitEntries,
PEXPLICIT_ACCESS_A  pListOfExplicitEntries,
PACL  OldAcl,
PACL NewAcl 
)

Definition at line 615 of file ac.c.

619{
620 PEXPLICIT_ACCESS_W ListOfExplicitEntriesW = NULL;
622
623 ErrorCode = InternalExplicitAccessAToW(cCountOfExplicitEntries,
624 pListOfExplicitEntries,
625 &ListOfExplicitEntriesW);
627 {
628 ErrorCode = SetEntriesInAclW(cCountOfExplicitEntries,
629 ListOfExplicitEntriesW,
630 OldAcl,
631 NewAcl);
632
633 /* free the allocated array */
634 RtlFreeHeap(RtlGetProcessHeap(),
635 0,
636 ListOfExplicitEntriesW);
637 }
638
639 return ErrorCode;
640}
static DWORD InternalExplicitAccessAToW(IN ULONG cCountOfExplicitEntries, IN PEXPLICIT_ACCESS_A pListOfExplicitEntriesA, OUT PEXPLICIT_ACCESS_W *pListOfExplicitEntriesW)
Definition: ac.c:408
DWORD WINAPI SetEntriesInAclW(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, PACL *NewAcl)
Definition: ac.c:199

Referenced by test_reg_create_key(), and test_reg_open_key().

◆ SetEntriesInAclW()

DWORD WINAPI SetEntriesInAclW ( ULONG  cCountOfExplicitEntries,
PEXPLICIT_ACCESS_W  pListOfExplicitEntries,
PACL  OldAcl,
PACL NewAcl 
)

Definition at line 199 of file ac.c.

203{
205
206 if (!NewAcl)
207 {
209 }
210
213 {
214 /* call the MARTA provider */
215 ErrorCode = AccRewriteSetEntriesInAcl(cCountOfExplicitEntries,
216 pListOfExplicitEntries,
217 OldAcl,
218 NewAcl);
219 }
220
221 return ErrorCode;
222}
#define AccRewriteSetEntriesInAcl
Definition: advapi32.h:175
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101

Referenced by DwInitializeSdFromThreadToken(), SetEntriesInAclA(), and START_TEST().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( advapi  )