ReactOS  0.4.14-dev-297-g23e575c
properties.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DEVADVPROP_INFO
 
struct  _ENUMDRIVERFILES_CONTEXT
 

Macros

#define PM_INITIALIZE   (WM_APP + 0x101)
 

Typedefs

typedef INT_PTR(WINAPIPPROPERTYSHEETW) (LPCPROPSHEETHEADERW)
 
typedef HPROPSHEETPAGE(WINAPIPCREATEPROPERTYSHEETPAGEW) (LPCPROPSHEETPAGEW)
 
typedef BOOL(WINAPIPDESTROYPROPERTYSHEETPAGE) (HPROPSHEETPAGE)
 
typedef struct _DEVADVPROP_INFO DEVADVPROP_INFO
 
typedef struct _DEVADVPROP_INFOPDEVADVPROP_INFO
 
typedef struct _ENUMDRIVERFILES_CONTEXT ENUMDRIVERFILES_CONTEXT
 
typedef struct _ENUMDRIVERFILES_CONTEXTPENUMDRIVERFILES_CONTEXT
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (devmgr)
 
INT_PTR CALLBACK ResourcesProcDriverDlgProc (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)
 
BOOL ShowDeviceProblemWizard (IN HWND hWndParent OPTIONAL, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA DevInfoData, IN HMACHINE hMachine OPTIONAL)
 
INT LengthOfStrResource (IN HINSTANCE hInst, IN UINT uID)
 
DWORD LoadAndFormatString (IN HINSTANCE hInstance, IN UINT uID, OUT LPWSTR *lpTarget,...)
 
DWORD LoadAndFormatStringsCat (IN HINSTANCE hInstance, IN UINT *uID, IN UINT nIDs, OUT LPWSTR *lpTarget,...)
 
LPARAM ListViewGetSelectedItemData (IN HWND hwnd)
 
LPWSTR ConvertMultiByteToUnicode (IN LPCSTR lpMultiByteStr, IN UINT uCodePage)
 
HINSTANCE LoadAndInitComctl32 (VOID)
 
BOOL GetDeviceAndComputerName (LPWSTR lpString, WCHAR szDeviceID[], WCHAR szMachineName[])
 
BOOL GetDeviceManufacturerString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDeviceLocationString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDeviceStatusString (IN DEVINST DevInst, IN HMACHINE hMachine, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDriverProviderString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDriverVersionString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDriverDateString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL IsDeviceHidden (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsHidden)
 
BOOL IsDriverInstalled (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *Installed)
 
BOOL CanDisableDevice (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
 
BOOL IsDeviceStarted (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsStarted)
 
BOOL EnableDevice (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
 
BOOL GetDeviceTypeString (IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL GetDeviceDescriptionString (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
 
BOOL FindCurrentDriver (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT PSP_DRVINFO_DATA DriverInfoData)
 

Variables

HINSTANCE hDllInstance
 

Macro Definition Documentation

◆ PM_INITIALIZE

#define PM_INITIALIZE   (WM_APP + 0x101)

Definition at line 69 of file properties.h.

Typedef Documentation

◆ DEVADVPROP_INFO

◆ ENUMDRIVERFILES_CONTEXT

◆ PCREATEPROPERTYSHEETPAGEW

typedef HPROPSHEETPAGE(WINAPI * PCREATEPROPERTYSHEETPAGEW) (LPCPROPSHEETPAGEW)

Definition at line 9 of file properties.h.

◆ PDESTROYPROPERTYSHEETPAGE

typedef BOOL(WINAPI * PDESTROYPROPERTYSHEETPAGE) (HPROPSHEETPAGE)

Definition at line 10 of file properties.h.

◆ PDEVADVPROP_INFO

◆ PENUMDRIVERFILES_CONTEXT

◆ PPROPERTYSHEETW

typedef INT_PTR(WINAPI * PPROPERTYSHEETW) (LPCPROPSHEETHEADERW)

Definition at line 8 of file properties.h.

Function Documentation

◆ CanDisableDevice()

BOOL CanDisableDevice ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL CanDisable 
)

Definition at line 711 of file misc.cpp.

714 {
715  CONFIGRET cr;
716  ULONG Status, ProblemNumber;
717  BOOL Ret = FALSE;
718 
720  &ProblemNumber,
721  DevInst,
722  0,
723  hMachine);
724  if (cr == CR_SUCCESS)
725  {
726  *CanDisable = ((Status & DN_DISABLEABLE) != 0);
727  Ret = TRUE;
728  }
729 
730  return Ret;
731 }
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 TRUE
Definition: types.h:120
#define DN_DISABLEABLE
Definition: cfg.h:131
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
Status
Definition: gdiplustypes.h:24
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
unsigned int ULONG
Definition: retypes.h:1

Referenced by UpdateDevInfo().

◆ ConvertMultiByteToUnicode()

LPWSTR ConvertMultiByteToUnicode ( IN LPCSTR  lpMultiByteStr,
IN UINT  uCodePage 
)

Definition at line 239 of file misc.cpp.

241 {
242  LPWSTR lpUnicodeStr;
243  INT nLength;
244 
245  nLength = MultiByteToWideChar(uCodePage,
246  0,
247  lpMultiByteStr,
248  -1,
249  NULL,
250  0);
251  if (nLength == 0)
252  return NULL;
253 
254  lpUnicodeStr = (LPWSTR)HeapAlloc(GetProcessHeap(),
255  0,
256  nLength * sizeof(WCHAR));
257  if (lpUnicodeStr == NULL)
258  {
260  return NULL;
261  }
262 
263  if (!MultiByteToWideChar(uCodePage,
264  0,
265  lpMultiByteStr,
266  nLength,
267  lpUnicodeStr,
268  nLength))
269  {
271  0,
272  lpUnicodeStr);
273  return NULL;
274  }
275 
276  return lpUnicodeStr;
277 }
_In_ DWORD nLength
Definition: wincon.h:461
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DeviceAdvancedPropertiesA(), DeviceManager_ExecuteA(), DeviceProblemWizardA(), DeviceProperties_RunDLLA(), and DevicePropertiesExA().

◆ 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};
2870  PPROPERTYSHEETW pPropertySheetW;
2871  PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW;
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");
2883  pCreatePropertySheetPageW =
2885  "CreatePropertySheetPageW");
2886  pDestroyPropertySheetPage =
2888  "DestroyPropertySheetPage");
2889  if (pPropertySheetW == NULL ||
2890  pCreatePropertySheetPageW == 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;
2971  DevAdvPropInfo->pCreatePropertySheetPageW = pCreatePropertySheetPageW;
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
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
INT_PTR(WINAPI * PPROPERTYSHEETW)(LPCPROPSHEETHEADERW)
Definition: properties.h:8
int32_t INT_PTR
Definition: typedefs.h:62
#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:374
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:395
UINT FreeDevPropSheets
Definition: properties.h:41
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__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:409
_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:254
#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:410
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:394
#define PROPSHEETPAGE
Definition: prsht.h:371
HDEVINFO DeviceInfoSet
Definition: properties.h:19
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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

◆ EnableDevice()

BOOL EnableDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DevInfoData  OPTIONAL,
IN BOOL  bEnable,
IN DWORD HardwareProfile  OPTIONAL,
OUT BOOL *bNeedReboot  OPTIONAL 
)

