Modified: trunk/reactos/lib/devmgr/advprop.c
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
--- trunk/reactos/lib/devmgr/advprop.c 2005-12-03 11:55:07 UTC (rev 19836)
+++ trunk/reactos/lib/devmgr/advprop.c 2005-12-03 14:07:38 UTC (rev 19837)
@@ -67,6 +67,7 @@
BOOL DeviceUsageChanged : 1;
BOOL CloseDevInst : 1;
BOOL IsAdmin : 1;
+ BOOL DoDefaultDevAction : 1;
WCHAR szDevName[255];
WCHAR szTemp[255];
@@ -682,7 +683,8 @@
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
IN HINSTANCE hComCtl32,
- IN LPCWSTR lpMachineName)
+ IN LPCWSTR lpMachineName,
+ IN DWORD dwFlags)
{
PROPSHEETHEADER psh = {0};
PROPSHEETPAGE pspGeneral = {0};
@@ -755,6 +757,7 @@
(DevIdSize * sizeof(WCHAR)));
if (DevAdvPropInfo == NULL)
{
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto Cleanup;
}
@@ -788,6 +791,7 @@
DevAdvPropInfo->hComCtl32 = hComCtl32;
DevAdvPropInfo->IsAdmin = IsUserAdmin();
+ DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0);
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPTITLE | PSH_NOAPPLYNOW;
@@ -940,19 +944,15 @@
* lpDeviceID: Specifies the device whose properties are to be shown
*
* RETURN VALUE
- * -1: if errors occured
+ * Always returns -1, a call to GetLastError returns 0 if successful
*
- * REVISIONS
- *
- * NOTE
- *
* @implemented
*/
INT_PTR
WINAPI
-DeviceAdvancedPropertiesW(HWND hWndParent,
- LPCWSTR lpMachineName,
- LPCWSTR lpDeviceID)
+DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
+ IN LPCWSTR lpMachineName OPTIONAL,
+ IN LPCWSTR lpDeviceID)
{
HDEVINFO hDevInfo;
SP_DEVINFO_DATA DevInfoData;
@@ -981,7 +981,8 @@
hDevInfo,
&DevInfoData,
hComCtl32,
- lpMachineName);
+ lpMachineName,
+ 0);
}
SetupDiDestroyDeviceInfoList(hDevInfo);
@@ -1008,19 +1009,15 @@
* lpDeviceID: Specifies the device whose properties are to be shown
*
* RETURN VALUE
- * -1: if errors occured
+ * Always returns -1, a call to GetLastError returns 0 if successful
*
- * REVISIONS
- *
- * NOTE
- *
* @implemented
*/
INT_PTR
WINAPI
-DeviceAdvancedPropertiesA(HWND hWndParent,
- LPCSTR lpMachineName,
- LPCSTR lpDeviceID)
+DeviceAdvancedPropertiesA(IN HWND hWndParent OPTIONAL,
+ IN LPCSTR lpMachineName OPTIONAL,
+ IN LPCSTR lpDeviceID)
{
LPWSTR lpMachineNameW = NULL;
LPWSTR lpDeviceIDW = NULL;
@@ -1063,3 +1060,178 @@
return Ret;
}
+
+
+/***************************************************************************
+ * NAME EXPORTED
+ * DevicePropertiesExA
+ *
+ * DESCRIPTION
+ * Invokes the extended device properties dialog
+ *
+ * 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
+ * dwFlags: This parameter can be a combination of the following flags:
+ * * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
+ * the default device status action button
+ * to be clicked (Troubleshoot, Enable
+ * Device, etc)
+ * bShowDevMgr: If non-zero it displays the device manager instead of
+ * the advanced device property dialog
+ *
+ * RETURN VALUE
+ * 1: if bShowDevMgr is non-zero and no error occured
+ * -1: a call to GetLastError returns 0 if successful
+ *
+ * @implemented
+ */
+INT_PTR
+WINAPI
+DevicePropertiesExA(IN HWND hWndParent OPTIONAL,
+ IN LPCSTR lpMachineName OPTIONAL,
+ IN LPCSTR lpDeviceID OPTIONAL,
+ IN DWORD dwFlags OPTIONAL,
+ IN BOOL bShowDevMgr)
+{
+ LPWSTR lpMachineNameW = NULL;
+ LPWSTR lpDeviceIDW = NULL;
+ INT_PTR Ret = -1;
+
+ if (lpMachineName != NULL)
+ {
+ if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
+ CP_ACP)))
+ {
+ goto Cleanup;
+ }
+ }
+ if (lpDeviceID != NULL)
+ {
+ if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
+ CP_ACP)))
+ {
+ goto Cleanup;
+ }
+ }
+
+ Ret = DevicePropertiesExW(hWndParent,
+ lpMachineNameW,
+ lpDeviceIDW,
+ dwFlags,
+ bShowDevMgr);
+
+Cleanup:
+ if (lpMachineNameW != NULL)
+ {
+ HeapFree(GetProcessHeap(),
+ 0,
+ lpMachineNameW);
+ }
+ if (lpDeviceIDW != NULL)
+ {
+ HeapFree(GetProcessHeap(),
+ 0,
+ lpDeviceIDW);
+ }
+
+ return Ret;
+}
+
+
+/***************************************************************************
+ * NAME EXPORTED
+ * DevicePropertiesExW
+ *
+ * DESCRIPTION
+ * Invokes the extended device properties dialog
+ *
+ * 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
+ * dwFlags: This parameter can be a combination of the following flags:
+ * * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
+ * the default device status action button
+ * to be clicked (Troubleshoot, Enable
+ * Device, etc)
+ * bShowDevMgr: If non-zero it displays the device manager instead of
+ * the advanced device property dialog
+ *
+ * RETURN VALUE
+ * 1: if bShowDevMgr is non-zero and no error occured
+ * -1: a call to GetLastError returns 0 if successful
+ *
+ * @unimplemented
+ */
+INT_PTR
+WINAPI
+DevicePropertiesExW(IN HWND hWndParent OPTIONAL,
+ IN LPCWSTR lpMachineName OPTIONAL,
+ IN LPCWSTR lpDeviceID OPTIONAL,
+ IN DWORD dwFlags OPTIONAL,
+ IN BOOL bShowDevMgr)
+{
+ INT_PTR Ret = -1;
+
+ if (dwFlags & ~(DPF_UNKNOWN | DPF_DEVICE_STATUS_ACTION))
+ {
+ DPRINT1("DevPropertiesExW: Invalid flags: 0x%x\n",
+ dwFlags & ~(DPF_UNKNOWN | DPF_DEVICE_STATUS_ACTION));
+ SetLastError(ERROR_INVALID_FLAGS);
+ return -1;
+ }
+
+ if (bShowDevMgr)
+ {
+ DPRINT("DevPropertiesExW doesn't support bShowDevMgr!\n");
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ }
+ else
+ {
+ HDEVINFO hDevInfo;
+ SP_DEVINFO_DATA DevInfoData;
+ HINSTANCE hComCtl32;
+
+ if (lpDeviceID == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return -1;
+ }
+
+ /* dynamically load comctl32 */
+ hComCtl32 = LoadAndInitComctl32();
+ if (hComCtl32 != NULL)
+ {
+ hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
+ hWndParent,
+ lpMachineName,
+ NULL);
+ if (hDevInfo != INVALID_HANDLE_VALUE)
+ {
+ DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+ if (SetupDiOpenDeviceInfo(hDevInfo,
+ lpDeviceID,
+ hWndParent,
+ 0,
+ &DevInfoData))
+ {
+ Ret = DisplayDeviceAdvancedProperties(hWndParent,
+ lpDeviceID,
+ hDevInfo,
+ &DevInfoData,
+ hComCtl32,
+ lpMachineName,
+ dwFlags);
+ }
+
+ SetupDiDestroyDeviceInfoList(hDevInfo);
+ }
+
+ FreeLibrary(hComCtl32);
+ }
+ }
+
+ return Ret;
+}
--- trunk/reactos/lib/devmgr/hwpage.c 2005-12-03 11:55:07 UTC (rev 19836)
+++ trunk/reactos/lib/devmgr/hwpage.c 2005-12-03 14:07:38 UTC (rev 19837)
@@ -30,13 +30,6 @@
#define NDEBUG
#include <debug.h>
-typedef enum
-{
- HWPD_STANDARDLIST = 0,
- HWPD_LARGELIST,
- HWPD_MAX = HWPD_LARGELIST
-} HWPAGE_DISPLAYMODE, *PHWPAGE_DISPLAYMODE;
-
typedef struct _HWDEVINFO
{
struct _HWCLASSDEVINFO *ClassDevInfo;
@@ -139,7 +132,8 @@
HwDevInfo->ClassDevInfo->hDevInfo,
&HwDevInfo->DevInfoData,
hpd->hComCtl32,
- NULL) != -1;
+ NULL,
+ 0) != -1;
}
return Ret;
--- trunk/reactos/lib/devmgr/misc.c 2005-12-03 11:55:07 UTC (rev 19836)
+++ trunk/reactos/lib/devmgr/misc.c 2005-12-03 14:07:38 UTC (rev 19837)
@@ -254,7 +254,10 @@
0,
nLength * sizeof(WCHAR));
if (lpUnicodeStr == NULL)
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
+ }
if (!MultiByteToWideChar(uCodePage,
0,
--- trunk/reactos/lib/devmgr/precomp.h 2005-12-03 11:55:07 UTC (rev 19836)
+++ trunk/reactos/lib/devmgr/precomp.h 2005-12-03 14:07:38 UTC (rev 19837)
@@ -120,16 +120,23 @@
INT_PTR
WINAPI
-DeviceAdvancedPropertiesA(HWND hWndParent,
- LPCSTR lpMachineName,
- LPCSTR lpDeviceID);
+DeviceAdvancedPropertiesA(IN HWND hWndParent OPTIONAL,
+ IN LPCSTR lpMachineName OPTIONAL,
+ IN LPCSTR lpDeviceID);
INT_PTR
WINAPI
-DeviceAdvancedPropertiesW(HWND hWndParent,
- LPCWSTR lpMachineName,
- LPCWSTR lpDeviceID);
+DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
+ IN LPCWSTR lpMachineName OPTIONAL,
+ IN LPCWSTR lpDeviceID);
+typedef enum
+{
+ HWPD_STANDARDLIST = 0,
+ HWPD_LARGELIST,
+ HWPD_MAX = HWPD_LARGELIST
+} HWPAGE_DISPLAYMODE, *PHWPAGE_DISPLAYMODE;
+
HWND
WINAPI
DeviceCreateHardwarePage(HWND hWndParent,
@@ -137,26 +144,28 @@
HWND
WINAPI
-DeviceCreateHardwarePageEx(HWND hWndParent,
- LPGUID lpGuids,
- UINT uNumberOfGuids,
- UINT Unknown);
+DeviceCreateHardwarePageEx(IN HWND hWndParent,
+ IN LPGUID lpGuids,
+ IN UINT uNumberOfGuids,
+ IN HWPAGE_DISPLAYMODE DisplayMode);
-int
+#define DPF_UNKNOWN (0x1)
+#define DPF_DEVICE_STATUS_ACTION (0x2)
+INT_PTR
WINAPI
-DevicePropertiesExA(HWND hWndParent,
- LPCSTR lpMachineName,
- LPCSTR lpDeviceID,
- HINSTANCE hInst,
- DWORD Unknown);
+DevicePropertiesExA(IN HWND hWndParent OPTIONAL,
+ IN LPCSTR lpMachineName OPTIONAL,
+ IN LPCSTR lpDeviceID OPTIONAL,
+ IN DWORD dwFlags OPTIONAL,
+ IN BOOL bShowDevMgr);
-int
+INT_PTR
WINAPI
-DevicePropertiesExW(HWND hWndParent,
- LPCWSTR lpMachineName,
- LPCWSTR lpDeviceID,
- HINSTANCE hInst,
- DWORD Unknown);
+DevicePropertiesExW(IN HWND hWndParent OPTIONAL,
+ IN LPCWSTR lpMachineName OPTIONAL,
+ IN LPCWSTR lpDeviceID OPTIONAL,
+ IN DWORD dwFlags OPTIONAL,
+ IN BOOL bShowDevMgr);
#ifdef UNICODE
#define DeviceManager_Execute DeviceManager_ExecuteW
@@ -188,7 +197,8 @@
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
IN HINSTANCE hComCtl32,
- IN LPCWSTR lpMachineName);
+ IN LPCWSTR lpMachineName,
+ IN DWORD dwFlags);
/* MISC.C */
--- trunk/reactos/lib/devmgr/stubs.c 2005-12-03 11:55:07 UTC (rev 19836)
+++ trunk/reactos/lib/devmgr/stubs.c 2005-12-03 14:07:38 UTC (rev 19837)
@@ -544,79 +544,3 @@
UNIMPLEMENTED;
return FALSE;
}
-
-
-/***************************************************************************
- * NAME EXPORTED
- * DevicePropertiesExA
- *
- * DESCRIPTION
- * Invokes the extended device properties dialog
- *
- * ARGUMENTS
- * hWndParent: Handle to the parent window
- * hInst: Handle to the application instance
- * lpMachineName: Machine Name, NULL is the local machine
- * lpDeviceID: Specifies the device whose properties are to be shown
- * Unknown: Unknown parameter, see NOTEs
- *
- * RETURN VALUE
- * >=0: if no errors occured
- * -1: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- * Unknown seems to be a BOOL, not sure what it affects
- *
- * @unimplemented
- */
-int
-WINAPI
-DevicePropertiesExA(HWND hWndParent,
- LPCSTR lpMachineName,
- LPCSTR lpDeviceID,
- HINSTANCE hInst,
- DWORD Unknown)
-{
- UNIMPLEMENTED;
- return -1;
-}
-
-
-/***************************************************************************
- * NAME EXPORTED
- * DevicePropertiesExW
- *
- * DESCRIPTION
- * Invokes the extended device properties dialog
- *
- * ARGUMENTS
- * hWndParent: Handle to the parent window
- * hInst: Handle to the application instance
- * lpMachineName: Machine Name, NULL is the local machine
- * lpDeviceID: Specifies the device whose properties are to be shown
- * Unknown: Unknown parameter, see NOTEs
- *
- * RETURN VALUE
- * >=0: if no errors occured
- * -1: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- * Unknown seems to be a BOOL, not sure what it affects
- *
- * @unimplemented
- */
-int
-WINAPI
-DevicePropertiesExW(HWND hWndParent,
- LPCWSTR lpMachineName,
- LPCWSTR lpDeviceID,
- HINSTANCE hInst,
- DWORD Unknown)
-{
- UNIMPLEMENTED;
- return -1;
-}