ReactOS 0.4.15-dev-5895-g2687c1b
rpcserver.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for rpcserver.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

DWORD WINAPI RpcServerThread (LPVOID lpParameter)
 
void __RPC_FAR *__RPC_USER midl_user_allocate (SIZE_T len)
 
void __RPC_USER midl_user_free (void __RPC_FAR *ptr)
 
static CONFIGRET WINAPI NtStatusToCrError (NTSTATUS Status)
 
static VOID SplitDeviceInstanceID (IN LPWSTR pszDeviceInstanceID, OUT LPWSTR pszEnumerator, OUT LPWSTR pszDevice, OUT LPWSTR pszInstance)
 
static CONFIGRET ClearDeviceStatus (_In_ LPWSTR pszDeviceID, _In_ DWORD ulStatus, _In_ DWORD ulProblem)
 
static CONFIGRET GetDeviceStatus (_In_ LPWSTR pszDeviceID, _Out_ DWORD *pulStatus, _Out_ DWORD *pulProblem)
 
static CONFIGRET SetDeviceStatus (_In_ LPWSTR pszDeviceID, _In_ DWORD ulStatus, _In_ DWORD ulProblem)
 
static CONFIGRET DisableDeviceInstance (_In_ LPWSTR pszDeviceInstance, _Inout_opt_ PPNP_VETO_TYPE pVetoType, _Inout_opt_ LPWSTR pszVetoName, _In_ DWORD ulNameLength)
 
static BOOL IsValidDeviceInstanceID (_In_ PWSTR pszDeviceInstanceID)
 
static BOOL IsRootDeviceInstanceID (_In_ PWSTR pszDeviceInstanceID)
 
static BOOL IsPresentDeviceInstanceID (_In_ LPWSTR pszDeviceInstanceID)
 
static CONFIGRET OpenConfigurationKey (_In_ LPCWSTR pszDeviceID, _Out_ PHKEY phKey)
 
static CONFIGRET GetConfigurationData (_In_ HKEY hKey, _In_ ULONG ulLogConfType, _Out_ PULONG pulRegDataType, _Out_ PULONG pulDataSize, _Out_ LPBYTE *ppBuffer)
 
VOID __RPC_USER PNP_NOTIFY_HANDLE_rundown (PNP_NOTIFY_HANDLE pHandle)
 
DWORD WINAPI PNP_Disconnect (handle_t hBinding)
 
DWORD WINAPI PNP_Connect (handle_t hBinding)
 
DWORD WINAPI PNP_GetVersion (handle_t hBinding, WORD *pVersion)
 
DWORD WINAPI PNP_GetGlobalState (handle_t hBinding, DWORD *pulState, DWORD ulFlags)
 
DWORD WINAPI PNP_InitDetection (handle_t hBinding)
 
DWORD WINAPI PNP_ReportLogOn (handle_t hBinding, BOOL Admin, DWORD ProcessId)
 
DWORD WINAPI PNP_ValidateDeviceInstance (handle_t hBinding, LPWSTR pDeviceID, DWORD ulFlags)
 
DWORD WINAPI PNP_GetRootDeviceInstance (handle_t hBinding, LPWSTR pDeviceID, PNP_RPC_STRING_LEN ulLength)
 