Definition at line 784 of file misc.cpp.

789 {
792  DWORD LastErr;
793  BOOL Ret = FALSE;
794 
797  pcp.HwProfile = HardwareProfile;
798 
799  if (bEnable)
800  {
801  /* try to enable the device on the global profile */
802  pcp.StateChange = DICS_ENABLE;
803  pcp.Scope = DICS_FLAG_GLOBAL;
804 
805  /* ignore errors */
806  LastErr = GetLastError();
808  DevInfoData,
809  &pcp.ClassInstallHeader,
810  sizeof(SP_PROPCHANGE_PARAMS)))
811  {
814  DevInfoData);
815  }
816  SetLastError(LastErr);
817  }
818 
819  /* try config-specific */
822 
824  DevInfoData,
825  &pcp.ClassInstallHeader,
826  sizeof(SP_PROPCHANGE_PARAMS)) &&
829  DevInfoData))
830  {
831  dp.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
833  DevInfoData,
834  &dp))
835  {
836  if (bNeedReboot != NULL)
837  {
838  *bNeedReboot = ((dp.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT)) != 0);
839  }
840 
841  Ret = TRUE;
842  }
843  }
844  return Ret;
845 }
#define TRUE
Definition: types.h:120
#define DI_NEEDREBOOT
Definition: setupapi.h:54
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2594
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
#define DICS_ENABLE
Definition: setupapi.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DICS_DISABLE
Definition: setupapi.h:114
smooth NULL
Definition: ftsmooth.c:416
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:911
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1150
#define SetLastError(x)
Definition: compat.h:409
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
_In_ BOOL bEnable
Definition: winddi.h:3426
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2612
DI_FUNCTION InstallFunction
Definition: setupapi.h:899

Referenced by ApplyGeneralSettings().

◆ FindCurrentDriver()

BOOL FindCurrentDriver ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT PSP_DRVINFO_DATA  DriverInfoData 
)

Definition at line 924 of file misc.cpp.

927 {
929  SP_DEVINSTALL_PARAMS InstallParams = {0};
930  SP_DRVINFO_DETAIL_DATA DriverInfoDetailData = {0};
931  WCHAR InfPath[MAX_PATH];
932  WCHAR InfSection[LINE_LEN];
933  DWORD dwType, dwLength;
934  DWORD i = 0;
935  LONG rc;
936  BOOL Ret = FALSE;
937 
938  /* Steps to find the right driver:
939  * 1) Get the device install parameters
940  * 2) Open the driver registry key
941  * 3) Read the .inf file name
942  * 4) Update install params, by setting DI_ENUMSINGLEINF and .inf file name
943  * 5) Build class driver list
944  * 6) Read inf section and inf section extension from registry
945  * 7) Enumerate drivers
946  * 8) Find the one who is in the same section as current driver?
947  */
948 
949  /* 1) Get the install params */
950  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
953  &InstallParams))
954  {
955  ERR("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", GetLastError());
956  goto Cleanup;
957  }
958 
959 #ifdef DI_FLAGSEX_INSTALLEDDRIVER
960  InstallParams.FlagsEx |= (DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS);
963  &InstallParams))
964  {
971  0,
972  DriverInfoData))
973  {
974  Ret = TRUE;
975  }
976 
977  goto Cleanup;
978  }
979  InstallParams.FlagsEx &= ~(DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS);
980 #endif
981 
982  /* 2) Open the driver registry key */
986  0,
987  DIREG_DRV,
989  if (hKey == INVALID_HANDLE_VALUE)
990  {
991  ERR("SetupDiOpenDevRegKey() failed with error 0x%lx\n", GetLastError());
992  goto Cleanup;
993  }
994 
995  /* 3) Read the .inf file name */
996  dwLength = (sizeof(InfPath) / sizeof(InfPath[0])) - 1;
997  rc = RegQueryValueEx(hKey,
999  0,
1000  &dwType,
1001  (LPBYTE)InfPath,
1002  &dwLength);
1003  if (rc != ERROR_SUCCESS)
1004  {
1005  ERR("RegQueryValueEx() failed with error 0x%lx\n", GetLastError());
1006  SetLastError(rc);
1007  goto Cleanup;
1008  }
1009  else if (dwType != REG_SZ)
1010  {
1011  ERR("Expected registry type REG_SZ (%lu), got %lu\n", REG_SZ, dwType);
1013  goto Cleanup;
1014  }
1015  InfPath[(dwLength / sizeof(WCHAR)) - 1] = L'\0';
1016 
1017  /* 4) Update install params, by setting DI_ENUMSINGLEINF and .inf file name */
1018  InstallParams.Flags |= DI_ENUMSINGLEINF;
1019  InstallParams.FlagsEx |= DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
1020  wcscpy(InstallParams.DriverPath, InfPath);
1023  &InstallParams))
1024  {
1025  ERR("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", GetLastError());
1026  goto Cleanup;
1027  }
1028 
1029  /* 5) Build class driver list */
1033  {
1034  ERR("SetupDiBuildDriverInfoList() failed with error 0x%lx\n", GetLastError());
1035  goto Cleanup;
1036  }
1037 
1038  /* 6) Read inf section and from registry */
1039  dwLength = (sizeof(InfSection) / sizeof(InfSection[0])) - 1;
1040  rc = RegQueryValueEx(hKey,
1042  0,
1043  &dwType,
1044  (LPBYTE)InfSection,
1045  &dwLength);
1046  if (rc != ERROR_SUCCESS)
1047  {
1048  ERR("RegQueryValueEx() failed with error 0x%lx\n", GetLastError());
1049  SetLastError(rc);
1050  goto Cleanup;
1051  }
1052  else if (dwType != REG_SZ)
1053  {
1054  ERR("Expected registry type REG_SZ (%lu), got %lu\n", REG_SZ, dwType);
1056  goto Cleanup;
1057  }
1058  InfPath[(dwLength / sizeof(WCHAR)) - 1] = L'\0';
1059 
1060  /* 7) Enumerate drivers */
1061  DriverInfoData->cbSize = sizeof(SP_DRVINFO_DATA);
1062  DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
1066  i,
1067  DriverInfoData))
1068  {
1069  /* 8) Find the one who is in the same section as current driver */
1072  DriverInfoData,
1073  &DriverInfoDetailData,
1074  DriverInfoDetailData.cbSize,
1075  NULL) &&
1077  {
1078  ERR("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", GetLastError());
1079  goto Cleanup;
1080  }
1081  if (_wcsicmp(DriverInfoDetailData.SectionName, InfSection) == 0)
1082  {
1083  /* We have found the right driver */
1084  Ret = TRUE;
1085  goto Cleanup;
1086  }
1087 
1088  i++;
1089  }
1091  {
1092  ERR("SetupDiEnumDriverInfo() failed with error 0x%lx\n", GetLastError());
1093  goto Cleanup;
1094  }
1095 
1097 
1098 Cleanup:
1099  if (hKey != INVALID_HANDLE_VALUE)
1100  RegCloseKey(hKey);
1101  return Ret;
1102 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define SetupDiEnumDriverInfo
Definition: setupapi.h:2582
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2594
#define REGSTR_VAL_INFPATH
Definition: regstr.h:439
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:87
CHAR SectionName[LINE_LEN]
Definition: setupapi.h:1060
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
SP_DRVINFO_DETAIL_DATA_A SP_DRVINFO_DETAIL_DATA
Definition: setupapi.h:1157
smooth NULL
Definition: ftsmooth.c:416
CHAR DriverPath[MAX_PATH]
Definition: setupapi.h:883
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define LINE_LEN
Definition: setupapi.h:20
#define SetupDiSetDeviceInstallParams
Definition: setupapi.h:2614
#define MAX_PATH
Definition: compat.h:26
_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 SetLastError(x)
Definition: compat.h:409
#define ERROR_NO_DRIVER_SELECTED
Definition: setupapi.h:294
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1049
_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
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5919
static const WCHAR Cleanup[]
Definition: register.c:80
#define SetupDiGetDriverInfoDetail
Definition: setupapi.h:2599
#define ERR(fmt,...)
Definition: debug.h:109
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define REGSTR_VAL_INFSECTION
Definition: regstr.h:440
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DI_ENUMSINGLEINF
Definition: setupapi.h:62
BOOL WINAPI SetupDiBuildDriverInfoList(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:718
#define DIREG_DRV
Definition: setupapi.h:182
HANDLE HKEY
Definition: registry.h:24
#define SPDIT_CLASSDRIVER
Definition: setupapi.h:500
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateDriverDetailsDlg().

◆ GetDeviceAndComputerName()

BOOL GetDeviceAndComputerName ( LPWSTR  lpString,
WCHAR  szDeviceID[],
WCHAR  szMachineName[] 
)

Definition at line 1132 of file misc.cpp.

1135 {
1136  BOOL ret = FALSE;
1137 
1138  szDeviceID[0] = L'\0';
1139  szMachineName[0] = L'\0';
1140 
1141  while (*lpString != L'\0')
1142  {
1143  if (*lpString == L'/')
1144  {
1145  lpString++;
1146  if (!_wcsnicmp(lpString, L"DeviceID", 8))
1147  {
1148  lpString += 9;
1149  if (*lpString != L'\0')
1150  {
1151  int i = 0;
1152  while ((*lpString != L' ') &&
1153  (*lpString != L'\0') &&
1154  (i <= MAX_DEVICE_ID_LEN))
1155  {
1156  szDeviceID[i++] = *lpString++;
1157  }
1158  szDeviceID[i] = L'\0';
1159  ret = TRUE;
1160  }
1161  }
1162  else if (!_wcsnicmp(lpString, L"MachineName", 11))
1163  {
1164  lpString += 12;
1165  if (*lpString != L'\0')
1166  {
1167  int i = 0;
1168  while ((*lpString != L' ') &&
1169  (*lpString != L'\0') &&
1171  {
1172  szMachineName[i++] = *lpString++;
1173  }
1174  szMachineName[i] = L'\0';
1175  }
1176  }
1177  /* knock the pointer back one and let the next
1178  * pointer deal with incrementing, otherwise we
1179  * go past the end of the string */
1180  lpString--;
1181  }
1182  lpString++;
1183  }
1184 
1185  return ret;
1186 }
#define TRUE
Definition: types.h:120
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define MAX_DEVICE_ID_LEN
Definition: pnpmgr.c:28
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 int BOOL
Definition: ntddk_ex.h:94
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240

Referenced by DeviceProperties_RunDLLW().

◆ GetDeviceDescriptionString()

BOOL GetDeviceDescriptionString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 880 of file misc.cpp.

884 {
885  DWORD RegDataType;
886  BOOL Ret = FALSE;
887 
891  &RegDataType,
892  (PBYTE)szBuffer,
893  BufferSize * sizeof(WCHAR),
894  NULL) ||
898  &RegDataType,
899  (PBYTE)szBuffer,
900  BufferSize * sizeof(WCHAR),
901  NULL)) &&
902  RegDataType == REG_SZ)
903  {
904  /* FIXME - check string for NULL termination! */
905  Ret = TRUE;
906  }
907  else
908  {
909  szBuffer[0] = L'\0';
912  szBuffer,
913  BufferSize))
914  {
915  Ret = TRUE;
916  }
917  }
918 
919  return Ret;
920 }
#define TRUE
Definition: types.h:120
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BufferSize
Definition: classpnp.h:419
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:514
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define SPDRP_DEVICEDESC
Definition: setupapi.h:502
#define IDS_UNKNOWNDEVICE
Definition: resource.h:111
BYTE * PBYTE
Definition: pedump.c:66
#define LoadString
Definition: winuser.h:5720
#define REG_SZ
Definition: layer.c:22

Referenced by FillDevicesListViewControl(), and UpdateDevInfo().

◆ GetDeviceLocationString()

BOOL GetDeviceLocationString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
IN DEVINST dnParentDevInst  OPTIONAL,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 318 of file misc.cpp.

323 {
324  DWORD RegDataType;
325  ULONG DataSize;
326  CONFIGRET cRet;
327  LPWSTR szFormatted;
328  HKEY hKey;
329  DWORD dwSize, dwType;
330  BOOL Ret = FALSE;
331 
332  DataSize = BufferSize * sizeof(WCHAR);
333  szBuffer[0] = L'\0';
334 
338  0,
339  DIREG_DRV,
341  if (hKey != INVALID_HANDLE_VALUE)
342  {
343  /* query the LocationInformationOverride value */
344  dwSize = BufferSize;
345  if (RegQueryValueEx(hKey,
346  L"LocationInformationOverride",
347  NULL,
348  &dwType,
349  (LPBYTE)szBuffer,
350  &dwSize) == ERROR_SUCCESS &&
351  dwType == REG_SZ &&
352  szBuffer[0] != L'\0')
353  {
354  Ret = TRUE;
355  }
356  else
357  {
358  szBuffer[0] = L'\0';
359  }
360 
361  RegCloseKey(hKey);
362  }
363 
364 
365  if (!Ret)
366  {
367  if (dnParentDevInst != 0)
368  {
369  /* query the parent node name */
370  if (CM_Get_DevNode_Registry_Property(dnParentDevInst,
372  &RegDataType,
373  szBuffer,
374  &DataSize,
375  0) == CR_SUCCESS &&
376  RegDataType == REG_SZ &&
379  &szFormatted,
380  szBuffer) != 0)
381  {
382  wcsncpy(szBuffer,
383  szFormatted,
384  BufferSize - 1);
385  szBuffer[BufferSize - 1] = L'\0';
386  LocalFree((HLOCAL)szFormatted);
387  Ret = TRUE;
388  }
389  }
390  else if (DeviceInfoData->DevInst != 0)
391  {
394  &RegDataType,
395  szBuffer,
396  &DataSize,
397  0);
398  if (cRet == CR_SUCCESS && RegDataType == REG_SZ)
399  {
400  /* FIXME - check string for NULL termination! */
401  Ret = TRUE;
402  }
403 
404  if (Ret && szBuffer[0] >= L'0' && szBuffer[0] <= L'9')
405  {
406  /* convert the string to an integer value and create a
407  formatted string */
408  ULONG ulLocation = (ULONG)wcstoul(szBuffer,
409  NULL,
410  10);
413  &szFormatted,
414  ulLocation,
415  szBuffer) != 0)
416  {
417  wcsncpy(szBuffer,
418  szFormatted,
419  BufferSize - 1);
420  szBuffer[BufferSize - 1] = L'\0';
421  LocalFree((HLOCAL)szFormatted);
422  }
423  else
424  Ret = FALSE;
425  }
426  }
427  }
428 
429  if (!Ret &&
431  IDS_UNKNOWN,
432  szBuffer,
433  BufferSize))
434  {
435  Ret = TRUE;
436  }
437 
438  return Ret;
439 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define CM_Get_DevNode_Registry_Property
Definition: cfgmgr32.h:1733
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define IDS_LOCATIONSTR
Definition: resource.h:106
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define IDS_UNKNOWN
Definition: resource.h:7
static HINSTANCE hDllInstance
Definition: clb.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BufferSize
Definition: classpnp.h:419
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CM_DRP_LOCATION_INFORMATION
Definition: cfgmgr32.h:689
#define IDS_DEVONPARENT
Definition: resource.h:113
static const WCHAR L[]
Definition: oid.c:1250
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
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
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPWSTR *lpTarget,...)
Definition: misc.cpp:144
#define DIREG_DRV
Definition: setupapi.h:182
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define LoadString
Definition: winuser.h:5720
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateControlStates(), and UpdateDevInfo().

◆ GetDeviceManufacturerString()

BOOL GetDeviceManufacturerString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 281 of file misc.cpp.

285 {
286  DWORD RegDataType;
287  BOOL Ret = FALSE;
288 
291  SPDRP_MFG,
292  &RegDataType,
293  (PBYTE)szBuffer,
294  BufferSize * sizeof(WCHAR),
295  NULL) ||
296  RegDataType != REG_SZ)
297  {
298  szBuffer[0] = L'\0';
300  IDS_UNKNOWN,
301  szBuffer,
302  BufferSize))
303  {
304  Ret = TRUE;
305  }
306  }
307  else
308  {
309  /* FIXME - check string for NULL termination! */
310  Ret = TRUE;
311  }
312 
313  return Ret;
314 }
#define TRUE
Definition: types.h:120
#define SPDRP_MFG
Definition: setupapi.h:513
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define IDS_UNKNOWN
Definition: resource.h:7
static HINSTANCE hDllInstance
Definition: clb.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BufferSize
Definition: classpnp.h:419
_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
BYTE * PBYTE
Definition: pedump.c:66
#define LoadString
Definition: winuser.h:5720
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateControlStates(), and UpdateDevInfo().

◆ GetDeviceStatusString()

BOOL GetDeviceStatusString ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 443 of file misc.cpp.

447 {
448  CONFIGRET cr;
449  ULONG Status, ProblemNumber;
450  UINT MessageId = IDS_UNKNOWN;
451  BOOL Ret = FALSE;
452 
453  szBuffer[0] = L'\0';
455  &ProblemNumber,
456  DevInst,
457  0,
458  hMachine);
459  if (cr == CR_SUCCESS)
460  {
461  if (Status & DN_HAS_PROBLEM)
462  {
463  UINT uRet;
464 
465  uRet = DeviceProblemTextW(hMachine,
466  DevInst,
467  ProblemNumber,
468  szBuffer,
469  (BufferSize != 0 ? BufferSize : BufferSize - 1));
470 
471  Ret = (uRet != 0 && uRet < BufferSize);
472  }
473  else
474  {
475  if (!(Status & (DN_DRIVER_LOADED | DN_STARTED)))
476  {
477  MessageId = IDS_NODRIVERLOADED;
478  }
479  else
480  {
481  MessageId = IDS_DEV_NO_PROBLEM;
482  }
483 
484  goto GeneralMessage;
485  }
486  }
487  else
488  {
489 GeneralMessage:
491  MessageId,
492  szBuffer,
493  (int)BufferSize))
494  {
495  Ret = TRUE;
496  }
497  }
498 
499  return Ret;
500 }
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 TRUE
Definition: types.h:120
#define DN_DRIVER_LOADED
Definition: cfg.h:119
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
UINT WINAPI DeviceProblemTextW(IN HMACHINE hMachine OPTIONAL, IN DEVINST dnDevInst, IN ULONG uProblemId, OUT LPWSTR lpString, IN UINT uMaxString)
Definition: devprblm.cpp:491
#define IDS_UNKNOWN
Definition: resource.h:7
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDS_NODRIVERLOADED
Definition: resource.h:112
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define BufferSize
Definition: classpnp.h:419
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
unsigned int UINT
Definition: ndis.h:50
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DN_STARTED
Definition: cfg.h:121
unsigned int ULONG
Definition: retypes.h:1
#define IDS_DEV_NO_PROBLEM
Definition: resource.h:130
#define LoadString
Definition: winuser.h:5720

Referenced by UpdateControlStates(), and UpdateDevInfo().

◆ GetDeviceTypeString()

BOOL GetDeviceTypeString ( IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 849 of file misc.cpp.

852 {
853  BOOL Ret = FALSE;
854 
856  szBuffer,
857  BufferSize,
858  NULL))
859  {
860  szBuffer[0] = L'\0';
862  IDS_UNKNOWN,
863  szBuffer,
864  BufferSize))
865  {
866  Ret = TRUE;
867  }
868  }
869  else
870  {
871  /* FIXME - check string for NULL termination! */
872  Ret = TRUE;
873  }
874 
875  return Ret;
876 }
#define SetupDiGetClassDescription
Definition: setupapi.h:2585
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define IDS_UNKNOWN
Definition: resource.h:7
static HINSTANCE hDllInstance
Definition: clb.c:30
#define BufferSize
Definition: classpnp.h:419
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
static const WCHAR L[]
Definition: oid.c:1250
#define LoadString
Definition: winuser.h:5720

Referenced by FillDevicesListViewControl(), and UpdateDevInfo().

◆ GetDriverDateString()

BOOL GetDriverDateString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 619 of file misc.cpp.

623 {
624  HKEY hKey;
625  FILETIME DriverDate;
626  SYSTEMTIME SystemTime, LocalTime;
627  DWORD dwSize, dwType;
628  BOOL Ret = FALSE;
629 
630  szBuffer[0] = L'\0';
631 
632  /* get driver provider, date and version */
636  0,
637  DIREG_DRV,
639  if (hKey != INVALID_HANDLE_VALUE)
640  {
641  /* query the driver provider */
642  dwSize = sizeof(FILETIME);
643  if (RegQueryValueEx(hKey,
644  L"DriverDateData",
645  NULL,
646  &dwType,
647  (LPBYTE)&DriverDate,
648  &dwSize) == ERROR_SUCCESS &&
649  dwType == REG_BINARY &&
650  dwSize == sizeof(FILETIME) &&
651  FileTimeToSystemTime(&DriverDate,
652  &SystemTime) &&
654  &SystemTime,
655  &LocalTime) &&
658  &LocalTime,
659  NULL,
660  szBuffer,
661  BufferSize) != 0)
662  {
663  Ret = TRUE;
664  }
665 
666  RegCloseKey(hKey);
667  }
668 
669  if (!Ret)
670  {
671  /* unable to query the information */
674  szBuffer,
675  BufferSize))
676  {
677  Ret = TRUE;
678  }
679  }
680 
681  return Ret;
682 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:193
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, CONST SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime)
Definition: timezone.c:377
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
struct _FILETIME FILETIME
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
#define BufferSize
Definition: classpnp.h:419
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_NOTAVAILABLE
Definition: resource.h:120
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 GetDateFormat
Definition: winnls.h:1181
#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
#define LoadString
Definition: winuser.h:5720

Referenced by UpdateDriverDlg().

◆ GetDriverProviderString()

BOOL GetDriverProviderString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 504 of file misc.cpp.

508 {
509  HKEY hKey;
510  DWORD dwSize, dwType;
511  BOOL Ret = FALSE;
512 
513  szBuffer[0] = L'\0';
514 
515  /* get driver provider, date and version */
519  0,
520  DIREG_DRV,
522  if (hKey != INVALID_HANDLE_VALUE)
523  {
524  /* query the driver provider */
525  dwSize = BufferSize;
526  if (RegQueryValueEx(hKey,
528  NULL,
529  &dwType,
530  (LPBYTE)szBuffer,
531  &dwSize) == ERROR_SUCCESS &&
532  dwType == REG_SZ &&
533  szBuffer[0] != L'\0')
534  {
535  Ret = TRUE;
536  }
537  else
538  {
539  szBuffer[0] = L'\0';
540  }
541 
542  RegCloseKey(hKey);
543  }
544 
545  if (szBuffer[0] == L'\0')
546  {
547  /* unable to query the information */
549  IDS_UNKNOWN,
550  szBuffer,
551  BufferSize))
552  {
553  Ret = TRUE;
554  }
555  }
556 
557  return Ret;
558 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define IDS_UNKNOWN
Definition: resource.h:7
static HINSTANCE hDllInstance
Definition: clb.c:30
#define REGSTR_VAL_PROVIDER_NAME
Definition: regstr.h:540
#define BufferSize
Definition: classpnp.h:419
_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
#define LoadString
Definition: winuser.h:5720
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateDriverDlg().

◆ GetDriverVersionString()

BOOL GetDriverVersionString ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
OUT LPWSTR  szBuffer,
IN DWORD  BufferSize 
)

Definition at line 562 of file misc.cpp.

566 {
567  HKEY hKey;
568  DWORD dwSize, dwType;
569  BOOL Ret = FALSE;
570 
571  szBuffer[0] = L'\0';
572 
573  /* get driver provider, date and version */
577  0,
578  DIREG_DRV,
580  if (hKey != INVALID_HANDLE_VALUE)
581  {
582  /* query the driver provider */
583  dwSize = BufferSize;
584  if (RegQueryValueEx(hKey,
585  L"DriverVersion",
586  NULL,
587  &dwType,
588  (LPBYTE)szBuffer,
589  &dwSize) == ERROR_SUCCESS &&
590  dwType == REG_SZ &&
591  szBuffer[0] != L'\0')
592  {
593  Ret = TRUE;
594  }
595  else
596  {
597  szBuffer[0] = L'\0';
598  }
599 
600  RegCloseKey(hKey);
601  }
602 
603  if (szBuffer[0] == L'\0')
604  {
605  /* unable to query the information */
608  szBuffer,
609  BufferSize))
610  {
611  Ret = TRUE;
612  }
613  }
614 
615  return Ret;
616 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
#define BufferSize
Definition: classpnp.h:419
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_NOTAVAILABLE
Definition: resource.h:120
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
#define LoadString
Definition: winuser.h:5720
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateDriverDlg().

◆ IsDeviceHidden()

BOOL IsDeviceHidden ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL IsHidden 
)

Definition at line 687 of file misc.cpp.

690 {
691  CONFIGRET cr;
692  ULONG Status, ProblemNumber;
693  BOOL Ret = FALSE;
694 
696  &ProblemNumber,
697  DevInst,
698  0,
699  hMachine);
700  if (cr == CR_SUCCESS)
701  {
702  *IsHidden = ((Status & DN_NO_SHOW_IN_DM) != 0);
703  Ret = TRUE;
704  }
705 
706  return Ret;
707 }
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 TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
Status
Definition: gdiplustypes.h:24
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
unsigned int ULONG
Definition: retypes.h:1

Referenced by BuildDevicesList().

◆ IsDeviceStarted()

BOOL IsDeviceStarted ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL IsStarted 
)

Definition at line 735 of file misc.cpp.

738 {
739  CONFIGRET cr;
740  ULONG Status, ProblemNumber;
741  BOOL Ret = FALSE;
742 
744  &ProblemNumber,
745  DevInst,
746  0,
747  hMachine);
748  if (cr == CR_SUCCESS)
749  {
750  *IsStarted = ((Status & DN_STARTED) != 0);
751  Ret = TRUE;
752  }
753 
754  return Ret;
755 }
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 TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
Status
Definition: gdiplustypes.h:24
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DN_STARTED
Definition: cfg.h:121
unsigned int ULONG
Definition: retypes.h:1

Referenced by UpdateDevInfo().

◆ IsDriverInstalled()

BOOL IsDriverInstalled ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL Installed 
)

Definition at line 759 of file misc.cpp.

762 {
763  CONFIGRET cr;
764  ULONG Status, ProblemNumber;
765  BOOL Ret = FALSE;
766 
768  &ProblemNumber,
769  DevInst,
770  0,
771  hMachine);
772  if (cr == CR_SUCCESS)
773  {
774  *Installed = ((Status & DN_HAS_PROBLEM) != 0 ||
775  (Status & (DN_DRIVER_LOADED | DN_STARTED)) != 0);
776  Ret = TRUE;
777  }
778 
779  return Ret;
780 }
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 TRUE
Definition: types.h:120
#define DN_DRIVER_LOADED
Definition: cfg.h:119
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define DN_HAS_PROBLEM
Definition: cfg.h:128
Status
Definition: gdiplustypes.h:24
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DN_STARTED
Definition: cfg.h:121
unsigned int ULONG
Definition: retypes.h:1

Referenced by UpdateDevInfo().

◆ LengthOfStrResource()

INT LengthOfStrResource ( IN HINSTANCE  hInst,
IN UINT  uID 
)

Definition at line 23 of file misc.c.

25 {
26  HRSRC hrSrc;
27  HGLOBAL hRes;
28  LPWSTR lpName, lpStr;
29 
30  if (hInst == NULL)
31  {
32  return -1;
33  }
34 
35  /* There are always blocks of 16 strings */
36  lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
37 
38  /* Find the string table block */
39  if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
40  (hRes = LoadResource(hInst, hrSrc)) &&
41  (lpStr = LockResource(hRes)))
42  {
43  UINT x;
44 
45  /* Find the string we're looking for */
46  uID &= 0xF; /* position in the block, same as % 16 */
47  for (x = 0; x < uID; x++)
48  {
49  lpStr += (*lpStr) + 1;
50  }
51 
52  /* Found the string */
53  return (int)(*lpStr);
54  }
55  return -1;
56 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
_In_ LPCSTR lpName
Definition: winbase.h:2736
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
#define RT_STRING
Definition: pedump.c:368
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int UINT
Definition: ndis.h:50
static LPWSTR
Definition: misc.c:35
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by AllocAndLoadString(), AllocAndLoadStringsCat(), and DeviceProblemTextW().

◆ ListViewGetSelectedItemData()

LPARAM ListViewGetSelectedItemData ( IN HWND  hwnd)

Definition at line 134 of file misc.c.

135 {
136  int Index;
137 
139  -1,
140  LVNI_SELECTED);
141  if (Index != -1)
142  {
143  LVITEM li;
144 
145  li.mask = LVIF_PARAM;
146  li.iItem = Index;
147  li.iSubItem = 0;
148 
150  &li))
151  {
152  return li.lParam;
153  }
154  }
155 
156  return 0;
157 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define LVNI_SELECTED
Definition: commctrl.h:2420
static const UCHAR Index[8]
Definition: usbohci.c:18
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2390
#define LVIF_PARAM
Definition: commctrl.h:2307
#define LVITEM
Definition: commctrl.h:2371

Referenced by DisplaySelectedDeviceProperties(), SecurityPageProc(), UpdateControlStates(), UpdateDevicesListViewControl(), and UpdatePrincipalInfo().

◆ LoadAndFormatString()

DWORD LoadAndFormatString ( IN HINSTANCE  hInstance,
IN UINT  uID,
OUT LPWSTR lpTarget,
  ... 
)

Definition at line 76 of file misc.c.

80 {
81  DWORD Ret = 0;
83  va_list lArgs;
84 
86  hInstance,
87  uID) > 0)
88  {
89  va_start(lArgs, lpTarget);
90  /* let's use Format to format it because it has the ability to allocate
91  memory automatically */
93  lpFormat,
94  0,
95  0,
96  (LPWSTR)lpTarget,
97  0,
98  &lArgs);
99  va_end(lArgs);
100 
102  }
103 
104  return Ret;
105 }
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
HINSTANCE hInstance
Definition: charmap.c:20
#define va_end(ap)
Definition: acmsvcex.h:90
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
char * va_list
Definition: acmsvcex.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
LPCWSTR lpFormat
Definition: trayclock.cpp:32
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
INT AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:50
#define va_start(ap, A)
Definition: acmsvcex.h:91
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GetDeviceLocationString().

◆ LoadAndFormatStringsCat()

DWORD LoadAndFormatStringsCat ( IN HINSTANCE  hInstance,
IN UINT uID,
IN UINT  nIDs,
OUT LPWSTR lpTarget,
  ... 
)

Definition at line 177 of file misc.cpp.

182 {
183  DWORD Ret = 0;
185  va_list lArgs;
186 
188  hInstance,
189  uID,
190  nIDs) != 0)
191  {
192  va_start(lArgs, lpTarget);
193  /* let's use FormatMessage to format it because it has the ability to allocate
194  memory automatically */
196  lpFormat,
197  0,
198  0,
199  (LPWSTR)lpTarget,
200  0,
201  &lArgs);
202  va_end(lArgs);
203 
205  }
206 
207  return Ret;
208 }
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
HINSTANCE hInstance
Definition: charmap.c:20
#define va_end(ap)
Definition: acmsvcex.h:90
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
char * va_list
Definition: acmsvcex.h:78
static INT AllocAndLoadStringsCat(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT *uID, IN UINT nIDs)
Definition: misc.cpp:98
unsigned long DWORD
Definition: ntddk_ex.h:95
LPCWSTR lpFormat
Definition: trayclock.cpp:32
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define va_start(ap, A)
Definition: acmsvcex.h:91
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DeviceProblemTextW().

◆ LoadAndInitComctl32()

HINSTANCE LoadAndInitComctl32 ( VOID  )

Definition at line 1106 of file misc.cpp.

1107 {
1108  typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
1109  PINITCOMMONCONTROLS pInitCommonControls;
1110  HINSTANCE hComCtl32;
1111 
1112  hComCtl32 = LoadLibrary(L"comctl32.dll");
1113  if (hComCtl32 != NULL)
1114  {
1115  /* initialize the common controls */
1116  pInitCommonControls = (PINITCOMMONCONTROLS)GetProcAddress(hComCtl32,
1117  "InitCommonControls");
1118  if (pInitCommonControls == NULL)
1119  {
1120  FreeLibrary(hComCtl32);
1121  return NULL;
1122  }
1123 
1124  pInitCommonControls();
1125  }
1126 
1127  return hComCtl32;
1128 }
#define LoadLibrary
Definition: winbase.h:3686
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405
#define WINAPI
Definition: msvc.h:8
static const WCHAR L[]
Definition: oid.c:1250
#define VOID
Definition: acefi.h:82
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by DeviceAdvancedPropertiesW(), DeviceCreateHardwarePageEx(), DeviceProblemWizardW(), and DevicePropertiesExW().

◆ ResourcesProcDriverDlgProc()

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

Definition at line 338 of file hwresource.cpp.

