Stefan Leichter : setupapi: Add partial implementation of SetupDiGetINFClassW.
Alexandre Julliard
julliard at winehq.org
Tue Oct 5 12:03:09 CDT 2010
Module: wine
Branch: master
Commit: 803b81c1b7e299692c18f73d6125f3737f159dc3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=803b81c1b7e299692c18f73d6125f3737f159dc3
Author: Stefan Leichter <Stefan.Leichter at camline.com>
Date: Mon Oct 4 18:16:25 2010 +0200
setupapi: Add partial implementation of SetupDiGetINFClassW.
---
dlls/setupapi/devinst.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/setupapi/stubs.c | 10 ------
2 files changed, 72 insertions(+), 10 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 31269ff..110f36c 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -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);
+}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 643d2df..f191854 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -241,16 +241,6 @@ BOOL WINAPI SetupDiGetINFClassA(PCSTR inf, LPGUID class_guid, PSTR class_name,
}
/***********************************************************************
- * 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.@)
*/
BOOL WINAPI SetupDiDestroyClassImageList(PSP_CLASSIMAGELIST_DATA ClassListImageData)
More information about the wine-cvs
mailing list