initial implementation of DeviceAdvancedPropertiesA/W
Modified: trunk/reactos/lib/devmgr/devmgr.xml
Modified: trunk/reactos/lib/devmgr/hwpage.c
Modified: trunk/reactos/lib/devmgr/misc.c
Modified: trunk/reactos/lib/devmgr/precomp.h
Modified: trunk/reactos/lib/devmgr/stubs.c

Modified: trunk/reactos/lib/devmgr/devmgr.xml
--- trunk/reactos/lib/devmgr/devmgr.xml	2005-11-26 03:21:41 UTC (rev 19603)
+++ trunk/reactos/lib/devmgr/devmgr.xml	2005-11-26 03:22:22 UTC (rev 19604)
@@ -13,6 +13,7 @@
 	<library>setupapi</library>
 	<library>user32</library>
 	<file>devmgr.rc</file>
+	<file>advprop.c</file>
 	<file>hwpage.c</file>
 	<file>misc.c</file>
 	<file>stubs.c</file>

Modified: trunk/reactos/lib/devmgr/hwpage.c
--- trunk/reactos/lib/devmgr/hwpage.c	2005-11-26 03:21:41 UTC (rev 19603)
+++ trunk/reactos/lib/devmgr/hwpage.c	2005-11-26 03:22:22 UTC (rev 19604)
@@ -30,8 +30,6 @@
 #define NDEBUG
 #include <debug.h>
 
-typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
-
 typedef enum
 {
     HWPD_STANDARDLIST = 0,
@@ -978,7 +976,6 @@
                            IN HWPAGE_DISPLAYMODE DisplayMode)
 {
     PHARDWARE_PAGE_DATA hpd;
-    PINITCOMMONCONTROLS pInitCommonControls;
 
     /* allocate the HARDWARE_PAGE_DATA structure. Make sure it is
        zeroed because the initialization code assumes that in
@@ -1006,21 +1003,12 @@
         }
 
         /* load comctl32.dll dynamically */
-        hpd->hComCtl32 = LoadLibrary(TEXT("comctl32.dll"));
+        hpd->hComCtl32 = LoadAndInitComctl32();
         if (hpd->hComCtl32 == NULL)
         {
             goto Cleanup;
         }
 
-        /* initialize the common controls */
-        pInitCommonControls = (PINITCOMMONCONTROLS)GetProcAddress(hpd->hComCtl32,
-                                                                  "InitCommonControls");
-        if (pInitCommonControls == NULL)
-        {
-            goto Cleanup;
-        }
-        pInitCommonControls();
-
         /* create the dialog */
         hWnd = CreateDialogParam(hDllInstance,
                                  MAKEINTRESOURCE(IDD_HARDWARE), 

Modified: trunk/reactos/lib/devmgr/misc.c
--- trunk/reactos/lib/devmgr/misc.c	2005-11-26 03:21:41 UTC (rev 19603)
+++ trunk/reactos/lib/devmgr/misc.c	2005-11-26 03:22:22 UTC (rev 19604)
@@ -149,6 +149,69 @@
     return 0;
 }
 
+LPWSTR
+ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
+                          IN UINT uCodePage)
+{
+    LPWSTR lpUnicodeStr;
+    INT nLength;
+
+    nLength = MultiByteToWideChar(uCodePage,
+                                  0,
+                                  lpMultiByteStr,
+                                  -1,
+                                  NULL,
+                                  0);
+    if (nLength == 0)
+        return NULL;
+
+    lpUnicodeStr = HeapAlloc(GetProcessHeap(),
+                             0,
+                             nLength * sizeof(WCHAR));
+    if (lpUnicodeStr == NULL)
+        return NULL;
+
+    if (!MultiByteToWideChar(uCodePage,
+                             0,
+                             lpMultiByteStr,
+                             nLength,
+                             lpUnicodeStr,
+                             nLength))
+    {
+        HeapFree(GetProcessHeap(),
+                 0,
+                 lpUnicodeStr);
+        return NULL;
+    }
+
+    return lpUnicodeStr;
+}
+
+HINSTANCE
+LoadAndInitComctl32(VOID)
+{
+    typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
+    PINITCOMMONCONTROLS pInitCommonControls;
+    HINSTANCE hComCtl32;
+
+    hComCtl32 = LoadLibrary(L"comctl32.dll");
+    if (hComCtl32 != NULL)
+    {
+        /* initialize the common controls */
+        pInitCommonControls = (PINITCOMMONCONTROLS)GetProcAddress(hComCtl32,
+                                                                  "InitCommonControls");
+        if (pInitCommonControls == NULL)
+        {
+            FreeLibrary(hComCtl32);
+            return NULL;
+        }
+
+        pInitCommonControls();
+    }
+
+    return hComCtl32;
+}
+
 BOOL
 STDCALL
 DllMain(IN HINSTANCE hinstDLL,

Modified: trunk/reactos/lib/devmgr/precomp.h
--- trunk/reactos/lib/devmgr/precomp.h	2005-11-26 03:21:41 UTC (rev 19603)
+++ trunk/reactos/lib/devmgr/precomp.h	2005-11-26 03:22:22 UTC (rev 19604)
@@ -191,6 +191,13 @@
 LPARAM
 ListViewGetSelectedItemData(IN HWND hwnd);
 
+LPWSTR
+ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
+                          IN UINT uCodePage);
+
+HINSTANCE
+LoadAndInitComctl32(VOID);
+
 #endif /* __DEVMGR_H */
 
 /* EOF */

Modified: trunk/reactos/lib/devmgr/stubs.c
--- trunk/reactos/lib/devmgr/stubs.c	2005-11-26 03:21:41 UTC (rev 19603)
+++ trunk/reactos/lib/devmgr/stubs.c	2005-11-26 03:22:22 UTC (rev 19604)
@@ -548,72 +548,6 @@
 
 /***************************************************************************
  * NAME                                                         EXPORTED
- *      DeviceAdvancedPropertiesA
- *
- * DESCRIPTION
- *   Invokes the device properties dialog, this version may add some property pages
- *   for some devices
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *
- * RETURN VALUE
- *   -1: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- *
- * @unimplemented
- */
-int
-WINAPI
-DeviceAdvancedPropertiesA(HWND hWndParent,
-                          LPCSTR lpMachineName,
-                          LPCSTR lpDeviceID)
-{
-  UNIMPLEMENTED;
-  return -1;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceAdvancedPropertiesW
- *
- * DESCRIPTION
- *   Invokes the device properties dialog, this version may add some property pages
- *   for some devices
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *
- * RETURN VALUE
- *   -1: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- *
- * @unimplemented
- */
-int
-WINAPI
-DeviceAdvancedPropertiesW(HWND hWndParent,
-                          LPCWSTR lpMachineName,
-                          LPCWSTR lpDeviceID)
-{
-  UNIMPLEMENTED;
-  return -1;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
  *      DevicePropertiesExA
  *
  * DESCRIPTION