- Implement IsUserAdmin (untested), MultiByteToUnicode and  UnicodeToMultiByte.
- Sort prototypes in setupapi.h.
Modified: trunk/reactos/include/wine/setupapi.h
Modified: trunk/reactos/lib/setupapi/misc.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec

Modified: trunk/reactos/include/wine/setupapi.h
--- trunk/reactos/include/wine/setupapi.h	2005-01-30 12:56:12 UTC (rev 13366)
+++ trunk/reactos/include/wine/setupapi.h	2005-01-30 13:48:51 UTC (rev 13367)
@@ -664,90 +664,26 @@
 #define SPDRP_INSTALL_STATE               0x00000022
 #define SPDRP_MAXIMUM_PROPERTY            0x00000023
 
-void     WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show );
-void     WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show );
+
+LONG     WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
+PWSTR    WINAPI DuplicateString(PCWSTR lpSrc);
+void     WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, PCSTR cmdline, INT show );
+void     WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline, INT show );
 #define         InstallHinfSection WINELIB_NAME_AW(InstallHinfSection)
-HINF     WINAPI SetupOpenInfFileA( PCSTR name, PCSTR pszclass, DWORD style, UINT *error );
-HINF     WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR pszclass, DWORD style, UINT *error );
-#define         SetupOpenInfFile WINELIB_NAME_AW(SetupOpenInfFile)
-BOOL     WINAPI SetupOpenAppendInfFileA( PCSTR, HINF, UINT * );
-BOOL     WINAPI SetupOpenAppendInfFileW( PCWSTR, HINF, UINT * );
-#define         SetupOpenAppendInfFile WINELIB_NAME_AW(SetupOpenAppendInfFile)
-HINF     WINAPI SetupOpenMasterInf( VOID );
+BOOL     WINAPI IsUserAdmin(VOID);
+PWSTR    WINAPI MultiByteToUnicode(PCSTR lpMultiByteStr, UINT uCodePage);
+VOID     WINAPI MyFree(PVOID lpMem);
+PVOID    WINAPI MyMalloc(DWORD dwSize);
+PVOID    WINAPI MyRealloc(PVOID lpSrc, DWORD dwSize);
+LONG     WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE *, PDWORD, PDWORD);
+BOOL     WINAPI SetupCloseFileQueue( HSPFILEQ );
 void     WINAPI SetupCloseInfFile( HINF hinf );
-BOOL     WINAPI SetupGetLineByIndexA( HINF, PCSTR, DWORD, INFCONTEXT * );
-BOOL     WINAPI SetupGetLineByIndexW( HINF, PCWSTR, DWORD, INFCONTEXT * );
-#define         SetupGetLineByIndex WINELIB_NAME_AW(SetupGetLineByIndex)
-LONG     WINAPI SetupGetLineCountA( HINF hinf, PCSTR section );
-LONG     WINAPI SetupGetLineCountW( HINF hinf, PCWSTR section );
-#define         SetupGetLineCount WINELIB_NAME_AW(SetupGetLineCount)
-BOOL     WINAPI SetupFindFirstLineA( HINF hinf, PCSTR section, PCSTR key, INFCONTEXT *context );
-BOOL     WINAPI SetupFindFirstLineW( HINF hinf, PCWSTR section, PCWSTR key, INFCONTEXT *context );
-#define         SetupFindFirstLine WINELIB_NAME_AW(SetupFindFirstLine)
-BOOL     WINAPI SetupFindNextLine( PINFCONTEXT context_in, PINFCONTEXT context_out );
-BOOL     WINAPI SetupFindNextMatchLineA( PINFCONTEXT context_in, PCSTR key, PINFCONTEXT context_out );
-BOOL     WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key, PINFCONTEXT context_out );
-#define         SetupFindNextMatchLine WINELIB_NAME_AW(SetupFindNextMatchLine)
-BOOL     WINAPI SetupGetLineTextA( PINFCONTEXT context, HINF hinf, PCSTR section_name,PCSTR key_name, PSTR buffer, DWORD size, PDWORD required );
-BOOL     WINAPI SetupGetLineTextW( PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required );
-#define         SetupGetLineText WINELIB_NAME_AW(SetupGetLineText)
-DWORD    WINAPI SetupGetFieldCount( PINFCONTEXT context );
-BOOL     WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result );
-BOOL     WINAPI SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, PDWORD required );
-BOOL     WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, PDWORD required );
-#define         SetupGetStringField WINELIB_NAME_AW(SetupGetStringField)
-BOOL     WINAPI SetupGetBinaryField( PINFCONTEXT context, DWORD index, BYTE *buffer, DWORD size, LPDWORD required );
-BOOL     WINAPI SetupGetMultiSzFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, LPDWORD required );
-BOOL     WINAPI SetupGetMultiSzFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, LPDWORD required );
-#define         SetupGetMultiSzField WINELIB_NAME_AW(SetupGetMultiSzField)
-BOOL     WINAPI SetupSetDirectoryIdA( HINF, DWORD, PCSTR );
-BOOL     WINAPI SetupSetDirectoryIdW( HINF, DWORD, PCWSTR );
-#define         SetupSetDirectoryId WINELIB_NAME_AW(SetupSetDirectoryId)
-HSPFILEQ WINAPI SetupOpenFileQueue(void);
-BOOL     WINAPI SetupCloseFileQueue( HSPFILEQ );
-BOOL     WINAPI SetupSetFileQueueAlternatePlatformA( HSPFILEQ, PSP_ALTPLATFORM_INFO, PCSTR );
-BOOL     WINAPI SetupSetFileQueueAlternatePlatformW( HSPFILEQ, PSP_ALTPLATFORM_INFO, PCWSTR );
-#define         SetupSetFileQueueAlternatePlatform WINELIB_NAME_AW(SetupSetFileQueueAlternatePlatform)
-BOOL     WINAPI SetupQueueCopyA(HSPFILEQ,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,DWORD);
-BOOL     WINAPI SetupQueueCopyW(HSPFILEQ,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,DWORD);
-#define         SetupQueueCopy WINELIB_NAME_AW(SetupQueueCopy)
-BOOL     WINAPI SetupQueueCopyIndirectA( PSP_FILE_COPY_PARAMS_A );
-BOOL     WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W );
-#define         SetupQueueCopyIndirect WINELIB_NAME_AW(SetupQueueCopyIndirect)
-BOOL     WINAPI SetupQueueDefaultCopyA( HSPFILEQ, HINF, PCSTR, PCSTR, PCSTR, DWORD );
-BOOL     WINAPI SetupQueueDefaultCopyW( HSPFILEQ, HINF, PCWSTR, PCWSTR, PCWSTR, DWORD );
-#define         SetupQueueDefaultCopy WINELIB_NAME_AW(SetupQueueDefaultCopy)
-BOOL     WINAPI SetupQueueDeleteA( HSPFILEQ, PCSTR, PCSTR );
-BOOL     WINAPI SetupQueueDeleteW( HSPFILEQ, PCWSTR, PCWSTR );
-#define         SetupQueueDelete WINELIB_NAME_AW(SetupQueueDelete)
-BOOL     WINAPI SetupQueueRenameA( HSPFILEQ, PCSTR, PCSTR, PCSTR, PCSTR );
-BOOL     WINAPI SetupQueueRenameW( HSPFILEQ, PCWSTR, PCWSTR, PCWSTR, PCWSTR );
-#define         SetupQueueRename WINELIB_NAME_AW(SetupQueueRename)
 BOOL     WINAPI SetupCommitFileQueueA( HWND, HSPFILEQ, PSP_FILE_CALLBACK_A, PVOID );
 BOOL     WINAPI SetupCommitFileQueueW( HWND, HSPFILEQ, PSP_FILE_CALLBACK_W, PVOID );
 #define         SetupCommitFileQueue WINELIB_NAME_AW(SetupCommitFileQueue)
