sync to trunk head (37853) (except rbuild changes)
[reactos.git] / reactos / dll / cpl / sysdm / hardware.c
1 /*
2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/hardware.c
5 * PURPOSE: Hardware devices
6 * COPYRIGHT: Copyright Thomas Weidenmueller <w3seek@reactos.org>
7 * Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
8 *
9 */
10
11 #include "precomp.h"
12
13 typedef BOOL (WINAPI *PDEVMGREXEC)(HWND hWndParent, HINSTANCE hInst, PVOID Unknown, int nCmdShow);
14
15 static BOOL
16 LaunchDeviceManager(HWND hWndParent)
17 {
18 /* hack for ROS to start our devmgmt until we have mmc */
19 #ifdef __REACTOS__
20 return ((INT_PTR)ShellExecuteW(NULL, L"open", L"devmgmt.exe", NULL, NULL, SW_SHOWNORMAL) > 32);
21 #else
22 HMODULE hDll;
23 PDEVMGREXEC DevMgrExec;
24 BOOL Ret;
25
26 hDll = LoadLibrary(_TEXT("devmgr.dll"));
27 if(!hDll)
28 return FALSE;
29
30 DevMgrExec = (PDEVMGREXEC)GetProcAddress(hDll, "DeviceManager_ExecuteW");
31 if(!DevMgrExec)
32 {
33 FreeLibrary(hDll);
34 return FALSE;
35 }
36
37 /* run the Device Manager */
38 Ret = DevMgrExec(hWndParent, hApplet, NULL /* ??? */, SW_SHOW);
39 FreeLibrary(hDll);
40 return Ret;
41 #endif /* __REACTOS__ */
42 }
43
44 /* Property page dialog callback */
45 INT_PTR CALLBACK
46 HardwarePageProc(HWND hwndDlg,
47 UINT uMsg,
48 WPARAM wParam,
49 LPARAM lParam)
50 {
51 UNREFERENCED_PARAMETER(lParam);
52
53 switch (uMsg)
54 {
55 case WM_INITDIALOG:
56 break;
57
58 case WM_COMMAND:
59 switch (LOWORD(wParam))
60 {
61 case IDC_HARDWARE_DEVICE_MANAGER:
62 if (!LaunchDeviceManager(hwndDlg))
63 {
64 /* FIXME */
65 }
66 return TRUE;
67
68 case IDC_HARDWARE_PROFILE:
69 DialogBox(hApplet,
70 MAKEINTRESOURCE(IDD_HARDWAREPROFILES),
71 hwndDlg,
72 (DLGPROC)HardProfDlgProc);
73 return TRUE;
74 }
75 break;
76 }
77
78 return FALSE;
79 }