ReactOS  0.4.10-dev-7-g0d308f4
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 (LPWSTR pszDeviceInstance)
 
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 2130 of file umpnpmgr.c.

Referenced by PNP_AddID().

2133 {
2134  DWORD dwLen;
2135  DWORD dwPos;
2136 
2137  dwLen = wcslen(lpDeviceId);
2138  dwPos = (*lpDeviceIdListSize / sizeof(WCHAR)) - 1;
2139 
2140  wcscpy(&lpDeviceIdList[dwPos], lpDeviceId);
2141 
2142  dwPos += (dwLen + 1);
2143 
2144  lpDeviceIdList[dwPos] = 0;
2145 
2146  *lpDeviceIdListSize = dwPos * sizeof(WCHAR);
2147 }
#define WCHAR
Definition: msvc.h:43
DWORD DWORD
Definition: winlogon.h:75
_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 2109 of file umpnpmgr.c.

Referenced by PNP_AddID().

2111 {
2112  LPWSTR lpPtr;
2113  DWORD dwLength;
2114 
2115  lpPtr = lpDeviceIdList;
2116  while (*lpPtr != 0)
2117  {
2118  dwLength = wcslen(lpPtr);
2119  if (0 == _wcsicmp(lpPtr, lpDeviceId))
2120  return TRUE;
2121 
2122  lpPtr += (dwLength + 1);
2123  }
2124 
2125  return FALSE;
2126 }
#define TRUE
Definition: types.h:120
DWORD DWORD
Definition: winlogon.h:75
#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 1754 of file umpnpmgr.c.

Referenced by PNP_CreateDevInst().

1755 {
1756  WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
1757  WCHAR szDevice[MAX_DEVICE_ID_LEN];
1758  WCHAR szInstance[MAX_DEVICE_ID_LEN];
1759  HKEY hKeyEnumerator;
1760  HKEY hKeyDevice;
1761  HKEY hKeyInstance;
1762  HKEY hKeyControl;
1763  LONG lError;
1764 
1765  /* Split the instance ID */
1766  SplitDeviceInstanceID(pszDeviceID,
1767  szEnumerator,
1768  szDevice,
1769  szInstance);
1770 
1771  /* Open or create the enumerator key */
1772  lError = RegCreateKeyExW(hEnumKey,
1773  szEnumerator,
1774  0,
1775  NULL,
1778  NULL,
1779  &hKeyEnumerator,
1780  NULL);
1781  if (lError != ERROR_SUCCESS)
1782  {
1783  return CR_REGISTRY_ERROR;
1784  }
1785 
1786  /* Open or create the device key */
1787  lError = RegCreateKeyExW(hKeyEnumerator,
1788  szDevice,
1789  0,
1790  NULL,
1793  NULL,
1794  &hKeyDevice,
1795  NULL);
1796 
1797  /* Close the enumerator key */
1798  RegCloseKey(hKeyEnumerator);
1799 
1800  if (lError != ERROR_SUCCESS)
1801  {
1802  return CR_REGISTRY_ERROR;
1803  }
1804 
1805  /* Try to open the instance key and fail if it exists */
1806  lError = RegOpenKeyExW(hKeyDevice,
1807  szInstance,
1808  0,
1809  KEY_SET_VALUE,
1810  &hKeyInstance);
1811  if (lError == ERROR_SUCCESS)
1812  {
1813  DPRINT1("Instance %S already exists!\n", szInstance);
1814  RegCloseKey(hKeyInstance);
1815  RegCloseKey(hKeyDevice);
1816  return CR_ALREADY_SUCH_DEVINST;
1817  }
1818 
1819  /* Create a new instance key */
1820  lError = RegCreateKeyExW(hKeyDevice,
1821  szInstance,
1822  0,
1823  NULL,
1826  NULL,
1827  &hKeyInstance,
1828  NULL);
1829 
1830  /* Close the device key */
1831  RegCloseKey(hKeyDevice);
1832 
1833  if (lError != ERROR_SUCCESS)
1834  {
1835  return CR_REGISTRY_ERROR;
1836  }
1837 
1838  /* Create the 'Control' sub key */
1839  lError = RegCreateKeyExW(hKeyInstance,
1840  L"Control",
1841  0,
1842  NULL,
1845  NULL,
1846  &hKeyControl,
1847  NULL);
1848  if (lError == ERROR_SUCCESS)
1849  {
1850  RegCloseKey(hKeyControl);
1851  }
1852 
1853  RegCloseKey(hKeyInstance);
1854 
1855  return (lError == ERROR_SUCCESS) ? CR_SUCCESS : CR_REGISTRY_ERROR;
1856 }
#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:1709
#define KEY_SET_VALUE
Definition: nt_native.h:1017
Definition: bidi.c:85
__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
#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 3498 of file umpnpmgr.c.

Referenced by ServiceMain().

3499 {
3500 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3501  PSLIST_ENTRY ListEntry;
3502 #else
3503  PLIST_ENTRY ListEntry;
3504 #endif
3505  DeviceInstallParams* Params;
3506  BOOL showWizard;
3507 
3508  UNREFERENCED_PARAMETER(lpParameter);
3509 
3511 
3512  showWizard = !SetupIsActive() && !IsConsoleBoot();
3513 
3514  while (TRUE)
3515  {
3516 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3518 #else
3520  ListEntry = NULL;
3521  else
3522  ListEntry = RemoveHeadList(&DeviceInstallListHead);
3523 #endif
3524  if (ListEntry == NULL)
3525  {
3528  }
3529  else
3530  {
3532  Params = CONTAINING_RECORD(ListEntry, DeviceInstallParams, ListEntry);
3533  InstallDevice(Params->DeviceIds, showWizard);
3534  }
3535  }
3536 
3537  return 0;
3538 }
#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:3422
_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:3453
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:3203
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 1956 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1957 {
1958  DPRINT("DisableDeviceInstance: not implemented\n");
1959  /* FIXME */
1960  return CR_CALL_NOT_IMPLEMENTED;
1961 }
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 3881 of file umpnpmgr.c.

3884 {
3885  switch (fdwReason)
3886  {
3887  case DLL_PROCESS_ATTACH:
3888  DisableThreadLibraryCalls(hinstDLL);
3890  break;
3891 
3892  case DLL_PROCESS_DETACH:
3893  break;
3894  }
3895 
3896  return TRUE;
3897 }
#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:3810
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static CONFIGRET EnableDeviceInstance ( LPWSTR  pszDeviceInstance)
static

Definition at line 1938 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1939 {
1940  PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData;
1942  NTSTATUS Status;
1943 
1944  DPRINT("Enable device instance %S\n", pszDeviceInstance);
1945 
1946  RtlInitUnicodeString(&ResetDeviceData.DeviceInstance, pszDeviceInstance);
1948  if (!NT_SUCCESS(Status))
1949  ret = NtStatusToCrError(Status);
1950 
1951  return ret;
1952 }
#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:1115
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 3810 of file umpnpmgr.c.

Referenced by DllMain().

3811 {
3812  BOOLEAN OldValue;
3813  DWORD dwError;
3814 
3815  DPRINT("UMPNPMGR: InitializePnPManager() started\n");
3816 
3817  /* We need this privilege for using CreateProcessAsUserW */
3819 
3821  if (hInstallEvent == NULL)
3822  {
3823  dwError = GetLastError();
3824  DPRINT1("Could not create the Install Event! (Error %lu)\n", dwError);
3825  return dwError;
3826  }
3827 
3830  {
3831  dwError = GetLastError();
3832  DPRINT1("Could not create the Event! (Error %lu)\n", dwError);
3833  return dwError;
3834  }
3835 
3837  TRUE,
3838  FALSE,
3839  L"Global\\PnP_No_Pending_Install_Events");
3840  if (hNoPendingInstalls == NULL)
3841  {
3842  dwError = GetLastError();
3843  DPRINT1("Could not create the Event! (Error %lu)\n", dwError);
3844  return dwError;
3845  }
3846 
3847 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
3849 #else
3851 #endif
3852 
3854  L"System\\CurrentControlSet\\Enum",
3855  0,
3857  &hEnumKey);
3858  if (dwError != ERROR_SUCCESS)
3859  {
3860  DPRINT1("Could not open the Enum Key! (Error %lu)\n", dwError);
3861  return dwError;
3862  }
3863 
3865  L"System\\CurrentControlSet\\Control\\Class",
3866  0,
3868  &hClassKey);
3869  if (dwError != ERROR_SUCCESS)
3870  {
3871  DPRINT1("Could not open the Class Key! (Error %lu)\n", dwError);
3872  return dwError;
3873  }
3874 
3875  DPRINT("UMPNPMGR: InitializePnPManager() done\n");
3876 
3877  return 0;
3878 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:85
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
static BOOL SetupIsActive(VOID)
Definition: umpnpmgr.c:3422
DWORD DWORD
Definition: winlogon.h:75
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 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 3203 of file umpnpmgr.c.

Referenced by DeviceInstallThread().