-BOOL     WINAPI SetupScanFileQueueA( HSPFILEQ, DWORD, HWND, PSP_FILE_CALLBACK_A, PVOID, PDWORD );
-BOOL     WINAPI SetupScanFileQueueW( HSPFILEQ, DWORD, HWND, PSP_FILE_CALLBACK_W, PVOID, PDWORD );
-#define         SetupScanFileQueue WINELIB_NAME_AW(SetupScanFileQueue)
-BOOL     WINAPI SetupGetFileQueueCount( HSPFILEQ, UINT, PUINT );
-BOOL     WINAPI SetupGetFileQueueFlags( HSPFILEQ, PDWORD );
-BOOL     WINAPI SetupSetFileQueueFlags( HSPFILEQ, DWORD, DWORD );
-BOOL     WINAPI SetupQueueCopySectionA( HSPFILEQ, PCSTR, HINF, HINF, PCSTR, DWORD );
-BOOL     WINAPI SetupQueueCopySectionW( HSPFILEQ, PCWSTR, HINF, HINF, PCWSTR, DWORD );
-#define         SetupQueueCopySection WINELIB_NAME_AW(SetupQueueCopySection)
-BOOL     WINAPI SetupQueueDeleteSectionA( HSPFILEQ, HINF, HINF, PCSTR );
-BOOL     WINAPI SetupQueueDeleteSectionW( HSPFILEQ, HINF, HINF, PCWSTR );
-#define         SetupQueueDeleteSection WINELIB_NAME_AW(SetupQueueDeleteSection)
-BOOL     WINAPI SetupQueueRenameSectionA( HSPFILEQ, HINF, HINF, PCSTR );
-BOOL     WINAPI SetupQueueRenameSectionW( HSPFILEQ, HINF, HINF, PCWSTR );
-#define         SetupQueueRenameSection WINELIB_NAME_AW(SetupQueueRenameSection)
-PVOID    WINAPI SetupInitDefaultQueueCallback( HWND );
-PVOID    WINAPI SetupInitDefaultQueueCallbackEx( HWND, HWND, UINT, DWORD, PVOID );
-void     WINAPI SetupTermDefaultQueueCallback( PVOID );
 UINT     WINAPI SetupDefaultQueueCallbackA( PVOID, UINT, UINT_PTR, UINT_PTR );
 UINT     WINAPI SetupDefaultQueueCallbackW( PVOID, UINT, UINT_PTR, UINT_PTR );
 #define         SetupDefaultQueueCallback WINELIB_NAME_AW(SetupDefaultQueueCallback)
-
 BOOL     WINAPI SetupDiBuildClassInfoList(DWORD, LPGUID, DWORD, PDWORD);
 BOOL     WINAPI SetupDiBuildClassInfoListExA(DWORD, LPGUID, DWORD, PDWORD, PCSTR, PVOID);
 BOOL     WINAPI SetupDiBuildClassInfoListExW(DWORD, LPGUID, DWORD, PDWORD, PCWSTR, PVOID);
@@ -795,6 +731,35 @@
 HKEY     WINAPI SetupDiOpenClassRegKeyExA(const GUID*, REGSAM, DWORD, PCSTR, PVOID);
 HKEY     WINAPI SetupDiOpenClassRegKeyExW(const GUID*, REGSAM, DWORD, PCWSTR, PVOID);
 #define         SetupDiOpenClassRegKeyEx WINELIB_NAME_AW(SetupDiOpenClassRegKeyEx)