342 {
343  PDEVADVPROP_INFO hpd;
344  HWND hWndDevList;
345  INT_PTR Ret = FALSE;
346 
348 
349  if (hpd != NULL || uMsg == WM_INITDIALOG)
350  {
351  switch (uMsg)
352  {
353  case WM_INITDIALOG:
354  {
355  /* init list */
356  hWndDevList = GetDlgItem(hwndDlg, IDC_DRIVERRESOURCES);
357  InitializeDevicesList(hWndDevList);
358 
360  if (hpd != NULL)
361  {
362  SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)hpd);
363 
364  UpdateDriverResourceDlg(hwndDlg, hpd);
365  AddResourceItems(hpd, hWndDevList);
366  }
367 
368  Ret = TRUE;
369  break;
370  }
371  }
372  }
373 
374  return Ret;
375 }
#define TRUE
Definition: types.h:120
struct _DEVADVPROP_INFO * PDEVADVPROP_INFO
int32_t INT_PTR
Definition: typedefs.h:62
#define SetWindowLongPtr
Definition: treelist.c:70
static VOID InitializeDevicesList(IN HWND hWndDevList)
Definition: hwresource.cpp:172
#define IDC_DRIVERRESOURCES
Definition: resource.h:252
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
VOID AddResourceItems(IN PDEVADVPROP_INFO dap, IN HWND hWndDevList)
Definition: hwresource.cpp:243
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static VOID UpdateDriverResourceDlg(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: hwresource.cpp:320
#define DWLP_USER
Definition: winuser.h:866
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by UpdateDevInfo().

◆ ShowDeviceProblemWizard()

BOOL ShowDeviceProblemWizard ( IN HWND hWndParent  OPTIONAL,
IN HDEVINFO  hDevInfo,
IN PSP_DEVINFO_DATA  DevInfoData,
IN HMACHINE hMachine  OPTIONAL 
)

Definition at line 34 of file devprblm.cpp.

38 {
39  WCHAR szDeviceInstanceId[256];
40  CONFIGRET cr;
41  ULONG Status, ProblemNumber;
42  DWORD dwReboot;
43  BOOL Ret = FALSE;
44 
45  /* Get the device instance id */
46  if (!SetupDiGetDeviceInstanceId(hDevInfo,
47  DevInfoData,
48  szDeviceInstanceId,
49  256,
50  NULL))
51  return FALSE;
52 
54  &ProblemNumber,
55  DevInfoData->DevInst,
56  0,
57  hMachine);
58  if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
59  {
60  switch (ProblemNumber)
61  {
63  {
64  /* FIXME - only if it's not a root bus devloader */
65  /* FIXME - display the update driver wizard */
66  break;
67  }
68 
73  case CM_PROB_LIAR:
75  {
76  /* FIXME - display the update driver wizard */
77  InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
78  break;
79  }
80 
84  {
85  /* FIXME - display the conflict wizard */
86  break;
87  }
88 
90  case CM_PROB_REINSTALL:
92  {
93  /* FIXME - display the driver (re)installation wizard */
94  InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
95  break;
96  }
97 
99  {
100  /* FIXME - 4 cases:
101  1) if it's a missing system devloader:
102  - fail
103  2) if it's not a system devloader but still missing:
104  - display the driver reinstallation wizard
105  3) if it's not a system devloader but the file can be found:
106  - display the update driver wizard
107  4) if it's a missing or empty software key
108  - display the update driver wizard
109  */
110  break;
111  }
112 
120  case CM_PROB_PHANTOM:
121  /* FIXME - do nothing */
122  break;
123 
126  /* FIXME - display search hardware wizard */
127  break;
128 
131  case CM_PROB_MOVED:
132  case CM_PROB_TOO_EARLY:
134  /* FIXME - reboot computer */
135  break;
136 
137  case CM_PROB_REGISTRY:
138  /* FIXME - check registry */
139  break;
140 
141  case CM_PROB_DISABLED:
142  {
143  /* FIXME - if device was disabled by user display the "Enable Device" wizard,
144  otherwise Troubleshoot because the device was disabled by the system */
145  break;
146  }
147 
149  {
150  /* FIXME - if it's a graphics adapter:
151  - if it's a a secondary adapter and the main adapter
152  couldn't be found
153  - do nothing or default action
154  - else
155  - display the Properties
156  - else
157  - Update driver
158  */
159  break;
160  }
161 
162  case CM_PROB_FAILED_ADD:
163  {
164  /* FIXME - display the properties of the sub-device */
165  break;
166  }
167 
177  case CM_PROB_HALTED:
181  default:
182  {
183  /* FIXME - troubleshoot the device */
184  break;
185  }
186  }
187  }
188 
189  return Ret;
190 }
#define CM_PROB_HALTED
Definition: cfg.h:74
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 TRUE
Definition: types.h:120
#define CM_PROB_REENUMERATION
Definition: cfg.h:45
#define CM_PROB_HELD_FOR_EJECT
Definition: cfg.h:77
#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 CM_PROB_OUT_OF_MEMORY
Definition: cfg.h:33
#define CM_PROB_FAILED_START
Definition: cfg.h:40
#define CM_PROB_FAILED_POST_START
Definition: cfg.h:73
#define CM_PROB_DUPLICATE_DEVICE
Definition: cfg.h:72
#define CM_PROB_FAILED_DRIVER_ENTRY
Definition: cfg.h:67
#define CM_PROB_REGISTRY_TOO_LARGE
Definition: cfg.h:79
#define CM_PROB_WILL_BE_REMOVED
Definition: cfg.h:51
#define CM_PROB_PARTIAL_LOG_CONF
Definition: cfg.h:46
#define CM_PROB_DISABLED
Definition: cfg.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CM_PROB_INVALID_DATA
Definition: cfg.h:39
#define CM_PROB_NO_SOFTCONFIG
Definition: cfg.h:64
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define CM_PROB_NORMAL_CONFLICT
Definition: cfg.h:42
#define CM_PROB_DEVLOADER_NOT_FOUND
Definition: cfg.h:38
#define CM_PROB_LIAR
Definition: cfg.h:41
#define CM_PROB_HARDWARE_DISABLED
Definition: cfg.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CM_PROB_DISABLED_SERVICE
Definition: cfg.h:62
#define CM_PROB_TRANSLATION_FAILED
Definition: cfg.h:63
#define DN_HAS_PROBLEM
Definition: cfg.h:128
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
#define CM_PROB_CANT_SHARE_IRQ
Definition: cfg.h:60
#define CM_PROB_REINSTALL
Definition: cfg.h:48
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2595
#define CM_PROB_DRIVER_FAILED_LOAD
Definition: cfg.h:69
#define CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
Definition: cfg.h:68
#define CM_PROB_UNKNOWN_RESOURCE
Definition: cfg.h:47
#define CM_PROB_NEED_RESTART
Definition: cfg.h:44
Status
Definition: gdiplustypes.h:24
#define CM_PROB_TOO_EARLY
Definition: cfg.h:56
#define CM_PROB_DEVLOADER_NOT_READY
Definition: cfg.h:53
#define CM_PROB_DEVICE_NOT_THERE
Definition: cfg.h:54
#define CM_PROB_SYSTEM_SHUTDOWN
Definition: cfg.h:76
#define CM_PROB_LEGACY_SERVICE_NO_DEVICES
Definition: cfg.h:71
#define CM_PROB_DRIVER_BLOCKED
Definition: cfg.h:78
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
#define CM_PROB_MOVED
Definition: cfg.h:55
#define CM_PROB_DRIVER_SERVICE_KEY_INVALID
Definition: cfg.h:70
unsigned int ULONG
Definition: retypes.h:1
#define CM_PROB_FAILED_FILTER
Definition: cfg.h:37
#define CM_PROB_BOOT_CONFIG_CONFLICT
Definition: cfg.h:36
#define CM_PROB_ENTRY_IS_WRONG_TYPE
Definition: cfg.h:34
#define CM_PROB_FAILED_ADD
Definition: cfg.h:61
#define CM_PROB_DEVLOADER_FAILED
Definition: cfg.h:32
#define CM_PROB_REGISTRY
Definition: cfg.h:49
#define CM_PROB_NO_VALID_LOG_CONF
Definition: cfg.h:57
#define CM_PROB_IRQ_TRANSLATION_FAILED
Definition: cfg.h:66

Referenced by AdvPropGeneralDlgProc(), and DeviceProblemWizardW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( devmgr  )

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 18 of file dnsrslvr.c.