From 3426d85319d4a3ea42f04604d9ca4b06225ee667 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Fri, 19 Feb 1999 16:29:05 +0000 Subject: [PATCH] - made the security functions consistent. advapi calls down to ntdll now - new SetSecurityDescriptorGroup, SetSecurityDescriptorOwner, SetSecurityDescriptorSacl, GetSecurityDescriptorDacl - nt-header cleanup --- dlls/advapi32/security.c | 585 +++++++++++--------- dlls/ntdll/nt.c | 55 +- dlls/ntdll/rtl.c | 1121 +++++++++++++++++++++----------------- include/ntddk.h | 171 +++++- include/ntdef.h | 12 + include/ntdll.h | 54 -- include/queue.h | 2 +- include/winbase.h | 5 +- include/winnt.h | 18 + include/winreg.h | 19 +- ole/oleobj.c | 1 - relay32/advapi32.spec | 10 +- 12 files changed, 1188 insertions(+), 865 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index de7b42a3121..9f4d5e9f23e 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -1,5 +1,6 @@ /* * dlls/advapi32/security.c + * FIXME: for all functions thunking down to Rtl* functions: implement SetLastError() */ #include @@ -8,8 +9,17 @@ #include "winerror.h" #include "heap.h" #include "ntdll.h" +#include "ntddk.h" #include "debug.h" +#define CallWin32ToNt(func) \ + { NTSTATUS ret; \ + ret = (func); \ + if (ret !=STATUS_SUCCESS) \ + { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \ + return TRUE; \ + } + /* FIXME: move it to a header */ BOOL32 WINAPI IsValidSid (PSID pSid); BOOL32 WINAPI EqualSid (PSID pSid1, PSID pSid2); @@ -24,6 +34,10 @@ BYTE* WINAPI GetSidSubAuthorityCount(PSID pSid); DWORD WINAPI GetLengthSid(PSID pSid); BOOL32 WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid); +/* ############################## + ###### TOKEN FUNCTIONS ###### + ############################## +*/ /****************************************************************************** * OpenProcessToken [ADVAPI32.109] @@ -40,8 +54,27 @@ BOOL32 WINAPI OpenProcessToken( HANDLE32 ProcessHandle, DWORD DesiredAccess, HANDLE32 *TokenHandle ) { - FIXME(advapi,"(%08x,%08lx,%p): stub\n",ProcessHandle,DesiredAccess, - TokenHandle); + FIXME(advapi,"(%08x,%08lx,%p): stub\n",ProcessHandle,DesiredAccess, TokenHandle); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/****************************************************************************** + * AdjustTokenPrivileges [ADVAPI32.10] + * + * PARAMS + * TokenHandle [] + * DisableAllPrivileges [] + * NewState [] + * BufferLength [] + * PreviousState [] + * ReturnLength [] + */ +BOOL32 WINAPI +AdjustTokenPrivileges( HANDLE32 TokenHandle, BOOL32 DisableAllPrivileges, + LPVOID NewState, DWORD BufferLength, + LPVOID PreviousState, LPDWORD ReturnLength ) +{ FIXME(advapi, "stub\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -65,102 +98,98 @@ OpenThreadToken( HANDLE32 thread, DWORD desiredaccess, BOOL32 openasself, return TRUE; } - /****************************************************************************** - * LookupPrivilegeValue32A [ADVAPI32.92] - */ -BOOL32 WINAPI -LookupPrivilegeValue32A( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid ) -{ - LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName); - LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName); - BOOL32 ret = LookupPrivilegeValue32W( lpSystemNameW, lpNameW, lpLuid); - HeapFree(GetProcessHeap(), 0, lpNameW); - HeapFree(GetProcessHeap(), 0, lpSystemNameW); - return ret; -} - -/****************************************************************************** - * LookupPrivilegeValue32W [ADVAPI32.93] - * Retrieves LUID used on a system to represent the privilege name. - * - * NOTES - * lpLuid should be PLUID + * GetTokenInformation [ADVAPI32.66] * * PARAMS - * lpSystemName [I] Address of string specifying the system - * lpName [I] Address of string specifying the privilege - * lpLuid [I] Address of locally unique identifier + * token [] + * tokeninfoclass [] + * tokeninfo [] + * tokeninfolength [] + * retlen [] * - * RETURNS STD + * FIXME + * tokeninfoclas should be TOKEN_INFORMATION_CLASS */ BOOL32 WINAPI -LookupPrivilegeValue32W( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid ) +GetTokenInformation( HANDLE32 token, DWORD tokeninfoclass, LPVOID tokeninfo, + DWORD tokeninfolength, LPDWORD retlen ) { - FIXME(advapi,"(%s,%s,%p): stub\n",debugstr_w(lpSystemName), - debugstr_w(lpName), lpLuid); + FIXME(advapi,"(%08x,%ld,%p,%ld,%p): stub\n", + token,tokeninfoclass,tokeninfo,tokeninfolength,retlen); + return FALSE; +} + +/* ############################## + ###### SID FUNCTIONS ###### + ############################## +*/ + +/****************************************************************************** + * AllocateAndInitializeSid [ADVAPI32.11] + * + * PARAMS + * pIdentifierAuthority [] + * nSubAuthorityCount [] + * nSubAuthority0 [] + * nSubAuthority1 [] + * nSubAuthority2 [] + * nSubAuthority3 [] + * nSubAuthority4 [] + * nSubAuthority5 [] + * nSubAuthority6 [] + * nSubAuthority7 [] + * pSid [] + */ +BOOL32 WINAPI +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 ) +{ + if (!(*pSid = HeapAlloc( GetProcessHeap(), 0, + GetSidLengthRequired(nSubAuthorityCount)))) + return FALSE; + (*pSid)->Revision = SID_REVISION; + if (pIdentifierAuthority) + memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority, + sizeof (SID_IDENTIFIER_AUTHORITY)); + *GetSidSubAuthorityCount(*pSid) = nSubAuthorityCount; + + if (nSubAuthorityCount > 0) + *GetSidSubAuthority(*pSid, 0) = nSubAuthority0; + if (nSubAuthorityCount > 1) + *GetSidSubAuthority(*pSid, 1) = nSubAuthority1; + if (nSubAuthorityCount > 2) + *GetSidSubAuthority(*pSid, 2) = nSubAuthority2; + if (nSubAuthorityCount > 3) + *GetSidSubAuthority(*pSid, 3) = nSubAuthority3; + if (nSubAuthorityCount > 4) + *GetSidSubAuthority(*pSid, 4) = nSubAuthority4; + if (nSubAuthorityCount > 5) + *GetSidSubAuthority(*pSid, 5) = nSubAuthority5; + if (nSubAuthorityCount > 6) + *GetSidSubAuthority(*pSid, 6) = nSubAuthority6; + if (nSubAuthorityCount > 7) + *GetSidSubAuthority(*pSid, 7) = nSubAuthority7; + return TRUE; } -/****************************************************************************** - * GetFileSecurity32A [ADVAPI32.45] - * - * Obtains Specified information about the security of a file or directory - * The information obtained is constrained by the callers access rights and - * privileges - */ -BOOL32 WINAPI -GetFileSecurity32A( LPCSTR lpFileName, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, LPDWORD lpnLengthNeeded ) -{ - FIXME(advapi, "(%s) : stub\n", debugstr_a(lpFileName)); - return TRUE; -} /****************************************************************************** - * GetFileSecurity32W [ADVAPI32.46] - * - * Obtains Specified information about the security of a file or directory - * The information obtained is constrained by the callers access rights and - * privileges + * FreeSid [ADVAPI32.42] * * PARAMS - * lpFileName [] - * RequestedInformation [] - * pSecurityDescriptor [] - * nLength [] - * lpnLengthNeeded [] + * pSid [] */ -BOOL32 WINAPI -GetFileSecurity32W( LPCWSTR lpFileName, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, LPDWORD lpnLengthNeeded ) +VOID* WINAPI +FreeSid( PSID pSid ) { - FIXME(advapi, "(%s) : stub\n", debugstr_w(lpFileName) ); - return TRUE; -} - - -/****************************************************************************** - * AdjustTokenPrivileges [ADVAPI32.10] - * - * PARAMS - * TokenHandle [] - * DisableAllPrivileges [] - * NewState [] - * BufferLength [] - * PreviousState [] - * ReturnLength [] - */ -BOOL32 WINAPI -AdjustTokenPrivileges( HANDLE32 TokenHandle, BOOL32 DisableAllPrivileges, - LPVOID NewState, DWORD BufferLength, - LPVOID PreviousState, LPDWORD ReturnLength ) -{ FIXME(advapi, "stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + HeapFree( GetProcessHeap(), 0, pSid ); + return NULL; } /****************************************************************************** @@ -252,153 +281,6 @@ GetSidLengthRequired( BYTE nSubAuthorityCount ) return sizeof (SID) + (nSubAuthorityCount - 1) * sizeof (DWORD); } -/****************************************************************************** - * GetTokenInformation [ADVAPI32.66] - * - * PARAMS - * token [] - * tokeninfoclass [] - * tokeninfo [] - * tokeninfolength [] - * retlen [] - * - * FIXME - * tokeninfoclas should be TOKEN_INFORMATION_CLASS - */ -BOOL32 WINAPI -GetTokenInformation( HANDLE32 token, DWORD tokeninfoclass, LPVOID tokeninfo, - DWORD tokeninfolength, LPDWORD retlen ) -{ - FIXME(advapi,"(%08x,%ld,%p,%ld,%p): stub\n", - token,tokeninfoclass,tokeninfo,tokeninfolength,retlen); - return FALSE; -} - -/****************************************************************************** - * AllocateAndInitializeSid [ADVAPI32.11] - * - * PARAMS - * pIdentifierAuthority [] - * nSubAuthorityCount [] - * nSubAuthority0 [] - * nSubAuthority1 [] - * nSubAuthority2 [] - * nSubAuthority3 [] - * nSubAuthority4 [] - * nSubAuthority5 [] - * nSubAuthority6 [] - * nSubAuthority7 [] - * pSid [] - */ -BOOL32 WINAPI -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 ) -{ - if (!(*pSid = HeapAlloc( GetProcessHeap(), 0, - GetSidLengthRequired(nSubAuthorityCount)))) - return FALSE; - (*pSid)->Revision = SID_REVISION; - if (pIdentifierAuthority) - memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority, - sizeof (SID_IDENTIFIER_AUTHORITY)); - *GetSidSubAuthorityCount(*pSid) = nSubAuthorityCount; - - if (nSubAuthorityCount > 0) - *GetSidSubAuthority(*pSid, 0) = nSubAuthority0; - if (nSubAuthorityCount > 1) - *GetSidSubAuthority(*pSid, 1) = nSubAuthority1; - if (nSubAuthorityCount > 2) - *GetSidSubAuthority(*pSid, 2) = nSubAuthority2; - if (nSubAuthorityCount > 3) - *GetSidSubAuthority(*pSid, 3) = nSubAuthority3; - if (nSubAuthorityCount > 4) - *GetSidSubAuthority(*pSid, 4) = nSubAuthority4; - if (nSubAuthorityCount > 5) - *GetSidSubAuthority(*pSid, 5) = nSubAuthority5; - if (nSubAuthorityCount > 6) - *GetSidSubAuthority(*pSid, 6) = nSubAuthority6; - if (nSubAuthorityCount > 7) - *GetSidSubAuthority(*pSid, 7) = nSubAuthority7; - - return TRUE; -} - -/****************************************************************************** - * FreeSid [ADVAPI32.42] - * - * PARAMS - * pSid [] - */ -VOID* WINAPI -FreeSid( PSID pSid ) -{ - HeapFree( GetProcessHeap(), 0, pSid ); - return NULL; -} - -/****************************************************************************** - * InitializeSecurityDescriptor [ADVAPI32.73] - * - * PARAMS - * pDescr [] - * revision [] - */ -BOOL32 WINAPI -InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, - DWORD revision ) -{ - TRACE (security, "(%p,%lx): stub\n", pDescr, revision); - ZeroMemory (pDescr, sizeof (SECURITY_DESCRIPTOR)); - pDescr->Revision = revision; - return TRUE; -} - -/****************************************************************************** - * GetSecurityDescriptorLength [ADVAPI32.55] - */ -DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr) -{ - FIXME(security, "(%p), stub\n", pDescr); - return 0; -} - -/****************************************************************************** - * GetSecurityDescriptorOwner [ADVAPI32.56] - * - * PARAMS - * pOwner [] - * lpbOwnerDefaulted [] - */ -BOOL32 WINAPI -GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner, - LPBOOL32 lpbOwnerDefaulted ) -{ - FIXME(security, "(%p,%p,%p), stub\n", pDescr,pOwner,lpbOwnerDefaulted); - *lpbOwnerDefaulted = TRUE; - return 0; -} - -/****************************************************************************** - * GetSecurityDescriptorGroup [ADVAPI32.54] - * - * PARAMS - * pGroup [] - * lpbOwnerDefaulted [] - */ -BOOL32 WINAPI -GetSecurityDescriptorGroup( SECURITY_DESCRIPTOR *pDescr, PSID *pGroup, - LPBOOL32 lpbOwnerDefaulted ) -{ - FIXME(security, "(%p,%p,%p), stub\n", pDescr,pGroup,lpbOwnerDefaulted); - *lpbOwnerDefaulted = TRUE; - return 0; -} - /****************************************************************************** * InitializeSid [ADVAPI32.74] * @@ -472,6 +354,75 @@ GetLengthSid (PSID pSid) return GetSidLengthRequired( * GetSidSubAuthorityCount(pSid) ); } +/* ############################################## + ###### SECURITY DESCRIPTOR FUNCTIONS ###### + ############################################## +*/ + +/****************************************************************************** + * InitializeSecurityDescriptor [ADVAPI32.73] + * + * PARAMS + * pDescr [] + * revision [] + */ +BOOL32 WINAPI +InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision ) +{ + CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision )); +} + +/****************************************************************************** + * GetSecurityDescriptorLength [ADVAPI32.55] + */ +DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr) +{ + return (RtlLengthSecurityDescriptor(pDescr)); +} + +/****************************************************************************** + * GetSecurityDescriptorOwner [ADVAPI32.56] + * + * PARAMS + * pOwner [] + * lpbOwnerDefaulted [] + */ +BOOL32 WINAPI +GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner, + LPBOOL32 lpbOwnerDefaulted ) +{ + CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted )); +} + +/****************************************************************************** + * SetSecurityDescriptorOwner [ADVAPI32] + * + * PARAMS + */ +BOOL32 SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID pOwner, BOOL32 bOwnerDefaulted) +{ + CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted)); +} +/****************************************************************************** + * GetSecurityDescriptorGroup [ADVAPI32.54] + */ +BOOL32 WINAPI GetSecurityDescriptorGroup( + PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID *Group, + LPBOOL32 GroupDefaulted) +{ + CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted)); +} +/****************************************************************************** + * SetSecurityDescriptorGroup + */ +BOOL32 WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID Group, BOOL32 GroupDefaulted) +{ + CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted)); +} + /****************************************************************************** * IsValidSecurityDescriptor [ADVAPI32.79] * @@ -479,12 +430,153 @@ GetLengthSid (PSID pSid) * lpsecdesc [] */ BOOL32 WINAPI -IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR lpsecdesc ) +IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor ) { - FIXME(advapi,"(%p):stub\n",lpsecdesc); + CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor)); +} + +/****************************************************************************** + * GetSecurityDescriptorDacl [ADVAPI.91] + */ +BOOL32 WINAPI GetSecurityDescriptorDacl( + IN PSECURITY_DESCRIPTOR pSecurityDescriptor, + OUT LPBOOL32 lpbDaclPresent, + OUT PACL *pDacl, + OUT LPBOOL32 lpbDaclDefaulted) +{ + CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent, + pDacl, (PBOOLEAN)lpbDaclDefaulted)); +} + +/****************************************************************************** + * SetSecurityDescriptorDacl [ADVAPI.224] + */ +BOOL32 WINAPI +SetSecurityDescriptorDacl ( PSECURITY_DESCRIPTOR lpsd, BOOL32 daclpresent, + PACL dacl, BOOL32 dacldefaulted ) +{ + CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted )); +} +/************************************************************************** + * SetSecurityDescriptorSacl [NTDLL.488] + */ +BOOL32 WINAPI SetSecurityDescriptorSacl ( + PSECURITY_DESCRIPTOR lpsd, + BOOL32 saclpresent, + PACL sacl, + BOOL32 sacldefaulted) +{ + CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, sacl, sacldefaulted)); +} +/****************************************************************************** + * MakeSelfRelativeSD [ADVAPI32.95] + * + * PARAMS + * lpabssecdesc [] + * lpselfsecdesc [] + * lpbuflen [] + */ +BOOL32 WINAPI +MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc, + PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen ) +{ + FIXME(advapi,"(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen); return TRUE; } +/****************************************************************************** + * GetSecurityDescriptorControl32 [ADVAPI32] + */ + +BOOL32 GetSecurityDescriptorControl32 ( PSECURITY_DESCRIPTOR pSecurityDescriptor, + /* fixme: PSECURITY_DESCRIPTOR_CONTROL*/ LPVOID pControl, LPDWORD lpdwRevision) +{ FIXME(advapi,"(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision); + return 1; +} + +/* ############################## + ###### MISC FUNCTIONS ###### + ############################## +*/ + +/****************************************************************************** + * LookupPrivilegeValue32W [ADVAPI32.93] + * Retrieves LUID used on a system to represent the privilege name. + * + * NOTES + * lpLuid should be PLUID + * + * PARAMS + * lpSystemName [I] Address of string specifying the system + * lpName [I] Address of string specifying the privilege + * lpLuid [I] Address of locally unique identifier + * + * RETURNS STD + */ +BOOL32 WINAPI +LookupPrivilegeValue32W( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid ) +{ + FIXME(advapi,"(%s,%s,%p): stub\n",debugstr_w(lpSystemName), + debugstr_w(lpName), lpLuid); + return TRUE; +} + +/****************************************************************************** + * LookupPrivilegeValue32A [ADVAPI32.92] + */ +BOOL32 WINAPI +LookupPrivilegeValue32A( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid ) +{ + LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName); + LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName); + BOOL32 ret = LookupPrivilegeValue32W( lpSystemNameW, lpNameW, lpLuid); + HeapFree(GetProcessHeap(), 0, lpNameW); + HeapFree(GetProcessHeap(), 0, lpSystemNameW); + return ret; +} + +/****************************************************************************** + * GetFileSecurity32A [ADVAPI32.45] + * + * Obtains Specified information about the security of a file or directory + * The information obtained is constrained by the callers access rights and + * privileges + */ +BOOL32 WINAPI +GetFileSecurity32A( LPCSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, LPDWORD lpnLengthNeeded ) +{ + FIXME(advapi, "(%s) : stub\n", debugstr_a(lpFileName)); + return TRUE; +} + +/****************************************************************************** + * GetFileSecurity32W [ADVAPI32.46] + * + * Obtains Specified information about the security of a file or directory + * The information obtained is constrained by the callers access rights and + * privileges + * + * PARAMS + * lpFileName [] + * RequestedInformation [] + * pSecurityDescriptor [] + * nLength [] + * lpnLengthNeeded [] + */ +BOOL32 WINAPI +GetFileSecurity32W( LPCWSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, LPDWORD lpnLengthNeeded ) +{ + FIXME(advapi, "(%s) : stub\n", debugstr_w(lpFileName) ); + return TRUE; +} + + /****************************************************************************** * LookupAccountSid32A [ADVAPI32.86] */ @@ -552,22 +644,6 @@ SetFileSecurity32W( LPCWSTR lpFileName, return TRUE; } -/****************************************************************************** - * MakeSelfRelativeSD [ADVAPI32.95] - * - * PARAMS - * lpabssecdesc [] - * lpselfsecdesc [] - * lpbuflen [] - */ -BOOL32 WINAPI -MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc, - PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen ) -{ - FIXME(advapi,"(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen); - return TRUE; -} - /****************************************************************************** * QueryWindows31FilesMigration [ADVAPI32.266] * @@ -627,16 +703,6 @@ NotifyBootConfigStatus( DWORD x1 ) return 1; } -/****************************************************************************** - * GetSecurityDescriptorControl32 [ADVAPI32] - */ - -BOOL32 GetSecurityDescriptorControl32 ( PSECURITY_DESCRIPTOR pSecurityDescriptor, - /* fixme: PSECURITY_DESCRIPTOR_CONTROL*/ LPVOID pControl, LPDWORD lpdwRevision) -{ FIXME(advapi,"(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision); - return 1; -} - /****************************************************************************** * RevertToSelf [ADVAPI32.180] * @@ -660,6 +726,9 @@ ImpersonateSelf32(DWORD/*SECURITY_IMPERSONATION_LEVEL*/ ImpersonationLevel) return TRUE; } +/****************************************************************************** + * AccessCheck32 [ADVAPI32.71] + */ BOOL32 WINAPI AccessCheck32(PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE32 ClientToken, DWORD DesiredAccess, LPVOID/*LPGENERIC_MAPPING*/ GenericMapping, LPVOID/*LPPRIVILEGE_SET*/ PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL32 AccessStatus) { diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 259048063e6..005c2917873 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -44,7 +44,8 @@ NTSTATUS WINAPI NtOpenFile( ULONG OpenOptions) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx) stub\n", - FileHandle, DesiredAccess, ObjectAttributes, debugstr_w(ObjectAttributes->ObjectName->Buffer), + FileHandle, DesiredAccess, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, IoStatusBlock, ShareAccess, OpenOptions); return 0; } @@ -81,7 +82,8 @@ NTSTATUS WINAPI NtCreateFile( ULONG EaLength) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n", - FileHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer), + FileHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, IoStatusBlock,AllocateSize,FileAttributes, ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength); return 0; @@ -96,7 +98,8 @@ NTSTATUS WINAPI NtCreateTimer( IN TIMER_TYPE TimerType) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),0x%08x) stub\n", - TimerHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer), + TimerHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, TimerType); return 0; } @@ -108,11 +111,11 @@ NTSTATUS WINAPI NtSetTimer( IN PLARGE_INTEGER DueTime, IN PTIMERAPCROUTINE TimerApcRoutine, IN PVOID TimerContext, - IN BOOL WakeTimer, + IN BOOLEAN WakeTimer, IN ULONG Period OPTIONAL, OUT PBOOLEAN PreviousState OPTIONAL) { - FIXME(ntdll,"(0x%08x,%p,%p,%p,%08lx,0x%08lx,%p) stub\n", + FIXME(ntdll,"(0x%08x,%p,%p,%p,%08x,0x%08lx,%p) stub\n", TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState); return 0; } @@ -128,7 +131,8 @@ NTSTATUS WINAPI NtCreateEvent( IN BOOLEAN InitialState) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),%08x,%08x): empty stub\n", - EventHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer), + EventHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, ManualReset,InitialState); return 0; } @@ -168,7 +172,8 @@ NTSTATUS WINAPI NtOpenDirectoryObject( POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(%p,0x%08lx,%p(%s)): stub\n", - DirectoryHandle, DesiredAccess, ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + DirectoryHandle, DesiredAccess, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } @@ -393,7 +398,7 @@ NTSTATUS WINAPI NtDuplicateToken( */ NTSTATUS WINAPI NtAdjustPrivilegesToken( IN HANDLE32 TokenHandle, - IN BOOL32 DisableAllPrivileges, + IN BOOLEAN DisableAllPrivileges, IN PTOKEN_PRIVILEGES NewState, IN DWORD BufferLength, OUT PTOKEN_PRIVILEGES PreviousState, @@ -509,7 +514,8 @@ NTSTATUS WINAPI NtOpenEvent( IN POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n", - EventHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + EventHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } @@ -529,7 +535,8 @@ NTSTATUS WINAPI NtWaitForSingleObject( * NtConnectPort [NTDLL] */ NTSTATUS WINAPI NtConnectPort(DWORD x1,PUNICODE_STRING uni,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8) { - FIXME(ntdll,"(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8); + FIXME(ntdll,"(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n", + x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8); return 0; } @@ -558,7 +565,8 @@ NTSTATUS WINAPI NtCreateDirectoryObject( POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n", - DirectoryHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + DirectoryHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } @@ -651,7 +659,8 @@ NTSTATUS WINAPI NtCreateSection( IN HANDLE32 FileHandle OPTIONAL) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx,0x%08x) stub\n", - SectionHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer), + SectionHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle); return 0; } @@ -707,10 +716,9 @@ NTSTATUS WINAPI NtTerminateThread( IN HANDLE32 ThreadHandle, IN NTSTATUS ExitStatus) { - BOOL32 ret = TerminateThread(ThreadHandle,ExitStatus); + if ( TerminateThread(ThreadHandle,ExitStatus) ) + return 0; - if (ret) - return 0; return 0xc0000000; /* FIXME: lasterror->ntstatus */ } @@ -731,13 +739,14 @@ NTSTATUS WINAPI NtOpenSection( POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n", - SectionHandle,DesiredAccess,ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + SectionHandle,DesiredAccess,ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } /****************************************************************************** * NtQueryPerformanceCounter [NTDLL] */ -BOOL32 WINAPI NtQueryPerformanceCounter( +NTSTATUS WINAPI NtQueryPerformanceCounter( IN PLARGE_INTEGER Counter, IN PLARGE_INTEGER Frequency) { @@ -778,7 +787,8 @@ NTSTATUS WINAPI NtCreateSemaphore( IN ULONG MaximumCount) { FIXME(ntdll,"(%p,0x%08lx,%p(%s),0x%08lx,0x%08lx) stub!\n", - SemaphoreHandle, DesiredAccess, ObjectAttributes, debugstr_w(ObjectAttributes->ObjectName->Buffer), + SemaphoreHandle, DesiredAccess, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, InitialCount, MaximumCount); return 0; } @@ -791,7 +801,8 @@ NTSTATUS WINAPI NtOpenSemaphore( IN POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(0x%08x,0x%08lx,%p(%s)) stub!\n", - SemaphoreHandle, DesiredAcces, ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + SemaphoreHandle, DesiredAcces, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } @@ -832,7 +843,8 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObject( IN PUNICODE_STRING Name) { FIXME(ntdll,"(%p,0x%08lx,%p(%s), %p) stub\n", - SymbolicLinkHandle, DesiredAccess, ObjectAttributes, debugstr_w(ObjectAttributes->ObjectName->Buffer), Name); + SymbolicLinkHandle, DesiredAccess, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL, Name); return 0; } @@ -845,7 +857,8 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject( IN POBJECT_ATTRIBUTES ObjectAttributes) { FIXME(ntdll,"(%p,0x%08lx,%p(%s)) stub\n", - LinkHandle, DesiredAccess, ObjectAttributes,debugstr_w(ObjectAttributes->ObjectName->Buffer)); + LinkHandle, DesiredAccess, ObjectAttributes, + ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL); return 0; } /****************************************************************************** diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 517faf7d355..b58e51ef972 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -17,18 +17,53 @@ #include "winuser.h" #include "wine/winestring.h" #include "file.h" -#include "stackframe.h" -#include "winnls.h" -#include "ntdll.h" -#include "debugstr.h" #include "heap.h" +#include "winnls.h" +#include "debugstr.h" +#include "debug.h" +#include "winuser.h" +#include "winerror.h" +#include "stackframe.h" + +#include "ntdll.h" #include "ntdef.h" #include "winreg.h" -#include "debug.h" -/* fixme: move to windef.h*/ -typedef BOOL32 *LPBOOL; +/* ############################## + ###### SID FUNCTIONS ###### + ############################## +*/ +/****************************************************************************** + * RtlAllocateAndInitializeSid [NTDLL.265] + * + */ +BOOLEAN WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, + DWORD nSubAuthorityCount,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, PSID pSid) +{ + FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n", + pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid); + return 0; +} +/****************************************************************************** + * RtlEqualSid [NTDLL.352] + * + */ +DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2) +{ + FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2); + return TRUE; +} + +/****************************************************************************** + * RtlFreeSid [NTDLL.376] + */ +DWORD WINAPI RtlFreeSid(DWORD x1) +{ + FIXME(ntdll,"(0x%08lx),stub!\n", x1); + return TRUE; +} + /************************************************************************** * RtlLengthRequiredSid [NTDLL.427] */ @@ -41,12 +76,293 @@ DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths) * RtlLengthSid [NTDLL.429] */ DWORD WINAPI RtlLengthSid(PSID sid) -{ TRACE(ntdll,"sid=%p\n",sid); +{ + TRACE(ntdll,"sid=%p\n",sid); if (!sid) return FALSE; return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID); } +/************************************************************************** + * RtlInitializeSid [NTDLL.410] + */ +DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth, + DWORD c) +{ + BYTE a = c&0xff; + + if (a>=SID_MAX_SUB_AUTHORITIES) + return a; + PSID->SubAuthorityCount = a; + PSID->Revision = SID_REVISION; + memcpy(&(PSID->IdentifierAuthority),PSIDauth,sizeof(SID_IDENTIFIER_AUTHORITY)); + return STATUS_SUCCESS; +} + +/************************************************************************** + * RtlSubAuthoritySid [NTDLL.497] + */ +LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr) +{ + return &(PSID->SubAuthority[nr]); +} + +/************************************************************************** + * RtlSubAuthorityCountSid [NTDLL.496] + */ + +LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID) +{ + return ((LPBYTE)PSID)+1; +} + +/************************************************************************** + * RtlCopySid [NTDLL.302] + */ +DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from) +{ if (!from) + return 0; + if (len<(from->SubAuthorityCount*4+8)) + return STATUS_BUFFER_TOO_SMALL; + memmove(to,from,from->SubAuthorityCount*4+8); + return STATUS_SUCCESS; +} + +/* ############################################## + ###### SECURITY DESCRIPTOR FUNCTIONS ###### + ############################################## +*/ +/************************************************************************** + * RtlCreateSecurityDescriptor [NTDLL.313] + * + * RETURNS: + * 0 success, + * STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE, + * STATUS_NO_MEMORY + */ +NTSTATUS WINAPI RtlCreateSecurityDescriptor( + PSECURITY_DESCRIPTOR lpsd, + DWORD rev) +{ + if (rev!=SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION; + memset(lpsd,'\0',sizeof(*lpsd)); + lpsd->Revision = SECURITY_DESCRIPTOR_REVISION; + return STATUS_SUCCESS; +} +/************************************************************************** + * RtlValidSecurityDescriptor [NTDLL.313] + * + */ +NTSTATUS WINAPI RtlValidSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor) +{ + if ( ! SecurityDescriptor ) + return STATUS_INVALID_SECURITY_DESCR; + if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION ) + return STATUS_UNKNOWN_REVISION; + + return STATUS_SUCCESS; +} + +/****************************************************************************** + * RtlGetDaclSecurityDescriptor [NTDLL] + * + */ +DWORD WINAPI RtlGetDaclSecurityDescriptor( + IN PSECURITY_DESCRIPTOR pSecurityDescriptor, + OUT PBOOLEAN lpbDaclPresent, + OUT PACL *pDacl, + OUT PBOOLEAN lpbDaclDefaulted) +{ + TRACE(ntdll,"(%p,%p,%p,%p)\n", + pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted); + + if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION ; + + if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) ) + { + if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control) + { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl); + } + else + { *pDacl = pSecurityDescriptor->Dacl; + } + } + + *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0); + + return STATUS_SUCCESS; +} + +/************************************************************************** + * RtlSetDaclSecurityDescriptor [NTDLL.483] + */ +NTSTATUS WINAPI RtlSetDaclSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + BOOLEAN daclpresent, + PACL dacl, + BOOLEAN dacldefaulted ) +{ + if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION; + if (lpsd->Control & SE_SELF_RELATIVE) + return STATUS_INVALID_SECURITY_DESCR; + + if (!daclpresent) + { lpsd->Control &= ~SE_DACL_PRESENT; + return TRUE; + } + + lpsd->Control |= SE_DACL_PRESENT; + lpsd->Dacl = dacl; + + if (dacldefaulted) + lpsd->Control |= SE_DACL_DEFAULTED; + else + lpsd->Control &= ~SE_DACL_DEFAULTED; + + return STATUS_SUCCESS; +} +/************************************************************************** + * RtlLengthSecurityDescriptor [NTDLL] + */ +ULONG WINAPI RtlLengthSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor) +{ + ULONG Size; + Size = SECURITY_DESCRIPTOR_MIN_LENGTH; + if ( SecurityDescriptor == NULL ) + return 0; + + if ( SecurityDescriptor->Owner != NULL ) + Size += SecurityDescriptor->Owner->SubAuthorityCount; + if ( SecurityDescriptor->Group != NULL ) + Size += SecurityDescriptor->Group->SubAuthorityCount; + + + if ( SecurityDescriptor->Sacl != NULL ) + Size += SecurityDescriptor->Sacl->AclSize; + if ( SecurityDescriptor->Dacl != NULL ) + Size += SecurityDescriptor->Dacl->AclSize; + + return Size; +} +/************************************************************************** + * RtlSetSaclSecurityDescriptor [NTDLL.488] + */ +DWORD WINAPI RtlSetSaclSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + BOOLEAN saclpresent, + PACL sacl, + BOOLEAN sacldefaulted) +{ + if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION; + if (lpsd->Control & SE_SELF_RELATIVE) + return STATUS_INVALID_SECURITY_DESCR; + if (!saclpresent) { + lpsd->Control &= ~SE_SACL_PRESENT; + return 0; + } + lpsd->Control |= SE_SACL_PRESENT; + lpsd->Sacl = sacl; + if (sacldefaulted) + lpsd->Control |= SE_SACL_DEFAULTED; + else + lpsd->Control &= ~SE_SACL_DEFAULTED; + return STATUS_SUCCESS; +} + +/************************************************************************** + * RtlGetOwnerSecurityDescriptor [NTDLL.488] + */ +NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID *Owner, + PBOOLEAN OwnerDefaulted) +{ + if ( !SecurityDescriptor || !Owner || !OwnerDefaulted ) + return STATUS_INVALID_PARAMETER; + + *Owner = SecurityDescriptor->Owner; + if ( *Owner != NULL ) { + if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED ) + *OwnerDefaulted = TRUE; + else + *OwnerDefaulted = FALSE; + } + return STATUS_SUCCESS; +} + +/************************************************************************** + * RtlSetOwnerSecurityDescriptor [NTDLL.487] + */ +NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor( + PSECURITY_DESCRIPTOR lpsd, + PSID owner, + BOOLEAN ownerdefaulted) +{ + if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION; + if (lpsd->Control & SE_SELF_RELATIVE) + return STATUS_INVALID_SECURITY_DESCR; + + lpsd->Owner = owner; + if (ownerdefaulted) + lpsd->Control |= SE_OWNER_DEFAULTED; + else + lpsd->Control &= ~SE_OWNER_DEFAULTED; + return STATUS_SUCCESS; +} + +/************************************************************************** + * RtlSetGroupSecurityDescriptor [NTDLL.485] + */ +NTSTATUS WINAPI RtlSetGroupSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + PSID group, + BOOLEAN groupdefaulted) +{ + if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) + return STATUS_UNKNOWN_REVISION; + if (lpsd->Control & SE_SELF_RELATIVE) + return STATUS_INVALID_SECURITY_DESCR; + + lpsd->Group = group; + if (groupdefaulted) + lpsd->Control |= SE_GROUP_DEFAULTED; + else + lpsd->Control &= ~SE_GROUP_DEFAULTED; + return STATUS_SUCCESS; +} +/************************************************************************** + * RtlGetGroupSecurityDescriptor [NTDLL] + */ +NTSTATUS WINAPI RtlGetGroupSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID *Group, + PBOOLEAN GroupDefaulted) +{ + if ( !SecurityDescriptor || !Group || !GroupDefaulted ) + return STATUS_INVALID_PARAMETER; + + *Group = SecurityDescriptor->Group; + if ( *Group != NULL ) { + if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED ) + *GroupDefaulted = TRUE; + else + *GroupDefaulted = FALSE; + } + return STATUS_SUCCESS; +} + +/* ############################## + ###### ACL FUNCTIONS ###### + ############################## +*/ + /************************************************************************** * RtlCreateAcl [NTDLL.306] * @@ -74,7 +390,7 @@ DWORD WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev) * looks for the AceCount+1 ACE, and if it is still within the alloced * ACL, return a pointer to it */ -BOOL32 WINAPI RtlFirstFreeAce( +BOOLEAN WINAPI RtlFirstFreeAce( PACL acl, LPACE_HEADER *x) { @@ -123,179 +439,32 @@ NTSTATUS WINAPI RtlAddAce( return STATUS_SUCCESS; } -/************************************************************************** - * RtlCreateSecurityDescriptor [NTDLL.313] - * - * RETURNS: - * 0 success, - * STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE, - * STATUS_NO_MEMORY +/****************************************************************************** + * RtlAddAccessAllowedAce [NTDLL] */ -NTSTATUS WINAPI RtlCreateSecurityDescriptor( - PSECURITY_DESCRIPTOR lpsd, - DWORD rev) -{ - if (rev!=SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION; - memset(lpsd,'\0',sizeof(*lpsd)); - lpsd->Revision = SECURITY_DESCRIPTOR_REVISION; - return STATUS_SUCCESS; +DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { + FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); + return 0; } -/************************************************************************** - * RtlSetDaclSecurityDescriptor [NTDLL.483] +/****************************************************************************** + * RtlGetAce [NTDLL] */ -NTSTATUS WINAPI RtlSetDaclSecurityDescriptor ( - PSECURITY_DESCRIPTOR lpsd, - BOOL32 daclpresent, - PACL dacl, - BOOL32 dacldefaulted ) -{ - if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION; - if (lpsd->Control & SE_SELF_RELATIVE) - return STATUS_INVALID_SECURITY_DESCR; - if (!daclpresent) - { lpsd->Control &= ~SE_DACL_PRESENT; - return TRUE; - } - lpsd->Control |= SE_DACL_PRESENT; - lpsd->Dacl = dacl; - if (dacldefaulted) - lpsd->Control |= SE_DACL_DEFAULTED; - else - lpsd->Control &= ~SE_DACL_DEFAULTED; - - return STATUS_SUCCESS; +DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) { + FIXME(ntdll,"(%p,%ld,%p),stub!\n",pAcl,dwAceIndex,pAce); + return 0; } -/************************************************************************** - * RtlSetSaclSecurityDescriptor [NTDLL.488] - */ -DWORD WINAPI RtlSetSaclSecurityDescriptor ( - PSECURITY_DESCRIPTOR lpsd, - BOOL32 saclpresent, - PACL sacl, - BOOL32 sacldefaulted) -{ - if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION; - if (lpsd->Control & SE_SELF_RELATIVE) - return STATUS_INVALID_SECURITY_DESCR; - if (!saclpresent) { - lpsd->Control &= ~SE_SACL_PRESENT; - return 0; - } - lpsd->Control |= SE_SACL_PRESENT; - lpsd->Sacl = sacl; - if (sacldefaulted) - lpsd->Control |= SE_SACL_DEFAULTED; - else - lpsd->Control &= ~SE_SACL_DEFAULTED; - return STATUS_SUCCESS; -} - -/************************************************************************** - * RtlSetOwnerSecurityDescriptor [NTDLL.487] - */ -NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor( - PSECURITY_DESCRIPTOR lpsd, - PSID owner, - BOOL32 ownerdefaulted) -{ - if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION; - if (lpsd->Control & SE_SELF_RELATIVE) - return STATUS_INVALID_SECURITY_DESCR; - - lpsd->Owner = owner; - if (ownerdefaulted) - lpsd->Control |= SE_OWNER_DEFAULTED; - else - lpsd->Control &= ~SE_OWNER_DEFAULTED; - return STATUS_SUCCESS; -} - -/************************************************************************** - * RtlSetGroupSecurityDescriptor [NTDLL.485] - */ -NTSTATUS WINAPI RtlSetGroupSecurityDescriptor ( - PSECURITY_DESCRIPTOR lpsd, - PSID group, - BOOL32 groupdefaulted) -{ - if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION; - if (lpsd->Control & SE_SELF_RELATIVE) - return STATUS_INVALID_SECURITY_DESCR; - - lpsd->Group = group; - if (groupdefaulted) - lpsd->Control |= SE_GROUP_DEFAULTED; - else - lpsd->Control &= ~SE_GROUP_DEFAULTED; - return STATUS_SUCCESS; -} - - -/************************************************************************** - * RtlNormalizeProcessParams [NTDLL.441] - */ -LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x) -{ - FIXME(ntdll,"(%p), stub\n",x); - return x; -} - -/************************************************************************** - * RtlInitializeSid [NTDLL.410] - */ -DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth, - DWORD c) -{ - BYTE a = c&0xff; - - if (a>=SID_MAX_SUB_AUTHORITIES) - return a; - PSID->SubAuthorityCount = a; - PSID->Revision = SID_REVISION; - memcpy(&(PSID->IdentifierAuthority),PSIDauth,sizeof(SID_IDENTIFIER_AUTHORITY)); - return STATUS_SUCCESS; -} - -/************************************************************************** - * RtlSubAuthoritySid [NTDLL.497] - */ -LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr) -{ - return &(PSID->SubAuthority[nr]); -} - -/************************************************************************** - * RtlSubAuthorityCountSid [NTDLL.496] - */ -LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID) -{ - return ((LPBYTE)PSID)+1; -} - -/************************************************************************** - * RtlCopySid [NTDLL.302] - */ -DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from) -{ if (!from) - return 0; - if (len<(from->SubAuthorityCount*4+8)) - return STATUS_BUFFER_TOO_SMALL; - memmove(to,from,from->SubAuthorityCount*4+8); - return STATUS_SUCCESS; -} +/* ###################################### + ###### STRING FUNCTIONS ###### + ###################################### +*/ /************************************************************************** * RtlAnsiStringToUnicodeString [NTDLL.269] */ DWORD /* NTSTATUS */ -WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOL32 doalloc) +WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOLEAN doalloc) { DWORD unilen = (ansi->Length+1)*sizeof(WCHAR); @@ -318,7 +487,7 @@ WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOL32 * RtlOemStringToUnicodeString [NTDLL.447] */ DWORD /* NTSTATUS */ -WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOL32 doalloc) +WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOLEAN doalloc) { DWORD unilen = (ansi->Length+1)*sizeof(WCHAR); @@ -455,7 +624,7 @@ WINAPI RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,D * RtlUnicodeStringToOemString [NTDLL.511] */ DWORD /* NTSTATUS */ -WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOL32 alloc) +WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc) { if (alloc) { oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1; @@ -470,7 +639,7 @@ WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOL32 a * RtlUnicodeStringToAnsiString [NTDLL.507] */ DWORD /* NTSTATUS */ -WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOL32 alloc) +WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc) { if (alloc) { oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1; @@ -492,29 +661,10 @@ DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x return !lstrncmp32W(s1->Buffer,s2->Buffer,s1->Length/2); } -/************************************************************************** - * RtlNtStatusToDosErro [NTDLL.442] - */ -DWORD WINAPI RtlNtStatusToDosError(DWORD error) -{ - FIXME(ntdll, "(%lx): map STATUS_ to ERROR_\n",error); - return error; -} - -/************************************************************************** - * RtlGetNtProductType [NTDLL.390] - */ -BOOL32 WINAPI RtlGetNtProductType(LPDWORD type) -{ - FIXME(ntdll, "(%p): stub\n", type); - *type=3; /* dunno. 1 for client, 3 for server? */ - return 1; -} - /************************************************************************** * RtlUpcaseUnicodeString [NTDLL.520] */ -DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOL32 doalloc) +DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOLEAN doalloc) { LPWSTR s,t; DWORD i,len; @@ -595,294 +745,7 @@ out: return len; } -/************************************************************************** - * RtlDosPathNameToNtPathName_U [NTDLL.338] - * - * FIXME: convert to UNC or whatever is expected here - */ -BOOL32 WINAPI RtlDosPathNameToNtPathName_U( - LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3) -{ - LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from); - FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3); - if (us) - RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from)); - return TRUE; -} - -/************************************************************************** - * NTDLL_chkstk [NTDLL.862] - * NTDLL_alloca_probe [NTDLL.861] - * Glorified "enter xxxx". - */ -REGS_ENTRYPOINT(NTDLL_chkstk) -{ - ESP_reg(context) -= EAX_reg(context); -} -REGS_ENTRYPOINT(NTDLL_alloca_probe) -{ - ESP_reg(context) -= EAX_reg(context); -} - -/****************************************************************************** - * RtlTimeToElapsedTimeFields [NTDLL.502] - */ -DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 ) -{ - FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2); - return 0; -} - - -/****************************************************************************** - * RtlExtendedLargeIntegerDivide [NTDLL.359] - */ -INT32 WINAPI RtlExtendedLargeIntegerDivide( - LARGE_INTEGER dividend, - DWORD divisor, - LPDWORD rest -) { -#if SIZEOF_LONG_LONG==8 - long long x1 = *(long long*)÷nd; - - if (*rest) - *rest = x1 % divisor; - return x1/divisor; -#else - FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest); - return 0; -#endif -} - -/****************************************************************************** - * RtlExtendedLargeIntegerMultiply [NTDLL.359] - * Note: This even works, since gcc returns 64bit values in eax/edx just like - * the caller expects. However... The relay code won't grok this I think. - */ -long long /*LARGE_INTEGER*/ -WINAPI RtlExtendedIntegerMultiply( - LARGE_INTEGER factor1,INT32 factor2 -) { -#if SIZEOF_LONG_LONG==8 - return (*(long long*)&factor1)*factor2; -#else - FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2); - return 0; -#endif -} - -/****************************************************************************** - * RtlFormatCurrentUserKeyPath [NTDLL.371] - */ -DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x) -{ - FIXME(ntdll,"(0x%08lx): stub\n",x); - return 1; -} - -/****************************************************************************** - * RtlOpenCurrentUser [NTDLL] - */ -DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2) -{ -/* Note: this is not the correct solution, - * But this works pretty good on wine and NT4.0 binaries - */ - if ( x1 == 0x2000000 ) { - *x2 = HKEY_CURRENT_USER; - return TRUE; - } - - return FALSE; -} -/****************************************************************************** - * RtlAllocateAndInitializeSid [NTDLL.265] - * - */ -BOOL32 WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,DWORD nSubAuthorityCount, - DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, PSID pSid) -{ FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n", - pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid); - return 0; -} -/****************************************************************************** - * RtlEqualSid [NTDLL.352] - * - */ -DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2) { - FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2); - return TRUE; -} - -/****************************************************************************** - * RtlFreeSid [NTDLL.376] - */ -DWORD WINAPI RtlFreeSid(DWORD x1) -{ FIXME(ntdll,"(0x%08lx),stub!\n", x1); - return TRUE; -} - -/****************************************************************************** - * RtlGetDaclSecurityDescriptor [NTDLL] - * - * NOTES: seems to be like GetSecurityDescriptorDacl (js) - */ -DWORD WINAPI RtlGetDaclSecurityDescriptor( - IN PSECURITY_DESCRIPTOR pSecurityDescriptor, - OUT LPBOOL lpbDaclPresent, - OUT PACL *pDacl, - OUT LPBOOL lpbDaclDefaulted) -{ DWORD ret = 0; - - TRACE(ntdll,"(%p,%p,%p,%p)\n", - pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted); - - if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION) - return STATUS_UNKNOWN_REVISION ; - - if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) ) - { - if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control) - { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl); - } - else - { *pDacl = pSecurityDescriptor->Dacl; - } - } - - *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0); - - return ret; -} - -/****************************************************************************** - * RtlCreateEnvironment [NTDLL] - */ -DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) { - FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); - return 0; -} - - -/****************************************************************************** - * RtlDestroyEnvironment [NTDLL] - */ -DWORD WINAPI RtlDestroyEnvironment(DWORD x) { - FIXME(ntdll,"(0x%08lx),stub!\n",x); - return 0; -} - -/****************************************************************************** - * RtlQueryEnvironmentVariable_U [NTDLL] - */ -DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { - FIXME(ntdll,"(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val); - return 0; -} - -/****************************************************************************** - * RtlSetEnvironmentVariable [NTDLL] - */ -DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { - FIXME(ntdll,"(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer)); - return 0; -} - -/****************************************************************************** - * RtlNewSecurityObject [NTDLL] - */ -DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) { - FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6); - return 0; -} - -/****************************************************************************** - * RtlDeleteSecurityObject [NTDLL] - */ -DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) { - FIXME(ntdll,"(0x%08lx),stub!\n",x1); - return 0; -} - -/****************************************************************************** - * RtlToTimeInSecondsSince1980 [NTDLL] - */ -BOOL32 WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,LPDWORD timeret) { - /* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */ - *timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600; - return 1; -} - -/****************************************************************************** - * RtlToTimeInSecondsSince1970 [NTDLL] - */ -BOOL32 WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,LPDWORD timeret) { - *timeret = DOSFS_FileTimeToUnixTime(ft,NULL); - return 1; -} - -/****************************************************************************** - * RtlAcquirePebLock [NTDLL] - */ -VOID WINAPI RtlAcquirePebLock(void) { - FIXME(ntdll,"()\n"); - /* enter critical section ? */ -} - -/****************************************************************************** - * RtlReleasePebLock [NTDLL] - */ -VOID WINAPI RtlReleasePebLock(void) { - FIXME(ntdll,"()\n"); - /* leave critical section ? */ -} - -/****************************************************************************** - * RtlAddAccessAllowedAce [NTDLL] - */ -DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { - FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); - return 0; -} - -/****************************************************************************** - * RtlGetAce [NTDLL] - */ -DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) { - FIXME(ntdll,"(%p,%ld,%p),stub!\n",pAcl,dwAceIndex,pAce); - return 0; -} - -/****************************************************************************** - * RtlAdjustPrivilege [NTDLL] - */ -DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { - FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); - return 0; -} - -/****************************************************************************** - * RtlIntegerToChar [NTDLL] - */ -DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { - FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); - return 0; -} -/****************************************************************************** - * RtlSystemTimeToLocalTime [NTDLL] - */ -DWORD WINAPI RtlSystemTimeToLocalTime(DWORD x1,DWORD x2) { - FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); - return 0; -} -/****************************************************************************** - * RtlTimeToTimeFields [NTDLL] - */ -DWORD WINAPI RtlTimeToTimeFields(DWORD x1,DWORD x2) { - FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); - return 0; -} /****************************************************************************** * RtlCompareUnicodeString [NTDLL] */ @@ -893,26 +756,11 @@ NTSTATUS WINAPI RtlCompareUnicodeString( return 0; } -/****************************************************************************** - * DbgPrint [NTDLL] - */ -void __cdecl DbgPrint(LPCSTR fmt,LPVOID args) { - char buf[512]; - - wvsprintf32A(buf,fmt,&args); - MSG("DbgPrint says: %s",buf); - /* hmm, raise exception? */ -} -DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments) -{ FIXME(ntdll,"0x%08lx 0x%08lx 0x%08lx %p\n", dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); - return 0; -} - -DWORD RtlRaiseException ( DWORD x) -{ FIXME(ntdll, "0x%08lx\n", x); - return 0; -} +/* ###################################### + ###### RESOURCE FUNCTIONS ###### + ###################################### +*/ /*********************************************************************** * RtlInitializeResource (NTDLL.409) * @@ -1098,3 +946,276 @@ void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl) } } +/* ############################## + ###### MISC FUNCTIONS ###### + ############################## +*/ + +/****************************************************************************** + * DbgPrint [NTDLL] + */ +void __cdecl DbgPrint(LPCSTR fmt,LPVOID args) { + char buf[512]; + + wvsprintf32A(buf,fmt,&args); + MSG("DbgPrint says: %s",buf); + /* hmm, raise exception? */ +} +DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments) +{ FIXME(ntdll,"0x%08lx 0x%08lx 0x%08lx %p\n", dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); + return 0; +} + +DWORD RtlRaiseException ( DWORD x) +{ FIXME(ntdll, "0x%08lx\n", x); + return 0; +} +/****************************************************************************** + * RtlAcquirePebLock [NTDLL] + */ +VOID WINAPI RtlAcquirePebLock(void) { + FIXME(ntdll,"()\n"); + /* enter critical section ? */ +} + +/****************************************************************************** + * RtlReleasePebLock [NTDLL] + */ +VOID WINAPI RtlReleasePebLock(void) { + FIXME(ntdll,"()\n"); + /* leave critical section ? */ +} + +/****************************************************************************** + * RtlAdjustPrivilege [NTDLL] + */ +DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { + FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); + return 0; +} + +/****************************************************************************** + * RtlIntegerToChar [NTDLL] + */ +DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { + FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); + return 0; +} +/****************************************************************************** + * RtlSystemTimeToLocalTime [NTDLL] + */ +DWORD WINAPI RtlSystemTimeToLocalTime(DWORD x1,DWORD x2) { + FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); + return 0; +} +/****************************************************************************** + * RtlTimeToTimeFields [NTDLL] + */ +DWORD WINAPI RtlTimeToTimeFields(DWORD x1,DWORD x2) { + FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); + return 0; +} +/****************************************************************************** + * RtlSetEnvironmentVariable [NTDLL] + */ +DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { + FIXME(ntdll,"(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer)); + return 0; +} + +/****************************************************************************** + * RtlNewSecurityObject [NTDLL] + */ +DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) { + FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6); + return 0; +} + +/****************************************************************************** + * RtlDeleteSecurityObject [NTDLL] + */ +DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) { + FIXME(ntdll,"(0x%08lx),stub!\n",x1); + return 0; +} + +/****************************************************************************** + * RtlToTimeInSecondsSince1980 [NTDLL] + */ +BOOLEAN WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,LPDWORD timeret) { + /* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */ + *timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600; + return 1; +} + +/****************************************************************************** + * RtlToTimeInSecondsSince1970 [NTDLL] + */ +BOOLEAN WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,LPDWORD timeret) { + *timeret = DOSFS_FileTimeToUnixTime(ft,NULL); + return 1; +} +/************************************************************************** + * RtlNormalizeProcessParams [NTDLL.441] + */ +LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x) +{ + FIXME(ntdll,"(%p), stub\n",x); + return x; +} + +/************************************************************************** + * RtlNtStatusToDosError [NTDLL.442] + */ +DWORD WINAPI RtlNtStatusToDosError(DWORD error) +{ + FIXME(ntdll, "(%lx): map STATUS_ to ERROR_\n",error); + switch (error) + { case STATUS_SUCCESS: return ERROR_SUCCESS; + case STATUS_INVALID_PARAMETER: return ERROR_BAD_ARGUMENTS; + case STATUS_BUFFER_TOO_SMALL: return ERROR_INSUFFICIENT_BUFFER; +/* case STATUS_INVALID_SECURITY_DESCR: return ERROR_INVALID_SECURITY_DESCR;*/ + case STATUS_NO_MEMORY: return ERROR_NOT_ENOUGH_MEMORY; +/* case STATUS_UNKNOWN_REVISION: + case STATUS_BUFFER_OVERFLOW:*/ + } + FIXME(ntdll, "unknown status (%lx)\n",error); + return ERROR_SUCCESS; +} + +/************************************************************************** + * RtlGetNtProductType [NTDLL.390] + */ +BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type) +{ + FIXME(ntdll, "(%p): stub\n", type); + *type=3; /* dunno. 1 for client, 3 for server? */ + return 1; +} + +/************************************************************************** + * NTDLL_chkstk [NTDLL.862] + * NTDLL_alloca_probe [NTDLL.861] + * Glorified "enter xxxx". + */ +REGS_ENTRYPOINT(NTDLL_chkstk) +{ + ESP_reg(context) -= EAX_reg(context); +} +REGS_ENTRYPOINT(NTDLL_alloca_probe) +{ + ESP_reg(context) -= EAX_reg(context); +} + +/****************************************************************************** + * RtlTimeToElapsedTimeFields [NTDLL.502] + */ +DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 ) +{ + FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2); + return 0; +} + + +/****************************************************************************** + * RtlExtendedLargeIntegerDivide [NTDLL.359] + */ +INT32 WINAPI RtlExtendedLargeIntegerDivide( + LARGE_INTEGER dividend, + DWORD divisor, + LPDWORD rest +) { +#if SIZEOF_LONG_LONG==8 + long long x1 = *(long long*)÷nd; + + if (*rest) + *rest = x1 % divisor; + return x1/divisor; +#else + FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest); + return 0; +#endif +} + +/****************************************************************************** + * RtlExtendedLargeIntegerMultiply [NTDLL.359] + * Note: This even works, since gcc returns 64bit values in eax/edx just like + * the caller expects. However... The relay code won't grok this I think. + */ +long long /*LARGE_INTEGER*/ +WINAPI RtlExtendedIntegerMultiply( + LARGE_INTEGER factor1,INT32 factor2 +) { +#if SIZEOF_LONG_LONG==8 + return (*(long long*)&factor1)*factor2; +#else + FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2); + return 0; +#endif +} + +/****************************************************************************** + * RtlFormatCurrentUserKeyPath [NTDLL.371] + */ +DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x) +{ + FIXME(ntdll,"(0x%08lx): stub\n",x); + return 1; +} + +/****************************************************************************** + * RtlOpenCurrentUser [NTDLL] + */ +DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2) +{ +/* Note: this is not the correct solution, + * But this works pretty good on wine and NT4.0 binaries + */ + if ( x1 == 0x2000000 ) { + *x2 = HKEY_CURRENT_USER; + return TRUE; + } + + return FALSE; +} +/************************************************************************** + * RtlDosPathNameToNtPathName_U [NTDLL.338] + * + * FIXME: convert to UNC or whatever is expected here + */ +BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( + LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3) +{ + LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from); + + FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3); + if (us) + RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from)); + return TRUE; +} + +/****************************************************************************** + * RtlCreateEnvironment [NTDLL] + */ +DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) { + FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2); + return 0; +} + + +/****************************************************************************** + * RtlDestroyEnvironment [NTDLL] + */ +DWORD WINAPI RtlDestroyEnvironment(DWORD x) { + FIXME(ntdll,"(0x%08lx),stub!\n",x); + return 0; +} + +/****************************************************************************** + * RtlQueryEnvironmentVariable_U [NTDLL] + */ +DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { + FIXME(ntdll,"(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val); + return 0; +} + diff --git a/include/ntddk.h b/include/ntddk.h index 08ac12f4e22..02eae9b9b9c 100644 --- a/include/ntddk.h +++ b/include/ntddk.h @@ -8,16 +8,13 @@ #include -/* fixme: put it elsewhere */ -typedef long BOOL; /* end fixme */ /****************** * asynchronous I/O */ -/* conflict with X11-includes*/ +#undef Status /* conflict with X11-includes*/ -#undef Status typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; @@ -156,7 +153,7 @@ typedef enum SYSTEM_INFORMATION_CLASS typedef struct _SYSTEM_TIME_ADJUSTMENT { ULONG TimeAdjustment; - BOOL TimeAdjustmentDisabled; + BOOLEAN TimeAdjustmentDisabled; } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT; @@ -201,4 +198,168 @@ typedef enum _TIMER_TYPE SynchronizationTimer } TIMER_TYPE; +/* ############################## + ###### SID FUNCTIONS ###### + ############################## +*/ + +BOOLEAN WINAPI RtlAllocateAndInitializeSid ( + PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, + DWORD nSubAuthorityCount, + DWORD x3, + DWORD x4, + DWORD x5, + DWORD x6, + DWORD x7, + DWORD x8, + DWORD x9, + DWORD x10, + PSID pSid); + +DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2); +DWORD WINAPI RtlFreeSid(DWORD x1); +DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths); +DWORD WINAPI RtlLengthSid(PSID sid); +DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth, DWORD c); +LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr); +LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID); +DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from); + +/* ############################################## + ###### SECURITY DESCRIPTOR FUNCTIONS ###### + ############################################## +*/ + +NTSTATUS WINAPI RtlCreateSecurityDescriptor( + PSECURITY_DESCRIPTOR lpsd, + DWORD rev); + +BOOLEAN WINAPI RtlValidSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor); + +DWORD WINAPI RtlGetDaclSecurityDescriptor( + IN PSECURITY_DESCRIPTOR pSecurityDescriptor, + OUT PBOOLEAN lpbDaclPresent, + OUT PACL *pDacl, + OUT PBOOLEAN lpbDaclDefaulted); + +NTSTATUS WINAPI RtlSetDaclSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + BOOLEAN daclpresent, + PACL dacl, + BOOLEAN dacldefaulted ); + +ULONG WINAPI RtlLengthSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor); + +DWORD WINAPI RtlSetSaclSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + BOOLEAN saclpresent, + PACL sacl, + BOOLEAN sacldefaulted); + +NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID *Owner, + PBOOLEAN OwnerDefaulted); + +NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor( + PSECURITY_DESCRIPTOR lpsd, + PSID owner, + BOOLEAN ownerdefaulted); + +NTSTATUS WINAPI RtlSetGroupSecurityDescriptor ( + PSECURITY_DESCRIPTOR lpsd, + PSID group, + BOOLEAN groupdefaulted); + +NTSTATUS WINAPI RtlGetGroupSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor, + PSID *Group, + PBOOLEAN GroupDefaulted); + +/* ############################## + ###### ACL FUNCTIONS ###### + ############################## +*/ + +DWORD WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev); + +BOOLEAN WINAPI RtlFirstFreeAce( + PACL acl, + LPACE_HEADER *x); +NTSTATUS WINAPI RtlAddAce( + PACL acl, + DWORD rev, + DWORD xnrofaces, + LPACE_HEADER acestart, + DWORD acelen); + +DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4); +DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ); + +/* ###################################### + ###### STRING FUNCTIONS ###### + ###################################### +*/ + +DWORD WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOLEAN doalloc); +DWORD WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOLEAN doalloc); +DWORD WINAPI RtlMultiByteToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen); +DWORD WINAPI RtlOemToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen); +VOID WINAPI RtlInitAnsiString(PANSI_STRING target,LPCSTR source); +VOID WINAPI RtlInitString(PSTRING target,LPCSTR source); +VOID WINAPI RtlInitUnicodeString(PUNICODE_STRING target,LPCWSTR source); +VOID WINAPI RtlFreeUnicodeString(PUNICODE_STRING str); +VOID WINAPI RtlFreeAnsiString(PANSI_STRING AnsiString); +DWORD WINAPI RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,DWORD unilen); +DWORD WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc); +DWORD WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc); +DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x); +DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOLEAN doalloc); +UINT32 WINAPI RtlxOemStringToUnicodeSize(PSTRING str); +UINT32 WINAPI RtlxAnsiStringToUnicodeSize(PANSI_STRING str); +DWORD WINAPI RtlIsTextUnicode(LPVOID buf, DWORD len, DWORD *pf); +NTSTATUS WINAPI RtlCompareUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive); + +/* ###################################### + ###### RESOURCE FUNCTIONS ###### + ###################################### +*/ +void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl); +void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl); +BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait); +BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait); +void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl); +void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl); + +void __cdecl DbgPrint(LPCSTR fmt,LPVOID args); +DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments); +DWORD RtlRaiseException ( DWORD x); +VOID WINAPI RtlAcquirePebLock(void); +VOID WINAPI RtlReleasePebLock(void); +DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4); +DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4); +DWORD WINAPI RtlSystemTimeToLocalTime(DWORD x1,DWORD x2); +DWORD WINAPI RtlTimeToTimeFields(DWORD x1,DWORD x2); +DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val); +DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6); +DWORD WINAPI RtlDeleteSecurityObject(DWORD x1); +BOOLEAN WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,LPDWORD timeret); +BOOLEAN WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,LPDWORD timeret); +LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x); +DWORD WINAPI RtlNtStatusToDosError(DWORD error); +BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type); +DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 ); +INT32 WINAPI RtlExtendedLargeIntegerDivide(LARGE_INTEGER dividend, DWORD divisor, LPDWORD rest); +LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(LARGE_INTEGER factor1,INT32 factor2); +DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x); +DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2); +BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3); +DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2); +DWORD WINAPI RtlDestroyEnvironment(DWORD x); +DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) ; + + + #endif diff --git a/include/ntdef.h b/include/ntdef.h index 47d287c529e..059267c45d9 100644 --- a/include/ntdef.h +++ b/include/ntdef.h @@ -3,6 +3,18 @@ #define NTAPI __stdcall +#ifndef IN +#define IN +#endif + +#ifndef OUT +#define OUT +#endif + +#ifndef OPTIONAL +#define OPTIONAL +#endif + /* NT lowlevel Strings (handled by Rtl* functions in NTDLL) * If they are zero terminated, Length does not include the terminating 0. */ diff --git a/include/ntdll.h b/include/ntdll.h index 2fb7a08d146..6aff6d8a384 100644 --- a/include/ntdll.h +++ b/include/ntdll.h @@ -15,23 +15,6 @@ extern "C" { typedef DWORD NTSTATUS; -/* Security Ids of NT */ - -/* Moved to windows.h -typedef struct { - BYTE Value[6]; -} SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY; -*/ - -/* Moved to windows.h -typedef struct _SID { - BYTE Revision; - BYTE SubAuthorityCount; - SID_IDENTIFIER_AUTHORITY IdentifierAuthority; - DWORD SubAuthority[1]; -} SID,*PSID,*PSID; -*/ - #define SID_REVISION (1) /* Current revision */ #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */ #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */ @@ -43,16 +26,6 @@ typedef struct _SID { #define ACL_REVISION1 1 #define ACL_REVISION2 2 -/* Moved to windows.h -typedef struct _ACL { - BYTE AclRevision; - BYTE Sbz1; - WORD AclSize; - WORD AceCount; - WORD Sbz2; -} ACL,*LPACL; -*/ - /* ACEs, directly starting after an ACL */ typedef struct _ACE_HEADER { BYTE AceType; @@ -108,33 +81,6 @@ typedef struct _SYSTEM_ALARM_ACE { DWORD SidStart; } SYSTEM_ALARM_ACE,*LPSYSTEM_ALARM_ACE; -#define SECURITY_DESCRIPTOR_REVISION 1 -#define SECURITY_DESCRIPTOR_REVISION1 1 - -/* -typedef WORD SECURITY_DESCRIPTOR_CONTROL; - */ - -#define SE_OWNER_DEFAULTED 0x0001 -#define SE_GROUP_DEFAULTED 0x0002 -#define SE_DACL_PRESENT 0x0004 -#define SE_DACL_DEFAULTED 0x0008 -#define SE_SACL_PRESENT 0x0010 -#define SE_SACL_DEFAULTED 0x0020 -#define SE_SELF_RELATIVE 0x8000 - -/* This was moved to windows.h -typedef struct { - BYTE Revision; - BYTE Sbz1; - SECURITY_DESCRIPTOR_CONTROL Control; - PSID Owner; - PSID Group; - LPACL Sacl; - LPACL Dacl; -} SECURITY_DESCRIPTOR,*PSECURITY_DESCRIPTOR,*LPSECURITY_DESCRIPTOR; -*/ - typedef enum tagSID_NAME_USE { SidTypeUser = 1, SidTypeGroup, diff --git a/include/queue.h b/include/queue.h index 3ad74a9d080..483f274365e 100644 --- a/include/queue.h +++ b/include/queue.h @@ -129,7 +129,7 @@ typedef struct tagMESSAGEQUEUE #define QUEUE_MAGIC 0xD46E80AF /* Per queue data management methods */ -PERQUEUEDATA* PERQDATA_CreateInstance( ); +PERQUEUEDATA* PERQDATA_CreateInstance( void ); ULONG PERQDATA_Addref( PERQUEUEDATA* pQData ); ULONG PERQDATA_Release( PERQUEUEDATA* pQData ); HWND32 PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData ); diff --git a/include/winbase.h b/include/winbase.h index 7960fa9f9bf..73abf0c42d1 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -162,10 +162,7 @@ typedef struct DWORD nLength; LPVOID lpSecurityDescriptor; BOOL32 bInheritHandle; -} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; - -typedef DWORD SECURITY_INFORMATION; - +} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #ifndef _FILETIME_ #define _FILETIME_ diff --git a/include/winnt.h b/include/winnt.h index 4f125cbe013..4a71a2296b0 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -358,6 +358,8 @@ typedef enum _TOKEN_INFORMATION_CLASS { #ifndef _SECURITY_DEFINED #define _SECURITY_DEFINED +#pragma pack (1) + typedef struct { BYTE Value[6]; } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY; @@ -381,6 +383,20 @@ typedef struct _ACL { WORD Sbz2; } ACL, *PACL; +/* SECURITY_DESCRIPTOR */ +#define SECURITY_DESCRIPTOR_REVISION 1 +#define SECURITY_DESCRIPTOR_REVISION1 1 + + +#define SE_OWNER_DEFAULTED 0x0001 +#define SE_GROUP_DEFAULTED 0x0002 +#define SE_DACL_PRESENT 0x0004 +#define SE_DACL_DEFAULTED 0x0008 +#define SE_SACL_PRESENT 0x0010 +#define SE_SACL_DEFAULTED 0x0020 +#define SE_SELF_RELATIVE 0x8000 + +typedef DWORD SECURITY_INFORMATION; typedef WORD SECURITY_DESCRIPTOR_CONTROL; /* The security descriptor structure */ @@ -394,6 +410,8 @@ typedef struct { PACL Dacl; } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR; +#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) + #endif /* _SECURITY_DEFINED */ /* diff --git a/include/winreg.h b/include/winreg.h index e5907d4a10a..6dfbdb0ac39 100644 --- a/include/winreg.h +++ b/include/winreg.h @@ -5,23 +5,9 @@ #define __WINE_WINREG_H #include "winbase.h" +#include "winnt.h" -/* FIXME: should be in security.h or whereever */ -#ifndef READ_CONTROL -#define READ_CONTROL 0x00020000 -#endif -#ifndef STANDARD_RIGHTS_READ -#define STANDARD_RIGHTS_READ READ_CONTROL -#endif -#ifndef STANDARD_RIGHTS_WRITE -#define STANDARD_RIGHTS_WRITE READ_CONTROL /* yes, it's right (js) */ -#endif -#ifndef STANDARD_RIGHTS_ALL -#define STANDARD_RIGHTS_ALL 0x001f0000 -#endif -/* ... */ - - +/* #define SHELL_ERROR_SUCCESS 0L #define SHELL_ERROR_BADDB 1L #define SHELL_ERROR_BADKEY 2L @@ -31,6 +17,7 @@ #define SHELL_ERROR_OUTOFMEMORY 6L #define SHELL_ERROR_INVALID_PARAMETER 7L #define SHELL_ERROR_ACCESS_DENIED 8L +*/ #define REG_NONE 0 /* no type */ #define REG_SZ 1 /* string type (ASCII) */ diff --git a/ole/oleobj.c b/ole/oleobj.c index 738ebd3c422..a561ba8ad0a 100644 --- a/ole/oleobj.c +++ b/ole/oleobj.c @@ -8,7 +8,6 @@ #include "ole.h" #include "ole2.h" #include "winerror.h" -#include "windows.h" #include "wine/obj_base.h" #include "wine/obj_storage.h" #include "wine/obj_moniker.h" diff --git a/relay32/advapi32.spec b/relay32/advapi32.spec index af0764d24b7..fd826104971 100644 --- a/relay32/advapi32.spec +++ b/relay32/advapi32.spec @@ -92,7 +92,7 @@ type win32 0088 stdcall GetOldestEventLogRecord (long ptr) GetOldestEventLogRecord32 0089 stub GetPrivateObjectSecurity 0090 stdcall GetSecurityDescriptorControl (ptr ptr ptr) GetSecurityDescriptorControl32 -0091 stub GetSecurityDescriptorDacl +0091 stdcall GetSecurityDescriptorDacl (ptr ptr ptr ptr) GetSecurityDescriptorDacl 0092 stdcall GetSecurityDescriptorGroup(ptr ptr ptr) GetSecurityDescriptorGroup 0093 stdcall GetSecurityDescriptorLength(ptr) GetSecurityDescriptorLength 0094 stdcall GetSecurityDescriptorOwner(ptr ptr ptr) GetSecurityDescriptorOwner @@ -225,10 +225,10 @@ type win32 0221 stdcall SetFileSecurityW(wstr long ptr) SetFileSecurity32W 0222 stub SetKernelObjectSecurity 0223 stub SetPrivateObjectSecurity -0224 stdcall SetSecurityDescriptorDacl(ptr long ptr long) RtlSetDaclSecurityDescriptor -0225 stub SetSecurityDescriptorGroup -0226 stub SetSecurityDescriptorOwner -0227 stub SetSecurityDescriptorSacl +0224 stdcall SetSecurityDescriptorDacl(ptr long ptr long) SetSecurityDescriptorDacl +0225 stdcall SetSecurityDescriptorGroup (ptr ptr long) SetSecurityDescriptorGroup +0226 stdcall SetSecurityDescriptorOwner (ptr ptr long) SetSecurityDescriptorOwner +0227 stdcall SetSecurityDescriptorSacl(ptr long ptr long) SetSecurityDescriptorSacl 0228 stub SetServiceBits 0229 stub SetServiceObjectSecurity 0230 stdcall SetServiceStatus(long long)SetServiceStatus