3204 {
3205  BOOL DeviceInstalled = FALSE;
3207  DWORD Value;
3209  HANDLE hPipe = INVALID_HANDLE_VALUE;
3211  PROCESS_INFORMATION ProcessInfo;
3212  STARTUPINFOW StartupInfo;
3213  UUID RandomUuid;
3214  HKEY DeviceKey;
3215 
3216  /* The following lengths are constant (see below), they cannot overflow */
3217  WCHAR CommandLine[116];
3218  WCHAR InstallEventName[73];
3219  WCHAR PipeName[74];
3220  WCHAR UuidString[39];
3221 
3222  DPRINT("InstallDevice(%S, %d)\n", DeviceInstance, ShowWizard);
3223 
3224  ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
3225 
3226  if (RegOpenKeyExW(hEnumKey,
3228  0,
3230  &DeviceKey) == ERROR_SUCCESS)
3231  {
3232  if (RegQueryValueExW(DeviceKey,
3233  L"Class",
3234  NULL,
3235  NULL,
3236  NULL,
3237  NULL) == ERROR_SUCCESS)
3238  {
3239  DPRINT("No need to install: %S\n", DeviceInstance);
3240  RegCloseKey(DeviceKey);
3241  return TRUE;
3242  }
3243 
3244  BytesWritten = sizeof(DWORD);
3245  if (RegQueryValueExW(DeviceKey,
3246  L"ConfigFlags",
3247  NULL,
3248  NULL,
3249  (PBYTE)&Value,
3250  &BytesWritten) == ERROR_SUCCESS)
3251  {
3252  if (Value & CONFIGFLAG_FAILEDINSTALL)
3253  {
3254  DPRINT("No need to install: %S\n", DeviceInstance);
3255  RegCloseKey(DeviceKey);
3256  return TRUE;
3257  }
3258  }
3259 
3260  RegCloseKey(DeviceKey);
3261  }
3262 
3263  DPRINT1("Installing: %S\n", DeviceInstance);
3264 
3265  /* Create a random UUID for the named pipe & event*/
3266  UuidCreate(&RandomUuid);
3267  swprintf(UuidString, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
3268  RandomUuid.Data1, RandomUuid.Data2, RandomUuid.Data3,
3269  RandomUuid.Data4[0], RandomUuid.Data4[1], RandomUuid.Data4[2],
3270  RandomUuid.Data4[3], RandomUuid.Data4[4], RandomUuid.Data4[5],
3271  RandomUuid.Data4[6], RandomUuid.Data4[7]);
3272 
3273  /* Create the event */
3274  wcscpy(InstallEventName, L"Global\\PNP_Device_Install_Event_0.");
3275  wcscat(InstallEventName, UuidString);
3276  hInstallEvent = CreateEventW(NULL, TRUE, FALSE, InstallEventName);
3277  if (!hInstallEvent)
3278  {
3279  DPRINT1("CreateEventW('%ls') failed with error %lu\n", InstallEventName, GetLastError());
3280  goto cleanup;
3281  }
3282 
3283  /* Create the named pipe */
3284  wcscpy(PipeName, L"\\\\.\\pipe\\PNP_Device_Install_Pipe_0.");
3285  wcscat(PipeName, UuidString);
3286  hPipe = CreateNamedPipeW(PipeName, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_BYTE, 1, 512, 512, 0, NULL);
3287  if (hPipe == INVALID_HANDLE_VALUE)
3288  {
3289  DPRINT1("CreateNamedPipeW failed with error %u\n", GetLastError());
3290  goto cleanup;
3291  }
3292 
3293  /* Launch rundll32 to call ClientSideInstallW */
3294  wcscpy(CommandLine, L"rundll32.exe newdev.dll,ClientSideInstall ");
3295  wcscat(CommandLine, PipeName);
3296 
3297  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
3298  StartupInfo.cb = sizeof(StartupInfo);
3299 
3300  if (hUserToken)
3301  {
3302  /* newdev has to run under the environment of the current user */
3303  if (!CreateEnvironmentBlock(&Environment, hUserToken, FALSE))
3304  {
3305  DPRINT1("CreateEnvironmentBlock failed with error %d\n", GetLastError());
3306  goto cleanup;
3307  }
3308 
3309  if (!CreateProcessAsUserW(hUserToken, NULL, CommandLine, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, Environment, NULL, &StartupInfo, &ProcessInfo))
3310  {
3311  DPRINT1("CreateProcessAsUserW failed with error %u\n", GetLastError());
3312  goto cleanup;
3313  }
3314  }
3315  else
3316  {
3317  /* FIXME: This is probably not correct, I guess newdev should never be run with SYSTEM privileges.
3318 
3319  Still, we currently do that in 2nd stage setup and probably Console mode as well, so allow it here.
3320  (ShowWizard is only set to FALSE for these two modes) */
3321  ASSERT(!ShowWizard);
3322 
3323  if (!CreateProcessW(NULL, CommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &StartupInfo, &ProcessInfo))
3324  {
3325  DPRINT1("CreateProcessW failed with error %u\n", GetLastError());
3326  goto cleanup;
3327  }
3328  }
3329 
3330  /* Wait for the function to connect to our pipe */
3331  if (!ConnectNamedPipe(hPipe, NULL))
3332  {
3334  {
3335  DPRINT1("ConnectNamedPipe failed with error %u\n", GetLastError());
3336  goto cleanup;
3337  }
3338  }
3339 
3340  /* Pass the data. The following output is partly compatible to Windows XP SP2 (researched using a modified newdev.dll to log this stuff) */
3341  Value = sizeof(InstallEventName);
3342  WriteFile(hPipe, &Value, sizeof(Value), &BytesWritten, NULL);
3343  WriteFile(hPipe, InstallEventName, Value, &BytesWritten, NULL);
3344 
3345  /* I couldn't figure out what the following value means under WinXP. It's usually 0 in my tests, but was also 5 once.
3346  Therefore the following line is entirely ReactOS-specific. We use the value here to pass the ShowWizard variable. */
3347  WriteFile(hPipe, &ShowWizard, sizeof(ShowWizard), &BytesWritten, NULL);
3348 
3349  Value = (wcslen(DeviceInstance) + 1) * sizeof(WCHAR);
3350  WriteFile(hPipe, &Value, sizeof(Value), &BytesWritten, NULL);
3351  WriteFile(hPipe, DeviceInstance, Value, &BytesWritten, NULL);
3352 
3353  /* Wait for newdev.dll to finish processing */
3354  WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
3355 
3356  /* If the event got signalled, this is success */
3357  DeviceInstalled = WaitForSingleObject(hInstallEvent, 0) == WAIT_OBJECT_0;
3358 
3359 cleanup:
3360  if (hInstallEvent)
3361  CloseHandle(hInstallEvent);
3362 
3363  if (hPipe != INVALID_HANDLE_VALUE)
3364  CloseHandle(hPipe);
3365 
3366  if (Environment)
3367  DestroyEnvironmentBlock(Environment);
3368 
3369  if (ProcessInfo.hProcess)
3370  CloseHandle(ProcessInfo.hProcess);
3371 
3372  if (ProcessInfo.hThread)
3373  CloseHandle(ProcessInfo.hThread);
3374 
3375  if (!DeviceInstalled)
3376  {
3377  DPRINT1("InstallDevice failed for DeviceInstance '%ws'\n", DeviceInstance);
3378  }
3379 
3380  return DeviceInstalled;
3381 }
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
Definition: bidi.c:85
#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:1056
#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:75
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:4631
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)
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(HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: logon.c:161
DWORD *typedef HANDLE
Definition: winlogon.h:52
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 3453 of file umpnpmgr.c.

Referenced by DeviceInstallThread().

3454 {
3455  HKEY ControlKey = NULL;
3456  LPWSTR SystemStartOptions = NULL;
3457  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
3458  BOOL ConsoleBoot = FALSE;
3459  LONG rc;
3460 
3461  rc = RegOpenKeyExW(
3463  L"SYSTEM\\CurrentControlSet\\Control",
3464  0,
3466  &ControlKey);
3467 
3468  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
3469  if (rc != ERROR_SUCCESS)
3470  goto cleanup;
3471 
3472  /* Check for CONSOLE switch in SystemStartOptions */
3473  CurrentOption = SystemStartOptions;
3474  while (CurrentOption)
3475  {
3476  NextOption = wcschr(CurrentOption, L' ');
3477  if (NextOption)
3478  *NextOption = L'\0';
3479  if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
3480  {
3481  DPRINT("Found %S. Switching to console boot\n", CurrentOption);
3482  ConsoleBoot = TRUE;
3483  goto cleanup;
3484  }
3485  CurrentOption = NextOption ? NextOption + 1 : NULL;
3486  }
3487 
3488 cleanup:
3489  if (ControlKey != NULL)
3490  RegCloseKey(ControlKey);
3491  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
3492  return ConsoleBoot;
3493 }
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: umpnpmgr.c:3385
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:85
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
#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 1918 of file umpnpmgr.c.

Referenced by PNP_DeviceInstanceAction().

1920 {
1921  DPRINT("MoveDeviceInstance: not implemented\n");
1922  /* FIXME */
1923  return CR_CALL_NOT_IMPLEMENTED;
1924 }
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(), and PNP_GetRelatedDeviceInstance().

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 2589 of file umpnpmgr.c.

Referenced by CM_Add_Empty_Log_Conf_Ex().

2595 {
2596  UNIMPLEMENTED;
2597  return CR_CALL_NOT_IMPLEMENTED;
2598 }
#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 2153 of file umpnpmgr.c.

Referenced by CM_Add_ID_ExW().

2158 {
2160  HKEY hDeviceKey;
2161  LPWSTR pszSubKey;
2162  DWORD dwDeviceIdListSize;
2163  DWORD dwNewDeviceIdSize;
2164  WCHAR * pszDeviceIdList = NULL;
2165 
2166  UNREFERENCED_PARAMETER(hBinding);
2167 
2168  DPRINT("PNP_AddID() called\n");
2169  DPRINT(" DeviceInstance: %S\n", pszDeviceID);
2170  DPRINT(" DeviceId: %S\n", pszID);
2171  DPRINT(" Flags: %lx\n", ulFlags);
2172 
2173  if (RegOpenKeyExW(hEnumKey,
2174  pszDeviceID,
2175  0,
2177  &hDeviceKey) != ERROR_SUCCESS)
2178  {
2179  DPRINT("Failed to open the device key!\n");
2180  return CR_INVALID_DEVNODE;
2181  }
2182 
2183  pszSubKey = (ulFlags & CM_ADD_ID_COMPATIBLE) ? L"CompatibleIDs" : L"HardwareID";
2184 
2185  if (RegQueryValueExW(hDeviceKey,
2186  pszSubKey,
2187  NULL,
2188  NULL,
2189  NULL,
2190  &dwDeviceIdListSize) != ERROR_SUCCESS)
2191  {
2192  DPRINT("Failed to query the desired ID string!\n");
2193  ret = CR_REGISTRY_ERROR;
2194  goto Done;
2195  }
2196 
2197  dwNewDeviceIdSize = lstrlenW(pszDeviceID);
2198  if (!dwNewDeviceIdSize)
2199  {
2200  ret = CR_INVALID_POINTER;
2201  goto Done;
2202  }
2203 
2204  dwDeviceIdListSize += (dwNewDeviceIdSize + 2) * sizeof(WCHAR);
2205 
2206  pszDeviceIdList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDeviceIdListSize);
2207  if (!pszDeviceIdList)
2208  {
2209  DPRINT("Failed to allocate memory for the desired ID string!\n");
2210  ret = CR_OUT_OF_MEMORY;
2211  goto Done;
2212  }
2213 
2214  if (RegQueryValueExW(hDeviceKey,
2215  pszSubKey,
2216  NULL,
2217  NULL,
2218  (LPBYTE)pszDeviceIdList,
2219  &dwDeviceIdListSize) != ERROR_SUCCESS)
2220  {
2221  DPRINT("Failed to query the desired ID string!\n");
2222  ret = CR_REGISTRY_ERROR;
2223  goto Done;
2224  }
2225 
2226  /* Check whether the device ID is already in use */
2227  if (CheckForDeviceId(pszDeviceIdList, pszDeviceID))
2228  {
2229  DPRINT("Device ID was found in the ID string!\n");
2230  ret = CR_SUCCESS;
2231  goto Done;
2232  }
2233 
2234  /* Append the Device ID */
2235  AppendDeviceId(pszDeviceIdList, &dwDeviceIdListSize, pszID);
2236 
2237  if (RegSetValueExW(hDeviceKey,
2238  pszSubKey,
2239  0,
2240  REG_MULTI_SZ,
2241  (LPBYTE)pszDeviceIdList,
2242  dwDeviceIdListSize) != ERROR_SUCCESS)
2243  {
2244  DPRINT("Failed to set the desired ID string!\n");
2245  ret = CR_REGISTRY_ERROR;
2246  }
2247 
2248 Done:
2249  RegCloseKey(hDeviceKey);
2250  if (pszDeviceIdList)
2251  HeapFree(GetProcessHeap(), 0, pszDeviceIdList);
2252 
2253  DPRINT("PNP_AddID() done (returns %lx)\n", ret);
2254 
2255  return ret;
2256 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
Definition: bidi.c:85
#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:75
#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:2130
#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:2109
int ret
#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 2666 of file umpnpmgr.c.

2676 {
2677  UNIMPLEMENTED;
2678  return CR_CALL_NOT_IMPLEMENTED;
2679 }
#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 3137 of file umpnpmgr.c.

3139 {
3140  UNIMPLEMENTED;
3141  return CR_CALL_NOT_IMPLEMENTED;
3142 }
#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 1862 of file umpnpmgr.c.

Referenced by CM_Create_DevNode_ExW().

1868 {
1870 
1871  DPRINT("PNP_CreateDevInst: %S\n", pszDeviceID);
1872 
1873  if (ulFlags & CM_CREATE_DEVNODE_GENERATE_ID)
1874  {
1875  WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
1876  DWORD dwInstanceNumber;
1877 
1878  /* Generated ID is: Root<Device ID><Instance number> */
1879  dwInstanceNumber = 0;
1880  do
1881  {
1882  swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
1883  pszDeviceID, dwInstanceNumber);
1884 
1885  /* Try to create a device instance with this ID */
1886  ret = CreateDeviceInstance(szGeneratedInstance);
1887 
1888  dwInstanceNumber++;
1889  }
1890  while (ret == CR_ALREADY_SUCH_DEVINST);
1891 
1892  if (ret == CR_SUCCESS)
1893  {
1894  /* pszDeviceID is an out parameter too for generated IDs */
1895  if (wcslen(szGeneratedInstance) > ulLength)
1896  {
1897  ret = CR_BUFFER_SMALL;
1898  }
1899  else
1900  {
1901  wcscpy(pszDeviceID, szGeneratedInstance);
1902  }
1903  }
1904  }
1905  else
1906  {
1907  /* Create the device instance */
1908  ret = CreateDeviceInstance(pszDeviceID);
1909  }
1910 
1911  DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
1912 
1913  return ret;
1914 }
Definition: bidi.c:85
#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:75
#define CR_SUCCESS
Definition: cfgmgr32.h:842
void DPRINT(...)
Definition: polytest.cpp:61
static CONFIGRET CreateDeviceInstance(LPWSTR pszDeviceID)
Definition: umpnpmgr.c:1754
#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)
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 1177 of file umpnpmgr.c.

1182 {
1183  HKEY hKey = 0;
1184 
1186  pszSubKey,
1187  0,
1188  NULL,
1189  0,
1191  NULL,
1192  &hKey,
1193  NULL))
1194  return CR_REGISTRY_ERROR;
1195 
1196  /* FIXME: Set security key */
1197 
1198  RegCloseKey(hKey);
1199 
1200  return CR_SUCCESS;
1201 }
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 1321 of file umpnpmgr.c.

Referenced by CM_Delete_Class_Key_Ex().

1325 {
1327 
1328  UNREFERENCED_PARAMETER(hBinding);
1329 
1330  DPRINT("PNP_GetClassName(%S, %lx) called\n", pszClassGuid, ulFlags);
1331 
1332  if (ulFlags & CM_DELETE_CLASS_SUBKEYS)
1333  {
1334  if (SHDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
1335  ret = CR_REGISTRY_ERROR;
1336  }
1337  else
1338  {
1339  if (RegDeleteKeyW(hClassKey, pszClassGuid) != ERROR_SUCCESS)
1340  ret = CR_REGISTRY_ERROR;
1341  }
1342 
1343  DPRINT("PNP_DeleteClassKey() done (returns %lx)\n", ret);
1344 
1345  return ret;
1346 }
#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 1207 of file umpnpmgr.c.

1213 {
1214  UNIMPLEMENTED;
1215  return CR_CALL_NOT_IMPLEMENTED;
1216 }
#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 3194 of file umpnpmgr.c.

3196 {
3197  UNIMPLEMENTED;
3198  return CR_CALL_NOT_IMPLEMENTED;
3199 }
#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 2780 of file umpnpmgr.c.

2788 {
2789  UNIMPLEMENTED;
2790  return CR_CALL_NOT_IMPLEMENTED;
2791 }
#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 1976 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().

1982 {
1984 
1985  UNREFERENCED_PARAMETER(hBinding);
1986 
1987  DPRINT("PNP_DeviceInstanceAction() called\n");
1988 
1989  switch (ulAction)
1990  {
1991  case PNP_DEVINST_MOVE:
1992  ret = MoveDeviceInstance(pszDeviceInstance1,
1993  pszDeviceInstance2);
1994  break;
1995 
1996  case PNP_DEVINST_SETUP:
1997  ret = SetupDeviceInstance(pszDeviceInstance1,
1998  ulFlags);
1999  break;
2000 
2001  case PNP_DEVINST_ENABLE:
2002  ret = EnableDeviceInstance(pszDeviceInstance1);
2003  break;
2004 
2005  case PNP_DEVINST_DISABLE:
2006  ret = DisableDeviceInstance(pszDeviceInstance1);
2007  break;
2008 
2009  case PNP_DEVINST_REENUMERATE:
2010  ret = ReenumerateDeviceInstance(pszDeviceInstance1);
2011  break;
2012 
2013  default:
2014  DPRINT1("Unknown device action %lu: not implemented\n", ulAction);
2016  }
2017 
2018  DPRINT("PNP_DeviceInstanceAction() done (returns %lx)\n", ret);
2019 
2020  return ret;
2021 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static CONFIGRET DisableDeviceInstance(LPWSTR pszDeviceInstance)
Definition: umpnpmgr.c:1956
#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:1928
static CONFIGRET EnableDeviceInstance(LPWSTR pszDeviceInstance)
Definition: umpnpmgr.c:1938
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DPRINT1
Definition: precomp.h:8
static CONFIGRET ReenumerateDeviceInstance(LPWSTR pszDeviceInstance)
Definition: umpnpmgr.c:1965
static CONFIGRET MoveDeviceInstance(LPWSTR pszDeviceInstanceDestination, LPWSTR pszDeviceInstanceSource)
Definition: umpnpmgr.c:1918
DWORD WINAPI PNP_DisableDevInst ( handle_t  hBinding,
LPWSTR  pDeviceID,
PPNP_VETO_TYPE  pVetoType,
LPWSTR  pszVetoName,
DWORD  ulNameLength,
DWORD  ulFlags 
)

Definition at line 2083 of file umpnpmgr.c.

2090 {
2091  UNIMPLEMENTED;
2092  return CR_CALL_NOT_IMPLEMENTED;
2093 }
#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 3148 of file umpnpmgr.c.

3150 {
3151  UNIMPLEMENTED;
3152  return CR_CALL_NOT_IMPLEMENTED;
3153 }
#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 3159 of file umpnpmgr.c.

3161 {
3162  UNIMPLEMENTED;
3163  return CR_CALL_NOT_IMPLEMENTED;
3164 }
#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:75
#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 2604 of file umpnpmgr.c.

Referenced by CM_Free_Log_Conf_Ex().

2610 {
2611  UNIMPLEMENTED;
2612  return CR_CALL_NOT_IMPLEMENTED;
2613 }
#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 2685 of file umpnpmgr.c.

2695 {
2696  UNIMPLEMENTED;
2697  return CR_CALL_NOT_IMPLEMENTED;
2698 }
#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 3028 of file umpnpmgr.c.

Referenced by CMP_GetBlockedDriverInfo().

3034 {
3035  UNIMPLEMENTED;
3036  return CR_CALL_NOT_IMPLEMENTED;
3037 }
#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 1222 of file umpnpmgr.c.

1226 {
1227  HKEY hKey;
1228  DWORD dwError;
1229 
1230  UNREFERENCED_PARAMETER(hBinding);
1231  UNREFERENCED_PARAMETER(ulFlags);
1232 
1235  0,
1237  &hKey);
1238  if (dwError != ERROR_SUCCESS)
1239  return CR_INVALID_DATA;
1240 
1241  dwError = RegQueryInfoKeyW(hKey,
1242  NULL,
1243  NULL,
1244  NULL,
1245  pulClassCount,
1246  NULL,
1247  NULL,
1248  NULL,
1249  NULL,
1250  NULL,
1251  NULL,
1252  NULL);
1253  RegCloseKey(hKey);
1254  if (dwError != ERROR_SUCCESS)
1255  return CR_INVALID_DATA;
1256 
1257  return CR_SUCCESS;
1258 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:75
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 1163 of file umpnpmgr.c.

1168 {
1169  UNIMPLEMENTED;
1170  return CR_CALL_NOT_IMPLEMENTED;
1171 }
#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 1264 of file umpnpmgr.c.

Referenced by CM_Get_Class_Name_ExW().

1270 {
1271  WCHAR szKeyName[MAX_PATH];
1273  HKEY hKey;
1274  DWORD dwSize;
1275 
1276  UNREFERENCED_PARAMETER(hBinding);
1277  UNREFERENCED_PARAMETER(ulFlags);
1278 
1279  DPRINT("PNP_GetClassName() called\n");
1280 
1281  lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class\\");
1282  if (lstrlenW(pszClassGuid) + 1 < sizeof(szKeyName)/sizeof(WCHAR)-(lstrlenW(szKeyName) * sizeof(WCHAR)))
1283  lstrcatW(szKeyName, pszClassGuid);
1284  else
1285  return CR_INVALID_DATA;
1286 
1288  szKeyName,
1289  0,
1291  &hKey))
1292  return CR_REGISTRY_ERROR;
1293 
1294  dwSize = *pulLength * sizeof(WCHAR);
1295  if (RegQueryValueExW(hKey,
1296  L"Class",
1297  NULL,
1298  NULL,
1299  (LPBYTE)Buffer,
1300  &dwSize))
1301  {
1302  *pulLength = 0;
1303  ret = CR_REGISTRY_ERROR;
1304  }
1305  else
1306  {
1307  *pulLength = dwSize / sizeof(WCHAR);
1308  }
1309 
1310  RegCloseKey(hKey);
1311 
1312  DPRINT("PNP_GetClassName() done (returns %lx)\n", ret);
1313 
1314  return ret;
1315 }
Definition: bidi.c:85
#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:75
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
#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 1485 of file umpnpmgr.c.

