Commit c1ccd657 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

setupapi: Implement SetupDiGetDeviceInstanceIdA on top of SetupDiGetDeviceInstanceIdW.

parent 634cba84
...@@ -813,9 +813,42 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdA( ...@@ -813,9 +813,42 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdA(
DWORD DeviceInstanceIdSize, DWORD DeviceInstanceIdSize,
PDWORD RequiredSize) PDWORD RequiredSize)
{ {
FIXME("%p %p %p %d %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstanceId, BOOL ret = FALSE;
DWORD size;
PWSTR instanceId;
TRACE("%p %p %p %d %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
DeviceInstanceIdSize, RequiredSize); DeviceInstanceIdSize, RequiredSize);
return FALSE;
SetupDiGetDeviceInstanceIdW(DeviceInfoSet,
DeviceInfoData,
NULL,
0,
&size);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return FALSE;
instanceId = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
if (instanceId)
{
ret = SetupDiGetDeviceInstanceIdW(DeviceInfoSet,
DeviceInfoData,
instanceId,
size,
&size);
if (ret)
{
int len = WideCharToMultiByte(CP_ACP, 0, instanceId, -1,
DeviceInstanceId,
DeviceInstanceIdSize, NULL, NULL);
if (!len)
ret = FALSE;
else if (RequiredSize)
*RequiredSize = len;
}
HeapFree(GetProcessHeap(), 0, instanceId);
}
return ret;
} }
/*********************************************************************** /***********************************************************************
...@@ -830,6 +863,7 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdW( ...@@ -830,6 +863,7 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdW(
{ {
FIXME("%p %p %p %d %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstanceId, FIXME("%p %p %p %d %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
DeviceInstanceIdSize, RequiredSize); DeviceInstanceIdSize, RequiredSize);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment