1999-01-28 14:46:25 +01:00
|
|
|
/*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 1999, 2000 Juergen Schmied <juergen.schmied@debitel.net>
|
2003-11-11 23:03:24 +01:00
|
|
|
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
1999-01-28 14:46:25 +01:00
|
|
|
*/
|
2002-03-10 00:29:33 +01:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-02-19 16:42:11 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
1997-11-30 18:45:40 +01:00
|
|
|
#include "winerror.h"
|
2002-09-06 21:36:37 +02:00
|
|
|
#include "rpcnterr.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winreg.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
2005-06-24 13:54:15 +02:00
|
|
|
#include "winioctl.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "ntstatus.h"
|
1999-07-04 13:01:21 +02:00
|
|
|
#include "ntsecapi.h"
|
2002-12-19 05:15:23 +01:00
|
|
|
#include "accctrl.h"
|
2003-11-11 23:03:24 +01:00
|
|
|
#include "sddl.h"
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
#include "winsvc.h"
|
2004-08-06 19:31:17 +02:00
|
|
|
#include "aclapi.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2002-10-23 22:20:59 +02:00
|
|
|
#include "wine/unicode.h"
|
1997-02-15 15:29:56 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes);
|
|
|
|
static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags,
|
|
|
|
PACL pAcl, LPDWORD cBytes);
|
|
|
|
static BYTE ParseAceStringFlags(LPCWSTR* StringAcl);
|
|
|
|
static BYTE ParseAceStringType(LPCWSTR* StringAcl);
|
|
|
|
static DWORD ParseAceStringRights(LPCWSTR* StringAcl);
|
|
|
|
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
|
|
|
|
LPCWSTR StringSecurityDescriptor,
|
2004-08-14 01:55:43 +02:00
|
|
|
SECURITY_DESCRIPTOR* SecurityDescriptor,
|
2003-11-11 23:03:24 +01:00
|
|
|
LPDWORD cBytes);
|
|
|
|
static DWORD ParseAclStringFlags(LPCWSTR* StringAcl);
|
|
|
|
|
|
|
|
typedef struct _ACEFLAG
|
|
|
|
{
|
|
|
|
LPCWSTR wstr;
|
|
|
|
DWORD value;
|
|
|
|
} ACEFLAG, *LPACEFLAG;
|
|
|
|
|
2005-03-05 11:46:34 +01:00
|
|
|
static SID const sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } };
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/*
|
|
|
|
* ACE access rights
|
|
|
|
*/
|
|
|
|
static const WCHAR SDDL_READ_CONTROL[] = {'R','C',0};
|
|
|
|
static const WCHAR SDDL_WRITE_DAC[] = {'W','D',0};
|
|
|
|
static const WCHAR SDDL_WRITE_OWNER[] = {'W','O',0};
|
|
|
|
static const WCHAR SDDL_STANDARD_DELETE[] = {'S','D',0};
|
|
|
|
static const WCHAR SDDL_GENERIC_ALL[] = {'G','A',0};
|
|
|
|
static const WCHAR SDDL_GENERIC_READ[] = {'G','R',0};
|
|
|
|
static const WCHAR SDDL_GENERIC_WRITE[] = {'G','W',0};
|
|
|
|
static const WCHAR SDDL_GENERIC_EXECUTE[] = {'G','X',0};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACE types
|
|
|
|
*/
|
|
|
|
static const WCHAR SDDL_ACCESS_ALLOWED[] = {'A',0};
|
|
|
|
static const WCHAR SDDL_ACCESS_DENIED[] = {'D',0};
|
|
|
|
static const WCHAR SDDL_OBJECT_ACCESS_ALLOWED[] = {'O','A',0};
|
|
|
|
static const WCHAR SDDL_OBJECT_ACCESS_DENIED[] = {'O','D',0};
|
|
|
|
static const WCHAR SDDL_AUDIT[] = {'A','U',0};
|
|
|
|
static const WCHAR SDDL_ALARM[] = {'A','L',0};
|
|
|
|
static const WCHAR SDDL_OBJECT_AUDIT[] = {'O','U',0};
|
|
|
|
static const WCHAR SDDL_OBJECT_ALARMp[] = {'O','L',0};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACE flags
|
|
|
|
*/
|
|
|
|
static const WCHAR SDDL_CONTAINER_INHERIT[] = {'C','I',0};
|
|
|
|
static const WCHAR SDDL_OBJECT_INHERIT[] = {'O','I',0};
|
|
|
|
static const WCHAR SDDL_NO_PROPAGATE[] = {'N','P',0};
|
|
|
|
static const WCHAR SDDL_INHERIT_ONLY[] = {'I','O',0};
|
|
|
|
static const WCHAR SDDL_INHERITED[] = {'I','D',0};
|
|
|
|
static const WCHAR SDDL_AUDIT_SUCCESS[] = {'S','A',0};
|
|
|
|
static const WCHAR SDDL_AUDIT_FAILURE[] = {'F','A',0};
|
|
|
|
|
2004-12-22 16:31:16 +01:00
|
|
|
/* set last error code from NT status and get the proper boolean return value */
|
|
|
|
/* used for functions that are a simple wrapper around the corresponding ntdll API */
|
|
|
|
static inline BOOL set_ntstatus( NTSTATUS status )
|
|
|
|
{
|
|
|
|
if (status) SetLastError( RtlNtStatusToDosError( status ));
|
|
|
|
return !status;
|
|
|
|
}
|
1999-02-19 17:29:05 +01:00
|
|
|
|
2005-03-05 11:46:34 +01:00
|
|
|
#define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + sizeof(sidWorld) - sizeof(DWORD))
|
|
|
|
|
|
|
|
static void GetWorldAccessACL(PACL pACL)
|
|
|
|
{
|
|
|
|
PACCESS_ALLOWED_ACE pACE = (PACCESS_ALLOWED_ACE) (pACL + 1);
|
|
|
|
|
|
|
|
pACL->AclRevision = ACL_REVISION;
|
|
|
|
pACL->Sbz1 = 0;
|
|
|
|
pACL->AclSize = WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
pACL->AceCount = 1;
|
|
|
|
pACL->Sbz2 = 0;
|
|
|
|
|
|
|
|
pACE->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
|
|
|
|
pACE->Header.AceFlags = CONTAINER_INHERIT_ACE;
|
|
|
|
pACE->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE) + sizeof(sidWorld) - sizeof(DWORD);
|
|
|
|
pACE->Mask = 0xf3ffffff; /* Everything except reserved bits */
|
|
|
|
memcpy(&pACE->SidStart, &sidWorld, sizeof(sidWorld));
|
|
|
|
}
|
|
|
|
|
2002-09-17 20:31:06 +02:00
|
|
|
/************************************************************
|
|
|
|
* ADVAPI_IsLocalComputer
|
|
|
|
*
|
|
|
|
* Checks whether the server name indicates local machine.
|
|
|
|
*/
|
2005-06-09 11:44:44 +02:00
|
|
|
static BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
|
2002-09-17 20:31:06 +02:00
|
|
|
{
|
2005-06-09 11:44:44 +02:00
|
|
|
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
|
|
|
|
BOOL Result;
|
|
|
|
LPWSTR buf;
|
|
|
|
|
|
|
|
if (!ServerName || !ServerName[0])
|
2004-11-04 05:52:17 +01:00
|
|
|
return TRUE;
|
2005-06-09 11:44:44 +02:00
|
|
|
|
|
|
|
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
|
|
|
|
Result = GetComputerNameW(buf, &dwSize);
|
|
|
|
if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
|
|
|
|
ServerName += 2;
|
|
|
|
Result = Result && !lstrcmpW(ServerName, buf);
|
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
|
|
|
|
|
|
|
return Result;
|
2002-09-17 20:31:06 +02:00
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/* ##############################
|
|
|
|
###### TOKEN FUNCTIONS ######
|
|
|
|
##############################
|
|
|
|
*/
|
1999-01-28 14:46:25 +01:00
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenProcessToken [ADVAPI32.@]
|
2003-03-18 19:35:48 +01:00
|
|
|
* Opens the access token associated with a process handle.
|
1999-01-03 13:48:29 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-01-28 14:46:25 +01:00
|
|
|
* ProcessHandle [I] Handle to process
|
|
|
|
* DesiredAccess [I] Desired access to process
|
|
|
|
* TokenHandle [O] Pointer to handle of open access token
|
1999-01-03 13:48:29 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. TokenHandle contains the access token.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* See NtOpenProcessToken.
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE *TokenHandle )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
|
1999-03-09 18:43:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenThreadToken [ADVAPI32.@]
|
1999-03-09 18:43:44 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Opens the access token associated with a thread handle.
|
|
|
|
*
|
1999-03-09 18:43:44 +01:00
|
|
|
* PARAMS
|
2003-03-18 19:35:48 +01:00
|
|
|
* ThreadHandle [I] Handle to process
|
|
|
|
* DesiredAccess [I] Desired access to the thread
|
|
|
|
* OpenAsSelf [I] ???
|
|
|
|
* TokenHandle [O] Destination for the token handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. TokenHandle contains the access token.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* See NtOpenThreadToken.
|
1999-03-09 18:43:44 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
|
1999-03-09 18:43:44 +01:00
|
|
|
BOOL OpenAsSelf, HANDLE *TokenHandle)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState,
|
|
|
|
DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength )
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( NtAdjustGroupsToken(TokenHandle, ResetToDefault, NewState, BufferLength,
|
|
|
|
PreviousState, ReturnLength));
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* AdjustTokenPrivileges [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Adjust the privileges of an open token handle.
|
|
|
|
*
|
1999-02-19 17:29:05 +01:00
|
|
|
* PARAMS
|
2003-03-18 19:35:48 +01:00
|
|
|
* TokenHandle [I] Handle from OpenProcessToken() or OpenThreadToken()
|
|
|
|
* DisableAllPrivileges [I] TRUE=Remove all privileges, FALSE=Use NewState
|
|
|
|
* NewState [I] Desired new privileges of the token
|
|
|
|
* BufferLength [I] Length of NewState
|
|
|
|
* PreviousState [O] Destination for the previous state
|
|
|
|
* ReturnLength [I/O] Size of PreviousState
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. Privileges are set to NewState and PreviousState is updated.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* See NtAdjustPrivilegesToken.
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
|
2002-04-03 21:53:31 +02:00
|
|
|
LPVOID NewState, DWORD BufferLength,
|
1999-02-19 17:29:05 +01:00
|
|
|
LPVOID PreviousState, LPDWORD ReturnLength )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2005-02-11 12:52:06 +01:00
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
status = NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges,
|
2004-12-22 16:31:16 +01:00
|
|
|
NewState, BufferLength, PreviousState,
|
2005-02-11 12:52:06 +01:00
|
|
|
ReturnLength);
|
|
|
|
SetLastError( RtlNtStatusToDosError( status ));
|
|
|
|
if ((status == STATUS_SUCCESS) || (status == STATUS_NOT_ALL_ASSIGNED))
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
2002-01-31 21:44:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* CheckTokenMembership [ADVAPI32.@]
|
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Determine if an access token is a member of a SID.
|
|
|
|
*
|
2002-01-31 21:44:02 +01:00
|
|
|
* PARAMS
|
2003-03-18 19:35:48 +01:00
|
|
|
* TokenHandle [I] Handle from OpenProcessToken() or OpenThreadToken()
|
|
|
|
* SidToCheck [I] SID that possibly contains the token
|
|
|
|
* IsMember [O] Destination for result.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. IsMember is TRUE if TokenHandle is a member, FALSE otherwise.
|
|
|
|
* Failure: FALSE.
|
2002-01-31 21:44:02 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
|
|
|
|
PBOOL IsMember )
|
|
|
|
{
|
2002-10-25 21:17:33 +02:00
|
|
|
FIXME("(%p %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
|
2002-01-31 21:44:02 +01:00
|
|
|
|
|
|
|
*IsMember = TRUE;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetTokenInformation [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
2003-03-18 19:35:48 +01:00
|
|
|
* token [I] Handle from OpenProcessToken() or OpenThreadToken()
|
|
|
|
* tokeninfoclass [I] A TOKEN_INFORMATION_CLASS from "winnt.h"
|
|
|
|
* tokeninfo [O] Destination for token information
|
|
|
|
* tokeninfolength [I] Length of tokeninfo
|
|
|
|
* retlen [O] Destination for returned token information length
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. tokeninfo contains retlen bytes of token information
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* See NtQueryInformationToken.
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-04-03 21:53:31 +02:00
|
|
|
GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
|
1999-03-09 18:43:44 +01:00
|
|
|
LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2002-10-25 21:17:33 +02:00
|
|
|
TRACE("(%p, %s, %p, %ld, %p): \n",
|
2002-08-26 23:39:17 +02:00
|
|
|
token,
|
|
|
|
(tokeninfoclass == TokenUser) ? "TokenUser" :
|
|
|
|
(tokeninfoclass == TokenGroups) ? "TokenGroups" :
|
|
|
|
(tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
|
|
|
|
(tokeninfoclass == TokenOwner) ? "TokenOwner" :
|
|
|
|
(tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
|
|
|
|
(tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
|
|
|
|
(tokeninfoclass == TokenSource) ? "TokenSource" :
|
|
|
|
(tokeninfoclass == TokenType) ? "TokenType" :
|
|
|
|
(tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
|
|
|
|
(tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
|
|
|
|
(tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
|
|
|
|
(tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
|
|
|
|
(tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
|
|
|
|
(tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
|
|
|
|
(tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
|
|
|
|
"Unknown",
|
|
|
|
tokeninfo, tokeninfolength, retlen);
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( NtQueryInformationToken( token, tokeninfoclass, tokeninfo,
|
|
|
|
tokeninfolength, retlen));
|
2002-08-26 23:39:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SetTokenInformation [ADVAPI32.@]
|
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Set information for an access token.
|
|
|
|
*
|
2002-08-26 23:39:17 +02:00
|
|
|
* PARAMS
|
2003-03-18 19:35:48 +01:00
|
|
|
* token [I] Handle from OpenProcessToken() or OpenThreadToken()
|
|
|
|
* tokeninfoclass [I] A TOKEN_INFORMATION_CLASS from "winnt.h"
|
|
|
|
* tokeninfo [I] Token information to set
|
|
|
|
* tokeninfolength [I] Length of tokeninfo
|
2002-08-26 23:39:17 +02:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. The information for the token is set to tokeninfo.
|
|
|
|
* Failure: FALSE.
|
2002-08-26 23:39:17 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
SetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
|
|
|
|
LPVOID tokeninfo, DWORD tokeninfolength )
|
|
|
|
{
|
2004-08-25 19:30:46 +02:00
|
|
|
TRACE("(%p, %s, %p, %ld): stub\n",
|
2002-08-26 23:39:17 +02:00
|
|
|
token,
|
|
|
|
(tokeninfoclass == TokenUser) ? "TokenUser" :
|
|
|
|
(tokeninfoclass == TokenGroups) ? "TokenGroups" :
|
|
|
|
(tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
|
|
|
|
(tokeninfoclass == TokenOwner) ? "TokenOwner" :
|
|
|
|
(tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
|
|
|
|
(tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
|
|
|
|
(tokeninfoclass == TokenSource) ? "TokenSource" :
|
|
|
|
(tokeninfoclass == TokenType) ? "TokenType" :
|
|
|
|
(tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
|
|
|
|
(tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
|
|
|
|
(tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
|
|
|
|
(tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
|
|
|
|
(tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
|
|
|
|
(tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
|
|
|
|
(tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
|
|
|
|
"Unknown",
|
|
|
|
tokeninfo, tokeninfolength);
|
|
|
|
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( NtSetInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength ));
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/*************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetThreadToken [ADVAPI32.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Assigns an 'impersonation token' to a thread so it can assume the
|
2004-04-28 02:24:44 +02:00
|
|
|
* security privileges of another thread or process. Can also remove
|
2003-03-18 19:35:48 +01:00
|
|
|
* a previously assigned token.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* thread [O] Handle to thread to set the token for
|
|
|
|
* token [I] Token to set
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. The threads access token is set to token
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Only supported on NT or higher. On Win9X this function does nothing.
|
|
|
|
* See SetTokenInformation.
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( NtSetInformationThread( thread ? *thread : GetCurrentThread(),
|
|
|
|
ThreadImpersonationToken, &token, sizeof token ));
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/* ##############################
|
|
|
|
###### SID FUNCTIONS ######
|
|
|
|
##############################
|
|
|
|
*/
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* AllocateAndInitializeSid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* pIdentifierAuthority []
|
|
|
|
* nSubAuthorityCount []
|
|
|
|
* nSubAuthority0 []
|
|
|
|
* nSubAuthority1 []
|
|
|
|
* nSubAuthority2 []
|
|
|
|
* nSubAuthority3 []
|
|
|
|
* nSubAuthority4 []
|
|
|
|
* nSubAuthority5 []
|
|
|
|
* nSubAuthority6 []
|
|
|
|
* nSubAuthority7 []
|
|
|
|
* pSid []
|
1999-01-28 14:46:25 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-19 17:29:05 +01:00
|
|
|
AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
|
|
|
|
BYTE nSubAuthorityCount,
|
|
|
|
DWORD nSubAuthority0, DWORD nSubAuthority1,
|
|
|
|
DWORD nSubAuthority2, DWORD nSubAuthority3,
|
|
|
|
DWORD nSubAuthority4, DWORD nSubAuthority5,
|
|
|
|
DWORD nSubAuthority6, DWORD nSubAuthority7,
|
|
|
|
PSID *pSid )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlAllocateAndInitializeSid(
|
|
|
|
pIdentifierAuthority, nSubAuthorityCount,
|
|
|
|
nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
|
|
|
|
nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
|
|
|
|
pSid ));
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
1999-01-03 13:48:29 +01:00
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* FreeSid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* pSid []
|
1999-01-28 14:46:25 +01:00
|
|
|
*/
|
1999-07-04 13:01:21 +02:00
|
|
|
PVOID WINAPI
|
1999-02-19 17:29:05 +01:00
|
|
|
FreeSid( PSID pSid )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
RtlFreeSid(pSid);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return NULL; /* is documented like this */
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* CopySid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* nDestinationSidLength []
|
|
|
|
* pDestinationSid []
|
|
|
|
* pSourceSid []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-12 18:47:07 +01:00
|
|
|
CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
IsTokenRestricted( HANDLE TokenHandle )
|
|
|
|
{
|
2005-06-21 22:49:54 +02:00
|
|
|
TOKEN_GROUPS *groups;
|
|
|
|
DWORD size;
|
|
|
|
NTSTATUS status;
|
|
|
|
BOOL restricted;
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
|
2005-06-21 22:49:54 +02:00
|
|
|
TRACE("(%p)\n", TokenHandle);
|
|
|
|
|
|
|
|
status = NtQueryInformationToken(TokenHandle, TokenRestrictedSids, NULL, 0, &size);
|
|
|
|
if (status != STATUS_BUFFER_TOO_SMALL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
groups = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if (!groups)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = NtQueryInformationToken(TokenHandle, TokenRestrictedSids, groups, size, &size);
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, groups);
|
|
|
|
return set_ntstatus(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (groups->GroupCount)
|
|
|
|
restricted = TRUE;
|
|
|
|
else
|
|
|
|
restricted = FALSE;
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, groups);
|
|
|
|
|
|
|
|
return restricted;
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* IsValidSid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-12 18:47:07 +01:00
|
|
|
IsValidSid( PSID pSid )
|
1999-01-28 14:46:25 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlValidSid( pSid );
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* EqualSid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid1 []
|
|
|
|
* pSid2 []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-12 18:47:07 +01:00
|
|
|
EqualSid( PSID pSid1, PSID pSid2 )
|
1999-01-28 14:46:25 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlEqualSid( pSid1, pSid2 );
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* EqualPrefixSid [ADVAPI32.@]
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
|
|
|
return RtlEqualPrefixSid(pSid1, pSid2);
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSidLengthRequired [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* nSubAuthorityCount []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-01-28 14:46:25 +01:00
|
|
|
DWORD WINAPI
|
|
|
|
GetSidLengthRequired( BYTE nSubAuthorityCount )
|
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlLengthRequiredSid(nSubAuthorityCount);
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* InitializeSid [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* pIdentifierAuthority []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
InitializeSid (
|
|
|
|
PSID pSid,
|
|
|
|
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
|
|
|
|
BYTE nSubAuthorityCount)
|
1999-01-28 14:46:25 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
DWORD WINAPI
|
|
|
|
GetEffectiveRightsFromAclA( PACL pacl, PTRUSTEEA pTrustee, PACCESS_MASK pAccessRights )
|
|
|
|
{
|
|
|
|
FIXME("%p %p %p - stub\n", pacl, pTrustee, pAccessRights);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI
|
|
|
|
GetEffectiveRightsFromAclW( PACL pacl, PTRUSTEEW pTrustee, PACCESS_MASK pAccessRights )
|
|
|
|
{
|
|
|
|
FIXME("%p %p %p - stub\n", pacl, pTrustee, pAccessRights);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSidIdentifierAuthority [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* pSid []
|
1999-01-28 14:46:25 +01:00
|
|
|
*/
|
1999-02-19 17:29:05 +01:00
|
|
|
PSID_IDENTIFIER_AUTHORITY WINAPI
|
|
|
|
GetSidIdentifierAuthority( PSID pSid )
|
1999-01-28 14:46:25 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlIdentifierAuthoritySid(pSid);
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
1997-02-15 15:29:56 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSidSubAuthority [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid []
|
|
|
|
* nSubAuthority []
|
|
|
|
*/
|
1999-07-04 13:01:21 +02:00
|
|
|
PDWORD WINAPI
|
1999-02-19 17:29:05 +01:00
|
|
|
GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
|
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlSubAuthoritySid(pSid, nSubAuthority);
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
1997-02-15 15:29:56 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSidSubAuthorityCount [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid []
|
|
|
|
*/
|
1999-07-04 13:01:21 +02:00
|
|
|
PUCHAR WINAPI
|
1999-02-19 17:29:05 +01:00
|
|
|
GetSidSubAuthorityCount (PSID pSid)
|
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlSubAuthorityCountSid(pSid);
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetLengthSid [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-19 17:29:05 +01:00
|
|
|
DWORD WINAPI
|
|
|
|
GetLengthSid (PSID pSid)
|
Release 971101
Thu Oct 30 21:52:23 1997 Martin Boehme <boehme@informatik.mu-luebeck.de>
* [windows/nonclient.c]
Changed NC_TrackSysMenu to give the same behaviour as MS-Windows,
i.e. system menu already appears when mouse button is depressed.
Changed NC_HandleNCLButtonDblClk so that double clicks on scroll
bar arrows are handled the same way as single clicks.
* [windows/winpos.c]
Fixed SetWindowPos32 to clear WIN_NO_REDRAW when SWP_SHOWWINDOW is
set; this is the way MS-Windows behaves.
Thu Oct 30 21:08:57 1997 Morten Welinder <terra@diku.dk>
* [controls/status.c]
In SW_SetText, fix condition, I hope.
* [controls/menu.c]
(GetMenuState32): Don't mask return value. Print more debug info.
(MENU_MenuBarCalcSize): Be more careful when printing debug
information.
(MENU_SetItemData): Empty strings are separators.
* [graphics/x11drv/text.c]
Don't prototype CLIPPING_IntersectClipRect.
* [include/dc.h]
Prototype CLIPPING_IntersectClipRect.
* [objects/font.c]
Remove non-portable (and faulty) smartness in FONT_TextMetric*to*.
In CreateFont32W and CreateFont16, handle null font name.
* [objects/text.c]
(TEXT_NextLine): Fix end-of-line bug.
* [if1632/shell32.spec]
Activate existing implementation of ExtractIconA.
* [misc/shell.c]
For Control_RunDLL, add types for parameters.
Thu Oct 30 14:54:11 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [controls/static.c] [include/windows.h] [misc/spy.c]
Added some win32 defines to static controls, basic SS_BITMAP style
handling implemented. [please add more, I am lacking knowledge and
time]
* [controls/status.c]
part_num 255 seems to indicate whole statusline (win95 cdplayer.exe)
* [if1632/thunk.c] [tools/build.c]
Support lret and 0x66 lret calls for CallTo16_regs
(needed for KERNEL32_45)
Fixed KERNEL32_45, QT_Thunk (should work now).
* [if1632/relay.c][if1632/builtin.c][tools/build.c][if1632/*32.spec]
Added string dumping to relay debugging for win32 apifuncs.
* [misc/ver.c]
Fixed and cleaned up VerQueryValue*.
* [multimedia/*.c][include/mmsystem.h][if1632/mmsystem.spec]
[if1632/winmm.spec]
Win32 support for lowlevel multimedia functions.
Added some mixer* lowlevel functions.
Some small fixes in the audio lowlevel queue handling, code
reformatting/cleanups.
* [debugger/hash.c]
Don't show difference between 16bit symbols if they are in
different segments.
* [objects/cursoricon.c]
Added GetIconInfo (partial) and CreateIconIndirect.
* [windows/mdi.c]
Fixed some "bad class" problems and crashes in MDICreateChild,
which happen in Win32 (jwp32.exe).
Wed Oct 29 00:57:27 1997 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [if1632/winaspi.spec] [misc/aspi.c] [include/aspi.c]
[documentation/aspi] [include/callback.h]
Added support for 16 bit ASPI calls to linux generic SCSI.
The support is not complete, but appears to run my Mustek
scanner from within ipplus.exe.
Mon Oct 27 00:59:41 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [windows/dce.c]
DC reuse framework.
Sun Oct 26 18:41:21 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [graphics/x11drv/xfont.c]
Substituted fonts are removed from the alias table. References to
the old name are also updated.
* [controls/combo.c]
LB_SELECTSTRING32 not CB_SELECTSTRING32 should be sent to
ComboLBox.
Sun Oct 26 14:25:00 1997 Nikita V. Youshchenko <yoush@cs.msu.su>
* [include/drive.h] [files/drive.c] [msdos/int21.c]
Partially implemented DOS drive mapping (int21 AX=440F).
Sat Oct 25 13:03:29 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [debugger/debug.l]
Support '.' in identifiers. Use "x . y" to access structure
fields.
* [debugger/hash.c] [loader/pe_image.c]
Load entry points of Win32 modules only when entering the
debugger.
* [debugger/break.c]
New function DEBUG_AddModuleBreakpoint() to set a breakpoint at
the start of every module.
* [files/file.c]
FILE_mmap() can now fake mmap() for unaligned offsets or broken
filesystems.
* [include/callback.h] [misc/callback.c] [if1632/thunk.c]
Use a table of callbacks instead of macros to differentiate
between emulator and Winelib.
* [loader/task.c]
Initialize current directory from cwd, not from module path.
* [tools/build.c]
Read CallTo16 prototypes directly from thunk.c source file.
* [windows/winproc.c] [windows/mdi.c]
Added translation for WM_MDIACTIVATE and WM_MDIGETACTIVE.
Fri Oct 24 21:41:25 1997 Uwe Bonnes <bon@elektron.ikp.tu-darmstadt.de>
* [files/drive.c]
Allow arguments like "a" for the drive related apis.
* [memory/global.c]
Keep the calculation for dwMemoryLoad in range.
* [misc/crtdll.c]
Make CRTDLL_getcwd use GetCurrentDirectory32A and alloc
its memory if requested.
Implemented CRTDLL_rename and CRTDLL_stat needed for
lcc-win32:wedit.exe.
Implemented CRTDLL__fullpath.
* [misc/comm.c]
High speed modes for the 16-bit mode Comm functions.
* [misc/cpu.c]
As applications may treat lpMaximumApplicationAddress as long,
use a valid long number.
* [misc/main.c]
In SystemParametersInfo16 ignore SPI_GETHIGHCONTRAST too.
* [misc/ole2nls.c]
Implement LCMAP_UPPERCASE for LCMapString32.
* [misc/wsprintf]
Made WPRINTF_ParseFormatA understand %ws.
* [win32/file.c]
Ignore FILE_ATTRIBUTE_NORMAL.
Stub for ReadFileEx.
Fri Oct 24 15:36:02 1997 Doug Ridgway <ridgway@routh.ucsd.edu>
* [memory/local.c]
Local heap exhaustion message now prints which builtin heap filled.
Fri Oct 24 00:46:34 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [windows/dialog.c]
Reversed CreateFont16/32W typo.
Thu Oct 23 23:44:20 1997 Kristian Nielsen <kristian.nielsen@risoe.dk>
* [if1632/user.spec]
Fixed argument list for ChangeClipboardChain.
* [windows/mdi.c]
Pass correct hInstance to CreateWindow16() in MDICreateChild().
Mon Oct 20 11:51:24 1997 Carsten Fallesen <cf@it.dtu.dk>
* [objects/metafile.c]
Added support for META_SETTEXTCHAREXTRA.
* [objects/region.c]
Fixed crash in XPolygonRegion if there is only one point in
in the region.
* [if1632/gdi32.spec][include/gdi.h][include/windows.h]
[objects/gdiobj.c]
Completed OBJ_XXX defines in gdi.h, removed OBJ_XXX in gdiobj.c
and included gdi.h instead. Implemented GetObjectType32().
Thu Oct 16 17:21:32 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [documentation/wine.texinfo]
Fixed WIN32 and Makefiles entries of Reference manual node, that
made makeinfo dump core.
Mon Oct 13 17:15:57 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de>
* [if1632/crtdll.spec]
Added missing math functions y0(), y1(), y2(), floor(), frexp(),
ldexp(), modf().
1997-11-01 20:08:16 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlLengthSid(pSid);
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/* ##############################################
|
|
|
|
###### SECURITY DESCRIPTOR FUNCTIONS ######
|
|
|
|
##############################################
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-06-23 13:40:57 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* BuildSecurityDescriptorA [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Builds a SD from
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pOwner [I]
|
|
|
|
* pGroup [I]
|
|
|
|
* cCountOfAccessEntries [I]
|
|
|
|
* pListOfAccessEntries [I]
|
|
|
|
* cCountOfAuditEntries [I]
|
|
|
|
* pListofAuditEntries [I]
|
|
|
|
* pOldSD [I]
|
|
|
|
* lpdwBufferLength [I/O]
|
|
|
|
* pNewSD [O]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI BuildSecurityDescriptorA(
|
|
|
|
IN PTRUSTEE_A pOwner,
|
|
|
|
IN PTRUSTEE_A pGroup,
|
|
|
|
IN DWORD cCountOfAccessEntries,
|
|
|
|
IN PEXPLICIT_ACCESS_A pListOfAccessEntries,
|
|
|
|
IN DWORD cCountOfAuditEntries,
|
|
|
|
IN PEXPLICIT_ACCESS_A pListofAuditEntries,
|
|
|
|
IN PSECURITY_DESCRIPTOR pOldSD,
|
|
|
|
IN OUT PDWORD lpdwBufferLength,
|
|
|
|
OUT PSECURITY_DESCRIPTOR pNewSD)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%ld,%p,%ld,%p,%p,%p,%p) stub!\n",pOwner,pGroup,
|
|
|
|
cCountOfAccessEntries,pListOfAccessEntries,cCountOfAuditEntries,
|
|
|
|
pListofAuditEntries,pOldSD,lpdwBufferLength,pNewSD);
|
|
|
|
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildSecurityDescriptorW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* See BuildSecurityDescriptorA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI BuildSecurityDescriptorW(
|
|
|
|
IN PTRUSTEE_W pOwner,
|
|
|
|
IN PTRUSTEE_W pGroup,
|
|
|
|
IN DWORD cCountOfAccessEntries,
|
|
|
|
IN PEXPLICIT_ACCESS_W pListOfAccessEntries,
|
|
|
|
IN DWORD cCountOfAuditEntries,
|
|
|
|
IN PEXPLICIT_ACCESS_W pListofAuditEntries,
|
|
|
|
IN PSECURITY_DESCRIPTOR pOldSD,
|
|
|
|
IN OUT PDWORD lpdwBufferLength,
|
|
|
|
OUT PSECURITY_DESCRIPTOR pNewSD)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%ld,%p,%ld,%p,%p,%p,%p) stub!\n",pOwner,pGroup,
|
|
|
|
cCountOfAccessEntries,pListOfAccessEntries,cCountOfAuditEntries,
|
|
|
|
pListofAuditEntries,pOldSD,lpdwBufferLength,pNewSD);
|
|
|
|
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* InitializeSecurityDescriptor [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pDescr []
|
|
|
|
* revision []
|
1997-10-12 18:30:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2004-08-14 01:55:43 +02:00
|
|
|
InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pDescr, DWORD revision )
|
1997-10-12 18:30:17 +02:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlCreateSecurityDescriptor(pDescr, revision ));
|
1997-10-12 18:30:17 +02:00
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* MakeAbsoluteSD [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MakeAbsoluteSD (
|
|
|
|
IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
|
|
|
|
OUT PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
|
|
|
|
OUT LPDWORD lpdwAbsoluteSecurityDescriptorSize,
|
|
|
|
OUT PACL pDacl,
|
|
|
|
OUT LPDWORD lpdwDaclSize,
|
|
|
|
OUT PACL pSacl,
|
|
|
|
OUT LPDWORD lpdwSaclSize,
|
|
|
|
OUT PSID pOwner,
|
|
|
|
OUT LPDWORD lpdwOwnerSize,
|
|
|
|
OUT PSID pPrimaryGroup,
|
|
|
|
OUT LPDWORD lpdwPrimaryGroupSize)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlSelfRelativeToAbsoluteSD(pSelfRelativeSecurityDescriptor,
|
|
|
|
pAbsoluteSecurityDescriptor,
|
|
|
|
lpdwAbsoluteSecurityDescriptorSize,
|
|
|
|
pDacl, lpdwDaclSize, pSacl, lpdwSaclSize,
|
|
|
|
pOwner, lpdwOwnerSize,
|
|
|
|
pPrimaryGroup, lpdwPrimaryGroupSize));
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
|
|
|
|
2005-06-17 11:52:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetKernelObjectSecurity [ADVAPI32.@]
|
|
|
|
*/
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI GetKernelObjectSecurity(
|
|
|
|
HANDLE Handle,
|
|
|
|
SECURITY_INFORMATION RequestedInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpnLengthNeeded )
|
|
|
|
{
|
2005-06-17 11:52:06 +02:00
|
|
|
TRACE("(%p,0x%08lx,%p,0x%08lx,%p)\n", Handle, RequestedInformation,
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
pSecurityDescriptor, nLength, lpnLengthNeeded);
|
|
|
|
|
2005-06-17 11:52:06 +02:00
|
|
|
return set_ntstatus( NtQuerySecurityObject(Handle, RequestedInformation, pSecurityDescriptor,
|
|
|
|
nLength, lpnLengthNeeded ));
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
}
|
|
|
|
|
2005-06-17 11:52:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetPrivateObjectSecurity [ADVAPI32.@]
|
|
|
|
*/
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI GetPrivateObjectSecurity(
|
|
|
|
PSECURITY_DESCRIPTOR ObjectDescriptor,
|
|
|
|
SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR ResultantDescriptor,
|
|
|
|
DWORD DescriptorLength,
|
|
|
|
PDWORD ReturnLength )
|
|
|
|
{
|
2005-06-17 11:52:06 +02:00
|
|
|
TRACE("(%p,0x%08lx,%p,0x%08lx,%p)\n", ObjectDescriptor, SecurityInformation,
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
ResultantDescriptor, DescriptorLength, ReturnLength);
|
|
|
|
|
2005-06-17 11:52:06 +02:00
|
|
|
return set_ntstatus( NtQuerySecurityObject(ObjectDescriptor, SecurityInformation,
|
|
|
|
ResultantDescriptor, DescriptorLength, ReturnLength ));
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorLength [ADVAPI32.@]
|
1999-01-17 17:55:11 +01:00
|
|
|
*/
|
2004-08-14 01:55:43 +02:00
|
|
|
DWORD WINAPI GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pDescr)
|
1999-01-17 17:55:11 +01:00
|
|
|
{
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
return RtlLengthSecurityDescriptor(pDescr);
|
1999-01-17 17:55:11 +01:00
|
|
|
}
|
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorOwner [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pOwner []
|
|
|
|
* lpbOwnerDefaulted []
|
1999-01-26 11:11:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2004-08-14 01:55:43 +02:00
|
|
|
GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pDescr, PSID *pOwner,
|
1999-02-26 12:11:13 +01:00
|
|
|
LPBOOL lpbOwnerDefaulted )
|
1999-01-26 11:11:22 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
BOOLEAN defaulted;
|
|
|
|
BOOL ret = set_ntstatus( RtlGetOwnerSecurityDescriptor( pDescr, pOwner, &defaulted ));
|
|
|
|
*lpbOwnerDefaulted = defaulted;
|
|
|
|
return ret;
|
1999-01-26 11:11:22 +01:00
|
|
|
}
|
1999-01-17 17:55:11 +01:00
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetSecurityDescriptorOwner [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-01-26 11:11:22 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
1999-02-26 12:11:13 +01:00
|
|
|
PSID pOwner, BOOL bOwnerDefaulted)
|
1999-02-19 17:29:05 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorGroup [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI GetSecurityDescriptorGroup(
|
1999-02-19 17:29:05 +01:00
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
PSID *Group,
|
1999-02-26 12:11:13 +01:00
|
|
|
LPBOOL GroupDefaulted)
|
1999-02-19 17:29:05 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
BOOLEAN defaulted;
|
|
|
|
BOOL ret = set_ntstatus( RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, &defaulted ));
|
|
|
|
*GroupDefaulted = defaulted;
|
|
|
|
return ret;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetSecurityDescriptorGroup [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
PSID Group, BOOL GroupDefaulted)
|
1999-01-26 11:11:22 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
|
1999-01-26 11:11:22 +01:00
|
|
|
}
|
1997-10-12 18:30:17 +02:00
|
|
|
|
1999-01-30 13:54:32 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* IsValidSecurityDescriptor [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* lpsecdesc []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-19 17:29:05 +01:00
|
|
|
IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
|
1997-08-24 18:00:30 +02:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlValidSecurityDescriptor(SecurityDescriptor));
|
1999-02-19 17:29:05 +01:00
|
|
|
}
|
1997-02-15 15:29:56 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorDacl [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI GetSecurityDescriptorDacl(
|
1999-02-19 17:29:05 +01:00
|
|
|
IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
1999-02-26 12:11:13 +01:00
|
|
|
OUT LPBOOL lpbDaclPresent,
|
1999-02-19 17:29:05 +01:00
|
|
|
OUT PACL *pDacl,
|
1999-02-26 12:11:13 +01:00
|
|
|
OUT LPBOOL lpbDaclDefaulted)
|
1999-02-19 17:29:05 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
BOOLEAN present, defaulted;
|
|
|
|
BOOL ret = set_ntstatus( RtlGetDaclSecurityDescriptor(pSecurityDescriptor, &present, pDacl, &defaulted));
|
|
|
|
*lpbDaclPresent = present;
|
|
|
|
*lpbDaclDefaulted = defaulted;
|
|
|
|
return ret;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1997-02-15 15:29:56 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetSecurityDescriptorDacl [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
1999-03-09 18:43:44 +01:00
|
|
|
SetSecurityDescriptorDacl (
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
BOOL daclpresent,
|
|
|
|
PACL dacl,
|
|
|
|
BOOL dacldefaulted )
|
1999-02-19 17:29:05 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ) );
|
1999-03-09 18:43:44 +01:00
|
|
|
}
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorSacl [ADVAPI32.@]
|
1999-03-09 18:43:44 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI GetSecurityDescriptorSacl(
|
|
|
|
IN PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
OUT LPBOOL lpbSaclPresent,
|
|
|
|
OUT PACL *pSacl,
|
|
|
|
OUT LPBOOL lpbSaclDefaulted)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
BOOLEAN present, defaulted;
|
|
|
|
BOOL ret = set_ntstatus( RtlGetSaclSecurityDescriptor(lpsd, &present, pSacl, &defaulted) );
|
|
|
|
*lpbSaclPresent = present;
|
|
|
|
*lpbSaclDefaulted = defaulted;
|
|
|
|
return ret;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-03-09 18:43:44 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/**************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetSecurityDescriptorSacl [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOL WINAPI SetSecurityDescriptorSacl (
|
1999-02-19 17:29:05 +01:00
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL saclpresent,
|
1999-03-09 18:43:44 +01:00
|
|
|
PACL lpsacl,
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL sacldefaulted)
|
1999-02-19 17:29:05 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* MakeSelfRelativeSD [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
1999-02-19 17:29:05 +01:00
|
|
|
* lpabssecdesc []
|
|
|
|
* lpselfsecdesc []
|
|
|
|
* lpbuflen []
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
MakeSelfRelativeSD(
|
|
|
|
IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
|
|
|
|
IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
|
|
|
|
IN OUT LPDWORD lpdwBufferLength)
|
1997-08-24 18:00:30 +02:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlMakeSelfRelativeSD( pAbsoluteSecurityDescriptor,
|
|
|
|
pSelfRelativeSecurityDescriptor, lpdwBufferLength));
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetSecurityDescriptorControl [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
|
|
|
|
1999-07-04 13:01:21 +02:00
|
|
|
BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-02-19 17:29:05 +01:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/* ##############################
|
|
|
|
###### ACL FUNCTIONS ######
|
|
|
|
##############################
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* InitializeAcl [ADVAPI32.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
BOOL WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus( RtlCreateAcl(acl, size, rev));
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI ImpersonateNamedPipeClient( HANDLE hNamedPipe )
|
|
|
|
{
|
2005-06-24 13:54:15 +02:00
|
|
|
TRACE("(%p)\n", hNamedPipe);
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
|
2005-06-24 13:54:15 +02:00
|
|
|
return set_ntstatus( NtFsControlFile(hNamedPipe, NULL, NULL, NULL, NULL,
|
|
|
|
FSCTL_PIPE_IMPERSONATE, NULL, 0, NULL, 0) );
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
}
|
|
|
|
|
2003-05-01 02:29:26 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* AddAccessAllowedAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAccessAllowedAce(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid));
|
2003-05-01 02:29:26 +02:00
|
|
|
}
|
|
|
|
|
2003-06-16 21:44:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* AddAccessAllowedAceEx [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAccessAllowedAceEx(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AceFlags,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlAddAccessAllowedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid));
|
2003-06-16 21:44:06 +02:00
|
|
|
}
|
|
|
|
|
2003-05-01 02:29:26 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* AddAccessDeniedAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAccessDeniedAce(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlAddAccessDeniedAce(pAcl, dwAceRevision, AccessMask, pSid));
|
2003-05-01 02:29:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2003-06-16 21:44:06 +02:00
|
|
|
* AddAccessDeniedAceEx [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAccessDeniedAceEx(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AceFlags,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlAddAccessDeniedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid));
|
2003-06-16 21:44:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AddAce [ADVAPI32.@]
|
2003-05-01 02:29:26 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAce(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD dwStartingAceIndex,
|
|
|
|
LPVOID pAceList,
|
|
|
|
DWORD nAceListLength)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlAddAce(pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength));
|
2003-05-01 02:29:26 +02:00
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* DeleteAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DeleteAce(PACL pAcl, DWORD dwAceIndex)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlDeleteAce(pAcl, dwAceIndex));
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
|
|
|
|
2003-05-01 02:29:26 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* FindFirstFreeAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI FindFirstFreeAce(IN PACL pAcl, LPVOID * pAce)
|
|
|
|
{
|
|
|
|
return RtlFirstFreeAce(pAcl, (PACE_HEADER *)pAce);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlGetAce(pAcl, dwAceIndex, pAce));
|
2003-05-01 02:29:26 +02:00
|
|
|
}
|
|
|
|
|
2003-06-16 21:44:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetAclInformation [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetAclInformation(
|
|
|
|
PACL pAcl,
|
|
|
|
LPVOID pAclInformation,
|
|
|
|
DWORD nAclInformationLength,
|
|
|
|
ACL_INFORMATION_CLASS dwAclInformationClass)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(RtlQueryInformationAcl(pAcl, pAclInformation,
|
|
|
|
nAclInformationLength, dwAclInformationClass));
|
2003-06-16 21:44:06 +02:00
|
|
|
}
|
|
|
|
|
2003-05-01 02:29:26 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* IsValidAcl [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI IsValidAcl(IN PACL pAcl)
|
|
|
|
{
|
|
|
|
return RtlValidAcl(pAcl);
|
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/* ##############################
|
|
|
|
###### MISC FUNCTIONS ######
|
|
|
|
##############################
|
|
|
|
*/
|
|
|
|
|
2004-11-04 05:52:17 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* AllocateLocallyUniqueId [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpLuid []
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AllocateLocallyUniqueId( PLUID lpLuid )
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus(NtAllocateLocallyUniqueId(lpLuid));
|
2004-11-04 05:52:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const WCHAR SE_CREATE_TOKEN_NAME_W[] =
|
|
|
|
{ 'S','e','C','r','e','a','t','e','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_ASSIGNPRIMARYTOKEN_NAME_W[] =
|
|
|
|
{ 'S','e','A','s','s','i','g','n','P','r','i','m','a','r','y','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_LOCK_MEMORY_NAME_W[] =
|
|
|
|
{ 'S','e','L','o','c','k','M','e','m','o','r','y','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_INCREASE_QUOTA_NAME_W[] =
|
|
|
|
{ 'S','e','I','n','c','r','e','a','s','e','Q','u','o','t','a','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_MACHINE_ACCOUNT_NAME_W[] =
|
|
|
|
{ 'S','e','M','a','c','h','i','n','e','A','c','c','o','u','n','t','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_TCB_NAME_W[] =
|
|
|
|
{ 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SECURITY_NAME_W[] =
|
|
|
|
{ 'S','e','S','e','c','u','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_TAKE_OWNERSHIP_NAME_W[] =
|
|
|
|
{ 'S','e','T','a','k','e','O','w','n','e','r','s','h','i','p','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_LOAD_DRIVER_NAME_W[] =
|
|
|
|
{ 'S','e','L','o','a','d','D','r','i','v','e','r','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SYSTEM_PROFILE_NAME_W[] =
|
|
|
|
{ 'S','e','S','y','s','t','e','m','P','r','o','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SYSTEMTIME_NAME_W[] =
|
|
|
|
{ 'S','e','S','y','s','t','e','m','t','i','m','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_PROF_SINGLE_PROCESS_NAME_W[] =
|
|
|
|
{ 'S','e','P','r','o','f','i','l','e','S','i','n','g','l','e','P','r','o','c','e','s','s','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_INC_BASE_PRIORITY_NAME_W[] =
|
|
|
|
{ 'S','e','I','n','c','r','e','a','s','e','B','a','s','e','P','r','i','o','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_CREATE_PAGEFILE_NAME_W[] =
|
|
|
|
{ 'S','e','C','r','e','a','t','e','P','a','g','e','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_CREATE_PERMANENT_NAME_W[] =
|
|
|
|
{ 'S','e','C','r','e','a','t','e','P','e','r','m','a','n','e','n','t','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_BACKUP_NAME_W[] =
|
|
|
|
{ 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_RESTORE_NAME_W[] =
|
|
|
|
{ 'S','e','R','e','s','t','o','r','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SHUTDOWN_NAME_W[] =
|
|
|
|
{ 'S','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_DEBUG_NAME_W[] =
|
|
|
|
{ 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_AUDIT_NAME_W[] =
|
|
|
|
{ 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SYSTEM_ENVIRONMENT_NAME_W[] =
|
|
|
|
{ 'S','e','S','y','s','t','e','m','E','n','v','i','r','o','n','m','e','n','t','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_CHANGE_NOTIFY_NAME_W[] =
|
|
|
|
{ 'S','e','C','h','a','n','g','e','N','o','t','i','f','y','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_REMOTE_SHUTDOWN_NAME_W[] =
|
|
|
|
{ 'S','e','R','e','m','o','t','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_UNDOCK_NAME_W[] =
|
|
|
|
{ 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_SYNC_AGENT_NAME_W[] =
|
|
|
|
{ 'S','e','S','y','n','c','A','g','e','n','t','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_ENABLE_DELEGATION_NAME_W[] =
|
|
|
|
{ 'S','e','E','n','a','b','l','e','D','e','l','e','g','a','t','i','o','n','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_MANAGE_VOLUME_NAME_W[] =
|
|
|
|
{ 'S','e','M','a','n','a','g','e','V','o','l','u','m','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_IMPERSONATE_NAME_W[] =
|
|
|
|
{ 'S','e','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
static const WCHAR SE_CREATE_GLOBAL_NAME_W[] =
|
|
|
|
{ 'S','e','C','r','e','a','t','e','G','l','o','b','a','l','P','r','i','v','i','l','e','g','e',0 };
|
|
|
|
|
|
|
|
static const WCHAR * const WellKnownPrivNames[SE_MAX_WELL_KNOWN_PRIVILEGE + 1] =
|
|
|
|
{
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
SE_CREATE_TOKEN_NAME_W,
|
|
|
|
SE_ASSIGNPRIMARYTOKEN_NAME_W,
|
|
|
|
SE_LOCK_MEMORY_NAME_W,
|
|
|
|
SE_INCREASE_QUOTA_NAME_W,
|
|
|
|
SE_MACHINE_ACCOUNT_NAME_W,
|
|
|
|
SE_TCB_NAME_W,
|
|
|
|
SE_SECURITY_NAME_W,
|
|
|
|
SE_TAKE_OWNERSHIP_NAME_W,
|
|
|
|
SE_LOAD_DRIVER_NAME_W,
|
|
|
|
SE_SYSTEM_PROFILE_NAME_W,
|
|
|
|
SE_SYSTEMTIME_NAME_W,
|
|
|
|
SE_PROF_SINGLE_PROCESS_NAME_W,
|
|
|
|
SE_INC_BASE_PRIORITY_NAME_W,
|
|
|
|
SE_CREATE_PAGEFILE_NAME_W,
|
|
|
|
SE_CREATE_PERMANENT_NAME_W,
|
|
|
|
SE_BACKUP_NAME_W,
|
|
|
|
SE_RESTORE_NAME_W,
|
|
|
|
SE_SHUTDOWN_NAME_W,
|
|
|
|
SE_DEBUG_NAME_W,
|
|
|
|
SE_AUDIT_NAME_W,
|
|
|
|
SE_SYSTEM_ENVIRONMENT_NAME_W,
|
|
|
|
SE_CHANGE_NOTIFY_NAME_W,
|
|
|
|
SE_REMOTE_SHUTDOWN_NAME_W,
|
|
|
|
SE_UNDOCK_NAME_W,
|
|
|
|
SE_SYNC_AGENT_NAME_W,
|
|
|
|
SE_ENABLE_DELEGATION_NAME_W,
|
|
|
|
SE_MANAGE_VOLUME_NAME_W,
|
|
|
|
SE_IMPERSONATE_NAME_W,
|
|
|
|
SE_CREATE_GLOBAL_NAME_W,
|
2003-07-24 02:01:16 +02:00
|
|
|
};
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* LookupPrivilegeValueW [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* See LookupPrivilegeValueA.
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-12-17 00:48:04 +01:00
|
|
|
LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid )
|
1997-08-24 18:00:30 +02:00
|
|
|
{
|
2003-07-24 02:01:16 +02:00
|
|
|
UINT i;
|
|
|
|
|
|
|
|
TRACE("%s,%s,%p\n",debugstr_w(lpSystemName), debugstr_w(lpName), lpLuid);
|
|
|
|
|
2004-11-04 05:52:17 +01:00
|
|
|
if (!ADVAPI_IsLocalComputer(lpSystemName))
|
2003-07-24 02:01:16 +02:00
|
|
|
{
|
2004-11-04 05:52:17 +01:00
|
|
|
SetLastError(RPC_S_SERVER_UNAVAILABLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (!lpName)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NO_SUCH_PRIVILEGE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
for( i=SE_MIN_WELL_KNOWN_PRIVILEGE; i<SE_MAX_WELL_KNOWN_PRIVILEGE; i++ )
|
|
|
|
{
|
|
|
|
if( !WellKnownPrivNames[i] )
|
2003-07-24 02:01:16 +02:00
|
|
|
continue;
|
2004-11-04 05:52:17 +01:00
|
|
|
if( strcmpiW( WellKnownPrivNames[i], lpName) )
|
2003-07-24 02:01:16 +02:00
|
|
|
continue;
|
|
|
|
lpLuid->LowPart = i;
|
|
|
|
lpLuid->HighPart = 0;
|
|
|
|
TRACE( "%s -> %08lx-%08lx\n",debugstr_w( lpSystemName ),
|
|
|
|
lpLuid->HighPart, lpLuid->LowPart );
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-11-04 05:52:17 +01:00
|
|
|
SetLastError(ERROR_NO_SUCH_PRIVILEGE);
|
2003-07-24 02:01:16 +02:00
|
|
|
return FALSE;
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* LookupPrivilegeValueA [ADVAPI32.@]
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Retrieves LUID used on a system to represent the privilege name.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpSystemName [I] Name of the system
|
|
|
|
* lpName [I] Name of the privilege
|
2004-04-23 23:32:34 +02:00
|
|
|
* lpLuid [O] Destination for the resulting LUID
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
2004-04-23 23:32:34 +02:00
|
|
|
* Success: TRUE. lpLuid contains the requested LUID.
|
2003-03-18 19:35:48 +01:00
|
|
|
* Failure: FALSE.
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-12-17 00:48:04 +01:00
|
|
|
LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid )
|
1997-08-24 18:00:30 +02:00
|
|
|
{
|
2003-01-21 00:23:12 +01:00
|
|
|
UNICODE_STRING lpSystemNameW;
|
|
|
|
UNICODE_STRING lpNameW;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOL ret;
|
|
|
|
|
2003-01-21 00:23:12 +01:00
|
|
|
RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&lpNameW,lpName);
|
|
|
|
ret = LookupPrivilegeValueW(lpSystemNameW.Buffer, lpNameW.Buffer, lpLuid);
|
|
|
|
RtlFreeUnicodeString(&lpNameW);
|
|
|
|
RtlFreeUnicodeString(&lpSystemNameW);
|
1999-02-19 17:29:05 +01:00
|
|
|
return ret;
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName,
|
|
|
|
LPDWORD cchDisplayName, LPDWORD lpLanguageId )
|
|
|
|
{
|
|
|
|
FIXME("%s %s %s %p %p - stub\n", debugstr_a(lpSystemName), debugstr_a(lpName),
|
|
|
|
debugstr_a(lpDisplayName), cchDisplayName, lpLanguageId);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName,
|
|
|
|
LPDWORD cchDisplayName, LPDWORD lpLanguageId )
|
|
|
|
{
|
|
|
|
FIXME("%s %s %s %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpName),
|
|
|
|
debugstr_w(lpDisplayName), cchDisplayName, lpLanguageId);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-07-24 02:01:16 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LookupPrivilegeNameA [ADVAPI32.@]
|
2004-11-04 05:52:17 +01:00
|
|
|
*
|
|
|
|
* See LookupPrivilegeNameW
|
2003-07-24 02:01:16 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
2004-11-04 05:52:17 +01:00
|
|
|
LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName,
|
|
|
|
LPDWORD cchName)
|
2003-07-24 02:01:16 +02:00
|
|
|
{
|
2004-11-04 05:52:17 +01:00
|
|
|
UNICODE_STRING lpSystemNameW;
|
|
|
|
BOOL ret;
|
|
|
|
DWORD wLen = 0;
|
|
|
|
|
|
|
|
TRACE("%s %p %p %p\n", debugstr_a(lpSystemName), lpLuid, lpName, cchName);
|
|
|
|
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
|
|
|
|
ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, NULL, &wLen);
|
|
|
|
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
{
|
|
|
|
LPWSTR lpNameW = HeapAlloc(GetProcessHeap(), 0, wLen * sizeof(WCHAR));
|
|
|
|
|
|
|
|
ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, lpNameW,
|
|
|
|
&wLen);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
/* Windows crashes if cchName is NULL, so will I */
|
|
|
|
int len = WideCharToMultiByte(CP_ACP, 0, lpNameW, -1, lpName,
|
|
|
|
*cchName, NULL, NULL);
|
|
|
|
|
|
|
|
if (len == 0)
|
|
|
|
{
|
|
|
|
/* WideCharToMultiByte failed */
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
else if (len > *cchName)
|
|
|
|
{
|
|
|
|
*cchName = len;
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* WideCharToMultiByte succeeded, output length needs to be
|
|
|
|
* length not including NULL terminator
|
|
|
|
*/
|
|
|
|
*cchName = len - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpNameW);
|
|
|
|
}
|
|
|
|
RtlFreeUnicodeString(&lpSystemNameW);
|
|
|
|
return ret;
|
2003-07-24 02:01:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LookupPrivilegeNameW [ADVAPI32.@]
|
2004-11-04 05:52:17 +01:00
|
|
|
*
|
|
|
|
* Retrieves the privilege name referred to by the LUID lpLuid.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpSystemName [I] Name of the system
|
|
|
|
* lpLuid [I] Privilege value
|
|
|
|
* lpName [O] Name of the privilege
|
|
|
|
* cchName [I/O] Number of characters in lpName.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. lpName contains the name of the privilege whose value is
|
|
|
|
* *lpLuid.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* REMARKS
|
|
|
|
* Only well-known privilege names (those defined in winnt.h) can be retrieved
|
|
|
|
* using this function.
|
|
|
|
* If the length of lpName is too small, on return *cchName will contain the
|
|
|
|
* number of WCHARs needed to contain the privilege, including the NULL
|
|
|
|
* terminator, and GetLastError will return ERROR_INSUFFICIENT_BUFFER.
|
|
|
|
* On success, *cchName will contain the number of characters stored in
|
|
|
|
* lpName, NOT including the NULL terminator.
|
2003-07-24 02:01:16 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
2004-11-04 05:52:17 +01:00
|
|
|
LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName,
|
|
|
|
LPDWORD cchName)
|
2003-07-24 02:01:16 +02:00
|
|
|
{
|
2004-11-04 05:52:17 +01:00
|
|
|
size_t privNameLen;
|
|
|
|
|
|
|
|
TRACE("%s,%p,%p,%p\n",debugstr_w(lpSystemName), lpLuid, lpName, cchName);
|
|
|
|
|
|
|
|
if (!ADVAPI_IsLocalComputer(lpSystemName))
|
|
|
|
{
|
|
|
|
SetLastError(RPC_S_SERVER_UNAVAILABLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (lpLuid->HighPart || (lpLuid->LowPart < SE_MIN_WELL_KNOWN_PRIVILEGE ||
|
|
|
|
lpLuid->LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NO_SUCH_PRIVILEGE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
privNameLen = strlenW(WellKnownPrivNames[lpLuid->LowPart]);
|
|
|
|
/* Windows crashes if cchName is NULL, so will I */
|
|
|
|
if (*cchName <= privNameLen)
|
|
|
|
{
|
|
|
|
*cchName = privNameLen + 1;
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpyW(lpName, WellKnownPrivNames[lpLuid->LowPart]);
|
|
|
|
*cchName = privNameLen;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-07-24 02:01:16 +02:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetFileSecurityA [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Obtains Specified information about the security of a file or directory.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpFileName [I] Name of the file to get info for
|
|
|
|
* RequestedInformation [I] SE_ flags from "winnt.h"
|
|
|
|
* pSecurityDescriptor [O] Destination for security information
|
|
|
|
* nLength [I] Length of pSecurityDescriptor
|
|
|
|
* lpnLengthNeeded [O] Destination for length of returned security information
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. pSecurityDescriptor contains the requested information.
|
|
|
|
* Failure: FALSE. lpnLengthNeeded contains the required space to return the info.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* The information returned is constrained by the callers access rights and
|
|
|
|
* privileges.
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
GetFileSecurityA( LPCSTR lpFileName,
|
1999-02-19 17:29:05 +01:00
|
|
|
SECURITY_INFORMATION RequestedInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
DWORD nLength, LPDWORD lpnLengthNeeded )
|
1997-08-24 18:00:30 +02:00
|
|
|
{
|
2004-08-17 01:18:23 +02:00
|
|
|
DWORD len;
|
|
|
|
BOOL r;
|
|
|
|
LPWSTR name = NULL;
|
|
|
|
|
|
|
|
if( lpFileName )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, lpFileName, -1, NULL, 0 );
|
|
|
|
name = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpFileName, -1, name, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
r = GetFileSecurityW( name, RequestedInformation, pSecurityDescriptor,
|
|
|
|
nLength, lpnLengthNeeded );
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, name );
|
2004-08-17 01:18:23 +02:00
|
|
|
|
|
|
|
return r;
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetFileSecurityW [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* See GetFileSecurityA.
|
1997-02-15 15:29:56 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
GetFileSecurityW( LPCWSTR lpFileName,
|
1999-02-19 17:29:05 +01:00
|
|
|
SECURITY_INFORMATION RequestedInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
DWORD nLength, LPDWORD lpnLengthNeeded )
|
1999-01-28 14:46:25 +01:00
|
|
|
{
|
2005-03-05 11:46:34 +01:00
|
|
|
DWORD nNeeded;
|
|
|
|
LPBYTE pBuffer;
|
|
|
|
DWORD iLocNow;
|
|
|
|
SECURITY_DESCRIPTOR_RELATIVE *pSDRelative;
|
|
|
|
|
2005-03-29 13:31:18 +02:00
|
|
|
if(INVALID_FILE_ATTRIBUTES == GetFileAttributesW(lpFileName))
|
|
|
|
return FALSE;
|
|
|
|
|
2005-03-05 11:46:34 +01:00
|
|
|
FIXME("(%s) : returns fake SECURITY_DESCRIPTOR\n", debugstr_w(lpFileName) );
|
|
|
|
|
|
|
|
nNeeded = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
|
|
|
|
if (RequestedInformation & OWNER_SECURITY_INFORMATION)
|
|
|
|
nNeeded += sizeof(sidWorld);
|
|
|
|
if (RequestedInformation & GROUP_SECURITY_INFORMATION)
|
|
|
|
nNeeded += sizeof(sidWorld);
|
|
|
|
if (RequestedInformation & DACL_SECURITY_INFORMATION)
|
|
|
|
nNeeded += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
if (RequestedInformation & SACL_SECURITY_INFORMATION)
|
|
|
|
nNeeded += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
|
|
|
|
*lpnLengthNeeded = nNeeded;
|
|
|
|
|
|
|
|
if (nNeeded > nLength)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!InitializeSecurityDescriptor(pSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
pSDRelative = (PISECURITY_DESCRIPTOR_RELATIVE) pSecurityDescriptor;
|
|
|
|
pSDRelative->Control |= SE_SELF_RELATIVE;
|
|
|
|
pBuffer = (LPBYTE) pSDRelative;
|
|
|
|
iLocNow = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
|
|
|
|
|
|
|
|
if (RequestedInformation & OWNER_SECURITY_INFORMATION)
|
|
|
|
{
|
|
|
|
memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
|
|
|
|
pSDRelative->Owner = iLocNow;
|
|
|
|
iLocNow += sizeof(sidWorld);
|
|
|
|
}
|
|
|
|
if (RequestedInformation & GROUP_SECURITY_INFORMATION)
|
|
|
|
{
|
|
|
|
memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
|
|
|
|
pSDRelative->Group = iLocNow;
|
|
|
|
iLocNow += sizeof(sidWorld);
|
|
|
|
}
|
|
|
|
if (RequestedInformation & DACL_SECURITY_INFORMATION)
|
|
|
|
{
|
|
|
|
GetWorldAccessACL((PACL) (pBuffer + iLocNow));
|
|
|
|
pSDRelative->Dacl = iLocNow;
|
|
|
|
iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
}
|
|
|
|
if (RequestedInformation & SACL_SECURITY_INFORMATION)
|
|
|
|
{
|
|
|
|
GetWorldAccessACL((PACL) (pBuffer + iLocNow));
|
|
|
|
pSDRelative->Sacl = iLocNow;
|
|
|
|
/* iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL; */
|
|
|
|
}
|
|
|
|
return TRUE;
|
1997-02-15 15:29:56 +01:00
|
|
|
}
|
1997-11-30 18:45:40 +01:00
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* LookupAccountSidA [ADVAPI32.@]
|
1997-11-30 18:45:40 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
LookupAccountSidA(
|
|
|
|
IN LPCSTR system,
|
|
|
|
IN PSID sid,
|
|
|
|
OUT LPSTR account,
|
|
|
|
IN OUT LPDWORD accountSize,
|
|
|
|
OUT LPSTR domain,
|
|
|
|
IN OUT LPDWORD domainSize,
|
|
|
|
OUT PSID_NAME_USE name_use )
|
|
|
|
{
|
2000-11-28 23:40:56 +01:00
|
|
|
static const char ac[] = "Administrator";
|
|
|
|
static const char dm[] = "DOMAIN";
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
debugstr_a(system),sid,
|
|
|
|
account,accountSize,accountSize?*accountSize:0,
|
|
|
|
domain,domainSize,domainSize?*domainSize:0,
|
|
|
|
name_use);
|
|
|
|
|
|
|
|
if (accountSize) *accountSize = strlen(ac)+1;
|
|
|
|
if (account && (*accountSize > strlen(ac)))
|
|
|
|
strcpy(account, ac);
|
|
|
|
|
|
|
|
if (domainSize) *domainSize = strlen(dm)+1;
|
|
|
|
if (domain && (*domainSize > strlen(dm)))
|
|
|
|
strcpy(domain,dm);
|
|
|
|
|
|
|
|
if (name_use) *name_use = SidTypeUser;
|
|
|
|
return TRUE;
|
1997-11-30 18:45:40 +01:00
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* LookupAccountSidW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* system []
|
|
|
|
* sid []
|
|
|
|
* account []
|
|
|
|
* accountSize []
|
|
|
|
* domain []
|
|
|
|
* domainSize []
|
|
|
|
* name_use []
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
LookupAccountSidW(
|
|
|
|
IN LPCWSTR system,
|
|
|
|
IN PSID sid,
|
|
|
|
OUT LPWSTR account,
|
|
|
|
IN OUT LPDWORD accountSize,
|
|
|
|
OUT LPWSTR domain,
|
|
|
|
IN OUT LPDWORD domainSize,
|
|
|
|
OUT PSID_NAME_USE name_use )
|
|
|
|
{
|
2000-11-28 23:40:56 +01:00
|
|
|
static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
|
|
|
|
static const WCHAR dm[] = {'D','O','M','A','I','N',0};
|
2000-03-12 21:16:51 +01:00
|
|
|
FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
debugstr_w(system),sid,
|
|
|
|
account,accountSize,accountSize?*accountSize:0,
|
|
|
|
domain,domainSize,domainSize?*domainSize:0,
|
|
|
|
name_use);
|
|
|
|
|
2000-11-28 23:40:56 +01:00
|
|
|
if (accountSize) *accountSize = strlenW(ac)+1;
|
|
|
|
if (account && (*accountSize > strlenW(ac)))
|
|
|
|
strcpyW(account, ac);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2000-11-28 23:40:56 +01:00
|
|
|
if (domainSize) *domainSize = strlenW(dm)+1;
|
|
|
|
if (domain && (*domainSize > strlenW(dm)))
|
|
|
|
strcpyW(domain,dm);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
if (name_use) *name_use = SidTypeUser;
|
|
|
|
return TRUE;
|
1997-11-30 18:45:40 +01:00
|
|
|
}
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetFileSecurityA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
* Sets the security of a file or directory
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
|
1999-01-03 13:48:29 +01:00
|
|
|
SECURITY_INFORMATION RequestedInformation,
|
1999-02-12 18:47:07 +01:00
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2004-08-17 01:18:23 +02:00
|
|
|
DWORD len;
|
|
|
|
BOOL r;
|
|
|
|
LPWSTR name = NULL;
|
|
|
|
|
|
|
|
if( lpFileName )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, lpFileName, -1, NULL, 0 );
|
|
|
|
name = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpFileName, -1, name, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
r = SetFileSecurityW( name, RequestedInformation, pSecurityDescriptor );
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, name );
|
2004-08-17 01:18:23 +02:00
|
|
|
|
|
|
|
return r;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetFileSecurityW [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
* Sets the security of a file or directory
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpFileName []
|
|
|
|
* RequestedInformation []
|
|
|
|
* pSecurityDescriptor []
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
SetFileSecurityW( LPCWSTR lpFileName,
|
1999-01-28 14:46:25 +01:00
|
|
|
SECURITY_INFORMATION RequestedInformation,
|
1999-02-12 18:47:07 +01:00
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-01-28 14:46:25 +01:00
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* QueryWindows31FilesMigration [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* x1 []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-01-28 14:46:25 +01:00
|
|
|
QueryWindows31FilesMigration( DWORD x1 )
|
|
|
|
{
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%ld):stub\n",x1);
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* x1 []
|
|
|
|
* x2 []
|
|
|
|
* x3 []
|
|
|
|
* x4 []
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-01-28 14:46:25 +01:00
|
|
|
SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
|
|
|
|
DWORD x4 )
|
|
|
|
{
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* NotifyBootConfigStatus [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* x1 []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-01-28 14:46:25 +01:00
|
|
|
NotifyBootConfigStatus( DWORD x1 )
|
|
|
|
{
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(0x%08lx):stub\n",x1);
|
1999-01-03 13:48:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
1999-01-26 11:11:22 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* RevertToSelf [ADVAPI32.@]
|
1999-01-30 13:54:32 +01:00
|
|
|
*
|
2005-06-20 13:44:45 +02:00
|
|
|
* Ends the impersonation of a user.
|
|
|
|
*
|
1999-01-30 13:54:32 +01:00
|
|
|
* PARAMS
|
|
|
|
* void []
|
2005-06-20 13:44:45 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE.
|
1999-01-26 11:11:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-01-30 13:54:32 +01:00
|
|
|
RevertToSelf( void )
|
|
|
|
{
|
2005-06-20 13:44:45 +02:00
|
|
|
HANDLE Token = NULL;
|
|
|
|
return set_ntstatus( NtSetInformationThread( GetCurrentThread(),
|
|
|
|
ThreadImpersonationToken, &Token, sizeof(Token) ) );
|
1999-01-26 11:11:22 +01:00
|
|
|
}
|
1999-02-10 07:39:51 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ImpersonateSelf [ADVAPI32.@]
|
2005-06-20 13:44:45 +02:00
|
|
|
*
|
|
|
|
* Makes an impersonation token that represents the process user and assigns
|
|
|
|
* to the current thread.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* ImpersonationLevel [I] Level at which to impersonate.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE.
|
1999-02-10 07:39:51 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-07-04 13:01:21 +02:00
|
|
|
ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
1999-02-10 07:39:51 +01:00
|
|
|
{
|
2005-06-20 13:44:45 +02:00
|
|
|
return set_ntstatus( RtlImpersonateSelf( ImpersonationLevel ) );
|
1999-02-10 07:39:51 +01:00
|
|
|
}
|
|
|
|
|
2002-04-03 21:53:31 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* ImpersonateLoggedOnUser [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
|
|
|
|
{
|
2002-10-25 21:17:33 +02:00
|
|
|
FIXME("(%p):stub returning FALSE\n", hToken);
|
2002-04-03 21:53:31 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-02-19 17:29:05 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* AccessCheck [ADVAPI32.@]
|
1999-02-19 17:29:05 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
AccessCheck(
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
HANDLE ClientToken,
|
|
|
|
DWORD DesiredAccess,
|
|
|
|
PGENERIC_MAPPING GenericMapping,
|
|
|
|
PPRIVILEGE_SET PrivilegeSet,
|
|
|
|
LPDWORD PrivilegeSetLength,
|
|
|
|
LPDWORD GrantedAccess,
|
|
|
|
LPBOOL AccessStatus)
|
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
NTSTATUS access_status;
|
|
|
|
BOOL ret = set_ntstatus( NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
|
|
|
|
GenericMapping, PrivilegeSet, PrivilegeSetLength,
|
|
|
|
GrantedAccess, &access_status) );
|
|
|
|
if (ret) *AccessStatus = set_ntstatus( access_status );
|
|
|
|
return ret;
|
1999-02-10 07:39:51 +01:00
|
|
|
}
|
1999-07-10 12:17:27 +02:00
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AccessCheckByType [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AccessCheckByType(
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
PSID PrincipalSelfSid,
|
|
|
|
HANDLE ClientToken,
|
|
|
|
DWORD DesiredAccess,
|
|
|
|
POBJECT_TYPE_LIST ObjectTypeList,
|
|
|
|
DWORD ObjectTypeListLength,
|
|
|
|
PGENERIC_MAPPING GenericMapping,
|
|
|
|
PPRIVILEGE_SET PrivilegeSet,
|
|
|
|
LPDWORD PrivilegeSetLength,
|
|
|
|
LPDWORD GrantedAccess,
|
|
|
|
LPBOOL AccessStatus)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
|
|
|
|
*AccessStatus = TRUE;
|
|
|
|
|
|
|
|
return !*AccessStatus;
|
|
|
|
}
|
|
|
|
|
2005-06-20 13:44:45 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* MapGenericMask [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Maps generic access rights into specific access rights according to the
|
|
|
|
* supplied mapping.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* AccessMask [I/O] Access rights.
|
|
|
|
* GenericMapping [I] The mapping between generic and specific rights.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
|
|
|
*/
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
VOID WINAPI MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping )
|
|
|
|
{
|
2005-06-20 13:44:45 +02:00
|
|
|
RtlMapGenericMask( AccessMask, GenericMapping );
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
1999-07-10 12:17:27 +02:00
|
|
|
/*************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* SetKernelObjectSecurity [ADVAPI32.@]
|
1999-07-10 12:17:27 +02:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOL WINAPI SetKernelObjectSecurity (
|
|
|
|
IN HANDLE Handle,
|
|
|
|
IN SECURITY_INFORMATION SecurityInformation,
|
|
|
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor )
|
1999-07-10 12:17:27 +02:00
|
|
|
{
|
2004-12-22 16:31:16 +01:00
|
|
|
return set_ntstatus (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
|
1999-07-10 12:17:27 +02:00
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AddAuditAccessAce [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddAuditAccessAce(
|
2005-06-23 13:03:52 +02:00
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD dwAccessMask,
|
|
|
|
IN PSID pSid,
|
|
|
|
IN BOOL bAuditSuccess,
|
|
|
|
IN BOOL bAuditFailure)
|
|
|
|
{
|
|
|
|
return set_ntstatus( RtlAddAuditAccessAce(pAcl, dwAceRevision, dwAccessMask, pSid,
|
|
|
|
bAuditSuccess, bAuditFailure) );
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
|
|
|
|
2000-10-15 02:23:56 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LookupAccountNameA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
LookupAccountNameA(
|
|
|
|
IN LPCSTR system,
|
|
|
|
IN LPCSTR account,
|
|
|
|
OUT PSID sid,
|
|
|
|
OUT LPDWORD cbSid,
|
|
|
|
LPSTR ReferencedDomainName,
|
|
|
|
IN OUT LPDWORD cbReferencedDomainName,
|
|
|
|
OUT PSID_NAME_USE name_use )
|
|
|
|
{
|
2004-09-07 22:41:35 +02:00
|
|
|
/* Default implementation: Always return a default SID */
|
|
|
|
SID_IDENTIFIER_AUTHORITY identifierAuthority = {SECURITY_NT_AUTHORITY};
|
|
|
|
BOOL ret;
|
|
|
|
PSID pSid;
|
|
|
|
static const char dm[] = "DOMAIN";
|
|
|
|
|
2000-10-15 02:23:56 +02:00
|
|
|
FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
|
2004-09-07 22:41:35 +02:00
|
|
|
|
|
|
|
ret = AllocateAndInitializeSid(&identifierAuthority,
|
|
|
|
2,
|
|
|
|
SECURITY_BUILTIN_DOMAIN_RID,
|
|
|
|
DOMAIN_ALIAS_RID_ADMINS,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
|
|
|
&pSid);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
return FALSE;
|
|
|
|
if(!RtlValidSid(pSid))
|
|
|
|
{
|
|
|
|
FreeSid(pSid);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sid != NULL && (*cbSid >= GetLengthSid(pSid)))
|
|
|
|
CopySid(*cbSid, sid, pSid);
|
|
|
|
if (*cbSid < GetLengthSid(pSid))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
*cbSid = GetLengthSid(pSid);
|
|
|
|
|
|
|
|
if (ReferencedDomainName != NULL && (*cbReferencedDomainName > strlen(dm)))
|
|
|
|
strcpy(ReferencedDomainName, dm);
|
|
|
|
if (*cbReferencedDomainName <= strlen(dm))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
*cbReferencedDomainName = strlen(dm)+1;
|
|
|
|
|
|
|
|
FreeSid(pSid);
|
|
|
|
|
|
|
|
return ret;
|
2000-10-15 02:23:56 +02:00
|
|
|
}
|
2002-01-31 21:44:02 +01:00
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LookupAccountNameW [ADVAPI32.@]
|
|
|
|
*/
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid,
|
|
|
|
LPDWORD cbSid, LPWSTR ReferencedDomainName,
|
|
|
|
LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse )
|
|
|
|
{
|
|
|
|
FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName),
|
|
|
|
Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-04-19 02:04:27 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PrivilegeCheck [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
|
|
|
|
{
|
2005-04-22 23:17:42 +02:00
|
|
|
BOOL ret;
|
|
|
|
BOOLEAN Result;
|
|
|
|
|
|
|
|
TRACE("%p %p %p\n", ClientToken, RequiredPrivileges, pfResult);
|
|
|
|
|
|
|
|
ret = set_ntstatus (NtPrivilegeCheck (ClientToken, RequiredPrivileges, &Result));
|
|
|
|
if (ret)
|
|
|
|
*pfResult = Result;
|
|
|
|
return ret;
|
2002-04-19 02:04:27 +02:00
|
|
|
}
|
2002-12-19 05:15:23 +01:00
|
|
|
|
2003-05-11 04:37:11 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* AccessCheckAndAuditAlarmA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR Subsystem, LPVOID HandleId, LPSTR ObjectTypeName,
|
|
|
|
LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess,
|
|
|
|
PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess,
|
|
|
|
LPBOOL AccessStatus, LPBOOL pfGenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%s,%s,%p,%08lx,%p,%x,%p,%p,%p)\n", debugstr_a(Subsystem),
|
|
|
|
HandleId, debugstr_a(ObjectTypeName), debugstr_a(ObjectName),
|
|
|
|
SecurityDescriptor, DesiredAccess, GenericMapping,
|
|
|
|
ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AccessCheckAndAuditAlarmW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR Subsystem, LPVOID HandleId, LPWSTR ObjectTypeName,
|
|
|
|
LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess,
|
|
|
|
PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess,
|
|
|
|
LPBOOL AccessStatus, LPBOOL pfGenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%s,%s,%p,%08lx,%p,%x,%p,%p,%p)\n", debugstr_w(Subsystem),
|
|
|
|
HandleId, debugstr_w(ObjectTypeName), debugstr_w(ObjectName),
|
|
|
|
SecurityDescriptor, DesiredAccess, GenericMapping,
|
|
|
|
ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%x)\n", debugstr_a(SubsystemName), HandleId, GenerateOnClose);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ObjectCloseAuditAlarmW(LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%x)\n", debugstr_w(SubsystemName), HandleId, GenerateOnClose);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ObjectOpenAuditAlarmA(LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName,
|
|
|
|
LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess,
|
|
|
|
DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted,
|
|
|
|
LPBOOL GenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%s,%s,%p,%p,0x%08lx,0x%08lx,%p,%x,%x,%p)\n", debugstr_a(SubsystemName),
|
|
|
|
HandleId, debugstr_a(ObjectTypeName), debugstr_a(ObjectName), pSecurityDescriptor,
|
|
|
|
ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted,
|
|
|
|
GenerateOnClose);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ObjectOpenAuditAlarmW(LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName,
|
|
|
|
LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess,
|
|
|
|
DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted,
|
|
|
|
LPBOOL GenerateOnClose)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%s,%s,%p,%p,0x%08lx,0x%08lx,%p,%x,%x,%p)\n", debugstr_w(SubsystemName),
|
|
|
|
HandleId, debugstr_w(ObjectTypeName), debugstr_w(ObjectName), pSecurityDescriptor,
|
|
|
|
ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted,
|
|
|
|
GenerateOnClose);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken,
|
|
|
|
DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%p,0x%08lx,%p,%x)\n", debugstr_a(SubsystemName), HandleId, ClientToken,
|
|
|
|
DesiredAccess, Privileges, AccessGranted);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken,
|
|
|
|
DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%p,%p,0x%08lx,%p,%x)\n", debugstr_w(SubsystemName), HandleId, ClientToken,
|
|
|
|
DesiredAccess, Privileges, AccessGranted);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken,
|
|
|
|
PPRIVILEGE_SET Privileges, BOOL AccessGranted)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s,%s,%p,%p,%x)\n", debugstr_a(SubsystemName), debugstr_a(ServiceName),
|
|
|
|
ClientToken, Privileges, AccessGranted);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken,
|
|
|
|
PPRIVILEGE_SET Privileges, BOOL AccessGranted)
|
|
|
|
{
|
|
|
|
FIXME("stub %s,%s,%p,%p,%x)\n", debugstr_w(SubsystemName), debugstr_w(ServiceName),
|
|
|
|
ClientToken, Privileges, AccessGranted);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-05-11 04:37:11 +02:00
|
|
|
|
2004-08-26 02:29:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetSecurityInfo [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetSecurityInfo(
|
|
|
|
HANDLE hObject, SE_OBJECT_TYPE ObjectType,
|
|
|
|
SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner,
|
|
|
|
PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl,
|
|
|
|
PSECURITY_DESCRIPTOR *ppSecurityDescriptor
|
|
|
|
)
|
|
|
|
{
|
|
|
|
FIXME("stub!\n");
|
|
|
|
return ERROR_BAD_PROVIDER;
|
|
|
|
}
|
|
|
|
|
2002-12-19 05:15:23 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GetSecurityInfoExW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetSecurityInfoExW(
|
|
|
|
HANDLE hObject, SE_OBJECT_TYPE ObjectType,
|
|
|
|
SECURITY_INFORMATION SecurityInfo, LPCWSTR lpProvider,
|
|
|
|
LPCWSTR lpProperty, PACTRL_ACCESSW *ppAccessList,
|
|
|
|
PACTRL_AUDITW *ppAuditList, LPWSTR *lppOwner, LPWSTR *lppGroup
|
|
|
|
)
|
|
|
|
{
|
|
|
|
FIXME("stub!\n");
|
|
|
|
return ERROR_BAD_PROVIDER;
|
|
|
|
}
|
2003-08-11 20:41:28 +02:00
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* BuildExplicitAccessWithNameA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildExplicitAccessWithNameA( PEXPLICIT_ACCESSA pExplicitAccess,
|
|
|
|
LPSTR pTrusteeName, DWORD AccessPermissions,
|
|
|
|
ACCESS_MODE AccessMode, DWORD Inheritance )
|
|
|
|
{
|
|
|
|
TRACE("%p %s 0x%08lx 0x%08x 0x%08lx\n", pExplicitAccess, debugstr_a(pTrusteeName),
|
|
|
|
AccessPermissions, AccessMode, Inheritance);
|
|
|
|
|
|
|
|
pExplicitAccess->grfAccessPermissions = AccessPermissions;
|
|
|
|
pExplicitAccess->grfAccessMode = AccessMode;
|
|
|
|
pExplicitAccess->grfInheritance = Inheritance;
|
|
|
|
|
|
|
|
pExplicitAccess->Trustee.pMultipleTrustee = NULL;
|
|
|
|
pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
|
|
|
|
pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pExplicitAccess->Trustee.ptstrName = pTrusteeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildExplicitAccessWithNameW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildExplicitAccessWithNameW( PEXPLICIT_ACCESSW pExplicitAccess,
|
|
|
|
LPWSTR pTrusteeName, DWORD AccessPermissions,
|
|
|
|
ACCESS_MODE AccessMode, DWORD Inheritance )
|
|
|
|
{
|
|
|
|
TRACE("%p %s 0x%08lx 0x%08x 0x%08lx\n", pExplicitAccess, debugstr_w(pTrusteeName),
|
|
|
|
AccessPermissions, AccessMode, Inheritance);
|
|
|
|
|
|
|
|
pExplicitAccess->grfAccessPermissions = AccessPermissions;
|
|
|
|
pExplicitAccess->grfAccessMode = AccessMode;
|
|
|
|
pExplicitAccess->grfInheritance = Inheritance;
|
|
|
|
|
|
|
|
pExplicitAccess->Trustee.pMultipleTrustee = NULL;
|
|
|
|
pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
|
|
|
|
pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pExplicitAccess->Trustee.ptstrName = pTrusteeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithObjectsAndNameA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithObjectsAndNameA( PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName,
|
|
|
|
SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName,
|
|
|
|
LPSTR InheritedObjectTypeName, LPSTR Name )
|
|
|
|
{
|
|
|
|
TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName,
|
|
|
|
ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_a(Name));
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = Name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithObjectsAndNameW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithObjectsAndNameW( PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName,
|
|
|
|
SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName,
|
|
|
|
LPWSTR InheritedObjectTypeName, LPWSTR Name )
|
|
|
|
{
|
|
|
|
TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName,
|
|
|
|
ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_w(Name));
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = Name;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI BuildTrusteeWithObjectsAndSidA( PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid,
|
|
|
|
GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid )
|
|
|
|
{
|
|
|
|
TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid);
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = (LPSTR) pSid;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI BuildTrusteeWithObjectsAndSidW( PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid,
|
|
|
|
GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid )
|
|
|
|
{
|
|
|
|
TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid);
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = (LPWSTR) pSid;
|
|
|
|
}
|
|
|
|
|
2003-08-11 20:41:28 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithSidA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid)
|
|
|
|
{
|
2004-08-16 23:07:50 +02:00
|
|
|
TRACE("%p %p\n", pTrustee, pSid);
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
2004-08-19 21:01:12 +02:00
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_SID;
|
2004-08-16 23:07:50 +02:00
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = (LPSTR) pSid;
|
2003-08-11 20:41:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithSidW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid)
|
|
|
|
{
|
2004-08-16 23:07:50 +02:00
|
|
|
TRACE("%p %p\n", pTrustee, pSid);
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
2004-08-19 21:01:12 +02:00
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_SID;
|
2004-08-16 23:07:50 +02:00
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = (LPWSTR) pSid;
|
2003-08-11 20:41:28 +02:00
|
|
|
}
|
2003-08-12 20:53:14 +02:00
|
|
|
|
2004-08-19 21:01:12 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithNameA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithNameA(PTRUSTEEA pTrustee, LPSTR name)
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", pTrustee, debugstr_a(name) );
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BuildTrusteeWithNameW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
VOID WINAPI BuildTrusteeWithNameW(PTRUSTEEW pTrustee, LPWSTR name)
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", pTrustee, debugstr_w(name) );
|
|
|
|
|
|
|
|
pTrustee->pMultipleTrustee = NULL;
|
|
|
|
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
|
|
|
pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
|
|
|
|
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
|
|
|
|
pTrustee->ptstrName = name;
|
|
|
|
}
|
|
|
|
|
2005-06-21 22:20:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeFormA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
TRUSTEE_FORM WINAPI GetTrusteeFormA(PTRUSTEEA pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return TRUSTEE_BAD_FORM;
|
|
|
|
|
|
|
|
return pTrustee->TrusteeForm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeFormW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
TRUSTEE_FORM WINAPI GetTrusteeFormW(PTRUSTEEW pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return TRUSTEE_BAD_FORM;
|
|
|
|
|
|
|
|
return pTrustee->TrusteeForm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeNameA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
LPSTR WINAPI GetTrusteeNameA(PTRUSTEEA pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return pTrustee->ptstrName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeNameW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
LPWSTR WINAPI GetTrusteeNameW(PTRUSTEEW pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return pTrustee->ptstrName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeTypeA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
TRUSTEE_TYPE WINAPI GetTrusteeTypeA(PTRUSTEEA pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return TRUSTEE_IS_UNKNOWN;
|
|
|
|
|
|
|
|
return pTrustee->TrusteeType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetTrusteeTypeW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
TRUSTEE_TYPE WINAPI GetTrusteeTypeW(PTRUSTEEW pTrustee)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", pTrustee);
|
|
|
|
|
|
|
|
if (!pTrustee)
|
|
|
|
return TRUSTEE_IS_UNKNOWN;
|
|
|
|
|
|
|
|
return pTrustee->TrusteeType;
|
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI SetAclInformation( PACL pAcl, LPVOID pAclInformation,
|
|
|
|
DWORD nAclInformationLength,
|
|
|
|
ACL_INFORMATION_CLASS dwAclInformationClass )
|
|
|
|
{
|
|
|
|
FIXME("%p %p 0x%08lx 0x%08x - stub\n", pAcl, pAclInformation,
|
|
|
|
nAclInformationLength, dwAclInformationClass);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-08-12 20:53:14 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* SetEntriesInAclA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SetEntriesInAclA( ULONG count, PEXPLICIT_ACCESSA pEntries,
|
|
|
|
PACL OldAcl, PACL* NewAcl )
|
|
|
|
{
|
|
|
|
FIXME("%ld %p %p %p\n",count,pEntries,OldAcl,NewAcl);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SetEntriesInAclW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SetEntriesInAclW( ULONG count, PEXPLICIT_ACCESSW pEntries,
|
|
|
|
PACL OldAcl, PACL* NewAcl )
|
|
|
|
{
|
|
|
|
FIXME("%ld %p %p %p\n",count,pEntries,OldAcl,NewAcl);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SetNamedSecurityInfoA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SetNamedSecurityInfoA(LPSTR pObjectName,
|
|
|
|
SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo,
|
|
|
|
PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl)
|
|
|
|
{
|
2004-08-10 00:55:47 +02:00
|
|
|
DWORD len;
|
|
|
|
LPWSTR wstr = NULL;
|
|
|
|
DWORD r;
|
|
|
|
|
|
|
|
TRACE("%s %d %ld %p %p %p %p\n", debugstr_a(pObjectName), ObjectType,
|
2003-08-12 20:53:14 +02:00
|
|
|
SecurityInfo, psidOwner, psidGroup, pDacl, pSacl);
|
2004-08-10 00:55:47 +02:00
|
|
|
|
|
|
|
if( pObjectName )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 );
|
|
|
|
wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
r = SetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, psidOwner,
|
|
|
|
psidGroup, pDacl, pSacl );
|
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, wstr );
|
2004-08-10 00:55:47 +02:00
|
|
|
|
|
|
|
return r;
|
2003-08-12 20:53:14 +02:00
|
|
|
}
|
|
|
|
|
Stub implementations for GetKernelObjectSecurity,
GetPrivateObjectSecurity, GetServiceKeyName{A,W},
ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W},
IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW,
LookupPrivilegeDisplayName{A,W}, MapGenericMask,
ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W},
ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W},
QueryServiceLockStatus{A,W}, SetAclInformation,
SetPrivateObjectSecurity, SetSecurityDescriptorControl,
SetServiceBits, LsaSetInformationPolicy, LsaLookupNames,
LsaEnumerateTrustedDomains.
2005-01-03 18:12:51 +01:00
|
|
|
BOOL WINAPI SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR ModificationDescriptor,
|
|
|
|
PSECURITY_DESCRIPTOR* ObjectsSecurityDescriptor,
|
|
|
|
PGENERIC_MAPPING GenericMapping,
|
|
|
|
HANDLE Token )
|
|
|
|
{
|
|
|
|
FIXME("0x%08lx %p %p %p %p - stub\n", SecurityInformation, ModificationDescriptor,
|
|
|
|
ObjectsSecurityDescriptor, GenericMapping, Token);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
|
|
|
|
SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet )
|
|
|
|
{
|
|
|
|
FIXME("%p 0x%08x 0x%08x - stub\n", pSecurityDescriptor, ControlBitsOfInterest,
|
|
|
|
ControlBitsToSet);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
BOOL WINAPI AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess )
|
|
|
|
{
|
|
|
|
return RtlAreAllAccessesGranted( GrantedAccess, DesiredAccess );
|
|
|
|
}
|
|
|
|
|
2004-05-25 02:22:42 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* AreAnyAccessesGranted [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Determines whether or not any of a set of specified access permissions have
|
|
|
|
* been granted or not.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* GrantedAccess [I] The permissions that have been granted.
|
|
|
|
* DesiredAccess [I] The permissions that you want to have.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nonzero if any of the permissions have been granted, zero if none of the
|
|
|
|
* permissions have been granted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL WINAPI AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess )
|
|
|
|
{
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
return RtlAreAnyAccessesGranted( GrantedAccess, DesiredAccess );
|
2004-05-25 02:22:42 +02:00
|
|
|
}
|
|
|
|
|
2003-08-12 20:53:14 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* SetNamedSecurityInfoW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SetNamedSecurityInfoW(LPWSTR pObjectName,
|
|
|
|
SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo,
|
|
|
|
PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl)
|
|
|
|
{
|
|
|
|
FIXME("%s %d %ld %p %p %p %p\n", debugstr_w(pObjectName), ObjectType,
|
|
|
|
SecurityInfo, psidOwner, psidGroup, pDacl, pSacl);
|
2005-04-11 16:25:41 +02:00
|
|
|
return ERROR_SUCCESS;
|
2003-08-12 20:53:14 +02:00
|
|
|
}
|
2003-09-17 22:04:45 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetExplicitEntriesFromAclA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetExplicitEntriesFromAclA( PACL pacl, PULONG pcCountOfExplicitEntries,
|
|
|
|
PEXPLICIT_ACCESSA* pListOfExplicitEntries)
|
|
|
|
{
|
|
|
|
FIXME("%p %p %p\n",pacl, pcCountOfExplicitEntries, pListOfExplicitEntries);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetExplicitEntriesFromAclW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetExplicitEntriesFromAclW( PACL pacl, PULONG pcCountOfExplicitEntries,
|
|
|
|
PEXPLICIT_ACCESSW* pListOfExplicitEntries)
|
|
|
|
{
|
|
|
|
FIXME("%p %p %p\n",pacl, pcCountOfExplicitEntries, pListOfExplicitEntries);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseAclStringFlags
|
|
|
|
*/
|
|
|
|
static DWORD ParseAclStringFlags(LPCWSTR* StringAcl)
|
|
|
|
{
|
|
|
|
DWORD flags = 0;
|
|
|
|
LPCWSTR szAcl = *StringAcl;
|
|
|
|
|
|
|
|
while (*szAcl != '(')
|
|
|
|
{
|
|
|
|
if (*szAcl == 'P')
|
|
|
|
{
|
|
|
|
flags |= SE_DACL_PROTECTED;
|
|
|
|
}
|
|
|
|
else if (*szAcl == 'A')
|
|
|
|
{
|
|
|
|
szAcl++;
|
|
|
|
if (*szAcl == 'R')
|
|
|
|
flags |= SE_DACL_AUTO_INHERIT_REQ;
|
|
|
|
else if (*szAcl == 'I')
|
|
|
|
flags |= SE_DACL_AUTO_INHERITED;
|
|
|
|
}
|
|
|
|
szAcl++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*StringAcl = szAcl;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseAceStringType
|
|
|
|
*/
|
|
|
|
ACEFLAG AceType[] =
|
|
|
|
{
|
|
|
|
{ SDDL_ACCESS_ALLOWED, ACCESS_ALLOWED_ACE_TYPE },
|
|
|
|
{ SDDL_ALARM, SYSTEM_ALARM_ACE_TYPE },
|
|
|
|
{ SDDL_AUDIT, SYSTEM_AUDIT_ACE_TYPE },
|
|
|
|
{ SDDL_ACCESS_DENIED, ACCESS_DENIED_ACE_TYPE },
|
|
|
|
/*
|
|
|
|
{ SDDL_OBJECT_ACCESS_ALLOWED, ACCESS_ALLOWED_OBJECT_ACE_TYPE },
|
|
|
|
{ SDDL_OBJECT_ACCESS_DENIED, ACCESS_DENIED_OBJECT_ACE_TYPE },
|
|
|
|
{ SDDL_OBJECT_ALARM, SYSTEM_ALARM_OBJECT_ACE_TYPE },
|
|
|
|
{ SDDL_OBJECT_AUDIT, SYSTEM_AUDIT_OBJECT_ACE_TYPE },
|
|
|
|
*/
|
|
|
|
{ NULL, 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static BYTE ParseAceStringType(LPCWSTR* StringAcl)
|
|
|
|
{
|
|
|
|
UINT len = 0;
|
|
|
|
LPCWSTR szAcl = *StringAcl;
|
|
|
|
LPACEFLAG lpaf = AceType;
|
|
|
|
|
|
|
|
while (lpaf->wstr &&
|
|
|
|
(len = strlenW(lpaf->wstr)) &&
|
|
|
|
strncmpW(lpaf->wstr, szAcl, len))
|
|
|
|
lpaf++;
|
|
|
|
|
|
|
|
if (!lpaf->wstr)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
*StringAcl += len;
|
|
|
|
return lpaf->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseAceStringFlags
|
|
|
|
*/
|
|
|
|
ACEFLAG AceFlags[] =
|
|
|
|
{
|
|
|
|
{ SDDL_CONTAINER_INHERIT, CONTAINER_INHERIT_ACE },
|
|
|
|
{ SDDL_AUDIT_FAILURE, FAILED_ACCESS_ACE_FLAG },
|
|
|
|
{ SDDL_INHERITED, INHERITED_ACE },
|
|
|
|
{ SDDL_INHERIT_ONLY, INHERIT_ONLY_ACE },
|
|
|
|
{ SDDL_NO_PROPAGATE, NO_PROPAGATE_INHERIT_ACE },
|
|
|
|
{ SDDL_OBJECT_INHERIT, OBJECT_INHERIT_ACE },
|
|
|
|
{ SDDL_AUDIT_SUCCESS, SUCCESSFUL_ACCESS_ACE_FLAG },
|
|
|
|
{ NULL, 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static BYTE ParseAceStringFlags(LPCWSTR* StringAcl)
|
|
|
|
{
|
|
|
|
UINT len = 0;
|
|
|
|
BYTE flags = 0;
|
|
|
|
LPCWSTR szAcl = *StringAcl;
|
|
|
|
|
|
|
|
while (*szAcl != ';')
|
|
|
|
{
|
|
|
|
LPACEFLAG lpaf = AceFlags;
|
|
|
|
|
|
|
|
while (lpaf->wstr &&
|
|
|
|
(len = strlenW(lpaf->wstr)) &&
|
|
|
|
strncmpW(lpaf->wstr, szAcl, len))
|
|
|
|
lpaf++;
|
|
|
|
|
|
|
|
if (!lpaf->wstr)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
flags |= lpaf->value;
|
|
|
|
szAcl += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
*StringAcl = szAcl;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseAceStringRights
|
|
|
|
*/
|
|
|
|
ACEFLAG AceRights[] =
|
|
|
|
{
|
|
|
|
{ SDDL_GENERIC_ALL, GENERIC_ALL },
|
|
|
|
{ SDDL_GENERIC_READ, GENERIC_READ },
|
|
|
|
{ SDDL_GENERIC_WRITE, GENERIC_WRITE },
|
|
|
|
{ SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE },
|
|
|
|
{ SDDL_READ_CONTROL, READ_CONTROL },
|
|
|
|
{ SDDL_STANDARD_DELETE, DELETE },
|
|
|
|
{ SDDL_WRITE_DAC, WRITE_DAC },
|
|
|
|
{ SDDL_WRITE_OWNER, WRITE_OWNER },
|
|
|
|
{ NULL, 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static DWORD ParseAceStringRights(LPCWSTR* StringAcl)
|
|
|
|
{
|
|
|
|
UINT len = 0;
|
|
|
|
DWORD rights = 0;
|
|
|
|
LPCWSTR szAcl = *StringAcl;
|
|
|
|
|
|
|
|
if ((*szAcl == '0') && (*(szAcl + 1) == 'x'))
|
|
|
|
{
|
|
|
|
LPCWSTR p = szAcl;
|
|
|
|
|
|
|
|
while (*p && *p != ';')
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (p - szAcl <= 8)
|
|
|
|
{
|
|
|
|
rights = strtoulW(szAcl, NULL, 16);
|
|
|
|
*StringAcl = p;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (*szAcl != ';')
|
|
|
|
{
|
|
|
|
LPACEFLAG lpaf = AceRights;
|
|
|
|
|
|
|
|
while (lpaf->wstr &&
|
|
|
|
(len = strlenW(lpaf->wstr)) &&
|
|
|
|
strncmpW(lpaf->wstr, szAcl, len))
|
|
|
|
{
|
|
|
|
lpaf++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!lpaf->wstr)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
rights |= lpaf->value;
|
|
|
|
szAcl += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*StringAcl = szAcl;
|
|
|
|
return rights;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseStringAclToAcl
|
|
|
|
*
|
|
|
|
* dacl_flags(string_ace1)(string_ace2)... (string_acen)
|
|
|
|
*/
|
|
|
|
static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags,
|
|
|
|
PACL pAcl, LPDWORD cBytes)
|
|
|
|
{
|
|
|
|
DWORD val;
|
|
|
|
DWORD sidlen;
|
|
|
|
DWORD length = sizeof(ACL);
|
|
|
|
PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(StringAcl));
|
|
|
|
|
|
|
|
if (!StringAcl)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (pAcl) /* pAce is only useful if we're setting values */
|
|
|
|
pAce = (PACCESS_ALLOWED_ACE) ((LPBYTE)pAcl + sizeof(PACL));
|
|
|
|
|
|
|
|
/* Parse ACL flags */
|
|
|
|
*lpdwFlags = ParseAclStringFlags(&StringAcl);
|
|
|
|
|
|
|
|
/* Parse ACE */
|
|
|
|
while (*StringAcl == '(')
|
|
|
|
{
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE type */
|
|
|
|
val = ParseAceStringType(&StringAcl);
|
|
|
|
if (pAce)
|
|
|
|
pAce->Header.AceType = (BYTE) val;
|
|
|
|
if (*StringAcl != ';')
|
|
|
|
goto lerr;
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE flags */
|
|
|
|
val = ParseAceStringFlags(&StringAcl);
|
|
|
|
if (pAce)
|
|
|
|
pAce->Header.AceFlags = (BYTE) val;
|
|
|
|
if (*StringAcl != ';')
|
|
|
|
goto lerr;
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE rights */
|
|
|
|
val = ParseAceStringRights(&StringAcl);
|
|
|
|
if (pAce)
|
|
|
|
pAce->Mask = val;
|
|
|
|
if (*StringAcl != ';')
|
|
|
|
goto lerr;
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE object guid */
|
|
|
|
if (*StringAcl != ';')
|
|
|
|
{
|
2004-01-27 01:01:43 +01:00
|
|
|
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
|
2003-11-11 23:03:24 +01:00
|
|
|
goto lerr;
|
|
|
|
}
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE inherit object guid */
|
|
|
|
if (*StringAcl != ';')
|
|
|
|
{
|
2004-01-27 01:01:43 +01:00
|
|
|
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
|
2003-11-11 23:03:24 +01:00
|
|
|
goto lerr;
|
|
|
|
}
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
/* Parse ACE account sid */
|
|
|
|
if (ParseStringSidToSid(StringAcl, pAce ? (PSID)&pAce->SidStart : NULL, &sidlen))
|
|
|
|
{
|
|
|
|
while (*StringAcl && *StringAcl != ')')
|
|
|
|
StringAcl++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*StringAcl != ')')
|
|
|
|
goto lerr;
|
|
|
|
StringAcl++;
|
|
|
|
|
|
|
|
length += sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) + sidlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes = length;
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
lerr:
|
|
|
|
WARN("Invalid ACE string format\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ParseStringSecurityDescriptorToSecurityDescriptor
|
|
|
|
*/
|
|
|
|
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
|
|
|
|
LPCWSTR StringSecurityDescriptor,
|
2004-08-14 01:55:43 +02:00
|
|
|
SECURITY_DESCRIPTOR* SecurityDescriptor,
|
2003-11-11 23:03:24 +01:00
|
|
|
LPDWORD cBytes)
|
|
|
|
{
|
|
|
|
BOOL bret = FALSE;
|
|
|
|
WCHAR toktype;
|
|
|
|
WCHAR tok[MAX_PATH];
|
|
|
|
LPCWSTR lptoken;
|
|
|
|
LPBYTE lpNext = NULL;
|
2005-04-21 19:18:50 +02:00
|
|
|
DWORD len;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
*cBytes = 0;
|
|
|
|
|
|
|
|
if (SecurityDescriptor)
|
|
|
|
lpNext = ((LPBYTE) SecurityDescriptor) + sizeof(SECURITY_DESCRIPTOR);
|
|
|
|
|
|
|
|
while (*StringSecurityDescriptor)
|
|
|
|
{
|
|
|
|
toktype = *StringSecurityDescriptor;
|
|
|
|
|
|
|
|
/* Expect char identifier followed by ':' */
|
|
|
|
StringSecurityDescriptor++;
|
|
|
|
if (*StringSecurityDescriptor != ':')
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
StringSecurityDescriptor++;
|
|
|
|
|
|
|
|
/* Extract token */
|
|
|
|
lptoken = StringSecurityDescriptor;
|
|
|
|
while (*lptoken && *lptoken != ':')
|
|
|
|
lptoken++;
|
|
|
|
|
|
|
|
if (*lptoken)
|
|
|
|
lptoken--;
|
|
|
|
|
2005-04-21 19:18:50 +02:00
|
|
|
len = lptoken - StringSecurityDescriptor;
|
|
|
|
memcpy( tok, StringSecurityDescriptor, len * sizeof(WCHAR) );
|
|
|
|
tok[len] = 0;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
switch (toktype)
|
|
|
|
{
|
|
|
|
case 'O':
|
|
|
|
{
|
|
|
|
DWORD bytes;
|
|
|
|
|
|
|
|
if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes))
|
|
|
|
goto lend;
|
|
|
|
|
|
|
|
if (SecurityDescriptor)
|
|
|
|
{
|
2005-08-22 11:18:48 +02:00
|
|
|
SecurityDescriptor->Owner = (PSID)(lpNext - (LPBYTE)SecurityDescriptor);
|
2003-11-11 23:03:24 +01:00
|
|
|
lpNext += bytes; /* Advance to next token */
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes += bytes;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'G':
|
|
|
|
{
|
|
|
|
DWORD bytes;
|
|
|
|
|
|
|
|
if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes))
|
|
|
|
goto lend;
|
|
|
|
|
|
|
|
if (SecurityDescriptor)
|
|
|
|
{
|
2005-08-22 11:18:48 +02:00
|
|
|
SecurityDescriptor->Group = (PSID)(lpNext - (LPBYTE)SecurityDescriptor);
|
2003-11-11 23:03:24 +01:00
|
|
|
lpNext += bytes; /* Advance to next token */
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes += bytes;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'D':
|
|
|
|
{
|
|
|
|
DWORD flags;
|
|
|
|
DWORD bytes;
|
|
|
|
|
|
|
|
if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes))
|
|
|
|
goto lend;
|
|
|
|
|
|
|
|
if (SecurityDescriptor)
|
|
|
|
{
|
|
|
|
SecurityDescriptor->Control |= SE_DACL_PRESENT | flags;
|
2005-08-22 11:18:48 +02:00
|
|
|
SecurityDescriptor->Dacl = (PACL)(lpNext - (LPBYTE)SecurityDescriptor);
|
2003-11-11 23:03:24 +01:00
|
|
|
lpNext += bytes; /* Advance to next token */
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes += bytes;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
{
|
|
|
|
DWORD flags;
|
|
|
|
DWORD bytes;
|
|
|
|
|
|
|
|
if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes))
|
|
|
|
goto lend;
|
|
|
|
|
|
|
|
if (SecurityDescriptor)
|
|
|
|
{
|
|
|
|
SecurityDescriptor->Control |= SE_SACL_PRESENT | flags;
|
2005-08-22 11:18:48 +02:00
|
|
|
SecurityDescriptor->Sacl = (PACL)(lpNext - (LPBYTE)SecurityDescriptor);
|
2003-11-11 23:03:24 +01:00
|
|
|
lpNext += bytes; /* Advance to next token */
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes += bytes;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("Unknown token\n");
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringSecurityDescriptor = lptoken;
|
|
|
|
}
|
|
|
|
|
|
|
|
bret = TRUE;
|
|
|
|
|
|
|
|
lend:
|
|
|
|
return bret;
|
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* ConvertStringSecurityDescriptorToSecurityDescriptorA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
|
|
|
|
LPCSTR StringSecurityDescriptor,
|
|
|
|
DWORD StringSDRevision,
|
|
|
|
PSECURITY_DESCRIPTOR* SecurityDescriptor,
|
|
|
|
PULONG SecurityDescriptorSize)
|
|
|
|
{
|
|
|
|
UINT len;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
LPWSTR StringSecurityDescriptorW;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0);
|
2005-03-22 19:26:06 +01:00
|
|
|
StringSecurityDescriptorW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
|
|
|
|
if (StringSecurityDescriptorW)
|
|
|
|
{
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, StringSecurityDescriptorW, len);
|
|
|
|
|
|
|
|
ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW,
|
|
|
|
StringSDRevision, SecurityDescriptor,
|
|
|
|
SecurityDescriptorSize);
|
|
|
|
HeapFree(GetProcessHeap(), 0, StringSecurityDescriptorW);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(
|
|
|
|
LPCWSTR StringSecurityDescriptor,
|
|
|
|
DWORD StringSDRevision,
|
|
|
|
PSECURITY_DESCRIPTOR* SecurityDescriptor,
|
|
|
|
PULONG SecurityDescriptorSize)
|
|
|
|
{
|
|
|
|
DWORD cBytes;
|
2004-08-14 01:55:43 +02:00
|
|
|
SECURITY_DESCRIPTOR* psd;
|
2003-11-11 23:03:24 +01:00
|
|
|
BOOL bret = FALSE;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(StringSecurityDescriptor));
|
|
|
|
|
|
|
|
if (GetVersion() & 0x80000000)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
else if (StringSDRevision != SID_REVISION)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_UNKNOWN_REVISION);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute security descriptor length */
|
|
|
|
if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
|
|
|
|
NULL, &cBytes))
|
|
|
|
goto lend;
|
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
psd = *SecurityDescriptor = (SECURITY_DESCRIPTOR*) LocalAlloc(
|
2003-11-11 23:03:24 +01:00
|
|
|
GMEM_ZEROINIT, cBytes);
|
|
|
|
|
|
|
|
psd->Revision = SID_REVISION;
|
|
|
|
psd->Control |= SE_SELF_RELATIVE;
|
|
|
|
|
|
|
|
if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
|
|
|
|
psd, &cBytes))
|
|
|
|
{
|
|
|
|
LocalFree(psd);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SecurityDescriptorSize)
|
|
|
|
*SecurityDescriptorSize = cBytes;
|
|
|
|
|
|
|
|
bret = TRUE;
|
|
|
|
|
|
|
|
lend:
|
|
|
|
TRACE(" ret=%d\n", bret);
|
|
|
|
return bret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ConvertStringSidToSidW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertStringSidToSidW(LPCWSTR StringSid, PSID* Sid)
|
|
|
|
{
|
|
|
|
BOOL bret = FALSE;
|
|
|
|
DWORD cBytes;
|
|
|
|
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("%s, %p\n", debugstr_w(StringSid), Sid);
|
2003-11-11 23:03:24 +01:00
|
|
|
if (GetVersion() & 0x80000000)
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
2004-09-16 22:27:52 +02:00
|
|
|
else if (!StringSid || !Sid)
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2003-11-11 23:03:24 +01:00
|
|
|
else if (ParseStringSidToSid(StringSid, NULL, &cBytes))
|
|
|
|
{
|
|
|
|
PSID pSid = *Sid = (PSID) LocalAlloc(0, cBytes);
|
|
|
|
|
|
|
|
bret = ParseStringSidToSid(StringSid, pSid, &cBytes);
|
|
|
|
if (!bret)
|
|
|
|
LocalFree(*Sid);
|
|
|
|
}
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("returning %s\n", bret ? "TRUE" : "FALSE");
|
|
|
|
return bret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ConvertStringSidToSidA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid)
|
|
|
|
{
|
|
|
|
BOOL bret = FALSE;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("%s, %p\n", debugstr_a(StringSid), Sid);
|
|
|
|
if (GetVersion() & 0x80000000)
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
else if (!StringSid || !Sid)
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
|
2005-03-22 19:26:06 +01:00
|
|
|
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0,
|
2004-09-16 22:27:52 +02:00
|
|
|
len * sizeof(WCHAR));
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, StringSid, -1, wStringSid, len);
|
|
|
|
bret = ConvertStringSidToSidW(wStringSid, Sid);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wStringSid);
|
|
|
|
}
|
|
|
|
TRACE("returning %s\n", bret ? "TRUE" : "FALSE");
|
2003-11-11 23:03:24 +01:00
|
|
|
return bret;
|
|
|
|
}
|
|
|
|
|
2004-08-09 20:47:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* ConvertSidToStringSidW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* format of SID string is:
|
|
|
|
* S-<count>-<auth>-<subauth1>-<subauth2>-<subauth3>...
|
|
|
|
* where
|
|
|
|
* <rev> is the revision of the SID encoded as decimal
|
|
|
|
* <auth> is the identifier authority encoded as hex
|
|
|
|
* <subauthN> is the subauthority id encoded as decimal
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertSidToStringSidW( PSID pSid, LPWSTR *pstr )
|
|
|
|
{
|
|
|
|
DWORD sz, i;
|
|
|
|
LPWSTR str;
|
2004-09-16 22:27:52 +02:00
|
|
|
WCHAR fmt[] = { 'S','-','%','u','-','%','d',0 };
|
2004-08-09 20:47:06 +02:00
|
|
|
WCHAR subauthfmt[] = { '-','%','u',0 };
|
2004-08-14 01:55:43 +02:00
|
|
|
SID* pisid=pSid;
|
2004-08-09 20:47:06 +02:00
|
|
|
|
|
|
|
TRACE("%p %p\n", pSid, pstr );
|
|
|
|
|
|
|
|
if( !IsValidSid( pSid ) )
|
|
|
|
return FALSE;
|
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
if (pisid->Revision != SDDL_REVISION)
|
2004-08-09 20:47:06 +02:00
|
|
|
return FALSE;
|
2004-09-16 22:27:52 +02:00
|
|
|
if (pisid->IdentifierAuthority.Value[0] ||
|
|
|
|
pisid->IdentifierAuthority.Value[1])
|
|
|
|
{
|
|
|
|
FIXME("not matching MS' bugs\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-08-09 20:47:06 +02:00
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
sz = 14 + pisid->SubAuthorityCount * 11;
|
2004-08-09 20:47:06 +02:00
|
|
|
str = LocalAlloc( 0, sz*sizeof(WCHAR) );
|
2004-09-16 22:27:52 +02:00
|
|
|
sprintfW( str, fmt, pisid->Revision, MAKELONG(
|
|
|
|
MAKEWORD( pisid->IdentifierAuthority.Value[5],
|
|
|
|
pisid->IdentifierAuthority.Value[4] ),
|
|
|
|
MAKEWORD( pisid->IdentifierAuthority.Value[3],
|
|
|
|
pisid->IdentifierAuthority.Value[2] ) ) );
|
2004-08-14 01:55:43 +02:00
|
|
|
for( i=0; i<pisid->SubAuthorityCount; i++ )
|
|
|
|
sprintfW( str + strlenW(str), subauthfmt, pisid->SubAuthority[i] );
|
2004-08-09 20:47:06 +02:00
|
|
|
*pstr = str;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ConvertSidToStringSidA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ConvertSidToStringSidA(PSID pSid, LPSTR *pstr)
|
|
|
|
{
|
|
|
|
LPWSTR wstr = NULL;
|
|
|
|
LPSTR str;
|
|
|
|
UINT len;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", pSid, pstr );
|
|
|
|
|
|
|
|
if( !ConvertSidToStringSidW( pSid, &wstr ) )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
len = WideCharToMultiByte( CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL );
|
|
|
|
str = LocalAlloc( 0, len );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, wstr, -1, str, len, NULL, NULL );
|
|
|
|
LocalFree( wstr );
|
|
|
|
|
|
|
|
*pstr = str;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
BOOL WINAPI CreatePrivateObjectSecurity(
|
|
|
|
PSECURITY_DESCRIPTOR ParentDescriptor,
|
|
|
|
PSECURITY_DESCRIPTOR CreatorDescriptor,
|
|
|
|
PSECURITY_DESCRIPTOR* NewDescriptor,
|
|
|
|
BOOL IsDirectoryObject,
|
|
|
|
HANDLE Token,
|
|
|
|
PGENERIC_MAPPING GenericMapping )
|
|
|
|
{
|
|
|
|
FIXME("%p %p %p %d %p %p - stub\n", ParentDescriptor, CreatorDescriptor,
|
|
|
|
NewDescriptor, IsDirectoryObject, Token, GenericMapping);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR* ObjectDescriptor )
|
|
|
|
{
|
|
|
|
FIXME("%p - stub\n", ObjectDescriptor);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI CreateProcessAsUserA(
|
|
|
|
HANDLE hToken,
|
|
|
|
LPCSTR lpApplicationName,
|
|
|
|
LPSTR lpCommandLine,
|
|
|
|
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
|
|
|
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
|
|
|
BOOL bInheritHandles,
|
|
|
|
DWORD dwCreationFlags,
|
|
|
|
LPVOID lpEnvironment,
|
|
|
|
LPCSTR lpCurrentDirectory,
|
|
|
|
LPSTARTUPINFOA lpStartupInfo,
|
|
|
|
LPPROCESS_INFORMATION lpProcessInformation )
|
|
|
|
{
|
|
|
|
FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - stub\n", hToken, debugstr_a(lpApplicationName),
|
|
|
|
debugstr_a(lpCommandLine), lpProcessAttributes, lpThreadAttributes, bInheritHandles,
|
|
|
|
dwCreationFlags, lpEnvironment, debugstr_a(lpCurrentDirectory), lpStartupInfo, lpProcessInformation);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI CreateProcessAsUserW(
|
|
|
|
HANDLE hToken,
|
|
|
|
LPCWSTR lpApplicationName,
|
|
|
|
LPWSTR lpCommandLine,
|
|
|
|
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
|
|
|
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
|
|
|
BOOL bInheritHandles,
|
|
|
|
DWORD dwCreationFlags,
|
|
|
|
LPVOID lpEnvironment,
|
|
|
|
LPCWSTR lpCurrentDirectory,
|
|
|
|
LPSTARTUPINFOW lpStartupInfo,
|
|
|
|
LPPROCESS_INFORMATION lpProcessInformation )
|
|
|
|
{
|
2005-04-13 13:02:59 +02:00
|
|
|
FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - semi- stub\n", hToken,
|
|
|
|
debugstr_w(lpApplicationName), debugstr_w(lpCommandLine), lpProcessAttributes,
|
|
|
|
lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment,
|
|
|
|
debugstr_w(lpCurrentDirectory), lpStartupInfo, lpProcessInformation);
|
|
|
|
|
|
|
|
/* We should create the process with a suspended main thread */
|
|
|
|
if (!CreateProcessW (lpApplicationName,
|
|
|
|
lpCommandLine,
|
|
|
|
lpProcessAttributes,
|
|
|
|
lpThreadAttributes,
|
|
|
|
bInheritHandles,
|
|
|
|
dwCreationFlags, /* CREATE_SUSPENDED */
|
|
|
|
lpEnvironment,
|
|
|
|
lpCurrentDirectory,
|
|
|
|
lpStartupInfo,
|
|
|
|
lpProcessInformation))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
|
2005-04-13 13:02:59 +02:00
|
|
|
return TRUE;
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* ComputeStringSidSize
|
|
|
|
*/
|
|
|
|
static DWORD ComputeStringSidSize(LPCWSTR StringSid)
|
|
|
|
{
|
|
|
|
int ctok = 0;
|
|
|
|
DWORD size = sizeof(SID);
|
|
|
|
|
|
|
|
while (*StringSid)
|
|
|
|
{
|
|
|
|
if (*StringSid == '-')
|
|
|
|
ctok++;
|
|
|
|
StringSid++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctok > 3)
|
|
|
|
size += (ctok - 3) * sizeof(DWORD);
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
BOOL WINAPI DuplicateTokenEx(
|
|
|
|
HANDLE ExistingTokenHandle, DWORD dwDesiredAccess,
|
|
|
|
LPSECURITY_ATTRIBUTES lpTokenAttributes,
|
|
|
|
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
|
|
|
TOKEN_TYPE TokenType,
|
|
|
|
PHANDLE DuplicateTokenHandle )
|
|
|
|
{
|
2005-02-11 12:52:06 +01:00
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
|
|
|
|
TRACE("%p 0x%08lx 0x%08x 0x%08x %p\n", ExistingTokenHandle, dwDesiredAccess,
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
ImpersonationLevel, TokenType, DuplicateTokenHandle);
|
|
|
|
|
2005-02-11 12:52:06 +01:00
|
|
|
InitializeObjectAttributes(
|
|
|
|
&ObjectAttributes,
|
|
|
|
NULL,
|
|
|
|
(lpTokenAttributes && lpTokenAttributes->bInheritHandle) ? OBJ_INHERIT : 0,
|
|
|
|
NULL,
|
|
|
|
lpTokenAttributes ? lpTokenAttributes->lpSecurityDescriptor : NULL );
|
|
|
|
|
|
|
|
return set_ntstatus( NtDuplicateToken( ExistingTokenHandle,
|
|
|
|
dwDesiredAccess,
|
|
|
|
&ObjectAttributes,
|
|
|
|
ImpersonationLevel,
|
|
|
|
TokenType,
|
|
|
|
DuplicateTokenHandle ) );
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI DuplicateToken(
|
|
|
|
HANDLE ExistingTokenHandle,
|
|
|
|
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
|
|
|
PHANDLE DuplicateTokenHandle )
|
|
|
|
{
|
2005-06-15 12:20:17 +02:00
|
|
|
return DuplicateTokenEx( ExistingTokenHandle, TOKEN_IMPERSONATE | TOKEN_QUERY,
|
|
|
|
NULL, ImpersonationLevel, TokenImpersonation,
|
|
|
|
DuplicateTokenHandle );
|
Stub implementations for AdjustTokenGroups, AreAllAccessesGranted,
CreatePrivateObjectSecurity, CreateProcessAsUser{A,W},
DestroyPrivateObjectSecurity, DuplicateToken{,Ex},
EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W},
ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations
for BuildExplicitAccessWithName{A,W},
BuildTrusteeWithObjectsAndName{A,W},
BuildTrusteeWithObjectsAndSid{A,W}.
Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce.
Use the CallWin32ToNt macro only with functions that return an
NTSTATUS.
2004-12-21 17:16:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI EnumDependentServicesA(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSA lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned )
|
|
|
|
{
|
|
|
|
FIXME("%p 0x%08lx %p 0x%08lx %p %p - stub\n", hService, dwServiceState,
|
|
|
|
lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI EnumDependentServicesW(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwServiceState,
|
|
|
|
LPENUM_SERVICE_STATUSW lpServices,
|
|
|
|
DWORD cbBufSize,
|
|
|
|
LPDWORD pcbBytesNeeded,
|
|
|
|
LPDWORD lpServicesReturned )
|
|
|
|
{
|
|
|
|
FIXME("%p 0x%08lx %p 0x%08lx %p %p - stub\n", hService, dwServiceState,
|
|
|
|
lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* ParseStringSidToSid
|
|
|
|
*/
|
|
|
|
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
|
|
|
|
{
|
|
|
|
BOOL bret = FALSE;
|
2004-08-14 01:55:43 +02:00
|
|
|
SID* pisid=pSid;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("%s, %p, %p\n", debugstr_w(StringSid), pSid, cBytes);
|
2003-11-11 23:03:24 +01:00
|
|
|
if (!StringSid)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("StringSid is NULL, returning FALSE\n");
|
2003-11-11 23:03:24 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*cBytes = ComputeStringSidSize(StringSid);
|
2004-08-14 01:55:43 +02:00
|
|
|
if (!pisid) /* Simply compute the size */
|
2004-09-16 22:27:52 +02:00
|
|
|
{
|
|
|
|
TRACE("only size requested, returning TRUE\n");
|
2003-11-11 23:03:24 +01:00
|
|
|
return TRUE;
|
2004-09-16 22:27:52 +02:00
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2005-09-16 20:44:17 +02:00
|
|
|
if (StringSid[0] == 'S' && StringSid[1] == '-') /* S-R-I-S-S */
|
2003-11-11 23:03:24 +01:00
|
|
|
{
|
2004-09-16 22:27:52 +02:00
|
|
|
DWORD i = 0, identAuth;
|
|
|
|
DWORD csubauth = ((*cBytes - sizeof(SID)) / sizeof(DWORD)) + 1;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
StringSid += 2; /* Advance to Revision */
|
2004-08-14 01:55:43 +02:00
|
|
|
pisid->Revision = atoiW(StringSid);
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
if (pisid->Revision != SDDL_REVISION)
|
2004-09-16 22:27:52 +02:00
|
|
|
{
|
|
|
|
TRACE("Revision %d is unknown\n", pisid->Revision);
|
|
|
|
goto lend; /* ERROR_INVALID_SID */
|
|
|
|
}
|
|
|
|
if (csubauth == 0)
|
|
|
|
{
|
|
|
|
TRACE("SubAuthorityCount is 0\n");
|
|
|
|
goto lend; /* ERROR_INVALID_SID */
|
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
pisid->SubAuthorityCount = csubauth;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
2004-09-16 22:27:52 +02:00
|
|
|
/* Advance to identifier authority */
|
2003-11-11 23:03:24 +01:00
|
|
|
while (*StringSid && *StringSid != '-')
|
2004-09-16 22:27:52 +02:00
|
|
|
StringSid++;
|
|
|
|
if (*StringSid == '-')
|
|
|
|
StringSid++;
|
|
|
|
|
|
|
|
/* MS' implementation can't handle values greater than 2^32 - 1, so
|
|
|
|
* we don't either; assume most significant bytes are always 0
|
|
|
|
*/
|
|
|
|
pisid->IdentifierAuthority.Value[0] = 0;
|
|
|
|
pisid->IdentifierAuthority.Value[1] = 0;
|
|
|
|
identAuth = atoiW(StringSid);
|
|
|
|
pisid->IdentifierAuthority.Value[5] = identAuth & 0xff;
|
|
|
|
pisid->IdentifierAuthority.Value[4] = (identAuth & 0xff00) >> 8;
|
|
|
|
pisid->IdentifierAuthority.Value[3] = (identAuth & 0xff0000) >> 16;
|
|
|
|
pisid->IdentifierAuthority.Value[2] = (identAuth & 0xff000000) >> 24;
|
|
|
|
|
|
|
|
/* Advance to first sub authority */
|
|
|
|
while (*StringSid && *StringSid != '-')
|
|
|
|
StringSid++;
|
|
|
|
if (*StringSid == '-')
|
|
|
|
StringSid++;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
while (*StringSid)
|
|
|
|
{
|
|
|
|
while (*StringSid && *StringSid != '-')
|
|
|
|
StringSid++;
|
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
pisid->SubAuthority[i++] = atoiW(StringSid);
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
|
|
|
|
2004-08-14 01:55:43 +02:00
|
|
|
if (i != pisid->SubAuthorityCount)
|
2003-11-11 23:03:24 +01:00
|
|
|
goto lend; /* ERROR_INVALID_SID */
|
|
|
|
|
|
|
|
bret = TRUE;
|
|
|
|
}
|
|
|
|
else /* String constant format - Only available in winxp and above */
|
|
|
|
{
|
2004-08-14 01:55:43 +02:00
|
|
|
pisid->Revision = SDDL_REVISION;
|
|
|
|
pisid->SubAuthorityCount = 1;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2));
|
|
|
|
|
|
|
|
/* TODO: Lookup string of well-known SIDs in table */
|
2004-08-14 01:55:43 +02:00
|
|
|
pisid->IdentifierAuthority.Value[5] = 0;
|
|
|
|
pisid->SubAuthority[0] = 0;
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
bret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lend:
|
|
|
|
if (!bret)
|
|
|
|
SetLastError(ERROR_INVALID_SID);
|
|
|
|
|
2004-09-16 22:27:52 +02:00
|
|
|
TRACE("returning %s\n", bret ? "TRUE" : "FALSE");
|
2003-11-11 23:03:24 +01:00
|
|
|
return bret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetNamedSecurityInfoA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetNamedSecurityInfoA(LPSTR pObjectName,
|
|
|
|
SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo,
|
|
|
|
PSID* ppsidOwner, PSID* ppsidGroup, PACL* ppDacl, PACL* ppSacl,
|
|
|
|
PSECURITY_DESCRIPTOR* ppSecurityDescriptor)
|
|
|
|
{
|
2004-08-06 19:31:17 +02:00
|
|
|
DWORD len;
|
|
|
|
LPWSTR wstr = NULL;
|
|
|
|
DWORD r;
|
|
|
|
|
|
|
|
TRACE("%s %d %ld %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo,
|
2003-11-11 23:03:24 +01:00
|
|
|
ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
|
2004-08-06 19:31:17 +02:00
|
|
|
|
|
|
|
if( pObjectName )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 );
|
|
|
|
wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner,
|
|
|
|
ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor );
|
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, wstr );
|
2004-08-06 19:31:17 +02:00
|
|
|
|
|
|
|
return r;
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetNamedSecurityInfoW [ADVAPI32.@]
|
|
|
|
*/
|
2005-04-11 16:25:41 +02:00
|
|
|
DWORD WINAPI GetNamedSecurityInfoW( LPWSTR name, SE_OBJECT_TYPE type,
|
|
|
|
SECURITY_INFORMATION info, PSID* owner, PSID* group, PACL* dacl,
|
|
|
|
PACL* sacl, PSECURITY_DESCRIPTOR* descriptor )
|
2003-11-11 23:03:24 +01:00
|
|
|
{
|
2005-04-11 16:25:41 +02:00
|
|
|
DWORD needed, offset;
|
|
|
|
SECURITY_DESCRIPTOR_RELATIVE *relative;
|
|
|
|
BYTE *buffer;
|
|
|
|
|
|
|
|
TRACE( "%s %d %ld %p %p %p %p %p\n", debugstr_w(name), type, info, owner,
|
|
|
|
group, dacl, sacl, descriptor );
|
|
|
|
|
|
|
|
if (!name || !descriptor) return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
needed = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
|
|
|
|
if (info & OWNER_SECURITY_INFORMATION)
|
|
|
|
needed += sizeof(sidWorld);
|
|
|
|
if (info & GROUP_SECURITY_INFORMATION)
|
|
|
|
needed += sizeof(sidWorld);
|
|
|
|
if (info & DACL_SECURITY_INFORMATION)
|
|
|
|
needed += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
if (info & SACL_SECURITY_INFORMATION)
|
|
|
|
needed += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
|
|
|
|
/* must be freed by caller */
|
|
|
|
*descriptor = HeapAlloc( GetProcessHeap(), 0, needed );
|
|
|
|
if (!*descriptor) return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
|
|
|
|
if (!InitializeSecurityDescriptor( *descriptor, SECURITY_DESCRIPTOR_REVISION ))
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, *descriptor );
|
|
|
|
return ERROR_INVALID_SECURITY_DESCR;
|
|
|
|
}
|
|
|
|
|
|
|
|
relative = (SECURITY_DESCRIPTOR_RELATIVE *)*descriptor;
|
|
|
|
relative->Control |= SE_SELF_RELATIVE;
|
|
|
|
buffer = (BYTE *)relative;
|
|
|
|
offset = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
|
|
|
|
|
|
|
|
if (owner && (info & OWNER_SECURITY_INFORMATION))
|
|
|
|
{
|
|
|
|
memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) );
|
|
|
|
relative->Owner = offset;
|
|
|
|
*owner = buffer + offset;
|
|
|
|
offset += sizeof(sidWorld);
|
|
|
|
}
|
|
|
|
if (group && (info & GROUP_SECURITY_INFORMATION))
|
|
|
|
{
|
|
|
|
memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) );
|
|
|
|
relative->Group = offset;
|
|
|
|
*group = buffer + offset;
|
|
|
|
offset += sizeof(sidWorld);
|
|
|
|
}
|
|
|
|
if (dacl && (info & DACL_SECURITY_INFORMATION))
|
|
|
|
{
|
|
|
|
GetWorldAccessACL( (PACL)(buffer + offset) );
|
|
|
|
relative->Dacl = offset;
|
|
|
|
*dacl = (PACL)(buffer + offset);
|
|
|
|
offset += WINE_SIZE_OF_WORLD_ACCESS_ACL;
|
|
|
|
}
|
|
|
|
if (sacl && (info & SACL_SECURITY_INFORMATION))
|
|
|
|
{
|
|
|
|
GetWorldAccessACL( (PACL)(buffer + offset) );
|
|
|
|
relative->Sacl = offset;
|
|
|
|
*sacl = (PACL)(buffer + offset);
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
2003-11-11 23:03:24 +01:00
|
|
|
}
|
2004-12-06 17:17:08 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DecryptFileW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DecryptFileW(LPCWSTR lpFileName, DWORD dwReserved)
|
|
|
|
{
|
|
|
|
FIXME("%s %08lx\n", debugstr_w(lpFileName), dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DecryptFileA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DecryptFileA(LPCSTR lpFileName, DWORD dwReserved)
|
|
|
|
{
|
|
|
|
FIXME("%s %08lx\n", debugstr_a(lpFileName), dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EncryptFileW [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI EncryptFileW(LPCWSTR lpFileName)
|
|
|
|
{
|
|
|
|
FIXME("%s\n", debugstr_w(lpFileName));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EncryptFileA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI EncryptFileA(LPCSTR lpFileName)
|
|
|
|
{
|
|
|
|
FIXME("%s\n", debugstr_a(lpFileName));
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-03-07 12:00:24 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SetSecurityInfo [ADVAPI32.@]
|
|
|
|
*/
|
2005-03-21 11:32:45 +01:00
|
|
|
DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
|
2005-03-07 12:00:24 +01:00
|
|
|
SECURITY_INFORMATION SecurityInfo, PSID psidOwner,
|
|
|
|
PSID psidGroup, PACL pDacl, PACL pSacl) {
|
|
|
|
FIXME("stub\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|