ReactOS  0.4.10-dev-509-g12e8d7f
umpnpmgr.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winsvc.h>
#include <winuser.h>
#include <dbt.h>
#include <stdio.h>
#include <cmfuncs.h>
#include <rtlfuncs.h>
#include <setypes.h>
#include <umpnpmgr/sysguid.h>
#include <cfgmgr32.h>
#include <regstr.h>
#include <userenv.h>
#include <shlwapi.h>
#include <pnp_s.h>
#include <debug.h>
Include dependency graph for umpnpmgr.c:

Go to the source code of this file.

Classes

struct  DeviceInstallParams
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NDEBUG
 

Functions

static 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)
 
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)
 
DWORD WINAPI PNP_GetDeviceList (handle_t hBinding, LPWSTR pszFilter, LPWSTR Buffer, PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags)
 
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 VOID SplitDeviceInstanceID (IN LPWSTR pszDeviceInstanceID, OUT LPWSTR pszEnumerator, OUT LPWSTR pszDevice, OUT LPWSTR pszInstance)
 
static CONFIGRET CreateDeviceInstance (LPWSTR pszDeviceID)
 
DWORD WINAPI PNP_CreateDevInst (handle_t hBinding, LPWSTR pszDeviceID, LPWSTR pszParentDeviceID, PNP_RPC_STRING_LEN ulLength, DWORD ulFlags)
 
static CONFIGRET MoveDeviceInstance (LPWSTR pszDeviceInstanceDestination, LPWSTR pszDeviceInstanceSource)
 
static CONFIGRET SetupDeviceInstance (LPWSTR pszDeviceInstance, DWORD ulFlags)
 
static CONFIGRET EnableDeviceInstance (LPWSTR pszDeviceInstance)
 
static CONFIGRET DisableDeviceInstance (LPWSTR pszDeviceInstance)
 
static CONFIGRET ReenumerateDeviceInstance (_In_ LPWSTR pszDeviceInstance, _In_ ULONG ulFlags)
 
DWORD WINAPI PNP_DeviceInstanceAction (handle_t hBinding, DWORD ulAction, DWORD ulFlags, 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 ulFlags, DWORD *pulNotify)
 
DWORD WINAPI PNP_UnregisterNotification (handle_t hBinding, DWORD ulNotify)
 
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)
 
static BOOL InstallDevice (PCWSTR DeviceInstance, BOOL ShowWizard)
 
static LONG ReadRegSzKey (IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
 
static BOOL SetupIsActive (VOID)
 
static BOOL IsConsoleBoot (VOID)
 
static DWORD WINAPI DeviceInstallThread (LPVOID lpParameter)
 
static DWORD WINAPI PnpEventThread (LPVOID lpParameter)
 
static VOID UpdateServiceStatus (DWORD dwState)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv)
 
static DWORD InitializePnPManager (VOID)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Variables

static WCHAR ServiceName [] = L"PlugPlay"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 
static WCHAR szRootDeviceId [] = L"HTREE\\ROOT\\0"
 
static HKEY hEnumKey = NULL
 
static HKEY hClassKey = NULL
 
static HANDLE hUserToken = NULL
 
static HANDLE hInstallEvent = NULL
 
static HANDLE hNoPendingInstalls = NULL
 
static LIST_ENTRY DeviceInstallListHead
 
static HANDLE hDeviceInstallListNotEmpty
 

Macro Definition Documentation

#define _INC_WINDOWS

Definition at line 33 of file umpnpmgr.c.

#define COM_NO_WINDOWS_H

Definition at line 34 of file umpnpmgr.c.

#define NDEBUG

Definition at line 53 of file umpnpmgr.c.

#define WIN32_NO_STATUS

Definition at line 32 of file umpnpmgr.c.

Function Documentation

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

Definition at line 2153 of file umpnpmgr.c.

Referenced by PNP_AddID().

2156 {
2157  DWORD dwLen;
2158  DWORD dwPos;
2159 
2160  dwLen = wcslen(lpDeviceId);
2161  dwPos = (*lpDeviceIdListSize / sizeof(WCHAR)) - 1;
2162 
2163  wcscpy(&lpDeviceIdList[dwPos], lpDeviceId);
2164 
2165  dwPos += (dwLen + 1);
2166 
2167  lpDeviceIdList[dwPos] = 0;
2168 
2169  *lpDeviceIdListSize = dwPos * sizeof(WCHAR);
2170 }
#define WCHAR
Definition: msvc.h:43
DWORD DWORD
Definition: winlogon.h:83
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static BOOL CheckForDeviceId ( LPWSTR  lpDeviceIdList,
LPWSTR  lpDeviceId 
)
static

Definition at line 2132 of file umpnpmgr.c.

Referenced by PNP_AddID().

2134 {
2135  LPWSTR lpPtr;
2136  DWORD dwLength;
2137 
2138  lpPtr = lpDeviceIdList;
2139  while (*lpPtr != 0)
2140  {
2141  dwLength = wcslen(lpPtr);
2142  if (0 == _wcsicmp(lpPtr, lpDeviceId))
2143  return TRUE;
2144 
2145  lpPtr += (dwLength + 1);
2146  }
2147 
2148  return FALSE;
2149 }
#define TRUE
Definition: types.h:120
DWORD DWORD
Definition: winlogon.h:83
#define FALSE
Definition: types.h:117
static DWORD DWORD * dwLength
Definition: fusion.c:83
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static CONFIGRET CreateDeviceInstance ( LPWSTR  pszDeviceID)
static

Definition at line 1751 of file umpnpmgr.c.

Referenced by PNP_CreateDevInst().

1752 {
1753  WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
1754  WCHAR szDevice[MAX_DEVICE_ID_LEN];
1755  WCHAR szInstance[MAX_DEVICE_ID_LEN];
1756  HKEY hKeyEnumerator;
1757  HKEY hKeyDevice;
1758  HKEY hKeyInstance;
1759  HKEY hKeyControl;
1760  LONG lError;
1761 
1762  /* Split the instance ID */
1763  SplitDeviceInstanceID(pszDeviceID,
1764  szEnumerator,
1765  szDevice,
1766  szInstance);
1767 
1768  /* Open or create the enumerator key */
1769  lError = RegCreateKeyExW(hEnumKey,
1770  szEnumerator,
1771  0,
1772  NULL,
1775  NULL,
1776  &hKeyEnumerator,
1777  NULL);
1778  if (lError != ERROR_SUCCESS)
1779  {
1780  return CR_REGISTRY_ERROR;
1781  }
1782 
1783  /* Open or create the device key */
1784  lError = RegCreateKeyExW(hKeyEnumerator,
1785  szDevice,
1786  0,
1787  NULL,
1790  NULL,
1791  &hKeyDevice,
1792  NULL);
1793 
1794  /* Close the enumerator key */
1795  RegCloseKey(hKeyEnumerator);
1796 
1797  if (lError != ERROR_SUCCESS)
1798  {
1799  return CR_REGISTRY_ERROR;
1800  }
1801 
1802  /* Try to open the instance key and fail if it exists */
1803  lError = RegOpenKeyExW(hKeyDevice,
1804  szInstance,
1805  0,
1806  KEY_SET_VALUE,
1807  &hKeyInstance);
1808  if (lError == ERROR_SUCCESS)
1809  {
1810  DPRINT1("Instance %S already exists!\n", szInstance);
1811  RegCloseKey(hKeyInstance);
1812  RegCloseKey(hKeyDevice);
1813  return CR_ALREADY_SUCH_DEVINST;
1814  }
1815 
1816  /* Create a new instance key */
1817  lError = RegCreateKeyExW(hKeyDevice,
1818  szInstance,
1819  0,
1820  NULL,
1823  NULL,
1824  &hKeyInstance,
1825  NULL);
1826 
1827  /* Close the device key */
1828  RegCloseKey(hKeyDevice);
1829 
1830  if (lError != ERROR_SUCCESS)
1831  {
1832  return CR_REGISTRY_ERROR;
1833  }
1834 
1835  /* Create the 'Control' sub key */
1836  lError = RegCreateKeyExW(hKeyInstance,
1837  L"Control",
1838  0,
1839  NULL,
1842  NULL,
1843  &hKeyControl,
1844  NULL);
1845  if (lError == ERROR_SUCCESS)
1846  {
1847  RegCloseKey(hKeyControl);
1848  }
1849 
1850  RegCloseKey(hKeyInstance);
1851 
1852  return (lError == ERROR_SUCCESS) ? CR_SUCCESS : CR_REGISTRY_ERROR;
1853 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static VOID SplitDeviceInstanceID(IN LPWSTR pszDeviceInstanceID, OUT LPWSTR pszEnumerator, OUT LPWSTR pszDevice, OUT LPWSTR pszInstance)
Definition: umpnpmgr.c:1706
#define KEY_SET_VALUE
Definition: nt_native.h:1017
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_DEVICE_ID_LEN
Definition: pnpmgr.c:29
#define CR_ALREADY_SUCH_DEVINST
Definition: cfgmgr32.h:862
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:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CR_SUCCESS
Definition: cfgmgr32.h:842
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
HANDLE HKEY
Definition: registry.h:24
static const WCHAR L[]
Definition: oid.c:1087
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
static DWORD WINAPI DeviceInstallThread ( LPVOID  lpParameter)
static

Definition at line 3521 of file umpnpmgr.c.

Referenced by ServiceMain().

3522 {
3523 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3524  PSLIST_ENTRY ListEntry;
3525 #else
3526  PLIST_ENTRY ListEntry;
3527 #endif
3528  DeviceInstallParams* Params;
3529  BOOL showWizard;
3530 
3531  UNREFERENCED_PARAMETER(lpParameter);
3532 
3534 
3535  showWizard = !SetupIsActive() && !IsConsoleBoot();
3536 
3537  while (TRUE)
3538  {
3539 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3541 #else
3543  ListEntry = NULL;
3544  else
3545  ListEntry = RemoveHeadList(&DeviceInstallListHead);
3546 #endif
3547  if (ListEntry == NULL)
3548  {
3551  }
3552  else
3553  {
3555  Params = CONTAINING_RECORD(ListEntry, DeviceInstallParams, ListEntry);
3556  InstallDevice(Params->DeviceIds, showWizard);
3557  }
3558  }
3559 
3560  return 0;
3561 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
static BOOL SetupIsActive(VOID)
Definition: umpnpmgr.c:3445
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
static HANDLE hInstallEvent
Definition: umpnpmgr.c:69
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
static BOOL IsConsoleBoot(VOID)
Definition: umpnpmgr.c:3476
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
WCHAR DeviceIds[1]
Definition: umpnpmgr.c:86
static HANDLE hNoPendingInstalls
Definition: umpnpmgr.c:70
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PSLIST_ENTRY
Definition: rtltypes.h:130
static BOOL InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
Definition: umpnpmgr.c:3226
Definition: typedefs.h:117
static LIST_ENTRY DeviceInstallListHead
Definition: umpnpmgr.c:75
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
#define INFINITE
Definition: serial.h:102
static HANDLE hDeviceInstallListNotEmpty
Definition: umpnpmgr.c:77
static CONFIGRET DisableDeviceInstance ( LPWSTR  pszDeviceInstance)
static

Definition at line 1953 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1954 {
1955  DPRINT("DisableDeviceInstance: not implemented\n");
1956  /* FIXME */
1957  return CR_CALL_NOT_IMPLEMENTED;
1958 }
void DPRINT(...)
Definition: polytest.cpp:61
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 3904 of file umpnpmgr.c.

3907 {
3908  switch (fdwReason)
3909  {
3910  case DLL_PROCESS_ATTACH:
3911  DisableThreadLibraryCalls(hinstDLL);
3913  break;
3914 
3915  case DLL_PROCESS_DETACH:
3916  break;
3917  }
3918 
3919  return TRUE;
3920 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static DWORD InitializePnPManager(VOID)
Definition: umpnpmgr.c:3833
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static CONFIGRET EnableDeviceInstance ( LPWSTR  pszDeviceInstance)
static

Definition at line 1935 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1936 {
1937  PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData;
1939  NTSTATUS Status;
1940 
1941  DPRINT("Enable device instance %S\n", pszDeviceInstance);
1942 
1943  RtlInitUnicodeString(&ResetDeviceData.DeviceInstance, pszDeviceInstance);
1945  if (!NT_SUCCESS(Status))
1946  ret = NtStatusToCrError(Status);
1947 
1948  return ret;
1949 }
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
int ret
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static DWORD InitializePnPManager ( VOID  )
static

Definition at line 3833 of file umpnpmgr.c.

Referenced by DllMain().

3834 {
3835  BOOLEAN OldValue;
3836  DWORD dwError;
3837 
3838  DPRINT("UMPNPMGR: InitializePnPManager() started\n");
3839 
3840  /* We need this privilege for using CreateProcessAsUserW */
3842 
3844  if (hInstallEvent == NULL)
3845  {
3846  dwError = GetLastError();
3847  DPRINT1("Could not create the Install Event! (Error %lu)\n", dwError);
3848  return dwError;
3849  }
3850 
3853  {
3854  dwError = GetLastError();
3855  DPRINT1("Could not create the Event! (Error %lu)\n", dwError);
3856  return dwError;
3857  }
3858 
3860  TRUE,
3861  FALSE,
3862  L"Global\\PnP_No_Pending_Install_Events");
3863  if (hNoPendingInstalls == NULL)
3864  {
3865  dwError = GetLastError();
3866  DPRINT1("Could not create the Event! (Error %lu)\n", dwError);
3867  return dwError;
3868  }
3869 
3870 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3872 #else
3874 #endif
3875 
3877  L"System\\CurrentControlSet\\Enum",
3878  0,
3880  &hEnumKey);
3881  if (dwError != ERROR_SUCCESS)
3882  {
3883  DPRINT1("Could not open the Enum Key! (Error %lu)\n", dwError);
3884  return dwError;
3885  }
3886 
3888  L"System\\CurrentControlSet\\Control\\Class",
3889  0,
3891  &hClassKey);
3892  if (dwError != ERROR_SUCCESS)
3893  {
3894  DPRINT1("Could not open the Class Key! (Error %lu)\n", dwError);
3895  return dwError;
3896  }
3897 
3898  DPRINT("UMPNPMGR: InitializePnPManager() done\n");
3899 
3900  return 0;
3901 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
static BOOL SetupIsActive(VOID)
Definition: umpnpmgr.c:3445
DWORD DWORD
Definition: winlogon.h:83
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hInstallEvent
Definition: umpnpmgr.c:69
#define FALSE
Definition: types.h:117
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static HANDLE hNoPendingInstalls
Definition: umpnpmgr.c:70
unsigned char BOOLEAN
static const WCHAR L[]
Definition: oid.c:1087
static LIST_ENTRY DeviceInstallListHead
Definition: umpnpmgr.c:75
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DPRINT1
Definition: precomp.h:8
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE
Definition: security.c:657
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
static HANDLE hDeviceInstallListNotEmpty
Definition: umpnpmgr.c:77
WINBASEAPI VOID WINAPI InitializeSListHead(_Out_ PSLIST_HEADER ListHead)
Definition: rtlfuncs.h:3353
static HKEY hClassKey
Definition: umpnpmgr.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static BOOL InstallDevice ( PCWSTR  DeviceInstance,
BOOL  ShowWizard 
)
static

Definition at line 3226 of file umpnpmgr.c.

Referenced by DeviceInstallThread().

3227 {
3228  BOOL DeviceInstalled = FALSE;
3230  DWORD Value;
3232  HANDLE hPipe = INVALID_HANDLE_VALUE;
3234  PROCESS_INFORMATION ProcessInfo;
3235  STARTUPINFOW StartupInfo;
3236  UUID RandomUuid;
3237  HKEY DeviceKey;
3238 
3239  /* The following lengths are constant (see below), they cannot overflow */
3240  WCHAR CommandLine[116];
3241  WCHAR InstallEventName[73];
3242  WCHAR PipeName[74];
3243  WCHAR UuidString[39];
3244 
3245  DPRINT("InstallDevice(%S, %d)\n", DeviceInstance, ShowWizard);
3246 
3247  ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
3248 
3249  if (RegOpenKeyExW(hEnumKey,
3251  0,
3253  &DeviceKey) == ERROR_SUCCESS)
3254  {
3255  if (RegQueryValueExW(DeviceKey,
3256  L"Class",
3257  NULL,
3258  NULL,
3259  NULL,
3260  NULL) == ERROR_SUCCESS)
3261  {
3262  DPRINT("No need to install: %S\n", DeviceInstance);
3263  RegCloseKey(DeviceKey);
3264  return TRUE;
3265  }
3266 
3267  BytesWritten = sizeof(DWORD);
3268  if (RegQueryValueExW(DeviceKey,
3269  L"ConfigFlags",
3270  NULL,
3271  NULL,
3272  (PBYTE)&Value,
3273  &BytesWritten) == ERROR_SUCCESS)
3274  {
3275  if (Value & CONFIGFLAG_FAILEDINSTALL)
3276  {
3277  DPRINT("No need to install: %S\n", DeviceInstance);
3278  RegCloseKey(DeviceKey);
3279  return TRUE;
3280  }
3281  }
3282 
3283  RegCloseKey(DeviceKey);
3284  }
3285 
3286  DPRINT1("Installing: %S\n", DeviceInstance);
3287 
3288  /* Create a random UUID for the named pipe & event*/
3289  UuidCreate(&RandomUuid);
3290  swprintf(UuidString, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
3291  RandomUuid.Data1, RandomUuid.Data2, RandomUuid.Data3,
3292  RandomUuid.Data4[0], RandomUuid.Data4[1], RandomUuid.Data4[2],
3293  RandomUuid.Data4[3], RandomUuid.Data4[4], RandomUuid.Data4[5],
3294  RandomUuid.Data4[6], RandomUuid.Data4[7]);
3295 
3296  /* Create the event */
3297  wcscpy(InstallEventName, L"Global\\PNP_Device_Install_Event_0.");
3298  wcscat(InstallEventName, UuidString);
3299  hInstallEvent = CreateEventW(NULL, TRUE, FALSE, InstallEventName);
3300  if (!hInstallEvent)
3301  {
3302  DPRINT1("CreateEventW('%ls') failed with error %lu\n", InstallEventName, GetLastError());
3303  goto cleanup;
3304  }
3305 
3306  /* Create the named pipe */
3307  wcscpy(PipeName, L"\\\\.\\pipe\\PNP_Device_Install_Pipe_0.");
3308  wcscat(PipeName, UuidString);
3309  hPipe = CreateNamedPipeW(PipeName, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_BYTE, 1, 512, 512, 0, NULL);
3310  if (hPipe == INVALID_HANDLE_VALUE)
3311  {
3312  DPRINT1("CreateNamedPipeW failed with error %u\n", GetLastError());
3313  goto cleanup;
3314  }
3315 
3316  /* Launch rundll32 to call ClientSideInstallW */
3317  wcscpy(CommandLine, L"rundll32.exe newdev.dll,ClientSideInstall ");
3318  wcscat(CommandLine, PipeName);
3319 
3320  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
3321  StartupInfo.cb = sizeof(StartupInfo);
3322 
3323  if (hUserToken)
3324  {
3325  /* newdev has to run under the environment of the current user */
3326  if (!CreateEnvironmentBlock(&Environment, hUserToken, FALSE))
3327  {
3328  DPRINT1("CreateEnvironmentBlock failed with error %d\n", GetLastError());
3329  goto cleanup;
3330  }
3331 
3332  if (!CreateProcessAsUserW(hUserToken, NULL, CommandLine, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, Environment, NULL, &StartupInfo, &ProcessInfo))
3333  {
3334  DPRINT1("CreateProcessAsUserW failed with error %u\n", GetLastError());
3335  goto cleanup;
3336  }
3337  }
3338  else
3339  {
3340  /* FIXME: This is probably not correct, I guess newdev should never be run with SYSTEM privileges.
3341 
3342  Still, we currently do that in 2nd stage setup and probably Console mode as well, so allow it here.
3343  (ShowWizard is only set to FALSE for these two modes) */
3344  ASSERT(!ShowWizard);
3345 
3346  if (!CreateProcessW(NULL, CommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &StartupInfo, &ProcessInfo))
3347  {
3348  DPRINT1("CreateProcessW failed with error %u\n", GetLastError());
3349  goto cleanup;
3350  }
3351  }
3352 
3353  /* Wait for the function to connect to our pipe */
3354  if (!ConnectNamedPipe(hPipe, NULL))
3355  {
3357  {
3358  DPRINT1("ConnectNamedPipe failed with error %u\n", GetLastError());
3359  goto cleanup;
3360  }
3361  }
3362 
3363  /* Pass the data. The following output is partly compatible to Windows XP SP2 (researched using a modified newdev.dll to log this stuff) */
3364  Value = sizeof(InstallEventName);
3365  WriteFile(hPipe, &Value, sizeof(Value), &BytesWritten, NULL);
3366  WriteFile(hPipe, InstallEventName, Value, &BytesWritten, NULL);
3367 
3368  /* I couldn't figure out what the following value means under WinXP. It's usually 0 in my tests, but was also 5 once.
3369  Therefore the following line is entirely ReactOS-specific. We use the value here to pass the ShowWizard variable. */
3370  WriteFile(hPipe, &ShowWizard, sizeof(ShowWizard), &BytesWritten, NULL);
3371 
3372  Value = (wcslen(DeviceInstance) + 1) * sizeof(WCHAR);
3373  WriteFile(hPipe, &Value, sizeof(Value), &BytesWritten, NULL);
3374  WriteFile(hPipe, DeviceInstance, Value, &BytesWritten, NULL);
3375 
3376  /* Wait for newdev.dll to finish processing */
3377  WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
3378 
3379  /* If the event got signalled, this is success */
3380  DeviceInstalled = WaitForSingleObject(hInstallEvent, 0) == WAIT_OBJECT_0;
3381 
3382 cleanup:
3383  if (hInstallEvent)
3384  CloseHandle(hInstallEvent);
3385 
3386  if (hPipe != INVALID_HANDLE_VALUE)
3387  CloseHandle(hPipe);
3388 
3389  if (Environment)
3390  DestroyEnvironmentBlock(Environment);
3391 
3392  if (ProcessInfo.hProcess)
3393  CloseHandle(ProcessInfo.hProcess);
3394 
3395  if (ProcessInfo.hThread)
3396  CloseHandle(ProcessInfo.hThread);
3397 
3398  if (!DeviceInstalled)
3399  {
3400  DPRINT1("InstallDevice failed for DeviceInstance '%ws'\n", DeviceInstance);
3401  }
3402 
3403  return DeviceInstalled;
3404 }
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:45
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:186
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:83
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hInstallEvent
Definition: umpnpmgr.c:69
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static HANDLE hUserToken
Definition: umpnpmgr.c:68
#define FALSE
Definition: types.h:117
#define PIPE_TYPE_BYTE
Definition: winbase.h:167
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4650
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WAIT_OBJECT_0
Definition: winbase.h:387
DWORD cb
Definition: winbase.h:817
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define PIPE_ACCESS_OUTBOUND
Definition: winbase.h:166
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:727
#define ERROR_PIPE_CONNECTED
Definition: winerror.h:352
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5184
UINTN UINT8 Value
Definition: acefiex.h:751
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserW(_In_opt_ HANDLE hToken, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
Definition: logon.c:276
DWORD *typedef HANDLE
Definition: winlogon.h:60
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:306
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:246
#define INFINITE
Definition: serial.h:102
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
Definition: npipe.c:701
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
static BOOL IsConsoleBoot ( VOID  )
static

Definition at line 3476 of file umpnpmgr.c.

Referenced by DeviceInstallThread().

3477 {
3478  HKEY ControlKey = NULL;
3479  LPWSTR SystemStartOptions = NULL;
3480  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
3481  BOOL ConsoleBoot = FALSE;
3482  LONG rc;
3483 
3484  rc = RegOpenKeyExW(
3486  L"SYSTEM\\CurrentControlSet\\Control",
3487  0,
3489  &ControlKey);
3490 
3491  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
3492  if (rc != ERROR_SUCCESS)
3493  goto cleanup;
3494 
3495  /* Check for CONSOLE switch in SystemStartOptions */
3496  CurrentOption = SystemStartOptions;
3497  while (CurrentOption)
3498  {
3499  NextOption = wcschr(CurrentOption, L' ');
3500  if (NextOption)
3501  *NextOption = L'\0';
3502  if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
3503  {
3504  DPRINT("Found %S. Switching to console boot\n", CurrentOption);
3505  ConsoleBoot = TRUE;
3506  goto cleanup;
3507  }
3508  CurrentOption = NextOption ? NextOption + 1 : NULL;
3509  }
3510 
3511 cleanup:
3512  if (ControlKey != NULL)
3513  RegCloseKey(ControlKey);
3514  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
3515  return ConsoleBoot;
3516 }
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: umpnpmgr.c:3408
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HANDLE HKEY
Definition: registry.h:24
static const WCHAR L[]
Definition: oid.c:1087
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
void __RPC_FAR* __RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 155 of file umpnpmgr.c.

156 {
158 }
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 161 of file umpnpmgr.c.

162 {
163  HeapFree(GetProcessHeap(), 0, ptr);
164 }
static PVOID ptr
Definition: dispmode.c:27
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394
static CONFIGRET MoveDeviceInstance ( LPWSTR  pszDeviceInstanceDestination,
LPWSTR  pszDeviceInstanceSource 
)
static

Definition at line 1915 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1917 {
1918  DPRINT("MoveDeviceInstance: not implemented\n");
1919  /* FIXME */
1920  return CR_CALL_NOT_IMPLEMENTED;
1921 }
void DPRINT(...)
Definition: polytest.cpp:61
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
static CONFIGRET WINAPI NtStatusToCrError ( NTSTATUS  Status)
static

Definition at line 168 of file umpnpmgr.c.

Referenced by EnableDeviceInstance(), PNP_GetDepth(), PNP_GetDeviceList(), PNP_GetDeviceListSize(), PNP_GetDeviceRegProp(), PNP_GetDeviceStatus(), PNP_GetInterfaceDeviceList(), PNP_GetInterfaceDeviceListSize(), PNP_GetRelatedDeviceInstance(), and ReenumerateDeviceInstance().

169 {
170  switch (Status)
171  {
174 
176  return CR_INVALID_DATA;
177 
179  return CR_NO_SUCH_DEVINST;
180 
182  return CR_ACCESS_DENIED;
183 
185  return CR_BUFFER_SMALL;
186 
188  return CR_NO_SUCH_VALUE;
189 
190  default:
191  return CR_FAILURE;
192  }
193 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define CR_ACCESS_DENIED
Definition: cfgmgr32.h:897
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:52
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define CR_FAILURE
Definition: cfgmgr32.h:865
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
Status
Definition: gdiplustypes.h:24
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define CR_NO_SUCH_DEVINST
Definition: cfgmgr32.h:858
DWORD WINAPI PNP_AddEmptyLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulPriority,
DWORD pulLogConfTag,
DWORD  ulFlags 
)

Definition at line 2612 of file umpnpmgr.c.

Referenced by CM_Add_Empty_Log_Conf_Ex().

2618 {
2619  UNIMPLEMENTED;
2620  return CR_CALL_NOT_IMPLEMENTED;
2621 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_AddID ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszID,
DWORD  ulFlags 
)

Definition at line 2176 of file umpnpmgr.c.

Referenced by CM_Add_ID_ExW().

2181 {
2183  HKEY hDeviceKey;
2184  LPWSTR pszSubKey;
2185  DWORD dwDeviceIdListSize;
2186  DWORD dwNewDeviceIdSize;
2187  WCHAR * pszDeviceIdList = NULL;
2188 
2189  UNREFERENCED_PARAMETER(hBinding);
2190 
2191  DPRINT("PNP_AddID() called\n");
2192  DPRINT(" DeviceInstance: %S\n", pszDeviceID);
2193  DPRINT(" DeviceId: %S\n", pszID);
2194  DPRINT(" Flags: %lx\n", ulFlags);
2195 
2196  if (RegOpenKeyExW(hEnumKey,
2197  pszDeviceID,
2198  0,
2200  &hDeviceKey) != ERROR_SUCCESS)
2201  {
2202  DPRINT("Failed to open the device key!\n");
2203  return CR_INVALID_DEVNODE;
2204  }
2205 
2206  pszSubKey = (ulFlags & CM_ADD_ID_COMPATIBLE) ? L"CompatibleIDs" : L"HardwareID";
2207 
2208  if (RegQueryValueExW(hDeviceKey,
2209  pszSubKey,
2210  NULL,
2211  NULL,
2212  NULL,
2213  &dwDeviceIdListSize) != ERROR_SUCCESS)
2214  {
2215  DPRINT("Failed to query the desired ID string!\n");
2216  ret = CR_REGISTRY_ERROR;
2217  goto Done;
2218  }
2219 
2220  dwNewDeviceIdSize = lstrlenW(pszDeviceID);
2221  if (!dwNewDeviceIdSize)
2222  {
2223  ret = CR_INVALID_POINTER;
2224  goto Done;
2225  }
2226 
2227  dwDeviceIdListSize += (dwNewDeviceIdSize + 2) * sizeof(WCHAR);
2228 
2229  pszDeviceIdList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDeviceIdListSize);
2230  if (!pszDeviceIdList)
2231  {
2232  DPRINT("Failed to allocate memory for the desired ID string!\n");
2233  ret = CR_OUT_OF_MEMORY;
2234  goto Done;
2235  }
2236 
2237  if (RegQueryValueExW(hDeviceKey,
2238  pszSubKey,
2239  NULL,
2240  NULL,
2241  (LPBYTE)pszDeviceIdList,
2242  &dwDeviceIdListSize) != ERROR_SUCCESS)
2243  {
2244  DPRINT("Failed to query the desired ID string!\n");
2245  ret = CR_REGISTRY_ERROR;
2246  goto Done;
2247  }
2248 
2249  /* Check whether the device ID is already in use */
2250  if (CheckForDeviceId(pszDeviceIdList, pszDeviceID))
2251  {
2252  DPRINT("Device ID was found in the ID string!\n");
2253  ret = CR_SUCCESS;
2254  goto Done;
2255  }
2256 
2257  /* Append the Device ID */
2258  AppendDeviceId(pszDeviceIdList, &dwDeviceIdListSize, pszID);
2259 
2260  if (RegSetValueExW(hDeviceKey,
2261  pszSubKey,
2262  0,
2263  REG_MULTI_SZ,
2264  (LPBYTE)pszDeviceIdList,
2265  dwDeviceIdListSize) != ERROR_SUCCESS)
2266  {
2267  DPRINT("Failed to set the desired ID string!\n");
2268  ret = CR_REGISTRY_ERROR;
2269  }
2270 
2271 Done:
2272  RegCloseKey(hDeviceKey);
2273  if (pszDeviceIdList)
2274  HeapFree(GetProcessHeap(), 0, pszDeviceIdList);
2275 
2276  DPRINT("PNP_AddID() done (returns %lx)\n", ret);
2277 
2278  return ret;
2279 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#define lstrlenW
Definition: compat.h:407
DWORD DWORD
Definition: winlogon.h:83
#define CM_ADD_ID_COMPATIBLE
Definition: cfgmgr32.h:615
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define CR_SUCCESS
Definition: cfgmgr32.h:842
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define CR_OUT_OF_MEMORY
Definition: cfgmgr32.h:844
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:4917
static VOID AppendDeviceId(LPWSTR lpDeviceIdList, LPDWORD lpDeviceIdListSize, LPWSTR lpDeviceId)
Definition: umpnpmgr.c:2153
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
static BOOL CheckForDeviceId(LPWSTR lpDeviceIdList, LPWSTR lpDeviceId)
Definition: umpnpmgr.c:2132
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define CR_INVALID_DEVNODE
Definition: cfgmgr32.h:847
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
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 2689 of file umpnpmgr.c.

2699 {
2700  UNIMPLEMENTED;
2701  return CR_CALL_NOT_IMPLEMENTED;
2702 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_ApplyPowerSettings ( handle_t  hBinding)

Definition at line 3160 of file umpnpmgr.c.

3162 {
3163  UNIMPLEMENTED;
3164  return CR_CALL_NOT_IMPLEMENTED;
3165 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_Connect ( handle_t  hBinding)

Definition at line 210 of file umpnpmgr.c.

212 {
213  UNREFERENCED_PARAMETER(hBinding);
214  return CR_SUCCESS;
215 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
DWORD WINAPI PNP_CreateDevInst ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszParentDeviceID,
PNP_RPC_STRING_LEN  ulLength,
DWORD  ulFlags 
)

Definition at line 1859 of file umpnpmgr.c.

Referenced by CM_Create_DevNode_ExW().

1865 {
1867 
1868  DPRINT("PNP_CreateDevInst: %S\n", pszDeviceID);
1869 
1870  if (ulFlags & CM_CREATE_DEVNODE_GENERATE_ID)
1871  {
1872  WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
1873  DWORD dwInstanceNumber;
1874 
1875  /* Generated ID is: Root<Device ID><Instance number> */
1876  dwInstanceNumber = 0;
1877  do
1878  {
1879  swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
1880  pszDeviceID, dwInstanceNumber);
1881 
1882  /* Try to create a device instance with this ID */
1883  ret = CreateDeviceInstance(szGeneratedInstance);
1884 
1885  dwInstanceNumber++;
1886  }
1887  while (ret == CR_ALREADY_SUCH_DEVINST);
1888 
1889  if (ret == CR_SUCCESS)
1890  {
1891  /* pszDeviceID is an out parameter too for generated IDs */
1892  if (wcslen(szGeneratedInstance) > ulLength)
1893  {
1894  ret = CR_BUFFER_SMALL;
1895  }
1896  else
1897  {
1898  wcscpy(pszDeviceID, szGeneratedInstance);
1899  }
1900  }
1901  }
1902  else
1903  {
1904  /* Create the device instance */
1905  ret = CreateDeviceInstance(pszDeviceID);
1906  }
1907 
1908  DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
1909 
1910  return ret;
1911 }
#define CM_CREATE_DEVNODE_GENERATE_ID
Definition: cfgmgr32.h:622
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_DEVICE_ID_LEN
Definition: pnpmgr.c:29
#define CR_ALREADY_SUCH_DEVINST
Definition: cfgmgr32.h:862
DWORD DWORD
Definition: winlogon.h:83
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
static CONFIGRET CreateDeviceInstance(LPWSTR pszDeviceID)
Definition: umpnpmgr.c:1751
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define swprintf(buf, format,...)
Definition: sprintf.c:56
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
DWORD WINAPI PNP_CreateKey ( handle_t  hBinding,
LPWSTR  pszSubKey,
DWORD  samDesired,
DWORD  ulFlags 
)

Definition at line 1174 of file umpnpmgr.c.

1179 {
1180  HKEY hKey = 0;
1181 
1183  pszSubKey,
1184  0,
1185  NULL,
1186  0,
1188  NULL,
1189  &hKey,
1190  NULL))
1191  return CR_REGISTRY_ERROR;
1192 
1193  /* FIXME: Set security key */
1194 
1195  RegCloseKey(hKey);
1196 
1197  return CR_SUCCESS;
1198 }
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:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
HANDLE HKEY
Definition: registry.h:24
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD WINAPI PNP_DeleteClassKey ( handle_t  hBinding,
LPWSTR  pszClassGuid,
DWORD  ulFlags 
)

Definition at line 1318 of file umpnpmgr.c.

Referenced by CM_Delete_Class_Key_Ex().

1322 {
1324 
1325  UNREFERENCED_PARAMETER(hBinding);
1326 
1327  DPRINT("PNP_GetClassName(%S, %lx) called\n", pszClassGuid, ulFlags);
1328 
1329  if (ulFlags & CM_DELETE_CLASS_SUBKEYS)
1330  {
1331  if (SHDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
1332  ret = CR_REGISTRY_ERROR;
1333  }
1334  else
1335  {
1336  if (RegDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
1337  ret = CR_REGISTRY_ERROR;
1338  }
1339 
1340  DPRINT("PNP_DeleteClassKey() done (returns %lx)\n", ret);
1341 
1342  return ret;
1343 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CM_DELETE_CLASS_SUBKEYS
Definition: cfgmgr32.h:635
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
int ret
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
static HKEY hClassKey
Definition: umpnpmgr.c:66
DWORD WINAPI PNP_DeleteRegistryKey ( handle_t  hBinding,
LPWSTR  pszDeviceID,
LPWSTR  pszParentKey,
LPWSTR  pszChildKey,
DWORD  ulFlags 
)

Definition at line 1204 of file umpnpmgr.c.

1210 {
1211  UNIMPLEMENTED;
1212  return CR_CALL_NOT_IMPLEMENTED;
1213 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_DeleteServiceDevices ( handle_t  hBinding)

Definition at line 3217 of file umpnpmgr.c.

3219 {
3220  UNIMPLEMENTED;
3221  return CR_CALL_NOT_IMPLEMENTED;
3222 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 2803 of file umpnpmgr.c.

2811 {
2812  UNIMPLEMENTED;
2813  return CR_CALL_NOT_IMPLEMENTED;
2814 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_DeviceInstanceAction ( handle_t  hBinding,
DWORD  ulAction,
DWORD  ulFlags,
LPWSTR  pszDeviceInstance1,
LPWSTR  pszDeviceInstance2 
)

Definition at line 1998 of file umpnpmgr.c.

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

2004 {
2006 
2007  UNREFERENCED_PARAMETER(hBinding);
2008 
2009  DPRINT("PNP_DeviceInstanceAction() called\n");
2010 
2011  switch (ulAction)
2012  {
2013  case PNP_DEVINST_MOVE:
2014  ret = MoveDeviceInstance(pszDeviceInstance1,
2015  pszDeviceInstance2);
2016  break;
2017 
2018  case PNP_DEVINST_SETUP:
2019  ret = SetupDeviceInstance(pszDeviceInstance1,
2020  ulFlags);
2021  break;
2022 
2023  case PNP_DEVINST_ENABLE:
2024  ret = EnableDeviceInstance(pszDeviceInstance1);
2025  break;
2026 
2027  case PNP_DEVINST_DISABLE:
2028  ret = DisableDeviceInstance(pszDeviceInstance1);
2029  break;
2030 
2031  case PNP_DEVINST_REENUMERATE:
2032  ret = ReenumerateDeviceInstance(pszDeviceInstance1,
2033  ulFlags);
2034  break;
2035 
2036  default:
2037  DPRINT1("Unknown device action %lu: not implemented\n", ulAction);
2039  }
2040 
2041  DPRINT("PNP_DeviceInstanceAction() done (returns %lx)\n", ret);
2042 
2043  return ret;
2044 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static CONFIGRET DisableDeviceInstance(LPWSTR pszDeviceInstance)
Definition: umpnpmgr.c:1953
static CONFIGRET ReenumerateDeviceInstance(_In_ LPWSTR pszDeviceInstance, _In_ ULONG ulFlags)
Definition: umpnpmgr.c:1962
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
int ret
static CONFIGRET SetupDeviceInstance(LPWSTR pszDeviceInstance, DWORD ulFlags)
Definition: umpnpmgr.c:1925
static CONFIGRET EnableDeviceInstance(LPWSTR pszDeviceInstance)
Definition: umpnpmgr.c:1935
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DPRINT1
Definition: precomp.h:8
static CONFIGRET MoveDeviceInstance(LPWSTR pszDeviceInstanceDestination, LPWSTR pszDeviceInstanceSource)
Definition: umpnpmgr.c:1915
DWORD WINAPI PNP_DisableDevInst ( handle_t  hBinding,
LPWSTR  pDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 2106 of file umpnpmgr.c.

2113 {
2114  UNIMPLEMENTED;
2115  return CR_CALL_NOT_IMPLEMENTED;
2116 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_Disconnect ( handle_t  hBinding)

Definition at line 199 of file umpnpmgr.c.

201 {
202  UNREFERENCED_PARAMETER(hBinding);
203  return CR_SUCCESS;
204 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
DWORD WINAPI PNP_DriverStoreAddDriverPackage ( handle_t  hBinding)

Definition at line 3171 of file umpnpmgr.c.

3173 {
3174  UNIMPLEMENTED;
3175  return CR_CALL_NOT_IMPLEMENTED;
3176 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_DriverStoreDeleteDriverPackage ( handle_t  hBinding)

Definition at line 3182 of file umpnpmgr.c.

3184 {
3185  UNIMPLEMENTED;
3186  return CR_CALL_NOT_IMPLEMENTED;
3187 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 438 of file umpnpmgr.c.

Referenced by CM_Enumerate_Classes_Ex(), and CM_Enumerate_Enumerators_ExW().

446 {
448  HKEY hKey;
449  DWORD dwError;
450 
451  UNREFERENCED_PARAMETER(hBinding);
452  UNREFERENCED_PARAMETER(ulFlags);
453 
454  DPRINT("PNP_EnumerateSubKeys() called\n");
455 
456  switch (ulBranch)
457  {
458  case PNP_ENUMERATOR_SUBKEYS:
459  hKey = hEnumKey;
460  break;
461 
462  case PNP_CLASS_SUBKEYS:
463  hKey = hClassKey;
464  break;
465 
466  default:
467  return CR_FAILURE;
468  }
469 
470  *pulRequiredLen = ulLength;
471  dwError = RegEnumKeyExW(hKey,
472  ulIndex,
473  Buffer,
474  pulRequiredLen,
475  NULL,
476  NULL,
477  NULL,
478  NULL);
479  if (dwError != ERROR_SUCCESS)
480  {
481  ret = (dwError == ERROR_NO_MORE_ITEMS) ? CR_NO_SUCH_VALUE : CR_FAILURE;
482  }
483  else
484  {
485  (*pulRequiredLen)++;
486  }
487 
488  DPRINT("PNP_EnumerateSubKeys() done (returns %lx)\n", ret);
489 
490  return ret;
491 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
DWORD DWORD
Definition: winlogon.h:83
#define CR_SUCCESS
Definition: cfgmgr32.h:842
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
HANDLE HKEY
Definition: registry.h:24
#define CR_FAILURE
Definition: cfgmgr32.h:865
int ret
ULONG ulIndex
Definition: symbols.c:92
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
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:2541
static HKEY hClassKey
Definition: umpnpmgr.c:66
DWORD WINAPI PNP_FreeLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD  ulLogConfTag,
DWORD  ulFlags 
)

Definition at line 2627 of file umpnpmgr.c.

Referenced by CM_Free_Log_Conf_Ex().

2633 {
2634  UNIMPLEMENTED;
2635  return CR_CALL_NOT_IMPLEMENTED;
2636 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 2708 of file umpnpmgr.c.

2718 {
2719  UNIMPLEMENTED;
2720  return CR_CALL_NOT_IMPLEMENTED;
2721 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetBlockedDriverInfo ( handle_t  hBinding,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE pulTransferLen,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 3051 of file umpnpmgr.c.

Referenced by CMP_GetBlockedDriverInfo().

3057 {
3058  UNIMPLEMENTED;
3059  return CR_CALL_NOT_IMPLEMENTED;
3060 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetClassCount ( handle_t  hBinding,
DWORD pulClassCount,
DWORD  ulFlags 
)

Definition at line 1219 of file umpnpmgr.c.

1223 {
1224  HKEY hKey;
1225  DWORD dwError;
1226 
1227  UNREFERENCED_PARAMETER(hBinding);
1228  UNREFERENCED_PARAMETER(ulFlags);
1229 
1232  0,
1234  &hKey);
1235  if (dwError != ERROR_SUCCESS)
1236  return CR_INVALID_DATA;
1237 
1238  dwError = RegQueryInfoKeyW(hKey,
1239  NULL,
1240  NULL,
1241  NULL,
1242  pulClassCount,
1243  NULL,
1244  NULL,
1245  NULL,
1246  NULL,
1247  NULL,
1248  NULL,
1249  NULL);
1250  RegCloseKey(hKey);
1251  if (dwError != ERROR_SUCCESS)
1252  return CR_INVALID_DATA;
1253 
1254  return CR_SUCCESS;
1255 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
HANDLE HKEY
Definition: registry.h:24
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:3704
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REGSTR_PATH_CLASS
Definition: regstr.h:42
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD WINAPI PNP_GetClassInstance ( handle_t  hBinding,
LPWSTR  pDeviceId,
LPWSTR  pszClassInstance,
PNP_RPC_STRING_LEN  ulLength 
)

Definition at line 1160 of file umpnpmgr.c.

1165 {
1166  UNIMPLEMENTED;
1167  return CR_CALL_NOT_IMPLEMENTED;
1168 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetClassName ( handle_t  hBinding,
LPWSTR  pszClassGuid,
LPWSTR  Buffer,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 1261 of file umpnpmgr.c.

Referenced by CM_Get_Class_Name_ExW().

1267 {
1268  WCHAR szKeyName[MAX_PATH];
1270  HKEY hKey;
1271  DWORD dwSize;
1272 
1273  UNREFERENCED_PARAMETER(hBinding);
1274  UNREFERENCED_PARAMETER(ulFlags);
1275 
1276  DPRINT("PNP_GetClassName() called\n");
1277 
1278  lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class\\");
1279  if (lstrlenW(pszClassGuid) + 1 < sizeof(szKeyName)/sizeof(WCHAR)-(lstrlenW(szKeyName) * sizeof(WCHAR)))
1280  lstrcatW(szKeyName, pszClassGuid);
1281  else
1282  return CR_INVALID_DATA;
1283 
1285  szKeyName,
1286  0,
1288  &hKey))
1289  return CR_REGISTRY_ERROR;
1290 
1291  dwSize = *pulLength * sizeof(WCHAR);
1292  if (RegQueryValueExW(hKey,
1293  L"Class",
1294  NULL,
1295  NULL,
1296  (LPBYTE)Buffer,
1297  &dwSize))
1298  {
1299  *pulLength = 0;
1300  ret = CR_REGISTRY_ERROR;
1301  }
1302  else
1303  {
1304  *pulLength = dwSize / sizeof(WCHAR);
1305  }
1306 
1307  RegCloseKey(hKey);
1308 
1309  DPRINT("PNP_GetClassName() done (returns %lx)\n", ret);
1310 
1311  return ret;
1312 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#define WCHAR
Definition: msvc.h:43
#define lstrlenW
Definition: compat.h:407
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define lstrcpyW
Definition: compat.h:406
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD dwSize
Definition: wglext.h:734
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 1482 of file umpnpmgr.c.

Referenced by CM_Get_Class_Registry_PropertyW().

1491 {
1493  LPWSTR lpValueName = NULL;
1494  HKEY hInstKey = NULL;
1495  HKEY hPropKey = NULL;
1496  LONG lError;
1497 
1498  UNREFERENCED_PARAMETER(hBinding);
1499 
1500  DPRINT("PNP_GetClassRegProp() called\n");
1501 
1502  if (pulTransferLen == NULL || pulLength == NULL)
1503  {
1504  ret = CR_INVALID_POINTER;
1505  goto done;
1506  }
1507 
1508  if (ulFlags != 0)
1509  {
1510  ret = CR_INVALID_FLAG;
1511  goto done;
1512  }
1513 
1514  if (*pulLength < *pulTransferLen)
1515  *pulLength = *pulTransferLen;
1516 
1517  *pulTransferLen = 0;
1518 
1519  switch (ulProperty)
1520  {
1521  case CM_CRP_SECURITY:
1522  lpValueName = L"Security";
1523  break;
1524 
1525  case CM_CRP_DEVTYPE:
1526  lpValueName = L"DeviceType";
1527  break;
1528 
1529  case CM_CRP_EXCLUSIVE:
1530  lpValueName = L"Exclusive";
1531  break;
1532 
1534  lpValueName = L"DeviceCharacteristics";
1535  break;
1536 
1537  default:
1538  ret = CR_INVALID_PROPERTY;
1539  goto done;
1540  }
1541 
1542  DPRINT("Value name: %S\n", lpValueName);
1543 
1544  lError = RegOpenKeyExW(hClassKey,
1545  pszClassGuid,
1546  0,
1547  KEY_READ,
1548  &hInstKey);
1549  if (lError != ERROR_SUCCESS)
1550  {
1551  *pulLength = 0;
1553  goto done;
1554  }
1555 
1556  lError = RegOpenKeyExW(hInstKey,
1557  L"Properties",
1558  0,
1559  KEY_READ,
1560  &hPropKey);
1561  if (lError != ERROR_SUCCESS)
1562  {
1563  *pulLength = 0;
1565  goto done;
1566  }
1567 
1568  lError = RegQueryValueExW(hPropKey,
1569  lpValueName,
1570  NULL,
1571  pulRegDataType,
1572  Buffer,
1573  pulLength);
1574  if (lError != ERROR_SUCCESS)
1575  {
1576  if (lError == ERROR_MORE_DATA)
1577  {
1578  ret = CR_BUFFER_SMALL;
1579  }
1580  else
1581  {
1582  *pulLength = 0;
1583  ret = CR_NO_SUCH_VALUE;
1584  }
1585  }
1586 
1587 done:
1588  if (ret == CR_SUCCESS)
1589  *pulTransferLen = *pulLength;
1590 
1591  if (hPropKey != NULL)
1592  RegCloseKey(hPropKey);
1593 
1594  if (hInstKey != NULL)
1595  RegCloseKey(hInstKey);
1596 
1597  DPRINT("PNP_GetClassRegProp() done (returns %lx)\n", ret);
1598 
1599  return ret;
1600 }
#define CR_NO_SUCH_REGISTRY_KEY
Definition: cfgmgr32.h:892
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CM_CRP_DEVTYPE
Definition: cfgmgr32.h:710
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define CM_CRP_CHARACTERISTICS
Definition: cfgmgr32.h:714
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CM_CRP_EXCLUSIVE
Definition: cfgmgr32.h:712
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define CM_CRP_SECURITY
Definition: cfgmgr32.h:706
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define ERROR_MORE_DATA
Definition: dderror.h:13
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HKEY hClassKey
Definition: umpnpmgr.c:66
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 2941 of file umpnpmgr.c.

Referenced by CM_Get_DevNode_Custom_Property_ExW().

2950 {
2951  HKEY hDeviceKey = NULL;
2952  HKEY hParamKey = NULL;
2953  LONG lError;
2955 
2956  UNREFERENCED_PARAMETER(hBinding);
2957 
2958  DPRINT("PNP_GetCustomDevProp() called\n");
2959 
2960  if (pulTransferLen == NULL || pulLength == NULL)
2961  {
2962  ret = CR_INVALID_POINTER;
2963  goto done;
2964  }
2965 
2966  if (ulFlags & ~CM_CUSTOMDEVPROP_BITS)
2967  {
2968  ret = CR_INVALID_FLAG;
2969  goto done;
2970  }
2971 
2972  if (*pulLength < *pulTransferLen)
2973  *pulLength = *pulTransferLen;
2974 
2975  *pulTransferLen = 0;
2976 
2977  lError = RegOpenKeyExW(hEnumKey,
2978  pDeviceID,
2979  0,
2980  KEY_READ,
2981  &hDeviceKey);
2982  if (lError != ERROR_SUCCESS)
2983  {
2984  ret = CR_REGISTRY_ERROR;
2985  goto done;
2986  }
2987 
2988  lError = RegOpenKeyExW(hDeviceKey,
2989  L"Device Parameters",
2990  0,
2991  KEY_READ,
2992  &hParamKey);
2993  if (lError != ERROR_SUCCESS)
2994  {
2995  ret = CR_REGISTRY_ERROR;
2996  goto done;
2997  }
2998 
2999  lError = RegQueryValueExW(hParamKey,
3000  CustomPropName,
3001  NULL,
3002  pulRegDataType,
3003  Buffer,
3004  pulLength);
3005  if (lError != ERROR_SUCCESS)
3006  {
3007  if (lError == ERROR_MORE_DATA)
3008  {
3009  ret = CR_BUFFER_SMALL;
3010  }
3011  else
3012  {
3013  *pulLength = 0;
3014  ret = CR_NO_SUCH_VALUE;
3015  }
3016  }
3017 
3018 done:
3019  if (ret == CR_SUCCESS)
3020  *pulTransferLen = *pulLength;
3021 
3022  if (hParamKey != NULL)
3023  RegCloseKey(hParamKey);
3024 
3025  if (hDeviceKey != NULL)
3026  RegCloseKey(hDeviceKey);
3027 
3028  DPRINT("PNP_GetCustomDevProp() done (returns %lx)\n", ret);
3029 
3030  return ret;
3031 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CR_SUCCESS
Definition: cfgmgr32.h:842
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define CM_CUSTOMDEVPROP_BITS
Definition: cfgmgr32.h:836
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
DWORD WINAPI PNP_GetDepth ( handle_t  hBinding,
LPWSTR  pszDeviceID,
DWORD pulDepth,
DWORD  ulFlags 
)

Definition at line 659 of file umpnpmgr.c.

Referenced by CM_Get_Depth_Ex().

664 {
665  PLUGPLAY_CONTROL_DEPTH_DATA PlugPlayData;
668 
669  UNREFERENCED_PARAMETER(hBinding);
670  UNREFERENCED_PARAMETER(ulFlags);
671 
672  DPRINT("PNP_GetDepth() called\n");
673 
674  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
675  pszDeviceID);
676 
678  (PVOID)&PlugPlayData,
680  if (NT_SUCCESS(Status))
681  {
682  *pulDepth = PlugPlayData.Depth;
683  }
684  else
685  {
686  ret = NtStatusToCrError(Status);
687  }
688 
689  DPRINT("PNP_GetDepth() done (returns %lx)\n", ret);
690 
691  return ret;
692 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
int ret
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:495
DWORD WINAPI PNP_GetDeviceList ( handle_t  hBinding,
LPWSTR  pszFilter,
LPWSTR  Buffer,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 497 of file umpnpmgr.c.

Referenced by CM_Get_Device_ID_List_ExW().

503 {
507 
508  DPRINT("PNP_GetDeviceList() called\n");
509 
510  if (ulFlags & ~CM_GETIDLIST_FILTER_BITS)
511  return CR_INVALID_FLAG;
512 
513  if (pulLength == NULL || pszFilter == NULL)
514  return CR_INVALID_POINTER;
515 
516 // if (Buffer == NULL)
517 // return CR_INVALID_POINTER;
518 
519  if (ulFlags &
524  {
525  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
526  pszFilter);
527  if (ulFlags & CM_GETIDLIST_FILTER_BUSRELATIONS)
528  {
529  PlugPlayData.Relations = 3;
530  }
531  else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
532  {
533  PlugPlayData.Relations = 2;
534  }
535  else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
536  {
537  PlugPlayData.Relations = 1;
538  }
539  else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
540  {
541  PlugPlayData.Relations = 0;
542  }
543 
544  PlugPlayData.BufferSize = *pulLength * sizeof(WCHAR);
545  PlugPlayData.Buffer = Buffer;
546 
548  (PVOID)&PlugPlayData,
550  if (NT_SUCCESS(Status))
551  {
552  *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
553  }
554  else
555  {
556  ret = NtStatusToCrError(Status);
557  }
558  }
559  else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
560  {
562  }
563  else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
564  {
566  }
567  else /* CM_GETIDLIST_FILTER_NONE */
568  {
570  }
571 
572  return ret;
573 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define CM_GETIDLIST_FILTER_SERVICE
Definition: cfgmgr32.h:656
#define WCHAR
Definition: msvc.h:43
#define CM_GETIDLIST_FILTER_BUSRELATIONS
Definition: cfgmgr32.h:660
#define CM_GETIDLIST_FILTER_EJECTRELATIONS
Definition: cfgmgr32.h:657
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define CM_GETIDLIST_FILTER_REMOVALRELATIONS
Definition: cfgmgr32.h:658
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINTN VOID * Buffer
Definition: acefiex.h:370
#define CM_GETIDLIST_FILTER_POWERRELATIONS
Definition: cfgmgr32.h:659
int ret
Status
Definition: gdiplustypes.h:24
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
#define CM_GETIDLIST_FILTER_ENUMERATOR
Definition: cfgmgr32.h:655
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CM_GETIDLIST_FILTER_BITS
Definition: cfgmgr32.h:669
DWORD WINAPI PNP_GetDeviceListSize ( handle_t  hBinding,
LPWSTR  pszFilter,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 579 of file umpnpmgr.c.

Referenced by CM_Get_Device_ID_List_Size_ExW().

584 {
588 
589  DPRINT("PNP_GetDeviceListSize() called\n");
590 
591  if (ulFlags & ~CM_GETIDLIST_FILTER_BITS)
592  return CR_INVALID_FLAG;
593 
594  if (pulLength == NULL || pszFilter == NULL)
595  return CR_INVALID_POINTER;
596 
597  *pulLength = 0;
598 
599  if (ulFlags &
604  {
605  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
606  pszFilter);
607  if (ulFlags & CM_GETIDLIST_FILTER_BUSRELATIONS)
608  {
609  PlugPlayData.Relations = 3;
610  }
611  else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
612  {
613  PlugPlayData.Relations = 2;
614  }
615  else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
616  {
617  PlugPlayData.Relations = 1;
618  }
619  else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
620  {
621  PlugPlayData.Relations = 0;
622  }
623 
624  PlugPlayData.BufferSize = 0;
625  PlugPlayData.Buffer = NULL;
626 
628  (PVOID)&PlugPlayData,
630  if (NT_SUCCESS(Status))
631  {
632  *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
633  }
634  else
635  {
636  ret = NtStatusToCrError(Status);
637  }
638  }
639  else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
640  {
642  }
643  else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
644  {
646  }
647  else /* CM_GETIDLIST_FILTER_NONE */
648  {
650  }
651 
652  return ret;
653 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define CM_GETIDLIST_FILTER_SERVICE
Definition: cfgmgr32.h:656
#define WCHAR
Definition: msvc.h:43
#define CM_GETIDLIST_FILTER_BUSRELATIONS
Definition: cfgmgr32.h:660
#define CM_GETIDLIST_FILTER_EJECTRELATIONS
Definition: cfgmgr32.h:657
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define CM_GETIDLIST_FILTER_REMOVALRELATIONS
Definition: cfgmgr32.h:658
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define CM_GETIDLIST_FILTER_POWERRELATIONS
Definition: cfgmgr32.h:659
int ret
Status
Definition: gdiplustypes.h:24
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
#define CM_GETIDLIST_FILTER_ENUMERATOR
Definition: cfgmgr32.h:655
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CM_GETIDLIST_FILTER_BITS
Definition: cfgmgr32.h:669
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 698 of file umpnpmgr.c.

Referenced by CM_Get_DevNode_Registry_Property_ExW(), and GetDeviceInstanceKeyPath().

707 {
708  PLUGPLAY_CONTROL_PROPERTY_DATA PlugPlayData;
710  LPWSTR lpValueName = NULL;
711  HKEY hKey = NULL;
712  LONG lError;
714 
715  UNREFERENCED_PARAMETER(hBinding);
716 
717  DPRINT("PNP_GetDeviceRegProp() called\n");
718 
719  if (pulTransferLen == NULL || pulLength == NULL)
720  {
721  ret = CR_INVALID_POINTER;
722  goto done;
723  }
724 
725  if (ulFlags != 0)
726  {
727  ret = CR_INVALID_FLAG;
728  goto done;
729  }
730 
731  /* FIXME: Check pDeviceID */
732 
733  if (*pulLength < *pulTransferLen)
734  *pulLength = *pulTransferLen;
735 
736  *pulTransferLen = 0;
737 
738  switch (ulProperty)
739  {
740  case CM_DRP_DEVICEDESC:
741  lpValueName = L"DeviceDesc";
742  break;
743 
744  case CM_DRP_HARDWAREID:
745  lpValueName = L"HardwareID";
746  break;
747 
749  lpValueName = L"CompatibleIDs";
750  break;
751 
752  case CM_DRP_SERVICE:
753  lpValueName = L"Service";
754  break;
755 
756  case CM_DRP_CLASS:
757  lpValueName = L"Class";
758  break;
759 
760  case CM_DRP_CLASSGUID:
761  lpValueName = L"ClassGUID";
762  break;
763 
764  case CM_DRP_DRIVER:
765  lpValueName = L"Driver";
766  break;
767 
768  case CM_DRP_CONFIGFLAGS:
769  lpValueName = L"ConfigFlags";
770  break;
771 
772  case CM_DRP_MFG:
773  lpValueName = L"Mfg";
774  break;
775 
776  case CM_DRP_FRIENDLYNAME:
777  lpValueName = L"FriendlyName";
778  break;
779 
781  lpValueName = L"LocationInformation";
782  break;
783 
785  lpValueName = NULL;
786  break;
787 
788  case CM_DRP_CAPABILITIES:
789  lpValueName = L"Capabilities";
790  break;
791 
792  case CM_DRP_UI_NUMBER:
793  lpValueName = NULL;
794  break;
795 
796  case CM_DRP_UPPERFILTERS:
797  lpValueName = L"UpperFilters";
798  break;
799 
800  case CM_DRP_LOWERFILTERS:
801  lpValueName = L"LowerFilters";
802  break;
803 
804  case CM_DRP_BUSTYPEGUID:
805  lpValueName = NULL;
806  break;
807 
809  lpValueName = NULL;
810  break;
811 
812  case CM_DRP_BUSNUMBER:
813  lpValueName = NULL;
814  break;
815 
817  lpValueName = NULL;
818  break;
819 
820  case CM_DRP_SECURITY:
821  lpValueName = L"Security";
822  break;
823 
824  case CM_DRP_DEVTYPE:
825  lpValueName = L"DeviceType";
826  break;
827 
828  case CM_DRP_EXCLUSIVE:
829  lpValueName = L"Exclusive";
830  break;
831 
833  lpValueName = L"DeviceCharacteristics";
834  break;
835 
836  case CM_DRP_ADDRESS:
837  lpValueName = NULL;
838  break;
839 
841  lpValueName = L"UINumberDescFormat";
842  break;
843 
845  lpValueName = NULL;
846  break;
847 
849  lpValueName = NULL;
850  break;
851 
853  lpValueName = NULL;
854  break;
855 
857  lpValueName = L"RemovalPolicy";
858  break;
859 
861  lpValueName = NULL;
862  break;
863 
864 #if (WINVER >= _WIN32_WINNT_WS03)
866  lpValueName = NULL;
867  break;
868 #endif
869 
870 #if (WINVER >= _WIN32_WINNT_WIN7)
872  lpValueName = NULL;
873  break;
874 #endif
875 
876  default:
877  ret = CR_INVALID_PROPERTY;
878  goto done;
879  }
880 
881  DPRINT("Value name: %S\n", lpValueName);
882 
883  if (lpValueName)
884  {
885  /* Retrieve information from the Registry */
886  lError = RegOpenKeyExW(hEnumKey,
887  pDeviceID,
888  0,
890  &hKey);
891  if (lError != ERROR_SUCCESS)
892  {
893  hKey = NULL;
894  *pulLength = 0;
895  ret = CR_INVALID_DEVNODE;
896  goto done;
897  }
898 
899  lError = RegQueryValueExW(hKey,
900  lpValueName,
901  NULL,
902  pulRegDataType,
903  Buffer,
904  pulLength);
905  if (lError != ERROR_SUCCESS)
906  {
907  if (lError == ERROR_MORE_DATA)
908  {
909  ret = CR_BUFFER_SMALL;
910  }
911  else
912  {
913  *pulLength = 0;
914  ret = CR_NO_SUCH_VALUE;
915  }
916  }
917  }
918  else
919  {
920  /* Retrieve information from the Device Node */
921  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
922  pDeviceID);
923  PlugPlayData.Buffer = Buffer;
924  PlugPlayData.BufferSize = *pulLength;
925 
926  switch (ulProperty)
927  {
930  break;
931 
932  case CM_DRP_UI_NUMBER:
933  PlugPlayData.Property = PNP_PROPERTY_UI_NUMBER;
934  break;
935 
936  case CM_DRP_BUSTYPEGUID:
937  PlugPlayData.Property = PNP_PROPERTY_BUSTYPEGUID;
938  break;
939 
941  PlugPlayData.Property = PNP_PROPERTY_LEGACYBUSTYPE;
942  break;
943 
944  case CM_DRP_BUSNUMBER:
945  PlugPlayData.Property = PNP_PROPERTY_BUSNUMBER;
946  break;
947 
949  PlugPlayData.Property = PNP_PROPERTY_ENUMERATOR_NAME;
950  break;
951 
952  case CM_DRP_ADDRESS:
953  PlugPlayData.Property = PNP_PROPERTY_ADDRESS;
954  break;
955 
957  PlugPlayData.Property = PNP_PROPERTY_POWER_DATA;
958  break;
959 
961  PlugPlayData.Property = PNP_PROPERTY_REMOVAL_POLICY;
962  break;
963 
966  break;
967 
969  PlugPlayData.Property = PNP_PROPERTY_INSTALL_STATE;
970  break;
971 
972 #if (WINVER >= _WIN32_WINNT_WS03)
974  PlugPlayData.Property = PNP_PROPERTY_LOCATION_PATHS;
975  break;
976 #endif
977 
978 #if (WINVER >= _WIN32_WINNT_WIN7)
980  PlugPlayData.Property = PNP_PROPERTY_CONTAINERID;
981  break;
982 #endif
983 
984  default:
985  return CR_INVALID_PROPERTY;
986  }
987 
989  (PVOID)&PlugPlayData,
991  if (NT_SUCCESS(Status))
992  {
993  *pulLength = PlugPlayData.BufferSize;
994  }
995  else
996  {
997  ret = NtStatusToCrError(Status);
998  }
999  }
1000 
1001 done:
1002 
1003  if (pulTransferLen)
1004  *pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0;
1005 
1006  if (hKey != NULL)
1007  RegCloseKey(hKey);
1008 
1009  DPRINT("PNP_GetDeviceRegProp() done (returns %lx)\n", ret);
1010 
1011  return ret;
1012 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define PNP_PROPERTY_POWER_DATA
Definition: cmtypes.h:39
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CM_DRP_REMOVAL_POLICY_HW_DEFAULT
Definition: cfgmgr32.h:720
#define CM_DRP_FRIENDLYNAME
Definition: cfgmgr32.h:688
#define CM_DRP_EXCLUSIVE
Definition: cfgmgr32.h:711
#define CM_DRP_LEGACYBUSTYPE
Definition: cfgmgr32.h:702
#define CM_DRP_BUSTYPEGUID
Definition: cfgmgr32.h:701
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define CM_DRP_SERVICE
Definition: cfgmgr32.h:680
#define CM_DRP_COMPATIBLEIDS
Definition: cfgmgr32.h:678
#define CM_DRP_REMOVAL_POLICY
Definition: cfgmgr32.h:719
#define CM_DRP_SECURITY
Definition: cfgmgr32.h:705
#define CM_DRP_UPPERFILTERS
Definition: cfgmgr32.h:693
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CM_DRP_LOWERFILTERS
Definition: cfgmgr32.h:697
long LONG
Definition: pedump.c:60
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define CM_DRP_ENUMERATOR_NAME
Definition: cfgmgr32.h:704
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
#define CM_DRP_CLASSGUID
Definition: cfgmgr32.h:684
#define PNP_PROPERTY_BUSTYPEGUID
Definition: cmtypes.h:36
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT
Definition: cmtypes.h:44
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define CM_DRP_DEVTYPE
Definition: cfgmgr32.h:709
#define PNP_PROPERTY_ADDRESS
Definition: cmtypes.h:42
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:468
#define PNP_PROPERTY_LOCATION_PATHS
Definition: cmtypes.h:46
#define PNP_PROPERTY_ENUMERATOR_NAME
Definition: cmtypes.h:43
LONG NTSTATUS
Definition: precomp.h:26
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
HANDLE HKEY
Definition: registry.h:24
#define PNP_PROPERTY_REMOVAL_POLICY
Definition: cmtypes.h:40
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define CM_DRP_HARDWAREID
Definition: cfgmgr32.h:677
#define CM_DRP_REMOVAL_POLICY_OVERRIDE
Definition: cfgmgr32.h:721
#define CM_DRP_LOCATION_INFORMATION
Definition: cfgmgr32.h:689
UINTN VOID * Buffer
Definition: acefiex.h:370
#define CM_DRP_BASE_CONTAINERID
Definition: cfgmgr32.h:728
#define PNP_PROPERTY_UI_NUMBER
Definition: cmtypes.h:34
#define CM_DRP_DRIVER
Definition: cfgmgr32.h:685
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
#define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cfgmgr32.h:690
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cmtypes.h:35
#define CR_INVALID_DEVNODE
Definition: cfgmgr32.h:847
#define CM_DRP_UI_NUMBER
Definition: cfgmgr32.h:692
#define CM_DRP_DEVICE_POWER_DATA
Definition: cfgmgr32.h:718
#define CM_DRP_MFG
Definition: cfgmgr32.h:687
#define ERROR_MORE_DATA
Definition: dderror.h:13
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
#define CM_DRP_CHARACTERISTICS
Definition: cfgmgr32.h:713
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define CM_DRP_CONFIGFLAGS
Definition: cfgmgr32.h:686
#define PNP_PROPERTY_LEGACYBUSTYPE
Definition: cmtypes.h:37
#define CM_DRP_CLASS
Definition: cfgmgr32.h:683
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define PNP_PROPERTY_INSTALL_STATE
Definition: cmtypes.h:45
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define CM_DRP_ADDRESS
Definition: cfgmgr32.h:715
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CM_DRP_UI_NUMBER_DESC_FORMAT
Definition: cfgmgr32.h:716
#define CM_DRP_LOCATION_PATHS
Definition: cfgmgr32.h:725
#define PNP_PROPERTY_BUSNUMBER
Definition: cmtypes.h:38
#define PNP_PROPERTY_CONTAINERID
Definition: cmtypes.h:47
#define CM_DRP_INSTALL_STATE
Definition: cfgmgr32.h:722
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CM_DRP_CAPABILITIES
Definition: cfgmgr32.h:691
#define CM_DRP_BUSNUMBER
Definition: cfgmgr32.h:703
DWORD WINAPI PNP_GetDeviceStatus ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD pulStatus,
DWORD pulProblem,
DWORD  ulFlags 
)

Definition at line 2050 of file umpnpmgr.c.

Referenced by CM_Get_DevNode_Status_Ex().

2056 {
2057  PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
2059  NTSTATUS Status;
2060 
2061  UNREFERENCED_PARAMETER(hBinding);
2062  UNREFERENCED_PARAMETER(ulFlags);
2063 
2064  DPRINT("PNP_GetDeviceStatus() called\n");
2065 
2066  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
2067  pDeviceID);
2068  PlugPlayData.Operation = 0; /* Get status */
2069 
2071  (PVOID)&PlugPlayData,
2073  if (NT_SUCCESS(Status))
2074  {
2075  *pulStatus = PlugPlayData.DeviceStatus;
2076  *pulProblem = PlugPlayData.DeviceProblem;
2077  }
2078  else
2079  {
2080  ret = NtStatusToCrError(Status);
2081  }
2082 
2083  DPRINT("PNP_GetDeviceStatus() done (returns %lx)\n", ret);
2084 
2085  return ret;
2086 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:486
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
int ret
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
DWORD WINAPI PNP_GetFirstLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD pulLogConfTag,
DWORD  ulFlags 
)

Definition at line 2642 of file umpnpmgr.c.

Referenced by CM_Get_First_Log_Conf_Ex().

2648 {
2649  UNIMPLEMENTED;
2650  return CR_CALL_NOT_IMPLEMENTED;
2651 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetGlobalState ( handle_t  hBinding,
DWORD pulState,
DWORD  ulFlags 
)

Definition at line 235 of file umpnpmgr.c.

Referenced by CM_Get_Global_State_Ex().

239 {
240  UNREFERENCED_PARAMETER(hBinding);
241  UNREFERENCED_PARAMETER(ulFlags);
242 
244  return CR_SUCCESS;
245 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define CM_GLOBAL_STATE_SERVICES_AVAILABLE
Definition: cfgmgr32.h:910
#define CM_GLOBAL_STATE_CAN_DO_UI
Definition: cfgmgr32.h:908
DWORD WINAPI PNP_GetHwProfInfo ( handle_t  hBinding,
DWORD  ulIndex,
HWPROFILEINFO pHWProfileInfo,
DWORD  ulProfileInfoSize,
DWORD  ulFlags 
)

Definition at line 2477 of file umpnpmgr.c.

Referenced by CM_Get_Hardware_Profile_Info_ExW().

2483 {
2484  WCHAR szProfileName[5];
2485  HKEY hKeyConfig = NULL;
2486  HKEY hKeyProfiles = NULL;
2487  HKEY hKeyProfile = NULL;
2488  DWORD dwDisposition;
2489  DWORD dwSize;
2490  LONG lError;
2492 
2493  UNREFERENCED_PARAMETER(hBinding);
2494 
2495  DPRINT("PNP_GetHwProfInfo() called\n");
2496 
2497  if (ulProfileInfoSize == 0)
2498  {
2499  ret = CR_INVALID_DATA;
2500  goto done;
2501  }
2502 
2503  if (ulFlags != 0)
2504  {
2505  ret = CR_INVALID_FLAG;
2506  goto done;
2507  }
2508 
2509  /* Initialize the profile information */
2510  pHWProfileInfo->HWPI_ulHWProfile = 0;
2511  pHWProfileInfo->HWPI_szFriendlyName[0] = 0;
2512  pHWProfileInfo->HWPI_dwFlags = 0;
2513 
2514  /* Open the 'IDConfigDB' key */
2516  L"System\\CurrentControlSet\\Control\\IDConfigDB",
2517  0,
2518  NULL,
2521  NULL,
2522  &hKeyConfig,
2523  &dwDisposition);
2524  if (lError != ERROR_SUCCESS)
2525  {
2526  ret = CR_REGISTRY_ERROR;
2527  goto done;
2528  }
2529 
2530  /* Open the 'Hardware Profiles' subkey */
2531  lError = RegCreateKeyExW(hKeyConfig,
2532  L"Hardware Profiles",
2533  0,
2534  NULL,
2537  NULL,
2538  &hKeyProfiles,
2539  &dwDisposition);
2540  if (lError != ERROR_SUCCESS)
2541  {
2542  ret = CR_REGISTRY_ERROR;
2543  goto done;
2544  }
2545 
2546  if (ulIndex == (ULONG)-1)
2547  {
2548  dwSize = sizeof(ULONG);
2549  lError = RegQueryValueExW(hKeyConfig,
2550  L"CurrentConfig",
2551  NULL,
2552  NULL,
2553  (LPBYTE)&pHWProfileInfo->HWPI_ulHWProfile,
2554  &dwSize);
2555  if (lError != ERROR_SUCCESS)
2556  {
2557  pHWProfileInfo->HWPI_ulHWProfile = 0;
2558  ret = CR_REGISTRY_ERROR;
2559  goto done;
2560  }
2561  }
2562  else
2563  {
2564  /* FIXME: not implemented yet */
2566  goto done;
2567  }
2568 
2569  swprintf(szProfileName, L"%04lu", pHWProfileInfo->HWPI_ulHWProfile);
2570 
2571  lError = RegOpenKeyExW(hKeyProfiles,
2572  szProfileName,
2573  0,
2575  &hKeyProfile);
2576  if (lError != ERROR_SUCCESS)
2577  {
2578  ret = CR_REGISTRY_ERROR;
2579  goto done;
2580  }
2581 
2582  dwSize = sizeof(pHWProfileInfo->HWPI_szFriendlyName);
2583  lError = RegQueryValueExW(hKeyProfile,
2584  L"FriendlyName",
2585  NULL,
2586  NULL,
2587  (LPBYTE)&pHWProfileInfo->HWPI_szFriendlyName,
2588  &dwSize);
2589  if (lError != ERROR_SUCCESS)
2590  {
2591  ret = CR_REGISTRY_ERROR;
2592  goto done;
2593  }
2594 
2595 done:
2596  if (hKeyProfile != NULL)
2597  RegCloseKey(hKeyProfile);
2598 
2599  if (hKeyProfiles != NULL)
2600  RegCloseKey(hKeyProfiles);
2601 
2602  if (hKeyConfig != NULL)
2603  RegCloseKey(hKeyConfig);
2604 
2605  return ret;
2606 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
DWORD HWPI_dwFlags
Definition: cfgmgr32.h:556
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD DWORD
Definition: winlogon.h:83
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:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
int ret
static const WCHAR L[]
Definition: oid.c:1087
ULONG HWPI_ulHWProfile
Definition: cfgmgr32.h:554
ULONG ulIndex
Definition: symbols.c:92
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
CHAR HWPI_szFriendlyName[MAX_PROFILE_LEN]
Definition: cfgmgr32.h:555
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
DWORD dwSize
Definition: wglext.h:734
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 1349 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_Alias_ExW().

1357 {
1358  UNIMPLEMENTED;
1359  return CR_CALL_NOT_IMPLEMENTED;
1360 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetInterfaceDeviceList ( handle_t  hBinding,
GUID InterfaceGuid,
LPWSTR  pszDeviceID,
BYTE Buffer,
PNP_RPC_BUFFER_SIZE pulLength,
DWORD  ulFlags 
)

Definition at line 1366 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_List_ExW().

1373 {
1374  NTSTATUS Status;
1376  DWORD ret = CR_SUCCESS;
1377 
1378  UNREFERENCED_PARAMETER(hBinding);
1379 
1380  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
1381  pszDeviceID);
1382 
1383  PlugPlayData.Flags = ulFlags;
1384  PlugPlayData.FilterGuid = InterfaceGuid;
1385  PlugPlayData.Buffer = Buffer;
1386  PlugPlayData.BufferSize = *pulLength;
1387 
1389  (PVOID)&PlugPlayData,
1391  if (NT_SUCCESS(Status))
1392  {
1393  *pulLength = PlugPlayData.BufferSize;
1394  }
1395  else
1396  {
1397  ret = NtStatusToCrError(Status);
1398  }
1399 
1400  DPRINT("PNP_GetInterfaceDeviceListSize() done (returns %lx)\n", ret);
1401  return ret;
1402 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:83
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINTN VOID * Buffer
Definition: acefiex.h:370
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
DWORD WINAPI PNP_GetInterfaceDeviceListSize ( handle_t  hBinding,
PNP_RPC_BUFFER_SIZE pulLen,
GUID InterfaceGuid,
LPWSTR  pszDeviceID,
DWORD  ulFlags 
)

Definition at line 1408 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_List_Size_ExW().

1414 {
1415  NTSTATUS Status;
1417  DWORD ret = CR_SUCCESS;
1418 
1419  UNREFERENCED_PARAMETER(hBinding);
1420 
1421  DPRINT("PNP_GetInterfaceDeviceListSize() called\n");
1422 
1423  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
1424  pszDeviceID);
1425 
1426  PlugPlayData.FilterGuid = InterfaceGuid;
1427  PlugPlayData.Buffer = NULL;
1428  PlugPlayData.BufferSize = 0;
1429  PlugPlayData.Flags = ulFlags;
1430 
1432  (PVOID)&PlugPlayData,
1434  if (NT_SUCCESS(Status))
1435  {
1436  *pulLen = PlugPlayData.BufferSize;
1437  }
1438  else
1439  {
1440  ret = NtStatusToCrError(Status);
1441  }
1442 
1443  DPRINT("PNP_GetInterfaceDeviceListSize() done (returns %lx)\n", ret);
1444  return ret;
1445 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:83
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
DWORD WINAPI PNP_GetLogConfPriority ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulType,
DWORD  ulTag,
DWORD pPriority,
DWORD  ulFlags 
)

Definition at line 2673 of file umpnpmgr.c.

Referenced by CM_Get_Log_Conf_Priority_Ex().

2680 {
2681  UNIMPLEMENTED;
2682  return CR_CALL_NOT_IMPLEMENTED;
2683 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetNextLogConf ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfType,
DWORD  ulCurrentTag,
DWORD pulNextTag,
DWORD  ulFlags 
)

Definition at line 2657 of file umpnpmgr.c.

Referenced by CM_Get_Next_Log_Conf_Ex().

2664 {
2665  UNIMPLEMENTED;
2666  return CR_CALL_NOT_IMPLEMENTED;
2667 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 2727 of file umpnpmgr.c.

2737 {
2738  UNIMPLEMENTED;
2739  return CR_CALL_NOT_IMPLEMENTED;
2740 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 3110 of file umpnpmgr.c.

3121 {
3122  UNIMPLEMENTED;
3123  return CR_CALL_NOT_IMPLEMENTED;
3124 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 3092 of file umpnpmgr.c.

3101 {
3102  UNIMPLEMENTED;
3103  return CR_CALL_NOT_IMPLEMENTED;
3104 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetRelatedDeviceInstance ( handle_t  hBinding,
DWORD  ulRelationship,
LPWSTR  pDeviceID,
LPWSTR  pRelatedDeviceId,
PNP_RPC_STRING_LEN pulLength,
DWORD  ulFlags 
)

Definition at line 390 of file umpnpmgr.c.

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

397 {
401 
402  UNREFERENCED_PARAMETER(hBinding);
403  UNREFERENCED_PARAMETER(ulFlags);
404 
405  DPRINT("PNP_GetRelatedDeviceInstance() called\n");
406  DPRINT(" Relationship %ld\n", ulRelationship);
407  DPRINT(" DeviceId %S\n", pDeviceID);
408 
410  pDeviceID);
411 
412  PlugPlayData.Relation = ulRelationship;
413 
414  PlugPlayData.RelatedDeviceInstanceLength = *pulLength;
415  PlugPlayData.RelatedDeviceInstance = pRelatedDeviceId;
416 
418  (PVOID)&PlugPlayData,
420  if (!NT_SUCCESS(Status))
421  {
422  ret = NtStatusToCrError(Status);
423  }
424 
425  DPRINT("PNP_GetRelatedDeviceInstance() done (returns %lx)\n", ret);
426  if (ret == CR_SUCCESS)
427  {
428  DPRINT("RelatedDevice: %wZ\n", &PlugPlayData.RelatedDeviceInstance);
429  }
430 
431  return ret;
432 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
int ret
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
Definition: plugplay.c:1227
static CONFIGRET WINAPI NtStatusToCrError(NTSTATUS Status)
Definition: umpnpmgr.c:168
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
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 2746 of file umpnpmgr.c.

2756 {
2757  UNIMPLEMENTED;
2758  return CR_CALL_NOT_IMPLEMENTED;
2759 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetResDesDataSize ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulLogConfTag,
DWORD  ulLogConfType,
RESOURCEID  ResourceID,
DWORD  ulResourceTag,
DWORD pulSize,
DWORD  ulFlags 
)

Definition at line 2765 of file umpnpmgr.c.

2774 {
2775  UNIMPLEMENTED;
2776  return CR_CALL_NOT_IMPLEMENTED;
2777 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_GetRootDeviceInstance ( handle_t  hBinding,
LPWSTR  pDeviceID,
PNP_RPC_STRING_LEN  ulLength 
)

Definition at line 355 of file umpnpmgr.c.

Referenced by CM_Locate_DevNode_ExW().

359 {
361 
362  UNREFERENCED_PARAMETER(hBinding);
363 
364  DPRINT("PNP_GetRootDeviceInstance() called\n");
365 
366  if (!pDeviceID)
367  {
368  ret = CR_INVALID_POINTER;
369  goto Done;
370  }
371  if (ulLength < lstrlenW(szRootDeviceId) + 1)
372  {
373  ret = CR_BUFFER_SMALL;
374  goto Done;
375  }
376 
377  lstrcpyW(pDeviceID,
379 
380 Done:
381  DPRINT("PNP_GetRootDeviceInstance() done (returns %lx)\n", ret);
382 
383  return ret;
384 }
static WCHAR szRootDeviceId[]
Definition: umpnpmgr.c:63
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define lstrlenW
Definition: compat.h:407
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
int ret
#define lstrcpyW
Definition: compat.h:406
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
DWORD WINAPI PNP_GetServerSideDeviceInstallFlags ( handle_t  hBinding,
DWORD pulSSDIFlags,
DWORD  ulFlags 
)

Definition at line 3066 of file umpnpmgr.c.

Referenced by CMP_GetServerSideDeviceInstallFlags().

3070 {
3071  UNREFERENCED_PARAMETER(hBinding);
3072 
3073  DPRINT1("PNP_GetServerSideDeviceInstallFlags(%p %p %lu)\n",
3074  hBinding, pulSSDIFlags, ulFlags);
3075 
3076  if (pulSSDIFlags == NULL)
3077  return CR_INVALID_POINTER;
3078 
3079  if (ulFlags != 0)
3080  return CR_INVALID_FLAG;
3081 
3082  /* FIXME */
3083  *pulSSDIFlags = 0;
3084 
3085  return CR_SUCCESS;
3086 }
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
DWORD WINAPI PNP_GetVersion ( handle_t  hBinding,
WORD pVersion 
)

Definition at line 221 of file umpnpmgr.c.

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

224 {
225  UNREFERENCED_PARAMETER(hBinding);
226 
227  *pVersion = 0x0400;
228  return CR_SUCCESS;
229 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
DWORD WINAPI PNP_GetVersionInternal ( handle_t  hBinding,
WORD pwVersion 
)

Definition at line 3037 of file umpnpmgr.c.

3040 {
3041  UNREFERENCED_PARAMETER(hBinding);
3042 
3043  *pwVersion = 0x501;
3044  return CR_SUCCESS;
3045 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
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 2396 of file umpnpmgr.c.

Referenced by CM_Get_HW_Prof_Flags_ExW(), and CM_Set_HW_Prof_Flags_ExW().

2406 {
2408  WCHAR szKeyName[MAX_PATH];
2409  HKEY hKey;
2410  HKEY hDeviceKey;
2411  DWORD dwSize;
2412 
2413  UNREFERENCED_PARAMETER(hBinding);
2414 
2415  DPRINT("PNP_HwProfFlags() called\n");
2416 
2417  if (ulConfig == 0)
2418  {
2419  wcscpy(szKeyName,
2420  L"System\\CurrentControlSet\\HardwareProfiles\\Current\\System\\CurrentControlSet\\Enum");
2421  }
2422  else
2423  {
2424  swprintf(szKeyName,
2425  L"System\\CurrentControlSet\\HardwareProfiles\\%04lu\\System\\CurrentControlSet\\Enum",
2426  ulConfig);
2427  }
2428 
2430  szKeyName,
2431  0,
2433  &hKey) != ERROR_SUCCESS)
2434  return CR_REGISTRY_ERROR;
2435 
2436  if (ulAction == PNP_GET_HWPROFFLAGS)
2437  {
2438  if (RegOpenKeyExW(hKey,
2439  pDeviceID,
2440  0,
2442  &hDeviceKey) != ERROR_SUCCESS)
2443  {
2444  *pulValue = 0;
2445  }
2446  else
2447  {
2448  dwSize = sizeof(DWORD);
2449  if (RegQueryValueExW(hDeviceKey,
2450  L"CSConfigFlags",
2451  NULL,
2452  NULL,
2453  (LPBYTE)pulValue,
2454  &dwSize) != ERROR_SUCCESS)
2455  {
2456  *pulValue = 0;
2457  }
2458 
2459  RegCloseKey(hDeviceKey);
2460  }
2461  }
2462  else if (ulAction == PNP_SET_HWPROFFLAGS)
2463  {
2464  /* FIXME: not implemented yet */
2466  }
2467 
2468  RegCloseKey(hKey);
2469 
2470  return ret;
2471 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD dwSize
Definition: wglext.h:734
DWORD WINAPI PNP_InitDetection ( handle_t  hBinding)

Definition at line 251 of file umpnpmgr.c.

Referenced by CMP_Init_Detection().

253 {
254  UNREFERENCED_PARAMETER(hBinding);
255 
256  DPRINT("PNP_InitDetection() called\n");
257  return CR_SUCCESS;
258 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
DWORD WINAPI PNP_InstallDevInst ( handle_t  hBinding)

Definition at line 3149 of file umpnpmgr.c.

3151 {
3152  UNIMPLEMENTED;
3153  return CR_CALL_NOT_IMPLEMENTED;
3154 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
CONFIGRET WINAPI PNP_IsDockStationPresent ( handle_t  hBinding,
BOOL Present 
)

Definition at line 2330 of file umpnpmgr.c.

Referenced by CM_Is_Dock_Station_Present_Ex().

2333 {
2334  HKEY hKey;
2335  DWORD dwType;
2336  DWORD dwValue;
2337  DWORD dwSize;
2339 
2340  UNREFERENCED_PARAMETER(hBinding);
2341 
2342  DPRINT1("PNP_IsDockStationPresent() called\n");
2343 
2344  *Present = FALSE;
2345 
2347  L"CurrentDockInfo",
2348  0,
2349  KEY_READ,
2350  &hKey) != ERROR_SUCCESS)
2351  return CR_REGISTRY_ERROR;
2352 
2353  dwSize = sizeof(DWORD);
2354  if (RegQueryValueExW(hKey,
2355  L"DockingState",
2356  NULL,
2357  &dwType,
2358  (LPBYTE)&dwValue,
2359  &dwSize) != ERROR_SUCCESS)
2360  ret = CR_REGISTRY_ERROR;
2361 
2362  RegCloseKey(hKey);
2363 
2364  if (ret == CR_SUCCESS)
2365  {
2366  if (dwType != REG_DWORD || dwSize != sizeof(DWORD))
2367  {
2368  ret = CR_REGISTRY_ERROR;
2369  }
2370  else if (dwValue != 0)
2371  {
2372  *Present = TRUE;
2373  }
2374  }
2375 
2376  DPRINT1("PNP_IsDockStationPresent() done (returns %lx)\n", ret);
2377 
2378  return ret;
2379 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
unsigned char * LPBYTE
Definition: typedefs.h:52
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
int ret
static const WCHAR L[]
Definition: oid.c:1087
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define REG_DWORD
Definition: sdbapi.c:539
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
DWORD dwSize
Definition: wglext.h:734
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 2783 of file umpnpmgr.c.

2794 {
2795  UNIMPLEMENTED;
2796  return CR_CALL_NOT_IMPLEMENTED;
2797 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_QueryArbitratorFreeData ( handle_t  hBinding,
BYTE pData,
DWORD  DataLen,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
DWORD  ulFlags 
)

Definition at line 2851 of file umpnpmgr.c.

Referenced by CM_Query_Arbitrator_Free_Data_Ex().

2858 {
2859  UNIMPLEMENTED;
2860  return CR_CALL_NOT_IMPLEMENTED;
2861 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_QueryArbitratorFreeSize ( handle_t  hBinding,
DWORD pulSize,
LPWSTR  pDeviceID,
RESOURCEID  ResourceID,
DWORD  ulFlags 
)

Definition at line 2867 of file umpnpmgr.c.

Referenced by CM_Query_Arbitrator_Free_Size_Ex().

2873 {
2874  UNIMPLEMENTED;
2875  return CR_CALL_NOT_IMPLEMENTED;
2876 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_QueryRemove ( handle_t  hBinding,
LPWSTR  pszDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 2298 of file umpnpmgr.c.

Referenced by CM_Query_And_Remove_SubTree_ExW().

2305 {
2306  UNIMPLEMENTED;
2307  return CR_CALL_NOT_IMPLEMENTED;
2308 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 2820 of file umpnpmgr.c.

Referenced by CM_Query_Resource_Conflict_List().

2829 {
2830  UNIMPLEMENTED;
2831  return CR_CALL_NOT_IMPLEMENTED;
2832 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
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 1451 of file umpnpmgr.c.

Referenced by CM_Register_Device_Interface_ExW().

1460 {
1461  UNIMPLEMENTED;
1462  return CR_CALL_NOT_IMPLEMENTED;
1463 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_RegisterDriver ( handle_t  hBinding,
LPWSTR  pszDeviceID,
DWORD  ulFlags 
)

Definition at line 2285 of file umpnpmgr.c.

Referenced by CM_Register_Device_Driver_Ex().

2289 {
2290  UNIMPLEMENTED;
2291  return CR_CALL_NOT_IMPLEMENTED;
2292 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_RegisterNotification ( handle_t  hBinding,
DWORD  ulFlags,
DWORD pulNotify 
)

Definition at line 2893 of file umpnpmgr.c.

Referenced by CMP_RegisterNotification().

2897 {
2898 #if 0
2899  PNOTIFY_DATA pNotifyData;
2900 #endif
2901 
2902  DPRINT1("PNP_RegisterNotification(%p 0x%lx %p)\n",
2903  hBinding, ulFlags, pulNotify);
2904 
2905 #if 0
2906  pNotifyData = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NOTIFY_DATA));
2907  if (pNotifyData == NULL)
2908  return CR_OUT_OF_MEMORY;
2909 
2910  *pulNotify = (DWORD)pNotifyData;
2911 #endif
2912 
2913  *pulNotify = 1;
2914 
2915  return CR_SUCCESS;
2916 }
#define DWORD
Definition: msvc.h:34
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define CR_OUT_OF_MEMORY
Definition: cfgmgr32.h:844
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
#define GetProcessHeap()
Definition: compat.h:395
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DPRINT1
Definition: precomp.h:8
DWORD WINAPI PNP_RegisterServiceNotification ( handle_t  hBinding)

Definition at line 3193 of file umpnpmgr.c.

3195 {
3196  UNIMPLEMENTED;
3197  return CR_CALL_NOT_IMPLEMENTED;
3198 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_ReportLogOn ( handle_t  hBinding,
BOOL  Admin,
DWORD  ProcessId 
)

Definition at line 264 of file umpnpmgr.c.

Referenced by CMP_Report_LogOn().

268 {
271 
272  UNREFERENCED_PARAMETER(hBinding);
273  UNREFERENCED_PARAMETER(Admin);
274 
275  DPRINT("PNP_ReportLogOn(%u, %u) called\n", Admin, ProcessId);
276 
277  /* Get the users token */
279 
280  if (!hProcess)
281  {
282  DPRINT1("OpenProcess failed with error %u\n", GetLastError());
283  goto cleanup;
284  }
285 
286  if (hUserToken)
287  {
289  hUserToken = NULL;
290  }
291 
293  {
294  DPRINT1("OpenProcessToken failed with error %u\n", GetLastError());
295  goto cleanup;
296  }
297 
298  /* Trigger the installer thread */
299  if (hInstallEvent)
301 
302  ReturnValue = CR_SUCCESS;
303 
304 cleanup:
305  if (hProcess)
306  CloseHandle(hProcess);
307 
308  return ReturnValue;
309 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define TOKEN_ASSIGN_PRIMARY
Definition: setypes.h:871
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
DWORD DWORD
Definition: winlogon.h:83
static HANDLE hInstallEvent
Definition: umpnpmgr.c:69
static HANDLE hUserToken
Definition: umpnpmgr.c:68
UINT32 void void ** ReturnValue
Definition: acevents.h:192
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define TOKEN_QUERY
Definition: setypes.h:874
#define CR_FAILURE
Definition: cfgmgr32.h:865
#define TOKEN_DUPLICATE
Definition: setypes.h:872
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1284
DWORD *typedef HANDLE
Definition: winlogon.h:60
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:292
#define DPRINT1
Definition: precomp.h:8
char * cleanup(char *str)
Definition: wpickclick.c:99
DWORD WINAPI PNP_RequestDeviceEject ( handle_t  hBinding,
LPWSTR  pszDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 2314 of file umpnpmgr.c.

Referenced by CM_Request_Device_Eject_ExW().

2321 {
2322  UNIMPLEMENTED;
2323  return CR_CALL_NOT_IMPLEMENTED;
2324 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_RequestEjectPC ( handle_t  hBinding)

Definition at line 2385 of file umpnpmgr.c.

Referenced by CM_Request_Eject_PC_Ex().

2387 {
2388  UNIMPLEMENTED;
2389  return CR_CALL_NOT_IMPLEMENTED;
2390 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
CONFIGRET WINAPI PNP_RunDetection ( handle_t  hBinding,
DWORD  ulFlags 
)

Definition at line 2882 of file umpnpmgr.c.

Referenced by CM_Run_Detection_Ex().

2885 {
2886  return CR_CALL_NOT_IMPLEMENTED;
2887 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
DWORD WINAPI PNP_SetActiveService ( handle_t  hBinding,
LPWSTR  pszFilter,
DWORD  ulFlags 
)

Definition at line 3204 of file umpnpmgr.c.

3208 {
3209  UNIMPLEMENTED;
3210  return CR_CALL_NOT_IMPLEMENTED;
3211 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_SetClassRegProp ( handle_t  hBinding,
LPWSTR  pszClassGuid,
DWORD  ulProperty,
DWORD  ulDataType,
BYTE Buffer,
PNP_PROP_SIZE  ulLength,
DWORD  ulFlags 
)

Definition at line 1606 of file umpnpmgr.c.

1614 {
1616  LPWSTR lpValueName = NULL;
1617  HKEY hInstKey = 0;
1618  HKEY hPropKey = 0;
1619  LONG lError;
1620 
1621  UNREFERENCED_PARAMETER(hBinding);
1622 
1623  DPRINT("PNP_SetClassRegProp() called\n");
1624 
1625  if (ulFlags != 0)
1626  return CR_INVALID_FLAG;
1627 
1628  switch (ulProperty)
1629  {
1630  case CM_CRP_SECURITY:
1631  lpValueName = L"Security";
1632  break;
1633 
1634  case CM_CRP_DEVTYPE:
1635  lpValueName = L"DeviceType";
1636  break;
1637 
1638  case CM_CRP_EXCLUSIVE:
1639  lpValueName = L"Exclusive";
1640  break;
1641 
1643  lpValueName = L"DeviceCharacteristics";
1644  break;
1645 
1646  default:
1647  return CR_INVALID_PROPERTY;
1648  }
1649 
1650  lError = RegOpenKeyExW(hClassKey,
1651  pszClassGuid,
1652  0,
1653  KEY_WRITE,
1654  &hInstKey);
1655  if (lError != ERROR_SUCCESS)
1656  {
1658  goto done;
1659  }
1660 
1661  /* FIXME: Set security descriptor */
1662  lError = RegCreateKeyExW(hInstKey,
1663  L"Properties",
1664  0,
1665  NULL,
1668  NULL,
1669  &hPropKey,
1670  NULL);
1671  if (lError != ERROR_SUCCESS)
1672  {
1673  ret = CR_REGISTRY_ERROR;
1674  goto done;
1675  }
1676 
1677  if (ulLength == 0)
1678  {
1679  if (RegDeleteValueW(hPropKey,
1680  lpValueName))
1681  ret = CR_REGISTRY_ERROR;
1682  }
1683  else
1684  {
1685  if (RegSetValueExW(hPropKey,
1686  lpValueName,
1687  0,
1688  ulDataType,
1689  Buffer,
1690  ulLength))
1691  ret = CR_REGISTRY_ERROR;
1692  }
1693 
1694 done:
1695  if (hPropKey != NULL)
1696  RegCloseKey(hPropKey);
1697 
1698  if (hInstKey != NULL)
1699  RegCloseKey(hInstKey);
1700 
1701  return ret;
1702 }
#define CR_NO_SUCH_REGISTRY_KEY
Definition: cfgmgr32.h:892
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define CM_CRP_DEVTYPE
Definition: cfgmgr32.h:710
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:1094
#define CM_CRP_CHARACTERISTICS
Definition: cfgmgr32.h:714
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CM_CRP_EXCLUSIVE
Definition: cfgmgr32.h:712
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define CM_CRP_SECURITY
Definition: cfgmgr32.h:706
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
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:4917
HANDLE HKEY
Definition: registry.h:24
int ret
static const WCHAR L[]
Definition: oid.c:1087
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2368
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: