initial implementation of DeviceAdvancedPropertiesA/W

svn path=/trunk/; revision=19604
This commit is contained in:
Thomas Bluemel 2005-11-26 03:22:22 +00:00
parent 23970ac711
commit 2f90929822
5 changed files with 72 additions and 79 deletions

View 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>

View 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),

View 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,

View 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 */

View 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