ReactOS 0.4.15-dev-7670-g69b08be
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)
 
PVOID GetResourceList (_In_ LPWSTR pszDeviceID)
 
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 70 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}
#define DN_DISABLEABLE
Definition: cfg.h:131
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Get_DevNode_Status_Ex(_Out_ PULONG pulStatus, _Out_ PULONG pulProblemNumber, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3591
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
uint32_t ULONG
Definition: typedefs.h:59

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}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
int32_t INT
Definition: typedefs.h:58
_In_ DWORD nLength
Definition: wincon.h:473
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

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

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 */
804
805 /* ignore errors */
806 LastErr = GetLastError();
808 DevInfoData,
810 sizeof(SP_PROPCHANGE_PARAMS)))
811 {
814 DevInfoData);
815 }
816 SetLastError(LastErr);
817 }
818
819 /* try config-specific */
822
824 DevInfoData,
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}
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2599
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1155
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2617
#define DICS_DISABLE
Definition: setupapi.h:114
#define DICS_ENABLE
Definition: setupapi.h:112
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
#define DI_NEEDREBOOT
Definition: setupapi.h:54
_In_ BOOL bEnable
Definition: winddi.h:3426

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,
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;
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
1098Cleanup:
1101 return Ret;
1102}
HANDLE HKEY
Definition: registry.h:26
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define MAX_PATH
Definition: compat.h:34
static DWORD DWORD * dwLength
Definition: fusion.c:86
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5934
BOOL WINAPI SetupDiBuildDriverInfoList(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:718
FxAutoRegKey hKey
#define REG_SZ
Definition: layer.c:22
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
long LONG
Definition: pedump.c:60
#define REGSTR_VAL_INFPATH
Definition: regstr.h:439
#define REGSTR_VAL_INFSECTION
Definition: regstr.h:440
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SetupDiGetDriverInfoDetail
Definition: setupapi.h:2604
#define SPDIT_CLASSDRIVER
Definition: setupapi.h:505
#define LINE_LEN
Definition: setupapi.h:20
#define DI_ENUMSINGLEINF
Definition: setupapi.h:62
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1054
#define DIREG_DRV
Definition: setupapi.h:182
#define ERROR_NO_DRIVER_SELECTED
Definition: setupapi.h:299
SP_DRVINFO_DETAIL_DATA_A SP_DRVINFO_DETAIL_DATA
Definition: setupapi.h:1162
#define SetupDiSetDeviceInstallParams
Definition: setupapi.h:2619
#define SetupDiEnumDriverInfo
Definition: setupapi.h:2587
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:87
CHAR DriverPath[MAX_PATH]
Definition: setupapi.h:888
CHAR SectionName[LINE_LEN]
Definition: setupapi.h:1065
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define RegQueryValueEx
Definition: winreg.h:524

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 MAX_DEVICE_ID_LEN
Definition: devaction.c:40
_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)
int ret
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243

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 IDS_UNKNOWNDEVICE
Definition: resource.h:113
BYTE * PBYTE
Definition: pedump.c:66
#define SPDRP_DEVICEDESC
Definition: setupapi.h:507
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2603
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:519
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define LoadString
Definition: winuser.h:5818

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;
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,
342 {
343 /* query the LocationInformationOverride value */
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
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 &&
432 szBuffer,
433 BufferSize))
434 {
435 Ret = TRUE;
436 }
437
438 return Ret;
439}
#define IDS_UNKNOWN
Definition: resource.h:7
#define CM_DRP_LOCATION_INFORMATION
Definition: cfgmgr32.h:689
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
#define CM_Get_DevNode_Registry_Property
Definition: cfgmgr32.h:1733
#define BufferSize
Definition: mmc.h:75
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPWSTR *lpTarget,...)
Definition: misc.cpp:144
#define IDS_DEVONPARENT
Definition: resource.h:115
#define IDS_LOCATIONSTR
Definition: resource.h:108
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

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';
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 SPDRP_MFG
Definition: setupapi.h:518

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 {
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 {
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 {
489GeneralMessage:
491 MessageId,
492 szBuffer,
493 (int)BufferSize))
494 {
495 Ret = TRUE;
496 }
497 }
498
499 return Ret;
500}
#define DN_DRIVER_LOADED
Definition: cfg.h:119
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define DN_STARTED
Definition: cfg.h:121
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_NODRIVERLOADED
Definition: resource.h:114
#define IDS_DEV_NO_PROBLEM
Definition: resource.h:133

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,
858 NULL))
859 {
860 szBuffer[0] = L'\0';
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:2590

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,
640 {
641 /* query the driver provider */
642 dwSize = sizeof(FILETIME);
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
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 IDS_NOTAVAILABLE
Definition: resource.h:122
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
BOOL WINAPI SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, CONST SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime)
Definition: timezone.c:377
struct _FILETIME FILETIME
#define REG_BINARY
Definition: nt_native.h:1496
#define LOCALE_USER_DEFAULT
#define GetDateFormat
Definition: winnls.h:1184
#define DATE_SHORTDATE
Definition: winnls.h:196

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,
523 {
524 /* query the driver provider */
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
543 }
544
545 if (szBuffer[0] == L'\0')
546 {
547 /* unable to query the information */
550 szBuffer,
551 BufferSize))
552 {
553 Ret = TRUE;
554 }
555 }
556
557 return Ret;
558}
#define REGSTR_VAL_PROVIDER_NAME
Definition: regstr.h:540

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,
581 {
582 /* query the driver provider */
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
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}

Referenced by UpdateDriverDlg().

◆ GetResourceList()

PVOID GetResourceList ( _In_ LPWSTR  pszDeviceID)

◆ 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}
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148

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}

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}

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}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HINSTANCE hInst
Definition: dxdiag.c:13
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RT_STRING
Definition: pedump.c:368
_In_ LPCSTR lpName
Definition: winbase.h:2789

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,
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}
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_PARAM
Definition: commctrl.h:2311
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

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
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 */
94 0,
95 0,
96 (LPWSTR)lpTarget,
97 0,
98 &lArgs);
99 va_end(lArgs);
100
102 }
103
104 return Ret;
105}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
INT AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:50
HINSTANCE hInstance
Definition: charmap.c:19
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:421
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419

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}
static INT AllocAndLoadStringsCat(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT *uID, IN UINT nIDs)
Definition: misc.cpp:98

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 VOID
Definition: acefi.h:82
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibrary
Definition: winbase.h:3797
#define WINAPI
Definition: msvc.h:6

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 316 of file hwresource.cpp.

320{
322 HWND hWndDevList;
323 INT_PTR Ret = FALSE;
324
326
327 if (hpd != NULL || uMsg == WM_INITDIALOG)
328 {
329 switch (uMsg)
330 {
331 case WM_INITDIALOG:
332 {
333 /* init list */
334 hWndDevList = GetDlgItem(hwndDlg, IDC_DRIVERRESOURCES);
335 InitializeDevicesList(hWndDevList);
336
338 if (hpd != NULL)
339 {
340 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)hpd);
341
342 UpdateDriverResourceDlg(hwndDlg, hpd);
343 AddResourceItems(hpd, hWndDevList);
344 }
345
346 Ret = TRUE;
347 break;
348 }
349 }
350 }
351
352 return Ret;
353}
LPARAM lParam
Definition: combotst.c:139
#define IDC_DRIVERRESOURCES
Definition: resource.h:255
static VOID UpdateDriverResourceDlg(IN HWND hwndDlg, IN PDEVADVPROP_INFO dap)
Definition: hwresource.cpp:298
VOID AddResourceItems(IN PDEVADVPROP_INFO dap, IN HWND hWndDevList)
Definition: hwresource.cpp:243
static VOID InitializeDevicesList(IN HWND hWndDevList)
Definition: hwresource.cpp:172
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define DWLP_USER
Definition: winuser.h:871
#define WM_INITDIALOG
Definition: winuser.h:1738
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)

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
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:
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
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_REGISTRY_TOO_LARGE
Definition: cfg.h:79
#define CM_PROB_REGISTRY
Definition: cfg.h:49
#define CM_PROB_REINSTALL
Definition: cfg.h:48
#define CM_PROB_BOOT_CONFIG_CONFLICT
Definition: cfg.h:36
#define CM_PROB_FAILED_ADD
Definition: cfg.h:61
#define CM_PROB_INVALID_DATA
Definition: cfg.h:39
#define CM_PROB_HELD_FOR_EJECT
Definition: cfg.h:77
#define CM_PROB_DRIVER_BLOCKED
Definition: cfg.h:78
#define CM_PROB_HARDWARE_DISABLED
Definition: cfg.h:59
#define CM_PROB_NO_SOFTCONFIG
Definition: cfg.h:64
#define CM_PROB_TRANSLATION_FAILED
Definition: cfg.h:63
#define CM_PROB_PARTIAL_LOG_CONF
Definition: cfg.h:46
#define CM_PROB_LIAR
Definition: cfg.h:41
#define CM_PROB_REENUMERATION
Definition: cfg.h:45
#define CM_PROB_NORMAL_CONFLICT
Definition: cfg.h:42
#define CM_PROB_NEED_RESTART
Definition: cfg.h:44
#define CM_PROB_UNKNOWN_RESOURCE
Definition: cfg.h:47
#define CM_PROB_DEVICE_NOT_THERE
Definition: cfg.h:54
#define CM_PROB_DRIVER_SERVICE_KEY_INVALID
Definition: cfg.h:70
#define CM_PROB_DISABLED
Definition: cfg.h:52
#define CM_PROB_FAILED_FILTER
Definition: cfg.h:37
#define CM_PROB_WILL_BE_REMOVED
Definition: cfg.h:51
#define CM_PROB_DEVLOADER_FAILED
Definition: cfg.h:32
#define CM_PROB_FAILED_START
Definition: cfg.h:40
#define CM_PROB_PHANTOM
Definition: cfg.h:75
#define CM_PROB_DRIVER_FAILED_LOAD
Definition: cfg.h:69
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
#define CM_PROB_OUT_OF_MEMORY
Definition: cfg.h:33
#define CM_PROB_HALTED
Definition: cfg.h:74
#define CM_PROB_NOT_VERIFIED
Definition: cfg.h:43
#define CM_PROB_FAILED_POST_START
Definition: cfg.h:73
#define CM_PROB_SYSTEM_SHUTDOWN
Definition: cfg.h:76
#define CM_PROB_NO_VALID_LOG_CONF
Definition: cfg.h:57
#define CM_PROB_IRQ_TRANSLATION_FAILED
Definition: cfg.h:66
#define CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
Definition: cfg.h:68
#define CM_PROB_LACKED_ARBITRATOR
Definition: cfg.h:35
#define CM_PROB_FAILED_DRIVER_ENTRY
Definition: cfg.h:67
#define CM_PROB_DEVLOADER_NOT_READY
Definition: cfg.h:53
#define CM_PROB_DISABLED_SERVICE
Definition: cfg.h:62
#define CM_PROB_DEVLOADER_NOT_FOUND
Definition: cfg.h:38
#define CM_PROB_TOO_EARLY
Definition: cfg.h:56
#define CM_PROB_MOVED
Definition: cfg.h:55
#define CM_PROB_DUPLICATE_DEVICE
Definition: cfg.h:72
#define CM_PROB_LEGACY_SERVICE_NO_DEVICES
Definition: cfg.h:71
#define CM_PROB_ENTRY_IS_WRONG_TYPE
Definition: cfg.h:34
#define CM_PROB_CANT_SHARE_IRQ
Definition: cfg.h:60
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: stubs.cpp:24

Referenced by AdvPropGeneralDlgProc(), and DeviceProblemWizardW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( devmgr  )

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance
extern

Definition at line 17 of file browser.c.