+BOOL     WINAPI SetupFindFirstLineA( HINF hinf, PCSTR section, PCSTR key, INFCONTEXT *context );
+BOOL     WINAPI SetupFindFirstLineW( HINF hinf, PCWSTR section, PCWSTR key, INFCONTEXT *context );
+#define         SetupFindFirstLine WINELIB_NAME_AW(SetupFindFirstLine)
+BOOL     WINAPI SetupFindNextLine( PINFCONTEXT context_in, PINFCONTEXT context_out );
+BOOL     WINAPI SetupFindNextMatchLineA( PINFCONTEXT context_in, PCSTR key, PINFCONTEXT context_out );
+BOOL     WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key, PINFCONTEXT context_out );
+#define         SetupFindNextMatchLine WINELIB_NAME_AW(SetupFindNextMatchLine)
+BOOL     WINAPI SetupGetBinaryField( PINFCONTEXT context, DWORD index, BYTE *buffer, DWORD size, LPDWORD required );
+DWORD    WINAPI SetupGetFieldCount( PINFCONTEXT context );
+BOOL     WINAPI SetupGetFileQueueCount( HSPFILEQ, UINT, PUINT );
+BOOL     WINAPI SetupGetFileQueueFlags( HSPFILEQ, PDWORD );
+BOOL     WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result );
+BOOL     WINAPI SetupGetLineByIndexA( HINF, PCSTR, DWORD, INFCONTEXT * );
+BOOL     WINAPI SetupGetLineByIndexW( HINF, PCWSTR, DWORD, INFCONTEXT * );
+#define         SetupGetLineByIndex WINELIB_NAME_AW(SetupGetLineByIndex)
+LONG     WINAPI SetupGetLineCountA( HINF hinf, PCSTR section );
+LONG     WINAPI SetupGetLineCountW( HINF hinf, PCWSTR section );
+#define         SetupGetLineCount WINELIB_NAME_AW(SetupGetLineCount)
+BOOL     WINAPI SetupGetLineTextA( PINFCONTEXT context, HINF hinf, PCSTR section_name,PCSTR key_name, PSTR buffer, DWORD size, PDWORD required );
+BOOL     WINAPI SetupGetLineTextW( PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required );
+#define         SetupGetLineText WINELIB_NAME_AW(SetupGetLineText)
+BOOL     WINAPI SetupGetMultiSzFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, LPDWORD required );
+BOOL     WINAPI SetupGetMultiSzFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, LPDWORD required );
+#define         SetupGetMultiSzField WINELIB_NAME_AW(SetupGetMultiSzField)
+BOOL     WINAPI SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, PDWORD required );
+BOOL     WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, PDWORD required );
+#define         SetupGetStringField WINELIB_NAME_AW(SetupGetStringField)
+PVOID    WINAPI SetupInitDefaultQueueCallback( HWND );
+PVOID    WINAPI SetupInitDefaultQueueCallbackEx( HWND, HWND, UINT, DWORD, PVOID );
 BOOL     WINAPI SetupInstallFilesFromInfSectionA( HINF, HINF, HSPFILEQ, PCSTR, PCSTR, UINT );
 BOOL     WINAPI SetupInstallFilesFromInfSectionW( HINF, HINF, HSPFILEQ, PCWSTR, PCWSTR, UINT );
 #define         SetupInstallFilesFromInfSection WINELIB_NAME_AW(SetupInstallFilesFromInfSection)
@@ -806,6 +771,50 @@
 BOOL     WINAPI SetupIterateCabinetA(PCSTR, DWORD, PSP_FILE_CALLBACK_A, PVOID);
 BOOL     WINAPI SetupIterateCabinetW(PCWSTR, DWORD, PSP_FILE_CALLBACK_W, PVOID);
 #define         SetupIterateCabinet WINELIB_NAME_AW(SetupIterateCabinet)