Referenced by CM_Get_Class_Registry_PropertyW().

1494 {
1496  LPWSTR lpValueName = NULL;
1497  HKEY hInstKey = NULL;
1498  HKEY hPropKey = NULL;
1499  LONG lError;
1500 
1501  UNREFERENCED_PARAMETER(hBinding);
1502 
1503  DPRINT("PNP_GetClassRegProp() called\n");
1504 
1505  if (pulTransferLen == NULL || pulLength == NULL)
1506  {
1507  ret = CR_INVALID_POINTER;
1508  goto done;
1509  }
1510 
1511  if (ulFlags != 0)
1512  {
1513  ret = CR_INVALID_FLAG;
1514  goto done;
1515  }
1516 
1517  if (*pulLength < *pulTransferLen)
1518  *pulLength = *pulTransferLen;
1519 
1520  *pulTransferLen = 0;
1521 
1522  switch (ulProperty)
1523  {
1524  case CM_CRP_SECURITY:
1525  lpValueName = L"Security";
1526  break;
1527 
1528  case CM_CRP_DEVTYPE:
1529  lpValueName = L"DeviceType";
1530  break;
1531 
1532  case CM_CRP_EXCLUSIVE:
1533  lpValueName = L"Exclusive";
1534  break;
1535 
1537  lpValueName = L"DeviceCharacteristics";
1538  break;
1539 
1540  default:
1541  ret = CR_INVALID_PROPERTY;
1542  goto done;
1543  }
1544 
1545  DPRINT("Value name: %S\n", lpValueName);
1546 
1547  lError = RegOpenKeyExW(hClassKey,
1548  pszClassGuid,
1549  0,
1550  KEY_READ,
1551  &hInstKey);
1552  if (lError != ERROR_SUCCESS)
1553  {
1554  *pulLength = 0;
1556  goto done;
1557  }
1558 
1559  lError = RegOpenKeyExW(hInstKey,
1560  L"Properties",
1561  0,
1562  KEY_READ,
1563  &hPropKey);
1564  if (lError != ERROR_SUCCESS)
1565  {
1566  *pulLength = 0;
1568  goto done;
1569  }
1570 
1571  lError = RegQueryValueExW(hPropKey,
1572  lpValueName,
1573  NULL,
1574  pulRegDataType,
1575  Buffer,
1576  pulLength);
1577  if (lError != ERROR_SUCCESS)
1578  {
1579  if (lError == ERROR_MORE_DATA)
1580  {
1581  ret = CR_BUFFER_SMALL;
1582  }
1583  else
1584  {
1585  *pulLength = 0;
1586  ret = CR_NO_SUCH_VALUE;
1587  }
1588  }
1589 
1590 done:
1591  if (ret == CR_SUCCESS)
1592  *pulTransferLen = *pulLength;
1593 
1594  if (hPropKey != NULL)
1595  RegCloseKey(hPropKey);
1596 
1597  if (hInstKey != NULL)
1598  RegCloseKey(hInstKey);
1599 
1600  DPRINT("PNP_GetClassRegProp() done (returns %lx)\n", ret);
1601 
1602  return ret;
1603 }
#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
Definition: bidi.c:85
#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
#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 2918 of file umpnpmgr.c.

Referenced by CM_Get_DevNode_Custom_Property_ExW().

