mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Implement CM_Locate_DevNode_ExW, CM_Get_Device_ID_Size[_Ex] and CM_Get_Device_ID[_Ex]W.
- Add flags for CM_Get_Global_State[_Ex]. svn path=/trunk/; revision=16603
This commit is contained in:
parent
b4d21f4107
commit
108c748343
9 changed files with 391 additions and 119 deletions
|
@ -21,7 +21,7 @@ interface pnp
|
|||
[out] unsigned long *State,
|
||||
[in] unsigned long Flags);
|
||||
|
||||
// CONFIGRET PNP_GetRootDeviceInstance(handle_t BindingHandle,
|
||||
// [out, string, size_is(Length)] wchar_t *DeviceInstance,
|
||||
// [in] DWORD Length);
|
||||
CONFIGRET PNP_ValidateDeviceInstance(handle_t BindingHandle,
|
||||
[in, string] wchar_t *DeviceInstance,
|
||||
[in] DWORD Flags);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,12 @@ CONFIGRET WINAPI CM_Enumerate_Classes( ULONG, LPGUID, ULONG );
|
|||
CONFIGRET WINAPI CM_Enumerate_Classes_Ex( ULONG, LPGUID, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Child( PDEVINST, DEVINST, ULONG );
|
||||
CONFIGRET WINAPI CM_Get_Child_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Device_IDA( DEVINST, PCHAR, ULONG, ULONG );
|
||||
CONFIGRET WINAPI CM_Get_Device_IDW( DEVINST, PWCHAR, ULONG, ULONG );
|
||||
#define CM_Get_Device_ID WINELIB_NAME_AW(CM_Get_Device_ID)
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ExW( DEVINST, PWCHAR, ULONG, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ExA( DEVINST, PCHAR, ULONG, ULONG, HMACHINE );
|
||||
#define CM_Get_Device_ID_Ex WINELIB_NAME_AW(CM_Get_Device_ID_Ex)
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ListA( PCSTR, PCHAR, ULONG, ULONG );
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ListW( PCWSTR, PWCHAR, ULONG, ULONG );
|
||||
#define CM_Get_Device_ID_List WINELIB_NAME_AW(CM_Get_Device_ID_List)
|
||||
|
@ -93,6 +99,8 @@ CONFIGRET WINAPI CM_Get_Device_ID_List_SizeW( PULONG, PCWSTR, ULONG );
|
|||
CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExA( PULONG, PCSTR, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExW( PULONG, PCWSTR, ULONG, HMACHINE );
|
||||
#define CM_Get_Device_ID_List_Size_Ex WINELIB_NAME_AW(CM_Get_Device_ID_List_Size_Ex)
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size( PULONG, DEVINST, ULONG );
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size_Ex( PULONG, DEVINST, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Global_State( PULONG, ULONG );
|
||||
CONFIGRET WINAPI CM_Get_Global_State_Ex( PULONG, ULONG, HMACHINE );
|
||||
CONFIGRET WINAPI CM_Get_Parent( PDEVINST, DEVINST, ULONG );
|
||||
|
|
|
@ -49,7 +49,9 @@ static const WCHAR ControlClass[] = {'S','y','s','t','e','m','\\',
|
|||
|
||||
typedef struct _MACHINE_INFO
|
||||
{
|
||||
WCHAR szMachineName[MAX_PATH];
|
||||
RPC_BINDING_HANDLE BindingHandle;
|
||||
HSTRING_TABLE StringTable;
|
||||
} MACHINE_INFO, *PMACHINE_INFO;
|
||||
|
||||
|
||||
|
@ -86,13 +88,25 @@ CONFIGRET WINAPI CM_Connect_MachineW(PCWSTR UNCServerName, PHMACHINE phMachine)
|
|||
|
||||
TRACE("%s %p\n", debugstr_w(UNCServerName), phMachine);
|
||||
|
||||
pMachine = (PMACHINE_INFO)GlobalAlloc(GPTR, sizeof(MACHINE_INFO));
|
||||
pMachine = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MACHINE_INFO));
|
||||
if (pMachine == NULL)
|
||||
return CR_OUT_OF_MEMORY;
|
||||
|
||||
lstrcpyW(pMachine->szMachineName, UNCServerName);
|
||||
|
||||
pMachine->StringTable = StringTableInitialize();
|
||||
if (pMachine->StringTable == NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pMachine);
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
StringTableAddString(pMachine->StringTable, L"PLT", 1);
|
||||
|
||||
if (!PnpBindRpc(UNCServerName, &pMachine->BindingHandle))
|
||||
{
|
||||
GlobalFree(pMachine);
|
||||
StringTableDestroy(pMachine->StringTable);
|
||||
HeapFree(GetProcessHeap(), 0, pMachine);
|
||||
return CR_INVALID_MACHINENAME;
|
||||
}
|
||||
|
||||
|
@ -111,14 +125,17 @@ CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE hMachine)
|
|||
|
||||
TRACE("%lx\n", hMachine);
|
||||
|
||||
if (hMachine == NULL)
|
||||
pMachine = (PMACHINE_INFO)hMachine;
|
||||
if (pMachine == NULL)
|
||||
return CR_SUCCESS;
|
||||
|
||||
pMachine = (PMACHINE_INFO)hMachine;
|
||||
if (pMachine->StringTable != NULL)
|
||||
StringTableDestroy(pMachine->StringTable);
|
||||
|
||||
if (!PnpUnbindRpc(pMachine->BindingHandle))
|
||||
return CR_ACCESS_DENIED;
|
||||
|
||||
GlobalFree(pMachine);
|
||||
HeapFree(GetProcessHeap(), 0, pMachine);
|
||||
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
@ -239,11 +256,85 @@ CONFIGRET WINAPI CM_Get_Child_Ex(
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_IDA [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_IDA(
|
||||
DEVINST dnDevInst, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
TRACE("%lx %p %ld %ld\n",
|
||||
dnDevInst, Buffer, BufferLen, ulFlags);
|
||||
return CM_Get_Device_ID_ExA(dnDevInst, Buffer, BufferLen, ulFlags, NULL);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_IDW [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_IDW(
|
||||
DEVINST dnDevInst, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
TRACE("%lx %p %ld %ld\n",
|
||||
dnDevInst, Buffer, BufferLen, ulFlags);
|
||||
return CM_Get_Device_ID_ExW(dnDevInst, Buffer, BufferLen, ulFlags, NULL);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_ExA [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ExA(
|
||||
DEVINST dnDevInst, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags,
|
||||
HMACHINE hMachine)
|
||||
{
|
||||
FIXME("%lx %p %ld %ld %lx\n",
|
||||
dnDevInst, Buffer, BufferLen, ulFlags, hMachine);
|
||||
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_ExW [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ExW(
|
||||
DEVINST dnDevInst, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags,
|
||||
HMACHINE hMachine)
|
||||
{
|
||||
HSTRING_TABLE StringTable = NULL;
|
||||
|
||||
TRACE("%lx %p %ld %ld %lx\n",
|
||||
dnDevInst, Buffer, BufferLen, ulFlags, hMachine);
|
||||
|
||||
if (hMachine != NULL)
|
||||
{
|
||||
StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
|
||||
if (StringTable == NULL)
|
||||
return CR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!PnpGetLocalHandles(NULL, &StringTable))
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
if (!StringTableStringFromIdEx(StringTable,
|
||||
dnDevInst,
|
||||
Buffer,
|
||||
&BufferLen))
|
||||
{
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_ListA [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ListA(
|
||||
PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags )
|
||||
PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
TRACE("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags);
|
||||
return CM_Get_Device_ID_List_ExA(pszFilter, Buffer, BufferLen,
|
||||
|
@ -255,7 +346,7 @@ CONFIGRET WINAPI CM_Get_Device_ID_ListA(
|
|||
* CM_Get_Device_ID_ListW [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_ListW(
|
||||
PCWSTR pszFilter, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags )
|
||||
PCWSTR pszFilter, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
TRACE("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags);
|
||||
return CM_Get_Device_ID_List_ExW(pszFilter, Buffer, BufferLen,
|
||||
|
@ -268,7 +359,7 @@ CONFIGRET WINAPI CM_Get_Device_ID_ListW(
|
|||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_List_ExA(
|
||||
PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags,
|
||||
HMACHINE hMachine )
|
||||
HMACHINE hMachine)
|
||||
{
|
||||
FIXME("%p %p %ld %ld %lx\n",
|
||||
pszFilter, Buffer, BufferLen, ulFlags, hMachine);
|
||||
|
@ -282,7 +373,7 @@ CONFIGRET WINAPI CM_Get_Device_ID_List_ExA(
|
|||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_List_ExW(
|
||||
PCWSTR pszFilter, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags,
|
||||
HMACHINE hMachine )
|
||||
HMACHINE hMachine)
|
||||
{
|
||||
FIXME("%p %p %ld %ld %lx\n",
|
||||
pszFilter, Buffer, BufferLen, ulFlags, hMachine);
|
||||
|
@ -337,6 +428,53 @@ CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExW(
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_Size [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size(
|
||||
PULONG pulLen, DEVINST dnDevInst, ULONG ulFlags)
|
||||
{
|
||||
TRACE("%p %p %lx\n", pulLen, dnDevInst, ulFlags);
|
||||
return CM_Get_Device_ID_Size_Ex(pulLen, dnDevInst, ulFlags, NULL);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_Size_Ex [SETUPAPI.@]
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size_Ex(
|
||||
PULONG pulLen, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
||||
{
|
||||
HSTRING_TABLE StringTable = NULL;
|
||||
LPWSTR DeviceId;
|
||||
|
||||
TRACE("%p %p %lx %lx\n", pulLen, dnDevInst, ulFlags, hMachine);
|
||||
|
||||
if (hMachine != NULL)
|
||||
{
|
||||
StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
|
||||
if (StringTable == NULL)
|
||||
return CR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!PnpGetLocalHandles(NULL, &StringTable))
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
DeviceId = StringTableStringFromId(StringTable, dnDevInst);
|
||||
if (DeviceId == NULL)
|
||||
{
|
||||
*pulLen = 0;
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
*pulLen = lstrlenW(DeviceId);
|
||||
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Global_State [SETUPAPI.@]
|
||||
*/
|
||||
|
@ -355,7 +493,6 @@ CONFIGRET WINAPI CM_Get_Global_State_Ex(
|
|||
PULONG pulState, ULONG ulFlags, HMACHINE hMachine)
|
||||
{
|
||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||
RPC_STATUS Status;
|
||||
|
||||
TRACE("%p %lx %lx\n", pulState, ulFlags, hMachine);
|
||||
|
||||
|
@ -373,8 +510,7 @@ CONFIGRET WINAPI CM_Get_Global_State_Ex(
|
|||
}
|
||||
else
|
||||
{
|
||||
Status = PnpGetLocalBindingHandle(&BindingHandle);
|
||||
if (Status != RPC_S_OK)
|
||||
if (!PnpGetLocalHandles(&BindingHandle, NULL))
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -442,7 +578,6 @@ WORD WINAPI CM_Get_Version(VOID)
|
|||
WORD WINAPI CM_Get_Version_Ex(HMACHINE hMachine)
|
||||
{
|
||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||
RPC_STATUS Status;
|
||||
WORD Version = 0;
|
||||
|
||||
TRACE("%lx\n", hMachine);
|
||||
|
@ -455,9 +590,8 @@ WORD WINAPI CM_Get_Version_Ex(HMACHINE hMachine)
|
|||
}
|
||||
else
|
||||
{
|
||||
Status = PnpGetLocalBindingHandle(&BindingHandle);
|
||||
if (Status != RPC_S_OK)
|
||||
return 0;
|
||||
if (!PnpGetLocalHandles(&BindingHandle, NULL))
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
if (PNP_GetVersion(BindingHandle, &Version) != CR_SUCCESS)
|
||||
|
@ -521,6 +655,49 @@ CONFIGRET WINAPI CM_Locate_DevNode_ExA(
|
|||
CONFIGRET WINAPI CM_Locate_DevNode_ExW(
|
||||
PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags, HMACHINE hMachine)
|
||||
{
|
||||
FIXME("%p %s %lu %lx\n", pdnDevInst, debugstr_w(pDeviceID), ulFlags, hMachine);
|
||||
return CR_SUCCESS;
|
||||
WCHAR DeviceIdBuffer[MAX_DEVICE_ID_LEN];
|
||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||
HSTRING_TABLE StringTable = NULL;
|
||||
CONFIGRET rc = CR_SUCCESS;
|
||||
|
||||
TRACE("%p %s %lu %lx\n", pdnDevInst, debugstr_w(pDeviceID), ulFlags, hMachine);
|
||||
|
||||
if (hMachine != NULL)
|
||||
{
|
||||
BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
|
||||
if (BindingHandle == NULL)
|
||||
return CR_FAILURE;
|
||||
|
||||
StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
|
||||
if (StringTable == 0)
|
||||
return CR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
|
||||
return CR_FAILURE;
|
||||
}
|
||||
|
||||
if (pDeviceID != NULL && wcslen(pDeviceID) != 0)
|
||||
{
|
||||
lstrcpyW(DeviceIdBuffer, pDeviceID);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the root device ID */
|
||||
lstrcpyW(DeviceIdBuffer, L"HTREE\\ROOT\\0");
|
||||
}
|
||||
|
||||
/* Validate the device ID */
|
||||
rc = PNP_ValidateDeviceInstance(BindingHandle,
|
||||
DeviceIdBuffer,
|
||||
ulFlags);
|
||||
if (rc == CR_SUCCESS)
|
||||
{
|
||||
*pdnDevInst = StringTableAddString(StringTable, DeviceIdBuffer, 1);
|
||||
if (*pdnDevInst == -1)
|
||||
rc = CR_FAILURE;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
#include <windows.h>
|
||||
#include <rpc.h>
|
||||
#include <rpcdce.h>
|
||||
#include <setupapi.h>
|
||||
#include "rpc_private.h"
|
||||
|
||||
|
||||
static RPC_BINDING_HANDLE LocalBindingHandle = NULL;
|
||||
static HSTRING_TABLE LocalStringTable = NULL;
|
||||
|
||||
|
||||
RPC_STATUS
|
||||
|
@ -65,22 +67,48 @@ PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle)
|
|||
}
|
||||
|
||||
|
||||
RPC_STATUS
|
||||
PnpGetLocalBindingHandle(RPC_BINDING_HANDLE *BindingHandle)
|
||||
BOOL
|
||||
PnpGetLocalHandles(RPC_BINDING_HANDLE *BindingHandle,
|
||||
HSTRING_TABLE *StringTable)
|
||||
{
|
||||
if (LocalBindingHandle != NULL)
|
||||
{
|
||||
BindingHandle = LocalBindingHandle;
|
||||
return RPC_S_OK;
|
||||
if (BindingHandle != NULL)
|
||||
*BindingHandle = LocalBindingHandle;
|
||||
|
||||
if (StringTable != NULL)
|
||||
*StringTable = LocalStringTable;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return PnpBindRpc(NULL, BindingHandle);
|
||||
LocalStringTable = StringTableInitialize();
|
||||
if (LocalStringTable == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (PnpBindRpc(NULL, &LocalBindingHandle) != RPC_S_OK)
|
||||
{
|
||||
StringTableDestroy(LocalStringTable);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
StringTableAddString(LocalStringTable, L"PLT", 1);
|
||||
|
||||
if (BindingHandle != NULL)
|
||||
*BindingHandle = LocalBindingHandle;
|
||||
|
||||
if (StringTable != NULL)
|
||||
*StringTable = LocalStringTable;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
RPC_STATUS
|
||||
PnpUnbindLocalBindingHandle(VOID)
|
||||
{
|
||||
StringTableDestroy(LocalStringTable);
|
||||
LocalStringTable = NULL;
|
||||
return PnpUnbindRpc(&LocalBindingHandle);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,9 @@ RPC_STATUS PnpBindRpc(LPCWSTR pszMachine,
|
|||
RPC_BINDING_HANDLE* BindingHandle);
|
||||
RPC_STATUS PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle);
|
||||
|
||||
RPC_STATUS PnpGetLocalBindingHandle(RPC_BINDING_HANDLE *BindingHandle);
|
||||
BOOL
|
||||
PnpGetLocalHandles(RPC_BINDING_HANDLE *BindingHandle,
|
||||
HSTRING_TABLE *StringTable);
|
||||
RPC_STATUS PnpUnbindLocalHandles(VOID);
|
||||
|
||||
#endif /* __RPC_PRIVATE_H */
|
||||
|
|
|
@ -71,10 +71,10 @@
|
|||
@ stub CM_Get_DevNode_Registry_Property_ExW
|
||||
@ stub CM_Get_DevNode_Status
|
||||
@ stub CM_Get_DevNode_Status_Ex
|
||||
@ stub CM_Get_Device_IDA
|
||||
@ stub CM_Get_Device_IDW
|
||||
@ stub CM_Get_Device_ID_ExA
|
||||
@ stub CM_Get_Device_ID_ExW
|
||||
@ stdcall CM_Get_Device_IDA(long str long long)
|
||||
@ stdcall CM_Get_Device_IDW(long wstr long long)
|
||||
@ stdcall CM_Get_Device_ID_ExA(long str long long long)
|
||||
@ stdcall CM_Get_Device_ID_ExW(long wstr long long long)
|
||||
@ stdcall CM_Get_Device_ID_ListA(str str long long)
|
||||
@ stdcall CM_Get_Device_ID_ListW(wstr wstr long long)
|
||||
@ stdcall CM_Get_Device_ID_List_ExA(str str long long long)
|
||||
|
@ -83,8 +83,8 @@
|
|||
@ stdcall CM_Get_Device_ID_List_SizeW(ptr wstr long)
|
||||
@ stdcall CM_Get_Device_ID_List_Size_ExA(ptr str long long)
|
||||
@ stdcall CM_Get_Device_ID_List_Size_ExW(ptr wstr long long)
|
||||
@ stub CM_Get_Device_ID_Size
|
||||
@ stub CM_Get_Device_ID_Size_Ex
|
||||
@ stdcall CM_Get_Device_ID_Size(ptr long long)
|
||||
@ stdcall CM_Get_Device_ID_Size_Ex(ptr long long long)
|
||||
@ stub CM_Get_Device_Interface_AliasA
|
||||
@ stub CM_Get_Device_Interface_AliasW
|
||||
@ stub CM_Get_Device_Interface_Alias_ExA
|
||||
|
@ -128,6 +128,7 @@
|
|||
@ stub CM_Intersect_Range_List
|
||||
@ stub CM_Invert_Range_List
|
||||
@ stub CM_Is_Dock_Station_Present
|
||||
@ stub CM_Is_Dock_Station_Present_Ex
|
||||
@ stdcall CM_Locate_DevNodeA(ptr str long)
|
||||
@ stdcall CM_Locate_DevNodeW(ptr wstr long)
|
||||
@ stdcall CM_Locate_DevNode_ExA(ptr str long long)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <ndk/ntndk.h>
|
||||
#include <ndk/sysguid.h>
|
||||
#include <ddk/wdmguid.h>
|
||||
#include <ddk/cfgmgr32.h>
|
||||
|
||||
#include <rpc.h>
|
||||
#include <rpcdce.h>
|
||||
|
@ -107,22 +108,71 @@ void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
|
|||
}
|
||||
|
||||
|
||||
//CONFIRET PNP_GetVersion(RPC_BINDING_HANDLE BindingHandle,
|
||||
// WORD *Version)
|
||||
unsigned long PNP_GetVersion(handle_t BindingHandle,
|
||||
CONFIGRET
|
||||
PNP_GetVersion(handle_t BindingHandle,
|
||||
unsigned short *Version)
|
||||
{
|
||||
*Version = 0x0400;
|
||||
return 0; /* CR_SUCCESS */
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
unsigned long PNP_GetGlobalState(handle_t BindingHandle,
|
||||
CONFIGRET
|
||||
PNP_GetGlobalState(handle_t BindingHandle,
|
||||
unsigned long *State,
|
||||
unsigned long Flags)
|
||||
{
|
||||
*State = 5;
|
||||
return 0; /* CR_SUCCESS */
|
||||
*State = CM_GLOBAL_STATE_CAN_DO_UI | CM_GLOBAL_STATE_SERVICES_AVAILABLE;
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
CONFIGRET
|
||||
PNP_ValidateDeviceInstance(handle_t BindingHandle,
|
||||
wchar_t *DeviceInstance,
|
||||
unsigned long Flags)
|
||||
{
|
||||
CONFIGRET ret = CR_SUCCESS;
|
||||
HKEY hEnumKey = NULL;
|
||||
HKEY hDeviceKey = NULL;
|
||||
|
||||
DPRINT("PNP_ValidateDeviceInstance(%S %lx) called\n",
|
||||
DeviceInstance, Flags);
|
||||
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&hEnumKey))
|
||||
{
|
||||
DPRINT("Could not open the Enum Key!\n");
|
||||
ret = CR_FAILURE;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (RegOpenKeyExW(hEnumKey,
|
||||
DeviceInstance,
|
||||
0,
|
||||
KEY_READ,
|
||||
&hDeviceKey))
|
||||
{
|
||||
DPRINT("Could not open the Device Key!\n");
|
||||
ret = CR_NO_SUCH_DEVNODE;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
/* FIXME: add more tests */
|
||||
|
||||
Done:
|
||||
if (hDeviceKey != NULL)
|
||||
RegCloseKey(hDeviceKey);
|
||||
|
||||
if (hEnumKey != NULL)
|
||||
RegCloseKey(hEnumKey);
|
||||
|
||||
DPRINT("PNP_ValidateDeviceInstance() done (returns %lx)\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,6 +132,12 @@ typedef enum _PNP_VETO_TYPE {
|
|||
PNP_VetoLegacyDriver
|
||||
} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
|
||||
|
||||
#define CM_GLOBAL_STATE_CAN_DO_UI 0x00000001
|
||||
#define CM_GLOBAL_STATE_ON_BIG_STACK 0x00000002
|
||||
#define CM_GLOBAL_STATE_SERVICES_AVAILABLE 0x00000004
|
||||
#define CM_GLOBAL_STATE_SHUTTING_DOWN 0x00000008
|
||||
#define CM_GLOBAL_STATE_DETECTION_PENDING 0x00000010
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue