mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
setupapi: Implement CM_Get_Device_ID and add a stub for CM_Get_Parent.
This commit is contained in:
parent
f6cbd9a045
commit
ba8642639a
3 changed files with 81 additions and 24 deletions
|
@ -454,13 +454,16 @@ static HKEY SETUPDI_CreateDrvKey(struct DeviceInfo *devInfo)
|
|||
static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(struct DeviceInfoSet *set,
|
||||
DWORD devId, LPCWSTR instanceId, BOOL phantom)
|
||||
{
|
||||
struct DeviceInfo *devInfo = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(struct DeviceInfo));
|
||||
struct DeviceInfo *devInfo = NULL;
|
||||
HANDLE devInst = GlobalAlloc(GMEM_FIXED, sizeof(struct DeviceInfo));
|
||||
if (devInst)
|
||||
devInfo = GlobalLock(devInst);
|
||||
|
||||
if (devInfo)
|
||||
{
|
||||
devInfo->set = set;
|
||||
devInfo->devId = devId;
|
||||
devInfo->devId = (DWORD)devInst;
|
||||
|
||||
devInfo->instanceId = HeapAlloc(GetProcessHeap(), 0,
|
||||
(lstrlenW(instanceId) + 1) * sizeof(WCHAR));
|
||||
if (devInfo->instanceId)
|
||||
|
@ -477,10 +480,12 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(struct DeviceInfoSet *set,
|
|||
(LPBYTE)&phantom, sizeof(phantom));
|
||||
}
|
||||
list_init(&devInfo->interfaces);
|
||||
GlobalUnlock(devInst);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, devInfo);
|
||||
GlobalUnlock(devInst);
|
||||
GlobalFree(devInst);
|
||||
devInfo = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +519,7 @@ static void SETUPDI_FreeDeviceInfo(struct DeviceInfo *devInfo)
|
|||
SETUPDI_FreeInterfaceInstances(iface);
|
||||
HeapFree(GetProcessHeap(), 0, iface);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, devInfo);
|
||||
GlobalFree((HANDLE)devInfo->devId);
|
||||
}
|
||||
|
||||
/* Adds a device with GUID guid and identifer devInst to set. Allocates a
|
||||
|
@ -551,7 +556,7 @@ static BOOL SETUPDI_AddDeviceToSet(struct DeviceInfoSet *set,
|
|||
|
||||
DeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
memcpy(&DeviceInfoData->ClassGuid, guid, sizeof(GUID));
|
||||
DeviceInfoData->DevInst = devInst;
|
||||
DeviceInfoData->DevInst = devInfo->devId;
|
||||
DeviceInfoData->Reserved = (ULONG_PTR)devInfo;
|
||||
SETUPDI_GuidToString(guid, classGuidStr);
|
||||
SetupDiSetDeviceRegistryPropertyW((HDEVINFO)set,
|
||||
|
@ -3848,3 +3853,66 @@ BOOL WINAPI SetupDiDeleteDevRegKey(
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_IDA (SETUPAPI.@)
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_IDA( DEVINST dnDevInst, PSTR Buffer,
|
||||
ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
struct DeviceInfo *devInfo = GlobalLock((HANDLE)dnDevInst);
|
||||
|
||||
TRACE("%x->%p, %p, %u %u\n", dnDevInst, devInfo, Buffer, BufferLen, ulFlags);
|
||||
|
||||
if (!devInfo)
|
||||
return CR_NO_SUCH_DEVINST;
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, devInfo->instanceId, -1, Buffer, BufferLen, 0, 0);
|
||||
TRACE("Returning %s\n", debugstr_a(Buffer));
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_IDW (SETUPAPI.@)
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_IDW( DEVINST dnDevInst, LPWSTR Buffer,
|
||||
ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
struct DeviceInfo *devInfo = GlobalLock((HANDLE)dnDevInst);
|
||||
|
||||
TRACE("%x->%p, %p, %u %u\n", dnDevInst, devInfo, Buffer, BufferLen, ulFlags);
|
||||
|
||||
if (!devInfo)
|
||||
{
|
||||
WARN("dev instance %d not found!\n", dnDevInst);
|
||||
return CR_NO_SUCH_DEVINST;
|
||||
}
|
||||
|
||||
lstrcpynW(Buffer, devInfo->instanceId, BufferLen);
|
||||
TRACE("Returning %s\n", debugstr_w(Buffer));
|
||||
GlobalUnlock((HANDLE)dnDevInst);
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_Size (SETUPAPI.@)
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size( PULONG pulLen, DEVINST dnDevInst,
|
||||
ULONG ulFlags)
|
||||
{
|
||||
struct DeviceInfo *ppdevInfo = GlobalLock((HANDLE)dnDevInst);
|
||||
|
||||
TRACE("%x->%p, %p, %u\n", dnDevInst, ppdevInfo, pulLen, ulFlags);
|
||||
|
||||
if (!ppdevInfo)
|
||||
{
|
||||
WARN("dev instance %d not found!\n", dnDevInst);
|
||||
return CR_NO_SUCH_DEVINST;
|
||||
}
|
||||
|
||||
*pulLen = lstrlenW(ppdevInfo->instanceId);
|
||||
GlobalUnlock((HANDLE)dnDevInst);
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
@ stub CM_Get_DevNode_Status
|
||||
@ stub CM_Get_DevNode_Status_Ex
|
||||
@ stdcall CM_Get_Device_IDA(ptr ptr long long)
|
||||
@ stub CM_Get_Device_IDW
|
||||
@ stdcall CM_Get_Device_IDW(ptr ptr long long)
|
||||
@ stub CM_Get_Device_ID_ExA
|
||||
@ stub CM_Get_Device_ID_ExW
|
||||
@ stdcall CM_Get_Device_ID_ListA(ptr ptr long long)
|
||||
|
@ -115,7 +115,7 @@
|
|||
@ stub CM_Get_Next_Log_Conf_Ex
|
||||
@ stub CM_Get_Next_Res_Des
|
||||
@ stub CM_Get_Next_Res_Des_Ex
|
||||
@ stub CM_Get_Parent
|
||||
@ stdcall CM_Get_Parent(ptr long long)
|
||||
@ stub CM_Get_Parent_Ex
|
||||
@ stub CM_Get_Res_Des_Data
|
||||
@ stub CM_Get_Res_Des_Data_Ex
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "winreg.h"
|
||||
#include "cfgmgr32.h"
|
||||
#include "setupapi.h"
|
||||
#include "winnls.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
||||
|
@ -69,17 +70,6 @@ CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE handle)
|
|||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_IDA (SETUPAPI.@)
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_IDA( DEVINST dnDevInst, PSTR Buffer,
|
||||
ULONG BufferLen, ULONG ulFlags)
|
||||
{
|
||||
FIXME("%x, %p, %u %u\n",dnDevInst, Buffer, BufferLen, ulFlags);
|
||||
Buffer[0] = 0;
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_ListA (SETUPAPI.@)
|
||||
*/
|
||||
|
@ -93,13 +83,12 @@ CONFIGRET WINAPI CM_Get_Device_ID_ListA(
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CM_Get_Device_ID_Size (SETUPAPI.@)
|
||||
* CM_Get_Parent (SETUPAPI.@)
|
||||
*/
|
||||
CONFIGRET WINAPI CM_Get_Device_ID_Size( PULONG pulLen, DEVINST dnDevInst,
|
||||
ULONG ulFlags)
|
||||
DWORD WINAPI CM_Get_Parent(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags)
|
||||
{
|
||||
FIXME("%p %x %u\n",pulLen, dnDevInst, ulFlags);
|
||||
*pulLen = 1;
|
||||
FIXME("%p 0x%08x 0x%08x stub\n", pdnDevInst, dnDevInst, ulFlags);
|
||||
*pdnDevInst = dnDevInst;
|
||||
return CR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue