Alexandre Julliard : version: Use the find_resource function instead of the 16-bit entry points to load 16-bit resources .

Alexandre Julliard julliard at winehq.org
Thu Oct 1 09:48:19 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct  1 13:54:58 2009 +0200

version: Use the find_resource function instead of the 16-bit entry points to load 16-bit resources.

---

 dlls/version/info.c |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/dlls/version/info.c b/dlls/version/info.c
index 95dadaf..f88b239 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -30,6 +30,7 @@
 #include "winbase.h"
 #include "winver.h"
 #include "winternl.h"
+#include "lzexpand.h"
 #include "wine/winuser16.h"
 #include "wine/unicode.h"
 #include "winerror.h"
@@ -37,6 +38,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ver);
 
+extern DWORD find_resource( HFILE lzfd, LPCSTR type, LPCSTR id, DWORD *reslen, DWORD *offset );
+
 /******************************************************************************
  *
  *   This function will print via standard TRACE, debug info regarding
@@ -344,23 +347,30 @@ static DWORD VERSION_GetFileVersionInfo_16( LPCSTR filename, DWORD datasize, LPV
     }
 
     /* first try without loading a 16-bit module */
-    if (is_builtin)
-        len = 0;
-    else
-        len = GetFileResourceSize16( filename,
-                                     MAKEINTRESOURCEA(VS_FILE_INFO),
-                                     MAKEINTRESOURCEA(VS_VERSION_INFO),
-                                     &offset );
-    if (len)
-    {
-        if (!data) return len;
-
-        len = GetFileResource16( filename,
-                                 MAKEINTRESOURCEA(VS_FILE_INFO),
-                                 MAKEINTRESOURCEA(VS_VERSION_INFO),
-                                 offset, datasize, data );
+    len = 0;
+    if (!is_builtin)
+    {
+        OFSTRUCT ofs;
+        HFILE lzfd = LZOpenFileA( (LPSTR)filename, &ofs, OF_READ );
+
+        if (lzfd >= 0)
+        {
+            if (find_resource( lzfd, MAKEINTRESOURCEA(VS_FILE_INFO), MAKEINTRESOURCEA(VS_VERSION_INFO),
+                               &len, &offset ))
+            {
+                if (data)
+                {
+                    LZSeek( lzfd, offset, 0 /* SEEK_SET */ );
+                    len = LZRead( lzfd, data, min( len, datasize ) );
+                }
+            }
+            LZClose( lzfd );
+        }
+
         if (len)
         {
+            if (!data) return len;
+
             vffi = (VS_FIXEDFILEINFO *)VersionInfo16_Value( (VS_VERSION_INFO_STRUCT16 *)data );
 
             if ( vffi->dwSignature == VS_FFI_SIGNATURE )




More information about the wine-cvs mailing list