DWORD WINAPI PNP_GetRelatedDeviceInstance (handle_t hBinding, DWORD ulRelationship, LPWSTR pDeviceID, LPWSTR pRelatedDeviceId, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_EnumerateSubKeys (handle_t hBinding, DWORD ulBranch, DWORD ulIndex, LPWSTR Buffer, PNP_RPC_STRING_LEN ulLength, PNP_RPC_STRING_LEN *pulRequiredLen, DWORD ulFlags)
 
static CONFIGRET GetRelationsInstanceList (_In_ PWSTR pszDevice, _In_ DWORD ulFlags, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
 
static CONFIGRET GetServiceInstanceList (_In_ PWSTR pszService, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
 
static CONFIGRET GetDeviceInstanceList (_In_ PWSTR pszDevice, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
 
CONFIGRET GetEnumeratorInstanceList (_In_ PWSTR pszEnumerator, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
 
static CONFIGRET GetAllInstanceList (_Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
 
DWORD WINAPI PNP_GetDeviceList (handle_t hBinding, LPWSTR pszFilter, LPWSTR Buffer, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
static CONFIGRET GetRelationsInstanceListSize (_In_ PWSTR pszDevice, _In_ DWORD ulFlags, _Inout_ PDWORD pulLength)
 
static CONFIGRET GetServiceInstanceListSize (_In_ PWSTR pszService, _Out_ PDWORD pulLength)
 
static CONFIGRET GetDeviceInstanceListSize (_In_ LPCWSTR pszDevice, _Out_ PULONG pulLength)
 
static CONFIGRET GetEnumeratorInstanceListSize (_In_ LPCWSTR pszEnumerator, _Out_ PULONG pulLength)
 
static CONFIGRET GetAllInstanceListSize (_Out_ PULONG pulLength)
 
DWORD WINAPI PNP_GetDeviceListSize (handle_t hBinding, LPWSTR pszFilter, PNP_RPC_BUFFER_SIZE *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetDepth (handle_t hBinding, LPWSTR pszDeviceID, DWORD *pulDepth, DWORD ulFlags)
 
DWORD WINAPI PNP_GetDeviceRegProp (handle_t hBinding, LPWSTR pDeviceID, DWORD ulProperty, DWORD *pulRegDataType, BYTE *Buffer, PNP_PROP_SIZE *pulTransferLen, PNP_PROP_SIZE *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_SetDeviceRegProp (handle_t hBinding, LPWSTR pDeviceId, DWORD ulProperty, DWORD ulDataType, BYTE *Buffer, PNP_PROP_SIZE ulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetClassInstance (handle_t hBinding, LPWSTR pDeviceId, LPWSTR pszClassInstance, PNP_RPC_STRING_LEN ulLength)
 
DWORD WINAPI PNP_CreateKey (handle_t hBinding, LPWSTR pszSubKey, DWORD samDesired, DWORD ulFlags)
 
DWORD WINAPI PNP_DeleteRegistryKey (handle_t hBinding, LPWSTR pszDeviceID, LPWSTR pszParentKey, LPWSTR pszChildKey, DWORD ulFlags)
 
DWORD WINAPI PNP_GetClassCount (handle_t hBinding, DWORD *pulClassCount, DWORD ulFlags)
 
DWORD WINAPI PNP_GetClassName (handle_t hBinding, LPWSTR pszClassGuid, LPWSTR Buffer, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_DeleteClassKey (handle_t hBinding, LPWSTR pszClassGuid, DWORD ulFlags)
 
DWORD WINAPI PNP_GetInterfaceDeviceAlias (handle_t hBinding, LPWSTR pszInterfaceDevice, GUID *AliasInterfaceGuid, LPWSTR pszAliasInterfaceDevice, PNP_RPC_STRING_LEN *pulLength, PNP_RPC_STRING_LEN *pulTransferLen, DWORD ulFlags)
 
DWORD WINAPI PNP_GetInterfaceDeviceList (handle_t hBinding, GUID *InterfaceGuid, LPWSTR pszDeviceID, BYTE *Buffer, PNP_RPC_BUFFER_SIZE *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetInterfaceDeviceListSize (handle_t hBinding, PNP_RPC_BUFFER_SIZE *pulLen, GUID *InterfaceGuid, LPWSTR pszDeviceID, DWORD ulFlags)
 
DWORD WINAPI PNP_RegisterDeviceClassAssociation (handle_t hBinding, LPWSTR pszDeviceID, GUID *InterfaceGuid, LPWSTR pszReference, LPWSTR pszSymLink, PNP_RPC_STRING_LEN *pulLength, PNP_RPC_STRING_LEN *pulTransferLen, DWORD ulFlags)
 
DWORD WINAPI PNP_UnregisterDeviceClassAssociation (handle_t hBinding, LPWSTR pszInterfaceDevice, DWORD ulFlags)
 
DWORD WINAPI PNP_GetClassRegProp (handle_t hBinding, LPWSTR pszClassGuid, DWORD ulProperty, DWORD *pulRegDataType, BYTE *Buffer, PNP_RPC_STRING_LEN *pulTransferLen, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_SetClassRegProp (handle_t hBinding, LPWSTR pszClassGuid, DWORD ulProperty, DWORD ulDataType, BYTE *Buffer, PNP_PROP_SIZE ulLength, DWORD ulFlags)
 
static CONFIGRET CreateDeviceInstance (_In_ LPWSTR pszDeviceID, _In_ BOOL bPhantomDevice)
 
static CONFIGRET GenerateDeviceID (_Inout_ LPWSTR pszDeviceID, _In_ PNP_RPC_STRING_LEN ulLength)
 
DWORD WINAPI PNP_CreateDevInst (handle_t hBinding, LPWSTR pszDeviceID, LPWSTR pszParentDeviceID, PNP_RPC_STRING_LEN ulLength, DWORD ulFlags)
 
static CONFIGRET SetupDeviceInstance (_In_ LPWSTR pszDeviceInstance, _In_ DWORD ulMinorAction)
 
static CONFIGRET EnableDeviceInstance (_In_ LPWSTR pszDeviceInstance)
 
static CONFIGRET ReenumerateDeviceInstance (_In_ LPWSTR pszDeviceInstance, _In_ ULONG ulMinorAction)
 
DWORD WINAPI PNP_DeviceInstanceAction (handle_t hBinding, DWORD ulMajorAction, DWORD ulMinorAction, LPWSTR pszDeviceInstance1, LPWSTR pszDeviceInstance2)
 
DWORD WINAPI PNP_GetDeviceStatus (handle_t hBinding, LPWSTR pDeviceID, DWORD *pulStatus, DWORD *pulProblem, DWORD ulFlags)
 
DWORD WINAPI PNP_SetDeviceProblem (handle_t hBinding, LPWSTR pDeviceID, DWORD ulProblem, DWORD ulFlags)
 
DWORD WINAPI PNP_DisableDevInst (handle_t hBinding, LPWSTR pDeviceID, PPNP_VETO_TYPE pVetoType, LPWSTR pszVetoName, DWORD ulNameLength, DWORD ulFlags)
 
DWORD WINAPI PNP_UninstallDevInst (handle_t hBinding, LPWSTR pDeviceID, DWORD ulFlags)
 
static BOOL CheckForDeviceId (LPWSTR lpDeviceIdList, LPWSTR lpDeviceId)
 
static VOID AppendDeviceId (LPWSTR lpDeviceIdList, LPDWORD lpDeviceIdListSize, LPWSTR lpDeviceId)
 
DWORD WINAPI PNP_AddID (handle_t hBinding, LPWSTR pszDeviceID, LPWSTR pszID, DWORD ulFlags)
 
DWORD WINAPI PNP_RegisterDriver (handle_t hBinding, LPWSTR pszDeviceID, DWORD ulFlags)
 
DWORD WINAPI PNP_QueryRemove (handle_t hBinding, LPWSTR pszDeviceID, PPNP_VETO_TYPE pVetoType, LPWSTR pszVetoName, DWORD ulNameLength, DWORD ulFlags)
 
DWORD WINAPI PNP_RequestDeviceEject (handle_t hBinding, LPWSTR pszDeviceID, PPNP_VETO_TYPE pVetoType, LPWSTR pszVetoName, DWORD ulNameLength, DWORD ulFlags)
 
CONFIGRET WINAPI PNP_IsDockStationPresent (handle_t hBinding, BOOL *Present)
 
DWORD WINAPI PNP_RequestEjectPC (handle_t hBinding)
 
DWORD WINAPI PNP_HwProfFlags (handle_t hBinding, DWORD ulAction, LPWSTR pDeviceID, DWORD ulConfig, DWORD *pulValue, PPNP_VETO_TYPE pVetoType, LPWSTR pszVetoName, DWORD ulNameLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetHwProfInfo (handle_t hBinding, DWORD ulIndex, HWPROFILEINFO *pHWProfileInfo, DWORD ulProfileInfoSize, DWORD ulFlags)
 
DWORD WINAPI PNP_AddEmptyLogConf (handle_t hBinding, LPWSTR pDeviceID, DWORD ulPriority, DWORD *pulLogConfTag, DWORD ulFlags)
 
DWORD WINAPI PNP_FreeLogConf (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfType, DWORD ulLogConfTag, DWORD ulFlags)
 
DWORD WINAPI PNP_GetFirstLogConf (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfType, DWORD *pulLogConfTag, DWORD ulFlags)
 
DWORD WINAPI PNP_GetNextLogConf (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfType, DWORD ulCurrentTag, DWORD *pulNextTag, DWORD ulFlags)
 
DWORD WINAPI PNP_GetLogConfPriority (handle_t hBinding, LPWSTR pDeviceID, DWORD ulType, DWORD ulTag, DWORD *pPriority, DWORD ulFlags)
 
DWORD WINAPI PNP_AddResDes (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID ResourceID, DWORD *pulResourceTag, BYTE *ResourceData, PNP_RPC_BUFFER_SIZE ResourceLen, DWORD ulFlags)
 
DWORD WINAPI PNP_FreeResDes (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID ResourceID, DWORD ulResourceTag, DWORD *pulPreviousResType, DWORD *pulPreviousResTag, DWORD ulFlags)
 
DWORD WINAPI PNP_GetNextResDes (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID ResourceID, DWORD ulResourceTag, DWORD *pulNextResType, DWORD *pulNextResTag, DWORD ulFlags)
 
DWORD WINAPI PNP_GetResDesData (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID ResourceID, DWORD ulResourceTag, BYTE *Buffer, PNP_RPC_BUFFER_SIZE BufferLen, DWORD ulFlags)
 
DWORD WINAPI PNP_GetResDesDataSize (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID ResourceID, DWORD ulResourceTag, DWORD *pulSize, DWORD ulFlags)
 
DWORD WINAPI PNP_ModifyResDes (handle_t hBinding, LPWSTR pDeviceID, DWORD ulLogConfTag, DWORD ulLogConfType, RESOURCEID CurrentResourceID, RESOURCEID NewResourceID, DWORD ulResourceTag, BYTE *ResourceData, PNP_RPC_BUFFER_SIZE ResourceLen, DWORD ulFlags)
 
DWORD WINAPI PNP_DetectResourceConflict (handle_t hBinding, LPWSTR pDeviceID, RESOURCEID ResourceID, BYTE *ResourceData, PNP_RPC_BUFFER_SIZE ResourceLen, BOOL *pbConflictDetected, DWORD ulFlags)
 
DWORD WINAPI PNP_QueryResConfList (handle_t hBinding, LPWSTR pDeviceID, RESOURCEID ResourceID, BYTE *ResourceData, PNP_RPC_BUFFER_SIZE ResourceLen, BYTE *Buffer, PNP_RPC_BUFFER_SIZE BufferLen, DWORD ulFlags)
 
DWORD WINAPI PNP_SetHwProf (handle_t hBinding, DWORD ulHardwareProfile, DWORD ulFlags)
 
DWORD WINAPI PNP_QueryArbitratorFreeData (handle_t hBinding, BYTE *pData, DWORD DataLen, LPWSTR pDeviceID, RESOURCEID ResourceID, DWORD ulFlags)
 
DWORD WINAPI PNP_QueryArbitratorFreeSize (handle_t hBinding, DWORD *pulSize, LPWSTR pDeviceID, RESOURCEID ResourceID, DWORD ulFlags)
 
CONFIGRET WINAPI PNP_RunDetection (handle_t hBinding, DWORD ulFlags)
 
DWORD WINAPI PNP_RegisterNotification (handle_t hBinding, DWORD ulUnknown2, LPWSTR pszName, BYTE *pNotificationFilter, DWORD ulNotificationFilterSize, DWORD ulFlags, PNP_NOTIFY_HANDLE *pNotifyHandle, DWORD ulUnknown8, DWORD *pulUnknown9)
 
DWORD WINAPI PNP_UnregisterNotification (handle_t hBinding, PNP_NOTIFY_HANDLE *pNotifyHandle)
 
DWORD WINAPI PNP_GetCustomDevProp (handle_t hBinding, LPWSTR pDeviceID, LPWSTR CustomPropName, DWORD *pulRegDataType, BYTE *Buffer, PNP_RPC_STRING_LEN *pulTransferLen, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetVersionInternal (handle_t hBinding, WORD *pwVersion)
 
DWORD WINAPI PNP_GetBlockedDriverInfo (handle_t hBinding, BYTE *Buffer, PNP_RPC_BUFFER_SIZE *pulTransferLen, PNP_RPC_BUFFER_SIZE *pulLength, DWORD ulFlags)
 
DWORD WINAPI PNP_GetServerSideDeviceInstallFlags (handle_t hBinding, DWORD *pulSSDIFlags, DWORD ulFlags)
 
DWORD WINAPI PNP_GetObjectPropKeys (handle_t hBinding, LPWSTR ObjectName, DWORD ObjectType, LPWSTR PropertyCultureName, PNP_PROP_COUNT *PropertyCount, PNP_PROP_COUNT *TransferLen, DEVPROPKEY *PropertyKeys, DWORD Flags)
 
DWORD WINAPI PNP_GetObjectProp (handle_t hBinding, LPWSTR ObjectName, DWORD ObjectType, LPWSTR PropertyCultureName, const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PNP_PROP_SIZE *PropertySize, PNP_PROP_SIZE *TransferLen, BYTE *PropertyBuffer, DWORD Flags)
 
DWORD WINAPI PNP_SetObjectProp (handle_t hBinding, LPWSTR ObjectName, DWORD ObjectType, LPWSTR PropertyCultureName, const DEVPROPKEY *PropertyKey, DEVPROPTYPE PropertyType, PNP_PROP_SIZE PropertySize, BYTE *PropertyBuffer, DWORD Flags)
 
DWORD WINAPI PNP_InstallDevInst (handle_t hBinding)
 
DWORD WINAPI PNP_ApplyPowerSettings (handle_t hBinding)
 
DWORD WINAPI PNP_DriverStoreAddDriverPackage (handle_t hBinding)
 
DWORD WINAPI PNP_DriverStoreDeleteDriverPackage (handle_t hBinding)
 
DWORD WINAPI PNP_RegisterServiceNotification (handle_t hBinding)
 
DWORD WINAPI PNP_SetActiveService (handle_t hBinding, LPWSTR pszFilter, DWORD ulFlags)
 
DWORD WINAPI PNP_DeleteServiceDevices (handle_t hBinding)
 

Variables

static WCHAR szRootDeviceInstanceID [] = L"HTREE\\ROOT\\0"
 
LIST_ENTRY NotificationListHead
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 33 of file rpcserver.c.

Function Documentation

◆ AppendDeviceId()

static VOID AppendDeviceId ( LPWSTR  lpDeviceIdList,
LPDWORD  lpDeviceIdListSize,
LPWSTR  lpDeviceId 
)
static

Definition at line 3530 of file rpcserver.c.

3533{
3534 DWORD dwLen;
3535 DWORD dwPos;
3536
3537 dwLen = wcslen(lpDeviceId);
3538 dwPos = (*lpDeviceIdListSize / sizeof(WCHAR)) - 1;
3539
3540 wcscpy(&lpDeviceIdList[dwPos], lpDeviceId);
3541
3542 dwPos += (dwLen + 1);
3543
3544 lpDeviceIdList[dwPos] = 0;
3545
3546 *lpDeviceIdListSize = dwPos * sizeof(WCHAR);
3547}
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PNP_AddID().

◆ CheckForDeviceId()

static BOOL CheckForDeviceId ( LPWSTR  lpDeviceIdList,
LPWSTR  lpDeviceId 
)
static

Definition at line 3509 of file rpcserver.c.

3511{
3512 LPWSTR lpPtr;
3514
3515 lpPtr = lpDeviceIdList;
3516 while (*lpPtr != 0)
3517 {
3518 dwLength = wcslen(lpPtr);
3519 if (0 == _wcsicmp(lpPtr, lpDeviceId))
3520 return TRUE;
3521
3522 lpPtr += (dwLength + 1);
3523 }
3524
3525 return FALSE;
3526}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static DWORD DWORD * dwLength
Definition: fusion.c:86
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by PNP_AddID().

◆ ClearDeviceStatus()

static CONFIGRET ClearDeviceStatus ( _In_ LPWSTR  pszDeviceID,
_In_ DWORD  ulStatus,
_In_ DWORD  ulProblem 
)
static

Definition at line 199 of file rpcserver.c.

203{
204 PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
207
208 DPRINT1("ClearDeviceStatus(%S 0x%lx 0x%lx)\n",
209 pszDeviceID, ulStatus, ulProblem);
210
212 pszDeviceID);
213 PlugPlayData.Operation = PNP_CLEAR_DEVICE_STATUS;
214 PlugPlayData.DeviceStatus = ulStatus;
215 PlugPlayData.DeviceProblem = ulProblem;
216
218 (PVOID)&PlugPlayData,
220 if (!NT_SUCCESS(Status))
222
223 return ret;
224}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: rpcserver.c:124
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
@ PlugPlayControlDeviceStatus
Definition: cmtypes.h:223
#define PNP_CLEAR_DEVICE_STATUS
Definition: cmtypes.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1385
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:525
int ret

Referenced by PNP_SetDeviceProblem(), and SetupDeviceInstance().

◆ CreateDeviceInstance()

static CONFIGRET CreateDeviceInstance ( _In_ LPWSTR  pszDeviceID,
_In_ BOOL  bPhantomDevice 
)
static

Definition at line 2882 of file rpcserver.c.

2885{
2886 WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
2887 WCHAR szDevice[MAX_DEVICE_ID_LEN];
2888 WCHAR szInstance[MAX_DEVICE_ID_LEN];
2889 HKEY hKeyEnumerator;
2890 HKEY hKeyDevice;
2891 HKEY hKeyInstance;
2892 HKEY hKeyControl;
2893 LONG lError;
2894
2895 /* Split the instance ID */
2896 SplitDeviceInstanceID(pszDeviceID,
2897 szEnumerator,
2898 szDevice,
2899 szInstance);
2900
2901 /* Open or create the enumerator key */
2902 lError = RegCreateKeyExW(hEnumKey,
2903 szEnumerator,
2904 0,
2905 NULL,
2908 NULL,
2909 &hKeyEnumerator,
2910 NULL);
2911 if (lError != ERROR_SUCCESS)
2912 {
2913 return CR_REGISTRY_ERROR;
2914 }
2915
2916 /* Open or create the device key */
2917 lError = RegCreateKeyExW(hKeyEnumerator,
2918 szDevice,
2919 0,
2920 NULL,
2923 NULL,
2924 &hKeyDevice,
2925 NULL);
2926
2927 /* Close the enumerator key */
2928 RegCloseKey(hKeyEnumerator);
2929
2930 if (lError != ERROR_SUCCESS)
2931 {
2932 return CR_REGISTRY_ERROR;
2933 }
2934
2935 /* Try to open the instance key and fail if it exists */
2936 lError = RegOpenKeyExW(hKeyDevice,
2937 szInstance,
2938 0,
2940 &hKeyInstance);
2941 if (lError == ERROR_SUCCESS)
2942 {
2943 DPRINT1("Instance %S already exists!\n", szInstance);
2944 RegCloseKey(hKeyInstance);
2945 RegCloseKey(hKeyDevice);
2947 }
2948
2949 /* Create a new instance key */
2950 lError = RegCreateKeyExW(hKeyDevice,
2951 szInstance,
2952 0,
2953 NULL,
2956 NULL,
2957 &hKeyInstance,
2958 NULL);
2959
2960 /* Close the device key */
2961 RegCloseKey(hKeyDevice);
2962
2963 if (lError != ERROR_SUCCESS)
2964 {
2965 return CR_REGISTRY_ERROR;
2966 }
2967
2968 if (bPhantomDevice)
2969 {
2970 DWORD dwPhantomValue = 1;
2971 RegSetValueExW(hKeyInstance,
2972 L"Phantom",
2973 0,
2974 REG_DWORD,
2975 (PBYTE)&dwPhantomValue,
2976 sizeof(dwPhantomValue));
2977 }
2978
2979 /* Create the 'Control' sub key */
2980 lError = RegCreateKeyExW(hKeyInstance,
2981 L"Control",
2982 0,
2983 NULL,
2986 NULL,
2987 &hKeyControl,
2988 NULL);
2989 if (lError == ERROR_SUCCESS)
2990 {
2991 RegCloseKey(hKeyControl);
2992 }
2993
2994 RegCloseKey(hKeyInstance);
2995
2996 return (lError == ERROR_SUCCESS) ? CR_SUCCESS : CR_REGISTRY_ERROR;
2997}
HKEY hEnumKey
Definition: umpnpmgr.c:44
static VOID SplitDeviceInstanceID(IN LPWSTR pszDeviceInstanceID, OUT LPWSTR pszEnumerator, OUT LPWSTR pszDevice, OUT LPWSTR pszInstance)
Definition: rpcserver.c:153
#define RegCloseKey(hKey)
Definition: registry.h:47
#define CR_ALREADY_SUCH_DEVINST
Definition: cfgmgr32.h:862
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MAX_DEVICE_ID_LEN
Definition: devaction.c:40
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4900
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by PNP_CreateDevInst().

◆ DisableDeviceInstance()

static CONFIGRET DisableDeviceInstance ( _In_ LPWSTR  pszDeviceInstance,
_Inout_opt_ PPNP_VETO_TYPE  pVetoType,
_Inout_opt_ LPWSTR  pszVetoName,
_In_ DWORD  ulNameLength 
)
static

Definition at line 294 of file rpcserver.c.

299{
303
304 DPRINT1("DisableDeviceInstance(%S %p %p %lu)\n",
305 pszDeviceInstance, pVetoType, pszVetoName, ulNameLength);
306
307 RtlInitUnicodeString(&QueryRemoveData.DeviceInstance,
308 pszDeviceInstance);
309
310 QueryRemoveData.Flags = 0;
311 QueryRemoveData.VetoType = 0;
312 QueryRemoveData.VetoName = pszVetoName;
313 QueryRemoveData.NameLength = ulNameLength;
314
316 &QueryRemoveData,
319 {
321 }
323 {
324 if (pVetoType != NULL)
325 *pVetoType = QueryRemoveData.VetoType;
326
328 }
329 else if (!NT_SUCCESS(Status))
330 {
332 }
333
334 return ret;
335}
#define CR_INVALID_DEVNODE
Definition: cfgmgr32.h:847
#define CR_REMOVE_VETOED
Definition: cfgmgr32.h:869
@ PlugPlayControlQueryAndRemoveDevice
Definition: cmtypes.h:215
#define STATUS_PLUGPLAY_QUERY_VETOED
Definition: ntstatus.h:219
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136

Referenced by PNP_DisableDevInst().

◆ EnableDeviceInstance()

static CONFIGRET EnableDeviceInstance ( _In_ LPWSTR  pszDeviceInstance)
static

Definition at line 3237 of file rpcserver.c.

3239{
3243
3244 DPRINT("Enable device instance %S\n", pszDeviceInstance);
3245
3246 RtlInitUnicodeString(&ControlData.DeviceInstance, pszDeviceInstance);
3247 Status = NtPlugPlayControl(PlugPlayControlStartDevice, &ControlData, sizeof(ControlData));
3248 if (!NT_SUCCESS(Status))
3250
3251 return ret;
3252}
@ PlugPlayControlStartDevice
Definition: cmtypes.h:213
#define DPRINT
Definition: sndvol32.h:71

Referenced by PNP_DeviceInstanceAction().

◆ GenerateDeviceID()

static CONFIGRET GenerateDeviceID ( _Inout_ LPWSTR  pszDeviceID,
_In_ PNP_RPC_STRING_LEN  ulLength 
)
static

Definition at line 3002 of file rpcserver.c.

3005{
3006 WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
3007 HKEY hKey;
3008 DWORD dwInstanceNumber;
3009 DWORD dwError = ERROR_SUCCESS;
3011
3012 /* Fail, if the device name contains backslashes */
3013 if (wcschr(pszDeviceID, L'\\') != NULL)
3014 return CR_INVALID_DEVICE_ID;
3015
3016 /* Generated ID is: Root<Device ID><Instance number> */
3017 dwInstanceNumber = 0;
3018 while (dwError == ERROR_SUCCESS)
3019 {
3020 if (dwInstanceNumber >= 10000)
3021 return CR_FAILURE;
3022
3023 swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
3024 pszDeviceID, dwInstanceNumber);
3025
3026 /* Try to open the enum key of the device instance */
3027 dwError = RegOpenKeyEx(hEnumKey, szGeneratedInstance, 0, KEY_QUERY_VALUE, &hKey);
3028 if (dwError == ERROR_SUCCESS)
3029 {
3031 dwInstanceNumber++;
3032 }
3033 }
3034
3035 /* pszDeviceID is an out parameter too for generated IDs */
3036 if (wcslen(szGeneratedInstance) > ulLength)
3037 {
3039 }
3040 else
3041 {
3042 wcscpy(pszDeviceID, szGeneratedInstance);
3043 }
3044
3045 return ret;
3046}
#define CR_INVALID_DEVICE_ID
Definition: cfgmgr32.h:876
#define CR_FAILURE
Definition: cfgmgr32.h:865
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define wcschr
Definition: compat.h:17
#define swprintf
Definition: precomp.h:40
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define RegOpenKeyEx
Definition: winreg.h:520

Referenced by PNP_CreateDevInst().

◆ GetAllInstanceList()

static CONFIGRET GetAllInstanceList ( _Inout_ PWSTR  pszBuffer,
_Inout_ PDWORD  pulLength 
)
static

Definition at line 1223 of file rpcserver.c.

1226{
1227 WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
1228 PWSTR pPtr;
1229 DWORD dwIndex, dwEnumeratorLength, dwUsedLength, dwRemainingLength, dwPathLength;
1230 DWORD dwError;
1232
1233 dwUsedLength = 0;
1234 dwRemainingLength = *pulLength;
1235 pPtr = pszBuffer;
1236
1237 for (dwIndex = 0; ; dwIndex++)
1238 {
1239 dwEnumeratorLength = MAX_DEVICE_ID_LEN;
1240 dwError = RegEnumKeyExW(hEnumKey,
1241 dwIndex,
1242 szEnumeratorBuffer,
1243 &dwEnumeratorLength,
1244 NULL, NULL, NULL, NULL);
1245 if (dwError != ERROR_SUCCESS)
1246 break;
1247
1248 dwPathLength = dwRemainingLength;
1249 ret = GetEnumeratorInstanceList(szEnumeratorBuffer,
1250 pPtr,
1251 &dwPathLength);
1252 if (ret != CR_SUCCESS)
1253 break;
1254
1255 dwUsedLength += dwPathLength - 1;
1256 dwRemainingLength -= dwPathLength - 1;
1257 pPtr += dwPathLength - 1;
1258 }
1259
1260 if (ret == CR_SUCCESS)
1261 *pulLength = dwUsedLength + 1;
1262 else
1263 *pulLength = 0;
1264
1265 return ret;
1266}
CONFIGRET GetEnumeratorInstanceList(_In_ PWSTR pszEnumerator, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:1152
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by PNP_GetDeviceList().

◆ GetAllInstanceListSize()

static CONFIGRET GetAllInstanceListSize ( _Out_ PULONG  pulLength)
static

Definition at line 1608 of file rpcserver.c.

1610{
1611 WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
1612 DWORD dwIndex, dwEnumeratorLength, dwBufferLength;
1613 DWORD dwError;
1615
1616 for (dwIndex = 0; ; dwIndex++)
1617 {
1618 dwEnumeratorLength = MAX_DEVICE_ID_LEN;
1619 dwError = RegEnumKeyExW(hEnumKey,
1620 dwIndex,
1621 szEnumeratorBuffer,
1622 &dwEnumeratorLength,
1623 NULL, NULL, NULL, NULL);
1624 if (dwError != ERROR_SUCCESS)
1625 break;
1626
1627 /* Get the size of all device instances for the enumerator */
1628 ret = GetEnumeratorInstanceListSize(szEnumeratorBuffer,
1629 &dwBufferLength);
1630 if (ret != CR_SUCCESS)
1631 break;
1632
1633 *pulLength += dwBufferLength;
1634 }
1635
1636 return ret;
1637}
static CONFIGRET GetEnumeratorInstanceListSize(_In_ LPCWSTR pszEnumerator, _Out_ PULONG pulLength)
Definition: rpcserver.c:1547

Referenced by PNP_GetDeviceListSize().

◆ GetConfigurationData()

static CONFIGRET GetConfigurationData ( _In_ HKEY  hKey,
_In_ ULONG  ulLogConfType,
_Out_ PULONG  pulRegDataType,
_Out_ PULONG  pulDataSize,
_Out_ LPBYTE ppBuffer 
)
static

Definition at line 473 of file rpcserver.c.

479{
480 LPCWSTR pszValueName;
481
482 switch (ulLogConfType)
483 {
484 case BOOT_LOG_CONF:
485 pszValueName = L"BootConfig";
486 *pulRegDataType = REG_RESOURCE_LIST;
487 break;
488
489 case ALLOC_LOG_CONF:
490 pszValueName = L"AllocConfig";
491 *pulRegDataType = REG_RESOURCE_LIST;
492 break;
493
494 case FORCED_LOG_CONF:
495 pszValueName = L"ForcedConfig";
496 *pulRegDataType = REG_RESOURCE_LIST;
497 break;
498
500 pszValueName = L"FilteredConfigVector";
501 *pulRegDataType = REG_RESOURCE_REQUIREMENTS_LIST;
502 break;
503
504 case BASIC_LOG_CONF:
505 pszValueName = L"BasicConfigVector";
506 *pulRegDataType = REG_RESOURCE_REQUIREMENTS_LIST;
507 break;
508
510 pszValueName = L"OverrideConfigVector";
511 *pulRegDataType = REG_RESOURCE_REQUIREMENTS_LIST;
512 break;
513
514 default:
515 DPRINT1("Unsupported configuration type!\n");
516 return CR_FAILURE;
517 }
518
519 /* Get the configuration data size */
521 pszValueName,
522 NULL,
523 NULL,
524 NULL,
525 pulDataSize) != ERROR_SUCCESS)
526 {
527 return CR_INVALID_LOG_CONF;
528 }
529
530 /* Allocate the buffer */
531 *ppBuffer = HeapAlloc(GetProcessHeap(), 0, *pulDataSize);
532 if (*ppBuffer == NULL)
533 {
534 return CR_OUT_OF_MEMORY;
535 }
536
537 /* Retrieve the configuration data */
539 pszValueName,
540 NULL,
541 NULL,
542 (LPBYTE)*ppBuffer,
543 pulDataSize) != ERROR_SUCCESS)
544 {
545 return CR_INVALID_LOG_CONF;
546 }
547
548 return CR_SUCCESS;
549}
#define FILTERED_LOG_CONF
Definition: cfgmgr32.h:597
#define BASIC_LOG_CONF
Definition: cfgmgr32.h:596
#define CR_OUT_OF_MEMORY
Definition: cfgmgr32.h:844
#define CR_INVALID_LOG_CONF
Definition: cfgmgr32.h:850
#define BOOT_LOG_CONF
Definition: cfgmgr32.h:599
#define OVERRIDE_LOG_CONF
Definition: cfgmgr32.h:601
#define ALLOC_LOG_CONF
Definition: cfgmgr32.h:598
#define FORCED_LOG_CONF
Definition: cfgmgr32.h:600
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
unsigned char * LPBYTE
Definition: typedefs.h:53
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by PNP_GetFirstLogConf(), PNP_GetNextLogConf(), and PNP_GetNextResDes().

◆ GetDeviceInstanceList()

static CONFIGRET GetDeviceInstanceList ( _In_ PWSTR  pszDevice,
_Inout_ PWSTR  pszBuffer,
_Inout_ PDWORD  pulLength 
)
static

Definition at line 1081 of file rpcserver.c.

1085{
1086 WCHAR szInstanceBuffer[MAX_DEVICE_ID_LEN];
1087 WCHAR szPathBuffer[512];
1088 HKEY hDeviceKey;
1089 DWORD dwInstanceLength, dwPathLength, dwUsedLength;
1090 DWORD dwIndex, dwError;
1091 PWSTR pPtr;
1093
1094 /* Open the device key */
1095 dwError = RegOpenKeyExW(hEnumKey,
1096 pszDevice,
1097 0,
1099 &hDeviceKey);
1100 if (dwError != ERROR_SUCCESS)
1101 {
1102 DPRINT("Failed to open the device key (Error %lu)\n", dwError);
1103 return CR_REGISTRY_ERROR;
1104 }
1105
1106 dwUsedLength = 0;
1107 pPtr = pszBuffer;
1108
1109 for (dwIndex = 0; ; dwIndex++)
1110 {
1111 dwInstanceLength = MAX_DEVICE_ID_LEN;
1112 dwError = RegEnumKeyExW(hDeviceKey,
1113 dwIndex,
1114 szInstanceBuffer,
1115 &dwInstanceLength,
1116 NULL,
1117 NULL,
1118 NULL,
1119 NULL);
1120 if (dwError != ERROR_SUCCESS)
1121 break;
1122
1123 wsprintf(szPathBuffer, L"%s\\%s", pszDevice, szInstanceBuffer);
1124 DPRINT("Path: %S\n", szPathBuffer);
1125
1126 dwPathLength = wcslen(szPathBuffer) + 1;
1127 if (dwUsedLength + dwPathLength + 1 > *pulLength)
1128 {
1130 break;
1131 }
1132
1133 wcscpy(pPtr, szPathBuffer);
1134 dwUsedLength += dwPathLength;
1135 pPtr += dwPathLength;
1136
1137 *pPtr = UNICODE_NULL;
1138 }
1139
1140 RegCloseKey(hDeviceKey);
1141
1142 if (ret == CR_SUCCESS)
1143 *pulLength = dwUsedLength + 1;
1144 else
1145 *pulLength = 0;
1146
1147 return ret;
1148}
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define UNICODE_NULL
#define wsprintf
Definition: winuser.h:5855

Referenced by GetEnumeratorInstanceList(), and PNP_GetDeviceList().

◆ GetDeviceInstanceListSize()

static CONFIGRET GetDeviceInstanceListSize ( _In_ LPCWSTR  pszDevice,
_Out_ PULONG  pulLength 
)
static

Definition at line 1495 of file rpcserver.c.

1498{
1499 HKEY hDeviceKey;
1500 DWORD dwSubKeys, dwMaxSubKeyLength;
1501 DWORD dwError;
1502
1503 /* Open the device key */
1504 dwError = RegOpenKeyExW(hEnumKey,
1505 pszDevice,
1506 0,
1507 KEY_READ,
1508 &hDeviceKey);
1509 if (dwError != ERROR_SUCCESS)
1510 {
1511 DPRINT("Failed to open the device key (Error %lu)\n", dwError);
1512 return CR_REGISTRY_ERROR;
1513 }
1514
1515 /* Retrieve the number of device instances and the maximum name length */
1516 dwError = RegQueryInfoKeyW(hDeviceKey,
1517 NULL,
1518 NULL,
1519 NULL,
1520 &dwSubKeys,
1521 &dwMaxSubKeyLength,
1522 NULL,
1523 NULL,
1524 NULL,
1525 NULL,
1526 NULL,
1527 NULL);
1528 if (dwError != ERROR_SUCCESS)
1529 {
1530 DPRINT("RegQueryInfoKeyW failed (Error %lu)\n", dwError);
1531 dwSubKeys = 0;
1532 dwMaxSubKeyLength = 0;
1533 }
1534
1535 /* Close the device key */
1536 RegCloseKey(hDeviceKey);
1537
1538 /* Return the largest possible buffer size */
1539 *pulLength = dwSubKeys * (wcslen(pszDevice) + 1 + dwMaxSubKeyLength + 1);
1540
1541 return CR_SUCCESS;
1542}
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3690
#define KEY_READ
Definition: nt_native.h:1023

Referenced by GetEnumeratorInstanceListSize(), and PNP_GetDeviceListSize().

◆ GetDeviceStatus()

static CONFIGRET GetDeviceStatus ( _In_ LPWSTR  pszDeviceID,
_Out_ DWORD pulStatus,
_Out_ DWORD pulProblem 
)
static

Definition at line 229 of file rpcserver.c.

233{
234 PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
237
238 DPRINT("GetDeviceStatus(%S %p %p)\n",
239 pszDeviceID, pulStatus, pulProblem);
240
242 pszDeviceID);
243 PlugPlayData.Operation = PNP_GET_DEVICE_STATUS;
244
246 (PVOID)&PlugPlayData,
248 if (NT_SUCCESS(Status))
249 {
250 *pulStatus = PlugPlayData.DeviceStatus;
251 *pulProblem = PlugPlayData.DeviceProblem;
252 }
253 else
254 {
256 }
257
258 return ret;
259}
#define PNP_GET_DEVICE_STATUS
Definition: cmtypes.h:59

Referenced by DECLARE_INTERFACE_(), IsPresentDeviceInstanceID(), PNP_GetDeviceStatus(), PNP_SetDeviceProblem(), and SetupDeviceInstance().

◆ GetEnumeratorInstanceList()

CONFIGRET GetEnumeratorInstanceList ( _In_ PWSTR  pszEnumerator,
_Inout_ PWSTR  pszBuffer,
_Inout_ PDWORD  pulLength 
)

Definition at line 1152 of file rpcserver.c.

1156{
1157 WCHAR szDeviceBuffer[MAX_DEVICE_ID_LEN];
1158 WCHAR szPathBuffer[512];
1159 HKEY hEnumeratorKey;
1160 PWSTR pPtr;
1161 DWORD dwIndex, dwDeviceLength, dwUsedLength, dwRemainingLength, dwPathLength;
1162 DWORD dwError;
1164
1165 /* Open the enumerator key */
1166 dwError = RegOpenKeyExW(hEnumKey,
1167 pszEnumerator,
1168 0,
1170 &hEnumeratorKey);
1171 if (dwError != ERROR_SUCCESS)
1172 {
1173 DPRINT("Failed to open the enumerator key (Error %lu)\n", dwError);
1174 return CR_REGISTRY_ERROR;
1175 }
1176
1177 dwUsedLength = 0;
1178 dwRemainingLength = *pulLength;
1179 pPtr = pszBuffer;
1180
1181 for (dwIndex = 0; ; dwIndex++)
1182 {
1183 dwDeviceLength = MAX_DEVICE_ID_LEN;
1184 dwError = RegEnumKeyExW(hEnumeratorKey,
1185 dwIndex,
1186 szDeviceBuffer,
1187 &dwDeviceLength,
1188 NULL,
1189 NULL,
1190 NULL,
1191 NULL);
1192 if (dwError != ERROR_SUCCESS)
1193 break;
1194
1195 wsprintf(szPathBuffer, L"%s\\%s", pszEnumerator, szDeviceBuffer);
1196 DPRINT("Path: %S\n", szPathBuffer);
1197
1198 dwPathLength = dwRemainingLength;
1199 ret = GetDeviceInstanceList(szPathBuffer,
1200 pPtr,
1201 &dwPathLength);
1202 if (ret != CR_SUCCESS)
1203 break;
1204
1205 dwUsedLength += dwPathLength - 1;
1206 dwRemainingLength -= dwPathLength - 1;
1207 pPtr += dwPathLength - 1;
1208 }
1209
1210 RegCloseKey(hEnumeratorKey);
1211
1212 if (ret == CR_SUCCESS)
1213 *pulLength = dwUsedLength + 1;
1214 else
1215 *pulLength = 0;
1216
1217 return ret;
1218}
static CONFIGRET GetDeviceInstanceList(_In_ PWSTR pszDevice, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:1081

Referenced by GetAllInstanceList(), and PNP_GetDeviceList().

◆ GetEnumeratorInstanceListSize()

static CONFIGRET GetEnumeratorInstanceListSize ( _In_ LPCWSTR  pszEnumerator,
_Out_ PULONG  pulLength 
)
static

Definition at line 1547 of file rpcserver.c.

1550{
1551 WCHAR szDeviceBuffer[MAX_DEVICE_ID_LEN];
1552 WCHAR szPathBuffer[512];
1553 HKEY hEnumeratorKey;
1554 DWORD dwIndex, dwDeviceLength, dwBufferLength;
1555 DWORD dwError;
1557
1558 *pulLength = 0;
1559
1560 /* Open the enumerator key */
1561 dwError = RegOpenKeyExW(hEnumKey,
1562 pszEnumerator,
1563 0,
1565 &hEnumeratorKey);
1566 if (dwError != ERROR_SUCCESS)
1567 {
1568 DPRINT("Failed to open the enumerator key (Error %lu)\n", dwError);
1569 return CR_REGISTRY_ERROR;
1570 }
1571
1572 for (dwIndex = 0; ; dwIndex++)
1573 {
1574 dwDeviceLength = MAX_DEVICE_ID_LEN;
1575 dwError = RegEnumKeyExW(hEnumeratorKey,
1576 dwIndex,
1577 szDeviceBuffer,
1578 &dwDeviceLength,
1579 NULL,
1580 NULL,
1581 NULL,
1582 NULL);
1583 if (dwError != ERROR_SUCCESS)
1584 break;
1585
1586 wsprintf(szPathBuffer, L"%s\\%s", pszEnumerator, szDeviceBuffer);
1587 DPRINT("Path: %S\n", szPathBuffer);
1588
1589 ret = GetDeviceInstanceListSize(szPathBuffer, &dwBufferLength);
1590 if (ret != CR_SUCCESS)
1591 {
1592 *pulLength = 0;
1593 break;
1594 }
1595
1596 *pulLength += dwBufferLength;
1597 }
1598
1599 /* Close the enumerator key */
1600 RegCloseKey(hEnumeratorKey);
1601
1602 return ret;
1603}
static CONFIGRET GetDeviceInstanceListSize(_In_ LPCWSTR pszDevice, _Out_ PULONG pulLength)
Definition: rpcserver.c:1495

Referenced by GetAllInstanceListSize(), and PNP_GetDeviceListSize().

◆ GetRelationsInstanceList()

static CONFIGRET GetRelationsInstanceList ( _In_ PWSTR  pszDevice,
_In_ DWORD  ulFlags,
_Inout_ PWSTR  pszBuffer,
_Inout_ PDWORD  pulLength 
)
static

Definition at line 911 of file rpcserver.c.

916{
920
922 pszDevice);
923
925 {
926 PlugPlayData.Relations = 3;
927 }
928 else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
929 {
930 PlugPlayData.Relations = 2;
931 }
932 else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
933 {
934 PlugPlayData.Relations = 1;
935 }
936 else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
937 {
938 PlugPlayData.Relations = 0;
939 }
940
941 PlugPlayData.BufferSize = *pulLength * sizeof(WCHAR);
942 PlugPlayData.Buffer = pszBuffer;
943
945 (PVOID)&PlugPlayData,
947 if (NT_SUCCESS(Status))
948 {
949 *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
950 }
951 else
952 {
954 }
955
956 return ret;
957}
#define CM_GETIDLIST_FILTER_REMOVALRELATIONS
Definition: cfgmgr32.h:658
#define CM_GETIDLIST_FILTER_EJECTRELATIONS
Definition: cfgmgr32.h:657
#define CM_GETIDLIST_FILTER_BUSRELATIONS
Definition: cfgmgr32.h:660
#define CM_GETIDLIST_FILTER_POWERRELATIONS
Definition: cfgmgr32.h:659
@ PlugPlayControlQueryDeviceRelations
Definition: cmtypes.h:225

Referenced by PNP_GetDeviceList().

◆ GetRelationsInstanceListSize()

static CONFIGRET GetRelationsInstanceListSize ( _In_ PWSTR  pszDevice,
_In_ DWORD  ulFlags,
_Inout_ PDWORD  pulLength 
)
static

Definition at line 1346 of file rpcserver.c.

1350{
1354
1356 pszDevice);
1357
1359 {
1360 PlugPlayData.Relations = 3;
1361 }
1362 else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
1363 {
1364 PlugPlayData.Relations = 2;
1365 }
1366 else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
1367 {
1368 PlugPlayData.Relations = 1;
1369 }
1370 else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
1371 {
1372 PlugPlayData.Relations = 0;
1373 }
1374
1375 PlugPlayData.BufferSize = 0;
1376 PlugPlayData.Buffer = NULL;
1377
1379 (PVOID)&PlugPlayData,
1381 if (NT_SUCCESS(Status))
1382 {
1383 *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
1384 }
1385 else
1386 {
1388 }
1389
1390 return ret;
1391}

Referenced by PNP_GetDeviceListSize().

◆ GetServiceInstanceList()

static CONFIGRET GetServiceInstanceList ( _In_ PWSTR  pszService,
_Inout_ PWSTR  pszBuffer,
_Inout_ PDWORD  pulLength 
)
static

Definition at line 962 of file rpcserver.c.

966{
967 WCHAR szPathBuffer[512];
968 WCHAR szName[16];
969 HKEY hServicesKey = NULL, hServiceKey = NULL, hEnumKey = NULL;
970 DWORD dwValues, dwSize, dwIndex, dwUsedLength, dwPathLength;
971 DWORD dwError;
972 PWSTR pPtr;
974
975 /* Open the device key */
977 L"System\\CurrentControlSet\\Services",
978 0,
979 KEY_READ,
980 &hServicesKey);
981 if (dwError != ERROR_SUCCESS)
982 {
983 DPRINT("Failed to open the services key (Error %lu)\n", dwError);
984 return CR_REGISTRY_ERROR;
985 }
986
987 dwError = RegOpenKeyExW(hServicesKey,
988 pszService,
989 0,
990 KEY_READ,
991 &hServiceKey);
992 if (dwError != ERROR_SUCCESS)
993 {
994 DPRINT("Failed to open the service key (Error %lu)\n", dwError);
996 goto Done;
997 }
998
999 dwError = RegOpenKeyExW(hServiceKey,
1000 L"Enum",
1001 0,
1002 KEY_READ,
1003 &hEnumKey);
1004 if (dwError != ERROR_SUCCESS)
1005 {
1006 DPRINT("Failed to open the service enum key (Error %lu)\n", dwError);
1008 goto Done;
1009 }
1010
1011 /* Retrieve the number of device instances */
1012 dwSize = sizeof(DWORD);
1013 dwError = RegQueryValueExW(hEnumKey,
1014 L"Count",
1015 NULL,
1016 NULL,
1017 (LPBYTE)&dwValues,
1018 &dwSize);
1019 if (dwError != ERROR_SUCCESS)
1020 {
1021 DPRINT("RegQueryValueExW failed (Error %lu)\n", dwError);
1022 dwValues = 1;
1023 }
1024
1025 DPRINT("dwValues %lu\n", dwValues);
1026
1027 dwUsedLength = 0;
1028 pPtr = pszBuffer;
1029
1030 for (dwIndex = 0; dwIndex < dwValues; dwIndex++)
1031 {
1032 wsprintf(szName, L"%lu", dwIndex);
1033
1034 dwSize = sizeof(szPathBuffer);
1035 dwError = RegQueryValueExW(hEnumKey,
1036 szName,
1037 NULL,
1038 NULL,
1039 (LPBYTE)szPathBuffer,
1040 &dwSize);
1041 if (dwError != ERROR_SUCCESS)
1042 break;
1043
1044 DPRINT("Path: %S\n", szPathBuffer);
1045
1046 dwPathLength = wcslen(szPathBuffer) + 1;
1047 if (dwUsedLength + dwPathLength + 1 > *pulLength)
1048 {
1050 break;
1051 }
1052
1053 wcscpy(pPtr, szPathBuffer);
1054 dwUsedLength += dwPathLength;
1055 pPtr += dwPathLength;
1056
1057 *pPtr = UNICODE_NULL;
1058 }
1059
1060Done:
1061 if (hEnumKey != NULL)
1063
1064 if (hServiceKey != NULL)
1065 RegCloseKey(hServiceKey);
1066
1067 if (hServicesKey != NULL)
1069
1070 if (ret == CR_SUCCESS)
1071 *pulLength = dwUsedLength + 1;
1072 else
1073 *pulLength = 0;
1074
1075 return ret;
1076}
static HANDLE hServicesKey
Definition: devinst.c:21
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define DWORD
Definition: nt_native.h:44
static const WCHAR szName[]
Definition: powrprof.c:45
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by PNP_GetDeviceList().

◆ GetServiceInstanceListSize()

static CONFIGRET GetServiceInstanceListSize ( _In_ PWSTR  pszService,
_Out_ PDWORD  pulLength 
)
static

Definition at line 1396 of file rpcserver.c.

1399{
1400 HKEY hServicesKey = NULL, hServiceKey = NULL, hEnumKey = NULL;
1401 DWORD dwValues, dwMaxValueLength, dwSize;
1402 DWORD dwError;
1404
1405 /* Open the device key */
1407 L"System\\CurrentControlSet\\Services",
1408 0,
1409 KEY_READ,
1410 &hServicesKey);
1411 if (dwError != ERROR_SUCCESS)
1412 {
1413 DPRINT("Failed to open the services key (Error %lu)\n", dwError);
1414 return CR_REGISTRY_ERROR;
1415 }
1416
1417 dwError = RegOpenKeyExW(hServicesKey,
1418 pszService,
1419 0,
1420 KEY_READ,
1421 &hServiceKey);
1422 if (dwError != ERROR_SUCCESS)
1423 {
1424 DPRINT("Failed to open the service key (Error %lu)\n", dwError);
1426 goto Done;
1427 }
1428
1429 dwError = RegOpenKeyExW(hServiceKey,
1430 L"Enum",
1431 0,
1432 KEY_READ,
1433 &hEnumKey);
1434 if (dwError != ERROR_SUCCESS)
1435 {
1436 DPRINT("Failed to open the service enum key (Error %lu)\n", dwError);
1438 goto Done;
1439 }
1440
1441 /* Retrieve the number of device instances */
1442 dwSize = sizeof(DWORD);
1443 dwError = RegQueryValueExW(hEnumKey,
1444 L"Count",
1445 NULL,
1446 NULL,
1447 (LPBYTE)&dwValues,
1448 &dwSize);
1449 if (dwError != ERROR_SUCCESS)
1450 {
1451 DPRINT("RegQueryValueExW failed (Error %lu)\n", dwError);
1452 dwValues = 1;
1453 }
1454
1455 /* Retrieve the maximum instance name length */
1456 dwError = RegQueryInfoKeyW(hEnumKey,
1457 NULL,
1458 NULL,
1459 NULL,
1460 NULL,
1461 NULL,
1462 NULL,
1463 NULL,
1464 NULL,
1465 &dwMaxValueLength,
1466 NULL,
1467 NULL);
1468 if (dwError != ERROR_SUCCESS)
1469 {
1470 DPRINT("RegQueryInfoKeyW failed (Error %lu)\n", dwError);
1471 dwMaxValueLength = MAX_DEVICE_ID_LEN;
1472 }
1473
1474 DPRINT("dwValues %lu dwMaxValueLength %lu\n", dwValues, dwMaxValueLength / sizeof(WCHAR));
1475
1476 /* Return the largest possible buffer size */
1477 *pulLength = dwValues * dwMaxValueLength / sizeof(WCHAR) + 2;
1478
1479Done:
1480 if (hEnumKey != NULL)
1482
1483 if (hServiceKey != NULL)
1484 RegCloseKey(hServiceKey);
1485
1486 if (hServicesKey != NULL)
1488
1489 return ret;
1490}

Referenced by PNP_GetDeviceListSize().

◆ IsPresentDeviceInstanceID()

static BOOL IsPresentDeviceInstanceID ( _In_ LPWSTR  pszDeviceInstanceID)
static

Definition at line 418 of file rpcserver.c.

420{
421 DWORD ulStatus, ulProblem;
422
423 return (GetDeviceStatus(pszDeviceInstanceID, &ulStatus, &ulProblem) == CR_SUCCESS);
424}
static CONFIGRET GetDeviceStatus(_In_ LPWSTR pszDeviceID, _Out_ DWORD *pulStatus, _Out_ DWORD *pulProblem)
Definition: rpcserver.c:229

Referenced by PNP_CreateDevInst(), and PNP_GetRelatedDeviceInstance().

◆ IsRootDeviceInstanceID()

static BOOL IsRootDeviceInstanceID ( _In_ PWSTR  pszDeviceInstanceID)
static

Definition at line 406 of file rpcserver.c.

408{
409 if (_wcsicmp(pszDeviceInstanceID, szRootDeviceInstanceID) == 0)
410 return TRUE;
411
412 return FALSE;
413}
static WCHAR szRootDeviceInstanceID[]
Definition: rpcserver.c:39

Referenced by PNP_CreateDevInst(), PNP_DisableDevInst(), PNP_GetRelatedDeviceInstance(), PNP_QueryRemove(), and SetupDeviceInstance().

◆ IsValidDeviceInstanceID()

static BOOL IsValidDeviceInstanceID ( _In_ PWSTR  pszDeviceInstanceID)
static

Definition at line 340 of file rpcserver.c.

342{
343 INT nPartLength[3] = {0, 0, 0};
344 INT nLength = 0, nParts = 0;
345 PWCHAR p;
346
347 DPRINT("IsValidDeviceInstanceID(%S)\n",
348 pszDeviceInstanceID);
349
350 if (pszDeviceInstanceID == NULL)
351 {
352 DPRINT("Device instance ID is NULL!\n");
353 return FALSE;
354 }
355
356 p = pszDeviceInstanceID;
357 while (*p != UNICODE_NULL)
358 {
359 if (*p == L'\\')
360 {
361 nParts++;
362 if (nParts >= 3)
363 {
364 DPRINT("Too many separators: %d\n", nParts);
365 return FALSE;
366 }
367 }
368 else
369 {
370 nPartLength[nParts]++;
371 }
372
373 nLength++;
375 {
376 DPRINT("Too long: %d\n", nLength);
377 return FALSE;
378 }
379
380 p++;
381 }
382
383 if (nParts != 2)
384 {
385 DPRINT("Invalid number of separtors: %d\n", nParts);
386 return FALSE;
387 }
388
389 if ((nPartLength[0] == 0) ||
390 (nPartLength[1] == 0) ||
391 (nPartLength[2] == 0))
392 {
393 DPRINT("Invalid part lengths: %d %d %d\n",
394 nPartLength[0], nPartLength[1], nPartLength[2]);
395 return FALSE;
396 }
397
398 DPRINT("Valid device instance ID!\n");
399
400 return TRUE;
401}
GLfloat GLfloat p
Definition: glext.h:8902
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
_In_ DWORD nLength
Definition: wincon.h:473

Referenced by PNP_CreateKey(), PNP_DisableDevInst(), PNP_GetClassInstance(), PNP_GetCustomDevProp(), PNP_GetDepth(), PNP_GetDeviceRegProp(), PNP_GetDeviceStatus(), PNP_GetFirstLogConf(), PNP_GetInterfaceDeviceList(), PNP_GetInterfaceDeviceListSize(), PNP_GetNextLogConf(), PNP_GetNextResDes(), PNP_GetRelatedDeviceInstance(), PNP_HwProfFlags(), PNP_QueryRemove(), PNP_RegisterDriver(), PNP_RequestDeviceEject(), PNP_SetDeviceProblem(), PNP_SetDeviceRegProp(), and PNP_ValidateDeviceInstance().

◆ midl_user_allocate()

void __RPC_FAR *__RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 111 of file rpcserver.c.

112{
114}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLenum GLsizei len
Definition: glext.h:6722

◆ midl_user_free()

void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 117 of file rpcserver.c.

118{
120}
#define HeapFree(x, y, z)
Definition: compat.h:735
static PVOID ptr
Definition: dispmode.c:27

◆ NtStatusToCrError()

static CONFIGRET WINAPI NtStatusToCrError ( NTSTATUS  Status)
static

Definition at line 124 of file rpcserver.c.

125{
126 switch (Status)
127 {
130
132 return CR_INVALID_DATA;
133
135 return CR_NO_SUCH_DEVINST;
136
138 return CR_ACCESS_DENIED;
139
141 return CR_BUFFER_SMALL;
142
144 return CR_NO_SUCH_VALUE;
145
146 default:
147 return CR_FAILURE;
148 }
149}
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
#define CR_NO_SUCH_DEVINST
Definition: cfgmgr32.h:858
#define CR_ACCESS_DENIED
Definition: cfgmgr32.h:897
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149

Referenced by ClearDeviceStatus(), DisableDeviceInstance(), EnableDeviceInstance(), GetDeviceStatus(), GetRelationsInstanceList(), GetRelationsInstanceListSize(), PNP_GetDepth(), PNP_GetDeviceRegProp(), PNP_GetInterfaceDeviceList(), PNP_GetInterfaceDeviceListSize(), PNP_GetRelatedDeviceInstance(), PNP_QueryRemove(), PNP_RequestDeviceEject(), PNP_RequestEjectPC(), ReenumerateDeviceInstance(), SetDeviceStatus(), and SetupDeviceInstance().

◆ OpenConfigurationKey()

static CONFIGRET OpenConfigurationKey ( _In_ LPCWSTR  pszDeviceID,
_Out_ PHKEY  phKey 
)
static

Definition at line 429 of file rpcserver.c.

432{
433 WCHAR szKeyName[MAX_PATH];
434 HKEY hInstanceKey;
435 DWORD dwError;
436
437 /* Build the full device instance key name */
438 wcscpy(szKeyName, L"System\\CurrentControlSet\\Enum\\");
439 wcscat(szKeyName, pszDeviceID);
440
441 /* Open the device instance key */
443 szKeyName,
444 0,
446 &hInstanceKey);
447 if (dwError != ERROR_SUCCESS)
448 return CR_INVALID_DEVINST;
449
450 /* Create or open the LogConf key */
451 dwError = RegCreateKeyExW(hInstanceKey,
452 L"LogConf",
453 0,
454 NULL,
457 NULL,
458 phKey,
459 NULL);
460
461 /* Close the device instance key */
462 RegCloseKey(hInstanceKey);
463
464 if (dwError != ERROR_SUCCESS)
465 return CR_REGISTRY_ERROR;
466
467 return CR_SUCCESS;
468}
#define CR_INVALID_DEVINST
Definition: cfgmgr32.h:848
#define MAX_PATH
Definition: compat.h:34
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

Referenced by PNP_GetFirstLogConf(), PNP_GetNextLogConf(), and PNP_GetNextResDes().

◆ PNP_AddEmptyLogConf()

DWORD WINAPI PNP_AddEmptyLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulPriority,
DWORD pulLogConfTag,
DWORD  ulFlags 
)

Definition at line 4087 of file rpcserver.c.

4093{
4096}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by CM_Add_Empty_Log_Conf_Ex().

◆ PNP_AddID()

DWORD WINAPI PNP_AddID ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszID,
DWORD  ulFlags 
)

Definition at line 3553 of file rpcserver.c.

3558{
3560 HKEY hDeviceKey;
3561 LPWSTR pszSubKey;
3562 DWORD dwDeviceIdListSize;
3563 DWORD dwNewDeviceIdSize;
3564 WCHAR * pszDeviceIdList = NULL;
3565
3567
3568 DPRINT("PNP_AddID(%p %S %S 0x%08lx)\n",
3569 hBinding, pszDeviceID, pszID, ulFlags);
3570
3572 pszDeviceID,
3573 0,
3575 &hDeviceKey) != ERROR_SUCCESS)
3576 {
3577 DPRINT("Failed to open the device key!\n");
3578 return CR_INVALID_DEVNODE;
3579 }
3580
3581 pszSubKey = (ulFlags & CM_ADD_ID_COMPATIBLE) ? L"CompatibleIDs" : L"HardwareID";
3582
3583 if (RegQueryValueExW(hDeviceKey,
3584 pszSubKey,
3585 NULL,
3586 NULL,
3587 NULL,
3588 &dwDeviceIdListSize) != ERROR_SUCCESS)
3589 {
3590 DPRINT("Failed to query the desired ID string!\n");
3592 goto Done;
3593 }
3594
3595 dwNewDeviceIdSize = lstrlenW(pszDeviceID);
3596 if (!dwNewDeviceIdSize)
3597 {
3599 goto Done;
3600 }
3601
3602 dwDeviceIdListSize += (dwNewDeviceIdSize + 2) * sizeof(WCHAR);
3603
3604 pszDeviceIdList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDeviceIdListSize);
3605 if (!pszDeviceIdList)
3606 {
3607 DPRINT("Failed to allocate memory for the desired ID string!\n");
3609 goto Done;
3610 }
3611
3612 if (RegQueryValueExW(hDeviceKey,
3613 pszSubKey,
3614 NULL,
3615 NULL,
3616 (LPBYTE)pszDeviceIdList,
3617 &dwDeviceIdListSize) != ERROR_SUCCESS)
3618 {
3619 DPRINT("Failed to query the desired ID string!\n");
3621 goto Done;
3622 }
3623
3624 /* Check whether the device ID is already in use */
3625 if (CheckForDeviceId(pszDeviceIdList, pszDeviceID))
3626 {
3627 DPRINT("Device ID was found in the ID string!\n");
3628 ret = CR_SUCCESS;
3629 goto Done;
3630 }
3631
3632 /* Append the Device ID */
3633 AppendDeviceId(pszDeviceIdList, &dwDeviceIdListSize, pszID);
3634
3635 if (RegSetValueExW(hDeviceKey,
3636 pszSubKey,
3637 0,
3639 (LPBYTE)pszDeviceIdList,
3640 dwDeviceIdListSize) != ERROR_SUCCESS)
3641 {
3642 DPRINT("Failed to set the desired ID string!\n");
3644 }
3645
3646Done:
3647 RegCloseKey(hDeviceKey);
3648 if (pszDeviceIdList)
3649 HeapFree(GetProcessHeap(), 0, pszDeviceIdList);
3650
3651 DPRINT("PNP_AddID() done (returns %lx)\n", ret);
3652
3653 return ret;
3654}
static VOID AppendDeviceId(LPWSTR lpDeviceIdList, LPDWORD lpDeviceIdListSize, LPWSTR lpDeviceId)
Definition: rpcserver.c:3530
static BOOL CheckForDeviceId(LPWSTR lpDeviceIdList, LPWSTR lpDeviceId)
Definition: rpcserver.c:3509
#define CM_ADD_ID_COMPATIBLE
Definition: cfgmgr32.h:615
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
handle_t hBinding
Definition: ctx_c.c:54
#define lstrlenW
Definition: compat.h:750
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

