Implement LookupPrivilegeValueA/W

Mike McCormack mike at codeweavers.com
Mon Jul 21 04:30:12 CDT 2003


ChangeLog:
* Implement LookupPrivilegeValueA/W

-------------- next part --------------
Index: dlls/advapi32/advapi32.spec
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/advapi32.spec,v
retrieving revision 1.37
diff -u -r1.37 advapi32.spec
--- dlls/advapi32/advapi32.spec	16 Jun 2003 19:44:07 -0000	1.37
+++ dlls/advapi32/advapi32.spec	21 Jul 2003 09:13:54 -0000
@@ -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
Index: dlls/advapi32/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/security.c,v
retrieving revision 1.55
diff -u -r1.55 security.c
--- dlls/advapi32/security.c	16 Jun 2003 19:44:07 -0000	1.55
+++ dlls/advapi32/security.c	21 Jul 2003 09:13:55 -0000
@@ -757,6 +757,24 @@
 	##############################
 */
 
+
+static LPCSTR 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
 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; i<NUMPRIVS; i++ )
+    {
+        if( !DefaultPrivNames[i] )
+            continue;
+        MultiByteToWideChar( CP_ACP, 0, DefaultPrivNames[i], -1,
+                             priv, sizeof priv );
+        if( strcmpW( priv, lpName) )
+            continue;
+        lpLuid->LowPart = i;
+        lpLuid->HighPart = 0;
+        TRACE( "%s -> %08lx-%08lx\n",debugstr_w( lpSystemName ),
+               lpLuid->HighPart, lpLuid->LowPart );
+        return TRUE;
+    }
+    return FALSE;
 }
 
 /******************************************************************************
@@ -799,6 +832,27 @@
     RtlFreeUnicodeString(&lpNameW);
     RtlFreeUnicodeString(&lpSystemNameW);
     return ret;
+}
+
+
+/******************************************************************************
+ * LookupPrivilegeValueA			[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;
+}
+
+/******************************************************************************
+ * LookupPrivilegeValueW			[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;
 }
 
 /******************************************************************************


More information about the wine-patches mailing list