2927 {
2928  HKEY hDeviceKey = NULL;
2929  HKEY hParamKey = NULL;
2930  LONG lError;
2932 
2933  UNREFERENCED_PARAMETER(hBinding);
2934 
2935  DPRINT("PNP_GetCustomDevProp() called\n");
2936 
2937  if (pulTransferLen == NULL || pulLength == NULL)
2938  {
2939  ret = CR_INVALID_POINTER;
2940  goto done;
2941  }
2942 
2943  if (ulFlags & ~CM_CUSTOMDEVPROP_BITS)
2944  {
2945  ret = CR_INVALID_FLAG;
2946  goto done;
2947  }
2948 
2949  if (*pulLength < *pulTransferLen)
2950  *pulLength = *pulTransferLen;
2951 
2952  *pulTransferLen = 0;
2953 
2954  lError = RegOpenKeyExW(hEnumKey,
2955  pDeviceID,
2956  0,
2957  KEY_READ,
2958  &hDeviceKey);
2959  if (lError != ERROR_SUCCESS)
2960  {
2961  ret = CR_REGISTRY_ERROR;
2962  goto done;
2963  }
2964 
2965  lError = RegOpenKeyExW(hDeviceKey,
2966  L"Device Parameters",
2967  0,
2968  KEY_READ,
2969  &hParamKey);
2970  if (lError != ERROR_SUCCESS)
2971  {
2972  ret = CR_REGISTRY_ERROR;
2973  goto done;
2974  }
2975 
2976  lError = RegQueryValueExW(hParamKey,
2977  CustomPropName,
2978  NULL,
2979  pulRegDataType,
2980  Buffer,
2981  pulLength);
2982  if (lError != ERROR_SUCCESS)
2983  {
2984  if (lError == ERROR_MORE_DATA)
2985  {
2986  ret = CR_BUFFER_SMALL;
2987  }
2988  else
2989  {
2990  *pulLength = 0;
2991  ret = CR_NO_SUCH_VALUE;
2992  }
2993  }
2994 
2995 done:
2996  if (ret == CR_SUCCESS)
2997  *pulTransferLen = *pulLength;
2998 
2999  if (hParamKey != NULL)
3000  RegCloseKey(hParamKey);
3001 
3002  if (hDeviceKey != NULL)
3003  RegCloseKey(hDeviceKey);
3004 
3005  DPRINT("PNP_GetCustomDevProp() done (returns %lx)\n", ret);
3006 
3007  return ret;
3008 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
Definition: bidi.c:85
#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
#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:52
#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:1115
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:461
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:52
#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:1115
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:52
#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:1115
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  {
929  PlugPlayData.Property = 0xb; // DevicePropertyPhysicalDeviceObjectName;
930  break;
931 
932  case CM_DRP_UI_NUMBER:
933  PlugPlayData.Property = 0x11; // DevicePropertyUINumber;
934  break;
935 
936  case CM_DRP_BUSTYPEGUID:
937  PlugPlayData.Property = 0xc; // DevicePropertyBusTypeGuid;
938  break;
939 
941  PlugPlayData.Property = 0xd; // DevicePropertyLegacyBusType;
942  break;
943 
944  case CM_DRP_BUSNUMBER:
945  PlugPlayData.Property = 0xe; // DevicePropertyBusNumber;
946  break;
947 
949  PlugPlayData.Property = 0xf; // DevicePropertyEnumeratorName;
950  break;
951 
952  case CM_DRP_ADDRESS:
953  PlugPlayData.Property = 0x10; // DevicePropertyAddress;
954  break;
955 
956 #if 0
957  /* FIXME: This property is not supported by IoGetDeviceProperty */
959 #endif
960 
962  PlugPlayData.Property = 0x13; // DevicePropertyRemovalPolicy
963  break;
964 
965 #if 0
966  /* FIXME: This property is not supported by IoGetDeviceProperty */
968 #endif
969 
971  PlugPlayData.Property = 0x12; // DevicePropertyInstallState;
972  break;
973 
974 #if 0
975  /* FIXME: This property is not supported by IoGetDeviceProperty */
976 #if (WINVER >= _WIN32_WINNT_WS03)
978 #endif
979 #endif
980 
981 #if (WINVER >= _WIN32_WINNT_WIN7)
983  PlugPlayData.Property = 0x16; // DevicePropertyContainerID;
984  break;
985 #endif
986 
987  default:
988  return CR_INVALID_PROPERTY;
989  }
990 
992  (PVOID)&PlugPlayData,
994  if (NT_SUCCESS(Status))
995  {
996  *pulLength = PlugPlayData.BufferSize;
997  }
998  else
999  {
1000  ret = NtStatusToCrError(Status);
1001  }
1002  }
1003 
1004 done:
1005 
1006  if (pulTransferLen)
1007  *pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0;
1008 
1009  if (hKey != NULL)
1010  RegCloseKey(hKey);
1011 
1012  DPRINT("PNP_GetDeviceRegProp() done (returns %lx)\n", ret);
1013 
1014  return ret;
1015 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
Definition: bidi.c:85
#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 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
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:434
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 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 CM_DRP_DRIVER
Definition: cfgmgr32.h:685
int ret
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
#define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cfgmgr32.h:690
#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:1115
#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 CM_DRP_CLASS
Definition: cfgmgr32.h:683
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 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 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 2027 of file umpnpmgr.c.

Referenced by CM_Get_DevNode_Status_Ex().

2033 {
2034  PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
2036  NTSTATUS Status;
2037 
2038  UNREFERENCED_PARAMETER(hBinding);
2039  UNREFERENCED_PARAMETER(ulFlags);
2040 
2041  DPRINT("PNP_GetDeviceStatus() called\n");
2042 
2043  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
2044  pDeviceID);
2045  PlugPlayData.Operation = 0; /* Get status */
2046 
2048  (PVOID)&PlugPlayData,
2050  if (NT_SUCCESS(Status))
2051  {
2052  *pulStatus = PlugPlayData.DeviceStatus;
2053  *pulProblem = PlugPlayData.DeviceProblem;
2054  }
2055  else
2056  {
2057  ret = NtStatusToCrError(Status);
2058  }
2059 
2060  DPRINT("PNP_GetDeviceStatus() done (returns %lx)\n", ret);
2061 
2062  return ret;
2063 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:452
#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:1115
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 2619 of file umpnpmgr.c.

Referenced by CM_Get_First_Log_Conf_Ex().

2625 {
2626  UNIMPLEMENTED;
2627  return CR_CALL_NOT_IMPLEMENTED;
2628 }
#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 2454 of file umpnpmgr.c.

Referenced by CM_Get_Hardware_Profile_Info_ExW().

2460 {
2461  WCHAR szProfileName[5];
2462  HKEY hKeyConfig = NULL;
2463  HKEY hKeyProfiles = NULL;
2464  HKEY hKeyProfile = NULL;
2465  DWORD dwDisposition;
2466  DWORD dwSize;
2467  LONG lError;
2469 
2470  UNREFERENCED_PARAMETER(hBinding);
2471 
2472  DPRINT("PNP_GetHwProfInfo() called\n");
2473 
2474  if (ulProfileInfoSize == 0)
2475  {
2476  ret = CR_INVALID_DATA;
2477  goto done;
2478  }
2479 
2480  if (ulFlags != 0)
2481  {
2482  ret = CR_INVALID_FLAG;
2483  goto done;
2484  }
2485 
2486  /* Initialize the profile information */
2487  pHWProfileInfo->HWPI_ulHWProfile = 0;
2488  pHWProfileInfo->HWPI_szFriendlyName[0] = 0;
2489  pHWProfileInfo->HWPI_dwFlags = 0;
2490 
2491  /* Open the 'IDConfigDB' key */
2493  L"System\\CurrentControlSet\\Control\\IDConfigDB",
2494  0,
2495  NULL,
2498  NULL,
2499  &hKeyConfig,
2500  &dwDisposition);
2501  if (lError != ERROR_SUCCESS)
2502  {
2503  ret = CR_REGISTRY_ERROR;
2504  goto done;
2505  }
2506 
2507  /* Open the 'Hardware Profiles' subkey */
2508  lError = RegCreateKeyExW(hKeyConfig,
2509  L"Hardware Profiles",
2510  0,
2511  NULL,
2514  NULL,
2515  &hKeyProfiles,
2516  &dwDisposition);
2517  if (lError != ERROR_SUCCESS)
2518  {
2519  ret = CR_REGISTRY_ERROR;
2520  goto done;
2521  }
2522 
2523  if (ulIndex == (ULONG)-1)
2524  {
2525  dwSize = sizeof(ULONG);
2526  lError = RegQueryValueExW(hKeyConfig,
2527  L"CurrentConfig",
2528  NULL,
2529  NULL,
2530  (LPBYTE)&pHWProfileInfo->HWPI_ulHWProfile,
2531  &dwSize);
2532  if (lError != ERROR_SUCCESS)
2533  {
2534  pHWProfileInfo->HWPI_ulHWProfile = 0;
2535  ret = CR_REGISTRY_ERROR;
2536  goto done;
2537  }
2538  }
2539  else
2540  {
2541  /* FIXME: not implemented yet */
2543  goto done;
2544  }
2545 
2546  swprintf(szProfileName, L"%04lu", pHWProfileInfo->HWPI_ulHWProfile);
2547 
2548  lError = RegOpenKeyExW(hKeyProfiles,
2549  szProfileName,
2550  0,
2552  &hKeyProfile);
2553  if (lError != ERROR_SUCCESS)
2554  {
2555  ret = CR_REGISTRY_ERROR;
2556  goto done;
2557  }
2558 
2559  dwSize = sizeof(pHWProfileInfo->HWPI_szFriendlyName);
2560  lError = RegQueryValueExW(hKeyProfile,
2561  L"FriendlyName",
2562  NULL,
2563  NULL,
2564  (LPBYTE)&pHWProfileInfo->HWPI_szFriendlyName,
2565  &dwSize);
2566  if (lError != ERROR_SUCCESS)
2567  {
2568  ret = CR_REGISTRY_ERROR;
2569  goto done;
2570  }
2571 
2572 done:
2573  if (hKeyProfile != NULL)
2574  RegCloseKey(hKeyProfile);
2575 
2576  if (hKeyProfiles != NULL)
2577  RegCloseKey(hKeyProfiles);
2578 
2579  if (hKeyConfig != NULL)
2580  RegCloseKey(hKeyConfig);
2581 
2582  return ret;
2583 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
Definition: bidi.c:85
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:75
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
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 1352 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_Alias_ExW().