+BOOL     WINAPI SetupOpenAppendInfFileA( PCSTR, HINF, UINT * );
+BOOL     WINAPI SetupOpenAppendInfFileW( PCWSTR, HINF, UINT * );
+#define         SetupOpenAppendInfFile WINELIB_NAME_AW(SetupOpenAppendInfFile)
+HSPFILEQ WINAPI SetupOpenFileQueue(void);
+HINF     WINAPI SetupOpenInfFileA( PCSTR name, PCSTR pszclass, DWORD style, UINT *error );
+HINF     WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR pszclass, DWORD style, UINT *error );
+#define         SetupOpenInfFile WINELIB_NAME_AW(SetupOpenInfFile)
+HINF     WINAPI SetupOpenMasterInf( VOID );
+BOOL     WINAPI SetupQueueCopyA(HSPFILEQ,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,PCSTR,DWORD);
+BOOL     WINAPI SetupQueueCopyW(HSPFILEQ,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,PCWSTR,DWORD);
+#define         SetupQueueCopy WINELIB_NAME_AW(SetupQueueCopy)
+BOOL     WINAPI SetupQueueCopyIndirectA( PSP_FILE_COPY_PARAMS_A );
+BOOL     WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W );
+#define         SetupQueueCopyIndirect WINELIB_NAME_AW(SetupQueueCopyIndirect)
+BOOL     WINAPI SetupQueueCopySectionA( HSPFILEQ, PCSTR, HINF, HINF, PCSTR, DWORD );
+BOOL     WINAPI SetupQueueCopySectionW( HSPFILEQ, PCWSTR, HINF, HINF, PCWSTR, DWORD );
+#define         SetupQueueCopySection WINELIB_NAME_AW(SetupQueueCopySection)
+BOOL     WINAPI SetupQueueDefaultCopyA( HSPFILEQ, HINF, PCSTR, PCSTR, PCSTR, DWORD );
+BOOL     WINAPI SetupQueueDefaultCopyW( HSPFILEQ, HINF, PCWSTR, PCWSTR, PCWSTR, DWORD );
+#define         SetupQueueDefaultCopy WINELIB_NAME_AW(SetupQueueDefaultCopy)
+BOOL     WINAPI SetupQueueDeleteA( HSPFILEQ, PCSTR, PCSTR );
+BOOL     WINAPI SetupQueueDeleteW( HSPFILEQ, PCWSTR, PCWSTR );
+#define         SetupQueueDelete WINELIB_NAME_AW(SetupQueueDelete)
+BOOL     WINAPI SetupQueueDeleteSectionA( HSPFILEQ, HINF, HINF, PCSTR );
+BOOL     WINAPI SetupQueueDeleteSectionW( HSPFILEQ, HINF, HINF, PCWSTR );
+#define         SetupQueueDeleteSection WINELIB_NAME_AW(SetupQueueDeleteSection)
+BOOL     WINAPI SetupQueueRenameA( HSPFILEQ, PCSTR, PCSTR, PCSTR, PCSTR );
+BOOL     WINAPI SetupQueueRenameW( HSPFILEQ, PCWSTR, PCWSTR, PCWSTR, PCWSTR );
+#define         SetupQueueRename WINELIB_NAME_AW(SetupQueueRename)
+BOOL     WINAPI SetupQueueRenameSectionA( HSPFILEQ, HINF, HINF, PCSTR );
+BOOL     WINAPI SetupQueueRenameSectionW( HSPFILEQ, HINF, HINF, PCWSTR );
+#define         SetupQueueRenameSection WINELIB_NAME_AW(SetupQueueRenameSection)
+BOOL     WINAPI SetupScanFileQueueA( HSPFILEQ, DWORD, HWND, PSP_FILE_CALLBACK_A, PVOID, PDWORD );
+BOOL     WINAPI SetupScanFileQueueW( HSPFILEQ, DWORD, HWND, PSP_FILE_CALLBACK_W, PVOID, PDWORD );
+#define         SetupScanFileQueue WINELIB_NAME_AW(SetupScanFileQueue)
+BOOL     WINAPI SetupSetDirectoryIdA( HINF, DWORD, PCSTR );
+BOOL     WINAPI SetupSetDirectoryIdW( HINF, DWORD, PCWSTR );
+#define         SetupSetDirectoryId WINELIB_NAME_AW(SetupSetDirectoryId)
+BOOL     WINAPI SetupSetFileQueueAlternatePlatformA( HSPFILEQ, PSP_ALTPLATFORM_INFO, PCSTR );
+BOOL     WINAPI SetupSetFileQueueAlternatePlatformW( HSPFILEQ, PSP_ALTPLATFORM_INFO, PCWSTR );
+#define         SetupSetFileQueueAlternatePlatform WINELIB_NAME_AW(SetupSetFileQueueAlternatePlatform)
+BOOL     WINAPI SetupSetFileQueueFlags( HSPFILEQ, DWORD, DWORD );
+void     WINAPI SetupTermDefaultQueueCallback( PVOID );
+PSTR     WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
 
 #undef DECL_WINELIB_SETUPAPI_TYPE_AW
 

Modified: trunk/reactos/lib/setupapi/misc.c
--- trunk/reactos/lib/setupapi/misc.c	2005-01-30 12:56:12 UTC (rev 13366)
+++ trunk/reactos/lib/setupapi/misc.c	2005-01-30 13:48:51 UTC (rev 13367)
@@ -28,8 +28,11 @@
 #include "setupapi.h"
 
 #include "wine/unicode.h"
+#include "wine/debug.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
+
 /**************************************************************************
  * MyFree [SETUPAPI.@]
  *
@@ -41,9 +44,9 @@
  * RETURNS
  *     None
  */
-
 VOID WINAPI MyFree(LPVOID lpMem)
 {
+    TRACE("%p\n", lpMem);
     HeapFree(GetProcessHeap(), 0, lpMem);
 }
 
@@ -60,9 +63,9 @@
  *     Success: pointer to allocated memory block
  *     Failure: NULL
  */
-
 LPVOID WINAPI MyMalloc(DWORD dwSize)
 {
+    TRACE("%lu\n", dwSize);
     return HeapAlloc(GetProcessHeap(), 0, dwSize);
 }
 
@@ -85,9 +88,10 @@
  *     If lpSrc is a NULL-pointer, then MyRealloc allocates a memory
  *     block like MyMalloc.
  */
-
 LPVOID WINAPI MyRealloc(LPVOID lpSrc, DWORD dwSize)
 {
+    TRACE("%p %lu\n", lpSrc, dwSize);
+
     if (lpSrc == NULL)
         return HeapAlloc(GetProcessHeap(), 0, dwSize);
 
@@ -110,11 +114,12 @@
  * NOTES
  *     Call MyFree() to release the duplicated string.
  */
-
 LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc)
 {
     LPWSTR lpDst;
 
+    TRACE("%s\n", debugstr_w(lpSrc));
+
     lpDst = MyMalloc((lstrlenW(lpSrc) + 1) * sizeof(WCHAR));
     if (lpDst == NULL)
         return NULL;
@@ -145,7 +150,6 @@
  * NOTES
  *     Use MyFree to release the lpData buffer.
  */
-
 LONG WINAPI QueryRegistryValue(HKEY hKey,
                                LPCWSTR lpValueName,
                                LPBYTE  *lpData,
@@ -154,6 +158,9 @@
 {
     LONG lError;
 
+    TRACE("%lx %s %p %p %p\n",
+          hKey, debugstr_w(lpValueName), lpData, lpType, lpcbData);
+
     /* Get required buffer size */
     *lpcbData = 0;
     lError = RegQueryValueExW(hKey, lpValueName, 0, lpType, NULL, lpcbData);
@@ -172,3 +179,162 @@
 
     return lError;
 }
+
+
+/**************************************************************************
+ * IsUserAdmin [SETUPAPI.@]
+ *
+ * Checks whether the current user is a member of the Administrators group.
+ *
+ * PARAMS
+ *     None
+ *
+ * RETURNS
+ *     Success: TRUE
+ *     Failure: FALSE
+ */
+BOOL WINAPI IsUserAdmin(VOID)
+{
+    SID_IDENTIFIER_AUTHORITY Authority = {SECURITY_NT_AUTHORITY};
+    HANDLE hToken;
+    DWORD dwSize;
+    PTOKEN_GROUPS lpGroups;
+    PSID lpSid;
+    DWORD i;
+    BOOL bResult = FALSE;
+
+    TRACE("\n");
+
+    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
+        return FALSE;
+
+    if (!GetTokenInformation(hToken, TokenGroups, NULL, 0, &dwSize))
+    {
+        CloseHandle(hToken);
+        return FALSE;
+    }
+
+    lpGroups = MyMalloc(dwSize);
+    if (lpGroups == NULL)
+    {
+        CloseHandle(hToken);
+        return FALSE;
+    }
+
+    if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize))
+    {
+        MyFree(lpGroups);
+        CloseHandle(hToken);
+        return FALSE;
+    }
+
+    CloseHandle(hToken);
+
+    if (!AllocateAndInitializeSid(&Authority, 2, SECURITY_BUILTIN_DOMAIN_RID,
+                                  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
+                                  &lpSid))
+    {
+        MyFree(lpGroups);
+        return FALSE;
+    }
+
+    for (i = 0; i < lpGroups->GroupCount; i++)
+    {
+        if (EqualSid(lpSid, &lpGroups->Groups[i].Sid))
+        {
+            bResult = TRUE;
+            break;
+        }
+    }
+
+    FreeSid(lpSid);
+    MyFree(lpGroups);
+
+    return bResult;
+}
+
+
+/**************************************************************************
+ * MultiByteToUnicode [SETUPAPI.@]
+ *
+ * Converts a multi-byte string to a Unicode string.
+ *
+ * PARAMS
+ *     lpMultiByteStr  [I] Multi-byte string to be converted
+ *     uCodePage       [I] Code page
+ *
+ * RETURNS
+ *     Success: pointer to the converted Unicode string
+ *     Failure: NULL
+ *
+ * NOTE
+ *     Use MyFree to release the returned Unicode string.
+ */
+LPWSTR WINAPI MultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
+{
+    LPWSTR lpUnicodeStr;
+    int nLength;
+
+    TRACE("%s %lu\n", debugstr_a(lpMultiByteStr), uCodePage);
+
+    nLength = MultiByteToWideChar(uCodePage, 0, lpMultiByteStr,
+                                  -1, NULL, 0);
+    if (nLength == 0)
+        return NULL;
+
+    lpUnicodeStr = MyMalloc(nLength * sizeof(WCHAR));
+    if (lpUnicodeStr == NULL)
+        return NULL;
+
+    if (!MultiByteToWideChar(uCodePage, 0, lpMultiByteStr,
+                             nLength, lpUnicodeStr, nLength))
+    {
+        MyFree(lpUnicodeStr);
+        return NULL;
+    }
+
+    return lpUnicodeStr;
+}
+
+
+/**************************************************************************
+ * UnicodeToMultiByte [SETUPAPI.@]
+ *
+ * Converts a Unicode string to a multi-byte string.
+ *
+ * PARAMS
+ *     lpUnicodeStr  [I] Unicode string to be converted
+ *     uCodePage     [I] Code page
+ *
+ * RETURNS
+ *     Success: pointer to the converted multi-byte string
+ *     Failure: NULL
+ *
+ * NOTE
+ *     Use MyFree to release the returned multi-byte string.
+ */
+LPSTR WINAPI UnicodeToMultiByte(LPCWSTR lpUnicodeStr, UINT uCodePage)
+{
+    LPSTR lpMultiByteStr;
+    int nLength;
+
+    TRACE("%s %lu\n", debugstr_w(lpUnicodeStr), uCodePage);
+
+    nLength = WideCharToMultiByte(uCodePage, 0, lpUnicodeStr, -1,
+                                  NULL, 0, NULL, NULL);
+    if (nLength == 0)
+        return NULL;
+
+    lpMultiByteStr = MyMalloc(nLength);
+    if (lpMultiByteStr == NULL)
+        return NULL;
+
+    if (!WideCharToMultiByte(uCodePage, 0, lpUnicodeStr, -1,
+                             lpMultiByteStr, nLength, NULL, NULL))
+    {
+        MyFree(lpMultiByteStr);
+        return NULL;
+    }
+
+    return lpMultiByteStr;
+}

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-01-30 12:56:12 UTC (rev 13366)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-01-30 13:48:51 UTC (rev 13367)
@@ -97,8 +97,6 @@
 @ stub CM_Get_Device_Interface_List_SizeW
 @ stub CM_Get_Device_Interface_List_Size_ExA
 @ stub CM_Get_Device_Interface_List_Size_ExW
-@ stub CM_Request_Device_EjectA
-@ stub CM_Request_Device_EjectW
 @ stub CM_Get_First_Log_Conf
 @ stub CM_Get_First_Log_Conf_Ex
 @ stub CM_Get_Global_State
@@ -164,6 +162,8 @@
 @ stub CM_Remove_SubTree_Ex
 @ stub CM_Remove_Unmarked_Children
 @ stub CM_Remove_Unmarked_Children_Ex
+@ stub CM_Request_Device_EjectA
+@ stub CM_Request_Device_EjectW
 @ stub CM_Request_Eject_PC
 @ stub CM_Reset_Children_Marks
 @ stub CM_Reset_Children_Marks_Ex
@@ -214,10 +214,10 @@
 @ stdcall InstallHinfSectionW(long long wstr long)
 @ stub InstallStop
 @ stub InstallStopEx
-@ stub IsUserAdmin
+@ stdcall IsUserAdmin()
 @ stub LookUpStringInTable
 @ stub MemoryInitialize
-@ stub MultiByteToUnicode
+@ stdcall MultiByteToUnicode(str long)
 @ stub MultiSzFromSearchControl
 @ stdcall MyFree(ptr)
 @ stub MyGetFileTitle
@@ -527,7 +527,7 @@
 @ stub StringTableStringFromId
 @ stub StringTableTrim
 @ stub TakeOwnershipOfFile
-@ stub UnicodeToMultiByte
+@ stdcall UnicodeToMultiByte(wstr long)
 @ stub UnmapAndCloseFile
 @ stub VerifyCatalogFile
 @ stub VerifyFile