Implement SetupDiGetActualSectionToInstallA
Implement SetupDiCreateDeviceInfoA
Add SetupDiCreateDeviceInfoW stub
Fix SetupDiOpenClassRegKeyExW, by adding { } around the GUID string when opening the registry key
Don't use L"..." notation for wide strings
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/devinst.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec

Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c	2005-07-03 12:18:23 UTC (rev 16390)
+++ trunk/reactos/lib/setupapi/cfgmgr.c	2005-07-03 13:46:33 UTC (rev 16391)
@@ -39,6 +39,13 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
+/* Registry key and value names */
+static const WCHAR ControlClass[] = {'S','y','s','t','e','m','\\',
+                                  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+                                  'C','o','n','t','r','o','l','\\',
+                                  'C','l','a','s','s',0};
+
+
 typedef struct _MACHINE_INFO
 {
   RPC_BINDING_HANDLE BindingHandle;
@@ -166,7 +173,7 @@
 
     rc = RegOpenKeyExW(
         hRelativeKey,
-        L"System\\CurrentControlSet\\Control\\Class",
+        ControlClass,
         0, /* options */
         KEY_ENUMERATE_SUB_KEYS,
         &hKey);

Modified: trunk/reactos/lib/setupapi/devinst.c
--- trunk/reactos/lib/setupapi/devinst.c	2005-07-03 12:18:23 UTC (rev 16390)
+++ trunk/reactos/lib/setupapi/devinst.c	2005-07-03 13:46:33 UTC (rev 16391)
@@ -292,7 +292,7 @@
     LPWSTR MachineNameW = NULL;
     BOOL bResult;
 
-    FIXME("\n");
+    TRACE("\n");
 
     ClassNameW = MultiByteToUnicode(ClassName, CP_ACP);
     if (ClassNameW == NULL)
@@ -630,8 +630,45 @@
         PDWORD RequiredSize,
         PSTR *Extension)
 {
-    FIXME("\n");
-    return FALSE;
+    LPWSTR InfSectionNameW = NULL;
+    PWSTR InfSectionWithExtW = NULL;
+    PWSTR ExtensionW;
+    BOOL bResult;
+
+    TRACE("\n");
+
+    if (InfSectionName)
+    {
+        InfSectionNameW = MultiByteToUnicode(InfSectionName, CP_ACP);
+        if (InfSectionNameW == NULL) goto end;
+    }
+    if (InfSectionWithExt)
+    {
+        InfSectionWithExtW = HeapAlloc(GetProcessHeap(), 0, InfSectionWithExtSize * sizeof(WCHAR));
+        if (InfSectionWithExtW == NULL) goto end;
+    }
+
+    bResult = SetupDiGetActualSectionToInstallW(InfHandle, InfSectionNameW,
+                                                InfSectionWithExt ? InfSectionNameW : NULL,
+                                                InfSectionWithExtSize, RequiredSize,
+                                                Extension ? &ExtensionW : NULL);
+
+    if (InfSectionWithExt)
+    {
+    }
+    if (Extension)
+    {
+        if (ExtensionW == NULL)
+            *Extension = NULL;
+         else
+            *Extension = &InfSectionWithExt[ExtensionW - InfSectionWithExtW];
+    }
+
+end:
+    if (InfSectionNameW) MyFree(InfSectionNameW);
+    if (InfSectionWithExtW) HeapFree(GetProcessHeap(), 0, InfSectionWithExtW);
+
+    return bResult;
 }
 
 /***********************************************************************
@@ -1394,6 +1431,8 @@
         PVOID Reserved)
 {
     LPWSTR lpGuidString;
+    LPWSTR lpFullGuidString;
+    DWORD dwLength;
     HKEY hClassesKey;
     HKEY hClassKey;
     LPCWSTR lpKeyName;
@@ -1437,18 +1476,31 @@
 	return INVALID_HANDLE_VALUE;
     }
 
+    dwLength = lstrlenW(lpGuidString);
+    lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
+    if (!lpFullGuidString)
+    {
+        RpcStringFreeW(&lpGuidString);
+        return INVALID_HANDLE_VALUE;
+    }
+    lpFullGuidString[0] = '{';
+    memcpy(&lpFullGuidString[1], lpGuidString, dwLength * sizeof(WCHAR));
+    lpFullGuidString[dwLength + 1] = '}';
+    lpFullGuidString[dwLength + 2] = UNICODE_NULL;
+    RpcStringFreeW(&lpGuidString);
+
     if (RegOpenKeyExW(hClassesKey,
-		      lpGuidString,
+		      lpFullGuidString,
 		      0,
 		      KEY_ALL_ACCESS,
 		      &hClassKey))
     {
-	RpcStringFreeW(&lpGuidString);
+	HeapFree(GetProcessHeap(), 0, lpFullGuidString);
 	RegCloseKey(hClassesKey);
 	return INVALID_HANDLE_VALUE;
     }
 
-    RpcStringFreeW(&lpGuidString);
+    HeapFree(GetProcessHeap(), 0, lpFullGuidString);
     RegCloseKey(hClassesKey);
 
     return hClassKey;
@@ -1535,3 +1587,65 @@
           Scope, HwProfile, KeyType, samDesired);
     return INVALID_HANDLE_VALUE;
 }
+
+/***********************************************************************
+ *		SetupDiCreateDeviceInfoA (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiCreateDeviceInfoA(
+       HDEVINFO DeviceInfoSet,
+       PCSTR DeviceName,
+       LPGUID ClassGuid,
+       PCSTR DeviceDescription,
+       HWND hwndParent,
+       DWORD CreationFlags,
+       PSP_DEVINFO_DATA DeviceInfoData)
+{
+    LPWSTR DeviceNameW = NULL;
+    LPWSTR DeviceDescriptionW = NULL;
+    BOOL bResult;
+
+    TRACE("\n");
+
+    if (DeviceName)
+    {
+        DeviceNameW = MultiByteToUnicode(DeviceName, CP_ACP);
+        if (DeviceNameW == NULL) return FALSE;
+    }
+    if (DeviceDescription)
+    {
+        DeviceDescriptionW = MultiByteToUnicode(DeviceDescription, CP_ACP);
+        if (DeviceDescriptionW == NULL)
+        {
+            if (DeviceNameW) MyFree(DeviceNameW);
+            return FALSE;
+        }
+    }
+
+    bResult = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW,
+                                       ClassGuid, DeviceDescriptionW,
+                                       hwndParent, CreationFlags,
+                                       DeviceInfoData);
+
+    if (DeviceNameW) MyFree(DeviceNameW);
+    if (DeviceDescriptionW) MyFree(DeviceDescriptionW);
+
+    return bResult;
+}
+
+/***********************************************************************
+ *		SetupDiCreateDeviceInfoW (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiCreateDeviceInfoW(
+       HDEVINFO DeviceInfoSet,
+       PCWSTR DeviceName,
+       LPGUID ClassGuid,
+       PCWSTR DeviceDescription,
+       HWND hwndParent,
+       DWORD CreationFlags,
+       PSP_DEVINFO_DATA DeviceInfoData)
+{
+    FIXME("%p %S %p %S %p %lx %p\n", DeviceInfoSet, debugstr_w(DeviceName),
+          ClassGuid, debugstr_w(DeviceDescription), hwndParent,
+          CreationFlags, DeviceInfoData);
+    return FALSE;
+}

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-07-03 12:18:23 UTC (rev 16390)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-07-03 13:46:33 UTC (rev 16391)
@@ -38,8 +38,8 @@
 @ stub CM_Dup_Range_List
 @ stub CM_Enable_DevNode
 @ stub CM_Enable_DevNode_Ex
-@ stub CM_Enumerate_Classes
-@ stub CM_Enumerate_Classes_Ex
+@ stdcall CM_Enumerate_Classes(long ptr long)
+@ stdcall CM_Enumerate_Classes_Ex(long ptr long ptr)
 @ stub CM_Enumerate_EnumeratorsA
 @ stub CM_Enumerate_EnumeratorsW
 @ stub CM_Enumerate_Enumerators_ExA
@@ -282,11 +282,11 @@
 @ stdcall SetupDiClassNameFromGuidW(ptr wstr long ptr)
 @ stub SetupDiCreateDevRegKeyA
 @ stub SetupDiCreateDevRegKeyW
-@ stub SetupDiCreateDeviceInfoA
+@ stdcall SetupDiCreateDeviceInfoA(ptr str ptr str ptr long ptr)
+@ stdcall SetupDiCreateDeviceInfoW(ptr wstr ptr wstr ptr long ptr)
 @ stdcall SetupDiCreateDeviceInfoList(ptr ptr)
 @ stdcall SetupDiCreateDeviceInfoListExA(ptr long str ptr)
-@ stdcall SetupDiCreateDeviceInfoListExW(ptr long str ptr)
-@ stub SetupDiCreateDeviceInfoW
+@ stdcall SetupDiCreateDeviceInfoListExW(ptr long wstr ptr)
 @ stub SetupDiDeleteDevRegKey
 @ stub SetupDiDeleteDeviceInfo
 @ stub SetupDiDeleteDeviceInterfaceData