initial implementation of DeviceAdvancedPropertiesA/W
authorThomas Bluemel <thomas@reactsoft.com>
Sat, 26 Nov 2005 03:22:22 +0000 (03:22 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sat, 26 Nov 2005 03:22:22 +0000 (03:22 +0000)
svn path=/trunk/; revision=19604

reactos/lib/devmgr/devmgr.xml
reactos/lib/devmgr/hwpage.c
reactos/lib/devmgr/misc.c
reactos/lib/devmgr/precomp.h
reactos/lib/devmgr/stubs.c

index 83cc49d..6e9b94c 100644 (file)
@@ -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>
index b596cac..801752f 100644 (file)
@@ -30,8 +30,6 @@
 #define NDEBUG
 #include <debug.h>
 
-typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
-
 typedef enum
 {
     HWPD_STANDARDLIST = 0,
@@ -978,7 +976,6 @@ DeviceCreateHardwarePageEx(IN HWND hWndParent,
                            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 @@ DeviceCreateHardwarePageEx(IN HWND hWndParent,
         }
 
         /* 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), 
index 66fcfa8..17db6cf 100644 (file)
@@ -149,6 +149,69 @@ ListViewGetSelectedItemData(IN HWND hwnd)
     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,
index baf6d8b..f0b26d4 100644 (file)
@@ -191,6 +191,13 @@ LoadAndFormatString(IN HINSTANCE hInstance,
 LPARAM
 ListViewGetSelectedItemData(IN HWND hwnd);
 
+LPWSTR
+ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
+                          IN UINT uCodePage);
+
+HINSTANCE
+LoadAndInitComctl32(VOID);
+
 #endif /* __DEVMGR_H */
 
 /* EOF */
index 0d80ee6..ffa37dc 100644 (file)
@@ -546,72 +546,6 @@ DeviceManagerPrintW(LPCWSTR lpMachineName,
 }
 
 
-/***************************************************************************
- * 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