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_DISABLED
:
55 /* FIXME - display the "Enable Device" wizard */
59 case CM_PROB_FAILED_INSTALL
:
61 /* FIXME - display the driver installation wizard */
67 /* FIXME - troubleshoot the device */
77 /***************************************************************************
79 * DeviceProblemWizardA
82 * Calls the device problem wizard
85 * hWndParent: Handle to the parent window
86 * lpMachineName: Machine Name, NULL is the local machine
87 * lpDeviceID: Specifies the device, also see NOTEs
90 * TRUE: if no errors occured
91 * FALSE: if errors occured
97 DeviceProblemWizardA(IN HWND hWndParent OPTIONAL
,
98 IN LPCSTR lpMachineName OPTIONAL
,
101 LPWSTR lpMachineNameW
= NULL
;
102 LPWSTR lpDeviceIDW
= NULL
;
105 if (lpMachineName
!= NULL
)
107 if (!(lpMachineNameW
= ConvertMultiByteToUnicode(lpMachineName
,
113 if (lpDeviceID
!= NULL
)
115 if (!(lpDeviceIDW
= ConvertMultiByteToUnicode(lpDeviceID
,
122 Ret
= DeviceProblemWizardW(hWndParent
,
127 if (lpMachineNameW
!= NULL
)
129 HeapFree(GetProcessHeap(),
133 if (lpDeviceIDW
!= NULL
)
135 HeapFree(GetProcessHeap(),
144 /***************************************************************************
146 * DeviceProblemWizardW
149 * Calls the device problem wizard
152 * hWndParent: Handle to the parent window
153 * lpMachineName: Machine Name, NULL is the local machine
154 * lpDeviceID: Specifies the device, also see NOTEs
157 * TRUE: if no errors occured
158 * FALSE: if errors occured
164 DeviceProblemWizardW(IN HWND hWndParent OPTIONAL
,
165 IN LPCWSTR lpMachineName OPTIONAL
,
166 IN LPCWSTR lpDeviceID
)
169 SP_DEVINFO_DATA DevInfoData
;
175 if (lpDeviceID
== NULL
)
177 SetLastError(ERROR_INVALID_PARAMETER
);
181 /* dynamically load comctl32 */
182 hComCtl32
= LoadAndInitComctl32();
183 if (hComCtl32
!= NULL
)
185 hDevInfo
= SetupDiCreateDeviceInfoListEx(NULL
,
189 if (hDevInfo
!= INVALID_HANDLE_VALUE
)
191 cr
= CM_Connect_Machine(lpMachineName
,
193 if (cr
== CR_SUCCESS
)
195 DevInfoData
.cbSize
= sizeof(SP_DEVINFO_DATA
);
196 if (SetupDiOpenDeviceInfo(hDevInfo
,
202 Ret
= ShowDeviceProblemWizard(hWndParent
,
208 CM_Disconnect_Machine(hMachine
);
211 SetupDiDestroyDeviceInfoList(hDevInfo
);
214 FreeLibrary(hComCtl32
);