ReactOS 0.4.15-dev-8109-gd7be748
advprop.cpp File Reference
#include "precomp.h"
#include "properties.h"
#include "resource.h"
#include <winver.h>
Include dependency graph for advprop.cpp:

Go to the source code of this file.

Classes

struct  CM_Power_Data_s
 

Macros

#define PDCAP_D0_SUPPORTED   0x00000001
 
#define PDCAP_D1_SUPPORTED   0x00000002
 
#define PDCAP_D2_SUPPORTED   0x00000004
 
#define PDCAP_D3_SUPPORTED   0x00000008
 
#define PDCAP_WAKE_FROM_D0_SUPPORTED   0x00000010
 
#define PDCAP_WAKE_FROM_D1_SUPPORTED   0x00000020
 
#define PDCAP_WAKE_FROM_D2_SUPPORTED   0x00000040
 
#define PDCAP_WAKE_FROM_D3_SUPPORTED   0x00000080
 
#define PDCAP_WARM_EJECT_SUPPORTED   0x00000100
 

Typedefs

typedef struct CM_Power_Data_s CM_POWER_DATA
 
typedef struct CM_Power_Data_sPCM_POWER_DATA
 

Functions

static UINT WINAPI EnumDeviceDriverFilesCallback (IN PVOID Context, IN UINT Notification, IN UINT_PTR Param1, IN UINT_PTR Param2)
 
static VOID UpdateDriverDetailsDlg (IN HWND hwndDlg, IN HWND hDriversListView, IN PDEVADVPROP_INFO dap)
 
static VOID UpdateDriverVersionInfoDetails (IN HWND hwndDlg, IN LPCWSTR lpszDriverPath)
 
static INT_PTR CALLBACK DriverDetailsDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK UninstallDriverDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID UninstallDriver (_In_ HWND hwndDlg, _In_ PDEVADVPROP_INFO dap)
 
static VOID UpdateDriver (IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
 
static VOID UpdateDriverDlg (IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
 
static INT_PTR CALLBACK AdvProcDriverDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID SetListViewText (HWND hwnd, INT iItem, LPCWSTR lpText)
 
static VOID UpdateDetailsDlg (IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
 
static VOID DisplayDevicePropertyText (IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN DWORD dwProperty)
 
static VOID DisplayDevNodeFlags (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayDevNodeEnumerator (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayCsFlags (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayMatchingDeviceId (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayClassCoinstallers (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayDeviceCoinstallers (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayClassProperties (IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN LPCWSTR lpProperty)
 
static VOID DisplayDeviceRelations (IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN ULONG ulFlags)
 
static VOID DisplayCurrentPowerState (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayPowerCapabilities (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayPowerStateMappings (IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
 
static VOID DisplayDeviceProperties (IN PDEVADVPROP_INFO dap, IN HWND hwndComboBox, IN HWND hwndListView)
 
static INT_PTR CALLBACK AdvProcDetailsDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID InitDevUsageActions (IN HWND hwndDlg, IN HWND hComboBox, IN PDEVADVPROP_INFO dap)
 
static UINT GetSelectedUsageAction (IN HWND hComboBox)
 
static BOOL ApplyGeneralSettings (IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
 
static VOID UpdateDevInfo (IN HWND hwndDlg, IN PDEVADVPROP_INFO dap, IN BOOL ReOpen)
 
static LRESULT CALLBACK DlgParentSubWndProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK AdvPropGeneralDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
INT_PTR DisplayDeviceAdvancedProperties (IN HWND hWndParent, IN LPCWSTR lpDeviceID OPTIONAL, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN HINSTANCE hComCtl32, IN LPCWSTR lpMachineName, IN DWORD dwFlags)
 

Macro Definition Documentation

◆ PDCAP_D0_SUPPORTED

#define PDCAP_D0_SUPPORTED   0x00000001

Definition at line 36 of file advprop.cpp.

◆ PDCAP_D1_SUPPORTED

#define PDCAP_D1_SUPPORTED   0x00000002

Definition at line 37 of file advprop.cpp.

◆ PDCAP_D2_SUPPORTED

#define PDCAP_D2_SUPPORTED   0x00000004

Definition at line 38 of file advprop.cpp.

◆ PDCAP_D3_SUPPORTED

#define PDCAP_D3_SUPPORTED   0x00000008

Definition at line 39 of file advprop.cpp.

◆ PDCAP_WAKE_FROM_D0_SUPPORTED

#define PDCAP_WAKE_FROM_D0_SUPPORTED   0x00000010

Definition at line 40 of file advprop.cpp.

◆ PDCAP_WAKE_FROM_D1_SUPPORTED

#define PDCAP_WAKE_FROM_D1_SUPPORTED   0x00000020

Definition at line 41 of file advprop.cpp.

◆ PDCAP_WAKE_FROM_D2_SUPPORTED

#define PDCAP_WAKE_FROM_D2_SUPPORTED   0x00000040

Definition at line 42 of file advprop.cpp.

◆ PDCAP_WAKE_FROM_D3_SUPPORTED

#define PDCAP_WAKE_FROM_D3_SUPPORTED   0x00000080

Definition at line 43 of file advprop.cpp.

◆ PDCAP_WARM_EJECT_SUPPORTED

#define PDCAP_WARM_EJECT_SUPPORTED   0x00000100

Definition at line 44 of file advprop.cpp.

Typedef Documentation

◆ CM_POWER_DATA

◆ PCM_POWER_DATA

Function Documentation

◆ AdvProcDetailsDlgProc()

static INT_PTR CALLBACK AdvProcDetailsDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1886 of file advprop.cpp.

1890{
1891 PDEVADVPROP_INFO dap;
1892 INT_PTR Ret = FALSE;
1893
1895
1896 if (dap != NULL || uMsg == WM_INITDIALOG)
1897 {
1898 switch (uMsg)
1899 {
1900 case WM_CONTEXTMENU:
1901 {
1902 if ((HWND)wParam == GetDlgItem(hwndDlg, IDC_DETAILSPROPVALUE))
1903 {
1904 WCHAR szColName[255];
1905
1906 if (!LoadStringW(hDllInstance, IDS_COPY, szColName, _countof(szColName)))
1907 break;
1908
1909 INT nSelectedItems = ListView_GetSelectedCount((HWND)wParam);
1911 HMENU hPopup = CreatePopupMenu();
1912
1913 AppendMenuW(hPopup, MF_STRING, IDS_MENU_COPY, szColName);
1914
1915 if (nSelectedItems <= 0)
1917
1918 TrackPopupMenu(hPopup, TPM_LEFTALIGN, pt.x, pt.y, 0, hwndDlg, NULL);
1919 DestroyMenu(hPopup);
1920 Ret = TRUE;
1921 }
1922 break;
1923 }
1924
1925 case WM_COMMAND:
1926 {
1927 switch (LOWORD(wParam))
1928 {
1930 if (HIWORD(wParam) == CBN_SELCHANGE)
1931 {
1935 }
1936 break;
1937
1938 case IDS_MENU_COPY:
1939 {
1941 INT nSelectedItems = ListView_GetSelectedCount(hwndListView);
1943
1944 if (nSelectedId < 0 || nSelectedItems <= 0)
1945 break;
1946
1947 HGLOBAL hGlobal;
1948 LPWSTR pszBuffer;
1949 SIZE_T cchSize = MAX_PATH + 1;
1950
1951 hGlobal = GlobalAlloc(GHND, cchSize * sizeof(WCHAR));
1952 if (!hGlobal)
1953 break;
1954 pszBuffer = (LPWSTR)GlobalLock(hGlobal);
1955 if (!pszBuffer)
1956 {
1957 GlobalFree(hGlobal);
1958 break;
1959 }
1960
1962 nSelectedId, 0,
1963 pszBuffer,
1964 cchSize);
1965 /* Ensure NULL-termination */
1966 pszBuffer[cchSize - 1] = UNICODE_NULL;
1967
1968 GlobalUnlock(hGlobal);
1969
1970 if (OpenClipboard(NULL))
1971 {
1975 Ret = TRUE;
1976 }
1977 else
1978 {
1979 GlobalFree(hGlobal);
1980 }
1981 break;
1982 }
1983 }
1984 break;
1985 }
1986
1987 case WM_NOTIFY:
1988 {
1989 NMHDR *hdr = (NMHDR*)lParam;
1990 switch (hdr->code)
1991 {
1992 case PSN_APPLY:
1993 break;
1994 }
1995 break;
1996 }
1997
1998 case WM_INITDIALOG:
1999 {
2001 if (dap != NULL)
2002 {
2003 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
2004
2005 UpdateDetailsDlg(hwndDlg,
2006 dap);
2007 }
2008 Ret = TRUE;
2009 break;
2010 }
2011 }
2012 }
2013
2014 return Ret;
2015}
static VOID UpdateDetailsDlg(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:770
static VOID DisplayDeviceProperties(IN PDEVADVPROP_INFO dap, IN HWND hwndComboBox, IN HWND hwndListView)
Definition: advprop.cpp:1728
#define IDS_COPY
Definition: resource.h:131
#define CF_UNICODETEXT
Definition: constants.h:408
static HINSTANCE hDllInstance
Definition: clb.c:30
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
#define MAX_PATH
Definition: compat.h:34
#define IDC_DETAILSPROPNAME
Definition: resource.h:252
#define IDC_DETAILSPROPVALUE
Definition: resource.h:253
#define IDS_MENU_COPY
Definition: resource.h:64
#define pt(x, y)
Definition: drawing.c:79
HWND hwndListView
Definition: eventvwr.c:66
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
char hdr[14]
Definition: iptest.cpp:33
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define UNICODE_NULL
#define LOWORD(l)
Definition: pedump.c:82
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2684
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
#define _countof(array)
Definition: sndvol32.h:70
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define GHND
Definition: winbase.h:297
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MF_BYCOMMAND
Definition: winuser.h:202
#define DWLP_USER
Definition: winuser.h:872
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1740
#define MF_STRING
Definition: winuser.h:138
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CBN_SELCHANGE
Definition: winuser.h:1979
#define TPM_LEFTALIGN
Definition: winuser.h:2377
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define MF_GRAYED
Definition: winuser.h:129
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by UpdateDevInfo().

◆ AdvProcDriverDlgProc()

static INT_PTR CALLBACK AdvProcDriverDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 678 of file advprop.cpp.

682{
684 INT_PTR Ret = FALSE;
685
687
688 if (dap != NULL || uMsg == WM_INITDIALOG)
689 {
690 switch (uMsg)
691 {
692 case WM_COMMAND:
693 {
694 switch (LOWORD(wParam))
695 {
699 hwndDlg,
701 (ULONG_PTR)dap);
702 break;
703
704 case IDC_UPDATEDRIVER:
705 UpdateDriver(hwndDlg, dap);
706 break;
707
709 // FIXME
710 break;
711
713 UninstallDriver(hwndDlg, dap);
714 break;
715 }
716 break;
717 }
718
719 case WM_NOTIFY:
720 {
721 NMHDR *hdr = (NMHDR*)lParam;
722 switch (hdr->code)
723 {
724 case PSN_APPLY:
725 break;
726 }
727 break;
728 }
729
730 case WM_INITDIALOG:
731 {
733 if (dap != NULL)
734 {
735 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
736
737 UpdateDriverDlg(hwndDlg,
738 dap);
739 }
741 Ret = TRUE;
742 break;
743 }
744 }
745 }
746
747 return Ret;
748}
static VOID UpdateDriver(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:532
static INT_PTR CALLBACK DriverDetailsDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:305
static VOID UpdateDriverDlg(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:596
static VOID UninstallDriver(_In_ HWND hwndDlg, _In_ PDEVADVPROP_INFO dap)
Definition: advprop.cpp:496
#define IDC_DRIVERDETAILS
Definition: resource.h:247
#define IDC_UPDATEDRIVER
Definition: resource.h:254
#define IDC_UNINSTALLDRIVER
Definition: resource.h:257
#define IDC_ROLLBACKDRIVER
Definition: resource.h:256
#define IDD_DRIVERDETAILS
Definition: resource.h:220
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define DialogBoxParam
Definition: winuser.h:5764
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by UpdateDevInfo().

◆ AdvPropGeneralDlgProc()

static INT_PTR CALLBACK AdvPropGeneralDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 2798 of file advprop.cpp.

2802{
2803 PDEVADVPROP_INFO dap;
2804 INT_PTR Ret = FALSE;
2805
2807
2808 if (dap != NULL || uMsg == WM_INITDIALOG)
2809 {
2810 switch (uMsg)
2811 {
2812 case WM_COMMAND:
2813 {
2814 switch (LOWORD(wParam))
2815 {
2816 case IDC_DEVUSAGE:
2817 {
2818 if (HIWORD(wParam) == CBN_SELCHANGE)
2819 {
2821 hwndDlg);
2822 dap->DeviceUsageChanged = TRUE;
2823 }
2824 break;
2825 }
2826
2827 case IDC_DEVPROBLEM:
2828 {
2829 if (dap->IsAdmin)
2830 {
2831 /* display the device problem wizard */
2833 dap->DeviceInfoSet,
2834 &dap->DeviceInfoData,
2835 dap->hMachine);
2836 }
2837 break;
2838 }
2839 }
2840 break;
2841 }
2842
2843 case WM_NOTIFY:
2844 {
2845 NMHDR *hdr = (NMHDR*)lParam;
2846 switch (hdr->code)
2847 {
2848 case PSN_APPLY:
2849 ApplyGeneralSettings(hwndDlg,
2850 dap);
2851 break;
2852 }
2853 break;
2854 }
2855
2856 case WM_INITDIALOG:
2857 {
2859 if (dap != NULL)
2860 {
2862
2863 dap->hWndGeneralPage = hwndDlg;
2864
2865 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
2866
2867 /* subclass the parent window to always receive
2868 WM_DEVICECHANGE messages */
2869 hWndParent = GetParent(hwndDlg);
2870 if (hWndParent != NULL)
2871 {
2872 /* subclass the parent window. This is not safe
2873 if the parent window belongs to another thread! */
2877
2878 if (dap->ParentOldWndProc != NULL &&
2880 L"DevMgrDevChangeSub",
2881 (HANDLE)dap))
2882 {
2883 dap->hWndParent = hWndParent;
2884 }
2885 }
2886
2887 /* do not call UpdateDevInfo directly in here because it modifies
2888 the pages of the property sheet! */
2889 PostMessage(hwndDlg,
2891 0,
2892 0);
2893 }
2894 Ret = TRUE;
2895 break;
2896 }
2897
2898 case WM_DEVICECHANGE:
2899 {
2900 /* FIXME - don't call UpdateDevInfo for all events */
2901 UpdateDevInfo(hwndDlg,
2902 dap,
2903 TRUE);
2904 Ret = TRUE;
2905 break;
2906 }
2907
2908 case PM_INITIALIZE:
2909 {
2910 UpdateDevInfo(hwndDlg,
2911 dap,
2912 FALSE);
2913 dap->PageInitialized = TRUE;
2914 break;
2915 }
2916
2917 case WM_DESTROY:
2918 {
2919 /* restore the old window proc of the subclassed parent window */
2920 if (dap->hWndParent != NULL && dap->ParentOldWndProc != NULL)
2921 {
2925 {
2927 L"DevMgrDevChangeSub");
2928 }
2929 }
2930 break;
2931 }
2932 }
2933 }
2934
2935 return Ret;
2936}
static LRESULT CALLBACK DlgParentSubWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:2755
static VOID UpdateDevInfo(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap, IN BOOL ReOpen)
Definition: advprop.cpp:2177
static BOOL ApplyGeneralSettings(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:2110
BOOL ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA DevInfoData, IN HMACHINE hMachine OPTIONAL)
Definition: devprblm.cpp:34
#define IDC_DEVPROBLEM
Definition: resource.h:242
#define IDC_DEVUSAGE
Definition: resource.h:232
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
#define PM_INITIALIZE
Definition: properties.h:70
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
HMACHINE hMachine
Definition: properties.h:24
HDEVINFO DeviceInfoSet
Definition: properties.h:19
WNDPROC ParentOldWndProc
Definition: properties.h:16
UINT DeviceUsageChanged
Definition: properties.h:44
SP_DEVINFO_DATA DeviceInfoData
Definition: properties.h:20
UINT PageInitialized
Definition: properties.h:48
HWND hWndGeneralPage
Definition: properties.h:14
#define GWLP_WNDPROC
Definition: treelist.c:66
#define SetProp
Definition: winuser.h:5851
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define RemoveProp
Definition: winuser.h:5841
#define PostMessage
Definition: winuser.h:5832
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1609
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906

Referenced by DisplayDeviceAdvancedProperties().

◆ ApplyGeneralSettings()

static BOOL ApplyGeneralSettings ( IN HWND  hwndDlg,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 2110 of file advprop.cpp.

2112{
2113 BOOL Ret = FALSE;
2114
2115 if (dap->DeviceUsageChanged && dap->IsAdmin && dap->CanDisable)
2116 {
2117 UINT SelectedUsageAction;
2119
2120 SelectedUsageAction = GetSelectedUsageAction(GetDlgItem(hwndDlg,
2121 IDC_DEVUSAGE));
2122 switch (SelectedUsageAction)
2123 {
2124 case IDS_ENABLEDEVICE:
2125 if (!dap->DeviceStarted)
2126 {
2127 Ret = EnableDevice(dap->DeviceInfoSet,
2128 &dap->DeviceInfoData,
2129 TRUE,
2130 0,
2131 &NeedReboot);
2132 }
2133 break;
2134
2135 case IDS_DISABLEDEVICE:
2136 if (dap->DeviceStarted)
2137 {
2138 Ret = EnableDevice(dap->DeviceInfoSet,
2139 &dap->DeviceInfoData,
2140 FALSE,
2141 0,
2142 &NeedReboot);
2143 }
2144 break;
2145
2146 default:
2147 break;
2148 }
2149
2150 if (Ret)
2151 {
2152 if (NeedReboot)
2153 {
2154 /* make PropertySheet() return PSM_REBOOTSYSTEM */
2155 PropSheet_RebootSystem(hwndDlg);
2156 }
2157 }
2158 else
2159 {
2160 /* FIXME - display an error message */
2161 FIXME("Failed to enable/disable device! LastError: %d\n",
2162 GetLastError());
2163 }
2164 }
2165 else
2166 Ret = !dap->DeviceUsageChanged;
2167
2168 /* disable the apply button */
2170 hwndDlg);
2171 dap->DeviceUsageChanged = FALSE;
2172 return Ret;
2173}
static UINT GetSelectedUsageAction(IN HWND hComboBox)
Definition: advprop.cpp:2084
#define FIXME(fmt,...)
Definition: debug.h:114
BOOL WINAPI NeedReboot(DWORD dwRebootCheck)
Definition: advpack.c:311
BOOL EnableDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
Definition: misc.cpp:784
#define IDS_DISABLEDEVICE
Definition: resource.h:112
#define IDS_ENABLEDEVICE
Definition: resource.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned int UINT
Definition: ndis.h:50
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
#define PropSheet_RebootSystem(d)
Definition: prsht.h:350
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by AdvPropGeneralDlgProc().

◆ DisplayClassCoinstallers()

static VOID DisplayClassCoinstallers ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1219 of file advprop.cpp.

1221{
1224 WCHAR szClassGuid[45];
1226 DWORD dwSize;
1227 DWORD dwType;
1229 LPWSTR lpStr;
1230 INT index;
1231 INT len;
1232 LONG lError;
1233
1234 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1235 {
1236 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1237 DeviceInfoData = &dap->CurrentDeviceInfoData;
1238 }
1239 else
1240 {
1241 DeviceInfoSet = dap->DeviceInfoSet;
1242 DeviceInfoData = &dap->DeviceInfoData;
1243 }
1244
1245 dwSize = 45 * sizeof(WCHAR);
1249 &dwType,
1250 (LPBYTE)szClassGuid,
1251 dwSize,
1252 &dwSize))
1253 return;
1254
1256 L"SYSTEM\\CurrentControlSet\\Control\\CoDeviceInstallers",
1257 0,
1259 &hKey);
1260 if (lError != ERROR_SUCCESS)
1261 return;
1262
1263 dwSize = 0;
1264 lError = RegQueryValueEx(hKey,
1265 szClassGuid,
1266 NULL,
1267 &dwType,
1268 NULL,
1269 &dwSize);
1270 if (lError != ERROR_SUCCESS)
1271 goto done;
1272
1273 if (dwSize == 0)
1274 goto done;
1275
1278 dwSize);
1279
1281 szClassGuid,
1282 NULL,
1283 &dwType,
1284 lpBuffer,
1285 &dwSize);
1286
1287 lpStr = (LPWSTR)lpBuffer;
1288 index = 0;
1289 while (*lpStr != 0)
1290 {
1291 len = wcslen(lpStr) + 1;
1292
1294
1295 lpStr += len;
1296 index++;
1297 }
1298
1299done:
1300 if (lpBuffer != NULL)
1302
1305}
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define index(s, c)
Definition: various.h:29
HANDLE HKEY
Definition: registry.h:26
#define RegCloseKey(hKey)
Definition: registry.h:49
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define GetProcessHeap()
Definition: compat.h:736
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GENERIC_READ
Definition: compat.h:135
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint index
Definition: glext.h:6031
GLenum GLsizei len
Definition: glext.h:6722
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
long LONG
Definition: pedump.c:60
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2603
#define SPDRP_CLASSGUID
Definition: setupapi.h:515
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1528
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegQueryValueEx
Definition: winreg.h:524

Referenced by DisplayDeviceProperties().

◆ DisplayClassProperties()

static VOID DisplayClassProperties ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView,
IN LPCWSTR  lpProperty 
)
static

Definition at line 1385 of file advprop.cpp.

1388{
1391 WCHAR szClassGuid[45];
1392 DWORD dwSize;
1393 DWORD dwType;
1394 HKEY hKey;
1395 GUID ClassGuid;
1397 LPWSTR lpStr;
1398 INT index = 0;
1399 INT len;
1400
1401 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1402 {
1403 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1404 DeviceInfoData = &dap->CurrentDeviceInfoData;
1405 }
1406 else
1407 {
1408 DeviceInfoSet = dap->DeviceInfoSet;
1409 DeviceInfoData = &dap->DeviceInfoData;
1410 }
1411
1412 dwSize = 45 * sizeof(WCHAR);
1416 &dwType,
1417 (LPBYTE)szClassGuid,
1418 dwSize,
1419 &dwSize))
1420 return;
1421
1422 pSetupGuidFromString(szClassGuid,
1423 &ClassGuid);
1424
1425 hKey = SetupDiOpenClassRegKey(&ClassGuid,
1428 {
1429 dwSize = 0;
1431 lpProperty,
1432 NULL,
1433 &dwType,
1434 NULL,
1435 &dwSize) == ERROR_SUCCESS &&
1436 dwSize > 0)
1437 {
1440 dwSize);
1441
1443 lpProperty,
1444 NULL,
1445 &dwType,
1446 lpBuffer,
1447 &dwSize);
1448
1449 if (dwType == REG_SZ)
1450 {
1452 }
1453 else if (dwType == REG_MULTI_SZ)
1454 {
1455 lpStr = (LPWSTR)lpBuffer;
1456 index = 0;
1457 while (*lpStr != 0)
1458 {
1459 len = wcslen(lpStr) + 1;
1460
1462
1463 lpStr += len;
1464 index++;
1465 }
1466 }
1467
1469 0,
1470 lpBuffer);
1471 }
1472
1474 }
1475}
DWORD WINAPI pSetupGuidFromString(PCWSTR pString, LPGUID lpGUID)
Definition: misc.c:1751
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3618
#define REG_SZ
Definition: layer.c:22
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REG_MULTI_SZ
Definition: nt_native.h:1501

Referenced by DisplayDeviceProperties().

◆ DisplayCsFlags()

static VOID DisplayCsFlags ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1145 of file advprop.cpp.

1147{
1148 DWORD dwValue = 0;
1149 INT index;
1150
1151 CM_Get_HW_Prof_Flags_Ex(dap->szDevName,
1152 0, /* current hardware profile */
1153 &dwValue,
1154 0,
1155 dap->hMachine);
1156
1157 index = 0;
1158 swprintf(dap->szTemp, L"%08lx", dwValue);
1159 SetListViewText(hwndListView, index++, dap->szTemp);
1160
1161 if (dwValue & CSCONFIGFLAG_DISABLED)
1162 SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DISABLED");
1163
1164 if (dwValue & CSCONFIGFLAG_DO_NOT_CREATE)
1165 SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_CREATE");
1166
1167 if (dwValue & CSCONFIGFLAG_DO_NOT_START)
1168 SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_START");
1169}
#define CM_Get_HW_Prof_Flags_Ex
Definition: cfgmgr32.h:1942
#define swprintf
Definition: precomp.h:40
#define CSCONFIGFLAG_DO_NOT_CREATE
Definition: regstr.h:402
#define CSCONFIGFLAG_DO_NOT_START
Definition: regstr.h:403
#define CSCONFIGFLAG_DISABLED
Definition: regstr.h:401

Referenced by DisplayDeviceProperties().

◆ DisplayCurrentPowerState()

static VOID DisplayCurrentPowerState ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1530 of file advprop.cpp.

1533{
1536 CM_POWER_DATA PowerData;
1537 DWORD dwSize, dwType;
1538 PCWSTR lpText = NULL;
1539
1540 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1541 {
1542 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1543 DeviceInfoData = &dap->CurrentDeviceInfoData;
1544 }
1545 else
1546 {
1547 DeviceInfoSet = dap->DeviceInfoSet;
1548 DeviceInfoData = &dap->DeviceInfoData;
1549 }
1550
1551 dwSize = sizeof(CM_POWER_DATA);
1555 &dwType,
1556 (LPBYTE)&PowerData,
1557 dwSize,
1558 &dwSize))
1559 return;
1560
1561 switch (PowerData.PD_MostRecentPowerState)
1562 {
1563// case PowerDeviceUnspecified:
1564
1565 case PowerDeviceD0:
1566 lpText = L"D0";
1567 break;
1568
1569 case PowerDeviceD1:
1570 lpText = L"D1";
1571 break;
1572
1573 case PowerDeviceD2:
1574 lpText = L"D2";
1575 break;
1576
1577 case PowerDeviceD3:
1578 lpText = L"D3";
1579 break;
1580
1581 default:
1582 break;
1583 }
1584
1585 if (lpText != NULL)
1586 SetListViewText(hwndListView, 0, lpText);
1587}
struct CM_Power_Data_s CM_POWER_DATA
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
#define SPDRP_DEVICE_POWER_DATA
Definition: setupapi.h:537
const uint16_t * PCWSTR
Definition: typedefs.h:57

Referenced by DisplayDeviceProperties().

◆ DisplayDeviceAdvancedProperties()

INT_PTR DisplayDeviceAdvancedProperties ( IN HWND  hWndParent,
IN LPCWSTR lpDeviceID  OPTIONAL,
IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
IN HINSTANCE  hComCtl32,
IN LPCWSTR  lpMachineName,
IN DWORD  dwFlags 
)

Definition at line 2940 of file advprop.cpp.

2947{
2948 PROPSHEETHEADER psh = {0};
2949 PROPSHEETPAGE pspGeneral = {0};
2952 PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
2953 PDEVADVPROP_INFO DevAdvPropInfo;
2954 HMACHINE hMachine = NULL;
2955 DWORD DevIdSize = 0;
2956 INT_PTR Ret = -1;
2957
2958 /* we don't want to statically link against comctl32, so find the
2959 functions we need dynamically */
2962 "PropertySheetW");
2965 "CreatePropertySheetPageW");
2966 pDestroyPropertySheetPage =
2968 "DestroyPropertySheetPage");
2969 if (pPropertySheetW == NULL ||
2971 pDestroyPropertySheetPage == NULL)
2972 {
2973 return -1;
2974 }
2975
2976 if (lpDeviceID == NULL)
2977 {
2978 /* find out how much size is needed for the device id */
2981 NULL,
2982 0,
2983 &DevIdSize))
2984 {
2985 ERR("SetupDiGetDeviceInstanceId unexpectedly returned TRUE!\n");
2986 return -1;
2987 }
2988
2990 {
2991 return -1;
2992 }
2993 }
2994 else
2995 {
2996 DevIdSize = (DWORD)wcslen(lpDeviceID) + 1;
2997 }
2998
2999 if (lpMachineName != NULL && lpMachineName[0] != L'\0')
3000 {
3001 CONFIGRET cr = CM_Connect_Machine(lpMachineName,
3002 &hMachine);
3003 if (cr != CR_SUCCESS)
3004 {
3005 return -1;
3006 }
3007 }
3008
3009 /* create the internal structure associated with the "General",
3010 "Driver", ... pages */
3011 DevAdvPropInfo = (PDEVADVPROP_INFO)HeapAlloc(GetProcessHeap(),
3014 szDeviceID) +
3015 (DevIdSize * sizeof(WCHAR)));
3016 if (DevAdvPropInfo == NULL)
3017 {
3019 goto Cleanup;
3020 }
3021
3022 if (lpDeviceID == NULL)
3023 {
3024 /* read the device instance id */
3027 DevAdvPropInfo->szDeviceID,
3028 DevIdSize,
3029 NULL))
3030 {
3031 goto Cleanup;
3032 }
3033 }
3034 else
3035 {
3036 /* copy the device instance id supplied by the caller */
3037 wcscpy(DevAdvPropInfo->szDeviceID,
3038 lpDeviceID);
3039 }
3040
3041 DevAdvPropInfo->DeviceInfoSet = DeviceInfoSet;
3042 DevAdvPropInfo->DeviceInfoData = *DeviceInfoData;
3044 DevAdvPropInfo->CurrentDeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
3045
3046 DevAdvPropInfo->ShowRemotePages = (lpMachineName != NULL && lpMachineName[0] != L'\0');
3047 DevAdvPropInfo->hMachine = hMachine;
3048 DevAdvPropInfo->lpMachineName = lpMachineName;
3049 DevAdvPropInfo->szDevName[0] = L'\0';
3050 DevAdvPropInfo->hComCtl32 = hComCtl32;
3052 DevAdvPropInfo->pDestroyPropertySheetPage = pDestroyPropertySheetPage;
3053
3054 DevAdvPropInfo->IsAdmin = TRUE;// IsUserAdmin();
3055 DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0);
3056 DevAdvPropInfo->Extended = ((dwFlags & DPF_EXTENDED) != 0);
3057
3058 psh.dwSize = sizeof(PROPSHEETHEADER);
3059 psh.dwFlags = PSH_PROPTITLE | PSH_NOAPPLYNOW;
3060 psh.hwndParent = hWndParent;
3061 psh.pszCaption = DevAdvPropInfo->szDevName;
3062
3063 DevAdvPropInfo->PropertySheetType = DevAdvPropInfo->ShowRemotePages ?
3064 DIGCDP_FLAG_REMOTE_ADVANCED :
3066
3067 psh.phpage = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
3069 1 * sizeof(HPROPSHEETPAGE));
3070 if (psh.phpage == NULL)
3071 {
3072 goto Cleanup;
3073 }
3074
3075 /* add the "General" property sheet */
3076 pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
3077 pspGeneral.dwFlags = PSP_DEFAULT;
3078 pspGeneral.hInstance = hDllInstance;
3079 pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
3080 pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
3081 pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
3082 psh.phpage[psh.nPages] = pCreatePropertySheetPageW(&pspGeneral);
3083 if (psh.phpage[psh.nPages] != NULL)
3084 {
3085 psh.nPages++;
3086 }
3087
3088 DevAdvPropInfo->nDevPropSheets = psh.nPages;
3089
3090 if (psh.nPages != 0)
3091 {
3092 Ret = pPropertySheetW(&psh);
3093
3094 /* NOTE: no need to destroy the property sheets anymore! */
3095 }
3096 else
3097 {
3098 UINT i;
3099
3100Cleanup:
3101 /* in case of failure the property sheets must be destroyed */
3102 if (psh.phpage != NULL)
3103 {
3104 for (i = 0;
3105 i < psh.nPages;
3106 i++)
3107 {
3108 if (psh.phpage[i] != NULL)
3109 {
3110 pDestroyPropertySheetPage(psh.phpage[i]);
3111 }
3112 }
3113 }
3114 }
3115
3116 if (Ret != 1)
3117 {
3119
3124 {
3125 SP_PROPCHANGE_PARAMS PropChangeParams;
3126 PropChangeParams.ClassInstallHeader.cbSize = sizeof(PropChangeParams.ClassInstallHeader);
3128 PropChangeParams.Scope = DICS_FLAG_GLOBAL;
3129 PropChangeParams.StateChange = DICS_PROPCHANGE;
3130
3133 (PSP_CLASSINSTALL_HEADER)&PropChangeParams,
3134 sizeof(PropChangeParams));
3135
3139
3140 DeviceInstallParams.FlagsEx &= ~DI_FLAGSEX_PROPCHANGE_PENDING;
3144 }
3145 }
3146
3147 if (DevAdvPropInfo != NULL)
3148 {
3149 if (DevAdvPropInfo->FreeDevPropSheets)
3150 {
3151 /* don't free the array if it's the one allocated in
3152 DisplayDeviceAdvancedProperties */
3154 0,
3155 DevAdvPropInfo->DevPropSheets);
3156 }
3157
3158 if (DevAdvPropInfo->CloseDevInst)
3159 {
3160 /* close the device info set in case a new one was created */
3162 }
3163
3164 if (DevAdvPropInfo->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
3165 {
3167 }
3168
3169 if (DevAdvPropInfo->hDevIcon != NULL)
3170 {
3171 DestroyIcon(DevAdvPropInfo->hDevIcon);
3172 }
3173
3174 if (DevAdvPropInfo->pResourceList != NULL)
3175 HeapFree(GetProcessHeap(), 0, DevAdvPropInfo->pResourceList);
3176
3178 0,
3179 DevAdvPropInfo);
3180 }
3181
3182 if (psh.phpage != NULL)
3183 {
3185 0,
3186 psh.phpage);
3187 }
3188
3189 if (hMachine != NULL)
3190 {
3191 CM_Disconnect_Machine(hMachine);
3192 }
3193
3194 return Ret;
3195}
static INT_PTR CALLBACK AdvPropGeneralDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:2798
#define ERR(fmt,...)
Definition: debug.h:113
#define CM_Connect_Machine
Definition: cfgmgr32.h:1074
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Disconnect_Machine(_In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1863
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define IDD_DEVICEGENERAL
Definition: resource.h:217
BOOL WINAPI SetupDiSetClassInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
Definition: devclass.c:972
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4558
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4451
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4024
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893
static const WCHAR Cleanup[]
Definition: register.c:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static FN_PropertySheetW pPropertySheetW
Definition: propsheet.c:122
static FN_CreatePropertySheetPageW pCreatePropertySheetPageW
Definition: propsheet.c:121
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define DWORD
Definition: nt_native.h:44
HPROPSHEETPAGE(WINAPI * PCREATEPROPERTYSHEETPAGEW)(LPCPROPSHEETPAGEW)
Definition: properties.h:9
INT_PTR(WINAPI * PPROPERTYSHEETW)(LPCPROPSHEETHEADERW)
Definition: properties.h:8
BOOL(WINAPI * PDESTROYPROPERTYSHEETPAGE)(HPROPSHEETPAGE)
Definition: properties.h:10
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define PROPSHEETPAGE
Definition: prsht.h:389
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define DPF_DEVICE_STATUS_ACTION
Definition: devmgr.h:145
#define DPF_EXTENDED
Definition: devmgr.h:144
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2600
#define DICS_PROPCHANGE
Definition: setupapi.h:116
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
#define DIGCDP_FLAG_ADVANCED
Definition: setupapi.h:165
UINT DoDefaultDevAction
Definition: properties.h:47
SP_DEVINFO_DATA CurrentDeviceInfoData
Definition: properties.h:22
LPCWSTR lpMachineName
Definition: properties.h:25
DWORD PropertySheetType
Definition: properties.h:31
PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW
Definition: properties.h:28
UINT FreeDevPropSheets
Definition: properties.h:41
DWORD nDevPropSheets
Definition: properties.h:32
WCHAR szDevName[255]
Definition: properties.h:57
PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage
Definition: properties.h:29
HINSTANCE hComCtl32
Definition: properties.h:27
HPROPSHEETPAGE * DevPropSheets
Definition: properties.h:33
PVOID pResourceList
Definition: properties.h:56
HDEVINFO CurrentDeviceInfoSet
Definition: properties.h:21
UINT ShowRemotePages
Definition: properties.h:49
WCHAR szDeviceID[1]
Definition: properties.h:59
DI_FUNCTION InstallFunction
Definition: setupapi.h:904
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:916
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2084
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DeviceAdvancedPropertiesW(), DevicePropertiesExW(), and DisplaySelectedDeviceProperties().

◆ DisplayDeviceCoinstallers()

static VOID DisplayDeviceCoinstallers ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1309 of file advprop.cpp.

1311{
1314 HKEY hKey;
1315 DWORD dwSize;
1316 DWORD dwType;
1318 LPWSTR lpStr;
1319 INT index;
1320 INT len;
1321
1322 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1323 {
1324 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1325 DeviceInfoData = &dap->CurrentDeviceInfoData;
1326 }
1327 else
1328 {
1329 DeviceInfoSet = dap->DeviceInfoSet;
1330 DeviceInfoData = &dap->DeviceInfoData;
1331 }
1332
1336 0,
1337 DIREG_DRV,
1340 {
1341 dwSize = 0;
1343 L"CoInstallers32",
1344 NULL,
1345 &dwType,
1346 NULL,
1347 &dwSize) == ERROR_SUCCESS &&
1348 dwSize > 0)
1349 {
1350
1353 dwSize);
1354
1356 L"CoInstallers32",
1357 NULL,
1358 &dwType,
1359 lpBuffer,
1360 &dwSize);
1361
1362 lpStr = (LPWSTR)lpBuffer;
1363 index = 0;
1364 while (*lpStr != 0)
1365 {
1366 len = wcslen(lpStr) + 1;
1367
1369
1370 lpStr += len;
1371 index++;
1372 }
1373
1375 0,
1376 lpBuffer);
1377 }
1378
1380 }
1381}
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5934
#define DIREG_DRV
Definition: setupapi.h:182

Referenced by DisplayDeviceProperties().

◆ DisplayDeviceProperties()

static VOID DisplayDeviceProperties ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndComboBox,
IN HWND  hwndListView 
)
static

Definition at line 1728 of file advprop.cpp.

1731{
1732 INT Index;
1733
1734 Index = (INT)SendMessage(hwndComboBox,
1736 0,
1737 0);
1738 if (Index == CB_ERR)
1739 return;
1740
1742
1743 switch (Index)
1744 {
1745 case 0: /* Device ID */
1746 SetListViewText(hwndListView, 0, dap->szDeviceID);
1747 break;
1748
1749 case 1: /* Hardware ID */
1753 break;
1754
1755 case 2: /* Compatible IDs */
1759 break;
1760
1761 case 3: /* Matching ID */
1763 hwndListView);
1764 break;
1765
1766 case 4: /* Service */
1770 break;
1771
1772 case 5: /* Enumerator */
1774 hwndListView);
1775 break;
1776
1777 case 6: /* Capabilities */
1781 break;
1782
1783 case 7: /* Devnode Flags */
1785 hwndListView);
1786 break;
1787
1788 case 8: /* Config Flags */
1792 break;
1793
1794 case 9: /* CSConfig Flags */
1795 DisplayCsFlags(dap,
1796 hwndListView);
1797 break;
1798
1799 case 10: /* Ejection relation */
1803 break;
1804
1805 case 11: /* Removal relations */
1809 break;
1810
1811 case 12: /* Bus relation */
1815 break;
1816
1817 case 13: /* Device Upper Filters */
1821 break;
1822
1823 case 14: /* Device Lower Filters */
1827 break;
1828
1829 case 15: /* Class Upper Filters */
1832 L"UpperFilters");
1833 break;
1834
1835 case 16: /* Class Lower Filters */
1838 L"LowerFilters");
1839 break;
1840
1841 case 17: /* Class Installer */
1844 L"Installer32");
1845 break;
1846
1847 case 18: /* Class Coinstaller */
1849 hwndListView);
1850 break;
1851
1852 case 19: /* Device Coinstaller */
1854 hwndListView);
1855 break;
1856
1857#if 0
1858 case 20: /* Firmware Revision */
1859 break;
1860#endif
1861
1862 case 21: /* Current Power State */
1864 hwndListView);
1865 break;
1866
1867 case 22: /* Power Capabilities */
1869 hwndListView);
1870 break;
1871
1872 case 23: /* Power State Mappings */
1874 hwndListView);
1875 break;
1876
1877 default:
1878 SetListViewText(hwndListView, 0, L"<Not implemented yet>");
1879 break;
1880 }
1881}
static VOID DisplayDevNodeEnumerator(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1114
static VOID DisplayDeviceCoinstallers(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1309
static VOID DisplayDevicePropertyText(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN DWORD dwProperty)
Definition: advprop.cpp:866
static VOID DisplayDeviceRelations(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN ULONG ulFlags)
Definition: advprop.cpp:1479
static VOID DisplayPowerStateMappings(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1652
static VOID DisplayClassProperties(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN LPCWSTR lpProperty)
Definition: advprop.cpp:1385
static VOID DisplayPowerCapabilities(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1591
static VOID DisplayMatchingDeviceId(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1173
static VOID DisplayDevNodeFlags(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1028
static VOID DisplayClassCoinstallers(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1219
static VOID DisplayCurrentPowerState(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1530
static VOID DisplayCsFlags(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1145
#define CM_GETIDLIST_FILTER_REMOVALRELATIONS
Definition: cfgmgr32.h:658
#define CM_GETIDLIST_FILTER_EJECTRELATIONS
Definition: cfgmgr32.h:657
#define CM_GETIDLIST_FILTER_BUSRELATIONS
Definition: cfgmgr32.h:660
#define INT
Definition: polytest.cpp:20
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414
#define SPDRP_CAPABILITIES
Definition: setupapi.h:522
#define SPDRP_COMPATIBLEIDS
Definition: setupapi.h:509
#define SPDRP_UPPERFILTERS
Definition: setupapi.h:524
#define SPDRP_SERVICE
Definition: setupapi.h:511
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:517
#define SPDRP_HARDWAREID
Definition: setupapi.h:508
#define SPDRP_LOWERFILTERS
Definition: setupapi.h:525
_In_ WDFCOLLECTION _In_ ULONG Index
#define CB_ERR
Definition: winuser.h:2435
#define SendMessage
Definition: winuser.h:5843
#define CB_GETCURSEL
Definition: winuser.h:1943

Referenced by AdvProcDetailsDlgProc().

◆ DisplayDevicePropertyText()

static VOID DisplayDevicePropertyText ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView,
IN DWORD  dwProperty 
)
static

Definition at line 866 of file advprop.cpp.

869{
872 DWORD dwType;
874 DWORD dwValue;
876 LPWSTR lpStr;
877 INT len;
878 INT index;
879
880 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
881 {
882 DeviceInfoSet = dap->CurrentDeviceInfoSet;
883 DeviceInfoData = &dap->CurrentDeviceInfoData;
884 }
885 else
886 {
887 DeviceInfoSet = dap->DeviceInfoSet;
888 DeviceInfoData = &dap->DeviceInfoData;
889 }
890
891 dwSize = 0;
894 dwProperty,
895 &dwType,
896 NULL,
897 0,
898 &dwSize);
899 if (dwSize == 0)
900 {
902 {
903 swprintf(dap->szTemp, L"Error: Getting the size failed! (Error: %ld)", GetLastError());
904 SetListViewText(hwndListView, 0, dap->szTemp);
905 }
906 return;
907 }
908
909 if (dwType == REG_SZ)
910 dwSize += sizeof(WCHAR);
911
914 dwSize);
915 if (lpBuffer == NULL)
916 {
917 SetListViewText(hwndListView, 0, L"Error: Allocating the buffer failed!");
918 return;
919 }
920
923 dwProperty,
924 &dwType,
925 lpBuffer,
926 dwSize,
927 &dwSize))
928 {
929 if (dwType == REG_SZ)
930 {
932 }
933 else if (dwType == REG_MULTI_SZ)
934 {
935 lpStr = (LPWSTR)lpBuffer;
936 index = 0;
937 while (*lpStr != 0)
938 {
939 len = wcslen(lpStr) + 1;
940
942
943 lpStr += len;
944 index++;
945 }
946 }
947 else if (dwType == REG_DWORD)
948 {
949 dwValue = *(DWORD *) lpBuffer;
950
951 switch (dwProperty)
952 {
954 index = 0;
955 swprintf(dap->szTemp, L"%08lx", dwValue);
956 SetListViewText(hwndListView, index++, dap->szTemp);
957 if (dwValue & CM_DEVCAP_LOCKSUPPORTED)
958 SetListViewText(hwndListView, index++, L"CM_DEVCAP_LOCKSUPPORTED");
959 if (dwValue & CM_DEVCAP_EJECTSUPPORTED)
960 SetListViewText(hwndListView, index++, L"CM_DEVCAP_EJECTSUPPORTED");
961 if (dwValue & CM_DEVCAP_REMOVABLE)
962 SetListViewText(hwndListView, index++, L"CM_DEVCAP_REMOVABLE");
963 if (dwValue & CM_DEVCAP_DOCKDEVICE)
964 SetListViewText(hwndListView, index++, L"CM_DEVCAP_DOCKDEVICE");
965 if (dwValue & CM_DEVCAP_UNIQUEID)
966 SetListViewText(hwndListView, index++, L"CM_DEVCAP_UNIQUEID");
967 if (dwValue & CM_DEVCAP_SILENTINSTALL)
968 SetListViewText(hwndListView, index++, L"CM_DEVCAP_SILENTINSTALL");
969 if (dwValue & CM_DEVCAP_RAWDEVICEOK)
970 SetListViewText(hwndListView, index++, L"CM_DEVCAP_RAWDEVICEOK");
971 if (dwValue & CM_DEVCAP_SURPRISEREMOVALOK)
972 SetListViewText(hwndListView, index++, L"CM_DEVCAP_SURPRISEREMOVALOK");
973 if (dwValue & CM_DEVCAP_HARDWAREDISABLED)
974 SetListViewText(hwndListView, index++, L"CM_DEVCAP_HARDWAREDISABLED");
975 if (dwValue & CM_DEVCAP_NONDYNAMIC)
976 SetListViewText(hwndListView, index++, L"CM_DEVCAP_NONDYNAMIC");
977 break;
978
980 index = 0;
981 swprintf(dap->szTemp, L"%08lx", dwValue);
982 SetListViewText(hwndListView, index++, dap->szTemp);
983 if (dwValue & CONFIGFLAG_DISABLED)
984 SetListViewText(hwndListView, index++, L"CONFIGFLAG_DISABLED");
985 if (dwValue & CONFIGFLAG_REMOVED)
986 SetListViewText(hwndListView, index++, L"CONFIGFLAG_REMOVED");
987 if (dwValue & CONFIGFLAG_MANUAL_INSTALL)
988 SetListViewText(hwndListView, index++, L"CONFIGFLAG_MANUAL_INSTALL");
989 if (dwValue & CONFIGFLAG_IGNORE_BOOT_LC)
990 SetListViewText(hwndListView, index++, L"CONFIGFLAG_IGNORE_BOOT_LC");
991 if (dwValue & CONFIGFLAG_NET_BOOT)
992 SetListViewText(hwndListView, index++, L"CONFIGFLAG_NET_BOOT");
993 if (dwValue & CONFIGFLAG_REINSTALL)
994 SetListViewText(hwndListView, index++, L"CONFIGFLAG_REINSTALL");
995 if (dwValue & CONFIGFLAG_FAILEDINSTALL)
996 SetListViewText(hwndListView, index++, L"CONFIGFLAG_FAILEDINSTALL");
997 if (dwValue & CONFIGFLAG_CANTSTOPACHILD)
998 SetListViewText(hwndListView, index++, L"CONFIGFLAG_CANTSTOPACHILD");
999 if (dwValue & CONFIGFLAG_OKREMOVEROM)
1000 SetListViewText(hwndListView, index++, L"CONFIGFLAG_OKREMOVEROM");
1001 if (dwValue & CONFIGFLAG_NOREMOVEEXIT)
1002 SetListViewText(hwndListView, index++, L"CONFIGFLAG_NOREMOVEEXIT");
1003 break;
1004
1005 default:
1006 swprintf(dap->szTemp, L"0x%08lx", dwValue);
1007 SetListViewText(hwndListView, 0, dap->szTemp);
1008 break;
1009 }
1010 }
1011 else
1012 {
1013 SetListViewText(hwndListView, 0, L"Error: Unsupported value type!");
1014
1015 }
1016 }
1017 else
1018 {
1019 SetListViewText(hwndListView, 0, L"Error: Retrieving the value failed!");
1020 }
1021
1023 0,
1024 lpBuffer);
1025}
#define CM_DEVCAP_LOCKSUPPORTED
Definition: cfgmgr32.h:735
#define CM_DEVCAP_EJECTSUPPORTED
Definition: cfgmgr32.h:736
#define CM_DEVCAP_RAWDEVICEOK
Definition: cfgmgr32.h:741
#define CM_DEVCAP_HARDWAREDISABLED
Definition: cfgmgr32.h:743
#define CM_DEVCAP_UNIQUEID
Definition: cfgmgr32.h:739
#define CM_DEVCAP_NONDYNAMIC
Definition: cfgmgr32.h:744
#define CM_DEVCAP_SURPRISEREMOVALOK
Definition: cfgmgr32.h:742
#define CM_DEVCAP_SILENTINSTALL
Definition: cfgmgr32.h:740
#define CM_DEVCAP_DOCKDEVICE
Definition: cfgmgr32.h:738
#define CM_DEVCAP_REMOVABLE
Definition: cfgmgr32.h:737
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CONFIGFLAG_REMOVED
Definition: regstr.h:391
#define CONFIGFLAG_NET_BOOT
Definition: regstr.h:394
#define CONFIGFLAG_NOREMOVEEXIT
Definition: regstr.h:399
#define CONFIGFLAG_OKREMOVEROM
Definition: regstr.h:398
#define CONFIGFLAG_MANUAL_INSTALL
Definition: regstr.h:392
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
#define CONFIGFLAG_REINSTALL
Definition: regstr.h:395
#define CONFIGFLAG_CANTSTOPACHILD
Definition: regstr.h:397
#define CONFIGFLAG_IGNORE_BOOT_LC
Definition: regstr.h:393
#define CONFIGFLAG_DISABLED
Definition: regstr.h:390
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by DisplayDeviceProperties().

◆ DisplayDeviceRelations()

static VOID DisplayDeviceRelations ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView,
IN ULONG  ulFlags 
)
static

Definition at line 1479 of file advprop.cpp.

1483{
1484 ULONG ulLength = 0;
1485 LPWSTR pszBuffer = NULL, pszStr;
1486 INT index = 0, len;
1487 CONFIGRET ret;
1488
1490 dap->szDeviceID,
1491 ulFlags,
1492 NULL);
1493 if (ret != CR_SUCCESS)
1494 return;
1495
1496 pszBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
1498 ulLength * sizeof(WCHAR));
1499 if (pszBuffer == NULL)
1500 return;
1501
1502 ret = CM_Get_Device_ID_List_ExW(dap->szDeviceID,
1503 pszBuffer,
1504 ulLength,
1505 ulFlags,
1506 NULL);
1507 if (ret != CR_SUCCESS)
1508 {
1509 HeapFree(GetProcessHeap(), 0, pszBuffer);
1510 return;
1511 }
1512
1513 pszStr = pszBuffer;
1514 index = 0;
1515 while (*pszStr != 0)
1516 {
1517 len = wcslen(pszStr) + 1;
1518
1520
1521 pszStr += len;
1522 index++;
1523 }
1524
1525 HeapFree(GetProcessHeap(), 0, pszBuffer);
1526}
CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExW(_Out_ PULONG pulLen, _In_opt_ PCWSTR pszFilter, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:4019
CONFIGRET WINAPI CM_Get_Device_ID_List_ExW(_In_ PCWSTR pszFilter, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3888
uint32_t ULONG
Definition: typedefs.h:59
int ret

Referenced by DisplayDeviceProperties().

◆ DisplayDevNodeEnumerator()

static VOID DisplayDevNodeEnumerator ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1114 of file advprop.cpp.

1116{
1118
1119 DWORD dwType = 0;
1120 WCHAR szBuffer[256];
1121 DWORD dwSize = 256 * sizeof(WCHAR);
1122
1123 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1124 {
1125 DeviceInfoData = &dap->CurrentDeviceInfoData;
1126 }
1127 else
1128 {
1129 DeviceInfoData = &dap->DeviceInfoData;
1130 }
1131
1134 &dwType,
1135 &szBuffer,
1136 &dwSize,
1137 0,
1138 dap->hMachine);
1139
1140 SetListViewText(hwndListView, 0, szBuffer);
1141}
#define CM_DRP_ENUMERATOR_NAME
Definition: cfgmgr32.h:704
CONFIGRET WINAPI CM_Get_DevNode_Registry_Property_ExW(_In_ DEVINST dnDevInst, _In_ ULONG ulProperty, _Out_opt_ PULONG pulRegDataType, _Out_writes_bytes_opt_(*pulLength) PVOID Buffer, _Inout_ PULONG pulLength, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3479

Referenced by DisplayDeviceProperties().

◆ DisplayDevNodeFlags()

static VOID DisplayDevNodeFlags ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1028 of file advprop.cpp.

1030{
1031 DWORD dwStatus = 0;
1032 DWORD dwProblem = 0;
1033 INT index;
1034
1036 &dwProblem,
1037 dap->DeviceInfoData.DevInst,
1038 0,
1039 dap->hMachine);
1040
1041 index = 0;
1042 swprintf(dap->szTemp, L"%08lx", dwStatus);
1043 SetListViewText(hwndListView, index++, dap->szTemp);
1045 SetListViewText(hwndListView, index++, L"DN_ROOT_ENUMERATED");
1047 SetListViewText(hwndListView, index++, L"DN_DRIVER_LOADED");
1049 SetListViewText(hwndListView, index++, L"DN_ENUM_LOADED");
1050 if (dwStatus & DN_STARTED)
1051 SetListViewText(hwndListView, index++, L"DN_STARTED");
1052 if (dwStatus & DN_MANUAL)
1053 SetListViewText(hwndListView, index++, L"DN_MANUAL");
1055 SetListViewText(hwndListView, index++, L"DN_NEED_TO_ENUM");
1057 SetListViewText(hwndListView, index++, L"DN_DRIVER_BLOCKED");
1059 SetListViewText(hwndListView, index++, L"DN_HARDWARE_ENUM");
1061 SetListViewText(hwndListView, index++, L"DN_NEED_RESTART");
1063 SetListViewText(hwndListView, index++, L"DN_CHILD_WITH_INVALID_ID");
1065 SetListViewText(hwndListView, index++, L"DN_HAS_PROBLEM");
1066 if (dwStatus & DN_FILTERED)
1067 SetListViewText(hwndListView, index++, L"DN_FILTERED");
1069 SetListViewText(hwndListView, index++, L"DN_LEGACY_DRIVER");
1071 SetListViewText(hwndListView, index++, L"DN_DISABLEABLE");
1072 if (dwStatus & DN_REMOVABLE)
1073 SetListViewText(hwndListView, index++, L"DN_REMOVABLE");
1075 SetListViewText(hwndListView, index++, L"DN_PRIVATE_PROBLEM");
1076 if (dwStatus & DN_MF_PARENT)
1077 SetListViewText(hwndListView, index++, L"DN_MF_PARENT");
1078 if (dwStatus & DN_MF_CHILD)
1079 SetListViewText(hwndListView, index++, L"DN_MF_CHILD");
1081 SetListViewText(hwndListView, index++, L"DN_WILL_BE_REMOVED");
1082
1084 SetListViewText(hwndListView, index++, L"DN_NOT_FIRST_TIMEE");
1086 SetListViewText(hwndListView, index++, L"DN_STOP_FREE_RES");
1088 SetListViewText(hwndListView, index++, L"DN_REBAL_CANDIDATE");
1090 SetListViewText(hwndListView, index++, L"DN_BAD_PARTIAL");
1092 SetListViewText(hwndListView, index++, L"DN_NT_ENUMERATOR");
1093 if (dwStatus & DN_NT_DRIVER)
1094 SetListViewText(hwndListView, index++, L"DN_NT_DRIVER");
1095
1097 SetListViewText(hwndListView, index++, L"DN_NEEDS_LOCKING");
1098 if (dwStatus & DN_ARM_WAKEUP)
1099 SetListViewText(hwndListView, index++, L"DN_ARM_WAKEUP");
1101 SetListViewText(hwndListView, index++, L"DN_APM_ENUMERATOR");
1102 if (dwStatus & DN_APM_DRIVER)
1103 SetListViewText(hwndListView, index++, L"DN_APM_DRIVER");
1105 SetListViewText(hwndListView, index++, L"DN_SILENT_INSTALL");
1107 SetListViewText(hwndListView, index++, L"DN_NO_SHOW_IN_DM");
1109 SetListViewText(hwndListView, index++, L"DN_BOOT_LOG_PROB");
1110}
#define DN_NT_DRIVER
Definition: cfg.h:142
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
#define DN_NT_ENUMERATOR
Definition: cfg.h:141
#define DN_NOT_FIRST_TIMEE
Definition: cfg.h:137
#define DN_DRIVER_LOADED
Definition: cfg.h:119
#define DN_DISABLEABLE
Definition: cfg.h:131
#define DN_APM_DRIVER
Definition: cfg.h:146
#define DN_DRIVER_BLOCKED
Definition: cfg.h:154
#define DN_BOOT_LOG_PROB
Definition: cfg.h:149
#define DN_STOP_FREE_RES
Definition: cfg.h:138
#define DN_CHILD_WITH_INVALID_ID
Definition: cfg.h:156
#define DN_ARM_WAKEUP
Definition: cfg.h:144
#define DN_REMOVABLE
Definition: cfg.h:132
#define DN_FILTERED
Definition: cfg.h:129
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define DN_NEED_TO_ENUM
Definition: cfg.h:123
#define DN_STARTED
Definition: cfg.h:121
#define DN_BAD_PARTIAL
Definition: cfg.h:140
#define DN_HARDWARE_ENUM
Definition: cfg.h:125
#define DN_SILENT_INSTALL
Definition: cfg.h:147
#define DN_NEEDS_LOCKING
Definition: cfg.h:143
#define DN_MANUAL
Definition: cfg.h:122
#define DN_ENUM_LOADED
Definition: cfg.h:120
#define DN_WILL_BE_REMOVED
Definition: cfg.h:136
#define DN_ROOT_ENUMERATED
Definition: cfg.h:118
#define DN_LEGACY_DRIVER
Definition: cfg.h:155
#define DN_REBAL_CANDIDATE
Definition: cfg.h:139
#define DN_PRIVATE_PROBLEM
Definition: cfg.h:133
#define DN_APM_ENUMERATOR
Definition: cfg.h:145
#define DN_MF_PARENT
Definition: cfg.h:134
#define DN_NEED_RESTART
Definition: cfg.h:153
#define DN_MF_CHILD
Definition: cfg.h:135
CONFIGRET WINAPI CM_Get_DevNode_Status_Ex(_Out_ PULONG pulStatus, _Out_ PULONG pulProblemNumber, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3591
DWORD dwStatus
Definition: mediaobj.idl:95

Referenced by DisplayDeviceProperties().

◆ DisplayMatchingDeviceId()

static VOID DisplayMatchingDeviceId ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1173 of file advprop.cpp.

1175{
1178 WCHAR szBuffer[256];
1179 HKEY hKey;
1180 DWORD dwSize;
1181 DWORD dwType;
1182
1183 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1184 {
1185 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1186 DeviceInfoData = &dap->CurrentDeviceInfoData;
1187 }
1188 else
1189 {
1190 DeviceInfoSet = dap->DeviceInfoSet;
1191 DeviceInfoData = &dap->DeviceInfoData;
1192 }
1193
1197 0,
1198 DIREG_DRV,
1201 {
1202 dwSize = 256 * sizeof(WCHAR);
1204 L"MatchingDeviceId",
1205 NULL,
1206 &dwType,
1207 (LPBYTE)szBuffer,
1208 &dwSize) == ERROR_SUCCESS)
1209 {
1210 SetListViewText(hwndListView, 0, szBuffer);
1211 }
1212
1214 }
1215}

Referenced by DisplayDeviceProperties().

◆ DisplayPowerCapabilities()

static VOID DisplayPowerCapabilities ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1591 of file advprop.cpp.

1594{
1597 CM_POWER_DATA PowerData;
1598 DWORD dwSize, dwType;
1599 INT index = 0;
1600
1601 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1602 {
1603 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1604 DeviceInfoData = &dap->CurrentDeviceInfoData;
1605 }
1606 else
1607 {
1608 DeviceInfoSet = dap->DeviceInfoSet;
1609 DeviceInfoData = &dap->DeviceInfoData;
1610 }
1611
1612 dwSize = sizeof(CM_POWER_DATA);
1616 &dwType,
1617 (LPBYTE)&PowerData,
1618 dwSize,
1619 &dwSize))
1620 return;
1621
1622 if (PowerData.PD_Capabilities & PDCAP_D0_SUPPORTED)
1623 SetListViewText(hwndListView, index++, L"PDCAP_D0_SUPPORTED");
1624
1625 if (PowerData.PD_Capabilities & PDCAP_D1_SUPPORTED)
1626 SetListViewText(hwndListView, index++, L"PDCAP_D1_SUPPORTED");
1627
1628 if (PowerData.PD_Capabilities & PDCAP_D2_SUPPORTED)
1629 SetListViewText(hwndListView, index++, L"PDCAP_D2_SUPPORTED");
1630
1631 if (PowerData.PD_Capabilities & PDCAP_D3_SUPPORTED)
1632 SetListViewText(hwndListView, index++, L"PDCAP_D3_SUPPORTED");
1633
1634 if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D0_SUPPORTED)
1635 SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D0_SUPPORTED");
1636
1637 if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D1_SUPPORTED)
1638 SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D1_SUPPORTED");
1639
1640 if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D2_SUPPORTED)
1641 SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D2_SUPPORTED");
1642
1643 if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D3_SUPPORTED)
1644 SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D3_SUPPORTED");
1645
1646 if (PowerData.PD_Capabilities & PDCAP_WARM_EJECT_SUPPORTED)
1647 SetListViewText(hwndListView, index++, L"PDCAP_WARM_EJECT_SUPPORTED");
1648}
#define PDCAP_WARM_EJECT_SUPPORTED
Definition: advprop.cpp:44
#define PDCAP_D2_SUPPORTED
Definition: advprop.cpp:38
#define PDCAP_D0_SUPPORTED
Definition: advprop.cpp:36
#define PDCAP_D1_SUPPORTED
Definition: advprop.cpp:37
#define PDCAP_WAKE_FROM_D3_SUPPORTED
Definition: advprop.cpp:43
#define PDCAP_WAKE_FROM_D1_SUPPORTED
Definition: advprop.cpp:41
#define PDCAP_WAKE_FROM_D0_SUPPORTED
Definition: advprop.cpp:40
#define PDCAP_D3_SUPPORTED
Definition: advprop.cpp:39
#define PDCAP_WAKE_FROM_D2_SUPPORTED
Definition: advprop.cpp:42

Referenced by DisplayDeviceProperties().

◆ DisplayPowerStateMappings()

static VOID DisplayPowerStateMappings ( IN PDEVADVPROP_INFO  dap,
IN HWND  hwndListView 
)
static

Definition at line 1652 of file advprop.cpp.

1655{
1658 CM_POWER_DATA PowerData;
1659 DWORD dwSize, dwType;
1660 INT i;
1662 WCHAR szSystemStateBuffer[40];
1663 WCHAR szDeviceStateBuffer[40];
1664 WCHAR szOutBuffer[100];
1665
1666 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1667 {
1668 DeviceInfoSet = dap->CurrentDeviceInfoSet;
1669 DeviceInfoData = &dap->CurrentDeviceInfoData;
1670 }
1671 else
1672 {
1673 DeviceInfoSet = dap->DeviceInfoSet;
1674 DeviceInfoData = &dap->DeviceInfoData;
1675 }
1676
1677 dwSize = sizeof(CM_POWER_DATA);
1681 &dwType,
1682 (LPBYTE)&PowerData,
1683 dwSize,
1684 &dwSize))
1685 return;
1686
1688 {
1689 PowerState = PowerData.PD_PowerStateMapping[i];
1691 {
1692 swprintf(szSystemStateBuffer, L"S%u", i - 1);
1693
1694 switch (PowerState)
1695 {
1697 wcscpy(szDeviceStateBuffer, L"Not specified");
1698 break;
1699
1700 case PowerDeviceD0:
1701 wcscpy(szDeviceStateBuffer, L"D0");
1702 break;
1703
1704 case PowerDeviceD1:
1705 wcscpy(szDeviceStateBuffer, L"D1");
1706 break;
1707
1708 case PowerDeviceD2:
1709 wcscpy(szDeviceStateBuffer, L"D2");
1710 break;
1711
1712 case PowerDeviceD3:
1713 wcscpy(szDeviceStateBuffer, L"D3");
1714 break;
1715
1716 default:
1717 break;
1718 }
1719
1720 swprintf(szOutBuffer, L"%s -> %s", szSystemStateBuffer, szDeviceStateBuffer);
1721 SetListViewText(hwndListView, i, szOutBuffer);
1722 }
1723 }
1724}
@ PowerSystemMaximum
Definition: ntpoapi.h:42
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ PowerDeviceUnspecified
Definition: ntpoapi.h:48
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034

Referenced by DisplayDeviceProperties().

◆ DlgParentSubWndProc()

static LRESULT CALLBACK DlgParentSubWndProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 2755 of file advprop.cpp.

2759{
2760 PDEVADVPROP_INFO dap;
2761
2763 L"DevMgrDevChangeSub");
2764 if (dap != NULL)
2765 {
2766 if (uMsg == WM_DEVICECHANGE && !IsWindowVisible(dap->hWndGeneralPage))
2767 {
2770 wParam,
2771 lParam);
2772 }
2773
2774 /* pass the message the the old window proc */
2775 return CallWindowProc(dap->ParentOldWndProc,
2776 hwnd,
2777 uMsg,
2778 wParam,
2779 lParam);
2780 }
2781 else
2782 {
2783 /* this is not a good idea if the subclassed window was an ansi
2784 window, but we failed finding out the previous window proc
2785 so we can't use CallWindowProc. This should rarely - if ever -
2786 happen. */
2787
2788 return DefWindowProc(hwnd,
2789 uMsg,
2790 wParam,
2791 lParam);
2792 }
2793}
#define DefWindowProc
Definition: ros2win.h:31
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CallWindowProc
Definition: winuser.h:5735
#define GetProp
Definition: winuser.h:5792
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by AdvPropGeneralDlgProc().

◆ DriverDetailsDlgProc()

static INT_PTR CALLBACK DriverDetailsDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 305 of file advprop.cpp.

309{
311 INT_PTR Ret = FALSE;
312
314
315 if (dap != NULL || uMsg == WM_INITDIALOG)
316 {
317 switch (uMsg)
318 {
319 case WM_COMMAND:
320 {
321 switch (LOWORD(wParam))
322 {
323 case IDOK:
324 case IDCANCEL:
325 {
326 EndDialog(hwndDlg,
327 IDOK);
328 break;
329 }
330 }
331 break;
332 }
333
334 case WM_CLOSE:
335 {
336 EndDialog(hwndDlg,
337 IDCANCEL);
338 break;
339 }
340
341 case WM_INITDIALOG:
342 {
343 LV_COLUMN lvc;
344 HWND hDriversListView;
345 WCHAR szBuffer[260];
346
348 if (dap != NULL)
349 {
350 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
351
352 hDriversListView = GetDlgItem(hwndDlg,
354
355 /* add a column to the list view control */
356 lvc.mask = LVCF_FMT | LVCF_WIDTH;
357 lvc.fmt = LVCFMT_LEFT;
358 lvc.cx = 0;
359 (void)ListView_InsertColumn(hDriversListView,
360 0,
361 &lvc);
362
364 hDriversListView,
365 dap);
366
367 if (ListView_GetItemCount(hDriversListView) == 0)
368 {
369 if (LoadStringW(hDllInstance, IDS_NODRIVERS, szBuffer, _countof(szBuffer)))
370 MessageBoxW(hwndDlg, szBuffer, dap->szDevName, MB_OK);
371 EndDialog(hwndDlg, IDCANCEL);
372 }
373 }
374
375 Ret = TRUE;
376 break;
377 }
378
379 case WM_NOTIFY:
380 {
381 LPNMHDR pnmhdr = (LPNMHDR)lParam;
382
383 switch (pnmhdr->code)
384 {
385 case LVN_ITEMCHANGED:
386 {
388 HWND hDriversListView = GetDlgItem(hwndDlg,
390
391 if (ListView_GetSelectedCount(hDriversListView) == 0)
392 {
393 /* nothing is selected - empty the labels */
394 SetDlgItemText(hwndDlg,
396 NULL);
397 SetDlgItemText(hwndDlg,
399 NULL);
400 SetDlgItemText(hwndDlg,
402 NULL);
403 SetDlgItemText(hwndDlg,
405 NULL);
406 }
407 else if (pnmv->uNewState != 0)
408 {
409 /* extract version info and update the labels */
410 WCHAR szDriverPath[MAX_PATH];
411
412 ListView_GetItemText(hDriversListView,
413 pnmv->iItem,
414 pnmv->iSubItem,
415 szDriverPath,
416 _countof(szDriverPath));
417
419 szDriverPath);
420 }
421 }
422 }
423 break;
424 }
425 }
426 }
427
428 return Ret;
429}
static VOID UpdateDriverDetailsDlg(IN HWND hwndDlg, IN HWND hDriversListView, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:81
static VOID UpdateDriverVersionInfoDetails(IN HWND hwndDlg, IN LPCWSTR lpszDriverPath)
Definition: advprop.cpp:186
#define IDC_FILEPROVIDER
Definition: resource.h:249
#define IDS_NODRIVERS
Definition: resource.h:124
#define IDC_FILEVERSION
Definition: resource.h:250
#define IDC_DRIVERFILES
Definition: resource.h:248
#define IDC_DIGITALSIGNER
Definition: resource.h:246
#define IDC_FILECOPYRIGHT
Definition: resource.h:251
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define LV_COLUMN
Definition: commctrl.h:2547
UINT code
Definition: winuser.h:3159
UINT uNewState
Definition: commctrl.h:3036
#define WM_CLOSE
Definition: winuser.h:1621
#define IDCANCEL
Definition: winuser.h:831
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDOK
Definition: winuser.h:830
struct tagNMHDR * LPNMHDR
#define MB_OK
Definition: winuser.h:790
#define SetDlgItemText
Definition: winuser.h:5849
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by AdvProcDriverDlgProc().

◆ EnumDeviceDriverFilesCallback()

static UINT WINAPI EnumDeviceDriverFilesCallback ( IN PVOID  Context,
IN UINT  Notification,
IN UINT_PTR  Param1,
IN UINT_PTR  Param2 
)
static

Definition at line 60 of file advprop.cpp.

64{
65 LVITEM li;
67
68 li.mask = LVIF_TEXT | LVIF_STATE;
69 li.iItem = EnumDriverFilesContext->nCount++;
70 li.iSubItem = 0;
71 li.state = (li.iItem == 0 ? LVIS_SELECTED : 0);
72 li.stateMask = LVIS_SELECTED;
73 li.pszText = (LPWSTR)Param1;
74 (void)ListView_InsertItem(EnumDriverFilesContext->hDriversListView,
75 &li);
76 return NO_ERROR;
77}
#define NO_ERROR
Definition: dderror.h:5
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
struct _ENUMDRIVERFILES_CONTEXT * PENUMDRIVERFILES_CONTEXT
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_TEXT
Definition: commctrl.h:2309

Referenced by UpdateDriverDetailsDlg().

◆ GetSelectedUsageAction()

static UINT GetSelectedUsageAction ( IN HWND  hComboBox)
static

Definition at line 2084 of file advprop.cpp.

2085{
2086 INT Index;
2087 UINT Ret = 0;
2088
2089 Index = (INT)SendMessage(hComboBox,
2091 0,
2092 0);
2093 if (Index != CB_ERR)
2094 {
2095 INT iRet = (INT) SendMessage(hComboBox,
2097 (WPARAM)Index,
2098 0);
2099 if (iRet != CB_ERR)
2100 {
2101 Ret = (UINT)iRet;
2102 }
2103 }
2104
2105 return Ret;
2106}
UINT_PTR WPARAM
Definition: windef.h:207
#define CB_GETITEMDATA
Definition: winuser.h:1950

Referenced by ApplyGeneralSettings().

◆ InitDevUsageActions()

static VOID InitDevUsageActions ( IN HWND  hwndDlg,
IN HWND  hComboBox,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 2019 of file advprop.cpp.

2022{
2023 INT Index;
2024 UINT i;
2025 UINT Actions[] =
2026 {
2029 };
2030
2031 for (i = 0;
2032 i != sizeof(Actions) / sizeof(Actions[0]);
2033 i++)
2034 {
2035 /* fill in the device usage combo box */
2037 Actions[i],
2038 dap->szTemp,
2039 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2040 {
2041 Index = (INT)SendMessage(hComboBox,
2043 0,
2044 (LPARAM)dap->szTemp);
2045 if (Index != CB_ERR)
2046 {
2047 SendMessage(hComboBox,
2049 (WPARAM)Index,
2050 (LPARAM)Actions[i]);
2051
2052 switch (Actions[i])
2053 {
2054 case IDS_ENABLEDEVICE:
2055 if (dap->DeviceStarted)
2056 {
2057 SendMessage(hComboBox,
2059 (WPARAM)Index,
2060 0);
2061 }
2062 break;
2063
2064 case IDS_DISABLEDEVICE:
2065 if (!dap->DeviceStarted)
2066 {
2067 SendMessage(hComboBox,
2069 (WPARAM)Index,
2070 0);
2071 }
2072 break;
2073
2074 default:
2075 break;
2076 }
2077 }
2078 }
2079 }
2080}
#define CB_SETITEMDATA
Definition: winuser.h:1966
#define CB_SETCURSEL
Definition: winuser.h:1961
#define CB_ADDSTRING
Definition: winuser.h:1936
#define LoadString
Definition: winuser.h:5819

Referenced by UpdateDevInfo().

◆ SetListViewText()

static VOID SetListViewText ( HWND  hwnd,
INT  iItem,
LPCWSTR  lpText 
)
static

◆ UninstallDriver()

static VOID UninstallDriver ( _In_ HWND  hwndDlg,
_In_ PDEVADVPROP_INFO  dap 
)
static

Definition at line 496 of file advprop.cpp.

499{
500 SP_REMOVEDEVICE_PARAMS RemoveDevParams;
501
504 hwndDlg,
506 (ULONG_PTR)dap) == IDCANCEL)
507 return;
508
509 RemoveDevParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
511 RemoveDevParams.Scope = DI_REMOVEDEVICE_GLOBAL;
512 RemoveDevParams.HwProfile = 0;
513
514 SetupDiSetClassInstallParamsW(dap->DeviceInfoSet,
515 &dap->DeviceInfoData,
516 &RemoveDevParams.ClassInstallHeader,
517 sizeof(SP_REMOVEDEVICE_PARAMS));
518
520 dap->DeviceInfoSet,
521 &dap->DeviceInfoData);
522
523 SetupDiSetClassInstallParamsW(dap->DeviceInfoSet,
524 &dap->DeviceInfoData,
525 NULL,
526 0);
527}
static INT_PTR CALLBACK UninstallDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:435
#define IDD_UNINSTALLDRIVER
Definition: resource.h:223
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define DI_REMOVEDEVICE_GLOBAL
Definition: setupapi.h:42
#define DIF_REMOVE
Definition: setupapi.h:124
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:922

Referenced by AdvProcDriverDlgProc().

◆ UninstallDriverDlgProc()

static INT_PTR CALLBACK UninstallDriverDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 435 of file advprop.cpp.

439{
441 INT_PTR Ret = FALSE;
442
444
445 if (dap != NULL || uMsg == WM_INITDIALOG)
446 {
447 switch (uMsg)
448 {
449 case WM_INITDIALOG:
451 if (dap != NULL)
452 {
453 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
454
455 /* Set the device image */
456 SendDlgItemMessage(hwndDlg,
459 (WPARAM)dap->hDevIcon,
460 0);
461
462 /* Set the device name */
463 SetDlgItemText(hwndDlg,
465 dap->szDevName);
466 }
467
468 Ret = TRUE;
469 break;
470
471 case WM_COMMAND:
472 switch (LOWORD(wParam))
473 {
474 case IDOK:
475 EndDialog(hwndDlg, IDOK);
476 break;
477
478 case IDCANCEL:
479 EndDialog(hwndDlg, IDCANCEL);
480 break;
481 }
482 break;
483
484 case WM_CLOSE:
485 EndDialog(hwndDlg, IDCANCEL);
486 break;
487 }
488 }
489
490 return Ret;
491}
#define IDC_DEVNAME
Definition: resource.h:226
#define IDC_DEVICON
Definition: resource.h:225
#define STM_SETICON
Definition: winuser.h:2092
#define SendDlgItemMessage
Definition: winuser.h:5842

Referenced by UninstallDriver().

◆ UpdateDetailsDlg()

static VOID UpdateDetailsDlg ( IN HWND  hwndDlg,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 770 of file advprop.cpp.

772{
773 HWND hwndComboBox;
775 LV_COLUMN lvc;
776 RECT rcClient;
777
778 UINT i;
779 UINT Properties[] =
780 {
805 };
806
807
808 /* set the device image */
809 SendDlgItemMessage(hwndDlg,
812 (WPARAM)dap->hDevIcon,
813 0);
814
815 /* set the device name edit control text */
816 SetDlgItemText(hwndDlg,
818 dap->szDevName);
819
820
821 hwndComboBox = GetDlgItem(hwndDlg,
823
824 hwndListView = GetDlgItem(hwndDlg,
826
827 for (i = 0; i != sizeof(Properties) / sizeof(Properties[0]); i++)
828 {
829 /* fill in the device usage combo box */
831 Properties[i],
832 dap->szTemp,
833 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
834 {
835 SendMessage(hwndComboBox,
837 0,
838 (LPARAM)dap->szTemp);
839 }
840 }
841
842
844 &rcClient);
845
846 /* add a column to the list view control */
847 lvc.mask = LVCF_FMT | LVCF_WIDTH;
848 lvc.fmt = LVCFMT_LEFT;
849 lvc.cx = rcClient.right;
851 0,
852 &lvc);
853
854 SendMessage(hwndComboBox,
856 0,
857 0);
858
859 SetListViewText(hwndListView, 0, dap->szDeviceID);
860
861 SetFocus(hwndComboBox);
862}
#define IDS_PROP_CAPABILITIES
Definition: resource.h:197
#define IDS_PROP_SERVICE
Definition: resource.h:195
#define IDS_PROP_REMOVALRELATIONS
Definition: resource.h:202
#define IDS_PROP_FIRMWAREREVISION
Definition: resource.h:211
#define IDS_PROP_DEVICEID
Definition: resource.h:191
#define IDS_PROP_CLASSCOINSTALLER
Definition: resource.h:209
#define IDS_PROP_DEVLOWERFILTERS
Definition: resource.h:205
#define IDS_PROP_CLASSINSTALLER
Definition: resource.h:208
#define IDS_PROP_DEVICECOINSTALLER
Definition: resource.h:210
#define IDS_PROP_EJECTIONRELATIONS
Definition: resource.h:201
#define IDS_PROP_POWERSTATEMAPPINGS
Definition: resource.h:214
#define IDS_PROP_CLASSLOWERFILTERS
Definition: resource.h:207
#define IDS_PROP_COMPATIBLEIDS
Definition: resource.h:193
#define IDS_PROP_CLASSUPPERFILTERS
Definition: resource.h:206
#define IDS_PROP_CSCONFIGFLAGS
Definition: resource.h:200
#define IDS_PROP_MATCHINGDEVICEID
Definition: resource.h:194
#define IDS_PROP_BUSRELATIONS
Definition: resource.h:203
#define IDS_PROP_DEVUPPERFILTERS
Definition: resource.h:204
#define IDS_PROP_DEVNODEFLAGS
Definition: resource.h:198
#define IDS_PROP_ENUMERATOR
Definition: resource.h:196
#define IDS_PROP_CONFIGFLAGS
Definition: resource.h:199
#define IDS_PROP_POWERCAPABILITIES
Definition: resource.h:213
#define IDS_PROP_HARDWAREIDS
Definition: resource.h:192
#define IDS_PROP_CURRENTPOWERSTATE
Definition: resource.h:212
LONG right
Definition: windef.h:308
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by AdvProcDetailsDlgProc().

◆ UpdateDevInfo()

static VOID UpdateDevInfo ( IN HWND  hwndDlg,
IN PDEVADVPROP_INFO  dap,
IN BOOL  ReOpen 
)
static

Definition at line 2177 of file advprop.cpp.

2180{
2181 HWND hDevUsage, hPropSheetDlg, hDevProbBtn;
2182 CONFIGRET cr;
2183 ULONG Status, ProblemNumber;
2184 SP_DEVINSTALL_PARAMS_W InstallParams;
2185 UINT TroubleShootStrId = IDS_TROUBLESHOOTDEV;
2186 BOOL bFlag, bDevActionAvailable = TRUE;
2187 BOOL bDrvInstalled = FALSE;
2188 DWORD iPage;
2191 PROPSHEETHEADER psh;
2192 DWORD nDriverPages = 0;
2193 BOOL RecalcPages = FALSE;
2194
2195 hPropSheetDlg = GetParent(hwndDlg);
2196
2197 if (dap->PageInitialized)
2198 {
2199 /* switch to the General page */
2200 PropSheet_SetCurSelByID(hPropSheetDlg,
2202
2203 /* remove and destroy the existing device property sheet pages */
2204 if (dap->DevPropSheets != NULL)
2205 {
2206 for (iPage = 0;
2207 iPage != dap->nDevPropSheets;
2208 iPage++)
2209 {
2210 if (dap->DevPropSheets[iPage] != NULL)
2211 {
2212 PropSheet_RemovePage(hPropSheetDlg,
2213 (WPARAM) -1,
2214 dap->DevPropSheets[iPage]);
2215 RecalcPages = TRUE;
2216 }
2217 }
2218 }
2219 }
2220
2221 iPage = 0;
2222
2223 if (dap->FreeDevPropSheets)
2224 {
2225 /* don't free the array if it's the one allocated in
2226 DisplayDeviceAdvancedProperties */
2228 0,
2229 dap->DevPropSheets);
2230
2231 dap->FreeDevPropSheets = FALSE;
2232 }
2233
2234 dap->DevPropSheets = NULL;
2235 dap->nDevPropSheets = 0;
2236
2237 if (ReOpen)
2238 {
2239 /* create a new device info set and re-open the device */
2240 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2241 {
2242 SetupDiDestroyDeviceInfoList(dap->CurrentDeviceInfoSet);
2243 }
2244
2245 dap->ParentDevInst = 0;
2246 dap->CurrentDeviceInfoSet = SetupDiCreateDeviceInfoListEx(NULL,
2247 hwndDlg,
2248 dap->lpMachineName,
2249 NULL);
2250 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2251 {
2252 if (SetupDiOpenDeviceInfo(dap->CurrentDeviceInfoSet,
2253 dap->szDeviceID,
2254 hwndDlg,
2255 0,
2256 &dap->CurrentDeviceInfoData))
2257 {
2258 if (dap->CloseDevInst)
2259 {
2260 SetupDiDestroyDeviceInfoList(dap->DeviceInfoSet);
2261 }
2262
2263 dap->CloseDevInst = TRUE;
2264 dap->DeviceInfoSet = dap->CurrentDeviceInfoSet;
2265 dap->DeviceInfoData = dap->CurrentDeviceInfoData;
2266 dap->CurrentDeviceInfoSet = INVALID_HANDLE_VALUE;
2267 }
2268 else
2269 goto GetParentNode;
2270 }
2271 else
2272 {
2273GetParentNode:
2274 /* get the parent node from the initial devinst */
2275 CM_Get_Parent_Ex(&dap->ParentDevInst,
2276 dap->DeviceInfoData.DevInst,
2277 0,
2278 dap->hMachine);
2279 }
2280
2281 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2282 {
2283 DeviceInfoSet = dap->CurrentDeviceInfoSet;
2284 DeviceInfoData = &dap->CurrentDeviceInfoData;
2285 }
2286 else
2287 {
2288 DeviceInfoSet = dap->DeviceInfoSet;
2289 DeviceInfoData = &dap->DeviceInfoData;
2290 }
2291 }
2292 else
2293 {
2294 DeviceInfoSet = dap->DeviceInfoSet;
2295 DeviceInfoData = &dap->DeviceInfoData;
2296 }
2297
2298 dap->HasDriverPage = TRUE;
2299 dap->HasResourcePage = TRUE;
2300 dap->HasPowerPage = TRUE;
2302 dap->hMachine,
2303 &bDrvInstalled) &&
2304 bDrvInstalled)
2305 {
2306 if (SetupDiCallClassInstaller((dap->ShowRemotePages ?
2311 {
2312 /* get install params */
2313 InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
2316 &InstallParams))
2317 {
2318 /* zero the flags */
2319 InstallParams.Flags = 0;
2320 InstallParams.FlagsEx = 0;
2321 }
2322
2323 dap->HasDriverPage = !(InstallParams.Flags & DI_DRIVERPAGE_ADDED);
2324 dap->HasResourcePage = !(InstallParams.Flags & DI_RESOURCEPAGE_ADDED);
2325 dap->HasPowerPage = !(InstallParams.FlagsEx & DI_FLAGSEX_POWERPAGE_ADDED);
2326 }
2327 }
2328
2329 /* get the device icon */
2330 if (dap->hDevIcon != NULL)
2331 {
2332 DestroyIcon(dap->hDevIcon);
2333 dap->hDevIcon = NULL;
2334 }
2336 &dap->hDevIcon,
2337 NULL))
2338 {
2339 dap->hDevIcon = NULL;
2340 }
2341
2342 /* get the device name */
2345 dap->szDevName,
2346 sizeof(dap->szDevName) / sizeof(dap->szDevName[0])))
2347 {
2348 PropSheet_SetTitle(hPropSheetDlg,
2350 dap->szDevName);
2351 }
2352
2353 /* set the device image */
2354 SendDlgItemMessage(hwndDlg,
2357 (WPARAM)dap->hDevIcon,
2358 0);
2359
2360 /* set the device name edit control text */
2361 SetDlgItemText(hwndDlg,
2363 dap->szDevName);
2364
2365 /* set the device type edit control text */
2367 dap->szTemp,
2368 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2369 {
2370 SetDlgItemText(hwndDlg,
2372 dap->szTemp);
2373 }
2374
2375 /* set the device manufacturer edit control text */
2378 dap->szTemp,
2379 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2380 {
2381 SetDlgItemText(hwndDlg,
2383 dap->szTemp);
2384 }
2385
2386 /* set the device location edit control text */
2389 dap->ParentDevInst,
2390 dap->szTemp,
2391 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2392 {
2393 SetDlgItemText(hwndDlg,
2395 dap->szTemp);
2396 }
2397
2398 /* set the device status edit control text */
2400 dap->hMachine,
2401 dap->szTemp,
2402 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2403 {
2404 SetDlgItemText(hwndDlg,
2406 dap->szTemp);
2407 }
2408
2409 /* set the device troubleshoot button text and disable it if necessary */
2410 hDevProbBtn = GetDlgItem(hwndDlg,
2413 &ProblemNumber,
2415 0,
2416 dap->hMachine);
2417 if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
2418 {
2419 switch (ProblemNumber)
2420 {
2422 {
2423 /* FIXME - only if it's not a root bus devloader,
2424 disable the button otherwise */
2425 TroubleShootStrId = IDS_UPDATEDRV;
2426 break;
2427 }
2428
2433 case CM_PROB_LIAR:
2435 {
2436 TroubleShootStrId = IDS_UPDATEDRV;
2437 break;
2438 }
2439
2443 {
2444 /* FIXME - Troubleshoot conflict */
2445 break;
2446 }
2447
2449 case CM_PROB_REINSTALL:
2451 {
2452 TroubleShootStrId = IDS_REINSTALLDRV;
2453 break;
2454 }
2455
2457 {
2458 /* FIXME - 4 cases:
2459 1) if it's a missing system devloader:
2460 - disable the button (Reinstall Driver)
2461 2) if it's not a system devloader but still missing:
2462 - Reinstall Driver
2463 3) if it's not a system devloader but the file can be found:
2464 - Update Driver
2465 4) if it's a missing or empty software key
2466 - Update Driver
2467 */
2468 break;
2469 }
2470
2478 case CM_PROB_PHANTOM:
2479 bDevActionAvailable = FALSE;
2480 break;
2481
2484 /* FIXME - search hardware */
2485 break;
2486
2489 case CM_PROB_MOVED:
2490 case CM_PROB_TOO_EARLY:
2492 TroubleShootStrId = IDS_REBOOT;
2493 break;
2494
2495 case CM_PROB_REGISTRY:
2496 /* FIXME - check registry? */
2497 break;
2498
2499 case CM_PROB_DISABLED:
2500 /* if device was disabled by the user: */
2501 TroubleShootStrId = IDS_ENABLEDEV;
2502 /* FIXME - otherwise disable button because the device was
2503 disabled by the system*/
2504 break;
2505
2507 /* FIXME - if it's a graphics adapter:
2508 - if it's a a secondary adapter and the main adapter
2509 couldn't be found
2510 - disable button
2511 - else
2512 - Properties
2513 - else
2514 - Update driver
2515 */
2516 break;
2517
2518 case CM_PROB_FAILED_ADD:
2519 TroubleShootStrId = IDS_PROPERTIES;
2520 break;
2521 }
2522 }
2523
2525 TroubleShootStrId,
2526 dap->szTemp,
2527 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])) != 0)
2528 {
2529 SetWindowText(hDevProbBtn,
2530 dap->szTemp);
2531 }
2532 EnableWindow(hDevProbBtn,
2533 dap->IsAdmin && bDevActionAvailable);
2534
2535 /* check if the device can be enabled/disabled */
2536 hDevUsage = GetDlgItem(hwndDlg,
2537 IDC_DEVUSAGE);
2538
2539 dap->CanDisable = FALSE;
2540 dap->DeviceStarted = FALSE;
2541
2543 dap->hMachine,
2544 &bFlag))
2545 {
2546 dap->CanDisable = bFlag;
2547 }
2548
2550 dap->hMachine,
2551 &bFlag))
2552 {
2553 dap->DeviceStarted = bFlag;
2554 }
2555
2556 /* enable/disable the device usage controls */
2557 EnableWindow(GetDlgItem(hwndDlg,
2559 dap->CanDisable && dap->IsAdmin);
2560 EnableWindow(hDevUsage,
2561 dap->CanDisable && dap->IsAdmin);
2562
2563 /* clear the combobox */
2564 SendMessage(hDevUsage,
2566 0,
2567 0);
2568 if (dap->CanDisable)
2569 {
2570 InitDevUsageActions(hwndDlg,
2571 hDevUsage,
2572 dap);
2573 }
2574
2575 /* find out how many new device property sheets to add.
2576 fake a PROPSHEETHEADER structure, we don't plan to
2577 call PropertySheet again!*/
2578 psh.dwSize = sizeof(PROPSHEETHEADER);
2579 psh.dwFlags = 0;
2580 psh.nPages = 0;
2581
2582 /* get the number of device property sheets for the device */
2585 &psh,
2586 0,
2587 &nDriverPages,
2588 dap->PropertySheetType) &&
2589 nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
2590 {
2591 dap->nDevPropSheets += nDriverPages;
2592 }
2593 else
2594 {
2595 nDriverPages = 0;
2596 }
2597
2598 dap->pResourceList = GetResourceList(dap->szDeviceID);
2599
2600 /* include the driver page */
2601 if (dap->HasDriverPage)
2602 dap->nDevPropSheets++;
2603
2604 /* include the details page */
2605 if (dap->Extended)
2606 dap->nDevPropSheets++;
2607
2608 if (dap->HasResourcePage && dap->pResourceList != NULL)
2609 dap->nDevPropSheets++;
2610
2611 /* add the device property sheets */
2612 if (dap->nDevPropSheets != 0)
2613 {
2614 dap->DevPropSheets = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
2616 dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
2617 if (dap->DevPropSheets != NULL)
2618 {
2619 if (nDriverPages != 0)
2620 {
2621 psh.phpage = dap->DevPropSheets;
2622
2623 /* query the device property sheet pages to add */
2626 &psh,
2627 dap->nDevPropSheets,
2628 NULL,
2629 dap->PropertySheetType))
2630 {
2631 /* add the property sheets */
2632 for (iPage = 0;
2633 iPage < nDriverPages;
2634 iPage++)
2635 {
2636 if (PropSheet_AddPage(hPropSheetDlg,
2637 dap->DevPropSheets[iPage]))
2638 {
2639 RecalcPages = TRUE;
2640 }
2641 }
2642
2643 dap->FreeDevPropSheets = TRUE;
2644 }
2645 else
2646 {
2647 /* cleanup, we were unable to get the device property sheets */
2648 iPage = nDriverPages;
2649 dap->nDevPropSheets -= nDriverPages;
2650 nDriverPages = 0;
2651 }
2652 }
2653 else
2654 iPage = 0;
2655
2656 /* add the driver page if necessary */
2657 if (dap->HasDriverPage)
2658 {
2659 PROPSHEETPAGE pspDriver = {0};
2660 pspDriver.dwSize = sizeof(PROPSHEETPAGE);
2661 pspDriver.dwFlags = PSP_DEFAULT;
2662 pspDriver.hInstance = hDllInstance;
2663 pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDRIVER);
2664 pspDriver.pfnDlgProc = AdvProcDriverDlgProc;
2665 pspDriver.lParam = (LPARAM)dap;
2666 dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
2667 if (dap->DevPropSheets[iPage] != NULL)
2668 {
2669 if (PropSheet_AddPage(hPropSheetDlg,
2670 dap->DevPropSheets[iPage]))
2671 {
2672 iPage++;
2673 RecalcPages = TRUE;
2674 }
2675 else
2676 {
2677 dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2678 dap->DevPropSheets[iPage] = NULL;
2679 }
2680 }
2681 }
2682
2683 if (dap->Extended)
2684 {
2685 /* Add the details page */
2686 PROPSHEETPAGE pspDetails = {0};
2687 pspDetails.dwSize = sizeof(PROPSHEETPAGE);
2688 pspDetails.dwFlags = PSP_DEFAULT;
2689 pspDetails.hInstance = hDllInstance;
2690 pspDetails.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDETAILS);
2691 pspDetails.pfnDlgProc = AdvProcDetailsDlgProc;
2692 pspDetails.lParam = (LPARAM)dap;
2693 dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDetails);
2694 if (dap->DevPropSheets[iPage] != NULL)
2695 {
2696 if (PropSheet_AddPage(hPropSheetDlg,
2697 dap->DevPropSheets[iPage]))
2698 {
2699 iPage++;
2700 RecalcPages = TRUE;
2701 }
2702 else
2703 {
2704 dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2705 dap->DevPropSheets[iPage] = NULL;
2706 }
2707 }
2708 }
2709
2710 if (dap->HasResourcePage && dap->pResourceList)
2711 {
2712 PROPSHEETPAGE pspDriver = {0};
2713 pspDriver.dwSize = sizeof(PROPSHEETPAGE);
2714 pspDriver.dwFlags = PSP_DEFAULT;
2715 pspDriver.hInstance = hDllInstance;
2716 pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICERESOURCES);
2717 pspDriver.pfnDlgProc = ResourcesProcDriverDlgProc;
2718 pspDriver.lParam = (LPARAM)dap;
2719 dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
2720 if (dap->DevPropSheets[iPage] != NULL)
2721 {
2722 if (PropSheet_AddPage(hPropSheetDlg,
2723 dap->DevPropSheets[iPage]))
2724 {
2725 iPage++;
2726 RecalcPages = TRUE;
2727 }
2728 else
2729 {
2730 dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2731 dap->DevPropSheets[iPage] = NULL;
2732 }
2733 }
2734 }
2735 /* FIXME: Add the power page */
2736 }
2737 else
2738 dap->nDevPropSheets = 0;
2739 }
2740
2741 if (RecalcPages)
2742 {
2743 PropSheet_RecalcPageSizes(hPropSheetDlg);
2744 }
2745
2746 /* finally, disable the apply button */
2747 PropSheet_UnChanged(hPropSheetDlg,
2748 hwndDlg);
2749 dap->DeviceUsageChanged = FALSE;
2750}
static VOID InitDevUsageActions(IN HWND hwndDlg, IN HWND hComboBox, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:2019
static INT_PTR CALLBACK AdvProcDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:678
static INT_PTR CALLBACK AdvProcDetailsDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:1886
#define IDS_PROPERTIES
Definition: resource.h:102
#define CM_PROB_REGISTRY
Definition: cfg.h:49
#define CM_PROB_REINSTALL
Definition: cfg.h:48
#define CM_PROB_BOOT_CONFIG_CONFLICT
Definition: cfg.h:36
#define CM_PROB_FAILED_ADD
Definition: cfg.h:61
#define CM_PROB_INVALID_DATA
Definition: cfg.h:39
#define CM_PROB_HARDWARE_DISABLED
Definition: cfg.h:59
#define CM_PROB_TRANSLATION_FAILED
Definition: cfg.h:63
#define CM_PROB_PARTIAL_LOG_CONF
Definition: cfg.h:46
#define CM_PROB_LIAR
Definition: cfg.h:41
#define CM_PROB_REENUMERATION
Definition: cfg.h:45
#define CM_PROB_NORMAL_CONFLICT
Definition: cfg.h:42
#define CM_PROB_NEED_RESTART
Definition: cfg.h:44
#define CM_PROB_UNKNOWN_RESOURCE
Definition: cfg.h:47
#define CM_PROB_DEVICE_NOT_THERE
Definition: cfg.h:54
#define CM_PROB_DISABLED
Definition: cfg.h:52
#define CM_PROB_FAILED_FILTER
Definition: cfg.h:37
#define CM_PROB_WILL_BE_REMOVED
Definition: cfg.h:51
#define CM_PROB_DEVLOADER_FAILED
Definition: cfg.h:32
#define CM_PROB_FAILED_START
Definition: cfg.h:40
#define CM_PROB_PHANTOM
Definition: cfg.h:75
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
#define CM_PROB_OUT_OF_MEMORY
Definition: cfg.h:33
#define CM_PROB_NOT_VERIFIED
Definition: cfg.h:43
#define CM_PROB_SYSTEM_SHUTDOWN
Definition: cfg.h:76
#define CM_PROB_NO_VALID_LOG_CONF
Definition: cfg.h:57
#define CM_PROB_LACKED_ARBITRATOR
Definition: cfg.h:35
#define CM_PROB_DEVLOADER_NOT_READY
Definition: cfg.h:53
#define CM_PROB_DISABLED_SERVICE
Definition: cfg.h:62
#define CM_PROB_DEVLOADER_NOT_FOUND
Definition: cfg.h:38
#define CM_PROB_TOO_EARLY
Definition: cfg.h:56
#define CM_PROB_MOVED
Definition: cfg.h:55
#define CM_PROB_ENTRY_IS_WRONG_TYPE
Definition: cfg.h:34
#define CM_PROB_CANT_SHARE_IRQ
Definition: cfg.h:60
CONFIGRET WINAPI CM_Get_Parent_Ex(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:5314
BOOL IsDeviceStarted(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsStarted)
Definition: misc.cpp:735
BOOL GetDeviceLocationString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:318
BOOL GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:281
BOOL CanDisableDevice(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
Definition: misc.cpp:711
BOOL GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:849
BOOL GetDeviceStatusString(IN DEVINST DevInst, IN HMACHINE hMachine, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:443
BOOL GetDeviceDescriptionString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:880
BOOL IsDriverInstalled(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *Installed)
Definition: misc.cpp:759
#define IDC_DEVMANUFACTURER
Definition: resource.h:228
#define IDS_ENABLEDEV
Definition: resource.h:117
#define IDD_DEVICERESOURCES
Definition: resource.h:219
#define IDS_REINSTALLDRV
Definition: resource.h:120
#define IDS_REBOOT
Definition: resource.h:121
#define IDC_DEVLOCATION
Definition: resource.h:229
#define IDS_UPDATEDRV
Definition: resource.h:119
#define IDD_DEVICEDETAILS
Definition: resource.h:221
#define IDC_DEVTYPE
Definition: resource.h:227
#define IDD_DEVICEDRIVER
Definition: resource.h:218
#define IDC_DEVSTATUS
Definition: resource.h:231
#define IDC_DEVUSAGELABEL
Definition: resource.h:241
#define IDS_TROUBLESHOOTDEV
Definition: resource.h:116
BOOL WINAPI SetupDiLoadClassIcon(IN CONST GUID *ClassGuid, OUT HICON *LargeIcon OPTIONAL, OUT PINT MiniIconIndex OPTIONAL)
Definition: devclass.c:658
Status
Definition: gdiplustypes.h:25
INT_PTR CALLBACK ResourcesProcDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: hwresource.cpp:316
PVOID GetResourceList(LPWSTR pszDeviceID)
Definition: hwresource.cpp:357
#define PropSheet_AddPage(d, p)
Definition: prsht.h:341
#define PropSheet_RemovePage(d, i, p)
Definition: prsht.h:351
#define PropSheet_SetTitle(d, w, s)
Definition: prsht.h:356
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PropSheet_RecalcPageSizes(d)
Definition: prsht.h:359
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
Definition: setupapi.h:159
#define DI_RESOURCEPAGE_ADDED
Definition: setupapi.h:59
#define SetupDiOpenDeviceInfo
Definition: setupapi.h:2614
#define DI_DRIVERPAGE_ADDED
Definition: setupapi.h:71
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define SetupDiCreateDeviceInfoListEx
Definition: setupapi.h:2580
#define SetupDiGetClassDevPropertySheets
Definition: setupapi.h:2592
#define DIF_ADDPROPERTYPAGE_ADVANCED
Definition: setupapi.h:154
#define DI_FLAGSEX_POWERPAGE_ADDED
Definition: setupapi.h:100
#define CB_RESETCONTENT
Definition: winuser.h:1959
#define SetWindowText
Definition: winuser.h:5857

Referenced by AdvPropGeneralDlgProc().

◆ UpdateDriver()

static VOID UpdateDriver ( IN HWND  hwndDlg,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 532 of file advprop.cpp.

535{
537 HANDLE hToken;
538 DWORD dwReboot;
540
541 // Better use InstallDevInst:
542 // BOOL
543 // WINAPI
544 // InstallDevInst(
545 // HWND hWnd,
546 // LPWSTR wszDeviceId,
547 // BOOL bUpdate,
548 // DWORD *dwReboot);
549 // See: http://comp.os.ms-windows.programmer.win32.narkive.com/J8FTd4KK/signature-of-undocumented-installdevinstex
550
551 if (!InstallDevInst(hwndDlg, dap->szDeviceID, TRUE, &dwReboot))
552 return;
553
554 if (NeedReboot == FALSE)
555 return;
556
557 //FIXME: load text from resource file
558 if (MessageBoxW(hwndDlg, L"Reboot now?", L"Reboot required", MB_YESNO | MB_ICONQUESTION) != IDYES)
559 return;
560
562 {
563 ERR("OpenProcessToken failed\n");
564 return;
565 }
566
567 /* Get the LUID for the Shutdown privilege */
568 if (!LookupPrivilegeValueW(NULL, SE_SHUTDOWN_NAME, &Privileges.Privileges[0].Luid))
569 {
570 ERR("LookupPrivilegeValue failed\n");
571 CloseHandle(hToken);
572 return;
573 }
574
575 /* Assign the Shutdown privilege to our process */
576 Privileges.PrivilegeCount = 1;
577 Privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
578
579 if (!AdjustTokenPrivileges(hToken, FALSE, &Privileges, 0, NULL, NULL))
580 {
581 ERR("AdjustTokenPrivileges failed\n");
582 CloseHandle(hToken);
583 return;
584 }
585
586 /* Finally shut down the system */
587 if (!ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
588 {
589 ERR("ExitWindowsEx failed\n");
590 CloseHandle(hToken);
591 }
592}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: stubs.cpp:24
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
#define MB_YESNO
Definition: winuser.h:817
#define EWX_REBOOT
Definition: winuser.h:638
#define MB_ICONQUESTION
Definition: winuser.h:789
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define IDYES
Definition: winuser.h:835
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:17
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:930
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by AdvProcDriverDlgProc().

◆ UpdateDriverDetailsDlg()

static VOID UpdateDriverDetailsDlg ( IN HWND  hwndDlg,
IN HWND  hDriversListView,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 81 of file advprop.cpp.

84{
87 SP_DRVINFO_DATA DriverInfoData;
88 ENUMDRIVERFILES_CONTEXT EnumDriverFilesContext;
89
90 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
91 {
92 DeviceInfoSet = dap->CurrentDeviceInfoSet;
93 DeviceInfoData = &dap->CurrentDeviceInfoData;
94 }
95 else
96 {
97 DeviceInfoSet = dap->DeviceInfoSet;
98 DeviceInfoData = &dap->DeviceInfoData;
99 }
100
101 /* set the device image */
102 SendDlgItemMessage(hwndDlg,
105 (WPARAM)dap->hDevIcon,
106 0);
107
108 /* set the device name edit control text */
109 SetDlgItemText(hwndDlg,
111 dap->szDevName);
112
113 /* fill the driver files list view */
114 EnumDriverFilesContext.hDriversListView = hDriversListView;
115 EnumDriverFilesContext.nCount = 0;
116
117 (void)ListView_DeleteAllItems(EnumDriverFilesContext.hDriversListView);
118 DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
121 &DriverInfoData) &&
124 &DriverInfoData))
125 {
126 HSPFILEQ queueHandle;
127
128 queueHandle = SetupOpenFileQueue();
129 if (queueHandle != (HSPFILEQ)INVALID_HANDLE_VALUE)
130 {
136 {
137 DeviceInstallParams.FileQueue = queueHandle;
139
146 {
147 DWORD scanResult;
148 RECT rcClient;
149 LVCOLUMN lvc;
150
151 /* enumerate the driver files */
152 SetupScanFileQueue(queueHandle,
154 NULL,
156 &EnumDriverFilesContext,
157 &scanResult);
158
159 /* update the list view column width */
160 GetClientRect(hDriversListView,
161 &rcClient);
162 lvc.mask = LVCF_WIDTH;
163 lvc.cx = rcClient.right;
164 (void)ListView_SetColumn(hDriversListView,
165 0,
166 &lvc);
167
168 /* highlight the first item from list */
169 if (ListView_GetSelectedCount(hDriversListView) != 0)
170 {
171 ListView_SetItemState(hDriversListView,
172 0,
175 }
176 }
177 }
178
179 SetupCloseFileQueue(queueHandle);
180 }
181 }
182}
static UINT WINAPI EnumDeviceDriverFilesCallback(IN PVOID Context, IN UINT Notification, IN UINT_PTR Param1, IN UINT_PTR Param2)
Definition: advprop.cpp:60
BOOL FindCurrentDriver(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT PSP_DRVINFO_DATA DriverInfoData)
Definition: misc.cpp:924
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ListView_SetColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2629
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define LVCOLUMN
Definition: commctrl.h:2581
#define SetupOpenFileQueue
Definition: fileqsup.c:29
#define SetupCloseFileQueue
Definition: fileqsup.c:30
#define SPQ_SCAN_USE_CALLBACK
Definition: setupapi.h:619
#define DI_NOVCP
Definition: setupapi.h:49
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:140
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2599
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1155
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1054
#define SetupDiSetDeviceInstallParams
Definition: setupapi.h:2619
#define SetupDiSetSelectedDriver
Definition: setupapi.h:2622
#define SetupScanFileQueue
Definition: setupapi.h:2675

Referenced by DriverDetailsDlgProc().

◆ UpdateDriverDlg()

static VOID UpdateDriverDlg ( IN HWND  hwndDlg,
IN PDEVADVPROP_INFO  dap 
)
static

Definition at line 596 of file advprop.cpp.

598{
601 DWORD dwStatus = 0;
602 DWORD dwProblem = 0;
603 CONFIGRET cr;
604
605 if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
606 {
607 DeviceInfoSet = dap->CurrentDeviceInfoSet;
608 DeviceInfoData = &dap->CurrentDeviceInfoData;
609 }
610 else
611 {
612 DeviceInfoSet = dap->DeviceInfoSet;
613 DeviceInfoData = &dap->DeviceInfoData;
614 }
615
616 /* set the device image */
617 SendDlgItemMessage(hwndDlg,
620 (WPARAM)dap->hDevIcon,
621 0);
622
623 /* set the device name edit control text */
624 SetDlgItemText(hwndDlg,
626 dap->szDevName);
627
628 /* query the driver provider */
631 dap->szTemp,
632 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
633 {
634 SetDlgItemText(hwndDlg,
636 dap->szTemp);
637 }
638
639 /* query the driver date */
642 dap->szTemp,
643 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
644 {
645 SetDlgItemText(hwndDlg,
647 dap->szTemp);
648 }
649
650 /* query the driver version */
653 dap->szTemp,
654 sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
655 {
656 SetDlgItemText(hwndDlg,
658 dap->szTemp);
659 }
660
661 /* Disable the Uninstall button if the driver cannot be removed */
663 &dwProblem,
664 dap->DeviceInfoData.DevInst,
665 0,
666 dap->hMachine);
667 if (cr == CR_SUCCESS)
668 {
669 if ((dwStatus & DN_ROOT_ENUMERATED) != 0 &&
670 (dwStatus & DN_DISABLEABLE) == 0)
672 }
673}
BOOL GetDriverVersionString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:562
BOOL GetDriverDateString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:619
BOOL GetDriverProviderString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:504
#define IDC_DRVPROVIDER
Definition: resource.h:243
#define IDC_DRVDATE
Definition: resource.h:244
#define IDC_DRVVERSION
Definition: resource.h:245

Referenced by AdvProcDriverDlgProc().

◆ UpdateDriverVersionInfoDetails()

static VOID UpdateDriverVersionInfoDetails ( IN HWND  hwndDlg,
IN LPCWSTR  lpszDriverPath 
)
static

Definition at line 186 of file advprop.cpp.

188{
189 DWORD dwHandle;
190 DWORD dwVerInfoSize;
191 LPVOID lpData = NULL;
192 LPVOID lpInfo;
193 UINT uInfoLen;
194 DWORD dwLangId;
195 WCHAR szLangInfo[255];
196 WCHAR szLangPath[MAX_PATH];
197 LPWSTR lpCompanyName = NULL;
198 LPWSTR lpFileVersion = NULL;
199 LPWSTR lpLegalCopyright = NULL;
200 LPWSTR lpDigitalSigner = NULL;
201 UINT uBufLen;
202 WCHAR szNotAvailable[255];
203
204 /* extract version info from selected file */
205 dwVerInfoSize = GetFileVersionInfoSize(lpszDriverPath,
206 &dwHandle);
207 if (!dwVerInfoSize)
208 goto done;
209
210 lpData = HeapAlloc(GetProcessHeap(),
212 dwVerInfoSize);
213 if (!lpData)
214 goto done;
215
216 if (!GetFileVersionInfo(lpszDriverPath,
217 dwHandle,
218 dwVerInfoSize,
219 lpData))
220 goto done;
221
222 if (!VerQueryValue(lpData,
223 L"\\VarFileInfo\\Translation",
224 &lpInfo,
225 &uInfoLen))
226 goto done;
227
228 dwLangId = *(LPDWORD)lpInfo;
229 swprintf(szLangInfo, L"\\StringFileInfo\\%04x%04x\\",
230 LOWORD(dwLangId), HIWORD(dwLangId));
231
232 /* read CompanyName */
233 wcscpy(szLangPath, szLangInfo);
234 wcscat(szLangPath, L"CompanyName");
235
236 VerQueryValue(lpData,
237 szLangPath,
238 (void **)&lpCompanyName,
239 (PUINT)&uBufLen);
240
241 /* read FileVersion */
242 wcscpy(szLangPath, szLangInfo);
243 wcscat(szLangPath, L"FileVersion");
244
245 VerQueryValue(lpData,
246 szLangPath,
247 (void **)&lpFileVersion,
248 (PUINT)&uBufLen);
249
250 /* read LegalTrademarks */
251 wcscpy(szLangPath, szLangInfo);
252 wcscat(szLangPath, L"LegalCopyright");
253
254 VerQueryValue(lpData,
255 szLangPath,
256 (void **)&lpLegalCopyright,
257 (PUINT)&uBufLen);
258
259 /* TODO: read digital signer info */
260
261done:
264 szNotAvailable,
265 sizeof(szNotAvailable) / sizeof(WCHAR)))
266 {
267 wcscpy(szNotAvailable, L"n/a");
268 }
269
270 /* update labels */
271 if (!lpCompanyName)
272 lpCompanyName = szNotAvailable;
273 SetDlgItemText(hwndDlg,
275 lpCompanyName);
276
277 if (!lpFileVersion)
278 lpFileVersion = szNotAvailable;
279 SetDlgItemText(hwndDlg,
281 lpFileVersion);
282
283 if (!lpLegalCopyright)
284 lpLegalCopyright = szNotAvailable;
285 SetDlgItemText(hwndDlg,
287 lpLegalCopyright);
288
289 if (!lpDigitalSigner)
290 lpDigitalSigner = szNotAvailable;
291 SetDlgItemText(hwndDlg,
293 lpDigitalSigner);
294
295 /* release version info */
296 if (lpData)
298 0,
299 lpData);
300}
#define IDS_NOTAVAILABLE
Definition: resource.h:122
unsigned int * PUINT
Definition: ndis.h:50
#define LPDWORD
Definition: nt_native.h:46
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define VerQueryValue
Definition: winver.h:56
#define GetFileVersionInfo
Definition: winver.h:54
#define GetFileVersionInfoSize
Definition: winver.h:53

Referenced by DriverDetailsDlgProc().