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
|
||||
{
|
||||
RPC_BINDING_HANDLE BindingHandle;
|
||||
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,
|
||||
unsigned short *Version)
|
||||
CONFIGRET
|
||||
PNP_GetVersion(handle_t BindingHandle,
|
||||
unsigned short *Version)
|
||||
{
|
||||
*Version = 0x0400;
|
||||
return 0; /* CR_SUCCESS */
|
||||
*Version = 0x0400;
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
unsigned long PNP_GetGlobalState(handle_t BindingHandle,
|
||||
unsigned long *State,
|
||||
unsigned long Flags)
|
||||
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
|
||||
|
|
|
@ -243,9 +243,9 @@ typedef struct DevPrivate_Des_s {
|
|||
} DEVPRIVATE_DES, *PDEVPRIVATE_DES;
|
||||
|
||||
typedef struct DevPrivate_Range_s {
|
||||
DWORD PR_Data1;
|
||||
DWORD PR_Data2;
|
||||
DWORD PR_Data3;
|
||||
DWORD PR_Data1;
|
||||
DWORD PR_Data2;
|
||||
DWORD PR_Data3;
|
||||
} DEVPRIVATE_RANGE, *PDEVPRIVATE_RANGE;
|
||||
|
||||
#define PType_Range sizeof(DEVPRIVATE_RANGE)
|
||||
|
@ -293,16 +293,16 @@ typedef struct DMA_Resource_s {
|
|||
} DMA_RESOURCE, *PDMA_RESOURCE;
|
||||
|
||||
/* IO_DES.Type constants and masks */
|
||||
#define fIOD_PortType 0x1
|
||||
#define fIOD_Memory 0x0
|
||||
#define fIOD_IO 0x1
|
||||
#define fIOD_DECODE 0x00fc
|
||||
#define fIOD_10_BIT_DECODE 0x0004
|
||||
#define fIOD_12_BIT_DECODE 0x0008
|
||||
#define fIOD_16_BIT_DECODE 0x0010
|
||||
#define fIOD_POSITIVE_DECODE 0x0020
|
||||
#define fIOD_PASSIVE_DECODE 0x0040
|
||||
#define fIOD_WINDOW_DECODE 0x0080
|
||||
#define fIOD_PortType 0x1
|
||||
#define fIOD_Memory 0x0
|
||||
#define fIOD_IO 0x1
|
||||
#define fIOD_DECODE 0x00fc
|
||||
#define fIOD_10_BIT_DECODE 0x0004
|
||||
#define fIOD_12_BIT_DECODE 0x0008
|
||||
#define fIOD_16_BIT_DECODE 0x0010
|
||||
#define fIOD_POSITIVE_DECODE 0x0020
|
||||
#define fIOD_PASSIVE_DECODE 0x0040
|
||||
#define fIOD_WINDOW_DECODE 0x0080
|
||||
|
||||
typedef struct IO_Des_s {
|
||||
DWORD IOD_Count;
|
||||
|
@ -313,10 +313,10 @@ typedef struct IO_Des_s {
|
|||
} IO_DES, *PIO_DES;
|
||||
|
||||
/* IO_RANGE.IOR_Alias constants */
|
||||
#define IO_ALIAS_10_BIT_DECODE 0x00000004
|
||||
#define IO_ALIAS_12_BIT_DECODE 0x00000010
|
||||
#define IO_ALIAS_16_BIT_DECODE 0x00000000
|
||||
#define IO_ALIAS_POSITIVE_DECODE 0x000000FF
|
||||
#define IO_ALIAS_10_BIT_DECODE 0x00000004
|
||||
#define IO_ALIAS_12_BIT_DECODE 0x00000010
|
||||
#define IO_ALIAS_16_BIT_DECODE 0x00000000
|
||||
#define IO_ALIAS_POSITIVE_DECODE 0x000000FF
|
||||
|
||||
typedef struct IO_Range_s {
|
||||
DWORDLONG IOR_Align;
|
||||
|
@ -335,16 +335,16 @@ typedef struct IO_Resource_s {
|
|||
} IO_RESOURCE, *PIO_RESOURCE;
|
||||
|
||||
/* IRQ_DES.IRQD_flags constants */
|
||||
#define mIRQD_Share 0x1
|
||||
#define fIRQD_Exclusive 0x0
|
||||
#define fIRQD_Share 0x1
|
||||
#define mIRQD_Share 0x1
|
||||
#define fIRQD_Exclusive 0x0
|
||||
#define fIRQD_Share 0x1
|
||||
|
||||
#define fIRQD_Share_Bit 0
|
||||
#define fIRQD_Level_Bit 1
|
||||
#define fIRQD_Share_Bit 0
|
||||
#define fIRQD_Level_Bit 1
|
||||
|
||||
#define mIRQD_Edge_Level 0x2
|
||||
#define fIRQD_Level 0x0
|
||||
#define fIRQD_Edge 0x2
|
||||
#define mIRQD_Edge_Level 0x2
|
||||
#define fIRQD_Level 0x0
|
||||
#define fIRQD_Edge 0x2
|
||||
|
||||
typedef struct IRQ_Des_32_s {
|
||||
DWORD IRQD_Count;
|
||||
|
@ -469,51 +469,51 @@ typedef struct PcCard_Des_s {
|
|||
DWORD PCD_MemoryCardBase2;
|
||||
} PCCARD_DES, *PPCCARD_DES;
|
||||
|
||||
#define mPCD_IO_8_16 0x1
|
||||
#define fPCD_IO_8 0x0
|
||||
#define fPCD_IO_16 0x1
|
||||
#define mPCD_MEM_8_16 0x2
|
||||
#define fPCD_MEM_8 0x0
|
||||
#define fPCD_MEM_16 0x2
|
||||
#define mPCD_MEM_A_C 0xC
|
||||
#define fPCD_MEM1_A 0x4
|
||||
#define fPCD_MEM2_A 0x8
|
||||
#define fPCD_IO_ZW_8 0x10
|
||||
#define fPCD_IO_SRC_16 0x20
|
||||
#define fPCD_IO_WS_16 0x40
|
||||
#define mPCD_MEM_WS 0x300
|
||||
#define fPCD_MEM_WS_ONE 0x100
|
||||
#define fPCD_MEM_WS_TWO 0x200
|
||||
#define fPCD_MEM_WS_THREE 0x300
|
||||
#define mPCD_IO_8_16 0x1
|
||||
#define fPCD_IO_8 0x0
|
||||
#define fPCD_IO_16 0x1
|
||||
#define mPCD_MEM_8_16 0x2
|
||||
#define fPCD_MEM_8 0x0
|
||||
#define fPCD_MEM_16 0x2
|
||||
#define mPCD_MEM_A_C 0xC
|
||||
#define fPCD_MEM1_A 0x4
|
||||
#define fPCD_MEM2_A 0x8
|
||||
#define fPCD_IO_ZW_8 0x10
|
||||
#define fPCD_IO_SRC_16 0x20
|
||||
#define fPCD_IO_WS_16 0x40
|
||||
#define mPCD_MEM_WS 0x300
|
||||
#define fPCD_MEM_WS_ONE 0x100
|
||||
#define fPCD_MEM_WS_TWO 0x200
|
||||
#define fPCD_MEM_WS_THREE 0x300
|
||||
|
||||
#define fPCD_MEM_A 0x4
|
||||
#define fPCD_MEM_A 0x4
|
||||
|
||||
#define fPCD_ATTRIBUTES_PER_WINDOW 0x8000
|
||||
#define fPCD_ATTRIBUTES_PER_WINDOW 0x8000
|
||||
|
||||
#define fPCD_IO1_16 0x00010000
|
||||
#define fPCD_IO1_ZW_8 0x00020000
|
||||
#define fPCD_IO1_SRC_16 0x00040000
|
||||
#define fPCD_IO1_WS_16 0x00080000
|
||||
#define fPCD_IO1_16 0x00010000
|
||||
#define fPCD_IO1_ZW_8 0x00020000
|
||||
#define fPCD_IO1_SRC_16 0x00040000
|
||||
#define fPCD_IO1_WS_16 0x00080000
|
||||
|
||||
#define fPCD_IO2_16 0x00100000
|
||||
#define fPCD_IO2_ZW_8 0x00200000
|
||||
#define fPCD_IO2_SRC_16 0x00400000
|
||||
#define fPCD_IO2_WS_16 0x00800000
|
||||
#define fPCD_IO2_16 0x00100000
|
||||
#define fPCD_IO2_ZW_8 0x00200000
|
||||
#define fPCD_IO2_SRC_16 0x00400000
|
||||
#define fPCD_IO2_WS_16 0x00800000
|
||||
|
||||
#define mPCD_MEM1_WS 0x03000000
|
||||
#define fPCD_MEM1_WS_ONE 0x01000000
|
||||
#define fPCD_MEM1_WS_TWO 0x02000000
|
||||
#define fPCD_MEM1_WS_THREE 0x03000000
|
||||
#define fPCD_MEM1_16 0x04000000
|
||||
#define mPCD_MEM1_WS 0x03000000
|
||||
#define fPCD_MEM1_WS_ONE 0x01000000
|
||||
#define fPCD_MEM1_WS_TWO 0x02000000
|
||||
#define fPCD_MEM1_WS_THREE 0x03000000
|
||||
#define fPCD_MEM1_16 0x04000000
|
||||
|
||||
#define mPCD_MEM2_WS 0x30000000
|
||||
#define fPCD_MEM2_WS_ONE 0x10000000
|
||||
#define fPCD_MEM2_WS_TWO 0x20000000
|
||||
#define fPCD_MEM2_WS_THREE 0x30000000
|
||||
#define fPCD_MEM2_16 0x40000000
|
||||
#define mPCD_MEM2_WS 0x30000000
|
||||
#define fPCD_MEM2_WS_ONE 0x10000000
|
||||
#define fPCD_MEM2_WS_TWO 0x20000000
|
||||
#define fPCD_MEM2_WS_THREE 0x30000000
|
||||
#define fPCD_MEM2_16 0x40000000
|
||||
|
||||
#define PCD_MAX_MEMORY 2
|
||||
#define PCD_MAX_IO 2
|
||||
#define PCD_MAX_MEMORY 2
|
||||
#define PCD_MAX_IO 2
|
||||
|
||||
typedef struct PcCard_Resource_s {
|
||||
PCCARD_DES PcCard_Header;
|
||||
|
@ -521,16 +521,16 @@ typedef struct PcCard_Resource_s {
|
|||
|
||||
|
||||
/* CONFLICT_DETAILS.CD.ulMask constants */
|
||||
#define CM_CDMASK_DEVINST 0x00000001
|
||||
#define CM_CDMASK_RESDES 0x00000002
|
||||
#define CM_CDMASK_FLAGS 0x00000004
|
||||
#define CM_CDMASK_DESCRIPTION 0x00000008
|
||||
#define CM_CDMASK_VALID 0x0000000F
|
||||
#define CM_CDMASK_DEVINST 0x00000001
|
||||
#define CM_CDMASK_RESDES 0x00000002
|
||||
#define CM_CDMASK_FLAGS 0x00000004
|
||||
#define CM_CDMASK_DESCRIPTION 0x00000008
|
||||
#define CM_CDMASK_VALID 0x0000000F
|
||||
|
||||
/* CONFLICT_DETAILS.CD.ulFlags constants */
|
||||
#define CM_CDFLAGS_DRIVER 0x00000001
|
||||
#define CM_CDFLAGS_ROOT_OWNED 0x00000002
|
||||
#define CM_CDFLAGS_RESERVED 0x00000004
|
||||
#define CM_CDFLAGS_DRIVER 0x00000001
|
||||
#define CM_CDFLAGS_ROOT_OWNED 0x00000002
|
||||
#define CM_CDFLAGS_RESERVED 0x00000004
|
||||
|
||||
typedef struct _CONFLICT_DETAILS_A {
|
||||
ULONG CD_ulSize;
|
||||
|
@ -561,9 +561,9 @@ typedef PCONFLICT_DETAILS_A PCONFLICT_DETAILS;
|
|||
|
||||
|
||||
/* CM_Add_Empty_Log_Conf.ulFlags constants */
|
||||
#define PRIORITY_EQUAL_FIRST 0x00000008
|
||||
#define PRIORITY_EQUAL_LAST 0x00000000
|
||||
#define PRIORITY_BIT 0x00000008
|
||||
#define PRIORITY_EQUAL_FIRST 0x00000008
|
||||
#define PRIORITY_EQUAL_LAST 0x00000000
|
||||
#define PRIORITY_BIT 0x00000008
|
||||
|
||||
CMAPI
|
||||
CONFIGRET
|
||||
|
|
Loading…
Reference in a new issue