Rob Shearman : setupapi: Improve the stub for SetupQueryInfOriginalFileInformation

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 8 13:17:00 CDT 2007


Module: wine
Branch: master
Commit: 04fada9035664df57c5a1219dd9ec62d9c15c65c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=04fada9035664df57c5a1219dd9ec62d9c15c65c

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue May  8 16:37:43 2007 +0100

setupapi: Improve the stub for SetupQueryInfOriginalFileInformation
to return information for OriginalCatalogName based on information in
the installed inf file.

---

 dlls/setupapi/query.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c
index 1961375..cd50dee 100644
--- a/dlls/setupapi/query.c
+++ b/dlls/setupapi/query.c
@@ -652,8 +652,12 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW(
     PSP_ORIGINAL_FILE_INFO_W OriginalFileInfo)
 {
     LPCWSTR inf_name;
+    LPCWSTR inf_path;
+    HINF hinf;
+    static const WCHAR wszVersion[] = { 'V','e','r','s','i','o','n',0 };
+    static const WCHAR wszCatalogFile[] = { 'C','a','t','a','l','o','g','F','i','l','e',0 };
 
-    FIXME("(%p, %d, %p, %p): stub\n", InfInformation, InfIndex,
+    FIXME("(%p, %d, %p, %p): semi-stub\n", InfInformation, InfIndex,
         AlternativePlatformInfo, OriginalFileInfo);
 
     if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo))
@@ -662,18 +666,30 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW(
         return ERROR_INVALID_USER_BUFFER;
     }
 
+    inf_path = (LPWSTR)&InfInformation->VersionData[0];
+
     /* FIXME: we should get OriginalCatalogName from CatalogFile line in
      * the original inf file and cache it, but that would require building a
      * .pnf file. */
-    OriginalFileInfo->OriginalCatalogName[0] = '\0';
+    hinf = SetupOpenInfFileW(inf_path, NULL, INF_STYLE_WIN4, NULL);
+    if (!hinf) return FALSE;
+
+    if (!SetupGetLineTextW(NULL, hinf, wszVersion, wszCatalogFile,
+                           OriginalFileInfo->OriginalCatalogName,
+                           sizeof(OriginalFileInfo->OriginalCatalogName)/sizeof(OriginalFileInfo->OriginalCatalogName[0]),
+                           NULL))
+    {
+        OriginalFileInfo->OriginalCatalogName[0] = '\0';
+    }
+    SetupCloseInfFile(hinf);
 
     /* FIXME: not quite correct as we just return the same file name as
      * destination (copied) inf file, not the source (original) inf file.
      * to fix it properly would require building a .pnf file */
     /* file name is stored in VersionData field of InfInformation */
-    inf_name = strrchrW((LPWSTR)&InfInformation->VersionData[0], '\\');
+    inf_name = strrchrW(inf_path, '\\');
     if (inf_name) inf_name++;
-    else inf_name = (LPWSTR)&InfInformation->VersionData[0];
+    else inf_name = inf_path;
 
     strcpyW(OriginalFileInfo->OriginalInfName, inf_name);
 




More information about the wine-cvs mailing list