Referenced by CM_Add_ID_ExW().

◆ PNP_AddResDes()

DWORD WINAPI PNP_AddResDes ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD pulResourceTag,
BYTE ResourceData,
PNP_RPC_BUFFER_SIZE  ResourceLen,
DWORD  ulFlags 
)

Definition at line 4322 of file rpcserver.c.

4332{
4335}

◆ PNP_ApplyPowerSettings()

DWORD WINAPI PNP_ApplyPowerSettings ( handle_t  hBinding)

Definition at line 4944 of file rpcserver.c.

4946{
4949}

◆ PNP_Connect()

DWORD WINAPI PNP_Connect ( handle_t  hBinding)

Definition at line 577 of file rpcserver.c.

579{
581 return CR_SUCCESS;
582}

◆ PNP_CreateDevInst()

DWORD WINAPI PNP_CreateDevInst ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszParentDeviceID,
PNP_RPC_STRING_LEN  ulLength,
DWORD  ulFlags 
)

Definition at line 3052 of file rpcserver.c.

3058{
3060 HKEY hKey = NULL;
3061 DWORD dwSize, dwPhantom;
3064
3065 DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
3066 hBinding, pszParentDeviceID, pszDeviceID, ulLength, ulFlags);
3067
3068 if (ulFlags & ~CM_CREATE_DEVNODE_BITS)
3069 return CR_INVALID_FLAG;
3070
3071 if (pszDeviceID == NULL || pszParentDeviceID == NULL)
3072 return CR_INVALID_POINTER;
3073
3074 /* Fail, if the parent device is not the root device */
3075 if (!IsRootDeviceInstanceID(pszParentDeviceID))
3076 return CR_INVALID_DEVINST;
3077
3078 if (ulFlags & CM_CREATE_DEVNODE_GENERATE_ID)
3079 {
3080 ret = GenerateDeviceID(pszDeviceID,
3081 ulLength);
3082 if (ret != CR_SUCCESS)
3083 return ret;
3084 }
3085
3086 /* Try to open the device instance key */
3087 RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, &hKey);
3088
3089 if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
3090 {
3091 /* Fail, if the device already exists */
3092 if (hKey != NULL)
3093 {
3095 goto done;
3096 }
3097
3098 /* Create the phantom device instance */
3099 ret = CreateDeviceInstance(pszDeviceID, TRUE);
3100 }
3101 else
3102 {
3103 /* Fail, if the device exists and is present */
3104 if ((hKey != NULL) && (IsPresentDeviceInstanceID(pszDeviceID)))
3105 {
3107 goto done;
3108 }
3109
3110 /* If it does not already exist ... */
3111 if (hKey == NULL)
3112 {
3113 /* Create the device instance */
3114 ret = CreateDeviceInstance(pszDeviceID, FALSE);
3115
3116 /* Open the device instance key */
3117 RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, &hKey);
3118 }
3119
3120 /* Create a device node for the device */
3121 RtlInitUnicodeString(&ControlData.DeviceInstance, pszDeviceID);
3123 &ControlData,
3124 sizeof(ControlData));
3125 if (!NT_SUCCESS(Status))
3126 {
3127 ret = CR_FAILURE;
3128 goto done;
3129 }
3130
3131 /* If the device is a phantom device, turn it into a normal device */
3132 if (hKey != NULL)
3133 {
3134 dwPhantom = 0;
3135 dwSize = sizeof(DWORD);
3136 RegQueryValueEx(hKey, L"Phantom", NULL, NULL, (PBYTE)&dwPhantom, &dwSize);
3137
3138 if (dwPhantom != 0)
3139 RegDeleteValue(hKey, L"Phantom");
3140 }
3141 }
3142
3143done:
3144 if (hKey)
3146
3147 DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
3148
3149 return ret;
3150}
static CONFIGRET GenerateDeviceID(_Inout_ LPWSTR pszDeviceID, _In_ PNP_RPC_STRING_LEN ulLength)
Definition: rpcserver.c:3002
static BOOL IsPresentDeviceInstanceID(_In_ LPWSTR pszDeviceInstanceID)
Definition: rpcserver.c:418
static BOOL IsRootDeviceInstanceID(_In_ PWSTR pszDeviceInstanceID)
Definition: rpcserver.c:406
static CONFIGRET CreateDeviceInstance(_In_ LPWSTR pszDeviceID, _In_ BOOL bPhantomDevice)
Definition: rpcserver.c:2882
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define CM_CREATE_DEVNODE_BITS
Definition: cfgmgr32.h:624
#define CM_CREATE_DEVNODE_GENERATE_ID
Definition: cfgmgr32.h:622
#define CM_CREATE_DEVNODE_PHANTOM
Definition: cfgmgr32.h:621
@ PlugPlayControlInitializeDevice
Definition: cmtypes.h:212
#define KEY_WRITE
Definition: nt_native.h:1031
#define RegQueryValueEx
Definition: winreg.h:524
#define RegDeleteValue
Definition: winreg.h:508

Referenced by CM_Create_DevNode_ExW().

◆ PNP_CreateKey()

DWORD WINAPI PNP_CreateKey ( handle_t  hBinding,
LPWSTR  pszSubKey,
DWORD  samDesired,
DWORD  ulFlags 
)

Definition at line 2296 of file rpcserver.c.

2301{
2302 HKEY hDeviceKey = NULL, hParametersKey = NULL;
2303 DWORD dwError;
2305
2307 UNREFERENCED_PARAMETER(samDesired);
2308
2309 DPRINT("PNP_CreateKey(%p %S 0x%lx 0x%08lx)\n",
2310 hBinding, pszSubKey, samDesired, ulFlags);
2311
2312 if (ulFlags != 0)
2313 return CR_INVALID_FLAG;
2314
2315 if (!IsValidDeviceInstanceID(pszSubKey))
2316 return CR_INVALID_DEVINST;
2317
2318 dwError = RegOpenKeyExW(hEnumKey,
2319 pszSubKey,
2320 0,
2321 KEY_WRITE,
2322 &hDeviceKey);
2323 if (dwError != ERROR_SUCCESS)
2324 {
2326 goto done;
2327 }
2328
2329 dwError = RegCreateKeyExW(hDeviceKey,
2330 L"Device Parameters",
2331 0,
2332 NULL,
2335 NULL,
2336 &hParametersKey,
2337 NULL);
2338 if (dwError != ERROR_SUCCESS)
2339 {
2341 goto done;
2342 }
2343
2344 /* FIXME: Set key security */
2345
2346done:
2347 if (hParametersKey != NULL)
2348 RegCloseKey(hParametersKey);
2349
2350 if (hDeviceKey != NULL)
2351 RegCloseKey(hDeviceKey);
2352
2353 return ret;
2354}
static BOOL IsValidDeviceInstanceID(_In_ PWSTR pszDeviceInstanceID)
Definition: rpcserver.c:340

◆ PNP_DeleteClassKey()

DWORD WINAPI PNP_DeleteClassKey ( handle_t  hBinding,
LPWSTR  pszClassGuid,
DWORD  ulFlags 
)

Definition at line 2478 of file rpcserver.c.

