ReactOS  0.4.14-dev-1034-g1e60116
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 1880 of file advprop.cpp.

1884 {
1885  PDEVADVPROP_INFO dap;
1886  INT_PTR Ret = FALSE;
1887 
1888  dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg, DWLP_USER);
1889 
1890  if (dap != NULL || uMsg == WM_INITDIALOG)
1891  {
1892  switch (uMsg)
1893  {
1894  case WM_COMMAND:
1895  {
1896  switch (LOWORD(wParam))
1897  {
1898  case IDC_DETAILSPROPNAME:
1899  if (HIWORD(wParam) == CBN_SELCHANGE)
1900  {
1902  GetDlgItem(hwndDlg, IDC_DETAILSPROPNAME),
1903  GetDlgItem(hwndDlg, IDC_DETAILSPROPVALUE));
1904  }
1905  break;
1906  }
1907  break;
1908  }
1909 
1910  case WM_NOTIFY:
1911  {
1912  NMHDR *hdr = (NMHDR*)lParam;
1913  switch (hdr->code)
1914  {
1915  case PSN_APPLY:
1916  break;
1917  }
1918  break;
1919  }
1920 
1921  case WM_INITDIALOG:
1922  {
1924  if (dap != NULL)
1925  {
1926  SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
1927 
1928  UpdateDetailsDlg(hwndDlg,
1929  dap);
1930  }
1931  Ret = TRUE;
1932  break;
1933  }
1934  }
1935  }
1936 
1937  return Ret;
1938 }
#define IDC_DETAILSPROPVALUE
Definition: resource.h:250
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:63
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
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:1722
#define IDC_DETAILSPROPNAME
Definition: resource.h:249
#define LPPROPSHEETPAGE
Definition: prsht.h:390
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

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 {
683  PDEVADVPROP_INFO dap;
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  {
696  case IDC_DRIVERDETAILS:
699  hwndDlg,
701  (ULONG_PTR)dap);
702  break;
703 
704  case IDC_UPDATEDRIVER:
705  UpdateDriver(hwndDlg, dap);
706  break;
707 
708  case IDC_ROLLBACKDRIVER:
709  // FIXME
710  break;
711 
712  case IDC_UNINSTALLDRIVER:
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 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 MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:63
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:64
static INT_PTR CALLBACK DriverDetailsDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:305
#define LPPROPSHEETPAGE
Definition: prsht.h:390
smooth NULL
Definition: ftsmooth.c:416
#define IDC_UNINSTALLDRIVER
Definition: resource.h:254
#define IDC_UPDATEDRIVER
Definition: resource.h:251
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDD_DRIVERDETAILS
Definition: resource.h:217
#define IDC_DRIVERDETAILS
Definition: resource.h:244
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DialogBoxParam
Definition: winuser.h:5739
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:64
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static VOID UpdateDriver(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:532
#define IDC_ROLLBACKDRIVER
Definition: resource.h:253
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

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 2718 of file advprop.cpp.

2722 {
2723  PDEVADVPROP_INFO dap;
2724  INT_PTR Ret = FALSE;
2725 
2726  dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg, DWLP_USER);
2727 
2728  if (dap != NULL || uMsg == WM_INITDIALOG)
2729  {
2730  switch (uMsg)
2731  {
2732  case WM_COMMAND:
2733  {
2734  switch (LOWORD(wParam))
2735  {
2736  case IDC_DEVUSAGE:
2737  {
2738  if (HIWORD(wParam) == CBN_SELCHANGE)
2739  {
2740  PropSheet_Changed(GetParent(hwndDlg),
2741  hwndDlg);
2742  dap->DeviceUsageChanged = TRUE;
2743  }
2744  break;
2745  }
2746 
2747  case IDC_DEVPROBLEM:
2748  {
2749  if (dap->IsAdmin)
2750  {
2751  /* display the device problem wizard */
2752  ShowDeviceProblemWizard(hwndDlg,
2753  dap->DeviceInfoSet,
2754  &dap->DeviceInfoData,
2755  dap->hMachine);
2756  }
2757  break;
2758  }
2759  }
2760  break;
2761  }
2762 
2763  case WM_NOTIFY:
2764  {
2765  NMHDR *hdr = (NMHDR*)lParam;
2766  switch (hdr->code)
2767  {
2768  case PSN_APPLY:
2769  ApplyGeneralSettings(hwndDlg,
2770  dap);
2771  break;
2772  }
2773  break;
2774  }
2775 
2776  case WM_INITDIALOG:
2777  {
2779  if (dap != NULL)
2780  {
2781  HWND hWndParent;
2782 
2783  dap->hWndGeneralPage = hwndDlg;
2784 
2785  SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
2786 
2787  /* subclass the parent window to always receive
2788  WM_DEVICECHANGE messages */
2789  hWndParent = GetParent(hwndDlg);
2790  if (hWndParent != NULL)
2791  {
2792  /* subclass the parent window. This is not safe
2793  if the parent window belongs to another thread! */
2795  GWLP_WNDPROC,
2797 
2798  if (dap->ParentOldWndProc != NULL &&
2800  L"DevMgrDevChangeSub",
2801  (HANDLE)dap))
2802  {
2803  dap->hWndParent = hWndParent;
2804  }
2805  }
2806 
2807  /* do not call UpdateDevInfo directly in here because it modifies
2808  the pages of the property sheet! */
2809  PostMessage(hwndDlg,
2810  PM_INITIALIZE,
2811  0,
2812  0);
2813  }
2814  Ret = TRUE;
2815  break;
2816  }
2817 
2818  case WM_DEVICECHANGE:
2819  {
2820  /* FIXME - don't call UpdateDevInfo for all events */
2821  UpdateDevInfo(hwndDlg,
2822  dap,
2823  TRUE);
2824  Ret = TRUE;
2825  break;
2826  }
2827 
2828  case PM_INITIALIZE:
2829  {
2830  UpdateDevInfo(hwndDlg,
2831  dap,
2832  FALSE);
2833  dap->PageInitialized = TRUE;
2834  break;
2835  }
2836 
2837  case WM_DESTROY:
2838  {
2839  /* restore the old window proc of the subclassed parent window */
2840  if (dap->hWndParent != NULL && dap->ParentOldWndProc != NULL)
2841  {
2842  if (SetWindowLongPtr(dap->hWndParent,
2843  GWLP_WNDPROC,
2845  {
2846  RemoveProp(dap->hWndParent,
2847  L"DevMgrDevChangeSub");
2848  }
2849  }
2850  break;
2851  }
2852  }
2853  }
2854 
2855  return Ret;
2856 }
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
UINT DeviceUsageChanged
Definition: properties.h:44
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:63
#define SetWindowLongPtr
Definition: treelist.c:70
SP_DEVINFO_DATA DeviceInfoData
Definition: properties.h:20
WPARAM wParam
Definition: combotst.c:138
#define SetProp
Definition: winuser.h:5826
HWND hWndGeneralPage
Definition: properties.h:14
#define LPPROPSHEETPAGE
Definition: prsht.h:390
smooth NULL
Definition: ftsmooth.c:416
static LRESULT CALLBACK DlgParentSubWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:2675
static BOOL ApplyGeneralSettings(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:2033
HMACHINE hMachine
Definition: properties.h:24
#define WM_DESTROY
Definition: winuser.h:1591
#define PostMessage
Definition: winuser.h:5807
static VOID UpdateDevInfo(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap, IN BOOL ReOpen)
Definition: advprop.cpp:2100
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
UINT PageInitialized
Definition: properties.h:48
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_DEVUSAGE
Definition: resource.h:229
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define IDC_DEVPROBLEM
Definition: resource.h:239
HWND WINAPI GetParent(_In_ HWND)
BOOL ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA DevInfoData, IN HMACHINE hMachine OPTIONAL)
Definition: devprblm.cpp:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define CBN_SELCHANGE
Definition: winuser.h:1961
WNDPROC ParentOldWndProc
Definition: properties.h:16
#define WM_DEVICECHANGE
Definition: winuser.h:1793
#define RemoveProp
Definition: winuser.h:5816
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
HDEVINFO DeviceInfoSet
Definition: properties.h:19
#define PM_INITIALIZE
Definition: properties.h:69

Referenced by DisplayDeviceAdvancedProperties().

◆ ApplyGeneralSettings()

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

Definition at line 2033 of file advprop.cpp.

2035 {
2036  BOOL Ret = FALSE;
2037 
2038  if (dap->DeviceUsageChanged && dap->IsAdmin && dap->CanDisable)
2039  {
2040  UINT SelectedUsageAction;
2041  BOOL NeedReboot = FALSE;
2042 
2043  SelectedUsageAction = GetSelectedUsageAction(GetDlgItem(hwndDlg,
2044  IDC_DEVUSAGE));
2045  switch (SelectedUsageAction)
2046  {
2047  case IDS_ENABLEDEVICE:
2048  if (!dap->DeviceStarted)
2049  {
2050  Ret = EnableDevice(dap->DeviceInfoSet,
2051  &dap->DeviceInfoData,
2052  TRUE,
2053  0,
2054  &NeedReboot);
2055  }
2056  break;
2057 
2058  case IDS_DISABLEDEVICE:
2059  if (dap->DeviceStarted)
2060  {
2061  Ret = EnableDevice(dap->DeviceInfoSet,
2062  &dap->DeviceInfoData,
2063  FALSE,
2064  0,
2065  &NeedReboot);
2066  }
2067  break;
2068 
2069  default:
2070  break;
2071  }
2072 
2073  if (Ret)
2074  {
2075  if (NeedReboot)
2076  {
2077  /* make PropertySheet() return PSM_REBOOTSYSTEM */
2078  PropSheet_RebootSystem(hwndDlg);
2079  }
2080  }
2081  else
2082  {
2083  /* FIXME - display an error message */
2084  FIXME("Failed to enable/disable device! LastError: %d\n",
2085  GetLastError());
2086  }
2087  }
2088  else
2089  Ret = !dap->DeviceUsageChanged;
2090 
2091  /* disable the apply button */
2092  PropSheet_UnChanged(GetParent(hwndDlg),
2093  hwndDlg);
2094  dap->DeviceUsageChanged = FALSE;
2095  return Ret;
2096 }
BOOL WINAPI NeedReboot(DWORD dwRebootCheck)
Definition: advpack.c:311
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define IDS_DISABLEDEVICE
Definition: resource.h:110
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_RebootSystem(d)
Definition: prsht.h:350
static UINT GetSelectedUsageAction(IN HWND hComboBox)
Definition: advprop.cpp:2007
#define IDC_DEVUSAGE
Definition: resource.h:229
HWND WINAPI GetParent(_In_ HWND)
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
unsigned int UINT
Definition: ndis.h:50
#define IDS_ENABLEDEVICE
Definition: resource.h:109

Referenced by AdvPropGeneralDlgProc().

◆ DisplayClassCoinstallers()

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

Definition at line 1213 of file advprop.cpp.

1215 {
1218  WCHAR szClassGuid[45];
1219  HKEY hKey = (HKEY)INVALID_HANDLE_VALUE;
1220  DWORD dwSize;
1221  DWORD dwType;
1222  LPBYTE lpBuffer = NULL;
1223  LPWSTR lpStr;
1224  INT index;
1225  INT len;
1226  LONG lError;
1227 
1228  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1229  {
1230  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1231  DeviceInfoData = &dap->CurrentDeviceInfoData;
1232  }
1233  else
1234  {
1235  DeviceInfoSet = dap->DeviceInfoSet;
1236  DeviceInfoData = &dap->DeviceInfoData;
1237  }
1238 
1239  dwSize = 45 * sizeof(WCHAR);
1243  &dwType,
1244  (LPBYTE)szClassGuid,
1245  dwSize,
1246  &dwSize))
1247  return;
1248 
1250  L"SYSTEM\\CurrentControlSet\\Control\\CoDeviceInstallers",
1251  0,
1252  GENERIC_READ,
1253  &hKey);
1254  if (lError != ERROR_SUCCESS)
1255  return;
1256 
1257  dwSize = 0;
1258  lError = RegQueryValueEx(hKey,
1259  szClassGuid,
1260  NULL,
1261  &dwType,
1262  NULL,
1263  &dwSize);
1264  if (lError != ERROR_SUCCESS)
1265  goto done;
1266 
1267  if (dwSize == 0)
1268  goto done;
1269 
1272  dwSize);
1273 
1274  RegQueryValueEx(hKey,
1275  szClassGuid,
1276  NULL,
1277  &dwType,
1278  lpBuffer,
1279  &dwSize);
1280 
1281  lpStr = (LPWSTR)lpBuffer;
1282  index = 0;
1283  while (*lpStr != 0)
1284  {
1285  len = wcslen(lpStr) + 1;
1286 
1288 
1289  lpStr += len;
1290  index++;
1291  }
1292 
1293 done:
1294  if (lpBuffer != NULL)
1296 
1297  if (hKey != INVALID_HANDLE_VALUE)
1298  RegCloseKey(hKey);
1299 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
int32_t INT
Definition: typedefs.h:57
#define SPDRP_CLASSGUID
Definition: setupapi.h:510
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define GENERIC_READ
Definition: compat.h:124
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HANDLE HKEY
Definition: registry.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by DisplayDeviceProperties().

◆ DisplayClassProperties()

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

Definition at line 1379 of file advprop.cpp.

1382 {
1385  WCHAR szClassGuid[45];
1386  DWORD dwSize;
1387  DWORD dwType;
1388  HKEY hKey;
1389  GUID ClassGuid;
1390  LPBYTE lpBuffer;
1391  LPWSTR lpStr;
1392  INT index = 0;
1393  INT len;
1394 
1395  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1396  {
1397  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1398  DeviceInfoData = &dap->CurrentDeviceInfoData;
1399  }
1400  else
1401  {
1402  DeviceInfoSet = dap->DeviceInfoSet;
1403  DeviceInfoData = &dap->DeviceInfoData;
1404  }
1405 
1406  dwSize = 45 * sizeof(WCHAR);
1410  &dwType,
1411  (LPBYTE)szClassGuid,
1412  dwSize,
1413  &dwSize))
1414  return;
1415 
1416  pSetupGuidFromString(szClassGuid,
1417  &ClassGuid);
1418 
1419  hKey = SetupDiOpenClassRegKey(&ClassGuid,
1420  KEY_QUERY_VALUE);
1421  if (hKey != INVALID_HANDLE_VALUE)
1422  {
1423  dwSize = 0;
1424  if (RegQueryValueEx(hKey,
1425  lpProperty,
1426  NULL,
1427  &dwType,
1428  NULL,
1429  &dwSize) == ERROR_SUCCESS &&
1430  dwSize > 0)
1431  {
1434  dwSize);
1435 
1436  RegQueryValueEx(hKey,
1437  lpProperty,
1438  NULL,
1439  &dwType,
1440  lpBuffer,
1441  &dwSize);
1442 
1443  if (dwType == REG_SZ)
1444  {
1446  }
1447  else if (dwType == REG_MULTI_SZ)
1448  {
1449  lpStr = (LPWSTR)lpBuffer;
1450  index = 0;
1451  while (*lpStr != 0)
1452  {
1453  len = wcslen(lpStr) + 1;
1454 
1456 
1457  lpStr += len;
1458  index++;
1459  }
1460  }
1461 
1463  0,
1464  lpBuffer);
1465  }
1466 
1467  RegCloseKey(hKey);
1468  }
1469 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
int32_t INT
Definition: typedefs.h:57
#define SPDRP_CLASSGUID
Definition: setupapi.h:510
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3623
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22
DWORD WINAPI pSetupGuidFromString(PCWSTR pString, LPGUID lpGUID)
Definition: misc.c:1751

Referenced by DisplayDeviceProperties().

◆ DisplayCsFlags()

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

Definition at line 1142 of file advprop.cpp.

1144 {
1145  DWORD dwValue = 0;
1146  INT index;
1147 
1148  CM_Get_HW_Prof_Flags_Ex(dap->szDevName,
1149  0, /* current hardware profile */
1150  &dwValue,
1151  0,
1152  dap->hMachine);
1153 
1154  index = 0;
1155  if (dwValue & CSCONFIGFLAG_DISABLED)
1156  SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DISABLED");
1157 
1158  if (dwValue & CSCONFIGFLAG_DO_NOT_CREATE)
1159  SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_CREATE");
1160 
1161  if (dwValue & CSCONFIGFLAG_DO_NOT_START)
1162  SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_START");
1163 }
#define CM_Get_HW_Prof_Flags_Ex
Definition: cfgmgr32.h:1942
#define CSCONFIGFLAG_DISABLED
Definition: regstr.h:401
int32_t INT
Definition: typedefs.h:57
HWND hwndListView
Definition: eventvwr.c:83
GLuint index
Definition: glext.h:6031
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
#define CSCONFIGFLAG_DO_NOT_CREATE
Definition: regstr.h:402
#define CSCONFIGFLAG_DO_NOT_START
Definition: regstr.h:403

Referenced by DisplayDeviceProperties().

◆ DisplayCurrentPowerState()

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

Definition at line 1524 of file advprop.cpp.

1527 {
1530  CM_POWER_DATA PowerData;
1531  DWORD dwSize, dwType;
1532  PCWSTR lpText = NULL;
1533 
1534  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1535  {
1536  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1537  DeviceInfoData = &dap->CurrentDeviceInfoData;
1538  }
1539  else
1540  {
1541  DeviceInfoSet = dap->DeviceInfoSet;
1542  DeviceInfoData = &dap->DeviceInfoData;
1543  }
1544 
1545  dwSize = sizeof(CM_POWER_DATA);
1549  &dwType,
1550  (LPBYTE)&PowerData,
1551  dwSize,
1552  &dwSize))
1553  return;
1554 
1555  switch (PowerData.PD_MostRecentPowerState)
1556  {
1557 // case PowerDeviceUnspecified:
1558 
1559  case PowerDeviceD0:
1560  lpText = L"D0";
1561  break;
1562 
1563  case PowerDeviceD1:
1564  lpText = L"D1";
1565  break;
1566 
1567  case PowerDeviceD2:
1568  lpText = L"D2";
1569  break;
1570 
1571  case PowerDeviceD3:
1572  lpText = L"D3";
1573  break;
1574 
1575  default:
1576  break;
1577  }
1578 
1579  if (lpText != NULL)
1580  SetListViewText(hwndListView, 0, lpText);
1581 }
const uint16_t * PCWSTR
Definition: typedefs.h:56
#define SPDRP_DEVICE_POWER_DATA
Definition: setupapi.h:532
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
unsigned char * LPBYTE
Definition: typedefs.h:53
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
struct CM_Power_Data_s CM_POWER_DATA
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

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 2860 of file advprop.cpp.

2867 {
2868  PROPSHEETHEADER psh = {0};
2869  PROPSHEETPAGE pspGeneral = {0};
2872  PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
2873  PDEVADVPROP_INFO DevAdvPropInfo;
2874  HMACHINE hMachine = NULL;
2875  DWORD DevIdSize = 0;
2876  INT_PTR Ret = -1;
2877 
2878  /* we don't want to statically link against comctl32, so find the
2879  functions we need dynamically */
2880  pPropertySheetW =
2881  (PPROPERTYSHEETW)GetProcAddress(hComCtl32,
2882  "PropertySheetW");
2885  "CreatePropertySheetPageW");
2886  pDestroyPropertySheetPage =
2888  "DestroyPropertySheetPage");
2889  if (pPropertySheetW == NULL ||
2891  pDestroyPropertySheetPage == NULL)
2892  {
2893  return -1;
2894  }
2895 
2896  if (lpDeviceID == NULL)
2897  {
2898  /* find out how much size is needed for the device id */
2901  NULL,
2902  0,
2903  &DevIdSize))
2904  {
2905  ERR("SetupDiGetDeviceInstanceId unexpectedly returned TRUE!\n");
2906  return -1;
2907  }
2908 
2910  {
2911  return -1;
2912  }
2913  }
2914  else
2915  {
2916  DevIdSize = (DWORD)wcslen(lpDeviceID) + 1;
2917  }
2918 
2919  if (lpMachineName != NULL && lpMachineName[0] != L'\0')
2920  {
2921  CONFIGRET cr = CM_Connect_Machine(lpMachineName,
2922  &hMachine);
2923  if (cr != CR_SUCCESS)
2924  {
2925  return -1;
2926  }
2927  }
2928 
2929  /* create the internal structure associated with the "General",
2930  "Driver", ... pages */
2931  DevAdvPropInfo = (PDEVADVPROP_INFO)HeapAlloc(GetProcessHeap(),
2934  szDeviceID) +
2935  (DevIdSize * sizeof(WCHAR)));
2936  if (DevAdvPropInfo == NULL)
2937  {
2939  goto Cleanup;
2940  }
2941 
2942  if (lpDeviceID == NULL)
2943  {
2944  /* read the device instance id */
2947  DevAdvPropInfo->szDeviceID,
2948  DevIdSize,
2949  NULL))
2950  {
2951  goto Cleanup;
2952  }
2953  }
2954  else
2955  {
2956  /* copy the device instance id supplied by the caller */
2957  wcscpy(DevAdvPropInfo->szDeviceID,
2958  lpDeviceID);
2959  }
2960 
2961  DevAdvPropInfo->DeviceInfoSet = DeviceInfoSet;
2962  DevAdvPropInfo->DeviceInfoData = *DeviceInfoData;
2963  DevAdvPropInfo->CurrentDeviceInfoSet = INVALID_HANDLE_VALUE;
2964  DevAdvPropInfo->CurrentDeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
2965 
2966  DevAdvPropInfo->ShowRemotePages = (lpMachineName != NULL && lpMachineName[0] != L'\0');
2967  DevAdvPropInfo->hMachine = hMachine;
2968  DevAdvPropInfo->lpMachineName = lpMachineName;
2969  DevAdvPropInfo->szDevName[0] = L'\0';
2970  DevAdvPropInfo->hComCtl32 = hComCtl32;
2972  DevAdvPropInfo->pDestroyPropertySheetPage = pDestroyPropertySheetPage;
2973 
2974  DevAdvPropInfo->IsAdmin = TRUE;// IsUserAdmin();
2975  DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0);
2976  DevAdvPropInfo->Extended = ((dwFlags & DPF_EXTENDED) != 0);
2977 
2978  psh.dwSize = sizeof(PROPSHEETHEADER);
2979  psh.dwFlags = PSH_PROPTITLE | PSH_NOAPPLYNOW;
2980  psh.hwndParent = hWndParent;
2981  psh.pszCaption = DevAdvPropInfo->szDevName;
2982 
2983  DevAdvPropInfo->PropertySheetType = DevAdvPropInfo->ShowRemotePages ?
2984  DIGCDP_FLAG_REMOTE_ADVANCED :
2986 
2987  psh.phpage = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
2989  1 * sizeof(HPROPSHEETPAGE));
2990  if (psh.phpage == NULL)
2991  {
2992  goto Cleanup;
2993  }
2994 
2995  /* add the "General" property sheet */
2996  pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
2997  pspGeneral.dwFlags = PSP_DEFAULT;
2998  pspGeneral.hInstance = hDllInstance;
2999  pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
3000  pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
3001  pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
3002  psh.phpage[psh.nPages] = pCreatePropertySheetPageW(&pspGeneral);
3003  if (psh.phpage[psh.nPages] != NULL)
3004  {
3005  psh.nPages++;
3006  }
3007 
3008  DevAdvPropInfo->nDevPropSheets = psh.nPages;
3009 
3010  if (psh.nPages != 0)
3011  {
3012  Ret = pPropertySheetW(&psh);
3013 
3014  /* NOTE: no need to destroy the property sheets anymore! */
3015  }
3016  else
3017  {
3018  UINT i;
3019 
3020 Cleanup:
3021  /* in case of failure the property sheets must be destroyed */
3022  if (psh.phpage != NULL)
3023  {
3024  for (i = 0;
3025  i < psh.nPages;
3026  i++)
3027  {
3028  if (psh.phpage[i] != NULL)
3029  {
3030  pDestroyPropertySheetPage(psh.phpage[i]);
3031  }
3032  }
3033  }
3034  }
3035 
3036  if (DevAdvPropInfo != NULL)
3037  {
3038  if (DevAdvPropInfo->FreeDevPropSheets)
3039  {
3040  /* don't free the array if it's the one allocated in
3041  DisplayDeviceAdvancedProperties */
3043  0,
3044  DevAdvPropInfo->DevPropSheets);
3045  }
3046 
3047  if (DevAdvPropInfo->CloseDevInst)
3048  {
3049  /* close the device info set in case a new one was created */
3051  }
3052 
3053  if (DevAdvPropInfo->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
3054  {
3056  }
3057 
3058  if (DevAdvPropInfo->hDevIcon != NULL)
3059  {
3060  DestroyIcon(DevAdvPropInfo->hDevIcon);
3061  }
3062 
3064  0,
3065  DevAdvPropInfo);
3066  }
3067 
3068  if (psh.phpage != NULL)
3069  {
3071  0,
3072  psh.phpage);
3073  }
3074 
3075  if (hMachine != NULL)
3076  {
3077  CM_Disconnect_Machine(hMachine);
3078  }
3079 
3080  return Ret;
3081 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
LPCWSTR lpMachineName
Definition: properties.h:25
HDEVINFO CurrentDeviceInfoSet
Definition: properties.h:21
#define TRUE
Definition: types.h:120
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
CONFIGRET WINAPI CM_Disconnect_Machine(_In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1854
WCHAR szDevName[255]
Definition: properties.h:56
BOOL(WINAPI * PDESTROYPROPERTYSHEETPAGE)(HPROPSHEETPAGE)
Definition: properties.h:10
PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage
Definition: properties.h:29
static FN_PropertySheetW pPropertySheetW
Definition: propsheet.c:122
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
INT_PTR(WINAPI * PPROPERTYSHEETW)(LPCPROPSHEETHEADERW)
Definition: properties.h:8
int32_t INT_PTR
Definition: typedefs.h:63
#define DWORD
Definition: nt_native.h:44
SP_DEVINFO_DATA DeviceInfoData
Definition: properties.h:20
#define DIGCDP_FLAG_ADVANCED
Definition: setupapi.h:165
HPROPSHEETPAGE(WINAPI * PCREATEPROPERTYSHEETPAGEW)(LPCPROPSHEETPAGEW)
Definition: properties.h:9
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
UINT DoDefaultDevAction
Definition: properties.h:47
#define IDD_DEVICEGENERAL
Definition: resource.h:214
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:392
LONG_PTR LPARAM
Definition: windef.h:208
SP_DEVINFO_DATA CurrentDeviceInfoData
Definition: properties.h:22
WCHAR szDeviceID[1]
Definition: properties.h:58
HMACHINE hMachine
Definition: properties.h:24
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
static HINSTANCE hDllInstance
Definition: clb.c:30
#define PSP_DEFAULT
Definition: prsht.h:22
#define GetProcessHeap()
Definition: compat.h:403
UINT FreeDevPropSheets
Definition: properties.h:41
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static FN_CreatePropertySheetPageW pCreatePropertySheetPageW
Definition: propsheet.c:121
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSH_PROPTITLE
Definition: prsht.h:40
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2595
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static const WCHAR Cleanup[]
Definition: register.c:80
HPROPSHEETPAGE * DevPropSheets
Definition: properties.h:33
#define ERR(fmt,...)
Definition: debug.h:109
static INT_PTR CALLBACK AdvPropGeneralDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:2718
PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW
Definition: properties.h:28
#define DPF_EXTENDED
Definition: devmgr.h:144
DWORD nDevPropSheets
Definition: properties.h:32
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define DPF_DEVICE_STATUS_ACTION
Definition: devmgr.h:145
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
UINT ShowRemotePages
Definition: properties.h:49
#define GetProcAddress(x, y)
Definition: compat.h:418
HINSTANCE hComCtl32
Definition: properties.h:27
DWORD PropertySheetType
Definition: properties.h:31
#define CM_Connect_Machine
Definition: cfgmgr32.h:1074
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
#define PROPSHEETPAGE
Definition: prsht.h:389
HDEVINFO DeviceInfoSet
Definition: properties.h:19
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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

◆ DisplayDeviceCoinstallers()

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

Definition at line 1303 of file advprop.cpp.

1305 {
1308  HKEY hKey;
1309  DWORD dwSize;
1310  DWORD dwType;
1311  LPBYTE lpBuffer;
1312  LPWSTR lpStr;
1313  INT index;
1314  INT len;
1315 
1316  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1317  {
1318  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1319  DeviceInfoData = &dap->CurrentDeviceInfoData;
1320  }
1321  else
1322  {
1323  DeviceInfoSet = dap->DeviceInfoSet;
1324  DeviceInfoData = &dap->DeviceInfoData;
1325  }
1326 
1330  0,
1331  DIREG_DRV,
1332  KEY_QUERY_VALUE);
1333  if (hKey != INVALID_HANDLE_VALUE)
1334  {
1335  dwSize = 0;
1336  if (RegQueryValueEx(hKey,
1337  L"CoInstallers32",
1338  NULL,
1339  &dwType,
1340  NULL,
1341  &dwSize) == ERROR_SUCCESS &&
1342  dwSize > 0)
1343  {
1344 
1347  dwSize);
1348 
1349  RegQueryValueEx(hKey,
1350  L"CoInstallers32",
1351  NULL,
1352  &dwType,
1353  lpBuffer,
1354  &dwSize);
1355 
1356  lpStr = (LPWSTR)lpBuffer;
1357  index = 0;
1358  while (*lpStr != 0)
1359  {
1360  len = wcslen(lpStr) + 1;
1361 
1363 
1364  lpStr += len;
1365  index++;
1366  }
1367 
1369  0,
1370  lpBuffer);
1371  }
1372 
1373  RegCloseKey(hKey);
1374  }
1375 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
int32_t INT
Definition: typedefs.h:57
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5919
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DIREG_DRV
Definition: setupapi.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DisplayDeviceProperties().

◆ DisplayDeviceProperties()

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

Definition at line 1722 of file advprop.cpp.

1725 {
1726  INT Index;
1727 
1728  Index = (INT)SendMessage(hwndComboBox,
1729  CB_GETCURSEL,
1730  0,
1731  0);
1732  if (Index == CB_ERR)
1733  return;
1734 
1736 
1737  switch (Index)
1738  {
1739  case 0: /* Device ID */
1740  SetListViewText(hwndListView, 0, dap->szDeviceID);
1741  break;
1742 
1743  case 1: /* Hardware ID */
1745  hwndListView,
1747  break;
1748 
1749  case 2: /* Compatible IDs */
1751  hwndListView,
1753  break;
1754 
1755  case 3: /* Matching ID */
1757  hwndListView);
1758  break;
1759 
1760  case 4: /* Service */
1762  hwndListView,
1763  SPDRP_SERVICE);
1764  break;
1765 
1766  case 5: /* Enumerator */
1768  hwndListView);
1769  break;
1770 
1771  case 6: /* Capabilities */
1773  hwndListView,
1775  break;
1776 
1777  case 7: /* Devnode Flags */
1778  DisplayDevNodeFlags(dap,
1779  hwndListView);
1780  break;
1781 
1782  case 8: /* Config Flags */
1784  hwndListView,
1786  break;
1787 
1788  case 9: /* CSConfig Flags */
1789  DisplayCsFlags(dap,
1790  hwndListView);
1791  break;
1792 
1793  case 10: /* Ejection relation */
1795  hwndListView,
1797  break;
1798 
1799  case 11: /* Removal relations */
1801  hwndListView,
1803  break;
1804 
1805  case 12: /* Bus relation */
1807  hwndListView,
1809  break;
1810 
1811  case 13: /* Device Upper Filters */
1813  hwndListView,
1815  break;
1816 
1817  case 14: /* Device Lower Filters */
1819  hwndListView,
1821  break;
1822 
1823  case 15: /* Class Upper Filters */
1825  hwndListView,
1826  L"UpperFilters");
1827  break;
1828 
1829  case 16: /* Class Lower Filters */
1831  hwndListView,
1832  L"LowerFilters");
1833  break;
1834 
1835  case 17: /* Class Installer */
1837  hwndListView,
1838  L"Installer32");
1839  break;
1840 
1841  case 18: /* Class Coinstaller */
1843  hwndListView);
1844  break;
1845 
1846  case 19: /* Device Coinstaller */
1848  hwndListView);
1849  break;
1850 
1851 #if 0
1852  case 20: /* Firmware Revision */
1853  break;
1854 #endif
1855 
1856  case 21: /* Current Power State */
1858  hwndListView);
1859  break;
1860 
1861  case 22: /* Power Capabilities */
1863  hwndListView);
1864  break;
1865 
1866  case 23: /* Power State Mappings */
1868  hwndListView);
1869  break;
1870 
1871  default:
1872  SetListViewText(hwndListView, 0, L"<Not implemented yet>");
1873  break;
1874  }
1875 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define INT
Definition: polytest.cpp:20
#define CM_GETIDLIST_FILTER_BUSRELATIONS
Definition: cfgmgr32.h:660
int32_t INT
Definition: typedefs.h:57
#define SPDRP_LOWERFILTERS
Definition: setupapi.h:520
#define CB_GETCURSEL
Definition: winuser.h:1925
#define CM_GETIDLIST_FILTER_EJECTRELATIONS
Definition: cfgmgr32.h:657
static VOID DisplayPowerCapabilities(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1585
static VOID DisplayCurrentPowerState(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1524
static VOID DisplayPowerStateMappings(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1646
HWND hwndListView
Definition: eventvwr.c:83
#define CB_ERR
Definition: winuser.h:2410
#define CM_GETIDLIST_FILTER_REMOVALRELATIONS
Definition: cfgmgr32.h:658
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
static VOID DisplayDeviceCoinstallers(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1303
static const UCHAR Index[8]
Definition: usbohci.c:18
static VOID DisplayDevNodeEnumerator(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1111
#define SPDRP_HARDWAREID
Definition: setupapi.h:503
static const WCHAR L[]
Definition: oid.c:1250
static VOID DisplayDevNodeFlags(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1024
#define SPDRP_SERVICE
Definition: setupapi.h:506
static VOID DisplayClassProperties(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN LPCWSTR lpProperty)
Definition: advprop.cpp:1379
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:512
#define SPDRP_UPPERFILTERS
Definition: setupapi.h:519
static VOID DisplayDevicePropertyText(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN DWORD dwProperty)
Definition: advprop.cpp:866
#define SPDRP_COMPATIBLEIDS
Definition: setupapi.h:504
static VOID DisplayMatchingDeviceId(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1167
static VOID DisplayClassCoinstallers(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1213
static VOID DisplayDeviceRelations(IN PDEVADVPROP_INFO dap, IN HWND hwndListView, IN ULONG ulFlags)
Definition: advprop.cpp:1473
#define SendMessage
Definition: winuser.h:5818
static VOID DisplayCsFlags(IN PDEVADVPROP_INFO dap, IN HWND hwndListView)
Definition: advprop.cpp:1142
#define SPDRP_CAPABILITIES
Definition: setupapi.h:517
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

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;
873  DWORD dwSize;
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  {
953  case SPDRP_CAPABILITIES:
954  index = 0;
955  if (dwValue & CM_DEVCAP_LOCKSUPPORTED)
956  SetListViewText(hwndListView, index++, L"CM_DEVCAP_LOCKSUPPORTED");
957  if (dwValue & CM_DEVCAP_EJECTSUPPORTED)
958  SetListViewText(hwndListView, index++, L"CM_DEVCAP_EJECTSUPPORTED");
959  if (dwValue & CM_DEVCAP_REMOVABLE)
960  SetListViewText(hwndListView, index++, L"CM_DEVCAP_REMOVABLE");
961  if (dwValue & CM_DEVCAP_DOCKDEVICE)
962  SetListViewText(hwndListView, index++, L"CM_DEVCAP_DOCKDEVICE");
963  if (dwValue & CM_DEVCAP_UNIQUEID)
964  SetListViewText(hwndListView, index++, L"CM_DEVCAP_UNIQUEID");
965  if (dwValue & CM_DEVCAP_SILENTINSTALL)
966  SetListViewText(hwndListView, index++, L"CM_DEVCAP_SILENTINSTALL");
967  if (dwValue & CM_DEVCAP_RAWDEVICEOK)
968  SetListViewText(hwndListView, index++, L"CM_DEVCAP_RAWDEVICEOK");
969  if (dwValue & CM_DEVCAP_SURPRISEREMOVALOK)
970  SetListViewText(hwndListView, index++, L"CM_DEVCAP_SURPRISEREMOVALOK");
971  if (dwValue & CM_DEVCAP_HARDWAREDISABLED)
972  SetListViewText(hwndListView, index++, L"CM_DEVCAP_HARDWAREDISABLED");
973  if (dwValue & CM_DEVCAP_NONDYNAMIC)
974  SetListViewText(hwndListView, index++, L"CM_DEVCAP_NONDYNAMIC");
975  break;
976 
977  case SPDRP_CONFIGFLAGS:
978  index = 0;
979  if (dwValue & CONFIGFLAG_DISABLED)
980  SetListViewText(hwndListView, index++, L"CONFIGFLAG_DISABLED");
981  if (dwValue & CONFIGFLAG_REMOVED)
982  SetListViewText(hwndListView, index++, L"CONFIGFLAG_REMOVED");
983  if (dwValue & CONFIGFLAG_MANUAL_INSTALL)
984  SetListViewText(hwndListView, index++, L"CONFIGFLAG_MANUAL_INSTALL");
985  if (dwValue & CONFIGFLAG_IGNORE_BOOT_LC)
986  SetListViewText(hwndListView, index++, L"CONFIGFLAG_IGNORE_BOOT_LC");
987  if (dwValue & CONFIGFLAG_NET_BOOT)
988  SetListViewText(hwndListView, index++, L"CONFIGFLAG_NET_BOOT");
989  if (dwValue & CONFIGFLAG_REINSTALL)
990  SetListViewText(hwndListView, index++, L"CONFIGFLAG_REINSTALL");
991  if (dwValue & CONFIGFLAG_FAILEDINSTALL)
992  SetListViewText(hwndListView, index++, L"CONFIGFLAG_FAILEDINSTALL");
993  if (dwValue & CONFIGFLAG_CANTSTOPACHILD)
994  SetListViewText(hwndListView, index++, L"CONFIGFLAG_CANTSTOPACHILD");
995  if (dwValue & CONFIGFLAG_OKREMOVEROM)
996  SetListViewText(hwndListView, index++, L"CONFIGFLAG_OKREMOVEROM");
997  if (dwValue & CONFIGFLAG_NOREMOVEEXIT)
998  SetListViewText(hwndListView, index++, L"CONFIGFLAG_NOREMOVEEXIT");
999  break;
1000 
1001  default:
1002  swprintf(dap->szTemp, L"0x%08lx", dwValue);
1003  SetListViewText(hwndListView, 0, dap->szTemp);
1004  break;
1005  }
1006  }
1007  else
1008  {
1009  SetListViewText(hwndListView, 0, L"Error: Unsupported value type!");
1010 
1011  }
1012  }
1013  else
1014  {
1015  SetListViewText(hwndListView, 0, L"Error: Retrieving the value failed!");
1016  }
1017 
1019  0,
1020  lpBuffer);
1021 }
#define CM_DEVCAP_LOCKSUPPORTED
Definition: cfgmgr32.h:735
#define CM_DEVCAP_REMOVABLE
Definition: cfgmgr32.h:737
#define CM_DEVCAP_EJECTSUPPORTED
Definition: cfgmgr32.h:736
#define CM_DEVCAP_SILENTINSTALL
Definition: cfgmgr32.h:740
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
int32_t INT
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define CM_DEVCAP_NONDYNAMIC
Definition: cfgmgr32.h:744
#define CONFIGFLAG_NOREMOVEEXIT
Definition: regstr.h:399
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CONFIGFLAG_REMOVED
Definition: regstr.h:391
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define CONFIGFLAG_DISABLED
Definition: regstr.h:390
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CONFIGFLAG_IGNORE_BOOT_LC
Definition: regstr.h:393
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CONFIGFLAG_CANTSTOPACHILD
Definition: regstr.h:397
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define CONFIGFLAG_MANUAL_INSTALL
Definition: regstr.h:392
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:512
#define CM_DEVCAP_RAWDEVICEOK
Definition: cfgmgr32.h:741
#define CONFIGFLAG_REINSTALL
Definition: regstr.h:395
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CM_DEVCAP_SURPRISEREMOVALOK
Definition: cfgmgr32.h:742
#define CM_DEVCAP_DOCKDEVICE
Definition: cfgmgr32.h:738
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define REG_DWORD
Definition: sdbapi.c:596
#define CONFIGFLAG_NET_BOOT
Definition: regstr.h:394
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define CM_DEVCAP_HARDWAREDISABLED
Definition: cfgmgr32.h:743
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
#define SPDRP_CAPABILITIES
Definition: setupapi.h:517
#define CM_DEVCAP_UNIQUEID
Definition: cfgmgr32.h:739
#define CONFIGFLAG_OKREMOVEROM
Definition: regstr.h:398
#define REG_SZ
Definition: layer.c:22

Referenced by DisplayDeviceProperties().

◆ DisplayDeviceRelations()

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

Definition at line 1473 of file advprop.cpp.

1477 {
1478  ULONG ulLength = 0;
1479  LPWSTR pszBuffer = NULL, pszStr;
1480  INT index = 0, len;
1481  CONFIGRET ret;
1482 
1483  ret = CM_Get_Device_ID_List_Size_ExW(&ulLength,
1484  dap->szDeviceID,
1485  ulFlags,
1486  NULL);
1487  if (ret != CR_SUCCESS)
1488  return;
1489 
1490  pszBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
1492  ulLength * sizeof(WCHAR));
1493  if (pszBuffer == NULL)
1494  return;
1495 
1496  ret = CM_Get_Device_ID_List_ExW(dap->szDeviceID,
1497  pszBuffer,
1498  ulLength,
1499  ulFlags,
1500  NULL);
1501  if (ret != CR_SUCCESS)
1502  {
1503  HeapFree(GetProcessHeap(), 0, pszBuffer);
1504  return;
1505  }
1506 
1507  pszStr = pszBuffer;
1508  index = 0;
1509  while (*pszStr != 0)
1510  {
1511  len = wcslen(pszStr) + 1;
1512 
1514 
1515  pszStr += len;
1516  index++;
1517  }
1518 
1519  HeapFree(GetProcessHeap(), 0, pszBuffer);
1520 }
int32_t INT
Definition: typedefs.h:57
#define CR_SUCCESS
Definition: cfgmgr32.h:842
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
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:3877
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
unsigned int ULONG
Definition: retypes.h:1
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:4008
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by DisplayDeviceProperties().

◆ DisplayDevNodeEnumerator()

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

Definition at line 1111 of file advprop.cpp.

1113 {
1115 
1116  DWORD dwType = 0;
1117  WCHAR szBuffer[256];
1118  DWORD dwSize = 256 * sizeof(WCHAR);
1119 
1120  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1121  {
1122  DeviceInfoData = &dap->CurrentDeviceInfoData;
1123  }
1124  else
1125  {
1126  DeviceInfoData = &dap->DeviceInfoData;
1127  }
1128 
1131  &dwType,
1132  &szBuffer,
1133  &dwSize,
1134  0,
1135  dap->hMachine);
1136 
1137  SetListViewText(hwndListView, 0, szBuffer);
1138 }
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:3468
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define CM_DRP_ENUMERATOR_NAME
Definition: cfgmgr32.h:704
HWND hwndListView
Definition: eventvwr.c:83
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DisplayDeviceProperties().

◆ DisplayDevNodeFlags()

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

Definition at line 1024 of file advprop.cpp.

1026 {
1027  DWORD dwStatus = 0;
1028  DWORD dwProblem = 0;
1029  INT index;
1030 
1032  &dwProblem,
1033  dap->DeviceInfoData.DevInst,
1034  0,
1035  dap->hMachine);
1036 
1037  index = 0;
1039  SetListViewText(hwndListView, index++, L"DN_ROOT_ENUMERATED");
1040  if (dwStatus & DN_DRIVER_LOADED)
1041  SetListViewText(hwndListView, index++, L"DN_DRIVER_LOADED");
1042  if (dwStatus & DN_ENUM_LOADED)
1043  SetListViewText(hwndListView, index++, L"DN_ENUM_LOADED");
1044  if (dwStatus & DN_STARTED)
1045  SetListViewText(hwndListView, index++, L"DN_STARTED");
1046  if (dwStatus & DN_MANUAL)
1047  SetListViewText(hwndListView, index++, L"DN_MANUAL");
1048  if (dwStatus & DN_NEED_TO_ENUM)
1049  SetListViewText(hwndListView, index++, L"DN_NEED_TO_ENUM");
1051  SetListViewText(hwndListView, index++, L"DN_DRIVER_BLOCKED");
1052  if (dwStatus & DN_HARDWARE_ENUM)
1053  SetListViewText(hwndListView, index++, L"DN_HARDWARE_ENUM");
1054  if (dwStatus & DN_NEED_RESTART)
1055  SetListViewText(hwndListView, index++, L"DN_NEED_RESTART");
1057  SetListViewText(hwndListView, index++, L"DN_CHILD_WITH_INVALID_ID");
1058  if (dwStatus & DN_HAS_PROBLEM)
1059  SetListViewText(hwndListView, index++, L"DN_HAS_PROBLEM");
1060  if (dwStatus & DN_FILTERED)
1061  SetListViewText(hwndListView, index++, L"DN_FILTERED");
1062  if (dwStatus & DN_LEGACY_DRIVER)
1063  SetListViewText(hwndListView, index++, L"DN_LEGACY_DRIVER");
1064  if (dwStatus & DN_DISABLEABLE)
1065  SetListViewText(hwndListView, index++, L"DN_DISABLEABLE");
1066  if (dwStatus & DN_REMOVABLE)
1067  SetListViewText(hwndListView, index++, L"DN_REMOVABLE");
1069  SetListViewText(hwndListView, index++, L"DN_PRIVATE_PROBLEM");
1070  if (dwStatus & DN_MF_PARENT)
1071  SetListViewText(hwndListView, index++, L"DN_MF_PARENT");
1072  if (dwStatus & DN_MF_CHILD)
1073  SetListViewText(hwndListView, index++, L"DN_MF_CHILD");
1075  SetListViewText(hwndListView, index++, L"DN_WILL_BE_REMOVED");
1076 
1078  SetListViewText(hwndListView, index++, L"DN_NOT_FIRST_TIMEE");
1079  if (dwStatus & DN_STOP_FREE_RES)
1080  SetListViewText(hwndListView, index++, L"DN_STOP_FREE_RES");
1082  SetListViewText(hwndListView, index++, L"DN_REBAL_CANDIDATE");
1083  if (dwStatus & DN_BAD_PARTIAL)
1084  SetListViewText(hwndListView, index++, L"DN_BAD_PARTIAL");
1085  if (dwStatus & DN_NT_ENUMERATOR)
1086  SetListViewText(hwndListView, index++, L"DN_NT_ENUMERATOR");
1087  if (dwStatus & DN_NT_DRIVER)
1088  SetListViewText(hwndListView, index++, L"DN_NT_DRIVER");
1089 
1090  if (dwStatus & DN_NEEDS_LOCKING)
1091  SetListViewText(hwndListView, index++, L"DN_NEEDS_LOCKING");
1092  if (dwStatus & DN_ARM_WAKEUP)
1093  SetListViewText(hwndListView, index++, L"DN_ARM_WAKEUP");
1095  SetListViewText(hwndListView, index++, L"DN_APM_ENUMERATOR");
1096  if (dwStatus & DN_APM_DRIVER)
1097  SetListViewText(hwndListView, index++, L"DN_APM_DRIVER");
1099  SetListViewText(hwndListView, index++, L"DN_SILENT_INSTALL");
1100  if (dwStatus & DN_NO_SHOW_IN_DM)
1101  SetListViewText(hwndListView, index++, L"DN_NO_SHOW_IN_DM");
1102  if (dwStatus & DN_BOOT_LOG_PROB)
1103  SetListViewText(hwndListView, index++, L"DN_BOOT_LOG_PROB");
1104 
1105 // swprintf(dap->szTemp, L"0x%08x", dwStatus);
1106 // SetListViewText(hwndListView, 0, dap->szTemp);
1107 }
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:3580
#define DN_NOT_FIRST_TIMEE
Definition: cfg.h:137
#define DN_HARDWARE_ENUM
Definition: cfg.h:125
#define DN_NEED_RESTART
Definition: cfg.h:153
#define DN_ROOT_ENUMERATED
Definition: cfg.h:118
#define DN_DRIVER_BLOCKED
Definition: cfg.h:154
#define DN_ARM_WAKEUP
Definition: cfg.h:144
#define DN_NEEDS_LOCKING
Definition: cfg.h:143
#define DN_NEED_TO_ENUM
Definition: cfg.h:123
#define DN_DRIVER_LOADED
Definition: cfg.h:119
#define DN_DISABLEABLE
Definition: cfg.h:131
#define DN_MF_PARENT
Definition: cfg.h:134
int32_t INT
Definition: typedefs.h:57
#define DN_SILENT_INSTALL
Definition: cfg.h:147
#define DN_STOP_FREE_RES
Definition: cfg.h:138
HWND hwndListView
Definition: eventvwr.c:83
#define DN_ENUM_LOADED
Definition: cfg.h:120
GLuint index
Definition: glext.h:6031
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define DN_PRIVATE_PROBLEM
Definition: cfg.h:133
#define DN_BAD_PARTIAL
Definition: cfg.h:140
#define DN_REMOVABLE
Definition: cfg.h:132
#define DN_HAS_PROBLEM
Definition: cfg.h:128
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DN_NT_DRIVER
Definition: cfg.h:142
#define DN_NT_ENUMERATOR
Definition: cfg.h:141
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
#define DN_APM_DRIVER
Definition: cfg.h:146
DWORD dwStatus
Definition: mediaobj.idl:95
#define DN_APM_ENUMERATOR
Definition: cfg.h:145
#define DN_MF_CHILD
Definition: cfg.h:135
#define DN_FILTERED
Definition: cfg.h:129
#define DN_BOOT_LOG_PROB
Definition: cfg.h:149
#define DN_LEGACY_DRIVER
Definition: cfg.h:155
#define DN_CHILD_WITH_INVALID_ID
Definition: cfg.h:156
#define DN_STARTED
Definition: cfg.h:121
#define DN_REBAL_CANDIDATE
Definition: cfg.h:139
#define DN_WILL_BE_REMOVED
Definition: cfg.h:136
#define DN_MANUAL
Definition: cfg.h:122

Referenced by DisplayDeviceProperties().

◆ DisplayMatchingDeviceId()

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

Definition at line 1167 of file advprop.cpp.

1169 {
1172  WCHAR szBuffer[256];
1173  HKEY hKey;
1174  DWORD dwSize;
1175  DWORD dwType;
1176 
1177  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1178  {
1179  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1180  DeviceInfoData = &dap->CurrentDeviceInfoData;
1181  }
1182  else
1183  {
1184  DeviceInfoSet = dap->DeviceInfoSet;
1185  DeviceInfoData = &dap->DeviceInfoData;
1186  }
1187 
1191  0,
1192  DIREG_DRV,
1193  KEY_QUERY_VALUE);
1194  if (hKey != INVALID_HANDLE_VALUE)
1195  {
1196  dwSize = 256 * sizeof(WCHAR);
1197  if (RegQueryValueEx(hKey,
1198  L"MatchingDeviceId",
1199  NULL,
1200  &dwType,
1201  (LPBYTE)szBuffer,
1202  &dwSize) == ERROR_SUCCESS)
1203  {
1204  SetListViewText(hwndListView, 0, szBuffer);
1205  }
1206 
1207  RegCloseKey(hKey);
1208  }
1209 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5919
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DIREG_DRV
Definition: setupapi.h:182
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DisplayDeviceProperties().

◆ DisplayPowerCapabilities()

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

Definition at line 1585 of file advprop.cpp.

1588 {
1591  CM_POWER_DATA PowerData;
1592  DWORD dwSize, dwType;
1593  INT index = 0;
1594 
1595  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1596  {
1597  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1598  DeviceInfoData = &dap->CurrentDeviceInfoData;
1599  }
1600  else
1601  {
1602  DeviceInfoSet = dap->DeviceInfoSet;
1603  DeviceInfoData = &dap->DeviceInfoData;
1604  }
1605 
1606  dwSize = sizeof(CM_POWER_DATA);
1610  &dwType,
1611  (LPBYTE)&PowerData,
1612  dwSize,
1613  &dwSize))
1614  return;
1615 
1616  if (PowerData.PD_Capabilities & PDCAP_D0_SUPPORTED)
1617  SetListViewText(hwndListView, index++, L"PDCAP_D0_SUPPORTED");
1618 
1619  if (PowerData.PD_Capabilities & PDCAP_D1_SUPPORTED)
1620  SetListViewText(hwndListView, index++, L"PDCAP_D1_SUPPORTED");
1621 
1622  if (PowerData.PD_Capabilities & PDCAP_D2_SUPPORTED)
1623  SetListViewText(hwndListView, index++, L"PDCAP_D2_SUPPORTED");
1624 
1625  if (PowerData.PD_Capabilities & PDCAP_D3_SUPPORTED)
1626  SetListViewText(hwndListView, index++, L"PDCAP_D3_SUPPORTED");
1627 
1628  if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D0_SUPPORTED)
1629  SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D0_SUPPORTED");
1630 
1631  if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D1_SUPPORTED)
1632  SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D1_SUPPORTED");
1633 
1634  if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D2_SUPPORTED)
1635  SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D2_SUPPORTED");
1636 
1637  if (PowerData.PD_Capabilities & PDCAP_WAKE_FROM_D3_SUPPORTED)
1638  SetListViewText(hwndListView, index++, L"PDCAP_WAKE_FROM_D3_SUPPORTED");
1639 
1640  if (PowerData.PD_Capabilities & PDCAP_WARM_EJECT_SUPPORTED)
1641  SetListViewText(hwndListView, index++, L"PDCAP_WARM_EJECT_SUPPORTED");
1642 }
#define PDCAP_WARM_EJECT_SUPPORTED
Definition: advprop.cpp:44
#define SPDRP_DEVICE_POWER_DATA
Definition: setupapi.h:532
#define PDCAP_D1_SUPPORTED
Definition: advprop.cpp:37
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
int32_t INT
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
#define PDCAP_D2_SUPPORTED
Definition: advprop.cpp:38
HWND hwndListView
Definition: eventvwr.c:83
GLuint index
Definition: glext.h:6031
#define PDCAP_D3_SUPPORTED
Definition: advprop.cpp:39
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define PDCAP_WAKE_FROM_D1_SUPPORTED
Definition: advprop.cpp:41
struct CM_Power_Data_s CM_POWER_DATA
#define PDCAP_WAKE_FROM_D0_SUPPORTED
Definition: advprop.cpp:40
#define PDCAP_WAKE_FROM_D2_SUPPORTED
Definition: advprop.cpp:42
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define PDCAP_WAKE_FROM_D3_SUPPORTED
Definition: advprop.cpp:43
#define PDCAP_D0_SUPPORTED
Definition: advprop.cpp:36

Referenced by DisplayDeviceProperties().

◆ DisplayPowerStateMappings()

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

Definition at line 1646 of file advprop.cpp.

1649 {
1652  CM_POWER_DATA PowerData;
1653  DWORD dwSize, dwType;
1654  INT i;
1656  WCHAR szSystemStateBuffer[40];
1657  WCHAR szDeviceStateBuffer[40];
1658  WCHAR szOutBuffer[100];
1659 
1660  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
1661  {
1662  DeviceInfoSet = dap->CurrentDeviceInfoSet;
1663  DeviceInfoData = &dap->CurrentDeviceInfoData;
1664  }
1665  else
1666  {
1667  DeviceInfoSet = dap->DeviceInfoSet;
1668  DeviceInfoData = &dap->DeviceInfoData;
1669  }
1670 
1671  dwSize = sizeof(CM_POWER_DATA);
1675  &dwType,
1676  (LPBYTE)&PowerData,
1677  dwSize,
1678  &dwSize))
1679  return;
1680 
1681  for (i = PowerSystemWorking; i < PowerSystemMaximum; i++)
1682  {
1683  PowerState = PowerData.PD_PowerStateMapping[i];
1685  {
1686  swprintf(szSystemStateBuffer, L"S%u", i - 1);
1687 
1688  switch (PowerState)
1689  {
1691  wcscpy(szDeviceStateBuffer, L"Not specified");
1692  break;
1693 
1694  case PowerDeviceD0:
1695  wcscpy(szDeviceStateBuffer, L"D0");
1696  break;
1697 
1698  case PowerDeviceD1:
1699  wcscpy(szDeviceStateBuffer, L"D1");
1700  break;
1701 
1702  case PowerDeviceD2:
1703  wcscpy(szDeviceStateBuffer, L"D2");
1704  break;
1705 
1706  case PowerDeviceD3:
1707  wcscpy(szDeviceStateBuffer, L"D3");
1708  break;
1709 
1710  default:
1711  break;
1712  }
1713 
1714  swprintf(szOutBuffer, L"%s -> %s", szSystemStateBuffer, szDeviceStateBuffer);
1715  SetListViewText(hwndListView, i, szOutBuffer);
1716  }
1717  }
1718 }
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
#define SPDRP_DEVICE_POWER_DATA
Definition: setupapi.h:532
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
int32_t INT
Definition: typedefs.h:57
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
unsigned char * LPBYTE
Definition: typedefs.h:53
HWND hwndListView
Definition: eventvwr.c:83
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
struct CM_Power_Data_s CM_POWER_DATA
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DisplayDeviceProperties().

◆ DlgParentSubWndProc()

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

Definition at line 2675 of file advprop.cpp.

2679 {
2680  PDEVADVPROP_INFO dap;
2681 
2682  dap = (PDEVADVPROP_INFO)GetProp(hwnd,
2683  L"DevMgrDevChangeSub");
2684  if (dap != NULL)
2685  {
2686  if (uMsg == WM_DEVICECHANGE && !IsWindowVisible(dap->hWndGeneralPage))
2687  {
2690  wParam,
2691  lParam);
2692  }
2693 
2694  /* pass the message the the old window proc */
2695  return CallWindowProc(dap->ParentOldWndProc,
2696  hwnd,
2697  uMsg,
2698  wParam,
2699  lParam);
2700  }
2701  else
2702  {
2703  /* this is not a good idea if the subclassed window was an ansi
2704  window, but we failed finding out the previous window proc
2705  so we can't use CallWindowProc. This should rarely - if ever -
2706  happen. */
2707 
2708  return DefWindowProc(hwnd,
2709  uMsg,
2710  wParam,
2711  lParam);
2712  }
2713 }
#define CallWindowProc
Definition: winuser.h:5710
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define GetProp
Definition: winuser.h:5767
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
WPARAM wParam
Definition: combotst.c:138
HWND hWndGeneralPage
Definition: properties.h:14
smooth NULL
Definition: ftsmooth.c:416
#define DefWindowProc
Definition: ros2win.h:31
static const WCHAR L[]
Definition: oid.c:1250
WNDPROC ParentOldWndProc
Definition: properties.h:16
#define WM_DEVICECHANGE
Definition: winuser.h:1793
#define SendMessage
Definition: winuser.h:5818
BOOL WINAPI IsWindowVisible(_In_ HWND)
LPARAM lParam
Definition: combotst.c:139

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 {
310  PDEVADVPROP_INFO dap;
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 
347  dap = (PDEVADVPROP_INFO)lParam;
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 
363  UpdateDriverDetailsDlg(hwndDlg,
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  MAX_PATH);
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
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
UINT uNewState
Definition: commctrl.h:3032
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
#define _countof(array)
Definition: fontsub.cpp:30
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2680
WCHAR szDevName[255]
Definition: properties.h:56
#define LV_COLUMN
Definition: commctrl.h:2543
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define IDC_DIGITALSIGNER
Definition: resource.h:243
#define IDC_FILEPROVIDER
Definition: resource.h:246
int32_t INT_PTR
Definition: typedefs.h:63
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3134
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2705
#define IDC_DRIVERFILES
Definition: resource.h:245
#define IDS_NODRIVERS
Definition: resource.h:122
smooth NULL
Definition: ftsmooth.c:416
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDC_FILECOPYRIGHT
Definition: resource.h:248
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
#define SetDlgItemText
Definition: winuser.h:5824
#define IDC_FILEVERSION
Definition: resource.h:247
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define LVCF_FMT
Definition: commctrl.h:2582
struct tagNMLISTVIEW * LPNMLISTVIEW
#define MB_OK
Definition: winuser.h:784
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
static VOID UpdateDriverVersionInfoDetails(IN HWND hwndDlg, IN LPCWSTR lpszDriverPath)
Definition: advprop.cpp:186

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 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
#define NO_ERROR
Definition: dderror.h:5
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVIS_SELECTED
Definition: commctrl.h:2315
struct _ENUMDRIVERFILES_CONTEXT * PENUMDRIVERFILES_CONTEXT
#define LVITEM
Definition: commctrl.h:2371
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LVIF_STATE
Definition: commctrl.h:2308

Referenced by UpdateDriverDetailsDlg().

◆ GetSelectedUsageAction()

static UINT GetSelectedUsageAction ( IN HWND  hComboBox)
static

Definition at line 2007 of file advprop.cpp.

2008 {
2009  INT Index;
2010  UINT Ret = 0;
2011 
2012  Index = (INT)SendMessage(hComboBox,
2013  CB_GETCURSEL,
2014  0,
2015  0);
2016  if (Index != CB_ERR)
2017  {
2018  INT iRet = (INT) SendMessage(hComboBox,
2020  (WPARAM)Index,
2021  0);
2022  if (iRet != CB_ERR)
2023  {
2024  Ret = (UINT)iRet;
2025  }
2026  }
2027 
2028  return Ret;
2029 }
#define CB_GETITEMDATA
Definition: winuser.h:1932
#define INT
Definition: polytest.cpp:20
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:57
#define CB_GETCURSEL
Definition: winuser.h:1925
#define CB_ERR
Definition: winuser.h:2410
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned int UINT
Definition: ndis.h:50
#define SendMessage
Definition: winuser.h:5818

Referenced by ApplyGeneralSettings().

◆ InitDevUsageActions()

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

Definition at line 1942 of file advprop.cpp.

1945 {
1946  INT Index;
1947  UINT i;
1948  UINT Actions[] =
1949  {
1952  };
1953 
1954  for (i = 0;
1955  i != sizeof(Actions) / sizeof(Actions[0]);
1956  i++)
1957  {
1958  /* fill in the device usage combo box */
1960  Actions[i],
1961  dap->szTemp,
1962  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
1963  {
1964  Index = (INT)SendMessage(hComboBox,
1965  CB_ADDSTRING,
1966  0,
1967  (LPARAM)dap->szTemp);
1968  if (Index != CB_ERR)
1969  {
1970  SendMessage(hComboBox,
1972  (WPARAM)Index,
1973  (LPARAM)Actions[i]);
1974 
1975  switch (Actions[i])
1976  {
1977  case IDS_ENABLEDEVICE:
1978  if (dap->DeviceStarted)
1979  {
1980  SendMessage(hComboBox,
1981  CB_SETCURSEL,
1982  (WPARAM)Index,
1983  0);
1984  }
1985  break;
1986 
1987  case IDS_DISABLEDEVICE:
1988  if (!dap->DeviceStarted)
1989  {
1990  SendMessage(hComboBox,
1991  CB_SETCURSEL,
1992  (WPARAM)Index,
1993  0);
1994  }
1995  break;
1996 
1997  default:
1998  break;
1999  }
2000  }
2001  }
2002  }
2003 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define INT
Definition: polytest.cpp:20
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:57
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
#define IDS_DISABLEDEVICE
Definition: resource.h:110
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
static HINSTANCE hDllInstance
Definition: clb.c:30
static const UCHAR Index[8]
Definition: usbohci.c:18
#define CB_SETCURSEL
Definition: winuser.h:1943
unsigned int UINT
Definition: ndis.h:50
#define SendMessage
Definition: winuser.h:5818
#define IDS_ENABLEDEVICE
Definition: resource.h:109
#define LoadString
Definition: winuser.h:5794

Referenced by UpdateDevInfo().

◆ SetListViewText()

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

Definition at line 752 of file advprop.cpp.

755 {
756  LVITEM li;
757 
758  li.mask = LVIF_TEXT | LVIF_STATE;
759  li.iItem = iItem;
760  li.iSubItem = 0;
761  li.state = 0; //(li.iItem == 0 ? LVIS_SELECTED : 0);
762  li.stateMask = LVIS_SELECTED;
763  li.pszText = (LPWSTR)lpText;
765  &li);
766 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVIS_SELECTED
Definition: commctrl.h:2315
#define LVITEM
Definition: commctrl.h:2371
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LVIF_STATE
Definition: commctrl.h:2308

Referenced by DisplayClassCoinstallers(), DisplayClassProperties(), DisplayCsFlags(), DisplayCurrentPowerState(), DisplayDeviceCoinstallers(), DisplayDeviceProperties(), DisplayDevicePropertyText(), DisplayDeviceRelations(), DisplayDevNodeEnumerator(), DisplayDevNodeFlags(), DisplayMatchingDeviceId(), DisplayPowerCapabilities(), DisplayPowerStateMappings(), and UpdateDetailsDlg().

◆ 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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define DI_REMOVEDEVICE_GLOBAL
Definition: setupapi.h:42
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
BOOL WINAPI SetupDiSetClassInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
Definition: devclass.c:1091
#define DialogBoxParam
Definition: winuser.h:5739
static INT_PTR CALLBACK UninstallDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:435
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define DIF_REMOVE
Definition: setupapi.h:124
#define IDCANCEL
Definition: winuser.h:825
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:917
#define IDD_UNINSTALLDRIVER
Definition: resource.h:220
DI_FUNCTION InstallFunction
Definition: setupapi.h:899

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 {
440  PDEVADVPROP_INFO dap;
441  INT_PTR Ret = FALSE;
442 
444 
445  if (dap != NULL || uMsg == WM_INITDIALOG)
446  {
447  switch (uMsg)
448  {
449  case WM_INITDIALOG:
450  dap = (PDEVADVPROP_INFO)lParam;
451  if (dap != NULL)
452  {
453  SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)dap);
454 
455  /* Set the device image */
456  SendDlgItemMessage(hwndDlg,
457  IDC_DEVICON,
458  STM_SETICON,
459  (WPARAM)dap->hDevIcon,
460  0);
461 
462  /* Set the device name */
463  SetDlgItemText(hwndDlg,
464  IDC_DEVNAME,
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 STM_SETICON
Definition: winuser.h:2074
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
#define IDC_DEVICON
Definition: resource.h:222
WCHAR szDevName[255]
Definition: properties.h:56
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
int32_t INT_PTR
Definition: typedefs.h:63
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
#define IDC_DEVNAME
Definition: resource.h:223
#define WM_CLOSE
Definition: winuser.h:1603
#define SetDlgItemText
Definition: winuser.h:5824
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

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,
810  IDC_DEVICON,
811  STM_SETICON,
812  (WPARAM)dap->hDevIcon,
813  0);
814 
815  /* set the device name edit control text */
816  SetDlgItemText(hwndDlg,
817  IDC_DEVNAME,
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,
836  CB_ADDSTRING,
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,
855  CB_SETCURSEL,
856  0,
857  0);
858 
859  SetListViewText(hwndListView, 0, dap->szDeviceID);
860 
861  SetFocus(hwndComboBox);
862 }
#define IDS_PROP_HARDWAREIDS
Definition: resource.h:189
#define STM_SETICON
Definition: winuser.h:2074
#define IDC_DETAILSPROPVALUE
Definition: resource.h:250
#define IDS_PROP_FIRMWAREREVISION
Definition: resource.h:208
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define IDC_DEVICON
Definition: resource.h:222
#define IDS_PROP_COMPATIBLEIDS
Definition: resource.h:190
#define LV_COLUMN
Definition: commctrl.h:2543
#define LVCFMT_LEFT
Definition: commctrl.h:2594
HWND WINAPI SetFocus(_In_opt_ HWND)
#define IDS_PROP_CLASSLOWERFILTERS
Definition: resource.h:204
UINT_PTR WPARAM
Definition: windef.h:207
#define IDS_PROP_CONFIGFLAGS
Definition: resource.h:196
#define SendDlgItemMessage
Definition: winuser.h:5817
LONG right
Definition: windef.h:308
#define IDS_PROP_DEVLOWERFILTERS
Definition: resource.h:202
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
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
#define IDS_PROP_DEVICEID
Definition: resource.h:188
#define IDS_PROP_POWERSTATEMAPPINGS
Definition: resource.h:211
#define IDC_DETAILSPROPNAME
Definition: resource.h:249
#define CB_ADDSTRING
Definition: winuser.h:1918
HWND hwndListView
Definition: eventvwr.c:83
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_DEVNAME
Definition: resource.h:223
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDS_PROP_DEVICECOINSTALLER
Definition: resource.h:207
static VOID SetListViewText(HWND hwnd, INT iItem, LPCWSTR lpText)
Definition: advprop.cpp:752
#define IDS_PROP_REMOVALRELATIONS
Definition: resource.h:199
#define IDS_PROP_POWERCAPABILITIES
Definition: resource.h:210
#define IDS_PROP_DEVUPPERFILTERS
Definition: resource.h:201
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDS_PROP_BUSRELATIONS
Definition: resource.h:200
#define SetDlgItemText
Definition: winuser.h:5824
#define IDS_PROP_ENUMERATOR
Definition: resource.h:193
#define IDS_PROP_MATCHINGDEVICEID
Definition: resource.h:191
#define IDS_PROP_EJECTIONRELATIONS
Definition: resource.h:198
#define CB_SETCURSEL
Definition: winuser.h:1943
#define IDS_PROP_DEVNODEFLAGS
Definition: resource.h:195
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2582
unsigned int UINT
Definition: ndis.h:50
#define IDS_PROP_CLASSCOINSTALLER
Definition: resource.h:206
#define IDS_PROP_CSCONFIGFLAGS
Definition: resource.h:197
#define SendMessage
Definition: winuser.h:5818
#define IDS_PROP_SERVICE
Definition: resource.h:192
#define IDS_PROP_CURRENTPOWERSTATE
Definition: resource.h:209
#define IDS_PROP_CLASSINSTALLER
Definition: resource.h:205
#define IDS_PROP_CLASSUPPERFILTERS
Definition: resource.h:203
#define LoadString
Definition: winuser.h:5794
#define IDS_PROP_CAPABILITIES
Definition: resource.h:194

Referenced by AdvProcDetailsDlgProc().

◆ UpdateDevInfo()

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

Definition at line 2100 of file advprop.cpp.

2103 {
2104  HWND hDevUsage, hPropSheetDlg, hDevProbBtn;
2105  CONFIGRET cr;
2106  ULONG Status, ProblemNumber;
2107  SP_DEVINSTALL_PARAMS_W InstallParams;
2108  UINT TroubleShootStrId = IDS_TROUBLESHOOTDEV;
2109  BOOL bFlag, bDevActionAvailable = TRUE;
2110  BOOL bDrvInstalled = FALSE;
2111  DWORD iPage;
2114  PROPSHEETHEADER psh;
2115  DWORD nDriverPages = 0;
2116  BOOL RecalcPages = FALSE;
2117 
2118  hPropSheetDlg = GetParent(hwndDlg);
2119 
2120  if (dap->PageInitialized)
2121  {
2122  /* switch to the General page */
2123  PropSheet_SetCurSelByID(hPropSheetDlg,
2125 
2126  /* remove and destroy the existing device property sheet pages */
2127  if (dap->DevPropSheets != NULL)
2128  {
2129  for (iPage = 0;
2130  iPage != dap->nDevPropSheets;
2131  iPage++)
2132  {
2133  if (dap->DevPropSheets[iPage] != NULL)
2134  {
2135  PropSheet_RemovePage(hPropSheetDlg,
2136  (WPARAM) -1,
2137  dap->DevPropSheets[iPage]);
2138  RecalcPages = TRUE;
2139  }
2140  }
2141  }
2142  }
2143 
2144  iPage = 0;
2145 
2146  if (dap->FreeDevPropSheets)
2147  {
2148  /* don't free the array if it's the one allocated in
2149  DisplayDeviceAdvancedProperties */
2151  0,
2152  dap->DevPropSheets);
2153 
2154  dap->FreeDevPropSheets = FALSE;
2155  }
2156 
2157  dap->DevPropSheets = NULL;
2158  dap->nDevPropSheets = 0;
2159 
2160  if (ReOpen)
2161  {
2162  /* create a new device info set and re-open the device */
2163  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2164  {
2165  SetupDiDestroyDeviceInfoList(dap->CurrentDeviceInfoSet);
2166  }
2167 
2168  dap->ParentDevInst = 0;
2169  dap->CurrentDeviceInfoSet = SetupDiCreateDeviceInfoListEx(NULL,
2170  hwndDlg,
2171  dap->lpMachineName,
2172  NULL);
2173  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2174  {
2175  if (SetupDiOpenDeviceInfo(dap->CurrentDeviceInfoSet,
2176  dap->szDeviceID,
2177  hwndDlg,
2178  0,
2179  &dap->CurrentDeviceInfoData))
2180  {
2181  if (dap->CloseDevInst)
2182  {
2183  SetupDiDestroyDeviceInfoList(dap->DeviceInfoSet);
2184  }
2185 
2186  dap->CloseDevInst = TRUE;
2187  dap->DeviceInfoSet = dap->CurrentDeviceInfoSet;
2188  dap->DeviceInfoData = dap->CurrentDeviceInfoData;
2189  dap->CurrentDeviceInfoSet = INVALID_HANDLE_VALUE;
2190  }
2191  else
2192  goto GetParentNode;
2193  }
2194  else
2195  {
2196 GetParentNode:
2197  /* get the parent node from the initial devinst */
2198  CM_Get_Parent_Ex(&dap->ParentDevInst,
2199  dap->DeviceInfoData.DevInst,
2200  0,
2201  dap->hMachine);
2202  }
2203 
2204  if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
2205  {
2206  DeviceInfoSet = dap->CurrentDeviceInfoSet;
2207  DeviceInfoData = &dap->CurrentDeviceInfoData;
2208  }
2209  else
2210  {
2211  DeviceInfoSet = dap->DeviceInfoSet;
2212  DeviceInfoData = &dap->DeviceInfoData;
2213  }
2214  }
2215  else
2216  {
2217  DeviceInfoSet = dap->DeviceInfoSet;
2218  DeviceInfoData = &dap->DeviceInfoData;
2219  }
2220 
2221  dap->HasDriverPage = FALSE;
2222  dap->HasResourcePage = FALSE;
2223  dap->HasPowerPage = FALSE;
2225  dap->hMachine,
2226  &bDrvInstalled) &&
2227  bDrvInstalled)
2228  {
2229  if (SetupDiCallClassInstaller((dap->ShowRemotePages ?
2232  DeviceInfoSet,
2233  DeviceInfoData))
2234  {
2235  /* get install params */
2236  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
2239  &InstallParams))
2240  {
2241  /* zero the flags */
2242  InstallParams.Flags = 0;
2243  }
2244 
2245  dap->HasDriverPage = !(InstallParams.Flags & DI_DRIVERPAGE_ADDED);
2246  dap->HasResourcePage = !(InstallParams.Flags & DI_RESOURCEPAGE_ADDED);
2247  dap->HasPowerPage = !(InstallParams.Flags & DI_FLAGSEX_POWERPAGE_ADDED);
2248  }
2249  }
2250 
2251  /* get the device icon */
2252  if (dap->hDevIcon != NULL)
2253  {
2254  DestroyIcon(dap->hDevIcon);
2255  dap->hDevIcon = NULL;
2256  }
2258  &dap->hDevIcon,
2259  NULL))
2260  {
2261  dap->hDevIcon = NULL;
2262  }
2263 
2264  /* get the device name */
2267  dap->szDevName,
2268  sizeof(dap->szDevName) / sizeof(dap->szDevName[0])))
2269  {
2270  PropSheet_SetTitle(hPropSheetDlg,
2271  PSH_PROPTITLE,
2272  dap->szDevName);
2273  }
2274 
2275  /* set the device image */
2276  SendDlgItemMessage(hwndDlg,
2277  IDC_DEVICON,
2278  STM_SETICON,
2279  (WPARAM)dap->hDevIcon,
2280  0);
2281 
2282  /* set the device name edit control text */
2283  SetDlgItemText(hwndDlg,
2284  IDC_DEVNAME,
2285  dap->szDevName);
2286 
2287  /* set the device type edit control text */
2289  dap->szTemp,
2290  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2291  {
2292  SetDlgItemText(hwndDlg,
2293  IDC_DEVTYPE,
2294  dap->szTemp);
2295  }
2296 
2297  /* set the device manufacturer edit control text */
2300  dap->szTemp,
2301  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2302  {
2303  SetDlgItemText(hwndDlg,
2305  dap->szTemp);
2306  }
2307 
2308  /* set the device location edit control text */
2311  dap->ParentDevInst,
2312  dap->szTemp,
2313  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2314  {
2315  SetDlgItemText(hwndDlg,
2317  dap->szTemp);
2318  }
2319 
2320  /* set the device status edit control text */
2322  dap->hMachine,
2323  dap->szTemp,
2324  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
2325  {
2326  SetDlgItemText(hwndDlg,
2327  IDC_DEVSTATUS,
2328  dap->szTemp);
2329  }
2330 
2331  /* set the device troubleshoot button text and disable it if necessary */
2332  hDevProbBtn = GetDlgItem(hwndDlg,
2333  IDC_DEVPROBLEM);
2335  &ProblemNumber,
2337  0,
2338  dap->hMachine);
2339  if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
2340  {
2341  switch (ProblemNumber)
2342  {
2344  {
2345  /* FIXME - only if it's not a root bus devloader,
2346  disable the button otherwise */
2347  TroubleShootStrId = IDS_UPDATEDRV;
2348  break;
2349  }
2350 
2351  case CM_PROB_OUT_OF_MEMORY:
2354  case CM_PROB_FAILED_START:
2355  case CM_PROB_LIAR:
2357  {
2358  TroubleShootStrId = IDS_UPDATEDRV;
2359  break;
2360  }
2361 
2364  case CM_PROB_REENUMERATION:
2365  {
2366  /* FIXME - Troubleshoot conflict */
2367  break;
2368  }
2369 
2370  case CM_PROB_FAILED_FILTER:
2371  case CM_PROB_REINSTALL:
2373  {
2374  TroubleShootStrId = IDS_REINSTALLDRV;
2375  break;
2376  }
2377 
2379  {
2380  /* FIXME - 4 cases:
2381  1) if it's a missing system devloader:
2382  - disable the button (Reinstall Driver)
2383  2) if it's not a system devloader but still missing:
2384  - Reinstall Driver
2385  3) if it's not a system devloader but the file can be found:
2386  - Update Driver
2387  4) if it's a missing or empty software key
2388  - Update Driver
2389  */
2390  break;
2391  }
2392 
2393  case CM_PROB_INVALID_DATA:
2400  case CM_PROB_PHANTOM:
2401  bDevActionAvailable = FALSE;
2402  break;
2403 
2404  case CM_PROB_NOT_VERIFIED:
2406  /* FIXME - search hardware */
2407  break;
2408 
2409  case CM_PROB_NEED_RESTART:
2411  case CM_PROB_MOVED:
2412  case CM_PROB_TOO_EARLY:
2414  TroubleShootStrId = IDS_REBOOT;
2415  break;
2416 
2417  case CM_PROB_REGISTRY:
2418  /* FIXME - check registry? */
2419  break;
2420 
2421  case CM_PROB_DISABLED:
2422  /* if device was disabled by the user: */
2423  TroubleShootStrId = IDS_ENABLEDEV;
2424  /* FIXME - otherwise disable button because the device was
2425  disabled by the system*/
2426  break;
2427 
2429  /* FIXME - if it's a graphics adapter:
2430  - if it's a a secondary adapter and the main adapter
2431  couldn't be found
2432  - disable button
2433  - else
2434  - Properties
2435  - else
2436  - Update driver
2437  */
2438  break;
2439 
2440  case CM_PROB_FAILED_ADD:
2441  TroubleShootStrId = IDS_PROPERTIES;
2442  break;
2443  }
2444  }
2445 
2447  TroubleShootStrId,
2448  dap->szTemp,
2449  sizeof(dap->szTemp) / sizeof(dap->szTemp[0])) != 0)
2450  {
2451  SetWindowText(hDevProbBtn,
2452  dap->szTemp);
2453  }
2454  EnableWindow(hDevProbBtn,
2455  dap->IsAdmin && bDevActionAvailable);
2456 
2457  /* check if the device can be enabled/disabled */
2458  hDevUsage = GetDlgItem(hwndDlg,
2459  IDC_DEVUSAGE);
2460 
2461  dap->CanDisable = FALSE;
2462  dap->DeviceStarted = FALSE;
2463 
2465  dap->hMachine,
2466  &bFlag))
2467  {
2468  dap->CanDisable = bFlag;
2469  }
2470 
2472  dap->hMachine,
2473  &bFlag))
2474  {
2475  dap->DeviceStarted = bFlag;
2476  }
2477 
2478  /* enable/disable the device usage controls */
2479  EnableWindow(GetDlgItem(hwndDlg,
2481  dap->CanDisable && dap->IsAdmin);
2482  EnableWindow(hDevUsage,
2483  dap->CanDisable && dap->IsAdmin);
2484 
2485  /* clear the combobox */
2486  SendMessage(hDevUsage,
2488  0,
2489  0);
2490  if (dap->CanDisable)
2491  {
2492  InitDevUsageActions(hwndDlg,
2493  hDevUsage,
2494  dap);
2495  }
2496 
2497  /* find out how many new device property sheets to add.
2498  fake a PROPSHEETHEADER structure, we don't plan to
2499  call PropertySheet again!*/
2500  psh.dwSize = sizeof(PROPSHEETHEADER);
2501  psh.dwFlags = 0;
2502  psh.nPages = 0;
2503 
2504  /* get the number of device property sheets for the device */
2507  &psh,
2508  0,
2509  &nDriverPages,
2510  dap->PropertySheetType) &&
2511  nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
2512  {
2513  dap->nDevPropSheets += nDriverPages;
2514  }
2515  else
2516  {
2517  nDriverPages = 0;
2518  }
2519 
2520  /* include the driver page */
2521  if (dap->HasDriverPage)
2522  dap->nDevPropSheets++;
2523 
2524  /* include the details page */
2525  if (dap->Extended)
2526  dap->nDevPropSheets++;
2527 
2528  if (dap->HasResourcePage)
2529  dap->nDevPropSheets++;
2530 
2531  /* add the device property sheets */
2532  if (dap->nDevPropSheets != 0)
2533  {
2534  dap->DevPropSheets = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
2536  dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
2537  if (dap->DevPropSheets != NULL)
2538  {
2539  if (nDriverPages != 0)
2540  {
2541  psh.phpage = dap->DevPropSheets;
2542 
2543  /* query the device property sheet pages to add */
2546  &psh,
2547  dap->nDevPropSheets,
2548  NULL,
2549  dap->PropertySheetType))
2550  {
2551  /* add the property sheets */
2552  for (iPage = 0;
2553  iPage < nDriverPages;
2554  iPage++)
2555  {
2556  if (PropSheet_AddPage(hPropSheetDlg,
2557  dap->DevPropSheets[iPage]))
2558  {
2559  RecalcPages = TRUE;
2560  }
2561  }
2562 
2563  dap->FreeDevPropSheets = TRUE;
2564  }
2565  else
2566  {
2567  /* cleanup, we were unable to get the device property sheets */
2568  iPage = nDriverPages;
2569  dap->nDevPropSheets -= nDriverPages;
2570  nDriverPages = 0;
2571  }
2572  }
2573  else
2574  iPage = 0;
2575 
2576  /* add the driver page if necessary */
2577  if (dap->HasDriverPage)
2578  {
2579  PROPSHEETPAGE pspDriver = {0};
2580  pspDriver.dwSize = sizeof(PROPSHEETPAGE);
2581  pspDriver.dwFlags = PSP_DEFAULT;
2582  pspDriver.hInstance = hDllInstance;
2583  pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDRIVER);
2584  pspDriver.pfnDlgProc = AdvProcDriverDlgProc;
2585  pspDriver.lParam = (LPARAM)dap;
2586  dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
2587  if (dap->DevPropSheets[iPage] != NULL)
2588  {
2589  if (PropSheet_AddPage(hPropSheetDlg,
2590  dap->DevPropSheets[iPage]))
2591  {
2592  iPage++;
2593  RecalcPages = TRUE;
2594  }
2595  else
2596  {
2597  dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2598  dap->DevPropSheets[iPage] = NULL;
2599  }
2600  }
2601  }
2602 
2603  if (dap->Extended)
2604  {
2605  /* Add the details page */
2606  PROPSHEETPAGE pspDetails = {0};
2607  pspDetails.dwSize = sizeof(PROPSHEETPAGE);
2608  pspDetails.dwFlags = PSP_DEFAULT;
2609  pspDetails.hInstance = hDllInstance;
2610  pspDetails.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDETAILS);
2611  pspDetails.pfnDlgProc = AdvProcDetailsDlgProc;
2612  pspDetails.lParam = (LPARAM)dap;
2613  dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDetails);
2614  if (dap->DevPropSheets[iPage] != NULL)
2615  {
2616  if (PropSheet_AddPage(hPropSheetDlg,
2617  dap->DevPropSheets[iPage]))
2618  {
2619  iPage++;
2620  RecalcPages = TRUE;
2621  }
2622  else
2623  {
2624  dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2625  dap->DevPropSheets[iPage] = NULL;
2626  }
2627  }
2628  }
2629 
2630  if (dap->HasResourcePage)
2631  {
2632  PROPSHEETPAGE pspDriver = {0};
2633  pspDriver.dwSize = sizeof(PROPSHEETPAGE);
2634  pspDriver.dwFlags = PSP_DEFAULT;
2635  pspDriver.hInstance = hDllInstance;
2636  pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICERESOURCES);
2637  pspDriver.pfnDlgProc = ResourcesProcDriverDlgProc;
2638  pspDriver.lParam = (LPARAM)dap;
2639  dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
2640  if (dap->DevPropSheets[iPage] != NULL)
2641  {
2642  if (PropSheet_AddPage(hPropSheetDlg,
2643  dap->DevPropSheets[iPage]))
2644  {
2645  iPage++;
2646  RecalcPages = TRUE;
2647  }
2648  else
2649  {
2650  dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
2651  dap->DevPropSheets[iPage] = NULL;
2652  }
2653  }
2654  }
2655  /* FIXME: Add the power page */
2656  }
2657  else
2658  dap->nDevPropSheets = 0;
2659  }
2660 
2661  if (RecalcPages)
2662  {
2663  PropSheet_RecalcPageSizes(hPropSheetDlg);
2664  }
2665 
2666  /* finally, disable the apply button */
2667  PropSheet_UnChanged(hPropSheetDlg,
2668  hwndDlg);
2669  dap->DeviceUsageChanged = FALSE;
2670 }
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:3580
#define STM_SETICON
Definition: winuser.h:2074
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDS_TROUBLESHOOTDEV
Definition: resource.h:114
#define TRUE
Definition: types.h:120
#define CM_PROB_REENUMERATION
Definition: cfg.h:45
INT_PTR CALLBACK ResourcesProcDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: hwresource.cpp:338
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDC_DEVICON
Definition: resource.h:222
#define IDD_DEVICERESOURCES
Definition: resource.h:216
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define CM_PROB_NOT_VERIFIED
Definition: cfg.h:43
#define CM_PROB_PHANTOM
Definition: cfg.h:75
#define CM_PROB_LACKED_ARBITRATOR
Definition: cfg.h:35
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
Definition: setupapi.h:159
BOOL IsDriverInstalled(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *Installed)
Definition: misc.cpp:759
#define CM_PROB_OUT_OF_MEMORY
Definition: cfg.h:33
#define IDD_DEVICEDRIVER
Definition: resource.h:215
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL GetDeviceDescriptionString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:880
BOOL GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:849
#define CM_PROB_FAILED_START
Definition: cfg.h:40
static INT_PTR CALLBACK AdvProcDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:678
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
#define SendDlgItemMessage
Definition: winuser.h:5817
#define IDS_PROPERTIES
Definition: resource.h:101
BOOL CanDisableDevice(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
Definition: misc.cpp:711
#define PropSheet_RemovePage(d, i, p)
Definition: prsht.h:351
#define DI_DRIVERPAGE_ADDED
Definition: setupapi.h:71
#define CM_PROB_WILL_BE_REMOVED
Definition: cfg.h:51
#define PropSheet_RecalcPageSizes(d)
Definition: prsht.h:359
#define PropSheet_AddPage(d, p)
Definition: prsht.h:341
#define DI_FLAGSEX_POWERPAGE_ADDED
Definition: setupapi.h:100
#define CM_PROB_PARTIAL_LOG_CONF
Definition: cfg.h:46
#define IDC_DEVLOCATION
Definition: resource.h:226
#define CM_PROB_DISABLED
Definition: cfg.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDD_DEVICEGENERAL
Definition: resource.h:214
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define CM_PROB_INVALID_DATA
Definition: cfg.h:39
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4456
#define CR_SUCCESS
Definition: cfgmgr32.h:842
BOOL GetDeviceLocationString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:318
#define IDS_REBOOT
Definition: resource.h:119
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:392
#define CM_PROB_NORMAL_CONFLICT
Definition: cfg.h:42
#define DIF_ADDPROPERTYPAGE_ADVANCED
Definition: setupapi.h:154
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_DEVNAME
Definition: resource.h:223
#define SetupDiCreateDeviceInfoListEx
Definition: setupapi.h:2575
#define CB_RESETCONTENT
Definition: winuser.h:1941
BOOL IsDeviceStarted(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsStarted)
Definition: misc.cpp:735
static HINSTANCE hDllInstance
Definition: clb.c:30
#define CM_PROB_DEVLOADER_NOT_FOUND
Definition: cfg.h:38
#define CM_PROB_LIAR
Definition: cfg.h:41
#define PSP_DEFAULT
Definition: prsht.h:22
#define CM_PROB_HARDWARE_DISABLED
Definition: cfg.h:59
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PSH_PROPTITLE
Definition: prsht.h:40
#define IDC_DEVUSAGELABEL
Definition: resource.h:238
#define CM_PROB_DISABLED_SERVICE
Definition: cfg.h:62
#define IDC_DEVSTATUS
Definition: resource.h:228
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define CM_PROB_TRANSLATION_FAILED
Definition: cfg.h:63
#define DN_HAS_PROBLEM
Definition: cfg.h:128
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define IDC_DEVTYPE
Definition: resource.h:224
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5824
BOOL GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:281
#define DI_RESOURCEPAGE_ADDED
Definition: setupapi.h:59
#define CM_PROB_CANT_SHARE_IRQ
Definition: cfg.h:60
#define CM_PROB_REINSTALL
Definition: cfg.h:48
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define IDD_DEVICEDETAILS
Definition: resource.h:218
#define IDS_UPDATEDRV
Definition: resource.h:117
#define IDS_REINSTALLDRV
Definition: resource.h:118
#define IDC_DEVUSAGE
Definition: resource.h:229
#define CM_PROB_UNKNOWN_RESOURCE
Definition: cfg.h:47
#define CM_PROB_NEED_RESTART
Definition: cfg.h:44
Status
Definition: gdiplustypes.h:24
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_DEVPROBLEM
Definition: resource.h:239
HWND WINAPI GetParent(_In_ HWND)
#define CM_PROB_TOO_EARLY
Definition: cfg.h:56
#define CM_PROB_DEVLOADER_NOT_READY
Definition: cfg.h:53
#define SetupDiGetClassDevPropertySheets
Definition: setupapi.h:2587
#define IDC_DEVMANUFACTURER
Definition: resource.h:225
static INT_PTR CALLBACK AdvProcDetailsDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: advprop.cpp:1880
#define CM_PROB_DEVICE_NOT_THERE
Definition: cfg.h:54
#define SetWindowText
Definition: winuser.h:5832
unsigned int UINT
Definition: ndis.h:50
#define CM_PROB_SYSTEM_SHUTDOWN
Definition: cfg.h:76
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define SendMessage
Definition: winuser.h:5818
#define CM_PROB_MOVED
Definition: cfg.h:55
unsigned int ULONG
Definition: retypes.h:1
static VOID InitDevUsageActions(IN HWND hwndDlg, IN HWND hComboBox, IN PDEVADVPROP_INFO dap)
Definition: advprop.cpp:1942
#define CM_PROB_FAILED_FILTER
Definition: cfg.h:37
#define CM_PROB_BOOT_CONFIG_CONFLICT
Definition: cfg.h:36
BOOL GetDeviceStatusString(IN DEVINST DevInst, IN HMACHINE hMachine, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:443
#define IDS_ENABLEDEV
Definition: resource.h:115
#define CM_PROB_ENTRY_IS_WRONG_TYPE
Definition: cfg.h:34
#define CM_PROB_FAILED_ADD
Definition: cfg.h:61
CONFIGRET WINAPI CM_Get_Parent_Ex(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:5228
#define PropSheet_SetTitle(d, w, s)
Definition: prsht.h:356
BOOL WINAPI SetupDiLoadClassIcon(IN CONST GUID *ClassGuid, OUT HICON *LargeIcon OPTIONAL, OUT PINT MiniIconIndex OPTIONAL)
Definition: devclass.c:777
#define SetupDiOpenDeviceInfo
Definition: setupapi.h:2609
#define CM_PROB_DEVLOADER_FAILED
Definition: cfg.h:32
#define HeapFree(x, y, z)
Definition: compat.h:402
#define CM_PROB_REGISTRY
Definition: cfg.h:49
#define LoadString
Definition: winuser.h:5794
#define PROPSHEETPAGE
Definition: prsht.h:389
#define CM_PROB_NO_VALID_LOG_CONF
Definition: cfg.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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 NeedReboot(DWORD dwRebootCheck)
Definition: advpack.c:311
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
#define IDYES
Definition: winuser.h:829
#define EWX_REBOOT
Definition: winuser.h:633
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: stubs.cpp:24
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:13
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:383
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

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,
103  IDC_DEVICON,
104  STM_SETICON,
105  (WPARAM)dap->hDevIcon,
106  0);
107 
108  /* set the device name edit control text */
109  SetDlgItemText(hwndDlg,
110  IDC_DEVNAME,
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  {
132  DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
136  {
137  DeviceInstallParams.FileQueue = queueHandle;
138  DeviceInstallParams.Flags |= DI_NOVCP;
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 }
#define SetupDiSetSelectedDriver
Definition: setupapi.h:2617
#define ListView_SetColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2625
#define STM_SETICON
Definition: winuser.h:2074
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define IDC_DEVICON
Definition: resource.h:222
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2594
HSPFILEQ WINAPI SetupOpenFileQueue(VOID)
Definition: fileqsup.c:161
BOOL FindCurrentDriver(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT PSP_DRVINFO_DATA DriverInfoData)
Definition: misc.cpp:924
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
#define SendDlgItemMessage
Definition: winuser.h:5817
LONG right
Definition: windef.h:308
#define SPQ_SCAN_USE_CALLBACK
Definition: setupapi.h:614
#define LVCOLUMN
Definition: commctrl.h:2577
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2705
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2669
#define DI_NOVCP
Definition: setupapi.h:49
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2315
#define IDC_DEVNAME
Definition: resource.h:223
#define SetupDiSetDeviceInstallParams
Definition: setupapi.h:2614
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1150
#define SetDlgItemText
Definition: winuser.h:5824
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1049
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SetupScanFileQueue
Definition: setupapi.h:2670
static UINT WINAPI EnumDeviceDriverFilesCallback(IN PVOID Context, IN UINT Notification, IN UINT_PTR Param1, IN UINT_PTR Param2)
Definition: advprop.cpp:60
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:140
BOOL WINAPI SetupCloseFileQueue(IN HSPFILEQ QueueHandle)
Definition: fileqsup.c:217
#define LVIS_FOCUSED
Definition: commctrl.h:2314
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

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,
618  IDC_DEVICON,
619  STM_SETICON,
620  (WPARAM)dap->hDevIcon,
621  0);
622 
623  /* set the device name edit control text */
624  SetDlgItemText(hwndDlg,
625  IDC_DEVNAME,
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,
646  IDC_DRVDATE,
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 }
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:3580
#define STM_SETICON
Definition: winuser.h:2074
#define IDC_DEVICON
Definition: resource.h:222
#define DN_ROOT_ENUMERATED
Definition: cfg.h:118
BOOL GetDriverVersionString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:562
#define DN_DISABLEABLE
Definition: cfg.h:131
#define INVALID_HANDLE_VALUE
Definition: compat.h:399