[FORMATTING] No code changes!

svn path=/trunk/; revision=36377
This commit is contained in:
Eric Kohl 2008-09-21 13:55:53 +00:00
parent fff44b9cb5
commit b48aef5119
9 changed files with 2116 additions and 2086 deletions

View file

@ -18,22 +18,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
*/ */
BOOL BOOL
STDCALL STDCALL
GetAclInformation ( GetAclInformation(PACL pAcl,
PACL pAcl,
LPVOID pAclInformation, LPVOID pAclInformation,
DWORD nAclInformationLength, DWORD nAclInformationLength,
ACL_INFORMATION_CLASS dwAclInformationClass ACL_INFORMATION_CLASS dwAclInformationClass)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlQueryInformationAcl (pAcl, Status = RtlQueryInformationAcl(pAcl,
pAclInformation, pAclInformation,
nAclInformationLength, nAclInformationLength,
dwAclInformationClass); dwAclInformationClass);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -46,20 +44,18 @@ GetAclInformation (
*/ */
BOOL BOOL
STDCALL STDCALL
InitializeAcl ( InitializeAcl(PACL pAcl,
PACL pAcl,
DWORD nAclLength, DWORD nAclLength,
DWORD dwAclRevision DWORD dwAclRevision)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlCreateAcl (pAcl, Status = RtlCreateAcl(pAcl,
nAclLength, nAclLength,
dwAclRevision); dwAclRevision);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -72,9 +68,7 @@ InitializeAcl (
*/ */
BOOL BOOL
STDCALL STDCALL
IsValidAcl ( IsValidAcl(PACL pAcl)
PACL pAcl
)
{ {
return RtlValidAcl (pAcl); return RtlValidAcl (pAcl);
} }
@ -85,22 +79,20 @@ IsValidAcl (
*/ */
BOOL BOOL
STDCALL STDCALL
SetAclInformation ( SetAclInformation(PACL pAcl,
PACL pAcl,
LPVOID pAclInformation, LPVOID pAclInformation,
DWORD nAclInformationLength, DWORD nAclInformationLength,
ACL_INFORMATION_CLASS dwAclInformationClass ACL_INFORMATION_CLASS dwAclInformationClass)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlSetInformationAcl (pAcl, Status = RtlSetInformationAcl(pAcl,
pAclInformation, pAclInformation,
nAclInformationLength, nAclInformationLength,
dwAclInformationClass); dwAclInformationClass);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -115,22 +107,20 @@ SetAclInformation (
*/ */
BOOL BOOL
STDCALL STDCALL
AddAccessAllowedAce ( AddAccessAllowedAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD AccessMask, DWORD AccessMask,
PSID pSid PSID pSid)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAddAccessAllowedAce (pAcl, Status = RtlAddAccessAllowedAce(pAcl,
dwAceRevision, dwAceRevision,
AccessMask, AccessMask,
pSid); pSid);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -170,13 +160,12 @@ AddAccessAllowedAceEx(PACL pAcl,
*/ */
BOOL BOOL
STDCALL STDCALL
AddAccessAllowedObjectAce( AddAccessAllowedObjectAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD AceFlags, DWORD AceFlags,
DWORD AccessMask, DWORD AccessMask,
GUID* ObjectTypeGuid, GUID *ObjectTypeGuid,
GUID* InheritedObjectTypeGuid, GUID *InheritedObjectTypeGuid,
PSID pSid) PSID pSid)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -203,22 +192,20 @@ AddAccessAllowedObjectAce(
*/ */
BOOL BOOL
STDCALL STDCALL
AddAccessDeniedAce ( AddAccessDeniedAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD AccessMask, DWORD AccessMask,
PSID pSid PSID pSid)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAddAccessDeniedAce (pAcl, Status = RtlAddAccessDeniedAce(pAcl,
dwAceRevision, dwAceRevision,
AccessMask, AccessMask,
pSid); pSid);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -258,8 +245,7 @@ AddAccessDeniedAceEx(PACL pAcl,
*/ */
BOOL BOOL
STDCALL STDCALL
AddAccessDeniedObjectAce( AddAccessDeniedObjectAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD AceFlags, DWORD AceFlags,
DWORD AccessMask, DWORD AccessMask,
@ -291,24 +277,22 @@ AddAccessDeniedObjectAce(
*/ */
BOOL BOOL
STDCALL STDCALL
AddAce ( AddAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD dwStartingAceIndex, DWORD dwStartingAceIndex,
LPVOID pAceList, LPVOID pAceList,
DWORD nAceListLength DWORD nAceListLength)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAddAce (pAcl, Status = RtlAddAce(pAcl,
dwAceRevision, dwAceRevision,
dwStartingAceIndex, dwStartingAceIndex,
pAceList, pAceList,
nAceListLength); nAceListLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -321,18 +305,16 @@ AddAce (
*/ */
BOOL BOOL
STDCALL STDCALL
AddAuditAccessAce ( AddAuditAccessAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD dwAccessMask, DWORD dwAccessMask,
PSID pSid, PSID pSid,
BOOL bAuditSuccess, BOOL bAuditSuccess,
BOOL bAuditFailure BOOL bAuditFailure)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAddAuditAccessAce (pAcl, Status = RtlAddAuditAccessAce(pAcl,
dwAceRevision, dwAceRevision,
dwAccessMask, dwAccessMask,
pSid, pSid,
@ -340,7 +322,7 @@ AddAuditAccessAce (
bAuditFailure); bAuditFailure);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -384,13 +366,12 @@ AddAuditAccessAceEx(PACL pAcl,
*/ */
BOOL BOOL
STDCALL STDCALL
AddAuditAccessObjectAce( AddAuditAccessObjectAce(PACL pAcl,
PACL pAcl,
DWORD dwAceRevision, DWORD dwAceRevision,
DWORD AceFlags, DWORD AceFlags,
DWORD AccessMask, DWORD AccessMask,
GUID* ObjectTypeGuid, GUID *ObjectTypeGuid,
GUID* InheritedObjectTypeGuid, GUID *InheritedObjectTypeGuid,
PSID pSid, PSID pSid,
BOOL bAuditSuccess, BOOL bAuditSuccess,
BOOL bAuditFailure) BOOL bAuditFailure)
@ -450,18 +431,16 @@ AddMandatoryAce(IN OUT PACL pAcl,
*/ */
BOOL BOOL
STDCALL STDCALL
DeleteAce ( DeleteAce(PACL pAcl,
PACL pAcl, DWORD dwAceIndex)
DWORD dwAceIndex
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlDeleteAce (pAcl, Status = RtlDeleteAce(pAcl,
dwAceIndex); dwAceIndex);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -474,12 +453,10 @@ DeleteAce (
*/ */
BOOL BOOL
STDCALL STDCALL
FindFirstFreeAce ( FindFirstFreeAce(PACL pAcl,
PACL pAcl, LPVOID *pAce)
LPVOID * pAce
)
{ {
return RtlFirstFreeAce (pAcl, return RtlFirstFreeAce(pAcl,
(PACE*)pAce); (PACE*)pAce);
} }
@ -489,20 +466,18 @@ FindFirstFreeAce (
*/ */
BOOL BOOL
STDCALL STDCALL
GetAce ( GetAce(PACL pAcl,
PACL pAcl,
DWORD dwAceIndex, DWORD dwAceIndex,
LPVOID * pAce LPVOID *pAce)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetAce (pAcl, Status = RtlGetAce(pAcl,
dwAceIndex, dwAceIndex,
pAce); pAce);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -515,18 +490,16 @@ GetAce (
*/ */
DWORD DWORD
STDCALL STDCALL
GetInheritanceSourceW ( GetInheritanceSourceW(LPWSTR pObjectName,
LPWSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
BOOL Container, BOOL Container,
GUID** pObjectClassGuids OPTIONAL, GUID **pObjectClassGuids OPTIONAL,
DWORD GuidCount, DWORD GuidCount,
PACL pAcl, PACL pAcl,
PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL,
PGENERIC_MAPPING pGenericMapping, PGENERIC_MAPPING pGenericMapping,
PINHERITED_FROMW pInheritArray PINHERITED_FROMW pInheritArray)
)
{ {
DWORD ErrorCode; DWORD ErrorCode;
@ -555,18 +528,16 @@ GetInheritanceSourceW (
*/ */
DWORD DWORD
STDCALL STDCALL
GetInheritanceSourceA ( GetInheritanceSourceA(LPSTR pObjectName,
LPSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
BOOL Container, BOOL Container,
GUID** pObjectClassGuids OPTIONAL, GUID **pObjectClassGuids OPTIONAL,
DWORD GuidCount, DWORD GuidCount,
PACL pAcl, PACL pAcl,
PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL,
PGENERIC_MAPPING pGenericMapping, PGENERIC_MAPPING pGenericMapping,
PINHERITED_FROMA pInheritArray PINHERITED_FROMA pInheritArray)
)
{ {
/* That's all this function does, at least up to w2k3... Even MS was too /* That's all this function does, at least up to w2k3... Even MS was too
lazy to implement it... */ lazy to implement it... */
@ -579,11 +550,9 @@ GetInheritanceSourceA (
*/ */
DWORD DWORD
STDCALL STDCALL
FreeInheritedFromArray ( FreeInheritedFromArray(PINHERITED_FROMW pInheritArray,
PINHERITED_FROMW pInheritArray,
USHORT AceCnt, USHORT AceCnt,
PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL)
)
{ {
DWORD ErrorCode; DWORD ErrorCode;
@ -605,11 +574,10 @@ FreeInheritedFromArray (
*/ */
DWORD DWORD
STDCALL STDCALL
SetEntriesInAclW( SetEntriesInAclW(ULONG cCountOfExplicitEntries,
ULONG cCountOfExplicitEntries,
PEXPLICIT_ACCESS_W pListOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries,
PACL OldAcl, PACL OldAcl,
PACL* NewAcl) PACL *NewAcl)
{ {
DWORD ErrorCode; DWORD ErrorCode;
@ -1013,11 +981,10 @@ RawTrusteeCopy:
*/ */
DWORD DWORD
STDCALL STDCALL
SetEntriesInAclA( SetEntriesInAclA(ULONG cCountOfExplicitEntries,
ULONG cCountOfExplicitEntries,
PEXPLICIT_ACCESS_A pListOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries,
PACL OldAcl, PACL OldAcl,
PACL* NewAcl) PACL *NewAcl)
{ {
PEXPLICIT_ACCESS_W ListOfExplicitEntriesW = NULL; PEXPLICIT_ACCESS_W ListOfExplicitEntriesW = NULL;
DWORD ErrorCode; DWORD ErrorCode;
@ -1025,7 +992,6 @@ SetEntriesInAclA(
ErrorCode = InternalExplicitAccessAToW(cCountOfExplicitEntries, ErrorCode = InternalExplicitAccessAToW(cCountOfExplicitEntries,
pListOfExplicitEntries, pListOfExplicitEntries,
&ListOfExplicitEntriesW); &ListOfExplicitEntriesW);
if (ErrorCode == ERROR_SUCCESS) if (ErrorCode == ERROR_SUCCESS)
{ {
ErrorCode = SetEntriesInAclW(cCountOfExplicitEntries, ErrorCode = SetEntriesInAclW(cCountOfExplicitEntries,
@ -1048,11 +1014,9 @@ SetEntriesInAclA(
*/ */
DWORD DWORD
STDCALL STDCALL
GetExplicitEntriesFromAclW( GetExplicitEntriesFromAclW(PACL pacl,
PACL pacl,
PULONG pcCountOfExplicitEntries, PULONG pcCountOfExplicitEntries,
PEXPLICIT_ACCESS_W* pListOfExplicitEntries PEXPLICIT_ACCESS_W *pListOfExplicitEntries)
)
{ {
DWORD ErrorCode; DWORD ErrorCode;

View file

@ -22,7 +22,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AccessCheckAndAuditAlarmA (LPCSTR SubsystemName, AccessCheckAndAuditAlarmA(LPCSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
LPSTR ObjectTypeName, LPSTR ObjectTypeName,
LPSTR ObjectName, LPSTR ObjectName,
@ -41,14 +41,14 @@ AccessCheckAndAuditAlarmA (LPCSTR SubsystemName,
BOOLEAN GenerateOnClose; BOOLEAN GenerateOnClose;
NTSTATUS Status; NTSTATUS Status;
RtlCreateUnicodeStringFromAsciiz (&SubsystemNameU, RtlCreateUnicodeStringFromAsciiz(&SubsystemNameU,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
RtlCreateUnicodeStringFromAsciiz (&ObjectTypeNameU, RtlCreateUnicodeStringFromAsciiz(&ObjectTypeNameU,
(PCHAR)ObjectTypeName); (PCHAR)ObjectTypeName);
RtlCreateUnicodeStringFromAsciiz (&ObjectNameU, RtlCreateUnicodeStringFromAsciiz(&ObjectNameU,
(PCHAR)ObjectName); (PCHAR)ObjectName);
Status = NtAccessCheckAndAuditAlarm (&SubsystemNameU, Status = NtAccessCheckAndAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
&ObjectTypeNameU, &ObjectTypeNameU,
&ObjectNameU, &ObjectNameU,
@ -59,22 +59,22 @@ AccessCheckAndAuditAlarmA (LPCSTR SubsystemName,
GrantedAccess, GrantedAccess,
&LocalAccessStatus, &LocalAccessStatus,
&GenerateOnClose); &GenerateOnClose);
RtlFreeUnicodeString (&SubsystemNameU); RtlFreeUnicodeString(&SubsystemNameU);
RtlFreeUnicodeString (&ObjectTypeNameU); RtlFreeUnicodeString(&ObjectTypeNameU);
RtlFreeUnicodeString (&ObjectNameU); RtlFreeUnicodeString(&ObjectNameU);
*pfGenerateOnClose = (BOOL)GenerateOnClose; *pfGenerateOnClose = (BOOL)GenerateOnClose;
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
if (!NT_SUCCESS (LocalAccessStatus)) if (!NT_SUCCESS (LocalAccessStatus))
{ {
*AccessStatus = FALSE; *AccessStatus = FALSE;
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -88,7 +88,7 @@ AccessCheckAndAuditAlarmA (LPCSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AccessCheckAndAuditAlarmW (LPCWSTR SubsystemName, AccessCheckAndAuditAlarmW(LPCWSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
LPWSTR ObjectTypeName, LPWSTR ObjectTypeName,
LPWSTR ObjectName, LPWSTR ObjectName,
@ -107,14 +107,14 @@ AccessCheckAndAuditAlarmW (LPCWSTR SubsystemName,
BOOLEAN GenerateOnClose; BOOLEAN GenerateOnClose;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&SubsystemNameU, RtlInitUnicodeString(&SubsystemNameU,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
RtlInitUnicodeString (&ObjectTypeNameU, RtlInitUnicodeString(&ObjectTypeNameU,
(PWSTR)ObjectTypeName); (PWSTR)ObjectTypeName);
RtlInitUnicodeString (&ObjectNameU, RtlInitUnicodeString(&ObjectNameU,
(PWSTR)ObjectName); (PWSTR)ObjectName);
Status = NtAccessCheckAndAuditAlarm (&SubsystemNameU, Status = NtAccessCheckAndAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
&ObjectTypeNameU, &ObjectTypeNameU,
&ObjectNameU, &ObjectNameU,
@ -128,16 +128,16 @@ AccessCheckAndAuditAlarmW (LPCWSTR SubsystemName,
*pfGenerateOnClose = (BOOL)GenerateOnClose; *pfGenerateOnClose = (BOOL)GenerateOnClose;
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
if (!NT_SUCCESS (LocalAccessStatus)) if (!NT_SUCCESS(LocalAccessStatus))
{ {
*AccessStatus = FALSE; *AccessStatus = FALSE;
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -151,54 +151,55 @@ AccessCheckAndAuditAlarmW (LPCWSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectCloseAuditAlarmA (LPCSTR SubsystemName, ObjectCloseAuditAlarmA(LPCSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
BOOL GenerateOnClose) BOOL GenerateOnClose)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
NTSTATUS Status; NTSTATUS Status;
Status = RtlCreateUnicodeStringFromAsciiz (&Name, Status = RtlCreateUnicodeStringFromAsciiz(&Name,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
Status = NtCloseObjectAuditAlarm (&Name, Status = NtCloseObjectAuditAlarm(&Name,
HandleId, HandleId,
GenerateOnClose); GenerateOnClose);
RtlFreeUnicodeString(&Name); RtlFreeUnicodeString(&Name);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectCloseAuditAlarmW (LPCWSTR SubsystemName, ObjectCloseAuditAlarmW(LPCWSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
BOOL GenerateOnClose) BOOL GenerateOnClose)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&Name, RtlInitUnicodeString(&Name,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
Status = NtCloseObjectAuditAlarm (&Name, Status = NtCloseObjectAuditAlarm(&Name,
HandleId, HandleId,
GenerateOnClose); GenerateOnClose);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -210,28 +211,28 @@ ObjectCloseAuditAlarmW (LPCWSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectDeleteAuditAlarmA (LPCSTR SubsystemName, ObjectDeleteAuditAlarmA(LPCSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
BOOL GenerateOnClose) BOOL GenerateOnClose)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
NTSTATUS Status; NTSTATUS Status;
Status = RtlCreateUnicodeStringFromAsciiz (&Name, Status = RtlCreateUnicodeStringFromAsciiz(&Name,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
Status = NtDeleteObjectAuditAlarm (&Name, Status = NtDeleteObjectAuditAlarm(&Name,
HandleId, HandleId,
GenerateOnClose); GenerateOnClose);
RtlFreeUnicodeString(&Name); RtlFreeUnicodeString(&Name);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -243,22 +244,22 @@ ObjectDeleteAuditAlarmA (LPCSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectDeleteAuditAlarmW (LPCWSTR SubsystemName, ObjectDeleteAuditAlarmW(LPCWSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
BOOL GenerateOnClose) BOOL GenerateOnClose)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&Name, RtlInitUnicodeString(&Name,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
Status = NtDeleteObjectAuditAlarm (&Name, Status = NtDeleteObjectAuditAlarm(&Name,
HandleId, HandleId,
GenerateOnClose); GenerateOnClose);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -270,7 +271,7 @@ ObjectDeleteAuditAlarmW (LPCWSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectOpenAuditAlarmA (LPCSTR SubsystemName, ObjectOpenAuditAlarmA(LPCSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
LPSTR ObjectTypeName, LPSTR ObjectTypeName,
LPSTR ObjectName, LPSTR ObjectName,
@ -288,14 +289,14 @@ ObjectOpenAuditAlarmA (LPCSTR SubsystemName,
UNICODE_STRING ObjectNameU; UNICODE_STRING ObjectNameU;
NTSTATUS Status; NTSTATUS Status;
RtlCreateUnicodeStringFromAsciiz (&SubsystemNameU, RtlCreateUnicodeStringFromAsciiz(&SubsystemNameU,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
RtlCreateUnicodeStringFromAsciiz (&ObjectTypeNameU, RtlCreateUnicodeStringFromAsciiz(&ObjectTypeNameU,
(PCHAR)ObjectTypeName); (PCHAR)ObjectTypeName);
RtlCreateUnicodeStringFromAsciiz (&ObjectNameU, RtlCreateUnicodeStringFromAsciiz(&ObjectNameU,
(PCHAR)ObjectName); (PCHAR)ObjectName);
Status = NtOpenObjectAuditAlarm (&SubsystemNameU, Status = NtOpenObjectAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
&ObjectTypeNameU, &ObjectTypeNameU,
&ObjectNameU, &ObjectNameU,
@ -307,12 +308,12 @@ ObjectOpenAuditAlarmA (LPCSTR SubsystemName,
ObjectCreation, ObjectCreation,
AccessGranted, AccessGranted,
(PBOOLEAN)GenerateOnClose); (PBOOLEAN)GenerateOnClose);
RtlFreeUnicodeString (&SubsystemNameU); RtlFreeUnicodeString(&SubsystemNameU);
RtlFreeUnicodeString (&ObjectTypeNameU); RtlFreeUnicodeString(&ObjectTypeNameU);
RtlFreeUnicodeString (&ObjectNameU); RtlFreeUnicodeString(&ObjectNameU);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -324,7 +325,7 @@ ObjectOpenAuditAlarmA (LPCSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectOpenAuditAlarmW (LPCWSTR SubsystemName, ObjectOpenAuditAlarmW(LPCWSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
LPWSTR ObjectTypeName, LPWSTR ObjectTypeName,
LPWSTR ObjectName, LPWSTR ObjectName,
@ -342,14 +343,14 @@ ObjectOpenAuditAlarmW (LPCWSTR SubsystemName,
UNICODE_STRING ObjectNameU; UNICODE_STRING ObjectNameU;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&SubsystemNameU, RtlInitUnicodeString(&SubsystemNameU,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
RtlInitUnicodeString (&ObjectTypeNameU, RtlInitUnicodeString(&ObjectTypeNameU,
(PWSTR)ObjectTypeName); (PWSTR)ObjectTypeName);
RtlInitUnicodeString (&ObjectNameU, RtlInitUnicodeString(&ObjectNameU,
(PWSTR)ObjectName); (PWSTR)ObjectName);
Status = NtOpenObjectAuditAlarm (&SubsystemNameU, Status = NtOpenObjectAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
&ObjectTypeNameU, &ObjectTypeNameU,
&ObjectNameU, &ObjectNameU,
@ -361,9 +362,9 @@ ObjectOpenAuditAlarmW (LPCWSTR SubsystemName,
ObjectCreation, ObjectCreation,
AccessGranted, AccessGranted,
(PBOOLEAN)GenerateOnClose); (PBOOLEAN)GenerateOnClose);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -375,7 +376,7 @@ ObjectOpenAuditAlarmW (LPCWSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectPrivilegeAuditAlarmA (LPCSTR SubsystemName, ObjectPrivilegeAuditAlarmA(LPCSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
HANDLE ClientToken, HANDLE ClientToken,
DWORD DesiredAccess, DWORD DesiredAccess,
@ -385,19 +386,19 @@ ObjectPrivilegeAuditAlarmA (LPCSTR SubsystemName,
UNICODE_STRING SubsystemNameU; UNICODE_STRING SubsystemNameU;
NTSTATUS Status; NTSTATUS Status;
RtlCreateUnicodeStringFromAsciiz (&SubsystemNameU, RtlCreateUnicodeStringFromAsciiz(&SubsystemNameU,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
Status = NtPrivilegeObjectAuditAlarm (&SubsystemNameU, Status = NtPrivilegeObjectAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
ClientToken, ClientToken,
DesiredAccess, DesiredAccess,
Privileges, Privileges,
AccessGranted); AccessGranted);
RtlFreeUnicodeString (&SubsystemNameU); RtlFreeUnicodeString (&SubsystemNameU);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -409,7 +410,7 @@ ObjectPrivilegeAuditAlarmA (LPCSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ObjectPrivilegeAuditAlarmW (LPCWSTR SubsystemName, ObjectPrivilegeAuditAlarmW(LPCWSTR SubsystemName,
LPVOID HandleId, LPVOID HandleId,
HANDLE ClientToken, HANDLE ClientToken,
DWORD DesiredAccess, DWORD DesiredAccess,
@ -419,18 +420,18 @@ ObjectPrivilegeAuditAlarmW (LPCWSTR SubsystemName,
UNICODE_STRING SubsystemNameU; UNICODE_STRING SubsystemNameU;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&SubsystemNameU, RtlInitUnicodeString(&SubsystemNameU,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
Status = NtPrivilegeObjectAuditAlarm (&SubsystemNameU, Status = NtPrivilegeObjectAuditAlarm(&SubsystemNameU,
HandleId, HandleId,
ClientToken, ClientToken,
DesiredAccess, DesiredAccess,
Privileges, Privileges,
AccessGranted); AccessGranted);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -442,7 +443,7 @@ ObjectPrivilegeAuditAlarmW (LPCWSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
PrivilegedServiceAuditAlarmA (LPCSTR SubsystemName, PrivilegedServiceAuditAlarmA(LPCSTR SubsystemName,
LPCSTR ServiceName, LPCSTR ServiceName,
HANDLE ClientToken, HANDLE ClientToken,
PPRIVILEGE_SET Privileges, PPRIVILEGE_SET Privileges,
@ -452,21 +453,21 @@ PrivilegedServiceAuditAlarmA (LPCSTR SubsystemName,
UNICODE_STRING ServiceNameU; UNICODE_STRING ServiceNameU;
NTSTATUS Status; NTSTATUS Status;
RtlCreateUnicodeStringFromAsciiz (&SubsystemNameU, RtlCreateUnicodeStringFromAsciiz(&SubsystemNameU,
(PCHAR)SubsystemName); (PCHAR)SubsystemName);
RtlCreateUnicodeStringFromAsciiz (&ServiceNameU, RtlCreateUnicodeStringFromAsciiz(&ServiceNameU,
(PCHAR)ServiceName); (PCHAR)ServiceName);
Status = NtPrivilegedServiceAuditAlarm (&SubsystemNameU, Status = NtPrivilegedServiceAuditAlarm(&SubsystemNameU,
&ServiceNameU, &ServiceNameU,
ClientToken, ClientToken,
Privileges, Privileges,
AccessGranted); AccessGranted);
RtlFreeUnicodeString (&SubsystemNameU); RtlFreeUnicodeString(&SubsystemNameU);
RtlFreeUnicodeString (&ServiceNameU); RtlFreeUnicodeString(&ServiceNameU);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -478,7 +479,7 @@ PrivilegedServiceAuditAlarmA (LPCSTR SubsystemName,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
PrivilegedServiceAuditAlarmW (LPCWSTR SubsystemName, PrivilegedServiceAuditAlarmW(LPCWSTR SubsystemName,
LPCWSTR ServiceName, LPCWSTR ServiceName,
HANDLE ClientToken, HANDLE ClientToken,
PPRIVILEGE_SET Privileges, PPRIVILEGE_SET Privileges,
@ -488,19 +489,19 @@ PrivilegedServiceAuditAlarmW (LPCWSTR SubsystemName,
UNICODE_STRING ServiceNameU; UNICODE_STRING ServiceNameU;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString (&SubsystemNameU, RtlInitUnicodeString(&SubsystemNameU,
(PWSTR)SubsystemName); (PWSTR)SubsystemName);
RtlInitUnicodeString (&ServiceNameU, RtlInitUnicodeString(&ServiceNameU,
(PWSTR)ServiceName); (PWSTR)ServiceName);
Status = NtPrivilegedServiceAuditAlarm (&SubsystemNameU, Status = NtPrivilegedServiceAuditAlarm(&SubsystemNameU,
&ServiceNameU, &ServiceNameU,
ClientToken, ClientToken,
Privileges, Privileges,
AccessGranted); AccessGranted);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -671,5 +672,4 @@ AccessCheckByTypeAndAuditAlarmA(IN LPCSTR SubsystemName,
return FALSE; return FALSE;
} }
/* EOF */ /* EOF */

View file

@ -12,7 +12,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
/* Needed for LookupAccountNameW implementation from Wine */ /* Needed for LookupAccountNameW implementation from Wine */
typedef struct _AccountSid { typedef struct _AccountSid
{
WELL_KNOWN_SID_TYPE type; WELL_KNOWN_SID_TYPE type;
LPCWSTR account; LPCWSTR account;
LPCWSTR domain; LPCWSTR domain;
@ -139,6 +140,7 @@ static PNTMARTA NtMarta = NULL;
return GetLastError(); \ return GetLastError(); \
} }
static DWORD static DWORD
LoadAndInitializeNtMarta(VOID) LoadAndInitializeNtMarta(VOID)
{ {
@ -180,6 +182,7 @@ LoadAndInitializeNtMarta(VOID)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
DWORD DWORD
CheckNtMartaPresent(VOID) CheckNtMartaPresent(VOID)
{ {
@ -221,7 +224,9 @@ CheckNtMartaPresent(VOID)
return ErrorCode; return ErrorCode;
} }
VOID UnloadNtMarta(VOID)
VOID
UnloadNtMarta(VOID)
{ {
if (InterlockedExchangePointer(&NtMarta, if (InterlockedExchangePointer(&NtMarta,
NULL) != NULL) NULL) != NULL)
@ -230,29 +235,32 @@ VOID UnloadNtMarta(VOID)
} }
} }
/******************************************************************************/ /******************************************************************************/
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
AreAllAccessesGranted(DWORD GrantedAccess, AreAllAccessesGranted(DWORD GrantedAccess,
DWORD DesiredAccess) DWORD DesiredAccess)
{ {
return((BOOL)RtlAreAllAccessesGranted(GrantedAccess, return (BOOL)RtlAreAllAccessesGranted(GrantedAccess,
DesiredAccess)); DesiredAccess);
} }
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
AreAnyAccessesGranted(DWORD GrantedAccess, AreAnyAccessesGranted(DWORD GrantedAccess,
DWORD DesiredAccess) DWORD DesiredAccess)
{ {
return((BOOL)RtlAreAnyAccessesGranted(GrantedAccess, return (BOOL)RtlAreAnyAccessesGranted(GrantedAccess,
DesiredAccess)); DesiredAccess);
} }
@ -278,7 +286,8 @@ AreAnyAccessesGranted(DWORD GrantedAccess,
* *
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL
WINAPI
GetFileSecurityA(LPCSTR lpFileName, GetFileSecurityA(LPCSTR lpFileName,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR pSecurityDescriptor,
@ -312,7 +321,8 @@ GetFileSecurityA(LPCSTR lpFileName,
/* /*
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL
WINAPI
GetFileSecurityW(LPCWSTR lpFileName, GetFileSecurityW(LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR pSecurityDescriptor,
@ -379,7 +389,6 @@ GetFileSecurityW(LPCWSTR lpFileName,
nLength, nLength,
lpnLengthNeeded); lpnLengthNeeded);
NtClose(FileHandle); NtClose(FileHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ERR("NtQuerySecurityObject() failed (Status %lx)\n", Status); ERR("NtQuerySecurityObject() failed (Status %lx)\n", Status);
@ -394,7 +403,8 @@ GetFileSecurityW(LPCWSTR lpFileName,
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
GetKernelObjectSecurity(HANDLE Handle, GetKernelObjectSecurity(HANDLE Handle,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR pSecurityDescriptor,
@ -411,9 +421,10 @@ GetKernelObjectSecurity(HANDLE Handle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return(FALSE); return FALSE;
} }
return(TRUE);
return TRUE;
} }
@ -423,8 +434,9 @@ GetKernelObjectSecurity(HANDLE Handle,
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
SetFileSecurityA (LPCSTR lpFileName, STDCALL
SetFileSecurityA(LPCSTR lpFileName,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor) PSECURITY_DESCRIPTOR pSecurityDescriptor)
{ {
@ -456,8 +468,9 @@ SetFileSecurityA (LPCSTR lpFileName,
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
SetFileSecurityW (LPCWSTR lpFileName, STDCALL
SetFileSecurityW(LPCWSTR lpFileName,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor) PSECURITY_DESCRIPTOR pSecurityDescriptor)
{ {
@ -539,7 +552,8 @@ SetFileSecurityW (LPCWSTR lpFileName,
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
SetKernelObjectSecurity(HANDLE Handle, SetKernelObjectSecurity(HANDLE Handle,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor) PSECURITY_DESCRIPTOR SecurityDescriptor)
@ -554,6 +568,7 @@ SetKernelObjectSecurity(HANDLE Handle,
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -568,7 +583,6 @@ ImpersonateAnonymousToken(IN HANDLE ThreadHandle)
NTSTATUS Status; NTSTATUS Status;
Status = NtImpersonateAnonymousToken(ThreadHandle); Status = NtImpersonateAnonymousToken(ThreadHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
@ -582,7 +596,8 @@ ImpersonateAnonymousToken(IN HANDLE ThreadHandle)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
ImpersonateLoggedOnUser(HANDLE hToken) ImpersonateLoggedOnUser(HANDLE hToken)
{ {
SECURITY_QUALITY_OF_SERVICE Qos; SECURITY_QUALITY_OF_SERVICE Qos;
@ -594,14 +609,14 @@ ImpersonateLoggedOnUser(HANDLE hToken)
NTSTATUS Status; NTSTATUS Status;
/* Get the token type */ /* Get the token type */
Status = NtQueryInformationToken (hToken, Status = NtQueryInformationToken(hToken,
TokenType, TokenType,
&Type, &Type,
sizeof(TOKEN_TYPE), sizeof(TOKEN_TYPE),
&ReturnLength); &ReturnLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -620,7 +635,7 @@ ImpersonateLoggedOnUser(HANDLE hToken)
ObjectAttributes.SecurityDescriptor = NULL; ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = &Qos; ObjectAttributes.SecurityQualityOfService = &Qos;
Status = NtDuplicateToken (hToken, Status = NtDuplicateToken(hToken,
TOKEN_IMPERSONATE | TOKEN_QUERY, TOKEN_IMPERSONATE | TOKEN_QUERY,
&ObjectAttributes, &ObjectAttributes,
FALSE, FALSE,
@ -628,7 +643,7 @@ ImpersonateLoggedOnUser(HANDLE hToken)
&NewToken); &NewToken);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -642,19 +657,19 @@ ImpersonateLoggedOnUser(HANDLE hToken)
} }
/* Impersonate the the current thread */ /* Impersonate the the current thread */
Status = NtSetInformationThread (NtCurrentThread (), Status = NtSetInformationThread(NtCurrentThread(),
ThreadImpersonationToken, ThreadImpersonationToken,
&NewToken, &NewToken,
sizeof(HANDLE)); sizeof(HANDLE));
if (Duplicated == TRUE) if (Duplicated == TRUE)
{ {
NtClose (NewToken); NtClose(NewToken);
} }
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -665,7 +680,8 @@ ImpersonateLoggedOnUser(HANDLE hToken)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel) ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -676,6 +692,7 @@ ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -683,7 +700,8 @@ ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
RevertToSelf(VOID) RevertToSelf(VOID)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -698,6 +716,7 @@ RevertToSelf(VOID)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -714,8 +733,10 @@ RevertToSelf(VOID)
* *
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL
GetUserNameA( LPSTR lpszName, LPDWORD lpSize ) WINAPI
GetUserNameA(LPSTR lpszName,
LPDWORD lpSize)
{ {
UNICODE_STRING NameW; UNICODE_STRING NameW;
ANSI_STRING NameA; ANSI_STRING NameA;
@ -750,6 +771,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
return Ret; return Ret;
} }
/****************************************************************************** /******************************************************************************
* GetUserNameW [ADVAPI32.@] * GetUserNameW [ADVAPI32.@]
* *
@ -757,8 +779,10 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
* *
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL
GetUserNameW ( LPWSTR lpszName, LPDWORD lpSize ) WINAPI
GetUserNameW(LPWSTR lpszName,
LPDWORD lpSize )
{ {
HANDLE hToken = INVALID_HANDLE_VALUE; HANDLE hToken = INVALID_HANDLE_VALUE;
DWORD tu_len = 0; DWORD tu_len = 0;
@ -862,8 +886,9 @@ GetUserNameW ( LPWSTR lpszName, LPDWORD lpSize )
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
LookupAccountSidA (LPCSTR lpSystemName, STDCALL
LookupAccountSidA(LPCSTR lpSystemName,
PSID lpSid, PSID lpSid,
LPSTR lpName, LPSTR lpName,
LPDWORD cchName, LPDWORD cchName,
@ -1003,14 +1028,13 @@ LookupAccountSidA (LPCSTR lpSystemName,
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL WINAPI
LookupAccountSidW ( LookupAccountSidW(LPCWSTR pSystemName,
LPCWSTR pSystemName,
PSID pSid, PSID pSid,
LPWSTR pAccountName, LPWSTR pAccountName,
LPDWORD pdwAccountName, LPDWORD pdwAccountName,
LPWSTR pDomainName, LPWSTR pDomainName,
LPDWORD pdwDomainName, LPDWORD pdwDomainName,
PSID_NAME_USE peUse ) PSID_NAME_USE peUse)
{ {
LSA_UNICODE_STRING SystemName; LSA_UNICODE_STRING SystemName;
LSA_OBJECT_ATTRIBUTES ObjectAttributes = {0}; LSA_OBJECT_ATTRIBUTES ObjectAttributes = {0};
@ -1098,8 +1122,9 @@ LookupAccountSidW (
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
LookupAccountNameA (LPCSTR SystemName, STDCALL
LookupAccountNameA(LPCSTR SystemName,
LPCSTR AccountName, LPCSTR AccountName,
PSID Sid, PSID Sid,
LPDWORD SidLength, LPDWORD SidLength,
@ -1116,15 +1141,28 @@ LookupAccountNameA (LPCSTR SystemName,
RtlCreateUnicodeStringFromAsciiz(&lpAccountW, AccountName); RtlCreateUnicodeStringFromAsciiz(&lpAccountW, AccountName);
if (ReferencedDomainName) if (ReferencedDomainName)
lpReferencedDomainNameW = HeapAlloc(GetProcessHeap(), 0, *hReferencedDomainNameLength * sizeof(WCHAR)); lpReferencedDomainNameW = HeapAlloc(GetProcessHeap(),
0,
*hReferencedDomainNameLength * sizeof(WCHAR));
ret = LookupAccountNameW(lpSystemW.Buffer, lpAccountW.Buffer, Sid, SidLength, lpReferencedDomainNameW, ret = LookupAccountNameW(lpSystemW.Buffer,
hReferencedDomainNameLength, SidNameUse); lpAccountW.Buffer,
Sid,
SidLength,
lpReferencedDomainNameW,
hReferencedDomainNameLength,
SidNameUse);
if (ret && lpReferencedDomainNameW) if (ret && lpReferencedDomainNameW)
{ {
WideCharToMultiByte(CP_ACP, 0, lpReferencedDomainNameW, *hReferencedDomainNameLength, WideCharToMultiByte(CP_ACP,
ReferencedDomainName, *hReferencedDomainNameLength, NULL, NULL); 0,
lpReferencedDomainNameW,
*hReferencedDomainNameLength,
ReferencedDomainName,
*hReferencedDomainNameLength,
NULL,
NULL);
} }
RtlFreeUnicodeString(&lpSystemW); RtlFreeUnicodeString(&lpSystemW);
@ -1140,9 +1178,15 @@ LookupAccountNameA (LPCSTR SystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, BOOL
LPDWORD cbSid, LPWSTR ReferencedDomainName, WINAPI
LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse) LookupAccountNameW(LPCWSTR lpSystemName,
LPCWSTR lpAccountName,
PSID Sid,
LPDWORD cbSid,
LPWSTR ReferencedDomainName,
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse)
{ {
/* Default implementation: Always return a default SID */ /* Default implementation: Always return a default SID */
SID_IDENTIFIER_AUTHORITY identifierAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY identifierAuthority = {SECURITY_NT_AUTHORITY};
@ -1184,11 +1228,13 @@ BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID
if (Sid != NULL && (*cbSid >= GetLengthSid(pSid))) if (Sid != NULL && (*cbSid >= GetLengthSid(pSid)))
CopySid(*cbSid, Sid, pSid); CopySid(*cbSid, Sid, pSid);
if (*cbSid < GetLengthSid(pSid)) if (*cbSid < GetLengthSid(pSid))
{ {
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
ret = FALSE; ret = FALSE;
} }
*cbSid = GetLengthSid(pSid); *cbSid = GetLengthSid(pSid);
if (ReferencedDomainName != NULL && (*cchReferencedDomainName > wcslen(dm))) if (ReferencedDomainName != NULL && (*cchReferencedDomainName > wcslen(dm)))
@ -1213,8 +1259,9 @@ BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeValueA (LPCSTR lpSystemName, STDCALL
LookupPrivilegeValueA(LPCSTR lpSystemName,
LPCSTR lpName, LPCSTR lpName,
PLUID lpLuid) PLUID lpLuid)
{ {
@ -1225,30 +1272,30 @@ LookupPrivilegeValueA (LPCSTR lpSystemName,
/* Remote system? */ /* Remote system? */
if (lpSystemName != NULL) if (lpSystemName != NULL)
{ {
RtlCreateUnicodeStringFromAsciiz (&SystemName, RtlCreateUnicodeStringFromAsciiz(&SystemName,
(LPSTR)lpSystemName); (LPSTR)lpSystemName);
} }
/* Check the privilege name is not NULL */ /* Check the privilege name is not NULL */
if (lpName == NULL) if (lpName == NULL)
{ {
SetLastError (ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
RtlCreateUnicodeStringFromAsciiz (&Name, RtlCreateUnicodeStringFromAsciiz(&Name,
(LPSTR)lpName); (LPSTR)lpName);
Result = LookupPrivilegeValueW ((lpSystemName != NULL) ? SystemName.Buffer : NULL, Result = LookupPrivilegeValueW((lpSystemName != NULL) ? SystemName.Buffer : NULL,
Name.Buffer, Name.Buffer,
lpLuid); lpLuid);
RtlFreeUnicodeString (&Name); RtlFreeUnicodeString(&Name);
/* Remote system? */ /* Remote system? */
if (lpSystemName != NULL) if (lpSystemName != NULL)
{ {
RtlFreeUnicodeString (&SystemName); RtlFreeUnicodeString(&SystemName);
} }
return Result; return Result;
@ -1260,8 +1307,9 @@ LookupPrivilegeValueA (LPCSTR lpSystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeValueW (LPCWSTR SystemName, STDCALL
LookupPrivilegeValueW(LPCWSTR SystemName,
LPCWSTR PrivName, LPCWSTR PrivName,
PLUID Luid) PLUID Luid)
{ {
@ -1328,8 +1376,9 @@ LookupPrivilegeValueW (LPCWSTR SystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeDisplayNameA (LPCSTR lpSystemName, STDCALL
LookupPrivilegeDisplayNameA(LPCSTR lpSystemName,
LPCSTR lpName, LPCSTR lpName,
LPSTR lpDisplayName, LPSTR lpDisplayName,
LPDWORD cbDisplayName, LPDWORD cbDisplayName,
@ -1346,8 +1395,9 @@ LookupPrivilegeDisplayNameA (LPCSTR lpSystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName, STDCALL
LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName,
LPCWSTR lpName, LPCWSTR lpName,
LPWSTR lpDisplayName, LPWSTR lpDisplayName,
LPDWORD cbDisplayName, LPDWORD cbDisplayName,
@ -1364,8 +1414,9 @@ LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeNameA (LPCSTR lpSystemName, STDCALL
LookupPrivilegeNameA(LPCSTR lpSystemName,
PLUID lpLuid, PLUID lpLuid,
LPSTR lpName, LPSTR lpName,
LPDWORD cbName) LPDWORD cbName)
@ -1381,8 +1432,9 @@ LookupPrivilegeNameA (LPCSTR lpSystemName,
* *
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
LookupPrivilegeNameW (LPCWSTR lpSystemName, STDCALL
LookupPrivilegeNameW(LPCWSTR lpSystemName,
PLUID lpLuid, PLUID lpLuid,
LPWSTR lpName, LPWSTR lpName,
LPDWORD cbName) LPDWORD cbName)
@ -1395,10 +1447,10 @@ LookupPrivilegeNameW (LPCWSTR lpSystemName,
static DWORD static DWORD
pGetSecurityInfoCheck(SECURITY_INFORMATION SecurityInfo, pGetSecurityInfoCheck(SECURITY_INFORMATION SecurityInfo,
PSID* ppsidOwner, PSID *ppsidOwner,
PSID* ppsidGroup, PSID *ppsidGroup,
PACL* ppDacl, PACL *ppDacl,
PACL* ppSacl, PACL *ppSacl,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor) PSECURITY_DESCRIPTOR* ppSecurityDescriptor)
{ {
if ((SecurityInfo & (OWNER_SECURITY_INFORMATION | if ((SecurityInfo & (OWNER_SECURITY_INFORMATION |
@ -1574,7 +1626,8 @@ ProtectSacl:
* *
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
GetNamedSecurityInfoW(LPWSTR pObjectName, GetNamedSecurityInfoW(LPWSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
@ -1624,7 +1677,8 @@ GetNamedSecurityInfoW(LPWSTR pObjectName,
* *
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
GetNamedSecurityInfoA(LPSTR pObjectName, GetNamedSecurityInfoA(LPSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
@ -1665,7 +1719,8 @@ GetNamedSecurityInfoA(LPSTR pObjectName,
* *
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
SetNamedSecurityInfoW(LPWSTR pObjectName, SetNamedSecurityInfoW(LPWSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
@ -1712,7 +1767,8 @@ SetNamedSecurityInfoW(LPWSTR pObjectName,
* *
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
SetNamedSecurityInfoA(LPSTR pObjectName, SetNamedSecurityInfoA(LPSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
@ -1751,15 +1807,16 @@ SetNamedSecurityInfoA(LPSTR pObjectName,
* *
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
GetSecurityInfo(HANDLE handle, GetSecurityInfo(HANDLE handle,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
PSID* ppsidOwner, PSID *ppsidOwner,
PSID* ppsidGroup, PSID *ppsidGroup,
PACL* ppDacl, PACL *ppDacl,
PACL* ppSacl, PACL *ppSacl,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor) PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
{ {
DWORD ErrorCode; DWORD ErrorCode;
@ -1847,8 +1904,9 @@ SetSecurityInfo(HANDLE handle,
/****************************************************************************** /******************************************************************************
* GetSecurityInfoExW EXPORTED * GetSecurityInfoExW EXPORTED
*/ */
DWORD WINAPI GetSecurityInfoExA( DWORD
HANDLE hObject, WINAPI
GetSecurityInfoExA(HANDLE hObject,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
LPCSTR lpProvider, LPCSTR lpProvider,
@ -1856,8 +1914,7 @@ DWORD WINAPI GetSecurityInfoExA(
PACTRL_ACCESSA *ppAccessList, PACTRL_ACCESSA *ppAccessList,
PACTRL_AUDITA *ppAuditList, PACTRL_AUDITA *ppAuditList,
LPSTR *lppOwner, LPSTR *lppOwner,
LPSTR *lppGroup LPSTR *lppGroup)
)
{ {
FIXME("%s() not implemented!\n", __FUNCTION__); FIXME("%s() not implemented!\n", __FUNCTION__);
return ERROR_BAD_PROVIDER; return ERROR_BAD_PROVIDER;
@ -1867,8 +1924,9 @@ DWORD WINAPI GetSecurityInfoExA(
/****************************************************************************** /******************************************************************************
* GetSecurityInfoExW EXPORTED * GetSecurityInfoExW EXPORTED
*/ */
DWORD WINAPI GetSecurityInfoExW( DWORD
HANDLE hObject, WINAPI
GetSecurityInfoExW(HANDLE hObject,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
LPCWSTR lpProvider, LPCWSTR lpProvider,
@ -1876,8 +1934,7 @@ DWORD WINAPI GetSecurityInfoExW(
PACTRL_ACCESSW *ppAccessList, PACTRL_ACCESSW *ppAccessList,
PACTRL_AUDITW *ppAuditList, PACTRL_AUDITW *ppAuditList,
LPWSTR *lppOwner, LPWSTR *lppOwner,
LPWSTR *lppGroup LPWSTR *lppGroup)
)
{ {
FIXME("%s() not implemented!\n", __FUNCTION__); FIXME("%s() not implemented!\n", __FUNCTION__);
return ERROR_BAD_PROVIDER; return ERROR_BAD_PROVIDER;
@ -1889,7 +1946,8 @@ DWORD WINAPI GetSecurityInfoExW(
* *
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
ImpersonateNamedPipeClient(HANDLE hNamedPipe) ImpersonateNamedPipeClient(HANDLE hNamedPipe)
{ {
IO_STATUS_BLOCK StatusBlock; IO_STATUS_BLOCK StatusBlock;
@ -1920,7 +1978,8 @@ ImpersonateNamedPipeClient(HANDLE hNamedPipe)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor, CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor,
PSECURITY_DESCRIPTOR *NewDescriptor, PSECURITY_DESCRIPTOR *NewDescriptor,
@ -1949,7 +2008,8 @@ CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
STDCALL
CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor, CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor,
PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor,
PSECURITY_DESCRIPTOR* NewDescriptor, PSECURITY_DESCRIPTOR* NewDescriptor,
@ -1967,7 +2027,8 @@ CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor,
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL
STDCALL
CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDescriptor, CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDescriptor,
PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor,
PSECURITY_DESCRIPTOR* NewDescriptor, PSECURITY_DESCRIPTOR* NewDescriptor,
@ -1986,7 +2047,8 @@ CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDe
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor) DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -2005,7 +2067,8 @@ DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor, GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR ResultantDescriptor, PSECURITY_DESCRIPTOR ResultantDescriptor,
@ -2032,7 +2095,8 @@ GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL
STDCALL
SetPrivateObjectSecurity(SECURITY_INFORMATION SecurityInformation, SetPrivateObjectSecurity(SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR ModificationDescriptor,
PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
@ -2059,7 +2123,8 @@ SetPrivateObjectSecurity(SECURITY_INFORMATION SecurityInformation,
/* /*
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
TreeResetNamedSecurityInfoW(LPWSTR pObjectName, TreeResetNamedSecurityInfoW(LPWSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,
@ -2191,7 +2256,8 @@ InternalfnProgressW(LPWSTR pObjectName,
/* /*
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD
STDCALL
TreeResetNamedSecurityInfoA(LPSTR pObjectName, TreeResetNamedSecurityInfoA(LPSTR pObjectName,
SE_OBJECT_TYPE ObjectType, SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo, SECURITY_INFORMATION SecurityInfo,

View file

@ -21,20 +21,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
*/ */
BOOL BOOL
STDCALL STDCALL
GetSecurityDescriptorControl ( GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR_CONTROL pControl, PSECURITY_DESCRIPTOR_CONTROL pControl,
LPDWORD lpdwRevision LPDWORD lpdwRevision)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetControlSecurityDescriptor (pSecurityDescriptor, Status = RtlGetControlSecurityDescriptor(pSecurityDescriptor,
pControl, pControl,
(PULONG)lpdwRevision); (PULONG)lpdwRevision);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -47,18 +45,16 @@ GetSecurityDescriptorControl (
*/ */
BOOL BOOL
STDCALL STDCALL
GetSecurityDescriptorDacl ( GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
LPBOOL lpbDaclPresent, LPBOOL lpbDaclPresent,
PACL *pDacl, PACL *pDacl,
LPBOOL lpbDaclDefaulted LPBOOL lpbDaclDefaulted)
)
{ {
BOOLEAN DaclPresent; BOOLEAN DaclPresent;
BOOLEAN DaclDefaulted; BOOLEAN DaclDefaulted;
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetDaclSecurityDescriptor (pSecurityDescriptor, Status = RtlGetDaclSecurityDescriptor(pSecurityDescriptor,
&DaclPresent, &DaclPresent,
pDacl, pDacl,
&DaclDefaulted); &DaclDefaulted);
@ -67,7 +63,7 @@ GetSecurityDescriptorDacl (
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -80,23 +76,21 @@ GetSecurityDescriptorDacl (
*/ */
BOOL BOOL
STDCALL STDCALL
GetSecurityDescriptorGroup ( GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID *pGroup, PSID *pGroup,
LPBOOL lpbGroupDefaulted LPBOOL lpbGroupDefaulted)
)
{ {
BOOLEAN GroupDefaulted; BOOLEAN GroupDefaulted;
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetGroupSecurityDescriptor (pSecurityDescriptor, Status = RtlGetGroupSecurityDescriptor(pSecurityDescriptor,
pGroup, pGroup,
&GroupDefaulted); &GroupDefaulted);
*lpbGroupDefaulted = (BOOL)GroupDefaulted; *lpbGroupDefaulted = (BOOL)GroupDefaulted;
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -109,23 +103,21 @@ GetSecurityDescriptorGroup (
*/ */
BOOL BOOL
STDCALL STDCALL
GetSecurityDescriptorOwner ( GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID *pOwner, PSID *pOwner,
LPBOOL lpbOwnerDefaulted LPBOOL lpbOwnerDefaulted)
)
{ {
BOOLEAN OwnerDefaulted; BOOLEAN OwnerDefaulted;
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetOwnerSecurityDescriptor (pSecurityDescriptor, Status = RtlGetOwnerSecurityDescriptor(pSecurityDescriptor,
pOwner, pOwner,
&OwnerDefaulted); &OwnerDefaulted);
*lpbOwnerDefaulted = (BOOL)OwnerDefaulted; *lpbOwnerDefaulted = (BOOL)OwnerDefaulted;
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -138,8 +130,7 @@ GetSecurityDescriptorOwner (
*/ */
DWORD DWORD
STDCALL STDCALL
GetSecurityDescriptorRMControl ( GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PUCHAR RMControl) PUCHAR RMControl)
{ {
if (!RtlGetSecurityDescriptorRMControl(SecurityDescriptor, if (!RtlGetSecurityDescriptorRMControl(SecurityDescriptor,
@ -155,18 +146,16 @@ GetSecurityDescriptorRMControl (
*/ */
BOOL BOOL
STDCALL STDCALL
GetSecurityDescriptorSacl ( GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
LPBOOL lpbSaclPresent, LPBOOL lpbSaclPresent,
PACL *pSacl, PACL *pSacl,
LPBOOL lpbSaclDefaulted LPBOOL lpbSaclDefaulted)
)
{ {
BOOLEAN SaclPresent; BOOLEAN SaclPresent;
BOOLEAN SaclDefaulted; BOOLEAN SaclDefaulted;
NTSTATUS Status; NTSTATUS Status;
Status = RtlGetSaclSecurityDescriptor (pSecurityDescriptor, Status = RtlGetSaclSecurityDescriptor(pSecurityDescriptor,
&SaclPresent, &SaclPresent,
pSacl, pSacl,
&SaclDefaulted); &SaclDefaulted);
@ -175,7 +164,7 @@ GetSecurityDescriptorSacl (
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -188,18 +177,16 @@ GetSecurityDescriptorSacl (
*/ */
BOOL BOOL
STDCALL STDCALL
InitializeSecurityDescriptor ( InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
DWORD dwRevision
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlCreateSecurityDescriptor (pSecurityDescriptor, Status = RtlCreateSecurityDescriptor(pSecurityDescriptor,
dwRevision); dwRevision);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -212,15 +199,13 @@ InitializeSecurityDescriptor (
*/ */
BOOL BOOL
STDCALL STDCALL
IsValidSecurityDescriptor ( IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor)
PSECURITY_DESCRIPTOR pSecurityDescriptor
)
{ {
BOOLEAN Result; BOOLEAN Result;
Result = RtlValidSecurityDescriptor (pSecurityDescriptor); Result = RtlValidSecurityDescriptor (pSecurityDescriptor);
if (Result == FALSE) if (Result == FALSE)
SetLastError (RtlNtStatusToDosError (STATUS_INVALID_SECURITY_DESCR)); SetLastError(RtlNtStatusToDosError(STATUS_INVALID_SECURITY_DESCR));
return (BOOL)Result; return (BOOL)Result;
} }
@ -231,8 +216,7 @@ IsValidSecurityDescriptor (
*/ */
BOOL BOOL
STDCALL STDCALL
MakeAbsoluteSD ( MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
LPDWORD lpdwAbsoluteSecurityDescriptorSize, LPDWORD lpdwAbsoluteSecurityDescriptorSize,
PACL pDacl, PACL pDacl,
@ -242,8 +226,7 @@ MakeAbsoluteSD (
PSID pOwner, PSID pOwner,
LPDWORD lpdwOwnerSize, LPDWORD lpdwOwnerSize,
PSID pPrimaryGroup, PSID pPrimaryGroup,
LPDWORD lpdwPrimaryGroupSize LPDWORD lpdwPrimaryGroupSize)
)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -282,7 +265,7 @@ MakeAbsoluteSD2(IN OUT PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
lpdwBufferSize); lpdwBufferSize);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -295,20 +278,18 @@ MakeAbsoluteSD2(IN OUT PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
*/ */
BOOL BOOL
STDCALL STDCALL
MakeSelfRelativeSD ( MakeSelfRelativeSD(PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
LPDWORD lpdwBufferLength LPDWORD lpdwBufferLength)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAbsoluteToSelfRelativeSD (pAbsoluteSecurityDescriptor, Status = RtlAbsoluteToSelfRelativeSD(pAbsoluteSecurityDescriptor,
pSelfRelativeSecurityDescriptor, pSelfRelativeSecurityDescriptor,
(PULONG)lpdwBufferLength); (PULONG)lpdwBufferLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -321,8 +302,7 @@ MakeSelfRelativeSD (
*/ */
BOOL BOOL
STDCALL STDCALL
SetSecurityDescriptorControl ( SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet) SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
{ {
@ -333,7 +313,7 @@ SetSecurityDescriptorControl (
ControlBitsToSet); ControlBitsToSet);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -346,22 +326,20 @@ SetSecurityDescriptorControl (
*/ */
BOOL BOOL
STDCALL STDCALL
SetSecurityDescriptorDacl ( SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
BOOL bDaclPresent, BOOL bDaclPresent,
PACL pDacl, PACL pDacl,
BOOL bDaclDefaulted BOOL bDaclDefaulted)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlSetDaclSecurityDescriptor (pSecurityDescriptor, Status = RtlSetDaclSecurityDescriptor(pSecurityDescriptor,
bDaclPresent, bDaclPresent,
pDacl, pDacl,
bDaclDefaulted); bDaclDefaulted);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -374,20 +352,18 @@ SetSecurityDescriptorDacl (
*/ */
BOOL BOOL
STDCALL STDCALL
SetSecurityDescriptorGroup ( SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID pGroup, PSID pGroup,
BOOL bGroupDefaulted BOOL bGroupDefaulted)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor, Status = RtlSetGroupSecurityDescriptor(pSecurityDescriptor,
pGroup, pGroup,
bGroupDefaulted); bGroupDefaulted);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -400,20 +376,18 @@ SetSecurityDescriptorGroup (
*/ */
BOOL BOOL
STDCALL STDCALL
SetSecurityDescriptorOwner ( SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID pOwner, PSID pOwner,
BOOL bOwnerDefaulted BOOL bOwnerDefaulted)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlSetOwnerSecurityDescriptor (pSecurityDescriptor, Status = RtlSetOwnerSecurityDescriptor(pSecurityDescriptor,
pOwner, pOwner,
bOwnerDefaulted); bOwnerDefaulted);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -426,8 +400,7 @@ SetSecurityDescriptorOwner (
*/ */
DWORD DWORD
STDCALL STDCALL
SetSecurityDescriptorRMControl ( SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PUCHAR RMControl) PUCHAR RMControl)
{ {
RtlSetSecurityDescriptorRMControl(SecurityDescriptor, RtlSetSecurityDescriptorRMControl(SecurityDescriptor,
@ -442,22 +415,20 @@ SetSecurityDescriptorRMControl (
*/ */
BOOL BOOL
STDCALL STDCALL
SetSecurityDescriptorSacl ( SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
BOOL bSaclPresent, BOOL bSaclPresent,
PACL pSacl, PACL pSacl,
BOOL bSaclDefaulted BOOL bSaclDefaulted)
)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlSetSaclSecurityDescriptor (pSecurityDescriptor, Status = RtlSetSaclSecurityDescriptor(pSecurityDescriptor,
bSaclPresent, bSaclPresent,
pSacl, pSacl,
bSaclDefaulted); bSaclDefaulted);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -574,10 +545,12 @@ BOOL WINAPI DecryptFileW(LPCWSTR lpFileName, DWORD dwReserved)
return TRUE; return TRUE;
} }
/* /*
* @implemented * @implemented
*/ */
BOOL WINAPI DecryptFileA(LPCSTR lpFileName, DWORD dwReserved) BOOL WINAPI
DecryptFileA(LPCSTR lpFileName, DWORD dwReserved)
{ {
UNICODE_STRING FileName; UNICODE_STRING FileName;
NTSTATUS Status; NTSTATUS Status;
@ -597,20 +570,24 @@ BOOL WINAPI DecryptFileA(LPCSTR lpFileName, DWORD dwReserved)
return ret; return ret;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI EncryptFileW(LPCWSTR lpFileName) BOOL WINAPI
EncryptFileW(LPCWSTR lpFileName)
{ {
FIXME("%s() not implemented!\n", __FUNCTION__); FIXME("%s() not implemented!\n", __FUNCTION__);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return TRUE; return TRUE;
} }
/* /*
* @implemented * @implemented
*/ */
BOOL WINAPI EncryptFileA(LPCSTR lpFileName) BOOL WINAPI
EncryptFileA(LPCSTR lpFileName)
{ {
UNICODE_STRING FileName; UNICODE_STRING FileName;
NTSTATUS Status; NTSTATUS Status;
@ -630,11 +607,15 @@ BOOL WINAPI EncryptFileA(LPCSTR lpFileName)
return ret; return ret;
} }
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(
PSECURITY_DESCRIPTOR pSecurityDescriptor, /*
* @unimplemented
*/
BOOL WINAPI
ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD dword, DWORD dword,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
LPWSTR* lpwstr, LPWSTR *lpwstr,
PULONG pulong) PULONG pulong)
{ {
FIXME("%s() not implemented!\n", __FUNCTION__); FIXME("%s() not implemented!\n", __FUNCTION__);
@ -642,11 +623,15 @@ BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(
return FALSE; return FALSE;
} }
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA(
PSECURITY_DESCRIPTOR pSecurityDescriptor, /*
* @unimplemented
*/
BOOL WINAPI
ConvertSecurityDescriptorToStringSecurityDescriptorA(PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD dword, DWORD dword,
SECURITY_INFORMATION SecurityInformation, SECURITY_INFORMATION SecurityInformation,
LPSTR* lpstr, LPSTR *lpstr,
PULONG pulong) PULONG pulong)
{ {
FIXME("%s() not implemented!\n", __FUNCTION__); FIXME("%s() not implemented!\n", __FUNCTION__);

View file

@ -541,7 +541,7 @@ AllocateLocallyUniqueId(PLUID Luid)
Status = NtAllocateLocallyUniqueId (Luid); Status = NtAllocateLocallyUniqueId (Luid);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -553,7 +553,7 @@ AllocateLocallyUniqueId(PLUID Luid)
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount, BYTE nSubAuthorityCount,
DWORD dwSubAuthority0, DWORD dwSubAuthority0,
DWORD dwSubAuthority1, DWORD dwSubAuthority1,
@ -567,7 +567,7 @@ AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlAllocateAndInitializeSid (pIdentifierAuthority, Status = RtlAllocateAndInitializeSid(pIdentifierAuthority,
nSubAuthorityCount, nSubAuthorityCount,
dwSubAuthority0, dwSubAuthority0,
dwSubAuthority1, dwSubAuthority1,
@ -578,9 +578,9 @@ AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
dwSubAuthority6, dwSubAuthority6,
dwSubAuthority7, dwSubAuthority7,
pSid); pSid);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -592,23 +592,25 @@ AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
CopySid (DWORD nDestinationSidLength, CopySid(DWORD nDestinationSidLength,
PSID pDestinationSid, PSID pDestinationSid,
PSID pSourceSid) PSID pSourceSid)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlCopySid (nDestinationSidLength, Status = RtlCopySid(nDestinationSidLength,
pDestinationSid, pDestinationSid,
pSourceSid); pSourceSid);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
/****************************************************************************** /******************************************************************************
* ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@] * ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@]
* @implemented * @implemented
@ -830,7 +832,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
EqualPrefixSid (PSID pSid1, EqualPrefixSid(PSID pSid1,
PSID pSid2) PSID pSid2)
{ {
return RtlEqualPrefixSid (pSid1, pSid2); return RtlEqualPrefixSid (pSid1, pSid2);
@ -841,7 +843,7 @@ EqualPrefixSid (PSID pSid1,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
EqualSid (PSID pSid1, EqualSid(PSID pSid1,
PSID pSid2) PSID pSid2)
{ {
return RtlEqualSid (pSid1, pSid2); return RtlEqualSid (pSid1, pSid2);
@ -856,9 +858,9 @@ EqualSid (PSID pSid1,
* even thou it's defined to return a PVOID... * even thou it's defined to return a PVOID...
*/ */
PVOID STDCALL PVOID STDCALL
FreeSid (PSID pSid) FreeSid(PSID pSid)
{ {
return RtlFreeSid (pSid); return RtlFreeSid(pSid);
} }
@ -866,9 +868,9 @@ FreeSid (PSID pSid)
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD STDCALL
GetLengthSid (PSID pSid) GetLengthSid(PSID pSid)
{ {
return (DWORD)RtlLengthSid (pSid); return (DWORD)RtlLengthSid(pSid);
} }
@ -876,9 +878,9 @@ GetLengthSid (PSID pSid)
* @implemented * @implemented
*/ */
PSID_IDENTIFIER_AUTHORITY STDCALL PSID_IDENTIFIER_AUTHORITY STDCALL
GetSidIdentifierAuthority (PSID pSid) GetSidIdentifierAuthority(PSID pSid)
{ {
return RtlIdentifierAuthoritySid (pSid); return RtlIdentifierAuthoritySid(pSid);
} }
@ -886,9 +888,9 @@ GetSidIdentifierAuthority (PSID pSid)
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD STDCALL
GetSidLengthRequired (UCHAR nSubAuthorityCount) GetSidLengthRequired(UCHAR nSubAuthorityCount)
{ {
return (DWORD)RtlLengthRequiredSid (nSubAuthorityCount); return (DWORD)RtlLengthRequiredSid(nSubAuthorityCount);
} }
@ -896,10 +898,10 @@ GetSidLengthRequired (UCHAR nSubAuthorityCount)
* @implemented * @implemented
*/ */
PDWORD STDCALL PDWORD STDCALL
GetSidSubAuthority (PSID pSid, GetSidSubAuthority(PSID pSid,
DWORD nSubAuthority) DWORD nSubAuthority)
{ {
return (PDWORD)RtlSubAuthoritySid (pSid, nSubAuthority); return (PDWORD)RtlSubAuthoritySid(pSid, nSubAuthority);
} }
@ -907,9 +909,9 @@ GetSidSubAuthority (PSID pSid,
* @implemented * @implemented
*/ */
PUCHAR STDCALL PUCHAR STDCALL
GetSidSubAuthorityCount (PSID pSid) GetSidSubAuthorityCount(PSID pSid)
{ {
return RtlSubAuthorityCountSid (pSid); return RtlSubAuthorityCountSid(pSid);
} }
@ -917,18 +919,18 @@ GetSidSubAuthorityCount (PSID pSid)
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
InitializeSid (PSID Sid, InitializeSid(PSID Sid,
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount) BYTE nSubAuthorityCount)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = RtlInitializeSid (Sid, Status = RtlInitializeSid(Sid,
pIdentifierAuthority, pIdentifierAuthority,
nSubAuthorityCount); nSubAuthorityCount);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -940,22 +942,24 @@ InitializeSid (PSID Sid,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
IsValidSid (PSID pSid) IsValidSid(PSID pSid)
{ {
return (BOOL)RtlValidSid (pSid); return (BOOL)RtlValidSid(pSid);
} }
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid) ConvertSidToStringSidW(PSID Sid,
LPWSTR *StringSid)
{ {
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
WCHAR FixedBuffer[64]; WCHAR FixedBuffer[64];
if (! RtlValidSid(Sid)) if (!RtlValidSid(Sid))
{ {
SetLastError(ERROR_INVALID_SID); SetLastError(ERROR_INVALID_SID);
return FALSE; return FALSE;
@ -969,7 +973,8 @@ ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
{ {
Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, TRUE); Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, TRUE);
} }
if (! NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
@ -1001,12 +1006,13 @@ ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid) ConvertSidToStringSidA(PSID Sid,
LPSTR *StringSid)
{ {
LPWSTR StringSidW; LPWSTR StringSidW;
int Len; int Len;
if (! ConvertSidToStringSidW(Sid, &StringSidW)) if (!ConvertSidToStringSidW(Sid, &StringSidW))
{ {
return FALSE; return FALSE;
} }
@ -1018,6 +1024,7 @@ ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE; return FALSE;
} }
*StringSid = LocalAlloc(LMEM_FIXED, Len); *StringSid = LocalAlloc(LMEM_FIXED, Len);
if (NULL == *StringSid) if (NULL == *StringSid)
{ {
@ -1026,7 +1033,7 @@ ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
return FALSE; return FALSE;
} }
if (! WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL)) if (!WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
{ {
LocalFree(StringSid); LocalFree(StringSid);
LocalFree(StringSidW); LocalFree(StringSidW);
@ -1077,22 +1084,27 @@ CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
int i; int i;
TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid); TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid);
if (DomainSid != NULL) { if (DomainSid != NULL)
{
FIXME("Only local computer supported!\n"); FIXME("Only local computer supported!\n");
SetLastError(ERROR_INVALID_PARAMETER); /* FIXME */ SetLastError(ERROR_INVALID_PARAMETER); /* FIXME */
return FALSE; return FALSE;
} }
if (cbSid == NULL || pSid == NULL) { if (cbSid == NULL || pSid == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) { for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
if (WellKnownSids[i].Type == WellKnownSidType) { {
if (WellKnownSids[i].Type == WellKnownSidType)
{
DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount); DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
if (*cbSid < length) { if (*cbSid < length)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE; return FALSE;
} }
@ -1118,10 +1130,14 @@ IsWellKnownSid(IN PSID pSid,
int i; int i;
TRACE("(%s, %d)\n", debugstr_sid(pSid), WellKnownSidType); TRACE("(%s, %d)\n", debugstr_sid(pSid), WellKnownSidType);
for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) for (i = 0; i < sizeof(WellKnownSids) / sizeof(WellKnownSids[0]); i++)
{
if (WellKnownSids[i].Type == WellKnownSidType) if (WellKnownSids[i].Type == WellKnownSidType)
{
if (EqualSid(pSid, (PSID)((ULONG_PTR)&WellKnownSids[i].Sid.Revision))) if (EqualSid(pSid, (PSID)((ULONG_PTR)&WellKnownSids[i].Sid.Revision)))
return TRUE; return TRUE;
}
}
return FALSE; return FALSE;
} }
@ -1131,8 +1147,7 @@ IsWellKnownSid(IN PSID pSid,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ConvertStringSidToSidA( ConvertStringSidToSidA(IN LPCSTR StringSid,
IN LPCSTR StringSid,
OUT PSID* sid) OUT PSID* sid)
{ {
BOOL bRetVal = FALSE; BOOL bRetVal = FALSE;
@ -1150,10 +1165,12 @@ ConvertStringSidToSidA(
return bRetVal; return bRetVal;
} }
/****************************************************************************** /******************************************************************************
* ComputeStringSidSize * ComputeStringSidSize
*/ */
static DWORD ComputeStringSidSize(LPCWSTR StringSid) static DWORD
ComputeStringSidSize(LPCWSTR StringSid)
{ {
DWORD size = sizeof(SID); DWORD size = sizeof(SID);
@ -1229,8 +1246,7 @@ static const RECORD SidTable[] =
* @implemented * @implemented
*/ */
BOOL WINAPI BOOL WINAPI
ConvertStringSidToSidW( ConvertStringSidToSidW(IN LPCWSTR StringSid,
IN LPCWSTR StringSid,
OUT PSID* sid) OUT PSID* sid)
{ {
DWORD size; DWORD size;

View file

@ -131,7 +131,8 @@ BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess,
* BuildTrusteeWithSidA [ADVAPI32.@] * BuildTrusteeWithSidA [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithSidA(PTRUSTEE_A pTrustee, PSID pSid) BuildTrusteeWithSidA(PTRUSTEE_A pTrustee,
PSID pSid)
{ {
TRACE("%p %p\n", pTrustee, pSid); TRACE("%p %p\n", pTrustee, pSid);
@ -147,7 +148,8 @@ BuildTrusteeWithSidA(PTRUSTEE_A pTrustee, PSID pSid)
* BuildTrusteeWithSidW [ADVAPI32.@] * BuildTrusteeWithSidW [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithSidW(PTRUSTEE_W pTrustee, PSID pSid) BuildTrusteeWithSidW(PTRUSTEE_W pTrustee,
PSID pSid)
{ {
TRACE("%p %p\n", pTrustee, pSid); TRACE("%p %p\n", pTrustee, pSid);
@ -163,7 +165,8 @@ BuildTrusteeWithSidW(PTRUSTEE_W pTrustee, PSID pSid)
* BuildTrusteeWithNameA [ADVAPI32.@] * BuildTrusteeWithNameA [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithNameA(PTRUSTEE_A pTrustee, LPSTR name) BuildTrusteeWithNameA(PTRUSTEE_A pTrustee,
LPSTR name)
{ {
TRACE("%p %s\n", pTrustee, name); TRACE("%p %s\n", pTrustee, name);
@ -179,7 +182,8 @@ BuildTrusteeWithNameA(PTRUSTEE_A pTrustee, LPSTR name)
* BuildTrusteeWithNameW [ADVAPI32.@] * BuildTrusteeWithNameW [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, LPWSTR name) BuildTrusteeWithNameW(PTRUSTEE_W pTrustee,
LPWSTR name)
{ {
TRACE("%p %s\n", pTrustee, name); TRACE("%p %s\n", pTrustee, name);
@ -195,9 +199,12 @@ BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, LPWSTR name)
* BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee,
SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, POBJECTS_AND_NAME_A pObjName,
LPSTR InheritedObjectTypeName, LPSTR Name) SE_OBJECT_TYPE ObjectType,
LPSTR ObjectTypeName,
LPSTR InheritedObjectTypeName,
LPSTR Name)
{ {
DWORD ObjectsPresent = 0; DWORD ObjectsPresent = 0;
@ -233,9 +240,12 @@ BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName
* BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee,
SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, POBJECTS_AND_NAME_W pObjName,
LPWSTR InheritedObjectTypeName, LPWSTR Name) SE_OBJECT_TYPE ObjectType,
LPWSTR ObjectTypeName,
LPWSTR InheritedObjectTypeName,
LPWSTR Name)
{ {
DWORD ObjectsPresent = 0; DWORD ObjectsPresent = 0;
@ -271,8 +281,11 @@ BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName
* BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid, BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee,
GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) POBJECTS_AND_SID pObjSid,
GUID *pObjectGuid,
GUID *pInheritedObjectGuid,
PSID pSid)
{ {
DWORD ObjectsPresent = 0; DWORD ObjectsPresent = 0;
@ -317,8 +330,11 @@ BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid,
* BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@]
*/ */
VOID WINAPI VOID WINAPI
BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid, BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee,
GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) POBJECTS_AND_SID pObjSid,
GUID *pObjectGuid,
GUID *pInheritedObjectGuid,
PSID pSid)
{ {
DWORD ObjectsPresent = 0; DWORD ObjectsPresent = 0;

View file

@ -40,8 +40,7 @@ static RPC_UNICODE_STRING EmptyString = { 0, 0, L"" };
* BackupEventLogA [ADVAPI32.@] * BackupEventLogA [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
BackupEventLogA( BackupEventLogA(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN LPCSTR lpBackupFileName) IN LPCSTR lpBackupFileName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -60,16 +59,16 @@ BackupEventLogA(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrBackupELFA(
pLog->BindingHandle, Status = ElfrBackupELFA(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&BackupFileName); &BackupFileName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -81,8 +80,7 @@ BackupEventLogA(
* lpBackupFileName [] * lpBackupFileName []
*/ */
BOOL WINAPI BOOL WINAPI
BackupEventLogW( BackupEventLogW(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN LPCWSTR lpBackupFileName) IN LPCWSTR lpBackupFileName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -101,16 +99,16 @@ BackupEventLogW(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrBackupELFW(
pLog->BindingHandle, Status = ElfrBackupELFW(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&BackupFileName); &BackupFileName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -119,8 +117,7 @@ BackupEventLogW(
* ClearEventLogA [ADVAPI32.@] * ClearEventLogA [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
ClearEventLogA( ClearEventLogA(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN LPCSTR lpBackupFileName) IN LPCSTR lpBackupFileName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -139,16 +136,16 @@ ClearEventLogA(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrClearELFA(
pLog->BindingHandle, Status = ElfrClearELFA(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&BackupFileName); &BackupFileName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -157,8 +154,7 @@ ClearEventLogA(
* ClearEventLogW [ADVAPI32.@] * ClearEventLogW [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
ClearEventLogW( ClearEventLogW(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN LPCWSTR lpBackupFileName) IN LPCWSTR lpBackupFileName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -177,16 +173,16 @@ ClearEventLogW(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrClearELFW(
pLog->BindingHandle, Status = ElfrClearELFW(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&BackupFileName); &BackupFileName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -195,8 +191,7 @@ ClearEventLogW(
* CloseEventLog [ADVAPI32.@] * CloseEventLog [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
CloseEventLog( CloseEventLog(IN HANDLE hEventLog)
IN HANDLE hEventLog)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
NTSTATUS Status; NTSTATUS Status;
@ -217,8 +212,7 @@ CloseEventLog(
} }
else else
{ {
Status = ElfrCloseEL( Status = ElfrCloseEL(pLog->BindingHandle,
pLog->BindingHandle,
&pLog->LogHandle); &pLog->LogHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -243,8 +237,7 @@ CloseEventLog(
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI BOOL WINAPI
DeregisterEventSource( DeregisterEventSource(IN HANDLE hEventLog)
IN HANDLE hEventLog)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
NTSTATUS Status; NTSTATUS Status;
@ -255,14 +248,14 @@ DeregisterEventSource(
if (!pLog) if (!pLog)
return TRUE; return TRUE;
Status = ElfrDeregisterEventSource( Status = ElfrDeregisterEventSource(pLog->BindingHandle,
pLog->BindingHandle,
&pLog->LogHandle); &pLog->LogHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -275,8 +268,7 @@ DeregisterEventSource(
* NumberOfRecords [] * NumberOfRecords []
*/ */
BOOL WINAPI BOOL WINAPI
GetNumberOfEventLogRecords( GetNumberOfEventLogRecords(IN HANDLE hEventLog,
IN HANDLE hEventLog,
OUT PDWORD NumberOfRecords) OUT PDWORD NumberOfRecords)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -291,8 +283,8 @@ GetNumberOfEventLogRecords(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrNumberOfRecords(
pLog->BindingHandle, Status = ElfrNumberOfRecords(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&Records); &Records);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -302,6 +294,7 @@ GetNumberOfEventLogRecords(
} }
*NumberOfRecords = Records; *NumberOfRecords = Records;
return TRUE; return TRUE;
} }
@ -314,8 +307,7 @@ GetNumberOfEventLogRecords(
* OldestRecord [] * OldestRecord []
*/ */
BOOL WINAPI BOOL WINAPI
GetOldestEventLogRecord( GetOldestEventLogRecord(IN HANDLE hEventLog,
IN HANDLE hEventLog,
OUT PDWORD OldestRecord) OUT PDWORD OldestRecord)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -330,8 +322,8 @@ GetOldestEventLogRecord(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrOldestRecord(
pLog->BindingHandle, Status = ElfrOldestRecord(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
&Oldest); &Oldest);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -341,6 +333,7 @@ GetOldestEventLogRecord(
} }
*OldestRecord = Oldest; *OldestRecord = Oldest;
return TRUE; return TRUE;
} }
@ -353,8 +346,7 @@ GetOldestEventLogRecord(
* hEvent [] * hEvent []
*/ */
BOOL WINAPI BOOL WINAPI
NotifyChangeEventLog( NotifyChangeEventLog(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN HANDLE hEvent) IN HANDLE hEvent)
{ {
/* Use ElfrChangeNotify */ /* Use ElfrChangeNotify */
@ -368,8 +360,7 @@ NotifyChangeEventLog(
* OpenBackupEventLogA [ADVAPI32.@] * OpenBackupEventLogA [ADVAPI32.@]
*/ */
HANDLE WINAPI HANDLE WINAPI
OpenBackupEventLogA( OpenBackupEventLogA(IN LPCSTR lpUNCServerName,
IN LPCSTR lpUNCServerName,
IN LPCSTR lpFileName) IN LPCSTR lpFileName)
{ {
UNICODE_STRING UNCServerName; UNICODE_STRING UNCServerName;
@ -383,6 +374,7 @@ OpenBackupEventLogA(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName)) if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{ {
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
@ -390,8 +382,7 @@ OpenBackupEventLogA(
return NULL; return NULL;
} }
Handle = OpenBackupEventLogW( Handle = OpenBackupEventLogW(UNCServerName.Buffer,
UNCServerName.Buffer,
FileName.Buffer); FileName.Buffer);
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
@ -409,8 +400,7 @@ OpenBackupEventLogA(
* lpFileName [] * lpFileName []
*/ */
HANDLE WINAPI HANDLE WINAPI
OpenBackupEventLogW( OpenBackupEventLogW(IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpFileName) IN LPCWSTR lpFileName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -429,6 +419,7 @@ OpenBackupEventLogW(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
ZeroMemory(pLog, sizeof(LOG_INFO)); ZeroMemory(pLog, sizeof(LOG_INFO));
if (lpUNCServerName == NULL || *lpUNCServerName == 0) if (lpUNCServerName == NULL || *lpUNCServerName == 0)
@ -454,20 +445,19 @@ OpenBackupEventLogW(
} }
} }
Status = ElfrOpenBELW( Status = ElfrOpenBELW(pLog->BindingHandle,
pLog->BindingHandle,
(LPWSTR)lpUNCServerName, (LPWSTR)lpUNCServerName,
&FileName, &FileName,
0, 0,
0, 0,
&pLog->LogHandle); &pLog->LogHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
HeapFree(GetProcessHeap(), 0, pLog); HeapFree(GetProcessHeap(), 0, pLog);
return NULL; return NULL;
} }
return pLog; return pLog;
} }
@ -476,8 +466,7 @@ OpenBackupEventLogW(
* OpenEventLogA [ADVAPI32.@] * OpenEventLogA [ADVAPI32.@]
*/ */
HANDLE WINAPI HANDLE WINAPI
OpenEventLogA( OpenEventLogA(IN LPCSTR lpUNCServerName,
IN LPCSTR lpUNCServerName,
IN LPCSTR lpSourceName) IN LPCSTR lpSourceName)
{ {
UNICODE_STRING UNCServerName; UNICODE_STRING UNCServerName;
@ -489,6 +478,7 @@ OpenEventLogA(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
if (!RtlCreateUnicodeStringFromAsciiz(&SourceName, lpSourceName)) if (!RtlCreateUnicodeStringFromAsciiz(&SourceName, lpSourceName))
{ {
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
@ -496,7 +486,8 @@ OpenEventLogA(
return NULL; return NULL;
} }
Handle = OpenEventLogW(UNCServerName.Buffer, SourceName.Buffer); Handle = OpenEventLogW(UNCServerName.Buffer,
SourceName.Buffer);
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
RtlFreeUnicodeString(&SourceName); RtlFreeUnicodeString(&SourceName);
@ -513,8 +504,7 @@ OpenEventLogA(
* lpSourceName [] * lpSourceName []
*/ */
HANDLE WINAPI HANDLE WINAPI
OpenEventLogW( OpenEventLogW(IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpSourceName) IN LPCWSTR lpSourceName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -533,6 +523,7 @@ OpenEventLogW(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
ZeroMemory(pLog, sizeof(LOG_INFO)); ZeroMemory(pLog, sizeof(LOG_INFO));
if (lpUNCServerName == NULL || *lpUNCServerName == 0) if (lpUNCServerName == NULL || *lpUNCServerName == 0)
@ -558,21 +549,20 @@ OpenEventLogW(
} }
} }
Status = ElfrOpenELW( Status = ElfrOpenELW(pLog->BindingHandle,
pLog->BindingHandle,
(LPWSTR)lpUNCServerName, (LPWSTR)lpUNCServerName,
&SourceName, &SourceName,
&EmptyString, &EmptyString,
0, 0,
0, 0,
&pLog->LogHandle); &pLog->LogHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
HeapFree(GetProcessHeap(), 0, pLog); HeapFree(GetProcessHeap(), 0, pLog);
return NULL; return NULL;
} }
return pLog; return pLog;
} }
@ -581,8 +571,7 @@ OpenEventLogW(
* ReadEventLogA [ADVAPI32.@] * ReadEventLogA [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
ReadEventLogA( ReadEventLogA(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN DWORD dwReadFlags, IN DWORD dwReadFlags,
IN DWORD dwRecordOffset, IN DWORD dwRecordOffset,
OUT LPVOID lpBuffer, OUT LPVOID lpBuffer,
@ -604,8 +593,8 @@ ReadEventLogA(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrReadELA(
pLog->BindingHandle, Status = ElfrReadELA(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
dwReadFlags, dwReadFlags,
dwRecordOffset, dwRecordOffset,
@ -621,6 +610,7 @@ ReadEventLogA(
*pnBytesRead = (DWORD)bytesRead; *pnBytesRead = (DWORD)bytesRead;
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded; *pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
return TRUE; return TRUE;
} }
@ -638,8 +628,7 @@ ReadEventLogA(
* pnMinNumberOfBytesNeeded [] * pnMinNumberOfBytesNeeded []
*/ */
BOOL WINAPI BOOL WINAPI
ReadEventLogW( ReadEventLogW(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN DWORD dwReadFlags, IN DWORD dwReadFlags,
IN DWORD dwRecordOffset, IN DWORD dwRecordOffset,
OUT LPVOID lpBuffer, OUT LPVOID lpBuffer,
@ -661,8 +650,8 @@ ReadEventLogW(
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
Status = ElfrReadELW(
pLog->BindingHandle, Status = ElfrReadELW(pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
dwReadFlags, dwReadFlags,
dwRecordOffset, dwRecordOffset,
@ -678,6 +667,7 @@ ReadEventLogW(
*pnBytesRead = (DWORD)bytesRead; *pnBytesRead = (DWORD)bytesRead;
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded; *pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
return TRUE; return TRUE;
} }
@ -686,8 +676,7 @@ ReadEventLogW(
* RegisterEventSourceA [ADVAPI32.@] * RegisterEventSourceA [ADVAPI32.@]
*/ */
HANDLE WINAPI HANDLE WINAPI
RegisterEventSourceA( RegisterEventSourceA(IN LPCSTR lpUNCServerName,
IN LPCSTR lpUNCServerName,
IN LPCSTR lpSourceName) IN LPCSTR lpSourceName)
{ {
UNICODE_STRING UNCServerName; UNICODE_STRING UNCServerName;
@ -701,6 +690,7 @@ RegisterEventSourceA(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
if (!RtlCreateUnicodeStringFromAsciiz(&SourceName, lpSourceName)) if (!RtlCreateUnicodeStringFromAsciiz(&SourceName, lpSourceName))
{ {
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
@ -708,7 +698,8 @@ RegisterEventSourceA(
return NULL; return NULL;
} }
Handle = RegisterEventSourceW(UNCServerName.Buffer, SourceName.Buffer); Handle = RegisterEventSourceW(UNCServerName.Buffer,
SourceName.Buffer);
RtlFreeUnicodeString(&UNCServerName); RtlFreeUnicodeString(&UNCServerName);
RtlFreeUnicodeString(&SourceName); RtlFreeUnicodeString(&SourceName);
@ -730,8 +721,7 @@ RegisterEventSourceA(
* Failure: NULL * Failure: NULL
*/ */
HANDLE WINAPI HANDLE WINAPI
RegisterEventSourceW( RegisterEventSourceW(IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpSourceName) IN LPCWSTR lpSourceName)
{ {
PLOG_INFO pLog; PLOG_INFO pLog;
@ -750,6 +740,7 @@ RegisterEventSourceW(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
ZeroMemory(pLog, sizeof(LOG_INFO)); ZeroMemory(pLog, sizeof(LOG_INFO));
if (lpUNCServerName == NULL || *lpUNCServerName == 0) if (lpUNCServerName == NULL || *lpUNCServerName == 0)
@ -775,21 +766,20 @@ RegisterEventSourceW(
} }
} }
Status = ElfrRegisterEventSourceW( Status = ElfrRegisterEventSourceW(pLog->BindingHandle,
pLog->BindingHandle,
(LPWSTR)lpUNCServerName, (LPWSTR)lpUNCServerName,
&SourceName, &SourceName,
&EmptyString, &EmptyString,
0, 0,
0, 0,
&pLog->LogHandle); &pLog->LogHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
HeapFree(GetProcessHeap(), 0, pLog); HeapFree(GetProcessHeap(), 0, pLog);
return NULL; return NULL;
} }
return pLog; return pLog;
} }
@ -798,8 +788,7 @@ RegisterEventSourceW(
* ReportEventA [ADVAPI32.@] * ReportEventA [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
ReportEventA( ReportEventA(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN WORD wType, IN WORD wType,
IN WORD wCategory, IN WORD wCategory,
IN DWORD dwEventID, IN DWORD dwEventID,
@ -820,8 +809,7 @@ ReportEventA(
if (lpStrings == NULL) if (lpStrings == NULL)
return TRUE; return TRUE;
wideStrArray = HeapAlloc( wideStrArray = HeapAlloc(GetProcessHeap(),
GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
sizeof(LPCWSTR) * wNumStrings); sizeof(LPCWSTR) * wNumStrings);
@ -834,8 +822,7 @@ ReportEventA(
if (i == wNumStrings) if (i == wNumStrings)
{ {
ret = ReportEventW( ret = ReportEventW(hEventLog,
hEventLog,
wType, wType,
wCategory, wCategory,
dwEventID, dwEventID,
@ -855,15 +842,13 @@ ReportEventA(
{ {
if (wideStrArray[i]) if (wideStrArray[i])
{ {
HeapFree( HeapFree(GetProcessHeap(),
GetProcessHeap(),
0, 0,
(PVOID)wideStrArray[i]); (PVOID)wideStrArray[i]);
} }
} }
HeapFree( HeapFree(GetProcessHeap(),
GetProcessHeap(),
0, 0,
wideStrArray); wideStrArray);
@ -886,8 +871,7 @@ ReportEventA(
* lpRawData [] * lpRawData []
*/ */
BOOL WINAPI BOOL WINAPI
ReportEventW( ReportEventW(IN HANDLE hEventLog,
IN HANDLE hEventLog,
IN WORD wType, IN WORD wType,
IN WORD wCategory, IN WORD wCategory,
IN DWORD dwEventID, IN DWORD dwEventID,
@ -914,8 +898,7 @@ ReportEventW(
return FALSE; return FALSE;
} }
Strings = HeapAlloc( Strings = HeapAlloc(GetProcessHeap(),
GetProcessHeap(),
0, 0,
wNumStrings * sizeof(UNICODE_STRING)); wNumStrings * sizeof(UNICODE_STRING));
if (!Strings) if (!Strings)
@ -923,11 +906,11 @@ ReportEventW(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE; return FALSE;
} }
for (i = 0; i < wNumStrings; i++) for (i = 0; i < wNumStrings; i++)
RtlInitUnicodeString(&Strings[i], lpStrings[i]); RtlInitUnicodeString(&Strings[i], lpStrings[i]);
Status = ElfrReportEventW( Status = ElfrReportEventW(pLog->BindingHandle,
pLog->BindingHandle,
pLog->LogHandle, pLog->LogHandle,
0, /* FIXME: Time */ 0, /* FIXME: Time */
wType, wType,
@ -949,6 +932,7 @@ ReportEventW(
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
#else #else
int i; int i;

View file

@ -18,23 +18,23 @@
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
PrivilegeCheck (HANDLE ClientToken, PrivilegeCheck(HANDLE ClientToken,
PPRIVILEGE_SET RequiredPrivileges, PPRIVILEGE_SET RequiredPrivileges,
LPBOOL pfResult) LPBOOL pfResult)
{ {
BOOLEAN Result; BOOLEAN Result;
NTSTATUS Status; NTSTATUS Status;
Status = NtPrivilegeCheck (ClientToken, Status = NtPrivilegeCheck(ClientToken,
RequiredPrivileges, RequiredPrivileges,
&Result); &Result);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
*pfResult = (BOOL) Result; *pfResult = (BOOL)Result;
return TRUE; return TRUE;
} }

View file

@ -17,7 +17,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AdjustTokenGroups (HANDLE TokenHandle, AdjustTokenGroups(HANDLE TokenHandle,
BOOL ResetToDefault, BOOL ResetToDefault,
PTOKEN_GROUPS NewState, PTOKEN_GROUPS NewState,
DWORD BufferLength, DWORD BufferLength,
@ -26,15 +26,15 @@ AdjustTokenGroups (HANDLE TokenHandle,
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtAdjustGroupsToken (TokenHandle, Status = NtAdjustGroupsToken(TokenHandle,
ResetToDefault, ResetToDefault,
NewState, NewState,
BufferLength, BufferLength,
PreviousState, PreviousState,
(PULONG)ReturnLength); (PULONG)ReturnLength);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -46,7 +46,7 @@ AdjustTokenGroups (HANDLE TokenHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AdjustTokenPrivileges (HANDLE TokenHandle, AdjustTokenPrivileges(HANDLE TokenHandle,
BOOL DisableAllPrivileges, BOOL DisableAllPrivileges,
PTOKEN_PRIVILEGES NewState, PTOKEN_PRIVILEGES NewState,
DWORD BufferLength, DWORD BufferLength,
@ -55,7 +55,7 @@ AdjustTokenPrivileges (HANDLE TokenHandle,
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtAdjustPrivilegesToken (TokenHandle, Status = NtAdjustPrivilegesToken(TokenHandle,
DisableAllPrivileges, DisableAllPrivileges,
NewState, NewState,
BufferLength, BufferLength,
@ -66,13 +66,16 @@ AdjustTokenPrivileges (HANDLE TokenHandle,
SetLastError(ERROR_NOT_ALL_ASSIGNED); SetLastError(ERROR_NOT_ALL_ASSIGNED);
return TRUE; return TRUE;
} }
if (! NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
SetLastError(ERROR_SUCCESS); /* AdjustTokenPrivileges is documented to do this */ /* AdjustTokenPrivileges is documented to do this */
SetLastError(ERROR_SUCCESS);
return TRUE; return TRUE;
} }
@ -81,7 +84,7 @@ AdjustTokenPrivileges (HANDLE TokenHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
GetTokenInformation (HANDLE TokenHandle, GetTokenInformation(HANDLE TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass, TOKEN_INFORMATION_CLASS TokenInformationClass,
LPVOID TokenInformation, LPVOID TokenInformation,
DWORD TokenInformationLength, DWORD TokenInformationLength,
@ -89,14 +92,14 @@ GetTokenInformation (HANDLE TokenHandle,
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtQueryInformationToken (TokenHandle, Status = NtQueryInformationToken(TokenHandle,
TokenInformationClass, TokenInformationClass,
TokenInformation, TokenInformation,
TokenInformationLength, TokenInformationLength,
(PULONG)ReturnLength); (PULONG)ReturnLength);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -108,20 +111,20 @@ GetTokenInformation (HANDLE TokenHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
SetTokenInformation (HANDLE TokenHandle, SetTokenInformation(HANDLE TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass, TOKEN_INFORMATION_CLASS TokenInformationClass,
LPVOID TokenInformation, LPVOID TokenInformation,
DWORD TokenInformationLength) DWORD TokenInformationLength)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtSetInformationToken (TokenHandle, Status = NtSetInformationToken(TokenHandle,
TokenInformationClass, TokenInformationClass,
TokenInformation, TokenInformation,
TokenInformationLength); TokenInformationLength);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -133,7 +136,7 @@ SetTokenInformation (HANDLE TokenHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AccessCheck (PSECURITY_DESCRIPTOR pSecurityDescriptor, AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor,
HANDLE ClientToken, HANDLE ClientToken,
DWORD DesiredAccess, DWORD DesiredAccess,
PGENERIC_MAPPING GenericMapping, PGENERIC_MAPPING GenericMapping,
@ -145,7 +148,7 @@ AccessCheck (PSECURITY_DESCRIPTOR pSecurityDescriptor,
NTSTATUS Status; NTSTATUS Status;
NTSTATUS AccessStat; NTSTATUS AccessStat;
Status = NtAccessCheck (pSecurityDescriptor, Status = NtAccessCheck(pSecurityDescriptor,
ClientToken, ClientToken,
DesiredAccess, DesiredAccess,
GenericMapping, GenericMapping,
@ -153,15 +156,15 @@ AccessCheck (PSECURITY_DESCRIPTOR pSecurityDescriptor,
(PULONG)PrivilegeSetLength, (PULONG)PrivilegeSetLength,
(PACCESS_MASK)GrantedAccess, (PACCESS_MASK)GrantedAccess,
&AccessStat); &AccessStat);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
if (!NT_SUCCESS (AccessStat)) if (!NT_SUCCESS(AccessStat))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
*AccessStatus = FALSE; *AccessStatus = FALSE;
return TRUE; return TRUE;
} }
@ -176,18 +179,18 @@ AccessCheck (PSECURITY_DESCRIPTOR pSecurityDescriptor,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
OpenProcessToken (HANDLE ProcessHandle, OpenProcessToken(HANDLE ProcessHandle,
DWORD DesiredAccess, DWORD DesiredAccess,
PHANDLE TokenHandle) PHANDLE TokenHandle)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtOpenProcessToken (ProcessHandle, Status = NtOpenProcessToken(ProcessHandle,
DesiredAccess, DesiredAccess,
TokenHandle); TokenHandle);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -199,20 +202,20 @@ OpenProcessToken (HANDLE ProcessHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
OpenThreadToken (HANDLE ThreadHandle, OpenThreadToken(HANDLE ThreadHandle,
DWORD DesiredAccess, DWORD DesiredAccess,
BOOL OpenAsSelf, BOOL OpenAsSelf,
PHANDLE TokenHandle) PHANDLE TokenHandle)
{ {
NTSTATUS Status; NTSTATUS Status;
Status = NtOpenThreadToken (ThreadHandle, Status = NtOpenThreadToken(ThreadHandle,
DesiredAccess, DesiredAccess,
OpenAsSelf, OpenAsSelf,
TokenHandle); TokenHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -224,21 +227,21 @@ OpenThreadToken (HANDLE ThreadHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
SetThreadToken (IN PHANDLE ThreadHandle OPTIONAL, SetThreadToken(IN PHANDLE ThreadHandle OPTIONAL,
IN HANDLE TokenHandle) IN HANDLE TokenHandle)
{ {
NTSTATUS Status; NTSTATUS Status;
HANDLE hThread; HANDLE hThread;
hThread = ((ThreadHandle != NULL) ? *ThreadHandle : NtCurrentThread()); hThread = (ThreadHandle != NULL) ? *ThreadHandle : NtCurrentThread();
Status = NtSetInformationThread (hThread, Status = NtSetInformationThread(hThread,
ThreadImpersonationToken, ThreadImpersonationToken,
&TokenHandle, &TokenHandle,
sizeof(HANDLE)); sizeof(HANDLE));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError (RtlNtStatusToDosError (Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
} }
@ -250,7 +253,7 @@ SetThreadToken (IN PHANDLE ThreadHandle OPTIONAL,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
DuplicateTokenEx (IN HANDLE ExistingTokenHandle, DuplicateTokenEx(IN HANDLE ExistingTokenHandle,
IN DWORD dwDesiredAccess, IN DWORD dwDesiredAccess,
IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL,
IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
@ -285,7 +288,7 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
ObjectAttributes.SecurityQualityOfService = &Sqos; ObjectAttributes.SecurityQualityOfService = &Sqos;
Status = NtDuplicateToken (ExistingTokenHandle, Status = NtDuplicateToken(ExistingTokenHandle,
dwDesiredAccess, dwDesiredAccess,
&ObjectAttributes, &ObjectAttributes,
FALSE, FALSE,
@ -305,11 +308,11 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
DuplicateToken (IN HANDLE ExistingTokenHandle, DuplicateToken(IN HANDLE ExistingTokenHandle,
IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
OUT PHANDLE DuplicateTokenHandle) OUT PHANDLE DuplicateTokenHandle)
{ {
return DuplicateTokenEx (ExistingTokenHandle, return DuplicateTokenEx(ExistingTokenHandle,
TOKEN_IMPERSONATE | TOKEN_QUERY, TOKEN_IMPERSONATE | TOKEN_QUERY,
NULL, NULL,
ImpersonationLevel, ImpersonationLevel,
@ -476,7 +479,6 @@ CheckTokenMembership(IN HANDLE ExistingTokenHandle,
&PrivBufferSize, &PrivBufferSize,
&GrantedAccess, &GrantedAccess,
&AccessStatus); &AccessStatus);
if (NT_SUCCESS(Status) && NT_SUCCESS(AccessStatus) && (GrantedAccess == 0x1)) if (NT_SUCCESS(Status) && NT_SUCCESS(AccessStatus) && (GrantedAccess == 0x1))
{ {
*IsMember = TRUE; *IsMember = TRUE;
@ -518,7 +520,6 @@ IsTokenRestricted(HANDLE TokenHandle)
/* determine the required buffer size and allocate enough memory to read the /* determine the required buffer size and allocate enough memory to read the
list of restricted SIDs */ list of restricted SIDs */
Status = NtQueryInformationToken(TokenHandle, Status = NtQueryInformationToken(TokenHandle,
TokenRestrictedSids, TokenRestrictedSids,
NULL, NULL,
@ -541,7 +542,6 @@ AllocAndReadRestrictedSids:
} }
/* actually read the list of the restricted SIDs */ /* actually read the list of the restricted SIDs */
Status = NtQueryInformationToken(TokenHandle, Status = NtQueryInformationToken(TokenHandle,
TokenRestrictedSids, TokenRestrictedSids,
lpGroups, lpGroups,
@ -554,7 +554,6 @@ AllocAndReadRestrictedSids:
else if (Status == STATUS_BUFFER_TOO_SMALL) else if (Status == STATUS_BUFFER_TOO_SMALL)
{ {
/* looks like the token was modified in the meanwhile, let's just try again */ /* looks like the token was modified in the meanwhile, let's just try again */
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
lpGroups); lpGroups);
@ -567,7 +566,6 @@ AllocAndReadRestrictedSids:
} }
/* free allocated memory */ /* free allocated memory */
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
lpGroups); lpGroups);
@ -575,9 +573,9 @@ AllocAndReadRestrictedSids:
return Ret; return Ret;
} }
BOOL STDCALL BOOL STDCALL
CreateRestrictedToken( CreateRestrictedToken(HANDLE TokenHandle,
HANDLE TokenHandle,
DWORD Flags, DWORD Flags,
DWORD DisableSidCount, DWORD DisableSidCount,
PSID_AND_ATTRIBUTES pSidAndAttributes, PSID_AND_ATTRIBUTES pSidAndAttributes,
@ -585,13 +583,13 @@ CreateRestrictedToken(
PLUID_AND_ATTRIBUTES pLUIDAndAttributes, PLUID_AND_ATTRIBUTES pLUIDAndAttributes,
DWORD RestrictedSidCount, DWORD RestrictedSidCount,
PSID_AND_ATTRIBUTES pSIDAndAttributes, PSID_AND_ATTRIBUTES pSIDAndAttributes,
PHANDLE NewTokenHandle PHANDLE NewTokenHandle)
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return FALSE; return FALSE;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -670,6 +668,7 @@ GetSiteSidFromToken(IN HANDLE TokenHandle)
return PSiteSid; return PSiteSid;
} }
BOOL BOOL
WINAPI WINAPI
CreateProcessWithTokenW(IN HANDLE hToken, CreateProcessWithTokenW(IN HANDLE hToken,