2482{
2484
2486
2487 DPRINT("PNP_DeleteClassKey(%p %S 0x%08lx)\n",
2488 hBinding, pszClassGuid, ulFlags);
2489
2490 if (ulFlags & CM_DELETE_CLASS_SUBKEYS)
2491 {
2492 if (SHDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
2494 }
2495 else
2496 {
2497 if (RegDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
2499 }
2500
2501 DPRINT("PNP_DeleteClassKey() done (returns %lx)\n", ret);
2502
2503 return ret;
2504}
HKEY hClassKey
Definition: umpnpmgr.c:45
#define CM_DELETE_CLASS_SUBKEYS
Definition: cfgmgr32.h:635
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546

Referenced by CM_Delete_Class_Key_Ex().

◆ PNP_DeleteRegistryKey()

DWORD WINAPI PNP_DeleteRegistryKey ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszParentKey,
LPWSTR  pszChildKey,
DWORD  ulFlags 
)

Definition at line 2360 of file rpcserver.c.

2366{
2369}

Referenced by CM_Delete_DevNode_Key_Ex().

◆ PNP_DeleteServiceDevices()

DWORD WINAPI PNP_DeleteServiceDevices ( handle_t  hBinding)

Definition at line 5001 of file rpcserver.c.

5003{
5006}

◆ PNP_DetectResourceConflict()

DWORD WINAPI PNP_DetectResourceConflict ( handle_t  hBinding,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
BYTE ResourceData,
PNP_RPC_BUFFER_SIZE  ResourceLen,
BOOL pbConflictDetected,
DWORD  ulFlags 
)

Definition at line 4511 of file rpcserver.c.

4519{
4520 DPRINT("PNP_DetectResourceConflict()\n");
4521
4522 if (pbConflictDetected != NULL)
4523 *pbConflictDetected = FALSE;
4524
4526}

◆ PNP_DeviceInstanceAction()

DWORD WINAPI PNP_DeviceInstanceAction ( handle_t  hBinding,
DWORD  ulMajorAction,
DWORD  ulMinorAction,
LPWSTR  pszDeviceInstance1,
LPWSTR  pszDeviceInstance2 
)

Definition at line 3292 of file rpcserver.c.

3298{
3300
3302
3303 DPRINT("PNP_DeviceInstanceAction(%p %lu 0x%08lx %S %S)\n",
3304 hBinding, ulMajorAction, ulMinorAction,
3305 pszDeviceInstance1, pszDeviceInstance2);
3306
3307 switch (ulMajorAction)
3308 {
3309 case PNP_DEVINST_SETUP:
3310 ret = SetupDeviceInstance(pszDeviceInstance1,
3311 ulMinorAction);
3312 break;
3313
3314 case PNP_DEVINST_ENABLE:
3315 ret = EnableDeviceInstance(pszDeviceInstance1);
3316 break;
3317
3318 case PNP_DEVINST_REENUMERATE:
3319 ret = ReenumerateDeviceInstance(pszDeviceInstance1,
3320 ulMinorAction);
3321 break;
3322
3323 default:
3324 DPRINT1("Unknown device action %lu: not implemented\n", ulMajorAction);
3326 }
3327
3328 DPRINT("PNP_DeviceInstanceAction() done (returns %lx)\n", ret);
3329
3330 return ret;
3331}
static CONFIGRET SetupDeviceInstance(_In_ LPWSTR pszDeviceInstance, _In_ DWORD ulMinorAction)
Definition: rpcserver.c:3154
static CONFIGRET ReenumerateDeviceInstance(_In_ LPWSTR pszDeviceInstance, _In_ ULONG ulMinorAction)
Definition: rpcserver.c:3256
static CONFIGRET EnableDeviceInstance(_In_ LPWSTR pszDeviceInstance)
Definition: rpcserver.c:3237

Referenced by CM_Enable_DevNode_Ex(), CM_Move_DevNode_Ex(), CM_Reenumerate_DevNode_Ex(), and CM_Setup_DevNode_Ex().

◆ PNP_DisableDevInst()

DWORD WINAPI PNP_DisableDevInst ( handle_t  hBinding,
LPWSTR  pDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 3468 of file rpcserver.c.

3475{
3477
3478 DPRINT1("PNP_DisableDevInst(%p %S %p %p %lu 0x%08lx)\n",
3479 hBinding, pDeviceID, pVetoType, pszVetoName, ulNameLength, ulFlags);
3480
3481 if (ulFlags & ~CM_DISABLE_BITS)
3482 return CR_INVALID_FLAG;
3483
3484 if (!IsValidDeviceInstanceID(pDeviceID) ||
3485 IsRootDeviceInstanceID(pDeviceID))
3486 return CR_INVALID_DEVINST;
3487
3488 return DisableDeviceInstance(pDeviceID,
3489 pVetoType,
3490 pszVetoName,
3491 ulNameLength);
3492}
static CONFIGRET DisableDeviceInstance(_In_ LPWSTR pszDeviceInstance, _Inout_opt_ PPNP_VETO_TYPE pVetoType, _Inout_opt_ LPWSTR pszVetoName, _In_ DWORD ulNameLength)
Definition: rpcserver.c:294
#define CM_DISABLE_BITS
Definition: cfgmgr32.h:652

Referenced by CM_Disable_DevNode_Ex().

◆ PNP_Disconnect()

DWORD WINAPI PNP_Disconnect ( handle_t  hBinding)

Definition at line 566 of file rpcserver.c.

568{
570 return CR_SUCCESS;
571}

◆ PNP_DriverStoreAddDriverPackage()

DWORD WINAPI PNP_DriverStoreAddDriverPackage ( handle_t  hBinding)

Definition at line 4955 of file rpcserver.c.

4957{
4960}

◆ PNP_DriverStoreDeleteDriverPackage()

DWORD WINAPI PNP_DriverStoreDeleteDriverPackage ( handle_t  hBinding)

Definition at line 4966 of file rpcserver.c.

4968{
4971}

◆ PNP_EnumerateSubKeys()

DWORD WINAPI PNP_EnumerateSubKeys ( handle_t  hBinding,
DWORD  ulBranch,
DWORD  ulIndex,
LPWSTR  Buffer,
PNP_RPC_STRING_LEN  ulLength,
PNP_RPC_STRING_LEN pulRequiredLen,
DWORD  ulFlags 
)

Definition at line 851 of file rpcserver.c.

859{
861 HKEY hKey;
862 DWORD dwError;
863
865 UNREFERENCED_PARAMETER(ulFlags);
866
867 DPRINT("PNP_EnumerateSubKeys(%p %lu %lu %p %lu %p 0x%08lx)\n",
868 hBinding, ulBranch, ulIndex, Buffer, ulLength,
869 pulRequiredLen, ulFlags);
870
871 switch (ulBranch)
872 {
873 case PNP_ENUMERATOR_SUBKEYS:
874 hKey = hEnumKey;
875 break;
876
877 case PNP_CLASS_SUBKEYS:
878 hKey = hClassKey;
879 break;
880
881 default:
882 return CR_FAILURE;
883 }
884
885 *pulRequiredLen = ulLength;
886 dwError = RegEnumKeyExW(hKey,
887 ulIndex,
888 Buffer,
889 pulRequiredLen,
890 NULL,
891 NULL,
892 NULL,
893 NULL);
894 if (dwError != ERROR_SUCCESS)
895 {
897 }
898 else
899 {
900 (*pulRequiredLen)++;
901 }
902
903 DPRINT("PNP_EnumerateSubKeys() done (returns %lx)\n", ret);
904
905 return ret;
906}
Definition: bufpool.h:45
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105

Referenced by CM_Enumerate_Classes_Ex(), and CM_Enumerate_Enumerators_ExW().

◆ PNP_FreeLogConf()

DWORD WINAPI PNP_FreeLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD  ulLogConfTag,
DWORD  ulFlags 
)

Definition at line 4102 of file rpcserver.c.

4108{
4111}

Referenced by CM_Free_Log_Conf_Ex().

◆ PNP_FreeResDes()

DWORD WINAPI PNP_FreeResDes ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD  ulResourceTag,
DWORD pulPreviousResType,
DWORD pulPreviousResTag,
DWORD  ulFlags 
)

Definition at line 4341 of file rpcserver.c.

4351{
4354}

◆ PNP_GetBlockedDriverInfo()

DWORD WINAPI PNP_GetBlockedDriverInfo ( handle_t  hBinding,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE pulTransferLen,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 4835 of file rpcserver.c.

4841{
4844}

Referenced by CMP_GetBlockedDriverInfo().

◆ PNP_GetClassCount()

DWORD WINAPI PNP_GetClassCount ( handle_t  hBinding,
DWORD pulClassCount,
DWORD  ulFlags 
)

Definition at line 2375 of file rpcserver.c.

2379{
2380 HKEY hKey;
2381 DWORD dwError;
2382
2384 UNREFERENCED_PARAMETER(ulFlags);
2385
2386 DPRINT("PNP_GetClassCount(%p %p 0x%08lx)\n",
2387 hBinding, pulClassCount, ulFlags);
2388
2391 0,
2393 &hKey);
2394 if (dwError != ERROR_SUCCESS)
2395 return CR_INVALID_DATA;
2396
2397 dwError = RegQueryInfoKeyW(hKey,
2398 NULL,
2399 NULL,
2400 NULL,
2401 pulClassCount,
2402 NULL,
2403 NULL,
2404 NULL,
2405 NULL,
2406 NULL,
2407 NULL,
2408 NULL);
2410 if (dwError != ERROR_SUCCESS)
2411 return CR_INVALID_DATA;
2412
2413 return CR_SUCCESS;
2414}
#define REGSTR_PATH_CLASS
Definition: regstr.h:42

◆ PNP_GetClassInstance()

DWORD WINAPI PNP_GetClassInstance ( handle_t  hBinding,
LPWSTR  pDeviceId,
LPWSTR  pszClassInstance,
PNP_RPC_STRING_LEN  ulLength 
)

Definition at line 2180 of file rpcserver.c.

2185{
2186 WCHAR szClassGuid[40];
2187 WCHAR szClassInstance[5];
2188 HKEY hDeviceClassKey = NULL;
2189 HKEY hClassInstanceKey;
2190 ULONG ulTransferLength, ulDataLength;
2191 DWORD dwDataType, dwDisposition, i;
2192 DWORD dwError;
2194
2195 DPRINT("PNP_GetClassInstance(%p %S %p %lu)\n",
2196 hBinding, pDeviceId, pszClassInstance, ulLength);
2197
2198 if (!IsValidDeviceInstanceID(pDeviceId))
2199 return CR_INVALID_DEVINST;
2200
2201 ulTransferLength = ulLength;
2203 pDeviceId,
2205 &dwDataType,
2206 (BYTE *)pszClassInstance,
2207 &ulTransferLength,
2208 &ulLength,
2209 0);
2210 if (ret == CR_SUCCESS)
2211 return ret;
2212
2213 ulTransferLength = sizeof(szClassGuid);
2214 ulDataLength = sizeof(szClassGuid);
2216 pDeviceId,
2218 &dwDataType,
2219 (BYTE *)szClassGuid,
2220 &ulTransferLength,
2221 &ulDataLength,
2222 0);
2223 if (ret != CR_SUCCESS)
2224 {
2225 DPRINT1("PNP_GetDeviceRegProp() failed (Error %lu)\n", ret);
2226 goto done;
2227 }
2228
2229 dwError = RegOpenKeyExW(hClassKey,
2230 szClassGuid,
2231 0,
2232 KEY_READ,
2233 &hDeviceClassKey);
2234 if (dwError != ERROR_SUCCESS)
2235 {
2236 DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
2237 ret = CR_FAILURE;
2238 goto done;
2239 }
2240
2241 for (i = 0; i < 10000; i++)
2242 {
2243 wsprintf(szClassInstance, L"%04lu", i);
2244
2245 dwError = RegCreateKeyExW(hDeviceClassKey,
2246 szClassInstance,
2247 0,
2248 NULL,
2251 NULL,
2252 &hClassInstanceKey,
2253 &dwDisposition);
2254 if (dwError == ERROR_SUCCESS)
2255 {
2256 RegCloseKey(hClassInstanceKey);
2257
2258 if (dwDisposition == REG_CREATED_NEW_KEY)
2259 {
2260 wsprintf(pszClassInstance,
2261 L"%s\\%s",
2262 szClassGuid,
2263 szClassInstance);
2264
2265 ulDataLength = (wcslen(pszClassInstance) + 1) * sizeof(WCHAR);
2267 pDeviceId,
2269 REG_SZ,
2270 (BYTE *)pszClassInstance,
2271 ulDataLength,
2272 0);
2273 if (ret != CR_SUCCESS)
2274 {
2275 DPRINT1("PNP_SetDeviceRegProp() failed (Error %lu)\n", ret);
2276 RegDeleteKeyW(hDeviceClassKey,
2277 szClassInstance);
2278 }
2279
2280 break;
2281 }
2282 }
2283 }
2284
2285done:
2286 if (hDeviceClassKey != NULL)
2287 RegCloseKey(hDeviceClassKey);
2288
2289 return ret;
2290}
DWORD WINAPI PNP_GetDeviceRegProp(handle_t hBinding, LPWSTR pDeviceID, DWORD ulProperty, DWORD *pulRegDataType, BYTE *Buffer, PNP_PROP_SIZE *pulTransferLen, PNP_PROP_SIZE *pulLength, DWORD ulFlags)
Definition: rpcserver.c:1761
DWORD WINAPI PNP_SetDeviceRegProp(handle_t hBinding, LPWSTR pDeviceId, DWORD ulProperty, DWORD ulDataType, BYTE *Buffer, PNP_PROP_SIZE ulLength, DWORD ulFlags)
Definition: rpcserver.c:2038
#define CM_DRP_DRIVER
Definition: cfgmgr32.h:685
#define CM_DRP_CLASSGUID
Definition: cfgmgr32.h:684
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REG_SZ
Definition: layer.c:22
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
uint32_t ULONG
Definition: typedefs.h:59
unsigned char BYTE
Definition: xxhash.c:193

Referenced by GetDeviceInstanceKeyPath().

◆ PNP_GetClassName()

DWORD WINAPI PNP_GetClassName ( handle_t  hBinding,
LPWSTR  pszClassGuid,
LPWSTR  Buffer,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 2420 of file rpcserver.c.

2426{
2427 WCHAR szKeyName[MAX_PATH];
2429 HKEY hKey;
2430 DWORD dwSize;
2431
2433 UNREFERENCED_PARAMETER(ulFlags);
2434
2435 DPRINT("PNP_GetClassName(%p %S %p %p 0x%08lx)\n",
2436 hBinding, pszClassGuid, Buffer, pulLength, ulFlags);
2437
2438 lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class\\");
2439 if (lstrlenW(pszClassGuid) + 1 < sizeof(szKeyName)/sizeof(WCHAR)-(lstrlenW(szKeyName) * sizeof(WCHAR)))
2440 lstrcatW(szKeyName, pszClassGuid);
2441 else
2442 return CR_INVALID_DATA;
2443
2445 szKeyName,
2446 0,
2448 &hKey))
2449 return CR_REGISTRY_ERROR;
2450
2451 dwSize = *pulLength * sizeof(WCHAR);
2453 L"Class",
2454 NULL,
2455 NULL,
2456 (LPBYTE)Buffer,
2457 &dwSize))
2458 {
2459 *pulLength = 0;
2461 }
2462 else
2463 {
2464 *pulLength = dwSize / sizeof(WCHAR);
2465 }
2466
2468
2469 DPRINT("PNP_GetClassName() done (returns %lx)\n", ret);
2470
2471 return ret;
2472}
#define lstrcpyW
Definition: compat.h:749
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by CM_Get_Class_Name_ExW().

◆ PNP_GetClassRegProp()

