ReactOS 0.4.15-dev-8241-g63935f8
hardware.c
Go to the documentation of this file.
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
14
15static BOOL
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
44static VOID
46{
47 SHELLEXECUTEINFO shInputDll;
48
49 memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
50
51 shInputDll.cbSize = sizeof(shInputDll);
52 shInputDll.hwnd = hWndParent;
53 shInputDll.lpVerb = _T("open");
54 shInputDll.lpFile = _T("rundll32.exe");
55 shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL hdwwiz.cpl");
56
57 if (ShellExecuteEx(&shInputDll) == 0)
58 {
60 _T("Can't start hdwwiz.cpl"),
61 NULL,
63 }
64}
65
66/* Property page dialog callback */
69 UINT uMsg,
72{
74
75 switch (uMsg)
76 {
77 case WM_INITDIALOG:
78 break;
79
80 case WM_COMMAND:
81 switch (LOWORD(wParam))
82 {
84 if (!LaunchDeviceManager(hwndDlg))
85 {
86 /* FIXME */
87 }
88 return TRUE;
89
91 LaunchHardwareWizard(hwndDlg);
92 return TRUE;
93
97 hwndDlg,
99 return TRUE;
100 }
101 break;
102 }
103
104 return FALSE;
105}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
static BOOL LaunchDeviceManager(HWND hWndParent)
Definition: hardware.c:16
INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardware.c:68
BOOL(WINAPI * PDEVMGREXEC)(HWND hWndParent, HINSTANCE hInst, PVOID Unknown, int nCmdShow)
Definition: hardware.c:13
static VOID LaunchHardwareWizard(HWND hWndParent)
Definition: hardware.c:45
#define IDD_HARDWAREPROFILES
Definition: resource.h:190
#define IDC_HARDWARE_PROFILE
Definition: resource.h:88
#define IDC_HARDWARE_DEVICE_MANAGER
Definition: resource.h:90
#define IDC_HARDWARE_WIZARD
Definition: resource.h:87
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define CALLBACK
Definition: compat.h:35
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
INT_PTR CALLBACK HardProfDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:740
@ Unknown
Definition: i8042prt.h:114
#define _TEXT(x)
Definition: tchar.h:1535
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define memset(x, y, z)
Definition: compat.h:39
#define ShellExecuteEx
Definition: shellapi.h:694
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2486
LPCSTR lpParameters
Definition: shellapi.h:316
int32_t INT_PTR
Definition: typedefs.h:64
#define _T(x)
Definition: vfdio.h:22
#define LoadLibrary
Definition: winbase.h:3862
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
#define MB_ICONERROR
Definition: winuser.h:787
#define MB_OK
Definition: winuser.h:790
#define MessageBox
Definition: winuser.h:5831
#define SW_SHOW
Definition: winuser.h:775
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5770