mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
partly implemented DeviceProblemWizardA/W
svn path=/trunk/; revision=19839
This commit is contained in:
parent
f68fa88629
commit
d792c652cf
7 changed files with 287 additions and 80 deletions
|
@ -17,6 +17,8 @@ BEGIN
|
|||
IDS_UNKNOWNDEVICE "Unknown device"
|
||||
IDS_NODRIVERLOADED "No drivers are installed for this device."
|
||||
IDS_DEVONPARENT "on %1"
|
||||
IDS_TROUBLESHOOTDEV "&Troubleshoot..."
|
||||
IDS_ENABLEDEV "E&nable Device"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
@ -104,7 +106,7 @@ BEGIN
|
|||
EDITTEXT IDC_DEVLOCATION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY
|
||||
GROUPBOX "Device status", IDC_DEVSTATUSGROUP, 7, 83, 238, 100
|
||||
EDITTEXT IDC_DEVSTATUS, 14, 96, 224, 61, NOT WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
|
||||
PUSHBUTTON "&Troubleshoot...", IDC_TROUBLESHOOT, 148, 163, 90, 15
|
||||
PUSHBUTTON "&Troubleshoot...", IDC_DEVPROBLEM, 148, 163, 90, 15
|
||||
LTEXT "&Device usage:", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED
|
||||
COMBOBOX IDC_DEVUSAGE, 7, 198, 239, 40, CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED
|
||||
END
|
||||
|
|
|
@ -218,8 +218,10 @@ UpdateDevInfo(IN HWND hwndDlg,
|
|||
IN BOOL ReOpen)
|
||||
{
|
||||
HICON hIcon;
|
||||
HWND hDevUsage;
|
||||
HWND hPropSheetDlg;
|
||||
HWND hDevUsage, hPropSheetDlg, hDevProbBtn;
|
||||
CONFIGRET cr;
|
||||
ULONG Status, ProblemNumber;
|
||||
UINT TroubleShootStrId = IDS_TROUBLESHOOTDEV;
|
||||
BOOL bFlag;
|
||||
DWORD i;
|
||||
HDEVINFO DeviceInfoSet = NULL;
|
||||
|
@ -458,6 +460,31 @@ GetParentNode:
|
|||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device troubleshoot button text and disable it if necessary */
|
||||
hDevProbBtn = GetDlgItem(hwndDlg,
|
||||
IDC_DEVPROBLEM);
|
||||
EnableWindow(hDevProbBtn,
|
||||
dap->IsAdmin);
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DeviceInfoData->DevInst,
|
||||
0,
|
||||
dap->hMachine);
|
||||
if (cr == CR_SUCCESS &&
|
||||
(Status & DN_HAS_PROBLEM) && ProblemNumber == CM_PROB_DISABLED)
|
||||
{
|
||||
TroubleShootStrId = IDS_ENABLEDEV;
|
||||
}
|
||||
|
||||
if (LoadString(hDllInstance,
|
||||
TroubleShootStrId,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])) != 0)
|
||||
{
|
||||
SetWindowText(hDevProbBtn,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* check if the device can be enabled/disabled */
|
||||
hDevUsage = GetDlgItem(hwndDlg,
|
||||
IDC_DEVUSAGE);
|
||||
|
@ -579,6 +606,19 @@ AdvPropGeneralDlgProc(IN HWND hwndDlg,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_DEVPROBLEM:
|
||||
{
|
||||
if (dap->IsAdmin)
|
||||
{
|
||||
/* display the device problem wizard */
|
||||
ShowDeviceProblemWizard(hwndDlg,
|
||||
dap->DeviceInfoSet,
|
||||
&dap->DeviceInfoData,
|
||||
dap->hMachine);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -959,6 +999,12 @@ DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
|
|||
HINSTANCE hComCtl32;
|
||||
INT_PTR Ret = -1;
|
||||
|
||||
if (lpDeviceID == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* dynamically load comctl32 */
|
||||
hComCtl32 = LoadAndInitComctl32();
|
||||
if (hComCtl32 != NULL)
|
||||
|
@ -1072,7 +1118,8 @@ Cleanup:
|
|||
* 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
|
||||
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
||||
* bShowDevMgr is nonzero
|
||||
* 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
|
||||
|
@ -1150,7 +1197,8 @@ Cleanup:
|
|||
* 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
|
||||
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
||||
* bShowDevMgr is nonzero
|
||||
* 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
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<library>user32</library>
|
||||
<file>devmgr.rc</file>
|
||||
<file>advprop.c</file>
|
||||
<file>devprblm.c</file>
|
||||
<file>hwpage.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>stubs.c</file>
|
||||
|
|
212
reactos/lib/devmgr/devprblm.c
Normal file
212
reactos/lib/devmgr/devprblm.c
Normal file
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
* ReactOS Device Manager Applet
|
||||
* Copyright (C) 2004 - 2005 ReactOS Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Id: hwpage.c 19599 2005-11-26 02:12:58Z weiden $
|
||||
*
|
||||
* PROJECT: ReactOS devmgr.dll
|
||||
* FILE: lib/devmgr/devprblm.c
|
||||
* PURPOSE: ReactOS Device Manager
|
||||
* PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
|
||||
* UPDATE HISTORY:
|
||||
* 04-04-2004 Created
|
||||
*/
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
BOOL
|
||||
ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL,
|
||||
IN HDEVINFO hDevInfo,
|
||||
IN PSP_DEVINFO_DATA DevInfoData,
|
||||
IN HMACHINE hMachine OPTIONAL)
|
||||
{
|
||||
CONFIGRET cr;
|
||||
ULONG Status, ProblemNumber;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInfoData->DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
|
||||
{
|
||||
switch (ProblemNumber)
|
||||
{
|
||||
case CM_PROB_DISABLED:
|
||||
{
|
||||
/* FIXME - display the "Enable Device" wizard */
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
/* FIXME - troubleshoot the device */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* NAME EXPORTED
|
||||
* DeviceProblemWizardA
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Calls the device problem wizard
|
||||
*
|
||||
* ARGUMENTS
|
||||
* hWndParent: Handle to the parent window
|
||||
* lpMachineName: Machine Name, NULL is the local machine
|
||||
* lpDeviceID: Specifies the device, also see NOTEs
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE: if no errors occured
|
||||
* FALSE: if errors occured
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardA(IN HWND hWndParent OPTIONAL,
|
||||
IN LPCSTR lpMachineName OPTIONAL,
|
||||
IN LPCSTR lpDeviceID)
|
||||
{
|
||||
LPWSTR lpMachineNameW = NULL;
|
||||
LPWSTR lpDeviceIDW = NULL;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
if (lpMachineName != NULL)
|
||||
{
|
||||
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
||||
CP_ACP)))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
if (lpDeviceID != NULL)
|
||||
{
|
||||
if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
|
||||
CP_ACP)))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
Ret = DeviceProblemWizardW(hWndParent,
|
||||
lpMachineNameW,
|
||||
lpDeviceIDW);
|
||||
|
||||
Cleanup:
|
||||
if (lpMachineNameW != NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
lpMachineNameW);
|
||||
}
|
||||
if (lpDeviceIDW != NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
lpDeviceIDW);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* NAME EXPORTED
|
||||
* DeviceProblemWizardW
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Calls the device problem wizard
|
||||
*
|
||||
* ARGUMENTS
|
||||
* hWndParent: Handle to the parent window
|
||||
* lpMachineName: Machine Name, NULL is the local machine
|
||||
* lpDeviceID: Specifies the device, also see NOTEs
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE: if no errors occured
|
||||
* FALSE: if errors occured
|
||||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardW(IN HWND hWndParent OPTIONAL,
|
||||
IN LPCWSTR lpMachineName OPTIONAL,
|
||||
IN LPCWSTR lpDeviceID)
|
||||
{
|
||||
HDEVINFO hDevInfo;
|
||||
SP_DEVINFO_DATA DevInfoData;
|
||||
HINSTANCE hComCtl32;
|
||||
CONFIGRET cr;
|
||||
HMACHINE hMachine;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
if (lpDeviceID == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* dynamically load comctl32 */
|
||||
hComCtl32 = LoadAndInitComctl32();
|
||||
if (hComCtl32 != NULL)
|
||||
{
|
||||
hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
|
||||
hWndParent,
|
||||
lpMachineName,
|
||||
NULL);
|
||||
if (hDevInfo != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
cr = CM_Connect_Machine(lpMachineName,
|
||||
&hMachine);
|
||||
if (cr == CR_SUCCESS)
|
||||
{
|
||||
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
if (SetupDiOpenDeviceInfo(hDevInfo,
|
||||
lpDeviceID,
|
||||
hWndParent,
|
||||
0,
|
||||
&DevInfoData))
|
||||
{
|
||||
Ret = ShowDeviceProblemWizard(hWndParent,
|
||||
hDevInfo,
|
||||
&DevInfoData,
|
||||
hMachine);
|
||||
}
|
||||
|
||||
CM_Disconnect_Machine(hMachine);
|
||||
}
|
||||
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
}
|
||||
|
||||
FreeLibrary(hComCtl32);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
|
@ -71,18 +71,18 @@ DeviceProblemTextW(PVOID Unknown1,
|
|||
LPWSTR lpString,
|
||||
UINT uMaxString);
|
||||
|
||||
WINBOOL
|
||||
BOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardA(HWND hWndParent,
|
||||
LPCSTR lpMachineName,
|
||||
LPCSTR lpDeviceID);
|
||||
DeviceProblemWizardA(IN HWND hWndParent OPTIONAL,
|
||||
IN LPCSTR lpMachineName OPTIONAL,
|
||||
IN LPCSTR lpDeviceID);
|
||||
|
||||
|
||||
WINBOOL
|
||||
BOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardW(HWND hWndParent,
|
||||
LPCWSTR lpMachineName,
|
||||
LPCWSTR lpDeviceID);
|
||||
DeviceProblemWizardW(IN HWND hWndParent OPTIONAL,
|
||||
IN LPCWSTR lpMachineName OPTIONAL,
|
||||
IN LPCWSTR lpDeviceID);
|
||||
|
||||
VOID
|
||||
WINAPI
|
||||
|
@ -200,6 +200,14 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
|
|||
IN LPCWSTR lpMachineName,
|
||||
IN DWORD dwFlags);
|
||||
|
||||
/* DEVPRBLM.C */
|
||||
|
||||
BOOL
|
||||
ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL,
|
||||
IN HDEVINFO hDevInfo,
|
||||
IN PSP_DEVINFO_DATA DevInfoData,
|
||||
IN HMACHINE hMachine OPTIONAL);
|
||||
|
||||
/* MISC.C */
|
||||
|
||||
DWORD
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define IDC_TROUBLESHOOT 0x589
|
||||
#define IDC_PROPERTIES 0x58A
|
||||
#define IDC_DEVUSAGELABEL 0x58B
|
||||
|
||||
#define IDC_DEVPROBLEM 0x58C
|
||||
|
||||
#define IDS_NAME 0x100
|
||||
#define IDS_TYPE 0x101
|
||||
|
@ -38,6 +38,8 @@
|
|||
#define IDS_UNKNOWNDEVICE 0x10A
|
||||
#define IDS_NODRIVERLOADED 0x10B
|
||||
#define IDS_DEVONPARENT 0x10C
|
||||
#define IDS_TROUBLESHOOTDEV 0x10D
|
||||
#define IDS_ENABLEDEV 0x10E
|
||||
|
||||
#define IDS_DEV_NO_PROBLEM 0x200
|
||||
#define IDS_DEV_NOT_CONFIGURED 0x201
|
||||
|
|
|
@ -316,72 +316,6 @@ DeviceProblemTextW(PVOID Unknown1,
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* NAME EXPORTED
|
||||
* DeviceProblemWizardA
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Calls the device problem wizard
|
||||
*
|
||||
* ARGUMENTS
|
||||
* hWndParent: Handle to the parent window
|
||||
* lpMachineName: Machine Name, NULL is the local machine
|
||||
* lpDeviceID: Specifies the device, also see NOTEs
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE: if no errors occured
|
||||
* FALSE: if errors occured
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
* NOTE
|
||||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardA(HWND hWndParent,
|
||||
LPCSTR lpMachineName,
|
||||
LPCSTR lpDeviceID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* NAME EXPORTED
|
||||
* DeviceProblemWizardW
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Calls the device problem wizard
|
||||
*
|
||||
* ARGUMENTS
|
||||
* hWndParent: Handle to the parent window
|
||||
* lpMachineName: Machine Name, NULL is the local machine
|
||||
* lpDeviceID: Specifies the device, also see NOTEs
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE: if no errors occured
|
||||
* FALSE: if errors occured
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
* NOTE
|
||||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
WINAPI
|
||||
DeviceProblemWizardW(HWND hWndParent,
|
||||
LPCWSTR lpMachineName,
|
||||
LPCWSTR lpDeviceID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* NAME EXPORTED
|
||||
* DeviceProblemWizard_RunDLLA
|
||||
|
|
Loading…
Reference in a new issue