1360 {
1361  UNIMPLEMENTED;
1362  return CR_CALL_NOT_IMPLEMENTED;
1363 }
#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 1369 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_List_ExW().

1376 {
1377  NTSTATUS Status;
1379  DWORD ret = CR_SUCCESS;
1380 
1381  UNREFERENCED_PARAMETER(hBinding);
1382 
1383  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
1384  pszDeviceID);
1385 
1386  PlugPlayData.Flags = ulFlags;
1387  PlugPlayData.FilterGuid = InterfaceGuid;
1388  PlugPlayData.Buffer = Buffer;
1389  PlugPlayData.BufferSize = *pulLength;
1390 
1392  (PVOID)&PlugPlayData,
1394  if (NT_SUCCESS(Status))
1395  {
1396  *pulLength = PlugPlayData.BufferSize;
1397  }
1398  else
1399  {
1400  ret = NtStatusToCrError(Status);
1401  }
1402 
1403  DPRINT("PNP_GetInterfaceDeviceListSize() done (returns %lx)\n", ret);
1404  return ret;
1405 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:75
#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:1115
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 1411 of file umpnpmgr.c.

Referenced by CM_Get_Device_Interface_List_Size_ExW().

1417 {
1418  NTSTATUS Status;
1420  DWORD ret = CR_SUCCESS;
1421 
1422  UNREFERENCED_PARAMETER(hBinding);
1423 
1424  DPRINT("PNP_GetInterfaceDeviceListSize() called\n");
1425 
1426  RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
1427  pszDeviceID);
1428 
1429  PlugPlayData.FilterGuid = InterfaceGuid;
1430  PlugPlayData.Buffer = NULL;
1431  PlugPlayData.BufferSize = 0;
1432  PlugPlayData.Flags = ulFlags;
1433 
1435  (PVOID)&PlugPlayData,
1437  if (NT_SUCCESS(Status))
1438  {
1439  *pulLen = PlugPlayData.BufferSize;
1440  }
1441  else
1442  {
1443  ret = NtStatusToCrError(Status);
1444  }
1445 
1446  DPRINT("PNP_GetInterfaceDeviceListSize() done (returns %lx)\n", ret);
1447  return ret;
1448 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD DWORD
Definition: winlogon.h:75
#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:1115
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 2650 of file umpnpmgr.c.

Referenced by CM_Get_Log_Conf_Priority_Ex().

2657 {
2658  UNIMPLEMENTED;
2659  return CR_CALL_NOT_IMPLEMENTED;
2660 }
#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 2634 of file umpnpmgr.c.

Referenced by CM_Get_Next_Log_Conf_Ex().

2641 {
2642  UNIMPLEMENTED;
2643  return CR_CALL_NOT_IMPLEMENTED;
2644 }
#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 2704 of file umpnpmgr.c.

2714 {
2715  UNIMPLEMENTED;
2716  return CR_CALL_NOT_IMPLEMENTED;
2717 }
#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 3087 of file umpnpmgr.c.

3098 {
3099  UNIMPLEMENTED;
3100  return CR_CALL_NOT_IMPLEMENTED;
3101 }
#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 3069 of file umpnpmgr.c.

3078 {
3079  UNIMPLEMENTED;
3080  return CR_CALL_NOT_IMPLEMENTED;
3081 }
#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:52
#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:1115
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 2723 of file umpnpmgr.c.

2733 {
2734  UNIMPLEMENTED;
2735  return CR_CALL_NOT_IMPLEMENTED;
2736 }
#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 2742 of file umpnpmgr.c.

2751 {
2752  UNIMPLEMENTED;
2753  return CR_CALL_NOT_IMPLEMENTED;
2754 }
#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 3043 of file umpnpmgr.c.

Referenced by CMP_GetServerSideDeviceInstallFlags().

3047 {
3048  UNREFERENCED_PARAMETER(hBinding);
3049 
3050  DPRINT1("PNP_GetServerSideDeviceInstallFlags(%p %p %lu)\n",
3051  hBinding, pulSSDIFlags, ulFlags);
3052 
3053  if (pulSSDIFlags == NULL)
3054  return CR_INVALID_POINTER;
3055 
3056  if (ulFlags != 0)
3057  return CR_INVALID_FLAG;
3058 
3059  /* FIXME */
3060  *pulSSDIFlags = 0;
3061 
3062  return CR_SUCCESS;
3063 }
#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 3014 of file umpnpmgr.c.

3017 {
3018  UNREFERENCED_PARAMETER(hBinding);
3019 
3020  *pwVersion = 0x501;
3021  return CR_SUCCESS;
3022 }
#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 2373 of file umpnpmgr.c.

Referenced by CM_Get_HW_Prof_Flags_ExW(), and CM_Set_HW_Prof_Flags_ExW().

2383 {
2385  WCHAR szKeyName[MAX_PATH];
2386  HKEY hKey;
2387  HKEY hDeviceKey;
2388  DWORD dwSize;
2389 
2390  UNREFERENCED_PARAMETER(hBinding);
2391 
2392  DPRINT("PNP_HwProfFlags() called\n");
2393 
2394  if (ulConfig == 0)
2395  {
2396  wcscpy(szKeyName,
2397  L"System\\CurrentControlSet\\HardwareProfiles\\Current\\System\\CurrentControlSet\\Enum");
2398  }
2399  else
2400  {
2401  swprintf(szKeyName,
2402  L"System\\CurrentControlSet\\HardwareProfiles\\%04lu\\System\\CurrentControlSet\\Enum",
2403  ulConfig);
2404  }
2405 
2407  szKeyName,
2408  0,
2410  &hKey) != ERROR_SUCCESS)
2411  return CR_REGISTRY_ERROR;
2412 
2413  if (ulAction == PNP_GET_HWPROFFLAGS)
2414  {
2415  if (RegOpenKeyExW(hKey,
2416  pDeviceID,
2417  0,
2419  &hDeviceKey) != ERROR_SUCCESS)
2420  {
2421  *pulValue = 0;
2422  }
2423  else
2424  {
2425  dwSize = sizeof(DWORD);
2426  if (RegQueryValueExW(hDeviceKey,
2427  L"CSConfigFlags",
2428  NULL,
2429  NULL,
2430  (LPBYTE)pulValue,
2431  &dwSize) != ERROR_SUCCESS)
2432  {
2433  *pulValue = 0;
2434  }
2435 
2436  RegCloseKey(hDeviceKey);
2437  }
2438  }
2439  else if (ulAction == PNP_SET_HWPROFFLAGS)
2440  {
2441  /* FIXME: not implemented yet */
2443  }
2444 
2445  RegCloseKey(hKey);
2446 
2447  return ret;
2448 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:85
#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:75
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)
#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 3126 of file umpnpmgr.c.

3128 {
3129  UNIMPLEMENTED;
3130  return CR_CALL_NOT_IMPLEMENTED;
3131 }
#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 2307 of file umpnpmgr.c.

Referenced by CM_Is_Dock_Station_Present_Ex().

