2 * ReactOS Device Manager Applet
3 * Copyright (C) 2004 - 2005 ReactOS Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /* $Id: hwpage.c 19599 2005-11-26 02:12:58Z weiden $
21 * PROJECT: ReactOS devmgr.dll
22 * FILE: lib/devmgr/devprblm.c
23 * PURPOSE: ReactOS Device Manager
24 * PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
35 ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL
,
37 IN PSP_DEVINFO_DATA DevInfoData
,
38 IN HMACHINE hMachine OPTIONAL
)
41 ULONG Status
, ProblemNumber
;
44 cr
= CM_Get_DevNode_Status_Ex(&Status
,
49 if (cr
== CR_SUCCESS
&& (Status
& DN_HAS_PROBLEM
))
51 switch (ProblemNumber
)
53 case CM_PROB_DEVLOADER_FAILED
:
55 /* FIXME - only if it's not a root bus devloader */
56 /* FIXME - display the update driver wizard */
60 case CM_PROB_OUT_OF_MEMORY
:
61 case CM_PROB_ENTRY_IS_WRONG_TYPE
:
62 case CM_PROB_LACKED_ARBITRATOR
:
63 case CM_PROB_FAILED_START
:
65 case CM_PROB_UNKNOWN_RESOURCE
:
67 /* FIXME - display the update driver wizard */
71 case CM_PROB_BOOT_CONFIG_CONFLICT
:
72 case CM_PROB_NORMAL_CONFLICT
:
73 case CM_PROB_REENUMERATION
:
75 /* FIXME - display the conflict wizard */
79 case CM_PROB_FAILED_FILTER
:
80 case CM_PROB_REINSTALL
:
81 case CM_PROB_FAILED_INSTALL
:
83 /* FIXME - display the driver (re)installation wizard */
87 case CM_PROB_DEVLOADER_NOT_FOUND
:
90 1) if it's a missing system devloader:
92 2) if it's not a system devloader but still missing:
93 - display the driver reinstallation wizard
94 3) if it's not a system devloader but the file can be found:
95 - display the update driver wizard
96 4) if it's a missing or empty software key
97 - display the update driver wizard
102 case CM_PROB_INVALID_DATA
:
103 case CM_PROB_PARTIAL_LOG_CONF
:
104 case CM_PROB_NO_VALID_LOG_CONF
:
105 case CM_PROB_HARDWARE_DISABLED
:
106 case CM_PROB_CANT_SHARE_IRQ
:
107 case CM_PROB_TRANSLATION_FAILED
:
108 case CM_PROB_SYSTEM_SHUTDOWN
:
109 case CM_PROB_PHANTOM
:
110 /* FIXME - do nothing */
113 case CM_PROB_NOT_VERIFIED
:
114 case CM_PROB_DEVICE_NOT_THERE
:
115 /* FIXME - display search hardware wizard */
118 case CM_PROB_NEED_RESTART
:
119 case CM_PROB_WILL_BE_REMOVED
:
121 case CM_PROB_TOO_EARLY
:
122 case CM_PROB_DISABLED_SERVICE
:
123 /* FIXME - reboot computer */
126 case CM_PROB_REGISTRY
:
127 /* FIXME - check registry */
130 case CM_PROB_DISABLED
:
132 /* FIXME - if device was disabled by user display the "Enable Device" wizard,
133 otherwise Troubleshoot because the device was disabled by the system */
137 case CM_PROB_DEVLOADER_NOT_READY
:
139 /* FIXME - if it's a graphics adapter:
140 - if it's a a secondary adapter and the main adapter
142 - do nothing or default action
144 - display the Properties
151 case CM_PROB_FAILED_ADD
:
153 /* FIXME - display the properties of the sub-device */
157 case CM_PROB_NO_SOFTCONFIG
:
158 case CM_PROB_IRQ_TRANSLATION_FAILED
:
159 case CM_PROB_FAILED_DRIVER_ENTRY
:
160 case CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
:
161 case CM_PROB_DRIVER_FAILED_LOAD
:
162 case CM_PROB_DRIVER_SERVICE_KEY_INVALID
:
163 case CM_PROB_LEGACY_SERVICE_NO_DEVICES
:
164 case CM_PROB_DUPLICATE_DEVICE
:
165 case CM_PROB_FAILED_POST_START
:
167 case CM_PROB_HELD_FOR_EJECT
:
168 case CM_PROB_DRIVER_BLOCKED
:
169 case CM_PROB_REGISTRY_TOO_LARGE
:
172 /* FIXME - troubleshoot the device */
182 /***************************************************************************
184 * DeviceProblemWizardA
187 * Calls the device problem wizard
190 * hWndParent: Handle to the parent window
191 * lpMachineName: Machine Name, NULL is the local machine
192 * lpDeviceID: Specifies the device, also see NOTEs
195 * TRUE: if no errors occured
196 * FALSE: if errors occured
202 DeviceProblemWizardA(IN HWND hWndParent OPTIONAL
,
203 IN LPCSTR lpMachineName OPTIONAL
,
204 IN LPCSTR lpDeviceID
)
206 LPWSTR lpMachineNameW
= NULL
;
207 LPWSTR lpDeviceIDW
= NULL
;
210 if (lpMachineName
!= NULL
)
212 if (!(lpMachineNameW
= ConvertMultiByteToUnicode(lpMachineName
,
218 if (lpDeviceID
!= NULL
)
220 if (!(lpDeviceIDW
= ConvertMultiByteToUnicode(lpDeviceID
,
227 Ret
= DeviceProblemWizardW(hWndParent
,
232 if (lpMachineNameW
!= NULL
)
234 HeapFree(GetProcessHeap(),
238 if (lpDeviceIDW
!= NULL
)
240 HeapFree(GetProcessHeap(),
249 /***************************************************************************
251 * DeviceProblemWizardW
254 * Calls the device problem wizard
257 * hWndParent: Handle to the parent window
258 * lpMachineName: Machine Name, NULL is the local machine
259 * lpDeviceID: Specifies the device, also see NOTEs
262 * TRUE: if no errors occured
263 * FALSE: if errors occured
269 DeviceProblemWizardW(IN HWND hWndParent OPTIONAL
,
270 IN LPCWSTR lpMachineName OPTIONAL
,
271 IN LPCWSTR lpDeviceID
)
274 SP_DEVINFO_DATA DevInfoData
;
280 if (lpDeviceID
== NULL
)
282 SetLastError(ERROR_INVALID_PARAMETER
);
286 /* dynamically load comctl32 */
287 hComCtl32
= LoadAndInitComctl32();
288 if (hComCtl32
!= NULL
)
290 hDevInfo
= SetupDiCreateDeviceInfoListEx(NULL
,
294 if (hDevInfo
!= INVALID_HANDLE_VALUE
)
296 cr
= CM_Connect_Machine(lpMachineName
,
298 if (cr
== CR_SUCCESS
)
300 DevInfoData
.cbSize
= sizeof(SP_DEVINFO_DATA
);
301 if (SetupDiOpenDeviceInfo(hDevInfo
,
307 Ret
= ShowDeviceProblemWizard(hWndParent
,
313 CM_Disconnect_Machine(hMachine
);
316 SetupDiDestroyDeviceInfoList(hDevInfo
);
319 FreeLibrary(hComCtl32
);