setupapi: Add partial implementation of SetupDiGetINFClassW.

This commit is contained in:
Stefan Leichter 2010-10-04 18:16:25 +02:00 committed by Alexandre Julliard
parent 781cb48653
commit 803b81c1b7
2 changed files with 72 additions and 10 deletions

View file

@ -46,6 +46,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/* Unicode constants */
static const WCHAR Chicago[] = {'$','C','h','i','c','a','g','o','$',0};
static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0};
static const WCHAR Class[] = {'C','l','a','s','s',0};
static const WCHAR ClassInstall32[] = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0};
@ -54,6 +55,7 @@ static const WCHAR NoInstallClass[] = {'N','o','I','n','s','t','a','l','l','C',
static const WCHAR NoUseClass[] = {'N','o','U','s','e','C','l','a','s','s',0};
static const WCHAR NtExtension[] = {'.','N','T',0};
static const WCHAR NtPlatformExtension[] = {'.','N','T','x','8','6',0};
static const WCHAR Signature[] = {'S','i','g','n','a','t','u','r','e',0};
static const WCHAR Version[] = {'V','e','r','s','i','o','n',0};
static const WCHAR WinExtension[] = {'.','W','i','n',0};
@ -3984,3 +3986,73 @@ CONFIGRET WINAPI CM_Get_Device_ID_Size( PULONG pulLen, DEVINST dnDevInst,
GlobalUnlock((HANDLE)dnDevInst);
return CR_SUCCESS;
}
/***********************************************************************
* SetupDiGetINFClassW (SETUPAPI.@)
*/
BOOL WINAPI SetupDiGetINFClassW(PCWSTR inf, LPGUID class_guid, PWSTR class_name,
DWORD size, PDWORD required_size)
{
BOOL have_guid, have_name;
DWORD dret;
WCHAR buffer[MAX_PATH];
if (!inf)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW(inf))
{
FIXME("%s not found. Searching via DevicePath not implemented\n", debugstr_w(inf));
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
if (!class_guid || !class_name || !size)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!GetPrivateProfileStringW(Version, Signature, NULL, buffer, MAX_PATH, inf))
return FALSE;
if (lstrcmpiW(buffer, Chicago))
return FALSE;
buffer[0] = '\0';
have_guid = 0 < GetPrivateProfileStringW(Version, ClassGUID, NULL, buffer, MAX_PATH, inf);
if (have_guid)
{
buffer[lstrlenW(buffer)-1] = 0;
if (RPC_S_OK != UuidFromStringW(buffer + 1, class_guid))
{
FIXME("failed to convert \"%s\" into a guid\n", debugstr_w(buffer));
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
buffer[0] = '\0';
dret = GetPrivateProfileStringW(Version, Class, NULL, buffer, MAX_PATH, inf);
have_name = 0 < dret;
if (dret >= MAX_PATH -1) FIXME("buffer might be too small\n");
if (have_guid && !have_name) FIXME("class name lookup via guid not implemented\n");
if (have_name)
{
if (dret < size) lstrcpyW(class_name, buffer);
else
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
have_name = FALSE;
}
}
if (required_size) *required_size = dret + ((dret) ? 1 : 0);
return (have_guid || have_name);
}

View file

@ -240,16 +240,6 @@ BOOL WINAPI SetupDiGetINFClassA(PCSTR inf, LPGUID class_guid, PSTR class_name,
return FALSE;
}
/***********************************************************************
* SetupDiGetINFClassW (SETUPAPI.@)
*/
BOOL WINAPI SetupDiGetINFClassW(PCWSTR inf, LPGUID class_guid, PWSTR class_name,
DWORD size, PDWORD required_size)
{
FIXME("%s %p %p %d %p\n", debugstr_w(inf), class_guid, class_name, size, required_size);
return FALSE;
}
/***********************************************************************
* SetupDiDestroyClassImageList (SETUPAPI.@)
*/