2310 {
2311  HKEY hKey;
2312  DWORD dwType;
2313  DWORD dwValue;
2314  DWORD dwSize;
2316 
2317  UNREFERENCED_PARAMETER(hBinding);
2318 
2319  DPRINT1("PNP_IsDockStationPresent() called\n");
2320 
2321  *Present = FALSE;
2322 
2324  L"CurrentDockInfo",
2325  0,
2326  KEY_READ,
2327  &hKey) != ERROR_SUCCESS)
2328  return CR_REGISTRY_ERROR;
2329 
2330  dwSize = sizeof(DWORD);
2331  if (RegQueryValueExW(hKey,
2332  L"DockingState",
2333  NULL,
2334  &dwType,
2335  (LPBYTE)&dwValue,
2336  &dwSize) != ERROR_SUCCESS)
2337  ret = CR_REGISTRY_ERROR;
2338 
2339  RegCloseKey(hKey);
2340 
2341  if (ret == CR_SUCCESS)
2342  {
2343  if (dwType != REG_DWORD || dwSize != sizeof(DWORD))
2344  {
2345  ret = CR_REGISTRY_ERROR;
2346  }
2347  else if (dwValue != 0)
2348  {
2349  *Present = TRUE;
2350  }
2351  }
2352 
2353  DPRINT1("PNP_IsDockStationPresent() done (returns %lx)\n", ret);
2354 
2355  return ret;
2356 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:85
#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:75
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
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 2760 of file umpnpmgr.c.

2771 {
2772  UNIMPLEMENTED;
2773  return CR_CALL_NOT_IMPLEMENTED;
2774 }
#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 2828 of file umpnpmgr.c.

Referenced by CM_Query_Arbitrator_Free_Data_Ex().

2835 {
2836  UNIMPLEMENTED;
2837  return CR_CALL_NOT_IMPLEMENTED;
2838 }
#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 2844 of file umpnpmgr.c.

Referenced by CM_Query_Arbitrator_Free_Size_Ex().

2850 {
2851  UNIMPLEMENTED;
2852  return CR_CALL_NOT_IMPLEMENTED;
2853 }
#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 2275 of file umpnpmgr.c.

Referenced by CM_Query_And_Remove_SubTree_ExW().

2282 {
2283  UNIMPLEMENTED;
2284  return CR_CALL_NOT_IMPLEMENTED;
2285 }
#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 2797 of file umpnpmgr.c.

Referenced by CM_Query_Resource_Conflict_List().

2806 {
2807  UNIMPLEMENTED;
2808  return CR_CALL_NOT_IMPLEMENTED;
2809 }
#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 1454 of file umpnpmgr.c.

Referenced by CM_Register_Device_Interface_ExW().

1463 {
1464  UNIMPLEMENTED;
1465  return CR_CALL_NOT_IMPLEMENTED;
1466 }
#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 2262 of file umpnpmgr.c.

Referenced by CM_Register_Device_Driver_Ex().

2266 {
2267  UNIMPLEMENTED;
2268  return CR_CALL_NOT_IMPLEMENTED;
2269 }
#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 2870 of file umpnpmgr.c.

Referenced by CMP_RegisterNotification().

2874 {
2875 #if 0
2876  PNOTIFY_DATA pNotifyData;
2877 #endif
2878 
2879  DPRINT1("PNP_RegisterNotification(%p 0x%lx %p)\n",
2880  hBinding, ulFlags, pulNotify);
2881 
2882 #if 0
2883  pNotifyData = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NOTIFY_DATA));
2884  if (pNotifyData == NULL)
2885  return CR_OUT_OF_MEMORY;
2886 
2887  *pulNotify = (DWORD)pNotifyData;
2888 #endif
2889 
2890  *pulNotify = 1;
2891 
2892  return CR_SUCCESS;
2893 }
#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 3170 of file umpnpmgr.c.

3172 {
3173  UNIMPLEMENTED;
3174  return CR_CALL_NOT_IMPLEMENTED;
3175 }
#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:1056
#define TOKEN_ASSIGN_PRIMARY
Definition: setypes.h:871
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
DWORD DWORD
Definition: winlogon.h:75
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:52
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 2291 of file umpnpmgr.c.

Referenced by CM_Request_Device_Eject_ExW().

2298 {
2299  UNIMPLEMENTED;
2300  return CR_CALL_NOT_IMPLEMENTED;
2301 }
#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 2362 of file umpnpmgr.c.

Referenced by CM_Request_Eject_PC_Ex().

2364 {
2365  UNIMPLEMENTED;
2366  return CR_CALL_NOT_IMPLEMENTED;
2367 }
#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 2859 of file umpnpmgr.c.

Referenced by CM_Run_Detection_Ex().

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

Definition at line 3181 of file umpnpmgr.c.

3185 {
3186  UNIMPLEMENTED;
3187  return CR_CALL_NOT_IMPLEMENTED;
3188 }
#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 1609 of file umpnpmgr.c.

1617 {
1619  LPWSTR lpValueName = NULL;
1620  HKEY hInstKey = 0;
1621  HKEY hPropKey = 0;
1622  LONG lError;
1623 
1624  UNREFERENCED_PARAMETER(hBinding);
1625 
1626  DPRINT("PNP_SetClassRegProp() called\n");
1627 
1628  if (ulFlags != 0)
1629  return CR_INVALID_FLAG;
1630 
1631  switch (ulProperty)
1632  {
1633  case CM_CRP_SECURITY:
1634  lpValueName = L"Security";
1635  break;
1636 
1637  case CM_CRP_DEVTYPE:
1638  lpValueName = L"DeviceType";
1639  break;
1640 
1641  case CM_CRP_EXCLUSIVE:
1642  lpValueName = L"Exclusive";
1643  break;
1644 
1646  lpValueName = L"DeviceCharacteristics";
1647  break;
1648 
1649  default:
1650  return CR_INVALID_PROPERTY;
1651  }
1652 
1653  lError = RegOpenKeyExW(hClassKey,
1654  pszClassGuid,
1655  0,
1656  KEY_WRITE,
1657  &hInstKey);
1658  if (lError != ERROR_SUCCESS)
1659  {
1661  goto done;
1662  }
1663 
1664  /* FIXME: Set security descriptor */
1665  lError = RegCreateKeyExW(hInstKey,
1666  L"Properties",
1667  0,
1668  NULL,
1671  NULL,
1672  &hPropKey,
1673  NULL);
1674  if (lError != ERROR_SUCCESS)
1675  {
1676  ret = CR_REGISTRY_ERROR;
1677  goto done;
1678  }
1679 
1680  if (ulLength == 0)
1681  {
1682  if (RegDeleteValueW(hPropKey,
1683  lpValueName))
1684  ret = CR_REGISTRY_ERROR;
1685  }
1686  else
1687  {
1688  if (RegSetValueExW(hPropKey,
1689  lpValueName,
1690  0,
1691  ulDataType,
1692  Buffer,
1693  ulLength))
1694  ret = CR_REGISTRY_ERROR;
1695  }
1696 
1697 done:
1698  if (hPropKey != NULL)
1699  RegCloseKey(hPropKey);
1700 
1701  if (hInstKey != NULL)
1702  RegCloseKey(hInstKey);
1703 
1704  return ret;
1705 }
#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
Definition: bidi.c:85
#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
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: reg.c:3381
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
static HKEY hClassKey
Definition: umpnpmgr.c:66
DWORD WINAPI PNP_SetDeviceProblem ( handle_t  hBinding,
LPWSTR  pDeviceID,
DWORD  ulProblem,
DWORD  ulFlags 
)

Definition at line 2069 of file umpnpmgr.c.

Referenced by CM_Set_DevNode_Problem_Ex().

2074 {
2075  UNIMPLEMENTED;
2076  return CR_CALL_NOT_IMPLEMENTED;
2077 }
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI PNP_SetDeviceRegProp ( handle_t  hBinding,
LPWSTR  pDeviceId,
DWORD  ulProperty,
DWORD  ulDataType,
BYTE