3 * COPYRIGHT: See COPYING in the top level directory
5 * Copyright 1999, 2000 Juergen Schmied <juergen.schmied@debitel.net>
6 * Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
8 * PROJECT: ReactOS system libraries
9 * FILE: lib/advapi32/sec/sid.c
10 * PURPOSE: Security ID functions
14 #include <wine/debug.h>
15 #include <wine/unicode.h>
17 WINE_DEFAULT_DEBUG_CHANNEL(advapi
);
20 static BOOL
ParseStringSidToSid(LPCWSTR StringSid
, PSID pSid
, LPDWORD cBytes
);
21 static BOOL
ParseStringAclToAcl(LPCWSTR StringAcl
, LPDWORD lpdwFlags
,
22 PACL pAcl
, LPDWORD cBytes
);
23 static BYTE
ParseAceStringFlags(LPCWSTR
* StringAcl
);
24 static BYTE
ParseAceStringType(LPCWSTR
* StringAcl
);
25 static DWORD
ParseAceStringRights(LPCWSTR
* StringAcl
);
26 static DWORD
ParseAclStringFlags(LPCWSTR
* StringAcl
);
28 typedef struct _ACEFLAG
32 } ACEFLAG
, *LPACEFLAG
;
34 static SID
const sidWorld
= { SID_REVISION
, 1, { SECURITY_WORLD_SID_AUTHORITY
} , { SECURITY_WORLD_RID
} };
39 static const WCHAR SDDL_READ_CONTROL
[] = {'R','C',0};
40 static const WCHAR SDDL_WRITE_DAC
[] = {'W','D',0};
41 static const WCHAR SDDL_WRITE_OWNER
[] = {'W','O',0};
42 static const WCHAR SDDL_STANDARD_DELETE
[] = {'S','D',0};
43 static const WCHAR SDDL_GENERIC_ALL
[] = {'G','A',0};
44 static const WCHAR SDDL_GENERIC_READ
[] = {'G','R',0};
45 static const WCHAR SDDL_GENERIC_WRITE
[] = {'G','W',0};
46 static const WCHAR SDDL_GENERIC_EXECUTE
[] = {'G','X',0};
51 static const WCHAR SDDL_ACCESS_ALLOWED
[] = {'A',0};
52 static const WCHAR SDDL_ACCESS_DENIED
[] = {'D',0};
53 static const WCHAR SDDL_OBJECT_ACCESS_ALLOWED
[] = {'O','A',0};
54 static const WCHAR SDDL_OBJECT_ACCESS_DENIED
[] = {'O','D',0};
55 static const WCHAR SDDL_AUDIT
[] = {'A','U',0};
56 static const WCHAR SDDL_ALARM
[] = {'A','L',0};
57 static const WCHAR SDDL_OBJECT_AUDIT
[] = {'O','U',0};
58 static const WCHAR SDDL_OBJECT_ALARMp
[] = {'O','L',0};
63 static const WCHAR SDDL_CONTAINER_INHERIT
[] = {'C','I',0};
64 static const WCHAR SDDL_OBJECT_INHERIT
[] = {'O','I',0};
65 static const WCHAR SDDL_NO_PROPAGATE
[] = {'N','P',0};
66 static const WCHAR SDDL_INHERIT_ONLY
[] = {'I','O',0};
67 static const WCHAR SDDL_INHERITED
[] = {'I','D',0};
68 static const WCHAR SDDL_AUDIT_SUCCESS
[] = {'S','A',0};
69 static const WCHAR SDDL_AUDIT_FAILURE
[] = {'F','A',0};
71 /* set last error code from NT status and get the proper boolean return value */
72 /* used for functions that are a simple wrapper around the corresponding ntdll API */
73 static inline BOOL
set_ntstatus( NTSTATUS status
)
75 if (status
) SetLastError( RtlNtStatusToDosError( status
));
79 #define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + sizeof(sidWorld) - sizeof(DWORD))
82 /* some helper functions - taken from winehq cvs 20050916 */
83 /******************************************************************************
84 * ComputeStringSidSize
86 static DWORD
ComputeStringSidSize(LPCWSTR StringSid
)
89 DWORD size
= sizeof(SID
);
93 if (*StringSid
== '-')
99 size
+= (ctok
- 3) * sizeof(DWORD
);
104 /******************************************************************************
109 { SDDL_ACCESS_ALLOWED
, ACCESS_ALLOWED_ACE_TYPE
},
110 { SDDL_ALARM
, SYSTEM_ALARM_ACE_TYPE
},
111 { SDDL_AUDIT
, SYSTEM_AUDIT_ACE_TYPE
},
112 { SDDL_ACCESS_DENIED
, ACCESS_DENIED_ACE_TYPE
},
114 { SDDL_OBJECT_ACCESS_ALLOWED, ACCESS_ALLOWED_OBJECT_ACE_TYPE },
115 { SDDL_OBJECT_ACCESS_DENIED, ACCESS_DENIED_OBJECT_ACE_TYPE },
116 { SDDL_OBJECT_ALARM, SYSTEM_ALARM_OBJECT_ACE_TYPE },
117 { SDDL_OBJECT_AUDIT, SYSTEM_AUDIT_OBJECT_ACE_TYPE },
122 static BYTE
ParseAceStringType(LPCWSTR
* StringAcl
)
125 LPCWSTR szAcl
= *StringAcl
;
126 LPACEFLAG lpaf
= AceType
;
129 (len
= strlenW(lpaf
->wstr
)) &&
130 strncmpW(lpaf
->wstr
, szAcl
, len
))
141 /******************************************************************************
142 * ParseAceStringFlags
146 { SDDL_CONTAINER_INHERIT
, CONTAINER_INHERIT_ACE
},
147 { SDDL_AUDIT_FAILURE
, FAILED_ACCESS_ACE_FLAG
},
148 { SDDL_INHERITED
, INHERITED_ACE
},
149 { SDDL_INHERIT_ONLY
, INHERIT_ONLY_ACE
},
150 { SDDL_NO_PROPAGATE
, NO_PROPAGATE_INHERIT_ACE
},
151 { SDDL_OBJECT_INHERIT
, OBJECT_INHERIT_ACE
},
152 { SDDL_AUDIT_SUCCESS
, SUCCESSFUL_ACCESS_ACE_FLAG
},
156 static BYTE
ParseAceStringFlags(LPCWSTR
* StringAcl
)
160 LPCWSTR szAcl
= *StringAcl
;
162 while (*szAcl
!= ';')
164 LPACEFLAG lpaf
= AceFlags
;
167 (len
= strlenW(lpaf
->wstr
)) &&
168 strncmpW(lpaf
->wstr
, szAcl
, len
))
174 flags
|= lpaf
->value
;
183 /******************************************************************************
184 * ParseAceStringRights
186 ACEFLAG AceRights
[] =
188 { SDDL_GENERIC_ALL
, GENERIC_ALL
},
189 { SDDL_GENERIC_READ
, GENERIC_READ
},
190 { SDDL_GENERIC_WRITE
, GENERIC_WRITE
},
191 { SDDL_GENERIC_EXECUTE
, GENERIC_EXECUTE
},
192 { SDDL_READ_CONTROL
, READ_CONTROL
},
193 { SDDL_STANDARD_DELETE
, DELETE
},
194 { SDDL_WRITE_DAC
, WRITE_DAC
},
195 { SDDL_WRITE_OWNER
, WRITE_OWNER
},
199 static DWORD
ParseAceStringRights(LPCWSTR
* StringAcl
)
203 LPCWSTR szAcl
= *StringAcl
;
205 if ((*szAcl
== '0') && (*(szAcl
+ 1) == 'x'))
209 while (*p
&& *p
!= ';')
214 rights
= strtoulW(szAcl
, NULL
, 16);
218 WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl
, p
- szAcl
));
222 while (*szAcl
!= ';')
224 LPACEFLAG lpaf
= AceRights
;
227 (len
= strlenW(lpaf
->wstr
)) &&
228 strncmpW(lpaf
->wstr
, szAcl
, len
))
236 rights
|= lpaf
->value
;
245 /******************************************************************************
246 * ParseStringAclToAcl
248 * dacl_flags(string_ace1)(string_ace2)... (string_acen)
250 static BOOL
ParseStringAclToAcl(LPCWSTR StringAcl
, LPDWORD lpdwFlags
,
251 PACL pAcl
, LPDWORD cBytes
)
255 DWORD length
= sizeof(ACL
);
256 PACCESS_ALLOWED_ACE pAce
= NULL
; /* pointer to current ACE */
258 TRACE("%s\n", debugstr_w(StringAcl
));
263 if (pAcl
) /* pAce is only useful if we're setting values */
264 pAce
= (PACCESS_ALLOWED_ACE
) ((LPBYTE
)pAcl
+ sizeof(PACL
));
266 /* Parse ACL flags */
267 *lpdwFlags
= ParseAclStringFlags(&StringAcl
);
270 while (*StringAcl
== '(')
275 val
= ParseAceStringType(&StringAcl
);
277 pAce
->Header
.AceType
= (BYTE
) val
;
278 if (*StringAcl
!= ';')
282 /* Parse ACE flags */
283 val
= ParseAceStringFlags(&StringAcl
);
285 pAce
->Header
.AceFlags
= (BYTE
) val
;
286 if (*StringAcl
!= ';')
290 /* Parse ACE rights */
291 val
= ParseAceStringRights(&StringAcl
);
294 if (*StringAcl
!= ';')
298 /* Parse ACE object guid */
299 if (*StringAcl
!= ';')
301 FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
306 /* Parse ACE inherit object guid */
307 if (*StringAcl
!= ';')
309 FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
314 /* Parse ACE account sid */
315 if (ParseStringSidToSid(StringAcl
, pAce
? (PSID
)&pAce
->SidStart
: NULL
, &sidlen
))
317 while (*StringAcl
&& *StringAcl
!= ')')
321 if (*StringAcl
!= ')')
325 length
+= sizeof(ACCESS_ALLOWED_ACE
) - sizeof(DWORD
) + sidlen
;
332 WARN("Invalid ACE string format\n");
336 /******************************************************************************
337 * ParseStringSecurityDescriptorToSecurityDescriptor
339 static BOOL
ParseStringSecurityDescriptorToSecurityDescriptor(
340 LPCWSTR StringSecurityDescriptor
,
341 SECURITY_DESCRIPTOR
* SecurityDescriptor
,
348 LPBYTE lpNext
= NULL
;
353 if (SecurityDescriptor
)
354 lpNext
= ((LPBYTE
) SecurityDescriptor
) + sizeof(SECURITY_DESCRIPTOR
);
356 while (*StringSecurityDescriptor
)
358 toktype
= *StringSecurityDescriptor
;
360 /* Expect char identifier followed by ':' */
361 StringSecurityDescriptor
++;
362 if (*StringSecurityDescriptor
!= ':')
364 SetLastError(ERROR_INVALID_PARAMETER
);
367 StringSecurityDescriptor
++;
370 lptoken
= StringSecurityDescriptor
;
371 while (*lptoken
&& *lptoken
!= ':')
377 len
= lptoken
- StringSecurityDescriptor
;
378 memcpy( tok
, StringSecurityDescriptor
, len
* sizeof(WCHAR
) );
387 if (!ParseStringSidToSid(tok
, (PSID
)lpNext
, &bytes
))
390 if (SecurityDescriptor
)
392 SecurityDescriptor
->Owner
= (PSID
) ((DWORD
) lpNext
-
393 (DWORD
) SecurityDescriptor
);
394 lpNext
+= bytes
; /* Advance to next token */
406 if (!ParseStringSidToSid(tok
, (PSID
)lpNext
, &bytes
))
409 if (SecurityDescriptor
)
411 SecurityDescriptor
->Group
= (PSID
) ((DWORD
) lpNext
-
412 (DWORD
) SecurityDescriptor
);
413 lpNext
+= bytes
; /* Advance to next token */
426 if (!ParseStringAclToAcl(tok
, &flags
, (PACL
)lpNext
, &bytes
))
429 if (SecurityDescriptor
)
431 SecurityDescriptor
->Control
|= SE_DACL_PRESENT
| flags
;
432 SecurityDescriptor
->Dacl
= (PACL
) ((DWORD
) lpNext
-
433 (DWORD
) SecurityDescriptor
);
434 lpNext
+= bytes
; /* Advance to next token */
447 if (!ParseStringAclToAcl(tok
, &flags
, (PACL
)lpNext
, &bytes
))
450 if (SecurityDescriptor
)
452 SecurityDescriptor
->Control
|= SE_SACL_PRESENT
| flags
;
453 SecurityDescriptor
->Sacl
= (PACL
) ((DWORD
) lpNext
-
454 (DWORD
) SecurityDescriptor
);
455 lpNext
+= bytes
; /* Advance to next token */
464 FIXME("Unknown token\n");
465 SetLastError(ERROR_INVALID_PARAMETER
);
469 StringSecurityDescriptor
= lptoken
;
478 /******************************************************************************
479 * ParseAclStringFlags
481 static DWORD
ParseAclStringFlags(LPCWSTR
* StringAcl
)
484 LPCWSTR szAcl
= *StringAcl
;
486 while (*szAcl
!= '(')
490 flags
|= SE_DACL_PROTECTED
;
492 else if (*szAcl
== 'A')
496 flags
|= SE_DACL_AUTO_INHERIT_REQ
;
497 else if (*szAcl
== 'I')
498 flags
|= SE_DACL_AUTO_INHERITED
;
507 /******************************************************************************
508 * ParseStringSidToSid
510 static BOOL
ParseStringSidToSid(LPCWSTR StringSid
, PSID pSid
, LPDWORD cBytes
)
515 TRACE("%s, %p, %p\n", debugstr_w(StringSid
), pSid
, cBytes
);
518 SetLastError(ERROR_INVALID_PARAMETER
);
519 TRACE("StringSid is NULL, returning FALSE\n");
523 *cBytes
= ComputeStringSidSize(StringSid
);
524 if (!pisid
) /* Simply compute the size */
526 TRACE("only size requested, returning TRUE\n");
530 if (*StringSid
!= 'S' || *StringSid
!= '-') /* S-R-I-S-S */
532 DWORD i
= 0, identAuth
;
533 DWORD csubauth
= ((*cBytes
- sizeof(SID
)) / sizeof(DWORD
)) + 1;
535 StringSid
+= 2; /* Advance to Revision */
536 pisid
->Revision
= atoiW(StringSid
);
538 if (pisid
->Revision
!= SDDL_REVISION
)
540 TRACE("Revision %d is unknown\n", pisid
->Revision
);
541 goto lend
; /* ERROR_INVALID_SID */
545 TRACE("SubAuthorityCount is 0\n");
546 goto lend
; /* ERROR_INVALID_SID */
549 pisid
->SubAuthorityCount
= csubauth
;
551 /* Advance to identifier authority */
552 while (*StringSid
&& *StringSid
!= '-')
554 if (*StringSid
== '-')
557 /* MS' implementation can't handle values greater than 2^32 - 1, so
558 * we don't either; assume most significant bytes are always 0
560 pisid
->IdentifierAuthority
.Value
[0] = 0;
561 pisid
->IdentifierAuthority
.Value
[1] = 0;
562 identAuth
= atoiW(StringSid
);
563 pisid
->IdentifierAuthority
.Value
[5] = identAuth
& 0xff;
564 pisid
->IdentifierAuthority
.Value
[4] = (identAuth
& 0xff00) >> 8;
565 pisid
->IdentifierAuthority
.Value
[3] = (identAuth
& 0xff0000) >> 16;
566 pisid
->IdentifierAuthority
.Value
[2] = (identAuth
& 0xff000000) >> 24;
568 /* Advance to first sub authority */
569 while (*StringSid
&& *StringSid
!= '-')
571 if (*StringSid
== '-')
576 while (*StringSid
&& *StringSid
!= '-')
579 pisid
->SubAuthority
[i
++] = atoiW(StringSid
);
582 if (i
!= pisid
->SubAuthorityCount
)
583 goto lend
; /* ERROR_INVALID_SID */
587 else /* String constant format - Only available in winxp and above */
589 pisid
->Revision
= SDDL_REVISION
;
590 pisid
->SubAuthorityCount
= 1;
592 FIXME("String constant not supported: %s\n", debugstr_wn(StringSid
, 2));
594 /* TODO: Lookup string of well-known SIDs in table */
595 pisid
->IdentifierAuthority
.Value
[5] = 0;
596 pisid
->SubAuthority
[0] = 0;
603 SetLastError(ERROR_INVALID_SID
);
605 TRACE("returning %s\n", bret
? "TRUE" : "FALSE");
609 /* Exported functions */
615 AllocateLocallyUniqueId(PLUID Luid
)
619 Status
= NtAllocateLocallyUniqueId (Luid
);
620 if (!NT_SUCCESS (Status
))
622 SetLastError (RtlNtStatusToDosError (Status
));
634 AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
635 BYTE nSubAuthorityCount
,
636 DWORD dwSubAuthority0
,
637 DWORD dwSubAuthority1
,
638 DWORD dwSubAuthority2
,
639 DWORD dwSubAuthority3
,
640 DWORD dwSubAuthority4
,
641 DWORD dwSubAuthority5
,
642 DWORD dwSubAuthority6
,
643 DWORD dwSubAuthority7
,
648 Status
= RtlAllocateAndInitializeSid (pIdentifierAuthority
,
659 if (!NT_SUCCESS (Status
))
661 SetLastError (RtlNtStatusToDosError (Status
));
673 CopySid (DWORD nDestinationSidLength
,
674 PSID pDestinationSid
,
679 Status
= RtlCopySid (nDestinationSidLength
,
682 if (!NT_SUCCESS (Status
))
684 SetLastError (RtlNtStatusToDosError (Status
));
690 /* Winehq cvs 20050916 */
691 /******************************************************************************
692 * ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@]
695 BOOL WINAPI
ConvertStringSecurityDescriptorToSecurityDescriptorW(
696 LPCWSTR StringSecurityDescriptor
,
697 DWORD StringSDRevision
,
698 PSECURITY_DESCRIPTOR
* SecurityDescriptor
,
699 PULONG SecurityDescriptorSize
)
702 SECURITY_DESCRIPTOR
* psd
;
705 TRACE("%s\n", debugstr_w(StringSecurityDescriptor
));
707 if (GetVersion() & 0x80000000)
709 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
712 else if (StringSDRevision
!= SID_REVISION
)
714 SetLastError(ERROR_UNKNOWN_REVISION
);
718 /* Compute security descriptor length */
719 if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor
,
723 psd
= *SecurityDescriptor
= (SECURITY_DESCRIPTOR
*) LocalAlloc(
724 GMEM_ZEROINIT
, cBytes
);
726 psd
->Revision
= SID_REVISION
;
727 psd
->Control
|= SE_SELF_RELATIVE
;
729 if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor
,
736 if (SecurityDescriptorSize
)
737 *SecurityDescriptorSize
= cBytes
;
742 TRACE(" ret=%d\n", bret
);
746 /* Winehq cvs 20050916 */
747 /******************************************************************************
748 * ConvertStringSecurityDescriptorToSecurityDescriptorA [ADVAPI32.@]
751 BOOL WINAPI
ConvertStringSecurityDescriptorToSecurityDescriptorA(
752 LPCSTR StringSecurityDescriptor
,
753 DWORD StringSDRevision
,
754 PSECURITY_DESCRIPTOR
* SecurityDescriptor
,
755 PULONG SecurityDescriptorSize
)
759 LPWSTR StringSecurityDescriptorW
;
761 len
= MultiByteToWideChar(CP_ACP
, 0, StringSecurityDescriptor
, -1, NULL
, 0);
762 StringSecurityDescriptorW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
764 if (StringSecurityDescriptorW
)
766 MultiByteToWideChar(CP_ACP
, 0, StringSecurityDescriptor
, -1, StringSecurityDescriptorW
, len
);
768 ret
= ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW
,
769 StringSDRevision
, SecurityDescriptor
,
770 SecurityDescriptorSize
);
771 HeapFree(GetProcessHeap(), 0, StringSecurityDescriptorW
);
781 EqualPrefixSid (PSID pSid1
,
784 return RtlEqualPrefixSid (pSid1
, pSid2
);
792 EqualSid (PSID pSid1
,
795 return RtlEqualSid (pSid1
, pSid2
);
803 * Docs says this function does NOT return a value
804 * even thou it's defined to return a PVOID...
809 return RtlFreeSid (pSid
);
817 GetLengthSid (PSID pSid
)
819 return (DWORD
)RtlLengthSid (pSid
);
826 PSID_IDENTIFIER_AUTHORITY STDCALL
827 GetSidIdentifierAuthority (PSID pSid
)
829 return RtlIdentifierAuthoritySid (pSid
);
837 GetSidLengthRequired (UCHAR nSubAuthorityCount
)
839 return (DWORD
)RtlLengthRequiredSid (nSubAuthorityCount
);
847 GetSidSubAuthority (PSID pSid
,
850 return (PDWORD
)RtlSubAuthoritySid (pSid
, nSubAuthority
);
858 GetSidSubAuthorityCount (PSID pSid
)
860 return RtlSubAuthorityCountSid (pSid
);
868 InitializeSid (PSID Sid
,
869 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
870 BYTE nSubAuthorityCount
)
874 Status
= RtlInitializeSid (Sid
,
875 pIdentifierAuthority
,
877 if (!NT_SUCCESS (Status
))
879 SetLastError (RtlNtStatusToDosError (Status
));
891 IsValidSid (PSID pSid
)
893 return (BOOL
)RtlValidSid (pSid
);
900 ConvertSidToStringSidW(PSID Sid
, LPWSTR
*StringSid
)
903 UNICODE_STRING UnicodeString
;
904 WCHAR FixedBuffer
[64];
906 if (! RtlValidSid(Sid
))
908 SetLastError(ERROR_INVALID_SID
);
912 UnicodeString
.Length
= 0;
913 UnicodeString
.MaximumLength
= sizeof(FixedBuffer
);
914 UnicodeString
.Buffer
= FixedBuffer
;
915 Status
= RtlConvertSidToUnicodeString(&UnicodeString
, Sid
, FALSE
);
916 if (STATUS_BUFFER_TOO_SMALL
== Status
)
918 Status
= RtlConvertSidToUnicodeString(&UnicodeString
, Sid
, TRUE
);
920 if (! NT_SUCCESS(Status
))
922 SetLastError(RtlNtStatusToDosError(Status
));
926 *StringSid
= LocalAlloc(LMEM_FIXED
, UnicodeString
.Length
+ sizeof(WCHAR
));
927 if (NULL
== *StringSid
)
929 if (UnicodeString
.Buffer
!= FixedBuffer
)
931 RtlFreeUnicodeString(&UnicodeString
);
933 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
937 MoveMemory(*StringSid
, UnicodeString
.Buffer
, UnicodeString
.Length
);
938 ZeroMemory((PCHAR
) *StringSid
+ UnicodeString
.Length
, sizeof(WCHAR
));
939 if (UnicodeString
.Buffer
!= FixedBuffer
)
941 RtlFreeUnicodeString(&UnicodeString
);
952 ConvertSidToStringSidA(PSID Sid
, LPSTR
*StringSid
)
957 if (! ConvertSidToStringSidW(Sid
, &StringSidW
))
962 Len
= WideCharToMultiByte(CP_ACP
, 0, StringSidW
, -1, NULL
, 0, NULL
, NULL
);
965 LocalFree(StringSidW
);
966 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
969 *StringSid
= LocalAlloc(LMEM_FIXED
, Len
);
970 if (NULL
== *StringSid
)
972 LocalFree(StringSidW
);
973 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
977 if (! WideCharToMultiByte(CP_ACP
, 0, StringSidW
, -1, *StringSid
, Len
, NULL
, NULL
))
979 LocalFree(StringSid
);
980 LocalFree(StringSidW
);
984 LocalFree(StringSidW
);
994 EqualDomainSid(IN PSID pSid1
,
998 FIXME("%s() not implemented!\n", __FUNCTION__
);
1007 GetWindowsAccountDomainSid(IN PSID pSid
,
1008 OUT PSID ppDomainSid
,
1009 IN OUT DWORD
* cbSid
)
1011 FIXME("%s() not implemented!\n", __FUNCTION__
);
1020 CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType
,
1021 IN PSID DomainSid OPTIONAL
,
1023 IN OUT DWORD
* cbSid
)
1025 FIXME("unimplemented!\n", __FUNCTION__
);
1034 IsWellKnownSid(IN PSID pSid
,
1035 IN WELL_KNOWN_SID_TYPE WellKnownSidType
)
1037 FIXME("unimplemented!\n", __FUNCTION__
);
1046 ConvertStringSidToSidA(
1047 IN LPCSTR StringSid
,
1050 BOOL bRetVal
= FALSE
;
1052 if (!StringSid
|| !sid
)
1053 SetLastError(ERROR_INVALID_PARAMETER
);
1056 UINT len
= MultiByteToWideChar(CP_ACP
, 0, StringSid
, -1, NULL
, 0);
1057 LPWSTR wStringSid
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1058 MultiByteToWideChar(CP_ACP
, 0, StringSid
, - 1, wStringSid
, len
);
1059 bRetVal
= ConvertStringSidToSidW(wStringSid
, sid
);
1060 HeapFree(GetProcessHeap(), 0, wStringSid
);
1069 ConvertStringSidToSidW(
1070 IN LPCWSTR StringSid
,
1073 FIXME("unimplemented!\n", __FUNCTION__
);