DWORD WINAPI PNP_GetClassRegProp ( handle_t  hBinding,
LPWSTR  pszClassGuid,
DWORD  ulProperty,
DWORD pulRegDataType,
BYTE Buffer,
PNP_RPC_STRING_LEN pulTransferLen,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 2653 of file rpcserver.c.

2662{
2664 LPWSTR lpValueName = NULL;
2665 HKEY hInstKey = NULL;
2666 HKEY hPropKey = NULL;
2667 LONG lError;
2668
2670
2671 DPRINT("PNP_GetClassRegProp(%p %S %lu %p %p %p %p 0x%08lx)\n",
2672 hBinding, pszClassGuid, ulProperty, pulRegDataType,
2673 Buffer, pulTransferLen, pulLength, ulFlags);
2674
2675 if (pulTransferLen == NULL || pulLength == NULL)
2676 {
2678 goto done;
2679 }
2680
2681 if (ulFlags != 0)
2682 {
2684 goto done;
2685 }
2686
2687 if (*pulLength < *pulTransferLen)
2688 *pulLength = *pulTransferLen;
2689
2690 *pulTransferLen = 0;
2691
2692 switch (ulProperty)
2693 {
2694 case CM_CRP_SECURITY:
2695 lpValueName = L"Security";
2696 break;
2697
2698 case CM_CRP_DEVTYPE:
2699 lpValueName = L"DeviceType";
2700 break;
2701
2702 case CM_CRP_EXCLUSIVE:
2703 lpValueName = L"Exclusive";
2704 break;
2705
2707 lpValueName = L"DeviceCharacteristics";
2708 break;
2709
2710 default:
2712 goto done;
2713 }
2714
2715 DPRINT("Value name: %S\n", lpValueName);
2716
2717 lError = RegOpenKeyExW(hClassKey,
2718 pszClassGuid,
2719 0,
2720 KEY_READ,
2721 &hInstKey);
2722 if (lError != ERROR_SUCCESS)
2723 {
2724 *pulLength = 0;
2726 goto done;
2727 }
2728
2729 lError = RegOpenKeyExW(hInstKey,
2730 L"Properties",
2731 0,
2732 KEY_READ,
2733 &hPropKey);
2734 if (lError != ERROR_SUCCESS)
2735 {
2736 *pulLength = 0;
2738 goto done;
2739 }
2740
2741 lError = RegQueryValueExW(hPropKey,
2742 lpValueName,
2743 NULL,
2744 pulRegDataType,
2745 Buffer,
2746 pulLength);
2747 if (lError != ERROR_SUCCESS)
2748 {
2749 if (lError == ERROR_MORE_DATA)
2750 {
2752 }
2753 else
2754 {
2755 *pulLength = 0;
2757 }
2758 }
2759
2760done:
2761 if (ret == CR_SUCCESS)
2762 *pulTransferLen = *pulLength;
2763
2764 if (hPropKey != NULL)
2765 RegCloseKey(hPropKey);
2766
2767 if (hInstKey != NULL)
2768 RegCloseKey(hInstKey);
2769
2770 DPRINT("PNP_GetClassRegProp() done (returns %lx)\n", ret);
2771
2772 return ret;
2773}
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
#define CM_CRP_DEVTYPE
Definition: cfgmgr32.h:710
#define CM_CRP_SECURITY
Definition: cfgmgr32.h:706
#define CM_CRP_EXCLUSIVE
Definition: cfgmgr32.h:712
#define CM_CRP_CHARACTERISTICS
Definition: cfgmgr32.h:714
#define CR_NO_SUCH_REGISTRY_KEY
Definition: cfgmgr32.h:892
#define ERROR_MORE_DATA
Definition: dderror.h:13

Referenced by CM_Get_Class_Registry_PropertyW().

◆ PNP_GetCustomDevProp()

DWORD WINAPI PNP_GetCustomDevProp ( handle_t  hBinding,
LPWSTR  pDeviceID,
LPWSTR  CustomPropName,
DWORD pulRegDataType,
BYTE Buffer,
PNP_RPC_STRING_LEN pulTransferLen,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 4722 of file rpcserver.c.

4731{
4732 HKEY hDeviceKey = NULL;
4733 HKEY hParamKey = NULL;
4734 LONG lError;
4736
4738
4739 DPRINT("PNP_GetCustomDevProp() called\n");
4740
4741 if (pulTransferLen == NULL || pulLength == NULL)
4742 {
4744 goto done;
4745 }
4746
4747 if (ulFlags & ~CM_CUSTOMDEVPROP_BITS)
4748 {
4750 goto done;
4751 }
4752
4753 if (!IsValidDeviceInstanceID(pDeviceID))
4754 return CR_INVALID_DEVINST;
4755
4756 if (*pulLength < *pulTransferLen)
4757 *pulLength = *pulTransferLen;
4758
4759 *pulTransferLen = 0;
4760
4761 lError = RegOpenKeyExW(hEnumKey,
4762 pDeviceID,
4763 0,
4764 KEY_READ,
4765 &hDeviceKey);
4766 if (lError != ERROR_SUCCESS)
4767 {
4769 goto done;
4770 }
4771
4772 lError = RegOpenKeyExW(hDeviceKey,
4773 L"Device Parameters",
4774 0,
4775 KEY_READ,
4776 &hParamKey);
4777 if (lError != ERROR_SUCCESS)
4778 {
4780 goto done;
4781 }
4782
4783 lError = RegQueryValueExW(hParamKey,
4784 CustomPropName,
4785 NULL,
4786 pulRegDataType,
4787 Buffer,
4788 pulLength);
4789 if (lError != ERROR_SUCCESS)
4790 {
4791 if (lError == ERROR_MORE_DATA)
4792 {
4794 }
4795 else
4796 {
4797 *pulLength = 0;
4799 }
4800 }
4801
4802done:
4803 if (ret == CR_SUCCESS)
4804 *pulTransferLen = *pulLength;
4805
4806 if (hParamKey != NULL)
4807 RegCloseKey(hParamKey);
4808
4809 if (hDeviceKey != NULL)
4810 RegCloseKey(hDeviceKey);
4811
4812 DPRINT("PNP_GetCustomDevProp() done (returns %lx)\n", ret);
4813
4814 return ret;
4815}
#define CM_CUSTOMDEVPROP_BITS
Definition: cfgmgr32.h:836

Referenced by CM_Get_DevNode_Custom_Property_ExW().

◆ PNP_GetDepth()

DWORD WINAPI PNP_GetDepth ( handle_t  hBinding,
LPWSTR  pszDeviceID,
DWORD pulDepth,
DWORD  ulFlags 
)

Definition at line 1718 of file rpcserver.c.

1723{
1724 PLUGPLAY_CONTROL_DEPTH_DATA PlugPlayData;
1727
1729 UNREFERENCED_PARAMETER(ulFlags);
1730
1731 DPRINT("PNP_GetDepth(%p %S %p 0x%08lx)\n",
1732 hBinding, pszDeviceID, pulDepth, ulFlags);
1733
1734 if (!IsValidDeviceInstanceID(pszDeviceID))
1735 return CR_INVALID_DEVINST;
1736
1738 pszDeviceID);
1739
1741 (PVOID)&PlugPlayData,
1743 if (NT_SUCCESS(Status))
1744 {
1745 *pulDepth = PlugPlayData.Depth;
1746 }
1747 else
1748 {
1750 }
1751
1752 DPRINT("PNP_GetDepth() done (returns %lx)\n", ret);
1753
1754 return ret;
1755}
@ PlugPlayControlGetDeviceDepth
Definition: cmtypes.h:224
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:534

Referenced by CM_Get_Depth_Ex().

◆ PNP_GetDeviceList()

DWORD WINAPI PNP_GetDeviceList ( handle_t  hBinding,
LPWSTR  pszFilter,
LPWSTR  Buffer,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 1272 of file rpcserver.c.

1278{
1279 WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
1280 WCHAR szDevice[MAX_DEVICE_ID_LEN];
1281 WCHAR szInstance[MAX_DEVICE_ID_LEN];
1283
1284 DPRINT("PNP_GetDeviceList(%p %S %p %p 0x%08lx)\n",
1285 hBinding, pszFilter, Buffer, pulLength, ulFlags);
1286
1287 if (ulFlags & ~CM_GETIDLIST_FILTER_BITS)
1288 return CR_INVALID_FLAG;
1289
1290 if (pulLength == NULL)
1291 return CR_INVALID_POINTER;
1292
1293 if ((ulFlags != CM_GETIDLIST_FILTER_NONE) &&
1294 (pszFilter == NULL))
1295 return CR_INVALID_POINTER;
1296
1297 if (ulFlags &
1302 {
1303 ret = GetRelationsInstanceList(pszFilter,
1304 ulFlags,
1305 Buffer,
1306 pulLength);
1307 }
1308 else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
1309 {
1310 ret = GetServiceInstanceList(pszFilter,
1311 Buffer,
1312 pulLength);
1313 }
1314 else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
1315 {
1316 SplitDeviceInstanceID(pszFilter,
1317 szEnumerator,
1318 szDevice,
1319 szInstance);
1320
1321 if (*szEnumerator != UNICODE_NULL && *szDevice != UNICODE_NULL)
1322 {
1323 ret = GetDeviceInstanceList(pszFilter,
1324 Buffer,
1325 pulLength);
1326 }
1327 else
1328 {
1329 ret = GetEnumeratorInstanceList(pszFilter,
1330 Buffer,
1331 pulLength);
1332 }
1333 }
1334 else /* CM_GETIDLIST_FILTER_NONE */
1335 {
1337 pulLength);
1338 }
1339
1340 return ret;
1341}
static CONFIGRET GetRelationsInstanceList(_In_ PWSTR pszDevice, _In_ DWORD ulFlags, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:911
static CONFIGRET GetAllInstanceList(_Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:1223
static CONFIGRET GetServiceInstanceList(_In_ PWSTR pszService, _Inout_ PWSTR pszBuffer, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:962
#define CM_GETIDLIST_FILTER_BITS
Definition: cfgmgr32.h:669
#define CM_GETIDLIST_FILTER_ENUMERATOR
Definition: cfgmgr32.h:655
#define CM_GETIDLIST_FILTER_SERVICE
Definition: cfgmgr32.h:656
#define CM_GETIDLIST_FILTER_NONE
Definition: cfgmgr32.h:654

Referenced by CM_Get_Device_ID_List_ExW(), and DeviceInstallThread().

◆ PNP_GetDeviceListSize()

DWORD WINAPI PNP_GetDeviceListSize ( handle_t  hBinding,
LPWSTR  pszFilter,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 1643 of file rpcserver.c.

1648{
1649 WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
1650 WCHAR szDevice[MAX_DEVICE_ID_LEN];
1651 WCHAR szInstance[MAX_DEVICE_ID_LEN];
1653
1654 DPRINT("PNP_GetDeviceListSize(%p %S %p 0x%08lx)\n",
1655 hBinding, pszFilter, pulLength, ulFlags);
1656
1657 if (ulFlags & ~CM_GETIDLIST_FILTER_BITS)
1658 return CR_INVALID_FLAG;
1659
1660 if (pulLength == NULL)
1661 return CR_INVALID_POINTER;
1662
1663 if ((ulFlags != CM_GETIDLIST_FILTER_NONE) &&
1664 (pszFilter == NULL))
1665 return CR_INVALID_POINTER;
1666
1667 *pulLength = 0;
1668
1669 if (ulFlags &
1674 {
1676 ulFlags,
1677 pulLength);
1678 }
1679 else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
1680 {
1681 ret = GetServiceInstanceListSize(pszFilter,
1682 pulLength);
1683 }
1684 else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
1685 {
1686 SplitDeviceInstanceID(pszFilter,
1687 szEnumerator,
1688 szDevice,
1689 szInstance);
1690
1691 if (*szEnumerator != UNICODE_NULL && *szDevice != UNICODE_NULL)
1692 {
1693 ret = GetDeviceInstanceListSize(pszFilter,
1694 pulLength);
1695 }
1696 else
1697 {
1699 pulLength);
1700 }
1701 }
1702 else /* CM_GETIDLIST_FILTER_NONE */
1703 {
1704 ret = GetAllInstanceListSize(pulLength);
1705 }
1706
1707 /* Add one character for the terminating double UNICODE_NULL */
1708 if (ret == CR_SUCCESS)
1709 (*pulLength) += 1;
1710
1711 return ret;
1712}
static CONFIGRET GetServiceInstanceListSize(_In_ PWSTR pszService, _Out_ PDWORD pulLength)
Definition: rpcserver.c:1396
static CONFIGRET GetAllInstanceListSize(_Out_ PULONG pulLength)
Definition: rpcserver.c:1608
static CONFIGRET GetRelationsInstanceListSize(_In_ PWSTR pszDevice, _In_ DWORD ulFlags, _Inout_ PDWORD pulLength)
Definition: rpcserver.c:1346

Referenced by CM_Get_Device_ID_List_Size_ExW(), and DeviceInstallThread().

◆ PNP_GetDeviceRegProp()

DWORD WINAPI PNP_GetDeviceRegProp ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulProperty,
DWORD pulRegDataType,
BYTE Buffer,
PNP_PROP_SIZE pulTransferLen,
PNP_PROP_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 1761 of file rpcserver.c.

1770{
1771 PLUGPLAY_CONTROL_PROPERTY_DATA PlugPlayData;
1773 LPWSTR lpValueName = NULL;
1774 HKEY hKey = NULL;
1775 LONG lError;
1777
1779
1780 DPRINT("PNP_GetDeviceRegProp(%p %S %lu %p %p %p %p 0x%08lx)\n",
1781 hBinding, pDeviceID, ulProperty, pulRegDataType, Buffer,
1782 pulTransferLen, pulLength, ulFlags);
1783
1784 if (pulTransferLen == NULL || pulLength == NULL)
1785 {
1787 goto done;
1788 }
1789
1790 if (ulFlags != 0)
1791 {
1793 goto done;
1794 }
1795
1796 /* Check pDeviceID */
1797 if (!IsValidDeviceInstanceID(pDeviceID))
1798 {
1800 goto done;
1801 }
1802
1803 if (*pulLength < *pulTransferLen)
1804 *pulLength = *pulTransferLen;
1805
1806 *pulTransferLen = 0;
1807
1808 switch (ulProperty)
1809 {
1810 case CM_DRP_DEVICEDESC:
1811 lpValueName = L"DeviceDesc";
1812 break;
1813
1814 case CM_DRP_HARDWAREID:
1815 lpValueName = L"HardwareID";
1816 break;
1817
1819 lpValueName = L"CompatibleIDs";
1820 break;
1821
1822 case CM_DRP_SERVICE:
1823 lpValueName = L"Service";
1824 break;
1825
1826 case CM_DRP_CLASS:
1827 lpValueName = L"Class";
1828 break;
1829
1830 case CM_DRP_CLASSGUID:
1831 lpValueName = L"ClassGUID";
1832 break;
1833
1834 case CM_DRP_DRIVER:
1835 lpValueName = L"Driver";
1836 break;
1837
1838 case CM_DRP_CONFIGFLAGS:
1839 lpValueName = L"ConfigFlags";
1840 break;
1841
1842 case CM_DRP_MFG:
1843 lpValueName = L"Mfg";
1844 break;
1845
1847 lpValueName = L"FriendlyName";
1848 break;
1849
1851 lpValueName = L"LocationInformation";
1852 break;
1853
1856 *pulRegDataType = REG_SZ;
1857 break;
1858
1860 lpValueName = L"Capabilities";
1861 break;
1862
1863 case CM_DRP_UI_NUMBER:
1864 PlugPlayData.Property = PNP_PROPERTY_UI_NUMBER;
1865 break;
1866
1868 lpValueName = L"UpperFilters";
1869 break;
1870
1872 lpValueName = L"LowerFilters";
1873 break;
1874
1875 case CM_DRP_BUSTYPEGUID:
1876 PlugPlayData.Property = PNP_PROPERTY_BUSTYPEGUID;
1877 *pulRegDataType = REG_BINARY;
1878 break;
1879
1881 PlugPlayData.Property = PNP_PROPERTY_LEGACYBUSTYPE;
1882 *pulRegDataType = REG_DWORD;
1883 break;
1884
1885 case CM_DRP_BUSNUMBER:
1886 PlugPlayData.Property = PNP_PROPERTY_BUSNUMBER;
1887 *pulRegDataType = REG_DWORD;
1888 break;
1889
1892 *pulRegDataType = REG_SZ;
1893 break;
1894
1895 case CM_DRP_SECURITY:
1896 lpValueName = L"Security";
1897 break;
1898
1899 case CM_DRP_DEVTYPE:
1900 lpValueName = L"DeviceType";
1901 break;
1902
1903 case CM_DRP_EXCLUSIVE:
1904 lpValueName = L"Exclusive";
1905 break;
1906
1908 lpValueName = L"DeviceCharacteristics";
1909 break;
1910
1911 case CM_DRP_ADDRESS:
1912 PlugPlayData.Property = PNP_PROPERTY_ADDRESS;
1913 *pulRegDataType = REG_DWORD;
1914 break;
1915
1917 lpValueName = L"UINumberDescFormat";
1918 break;
1919
1921 PlugPlayData.Property = PNP_PROPERTY_POWER_DATA;
1922 *pulRegDataType = REG_BINARY;
1923 break;
1924
1927 *pulRegDataType = REG_DWORD;
1928 break;
1929
1932 *pulRegDataType = REG_DWORD;
1933 break;
1934
1936 lpValueName = L"RemovalPolicy";
1937 *pulRegDataType = REG_DWORD;
1938 break;
1939
1941 PlugPlayData.Property = PNP_PROPERTY_INSTALL_STATE;
1942 *pulRegDataType = REG_DWORD;
1943 break;
1944
1945#if (WINVER >= _WIN32_WINNT_WS03)
1948 *pulRegDataType = REG_MULTI_SZ;
1949 break;
1950#endif
1951
1952#if (WINVER >= _WIN32_WINNT_WIN7)
1954 PlugPlayData.Property = PNP_PROPERTY_CONTAINERID;
1955 *pulRegDataType = REG_SZ;
1956 break;
1957#endif
1958
1959 default:
1961 goto done;
1962 }
1963
1964 DPRINT("Value name: %S\n", lpValueName);
1965
1966 if (lpValueName)
1967 {
1968 /* Retrieve information from the Registry */
1969 lError = RegOpenKeyExW(hEnumKey,
1970 pDeviceID,
1971 0,
1973 &hKey);
1974 if (lError != ERROR_SUCCESS)
1975 {
1976 hKey = NULL;
1977 *pulLength = 0;
1979 goto done;
1980 }
1981
1982 lError = RegQueryValueExW(hKey,
1983 lpValueName,
1984 NULL,
1985 pulRegDataType,
1986 Buffer,
1987 pulLength);
1988 if (lError != ERROR_SUCCESS)
1989 {
1990 if (lError == ERROR_MORE_DATA)
1991 {
1993 }
1994 else
1995 {
1996 *pulLength = 0;
1998 }
1999 }
2000 }
2001 else
2002 {
2003 /* Retrieve information from the Device Node */
2005 pDeviceID);
2006 PlugPlayData.Buffer = Buffer;
2007 PlugPlayData.BufferSize = *pulLength;
2008
2010 (PVOID)&PlugPlayData,
2012 if (NT_SUCCESS(Status))
2013 {
2014 *pulLength = PlugPlayData.BufferSize;
2015 }
2016 else
2017 {
2019 }
2020 }
2021
2022done:
2023 if (pulTransferLen)
2024 *pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0;
2025
2026 if (hKey != NULL)
2028
2029 DPRINT("PNP_GetDeviceRegProp() done (returns %lx)\n", ret);
2030
2031 return ret;
2032}
#define CM_DRP_BUSNUMBER
Definition: cfgmgr32.h:703
#define CM_DRP_LOCATION_INFORMATION
Definition: cfgmgr32.h:689
#define CM_DRP_CONFIGFLAGS
Definition: cfgmgr32.h:686
#define CM_DRP_REMOVAL_POLICY
Definition: cfgmgr32.h:719
#define CM_DRP_ENUMERATOR_NAME
Definition: cfgmgr32.h:704
#define CM_DRP_REMOVAL_POLICY_HW_DEFAULT
Definition: cfgmgr32.h:720
#define CM_DRP_BUSTYPEGUID
Definition: cfgmgr32.h:701
#define CM_DRP_LOWERFILTERS
Definition: cfgmgr32.h:697
#define CM_DRP_SECURITY
Definition: cfgmgr32.h:705
#define CM_DRP_MFG
Definition: cfgmgr32.h:687
#define CM_DRP_EXCLUSIVE
Definition: cfgmgr32.h:711
#define CM_DRP_LOCATION_PATHS
Definition: cfgmgr32.h:725
#define CM_DRP_REMOVAL_POLICY_OVERRIDE
Definition: cfgmgr32.h:721
#define CM_DRP_CAPABILITIES
Definition: cfgmgr32.h:691
#define CM_DRP_UPPERFILTERS
Definition: cfgmgr32.h:693
#define CM_DRP_COMPATIBLEIDS
Definition: cfgmgr32.h:678
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
#define CM_DRP_CLASS
Definition: cfgmgr32.h:683
#define CM_DRP_LEGACYBUSTYPE
Definition: cfgmgr32.h:702
#define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cfgmgr32.h:690
#define CM_DRP_DEVTYPE
Definition: cfgmgr32.h:709
#define CM_DRP_FRIENDLYNAME
Definition: cfgmgr32.h:688
#define CM_DRP_INSTALL_STATE
Definition: cfgmgr32.h:722
#define CM_DRP_UI_NUMBER
Definition: cfgmgr32.h:692
#define CM_DRP_CHARACTERISTICS
Definition: cfgmgr32.h:713
#define CM_DRP_BASE_CONTAINERID
Definition: cfgmgr32.h:728
#define CM_DRP_UI_NUMBER_DESC_FORMAT
Definition: cfgmgr32.h:716
#define CM_DRP_ADDRESS
Definition: cfgmgr32.h:715
#define CM_DRP_DEVICE_POWER_DATA
Definition: cfgmgr32.h:718
#define CM_DRP_HARDWAREID
Definition: cfgmgr32.h:677
#define CM_DRP_SERVICE
Definition: cfgmgr32.h:680
#define PNP_PROPERTY_UI_NUMBER
Definition: cmtypes.h:34
#define PNP_PROPERTY_REMOVAL_POLICY
Definition: cmtypes.h:40
#define PNP_PROPERTY_POWER_DATA
Definition: cmtypes.h:39
#define PNP_PROPERTY_ENUMERATOR_NAME
Definition: cmtypes.h:43
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cmtypes.h:35
@ PlugPlayControlProperty
Definition: cmtypes.h:219
#define PNP_PROPERTY_INSTALL_STATE
Definition: cmtypes.h:45
#define PNP_PROPERTY_LOCATION_PATHS
Definition: cmtypes.h:46
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT
Definition: cmtypes.h:44
#define PNP_PROPERTY_LEGACYBUSTYPE
Definition: cmtypes.h:37
#define PNP_PROPERTY_BUSTYPEGUID
Definition: cmtypes.h:36
#define PNP_PROPERTY_ADDRESS
Definition: cmtypes.h:42
#define PNP_PROPERTY_BUSNUMBER
Definition: cmtypes.h:38
#define PNP_PROPERTY_CONTAINERID
Definition: cmtypes.h:47
#define REG_BINARY
Definition: nt_native.h:1496
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:507

Referenced by CM_Get_DevNode_Registry_Property_ExW(), GetDeviceInstanceKeyPath(), PNP_GetClassInstance(), and PNP_GetDeviceStatus().

◆ PNP_GetDeviceStatus()

DWORD WINAPI PNP_GetDeviceStatus ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD pulStatus,
DWORD pulProblem,
DWORD  ulFlags 
)

Definition at line 3337 of file rpcserver.c.

3343{
3344 DWORD ulDataType, ulTransferLength, ulLength;
3345 DWORD ulCapabilities, ulConfigFlags;
3346 CONFIGRET ret;
3347
3349 UNREFERENCED_PARAMETER(ulFlags);
3350
3351 DPRINT("PNP_GetDeviceStatus(%p %S %p %p 0x%08lx)\n",
3352 hBinding, pDeviceID, pulStatus, pulProblem, ulFlags);
3353
3354 if (ulFlags != 0)
3355 return CR_INVALID_FLAG;
3356
3357 if ((pulStatus == NULL) || (pulProblem == NULL))
3358 return CR_INVALID_POINTER;
3359
3360 if (!IsValidDeviceInstanceID(pDeviceID))
3361 return CR_INVALID_DEVINST;
3362
3363 ret = GetDeviceStatus(pDeviceID, pulStatus, pulProblem);
3364 if (ret != CR_SUCCESS)
3365 return ret;
3366
3367 /* Check for DN_REMOVABLE */
3368 ulTransferLength = sizeof(ulCapabilities);
3369 ulLength = sizeof(ulCapabilities);
3371 pDeviceID,
3373 &ulDataType,
3374 (PBYTE)&ulCapabilities,
3375 &ulTransferLength,
3376 &ulLength,
3377 0);
3378 if (ret != CR_SUCCESS)
3379 ulCapabilities = 0;
3380
3381 if (ulCapabilities & CM_DEVCAP_REMOVABLE)
3382 *pulStatus |= DN_REMOVABLE;
3383
3384 /* Check for DN_MANUAL */
3385 ulTransferLength = sizeof(ulConfigFlags);
3386 ulLength = sizeof(ulConfigFlags);
3388 pDeviceID,
3390 &ulDataType,
3391 (PBYTE)&ulConfigFlags,
3392 &ulTransferLength,
3393 &ulLength,
3394 0);
3395 if (ret != CR_SUCCESS)
3396 ulConfigFlags = 0;
3397
3398 if (ulConfigFlags & CONFIGFLAG_MANUAL_INSTALL)
3399 *pulStatus |= DN_MANUAL;
3400
3401 /* Check for failed install */
3402 if (((*pulStatus & DN_HAS_PROBLEM) == 0) && (ulConfigFlags & CONFIGFLAG_FAILEDINSTALL))
3403 {
3404 *pulStatus |= DN_HAS_PROBLEM;
3405 *pulProblem = CM_PROB_FAILED_INSTALL;
3406 }
3407
3408 return CR_SUCCESS;
3409}
#define DN_REMOVABLE
Definition: cfg.h:132
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define DN_MANUAL
Definition: cfg.h:122
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
#define CM_DEVCAP_REMOVABLE
Definition: cfgmgr32.h:737
#define CONFIGFLAG_MANUAL_INSTALL
Definition: regstr.h:392
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396

Referenced by CM_Get_DevNode_Status_Ex().

◆ PNP_GetFirstLogConf()

DWORD WINAPI PNP_GetFirstLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD pulLogConfTag,
DWORD  ulFlags 
)

Definition at line 4117 of file rpcserver.c.

4123{
4124 HKEY hConfigKey = NULL;
4125 DWORD RegDataType = 0;
4126 ULONG ulDataSize = 0;
4127 LPBYTE lpData = NULL;
4129
4130 DPRINT("PNP_GetFirstLogConf(%p %S %lu %p 0x%08lx)\n",
4131 hBinding, pDeviceID, ulLogConfType, pulLogConfTag, ulFlags);
4132
4133 if (pulLogConfTag == NULL)
4134 return CR_INVALID_POINTER;
4135
4136 *pulLogConfTag = (DWORD)0;
4137
4138 if (ulFlags & ~LOG_CONF_BITS)
4139 return CR_INVALID_FLAG;
4140
4141 if (!IsValidDeviceInstanceID(pDeviceID))
4142 return CR_INVALID_DEVINST;
4143
4144 ret = OpenConfigurationKey(pDeviceID,
4145 &hConfigKey);
4146 if (ret != CR_SUCCESS)
4147 {
4148 DPRINT1("OpenConfigurationKey() failed (Error %lu)\n", ret);
4150 goto done;
4151 }
4152
4153 ret = GetConfigurationData(hConfigKey,
4154 ulLogConfType,
4155 &RegDataType,
4156 &ulDataSize,
4157 &lpData);
4158 if (ret != CR_SUCCESS)
4159 {
4160 DPRINT1("GetConfigurationData() failed (Error %lu)\n", ret);
4162 goto done;
4163 }
4164
4165 DPRINT("Data size %lu\n", ulDataSize);
4166 if (ulDataSize == 0 || lpData == NULL)
4167 {
4168 DPRINT1("No config data available!\n");
4170 goto done;
4171 }
4172
4173 /* Get the first tag */
4174 if (RegDataType == REG_RESOURCE_LIST)
4175 {
4176 DPRINT("REG_RESOURCE_LIST\n");
4177
4178 DPRINT("ResourceList->Count %lu\n", ((PCM_RESOURCE_LIST)lpData)->Count);
4179 if (((PCM_RESOURCE_LIST)lpData)->Count == 0)
4180 {
4181 DPRINT1("No resource descriptors!\n");
4183 goto done;
4184 }
4185
4186 DPRINT("lpData %p\n", lpData);
4187 DPRINT("&List[0] %p\n", &(((PCM_RESOURCE_LIST)lpData)->List[0]));
4188
4189 *pulLogConfTag = (DWORD)((DWORD_PTR)&(((PCM_RESOURCE_LIST)lpData)->List[0]) - (DWORD_PTR)lpData);
4190 DPRINT("Offset (Tag): 0x%08lx\n", *pulLogConfTag);
4191 }
4192 else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
4193 {
4194 DPRINT1("FIXME: REG_RESOURCE_REQUIREMENTS_LIST\n");
4195 /* FIXME */
4197 goto done;
4198 }
4199
4200done:
4201 if (lpData != NULL)
4202 HeapFree(GetProcessHeap(), 0, lpData);
4203
4204 if (hConfigKey != NULL)
4205 RegCloseKey(hConfigKey);
4206
4207 DPRINT("PNP_GetFirstLogConf() returns %lu\n", ret);
4208
4209 return ret;
4210}
static CONFIGRET GetConfigurationData(_In_ HKEY hKey, _In_ ULONG ulLogConfType, _Out_ PULONG pulRegDataType, _Out_ PULONG pulDataSize, _Out_ LPBYTE *ppBuffer)
Definition: rpcserver.c:473
static CONFIGRET OpenConfigurationKey(_In_ LPCWSTR pszDeviceID, _Out_ PHKEY phKey)
Definition: rpcserver.c:429
#define CR_NO_MORE_LOG_CONF
Definition: cfgmgr32.h:859
#define LOG_CONF_BITS
Definition: cfgmgr32.h:603
struct _CM_RESOURCE_LIST * PCM_RESOURCE_LIST
int Count
Definition: noreturn.cpp:7
uint32_t DWORD_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by CM_Get_First_Log_Conf_Ex().

◆ PNP_GetGlobalState()

DWORD WINAPI PNP_GetGlobalState ( handle_t  hBinding,
DWORD pulState,
DWORD  ulFlags 
)

Definition at line 606 of file rpcserver.c.

610{
612 UNREFERENCED_PARAMETER(ulFlags);
613
614 DPRINT("PNP_GetGlobalState(%p %p 0x%08lx)\n",
615 hBinding, pulState, ulFlags);
616
618
619 return CR_SUCCESS;
620}
#define CM_GLOBAL_STATE_SERVICES_AVAILABLE
Definition: cfgmgr32.h:910
#define CM_GLOBAL_STATE_CAN_DO_UI
Definition: cfgmgr32.h:908

Referenced by CM_Get_Global_State_Ex().

◆ PNP_GetHwProfInfo()

DWORD WINAPI PNP_GetHwProfInfo ( handle_t  hBinding,
DWORD  ulIndex,
HWPROFILEINFO pHWProfileInfo,
DWORD  ulProfileInfoSize,
DWORD  ulFlags 
)

Definition at line 3952 of file rpcserver.c.

3958{
3959 WCHAR szProfileName[5];
3960 HKEY hKeyConfig = NULL;
3961 HKEY hKeyProfiles = NULL;
3962 HKEY hKeyProfile = NULL;
3963 DWORD dwDisposition;
3964 DWORD dwSize;
3965 LONG lError;
3967
3969
3970 DPRINT("PNP_GetHwProfInfo() called\n");
3971
3972 if (ulProfileInfoSize == 0)
3973 {
3975 goto done;
3976 }
3977
3978 if (ulFlags != 0)
3979 {
3981 goto done;
3982 }
3983
3984 /* Initialize the profile information */
3985 pHWProfileInfo->HWPI_ulHWProfile = 0;
3986 pHWProfileInfo->HWPI_szFriendlyName[0] = 0;
3987 pHWProfileInfo->HWPI_dwFlags = 0;
3988
3989 /* Open the 'IDConfigDB' key */
3991 L"System\\CurrentControlSet\\Control\\IDConfigDB",
3992 0,
3993 NULL,
3996 NULL,
3997 &hKeyConfig,
3998 &dwDisposition);
3999 if (lError != ERROR_SUCCESS)
4000 {
4002 goto done;
4003 }
4004
4005 /* Open the 'Hardware Profiles' subkey */
4006 lError = RegCreateKeyExW(hKeyConfig,
4007 L"Hardware Profiles",
4008 0,
4009 NULL,
4012 NULL,
4013 &hKeyProfiles,
4014 &dwDisposition);
4015 if (lError != ERROR_SUCCESS)
4016 {
4018 goto done;
4019 }
4020
4021 if (ulIndex == (ULONG)-1)
4022 {
4023 dwSize = sizeof(ULONG);
4024 lError = RegQueryValueExW(hKeyConfig,
4025 L"CurrentConfig",
4026 NULL,
4027 NULL,
4028 (LPBYTE)&pHWProfileInfo->HWPI_ulHWProfile,
4029 &dwSize);
4030 if (lError != ERROR_SUCCESS)
4031 {
4032 pHWProfileInfo->HWPI_ulHWProfile = 0;
4034 goto done;
4035 }
4036 }
4037 else
4038 {
4039 /* FIXME: not implemented yet */
4041 goto done;
4042 }
4043
4044 swprintf(szProfileName, L"%04lu", pHWProfileInfo->HWPI_ulHWProfile);
4045
4046 lError = RegOpenKeyExW(hKeyProfiles,
4047 szProfileName,
4048 0,
4050 &hKeyProfile);
4051 if (lError != ERROR_SUCCESS)
4052 {
4054 goto done;
4055 }
4056
4057 dwSize = sizeof(pHWProfileInfo->HWPI_szFriendlyName);
4058 lError = RegQueryValueExW(hKeyProfile,
4059 L"FriendlyName",
4060 NULL,
4061 NULL,
4062 (LPBYTE)&pHWProfileInfo->HWPI_szFriendlyName,
4063 &dwSize);
4064 if (lError != ERROR_SUCCESS)
4065 {
4067 goto done;
4068 }
4069
4070done:
4071 if (hKeyProfile != NULL)
4072 RegCloseKey(hKeyProfile);
4073
4074 if (hKeyProfiles != NULL)
4075 RegCloseKey(hKeyProfiles);
4076
4077 if (hKeyConfig != NULL)
4078 RegCloseKey(hKeyConfig);
4079
4080 return ret;
4081}
ULONG HWPI_ulHWProfile
Definition: cfgmgr32.h:554
CHAR HWPI_szFriendlyName[MAX_PROFILE_LEN]
Definition: cfgmgr32.h:555
DWORD HWPI_dwFlags
Definition: cfgmgr32.h:556

Referenced by CM_Get_Hardware_Profile_Info_ExW().

◆ PNP_GetInterfaceDeviceAlias()

DWORD WINAPI PNP_GetInterfaceDeviceAlias ( handle_t  hBinding,
LPWSTR  pszInterfaceDevice,
GUID AliasInterfaceGuid,
LPWSTR  pszAliasInterfaceDevice,
PNP_RPC_STRING_LEN pulLength,
PNP_RPC_STRING_LEN pulTransferLen,
DWORD  ulFlags 
)

Definition at line 2510 of file rpcserver.c.

2518{
2521}

Referenced by CM_Get_Device_Interface_Alias_ExW().

◆ PNP_GetInterfaceDeviceList()

DWORD WINAPI PNP_GetInterfaceDeviceList ( handle_t  hBinding,
GUID InterfaceGuid,
LPWSTR  pszDeviceID,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 2527 of file rpcserver.c.

2534{
2538
2540
2541 DPRINT("PNP_GetInterfaceDeviceList(%p %p %S %p %p 0x%08lx)\n",
2542 hBinding, InterfaceGuid, pszDeviceID, Buffer, pulLength, ulFlags);
2543
2544 if (!IsValidDeviceInstanceID(pszDeviceID))
2545 return CR_INVALID_DEVINST;
2546
2548 pszDeviceID);
2549
2550 PlugPlayData.Flags = ulFlags;
2551 PlugPlayData.FilterGuid = InterfaceGuid;
2552 PlugPlayData.Buffer = Buffer;
2553 PlugPlayData.BufferSize = *pulLength;
2554
2556 (PVOID)&PlugPlayData,
2558 if (NT_SUCCESS(Status))
2559 {
2560 *pulLength = PlugPlayData.BufferSize;
2561 }
2562 else
2563 {
2565 }
2566
2567 DPRINT("PNP_GetInterfaceDeviceList() done (returns %lx)\n", ret);
2568 return ret;
2569}
@ PlugPlayControlGetInterfaceDeviceList
Definition: cmtypes.h:218
static const GUID InterfaceGuid
Definition: wlanapi.c:25

Referenced by CM_Get_Device_Interface_List_ExW().

◆ PNP_GetInterfaceDeviceListSize()

DWORD WINAPI PNP_GetInterfaceDeviceListSize ( handle_t  hBinding,
PNP_RPC_BUFFER_SIZE pulLen,
GUID InterfaceGuid,
LPWSTR  pszDeviceID,
DWORD  ulFlags 
)

Definition at line 2575 of file rpcserver.c.

2581{
2585
2587
2588 DPRINT("PNP_GetInterfaceDeviceListSize(%p %p %p %S 0x%08lx)\n",
2589 hBinding, pulLen, InterfaceGuid, pszDeviceID, ulFlags);
2590
2591 if (!IsValidDeviceInstanceID(pszDeviceID))
2592 return CR_INVALID_DEVINST;
2593
2595 pszDeviceID);
2596
2597 PlugPlayData.FilterGuid = InterfaceGuid;
2598 PlugPlayData.Buffer = NULL;
2599 PlugPlayData.BufferSize = 0;
2600 PlugPlayData.Flags = ulFlags;
2601
2603 (PVOID)&PlugPlayData,
2605 if (NT_SUCCESS(Status))
2606 {
2607 *pulLen = PlugPlayData.BufferSize;
2608 }
2609 else
2610 {
2612 }
2613
2614 DPRINT("PNP_GetInterfaceDeviceListSize() done (returns %lx)\n", ret);
2615 return ret;
2616}

Referenced by CM_Get_Device_Interface_List_Size_ExW().

◆ PNP_GetLogConfPriority()

DWORD WINAPI PNP_GetLogConfPriority ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulType,
DWORD  ulTag,
DWORD pPriority,
DWORD  ulFlags 
)

Definition at line 4306 of file rpcserver.c.

4313{
4316}

Referenced by CM_Get_Log_Conf_Priority_Ex().

◆ PNP_GetNextLogConf()

DWORD WINAPI PNP_GetNextLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD  ulCurrentTag,
DWORD pulNextTag,
DWORD  ulFlags 
)

Definition at line 4216 of file rpcserver.c.

4223{
4224 HKEY hConfigKey = NULL;
4225 DWORD RegDataType = 0;
4226 ULONG ulDataSize = 0;
4227 LPBYTE lpData = NULL;
4229
4230 DPRINT("PNP_GetNextLogConf(%p %S %lu %ul %p 0x%08lx)\n",
4231 hBinding, pDeviceID, ulLogConfType, ulCurrentTag, pulNextTag, ulFlags);
4232
4233 if (pulNextTag == NULL)
4234 return CR_INVALID_POINTER;
4235
4236 *pulNextTag = (DWORD)0;
4237
4238 if (ulFlags != 0)
4239 return CR_INVALID_FLAG;
4240
4241 if (!IsValidDeviceInstanceID(pDeviceID))
4242 return CR_INVALID_DEVINST;
4243
4244 ret = OpenConfigurationKey(pDeviceID,
4245 &hConfigKey);
4246 if (ret != CR_SUCCESS)
4247 {
4248 DPRINT1("OpenConfigurationKey() failed (Error %lu)\n", ret);
4250 goto done;
4251 }
4252
4253 ret = GetConfigurationData(hConfigKey,
4254 ulLogConfType,
4255 &RegDataType,
4256 &ulDataSize,
4257 &lpData);
4258 if (ret != CR_SUCCESS)
4259 {
4260 DPRINT1("GetConfigurationData() failed (Error %lu)\n", ret);
4262 goto done;
4263 }
4264
4265 DPRINT("Data size %lu\n", ulDataSize);
4266
4267 if (ulDataSize == 0 || lpData == NULL)
4268 {
4269 DPRINT1("No config data available!\n");
4271 goto done;
4272 }
4273
4274 /* FIXME: Get the next tag */
4275 if (RegDataType == REG_RESOURCE_LIST)
4276 {
4277 DPRINT1("FIXME: REG_RESOURCE_LIST\n");
4278 /* FIXME */
4280 goto done;
4281 }
4282 else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
4283 {
4284 DPRINT1("FIXME: REG_RESOURCE_REQUIREMENTS_LIST\n");
4285 /* FIXME */
4287 goto done;
4288 }
4289
4290done:
4291 if (lpData != NULL)
4292 HeapFree(GetProcessHeap(), 0, lpData);
4293
4294 if (hConfigKey != NULL)
4295 RegCloseKey(hConfigKey);
4296
4297 DPRINT("PNP_GetNextLogConf() returns %lu\n", ret);
4298
4299 return ret;
4300}

Referenced by CM_Get_Next_Log_Conf_Ex().

◆ PNP_GetNextResDes()

DWORD WINAPI PNP_GetNextResDes ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD  ulResourceTag,
DWORD pulNextResType,
DWORD pulNextResTag,
DWORD  ulFlags 
)

Definition at line 4360 of file rpcserver.c.

4370{
4371 HKEY hConfigKey = NULL;
4372 DWORD RegDataType = 0;
4373 ULONG ulDataSize = 0;
4374 LPBYTE lpData = NULL;
4376
4377 DPRINT1("PNP_GetNextResDes(%p %S 0x%lx %lu %lu %ul %p %p 0x%08lx)\n",
4378 hBinding, pDeviceID, ulLogConfTag, ulLogConfType, ResourceID,
4379 ulResourceTag, pulNextResType, pulNextResTag, ulFlags);
4380
4381 if (pulNextResType == NULL)
4382 return CR_INVALID_POINTER;
4383
4384 *pulNextResType = 0;
4385
4386 if (ulFlags != 0)
4387 return CR_INVALID_FLAG;
4388
4389 if (!IsValidDeviceInstanceID(pDeviceID))
4390 return CR_INVALID_DEVINST;
4391
4392 ret = OpenConfigurationKey(pDeviceID,
4393 &hConfigKey);
4394 if (ret != CR_SUCCESS)
4395 {
4396 DPRINT1("OpenConfigurationKey() failed (Error %lu)\n", ret);
4398 goto done;
4399 }
4400
4401 ret = GetConfigurationData(hConfigKey,
4402 ulLogConfType,
4403 &RegDataType,
4404 &ulDataSize,
4405 &lpData);
4406 if (ret != CR_SUCCESS)
4407 {
4408 DPRINT1("GetConfigurationData() failed (Error %lu)\n", ret);
4410 goto done;
4411 }
4412
4413 DPRINT1("Data size %lu\n", ulDataSize);
4414
4415 if (ulDataSize == 0 || lpData == NULL)
4416 {
4417 DPRINT1("No config data available!\n");
4419 goto done;
4420 }
4421
4422 /* Get the next resource descriptor */
4423 if (RegDataType == REG_RESOURCE_LIST)
4424 {
4425 DPRINT1("FIXME: REG_RESOURCE_LIST\n");
4426 /* FIXME */
4428 goto done;
4429 }
4430 else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
4431 {
4432 DPRINT1("FIXME: REG_RESOURCE_REQUIREMENTS_LIST\n");
4433 /* FIXME */
4435 goto done;
4436 }
4437
4438done:
4439 if (lpData != NULL)
4440 HeapFree(GetProcessHeap(), 0, lpData);
4441
4442 if (hConfigKey != NULL)
4443 RegCloseKey(hConfigKey);
4444
4445 DPRINT1("PNP_GetNextResDes() returns %lu\n", ret);
4446
4447 return ret;
4448}

Referenced by CM_Get_Next_Res_Des_Ex().

◆ PNP_GetObjectProp()

DWORD WINAPI PNP_GetObjectProp ( handle_t  hBinding,
LPWSTR  ObjectName,
DWORD  ObjectType,
LPWSTR  PropertyCultureName,
const DEVPROPKEY PropertyKey,
DEVPROPTYPE PropertyType,
PNP_PROP_SIZE PropertySize,
PNP_PROP_SIZE TransferLen,
BYTE PropertyBuffer,
DWORD  Flags 
)

Definition at line 4894 of file rpcserver.c.

4905{
4908}

◆ PNP_GetObjectPropKeys()

DWORD WINAPI PNP_GetObjectPropKeys ( handle_t  hBinding,
LPWSTR  ObjectName,
DWORD  ObjectType,
LPWSTR  PropertyCultureName,
PNP_PROP_COUNT PropertyCount,
PNP_PROP_COUNT TransferLen,
DEVPROPKEY PropertyKeys,
DWORD  Flags 
)

Definition at line 4876 of file rpcserver.c.

4885{
4888}

◆ PNP_GetRelatedDeviceInstance()

DWORD WINAPI PNP_GetRelatedDeviceInstance ( handle_t  hBinding,
DWORD  ulRelationship,
LPWSTR  pDeviceID,
LPWSTR  pRelatedDeviceId,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 773 of file rpcserver.c.

780{
784
786 UNREFERENCED_PARAMETER(ulFlags);
787
788 DPRINT("PNP_GetRelatedDeviceInstance(%p %lu %S %p %p 0x%lx)\n",
789 hBinding, ulRelationship, pDeviceID, pRelatedDeviceId,
790 pulLength, ulFlags);
791
792 if (!IsValidDeviceInstanceID(pDeviceID))
793 return CR_INVALID_DEVINST;
794
795 if (ulRelationship == PNP_GET_PARENT_DEVICE_INSTANCE)
796 {
797 /* The root device does not have a parent */
798 if (IsRootDeviceInstanceID(pDeviceID))
799 return CR_NO_SUCH_DEVINST;
800
801 /* Return the root device for non existing devices */
802 if (!IsPresentDeviceInstanceID(pDeviceID))
803 {
804 if ((wcslen(szRootDeviceInstanceID) + 1) > *pulLength)
805 {
806 *pulLength = wcslen(szRootDeviceInstanceID) + 1;
807 return CR_BUFFER_SMALL;
808 }
809
810 wcscpy(pRelatedDeviceId, szRootDeviceInstanceID);
811 *pulLength = wcslen(szRootDeviceInstanceID) + 1;
812 return CR_SUCCESS;
813 }
814 }
815 else if (ulRelationship == PNP_GET_SIBLING_DEVICE_INSTANCE)
816 {
817 /* The root device does not have siblings */
818 if (IsRootDeviceInstanceID(pDeviceID))
819 return CR_NO_SUCH_DEVINST;
820 }
821
823 pDeviceID);
824
825 PlugPlayData.Relation = ulRelationship;
826
827 PlugPlayData.RelatedDeviceInstanceLength = *pulLength;
828 PlugPlayData.RelatedDeviceInstance = pRelatedDeviceId;
829
831 (PVOID)&PlugPlayData,
833 if (!NT_SUCCESS(Status))
834 {
836 }
837
838 DPRINT("PNP_GetRelatedDeviceInstance() done (returns %lx)\n", ret);
839 if (ret == CR_SUCCESS)
840 {
841 DPRINT("RelatedDevice: %wZ\n", &PlugPlayData.RelatedDeviceInstance);
842 }
843
844 return ret;
845}
@ PlugPlayControlGetRelatedDevice
Definition: cmtypes.h:221

Referenced by CM_Get_Child_Ex(), CM_Get_Parent_Ex(), and CM_Get_Sibling_Ex().

◆ PNP_GetResDesData()

DWORD WINAPI PNP_GetResDesData ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD  ulResourceTag,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE  BufferLen,
DWORD  ulFlags 
)

Definition at line 4454 of file rpcserver.c.

4464{
4467}

◆ PNP_GetResDesDataSize()

DWORD WINAPI PNP_GetResDesDataSize ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD  ulResourceTag,
DWORD pulSize,
DWORD  ulFlags 
)

Definition at line 4473 of file rpcserver.c.

4482{
4485}

◆ PNP_GetRootDeviceInstance()

DWORD WINAPI PNP_GetRootDeviceInstance ( handle_t  hBinding,
LPWSTR  pDeviceID,
PNP_RPC_STRING_LEN  ulLength 
)

Definition at line 736 of file rpcserver.c.

740{
742
744
745 DPRINT("PNP_GetRootDeviceInstance(%p %S %lu)\n",
746 hBinding, pDeviceID, ulLength);
747
748 if (!pDeviceID)
749 {
751 goto Done;
752 }
753
754 if (ulLength < lstrlenW(szRootDeviceInstanceID) + 1)
755 {
757 goto Done;
758 }
759
760 lstrcpyW(pDeviceID,
762
763Done:
764 DPRINT("PNP_GetRootDeviceInstance() done (returns %lx)\n", ret);
765
766 return ret;
767}

Referenced by CM_Locate_DevNode_ExW().

◆ PNP_GetServerSideDeviceInstallFlags()

DWORD WINAPI PNP_GetServerSideDeviceInstallFlags ( handle_t  hBinding,
DWORD pulSSDIFlags,
DWORD  ulFlags 
)

Definition at line 4850 of file rpcserver.c.

4854{
4856
4857 DPRINT1("PNP_GetServerSideDeviceInstallFlags(%p %p %lu)\n",
4858 hBinding, pulSSDIFlags, ulFlags);
4859
4860 if (pulSSDIFlags == NULL)
4861 return CR_INVALID_POINTER;
4862
4863 if (ulFlags != 0)
4864 return CR_INVALID_FLAG;
4865
4866 /* FIXME */
4867 *pulSSDIFlags = 0;
4868
4869 return CR_SUCCESS;
4870}

Referenced by CMP_GetServerSideDeviceInstallFlags().

◆ PNP_GetVersion()

DWORD WINAPI PNP_GetVersion ( handle_t  hBinding,
WORD pVersion 
)

Definition at line 588 of file rpcserver.c.

591{
593
594 DPRINT("PNP_GetVersion(%p %p)\n",
595 hBinding, pVersion);
596
597 *pVersion = 0x0400;
598
599 return CR_SUCCESS;
600}

Referenced by CM_Get_Version_Ex(), CM_Is_Version_Available_Ex(), and CMP_WaitServicesAvailable().

◆ PNP_GetVersionInternal()

DWORD WINAPI PNP_GetVersionInternal ( handle_t  hBinding,
WORD pwVersion 
)

Definition at line 4821 of file rpcserver.c.

4824{
4826
4827 *pwVersion = 0x501;
4828 return CR_SUCCESS;
4829}

◆ PNP_HwProfFlags()

DWORD WINAPI PNP_HwProfFlags ( handle_t  hBinding,
DWORD  ulAction,
LPWSTR  pDeviceID,
DWORD  ulConfig,
DWORD pulValue,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 3868 of file rpcserver.c.

3878{
3880 WCHAR szKeyName[MAX_PATH];
3881 HKEY hKey;
3882 HKEY hDeviceKey;
3883 DWORD dwSize;
3884
3886
3887 DPRINT("PNP_HwProfFlags() called\n");
3888
3889 if (!IsValidDeviceInstanceID(pDeviceID))
3890 return CR_INVALID_DEVINST;
3891
3892 if (ulConfig == 0)
3893 {
3894 wcscpy(szKeyName,
3895 L"System\\CurrentControlSet\\HardwareProfiles\\Current\\System\\CurrentControlSet\\Enum");
3896 }
3897 else
3898 {
3899 swprintf(szKeyName,
3900 L"System\\CurrentControlSet\\HardwareProfiles\\%04lu\\System\\CurrentControlSet\\Enum",
3901 ulConfig);
3902 }
3903
3905 szKeyName,
3906 0,
3908 &hKey) != ERROR_SUCCESS)
3909 return CR_REGISTRY_ERROR;
3910
3911 if (ulAction == PNP_GET_HWPROFFLAGS)
3912 {
3913 if (RegOpenKeyExW(hKey,
3914 pDeviceID,
3915 0,
3917 &hDeviceKey) != ERROR_SUCCESS)
3918 {
3919 *pulValue = 0;
3920 }
3921 else
3922 {
3923 dwSize = sizeof(DWORD);
3924 if (RegQueryValueExW(hDeviceKey,
3925 L"CSConfigFlags",
3926 NULL,
3927 NULL,
3928 (LPBYTE)pulValue,
3929 &dwSize) != ERROR_SUCCESS)
3930 {
3931 *pulValue = 0;
3932 }
3933
3934 RegCloseKey(hDeviceKey);
3935 }
3936 }
3937 else if (ulAction == PNP_SET_HWPROFFLAGS)
3938 {
3939 /* FIXME: not implemented yet */
3941 }
3942
3944
3945 return ret;
3946}

Referenced by CM_Get_HW_Prof_Flags_ExW(), and CM_Set_HW_Prof_Flags_ExW().

◆ PNP_InitDetection()

DWORD WINAPI PNP_InitDetection ( handle_t  hBinding)

Definition at line 626 of file rpcserver.c.

628{
630
631 DPRINT("PNP_InitDetection(%p)\n",
632 hBinding);
633
634 return CR_SUCCESS;
635}

Referenced by CMP_Init_Detection().

◆ PNP_InstallDevInst()

DWORD WINAPI PNP_InstallDevInst ( handle_t  hBinding)

Definition at line 4933 of file rpcserver.c.

4935{
4938}

◆ PNP_IsDockStationPresent()

CONFIGRET WINAPI PNP_IsDockStationPresent ( handle_t  hBinding,
BOOL Present 
)

Definition at line 3780 of file rpcserver.c.

3783{
3784 HKEY hKey;
3785 DWORD dwType;
3786 DWORD dwValue;
3787 DWORD dwSize;
3789
3791
3792 DPRINT1("PNP_IsDockStationPresent(%p %p)\n",
3793 hBinding, Present);
3794
3795 *Present = FALSE;
3796
3798 L"CurrentDockInfo",
3799 0,
3800 KEY_READ,
3801 &hKey) != ERROR_SUCCESS)
3802 return CR_REGISTRY_ERROR;
3803
3804 dwSize = sizeof(DWORD);
3806 L"DockingState",
3807 NULL,
3808 &dwType,
3809 (LPBYTE)&dwValue,
3810 &dwSize) != ERROR_SUCCESS)
3812
3814
3815 if (ret == CR_SUCCESS)
3816 {
3817 if (dwType != REG_DWORD || dwSize != sizeof(DWORD))
3818 {
3820 }
3821 else if (dwValue != 0)
3822 {
3823 *Present = TRUE;
3824 }
3825 }
3826
3827 DPRINT1("PNP_IsDockStationPresent() done (returns %lx)\n", ret);
3828
3829 return ret;
3830}
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15

Referenced by CM_Is_Dock_Station_Present_Ex().

◆ PNP_ModifyResDes()

DWORD WINAPI PNP_ModifyResDes ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  CurrentResourceID,
RESOURCEID  NewResourceID,
DWORD  ulResourceTag,
BYTE ResourceData,
PNP_RPC_BUFFER_SIZE  ResourceLen,
DWORD  ulFlags 
)

Definition at line 4491 of file rpcserver.c.

4502{
4505}

◆ PNP_NOTIFY_HANDLE_rundown()

VOID __RPC_USER PNP_NOTIFY_HANDLE_rundown ( PNP_NOTIFY_HANDLE  pHandle)

Definition at line 554 of file rpcserver.c.

556{
557 DPRINT1("PNP_NOTIFY_HANDLE_rundown(%p)\n", pHandle);
558}

◆ PNP_QueryArbitratorFreeData()

DWORD WINAPI PNP_QueryArbitratorFreeData ( handle_t  hBinding,
BYTE pData,
DWORD  DataLen,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
DWORD  ulFlags 
)

Definition at line 4562 of file rpcserver.c.

4569{
4571}

Referenced by CM_Query_Arbitrator_Free_Data_Ex().

◆ PNP_QueryArbitratorFreeSize()

DWORD WINAPI PNP_QueryArbitratorFreeSize ( handle_t  hBinding,
DWORD pulSize,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
DWORD  ulFlags 
)

Definition at line 4577 of file rpcserver.c.

4583{
4584 if (pulSize != NULL)
4585 *pulSize = 0;
4586
4588}
_Check_return_ _Out_ PULONG pulSize
Definition: winddi.h:2120

Referenced by CM_Query_Arbitrator_Free_Size_Ex().

◆ PNP_QueryRemove()

DWORD WINAPI PNP_QueryRemove ( handle_t  hBinding,
LPWSTR  pszDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 3683 of file rpcserver.c.

3690{
3694
3695 DPRINT1("PNP_QueryRemove(%p %S %p %p %lu 0x%lx)\n",
3696 hBinding, pszDeviceID, pVetoType, pszVetoName,
3697 ulNameLength, ulFlags);
3698
3699 if (ulFlags & ~CM_REMOVE_BITS)
3700 return CR_INVALID_FLAG;
3701
3702 if (!IsValidDeviceInstanceID(pszDeviceID) ||
3703 IsRootDeviceInstanceID(pszDeviceID))
3704 return CR_INVALID_DEVINST;
3705
3706 if (pVetoType != NULL)
3707 *pVetoType = PNP_VetoTypeUnknown;
3708
3709 if (pszVetoName != NULL && ulNameLength > 0)
3710 *pszVetoName = UNICODE_NULL;
3711
3712 RtlZeroMemory(&PlugPlayData, sizeof(PlugPlayData));
3714 pszDeviceID);
3715 PlugPlayData.VetoName = pszVetoName;
3716 PlugPlayData.NameLength = ulNameLength;
3717// PlugPlayData.Flags =
3718
3720 &PlugPlayData,
3721 sizeof(PlugPlayData));
3722 if (!NT_SUCCESS(Status))
3724
3725 return ret;
3726}
@ PNP_VetoTypeUnknown
Definition: cfg.h:180
#define CM_REMOVE_BITS
Definition: cfgmgr32.h:780
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by CM_Query_And_Remove_SubTree_ExW().

◆ PNP_QueryResConfList()

DWORD WINAPI PNP_QueryResConfList ( handle_t  hBinding,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
BYTE ResourceData,
PNP_RPC_BUFFER_SIZE  ResourceLen,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE  BufferLen,
DWORD  ulFlags 
)

Definition at line 4532 of file rpcserver.c.

4541{
4544}

Referenced by CM_Query_Resource_Conflict_List().

◆ PNP_RegisterDeviceClassAssociation()

DWORD WINAPI PNP_RegisterDeviceClassAssociation ( handle_t  hBinding,
LPWSTR  pszDeviceID,
GUID InterfaceGuid,
LPWSTR  pszReference,
LPWSTR  pszSymLink,
PNP_RPC_STRING_LEN pulLength,
PNP_RPC_STRING_LEN pulTransferLen,
DWORD  ulFlags 
)

Definition at line 2622 of file rpcserver.c.

2631{
2634}

Referenced by CM_Register_Device_Interface_ExW().

◆ PNP_RegisterDriver()

DWORD WINAPI PNP_RegisterDriver ( handle_t  hBinding,
LPWSTR  pszDeviceID,
DWORD  ulFlags 
)

Definition at line 3660 of file rpcserver.c.

3664{
3665 DPRINT("PNP_RegisterDriver(%p %S 0x%lx)\n",
3666 hBinding, pszDeviceID, ulFlags);
3667
3668 if (ulFlags & ~CM_REGISTER_DEVICE_DRIVER_BITS)
3669 return CR_INVALID_FLAG;
3670
3671 if (!IsValidDeviceInstanceID(pszDeviceID))
3672 return CR_INVALID_DEVINST;
3673
3674 SetDeviceStatus(pszDeviceID, 0, 0);
3675
3676 return CR_SUCCESS;
3677}
static CONFIGRET SetDeviceStatus(_In_ LPWSTR pszDeviceID, _In_ DWORD ulStatus, _In_ DWORD ulProblem)
Definition: rpcserver.c:264
#define CM_REGISTER_DEVICE_DRIVER_BITS
Definition: cfgmgr32.h:798

Referenced by CM_Register_Device_Driver_Ex().

◆ PNP_RegisterNotification()

DWORD WINAPI PNP_RegisterNotification ( handle_t  hBinding,
DWORD  ulUnknown2,
LPWSTR  pszName,
BYTE pNotificationFilter,
DWORD  ulNotificationFilterSize,
DWORD  ulFlags,
PNP_NOTIFY_HANDLE pNotifyHandle,
DWORD  ulUnknown8,
DWORD pulUnknown9 
)

Definition at line 4605 of file rpcserver.c.

4615{
4616 PDEV_BROADCAST_DEVICEINTERFACE_W pBroadcastDeviceInterface;
4617 PDEV_BROADCAST_HANDLE pBroadcastDeviceHandle;
4618 PNOTIFY_ENTRY pNotifyData = NULL;
4619
4620 DPRINT1("PNP_RegisterNotification(%p %lx '%S' %p %lu 0x%lx %p %lx %p)\n",
4621 hBinding, ulUnknown2, pszName, pNotificationFilter,
4622 ulNotificationFilterSize, ulFlags, pNotifyHandle, ulUnknown8, pulUnknown9);
4623
4624 if (pNotifyHandle == NULL)
4625 return CR_INVALID_POINTER;
4626
4627 *pNotifyHandle = NULL;
4628
4629 if (pNotificationFilter == NULL ||
4630 pulUnknown9 == NULL)
4631 return CR_INVALID_POINTER;
4632
4633 if (ulFlags & ~0x7)
4634 return CR_INVALID_FLAG;
4635
4636 if ((ulNotificationFilterSize < sizeof(DEV_BROADCAST_HDR)) ||
4637 (((PDEV_BROADCAST_HDR)pNotificationFilter)->dbch_size < sizeof(DEV_BROADCAST_HDR)))
4638 return CR_INVALID_DATA;
4639
4640 if (((PDEV_BROADCAST_HDR)pNotificationFilter)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
4641 {
4642 DPRINT1("DBT_DEVTYP_DEVICEINTERFACE\n");
4643 pBroadcastDeviceInterface = (PDEV_BROADCAST_DEVICEINTERFACE_W)pNotificationFilter;
4644
4645 if ((ulNotificationFilterSize < sizeof(DEV_BROADCAST_DEVICEINTERFACE_W)) ||
4646 (pBroadcastDeviceInterface->dbcc_size < sizeof(DEV_BROADCAST_DEVICEINTERFACE_W)))
4647 return CR_INVALID_DATA;
4648
4650 if (pNotifyData == NULL)
4651 return CR_OUT_OF_MEMORY;
4652
4653 if (pszName != NULL)
4654 {
4655 pNotifyData->pszName = RtlAllocateHeap(GetProcessHeap(),
4657 (wcslen(pszName) + 1) * sizeof(WCHAR));
4658 if (pNotifyData->pszName == NULL)
4659 {
4660 RtlFreeHeap(GetProcessHeap(), 0, pNotifyData);
4661 return CR_OUT_OF_MEMORY;
4662 }
4663 }
4664
4665 /* Add the entry to the notification list */
4667
4668 DPRINT("pNotifyData: %p\n", pNotifyData);
4669 *pNotifyHandle = (PNP_NOTIFY_HANDLE)pNotifyData;
4670 }
4671 else if (((PDEV_BROADCAST_HDR)pNotificationFilter)->dbch_devicetype == DBT_DEVTYP_HANDLE)
4672 {
4673 DPRINT1("DBT_DEVTYP_HANDLE\n");
4674 pBroadcastDeviceHandle = (PDEV_BROADCAST_HANDLE)pNotificationFilter;
4675
4676 if ((ulNotificationFilterSize < sizeof(DEV_BROADCAST_HANDLE)) ||
4677 (pBroadcastDeviceHandle->dbch_size < sizeof(DEV_BROADCAST_HANDLE)))
4678 return CR_INVALID_DATA;
4679
4680 if (ulFlags & DEVICE_NOTIFY_ALL_INTERFACE_CLASSES)
4681 return CR_INVALID_FLAG;
4682 }
4683 else
4684 {
4685 DPRINT1("Invalid device type %lu\n", ((PDEV_BROADCAST_HDR)pNotificationFilter)->dbch_devicetype);
4686 return CR_INVALID_DATA;
4687 }
4688
4689 return CR_SUCCESS;
4690}
LIST_ENTRY NotificationListHead
Definition: rpcserver.c:41
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define DBT_DEVTYP_HANDLE
Definition: dbt.h:25
struct _DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADC