From 133ba9f3cd6093f6b0537d16885e1e7d8c245e5d Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 24 Jul 2003 00:01:16 +0000 Subject: [PATCH] Implemented LookupPrivilegeValueA/W. --- dlls/advapi32/advapi32.spec | 4 +-- dlls/advapi32/security.c | 64 ++++++++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec index 6b6aa14849d..df090906109 100644 --- a/dlls/advapi32/advapi32.spec +++ b/dlls/advapi32/advapi32.spec @@ -148,8 +148,8 @@ @ stdcall LookupAccountSidW(ptr ptr ptr ptr ptr ptr ptr) @ stub LookupPrivilegeDisplayNameA @ stub LookupPrivilegeDisplayNameW -@ stub LookupPrivilegeNameA -@ stub LookupPrivilegeNameW +@ stdcall LookupPrivilegeNameA(str ptr ptr long) +@ stdcall LookupPrivilegeNameW(wstr ptr ptr long) @ stdcall LookupPrivilegeValueA(ptr ptr ptr) @ stdcall LookupPrivilegeValueW(ptr ptr ptr) @ stub MakeAbsoluteSD diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 119c4e28544..ac24a413c97 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -757,6 +757,24 @@ BOOL WINAPI IsValidAcl(IN PACL pAcl) ############################## */ +static const char * const DefaultPrivNames[] = +{ + NULL, NULL, + "SeCreateTokenPrivilege", "SeAssignPrimaryTokenPrivilege", + "SeLockMemoryPrivilege", "SeIncreaseQuotaPrivilege", + "SeMachineAccountPrivilege", "SeTcbPrivilege", + "SeSecurityPrivilege", "SeTakeOwnershipPrivilege", + "SeLoadDriverPrivilege", "SeSystemProfilePrivilege", + "SeSystemtimePrivilege", "SeProfileSingleProcessPrivilege", + "SeIncreaseBasePriorityPrivilege", "SeCreatePagefilePrivilege", + "SeCreatePermanentPrivilege", "SeBackupPrivilege", + "SeRestorePrivilege", "SeShutdownPrivilege", + "SeDebugPrivilege", "SeAuditPrivilege", + "SeSystemEnvironmentPrivilege", "SeChangeNotifyPrivilege", + "SeRemoteShutdownPrivilege", +}; +#define NUMPRIVS (sizeof DefaultPrivNames/sizeof DefaultPrivNames[0]) + /****************************************************************************** * LookupPrivilegeValueW [ADVAPI32.@] * @@ -765,11 +783,26 @@ BOOL WINAPI IsValidAcl(IN PACL pAcl) BOOL WINAPI LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ) { - FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName), - debugstr_w(lpName), lpLuid); - lpLuid->LowPart = 0x12345678; - lpLuid->HighPart = 0x87654321; - return TRUE; + UINT i; + WCHAR priv[0x28]; + + TRACE("%s,%s,%p\n",debugstr_w(lpSystemName), debugstr_w(lpName), lpLuid); + + for( i=0; iLowPart = i; + lpLuid->HighPart = 0; + TRACE( "%s -> %08lx-%08lx\n",debugstr_w( lpSystemName ), + lpLuid->HighPart, lpLuid->LowPart ); + return TRUE; + } + return FALSE; } /****************************************************************************** @@ -801,6 +834,27 @@ LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ) return ret; } + +/****************************************************************************** + * LookupPrivilegeNameA [ADVAPI32.@] + */ +BOOL WINAPI +LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName) +{ + FIXME("%s %p %p %p\n", debugstr_a(lpSystemName), lpLuid, lpName, cchName); + return FALSE; +} + +/****************************************************************************** + * LookupPrivilegeNameW [ADVAPI32.@] + */ +BOOL WINAPI +LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName) +{ + FIXME("%s %p %p %p\n", debugstr_w(lpSystemName), lpLuid, lpName, cchName); + return FALSE; +} + /****************************************************************************** * GetFileSecurityA [ADVAPI32.@] *