Author: cwittich
Date: Sun Mar 21 22:02:06 2010
New Revision: 46323
URL:
http://svn.reactos.org/svn/reactos?rev=46323&view=rev
Log:
[VERSION]
sync version with wine 1.1.41
Removed:
trunk/reactos/dll/win32/version/version_ros.diff
Modified:
trunk/reactos/dll/win32/version/info.c
trunk/reactos/dll/win32/version/resource.c
Modified: trunk/reactos/dll/win32/version/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/info.c?r…
==============================================================================
--- trunk/reactos/dll/win32/version/info.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/version/info.c [iso-8859-1] Sun Mar 21 22:02:06 2010
@@ -29,14 +29,16 @@
#include "windef.h"
#include "winbase.h"
#include "winver.h"
+#include "winuser.h"
#include "winternl.h"
-#include "winuser.h"
-#include "wine/winuser16.h"
+#include "lzexpand.h"
#include "wine/unicode.h"
#include "winerror.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ver);
+
+extern DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset );
/******************************************************************************
*
@@ -230,225 +232,16 @@
#define VersionInfo32_Next( ver ) \
(VS_VERSION_INFO_STRUCT32 *)( (LPBYTE)ver + (((ver)->wLength + 3) & ~3) )
-/***********************************************************************
- * VERSION_GetFileVersionInfo_PE [internal]
- *
- * NOTE: returns size of the PE VERSION resource or 0xFFFFFFFF
- * in the case the file is a PE module, but VERSION_INFO not found.
- */
-static DWORD VERSION_GetFileVersionInfo_PE( LPCWSTR filename, DWORD datasize, LPVOID data
)
-{
- const VS_FIXEDFILEINFO *vffi;
- DWORD len;
- BYTE *buf;
+
+/***********************************************************************
+ * GetFileVersionInfoSizeW [VERSION.@]
+ */
+DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
+{
+ DWORD len, offset, magic = 1;
+ HFILE lzfd;
HMODULE hModule;
- HRSRC hRsrc;
- HGLOBAL hMem;
-
- TRACE("%s\n", debugstr_w(filename));
-
- if (!GetModuleHandleExW(0, filename, &hModule))
- hModule = LoadLibraryExW(filename, 0, LOAD_LIBRARY_AS_DATAFILE);
-
- if(!hModule)
- {
- WARN("Could not load %s\n", debugstr_w(filename));
-
- return 0;
- }
- hRsrc = FindResourceW(hModule,
- MAKEINTRESOURCEW(VS_VERSION_INFO),
- MAKEINTRESOURCEW(VS_FILE_INFO));
- if(!hRsrc)
- {
- WARN("Could not find VS_VERSION_INFO in %s\n", debugstr_w(filename));
- FreeLibrary(hModule);
- return 0xFFFFFFFF;
- }
- len = SizeofResource(hModule, hRsrc);
- hMem = LoadResource(hModule, hRsrc);
- if(!hMem)
- {
- WARN("Could not load VS_VERSION_INFO from %s\n", debugstr_w(filename));
- FreeLibrary(hModule);
- return 0xFFFFFFFF;
- }
- buf = LockResource(hMem);
-
- vffi = (VS_FIXEDFILEINFO *)VersionInfo32_Value( (VS_VERSION_INFO_STRUCT32 *)buf );
-
- if ( vffi->dwSignature != VS_FFI_SIGNATURE )
- {
- WARN("vffi->dwSignature is 0x%08x, but not 0x%08lx!\n",
- vffi->dwSignature, VS_FFI_SIGNATURE );
- len = 0xFFFFFFFF;
- goto END;
- }
-
- if ( TRACE_ON(ver) )
- print_vffi_debug( vffi );
-
- if(data)
- {
- if(datasize < len)
- len = datasize; /* truncate data */
- if(len)
- memcpy(data, buf, len);
- else
- len = 0xFFFFFFFF;
- }
-END:
- FreeResource(hMem);
- FreeLibrary(hModule);
-
- return len;
-}
-
-#ifndef __REACTOS__
-/***********************************************************************
- * VERSION_GetFileVersionInfo_16 [internal]
- *
- * NOTE: returns size of the 16-bit VERSION resource or 0xFFFFFFFF
- * in the case the file exists, but VERSION_INFO not found.
- */
-static DWORD VERSION_GetFileVersionInfo_16( LPCSTR filename, DWORD datasize, LPVOID data
)
-{
- const VS_FIXEDFILEINFO *vffi;
- DWORD len, offset;
- BYTE *buf;
- HMODULE16 hModule;
- HRSRC16 hRsrc;
- HGLOBAL16 hMem;
- char dllname[20], owner[20], *p;
- const char *basename;
- BOOL is_builtin = FALSE;
-
- TRACE("%s\n", debugstr_a(filename));
-
- /* strip path information */
-
- basename = filename;
- if (basename[0] && basename[1] == ':') basename += 2; /* strip drive
specification */
- if ((p = strrchr( basename, '\\' ))) basename = p + 1;
- if ((p = strrchr( basename, '/' ))) basename = p + 1;
-
- if (strlen(basename) < sizeof(dllname)-4)
- {
- int file_exists;
-
- strcpy( dllname, basename );
- p = strrchr( dllname, '.' );
- if (!p) strcat( dllname, ".dll" );
- for (p = dllname; *p; p++) if (*p >= 'A' && *p <=
'Z') *p += 32;
-
- if (wine_dll_get_owner( dllname, owner, sizeof(owner), &file_exists ) == 0)
- is_builtin = TRUE;
- }
-
- /* 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 );
- if (len)
- {
- vffi = (VS_FIXEDFILEINFO *)VersionInfo16_Value( (VS_VERSION_INFO_STRUCT16
*)data );
-
- if ( vffi->dwSignature == VS_FFI_SIGNATURE )
- {
- if ( ((VS_VERSION_INFO_STRUCT16 *)data)->wLength < len )
- len = ((VS_VERSION_INFO_STRUCT16 *)data)->wLength;
-
- if ( TRACE_ON(ver) )
- print_vffi_debug( vffi );
-
- return len;
- }
- }
- }
-
- /* this might be a builtin 16-bit module */
- hModule = LoadLibrary16(filename);
- if(hModule < 32)
- {
- WARN("Could not load %s\n", debugstr_a(filename));
- if (hModule == ERROR_BAD_FORMAT)
- return 0xFFFFFFFF;
- else
- return 0x0;
- }
- hRsrc = FindResource16(hModule,
- MAKEINTRESOURCEA(VS_VERSION_INFO),
- MAKEINTRESOURCEA(VS_FILE_INFO));
- if(!hRsrc)
- {
- WARN("Could not find VS_VERSION_INFO in %s\n", debugstr_a(filename));
- FreeLibrary16(hModule);
- return 0xFFFFFFFF;
- }
- len = SizeofResource16(hModule, hRsrc);
- hMem = LoadResource16(hModule, hRsrc);
- if(!hMem)
- {
- WARN("Could not load VS_VERSION_INFO from %s\n", debugstr_a(filename));
- FreeLibrary16(hModule);
- return 0xFFFFFFFF;
- }
- buf = LockResource16(hMem);
-
- if(!VersionInfoIs16(buf))
- {
- len = 0xFFFFFFFF;
- goto END;
- }
-
- vffi = (VS_FIXEDFILEINFO *)VersionInfo16_Value( (VS_VERSION_INFO_STRUCT16 *)buf );
-
- if ( vffi->dwSignature != VS_FFI_SIGNATURE )
- {
- WARN("vffi->dwSignature is 0x%08x, but not 0x%08lx!\n",
- vffi->dwSignature, VS_FFI_SIGNATURE );
- len = 0xFFFFFFFF;
- goto END;
- }
-
- if ( TRACE_ON(ver) )
- print_vffi_debug( vffi );
-
- if(data)
- {
- if(datasize < len)
- len = datasize; /* truncate data */
- if(len)
- memcpy(data, buf, len);
- else
- len = 0xFFFFFFFF;
- }
-END:
- FreeResource16(hMem);
- FreeLibrary16(hModule);
-
- return len;
-}
-#endif /* ! __REACTOS__ */
-
-/***********************************************************************
- * GetFileVersionInfoSizeW [VERSION.@]
- */
-DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
-{
- DWORD len;
+ OFSTRUCT ofs;
TRACE("(%s,%p)\n", debugstr_w(filename), handle );
@@ -465,40 +258,27 @@
return 0;
}
- len = VERSION_GetFileVersionInfo_PE(filename, 0, NULL);
- /* 0xFFFFFFFF means: file is a PE module, but VERSION_INFO not found */
- if(len == 0xFFFFFFFF)
- {
- SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
- return 0;
- }
-
- if (!len)
- {
-#ifdef __REACTOS__
- SetLastError(ERROR_FILE_NOT_FOUND);
- return 0;
-#else /* __REACTOS__ */
- LPSTR filenameA;
-
- len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
- filenameA = HeapAlloc( GetProcessHeap(), 0, len );
- WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
-
- len = VERSION_GetFileVersionInfo_16(filenameA, 0, NULL);
- HeapFree( GetProcessHeap(), 0, filenameA );
- /* 0xFFFFFFFF means: file exists, but VERSION_INFO not found */
- if (!len)
- {
- SetLastError(ERROR_FILE_NOT_FOUND);
- return 0;
- }
- if (len == 0xFFFFFFFF)
- {
- SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
- return 0;
- }
-
+ if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
+ {
+ magic = find_version_resource( lzfd, &len, &offset );
+ LZClose( lzfd );
+ }
+
+ if ((magic == 1) && (hModule = LoadLibraryExW( filename, 0,
LOAD_LIBRARY_AS_DATAFILE )))
+ {
+ HRSRC hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ MAKEINTRESOURCEW(VS_FILE_INFO) );
+ if (hRsrc)
+ {
+ magic = IMAGE_NT_SIGNATURE;
+ len = SizeofResource( hModule, hRsrc );
+ }
+ FreeLibrary( hModule );
+ }
+
+ switch (magic)
+ {
+ case IMAGE_OS2_SIGNATURE:
/* We have a 16bit resource.
*
* XP/W2K/W2K3 uses a buffer which is more than the actual needed space:
@@ -509,21 +289,22 @@
* info->wLength should be the same as len. Currently it isn't but that
* doesn't seem to be a problem (len is bigger than info->wLength).
*/
- len = (len - sizeof(VS_FIXEDFILEINFO)) * 4;
-#endif /* ! __REACTOS__ */
- }
- else
- {
+ SetLastError(0);
+ return (len - sizeof(VS_FIXEDFILEINFO)) * 4;
+
+ case IMAGE_NT_SIGNATURE:
/* We have a 32bit resource.
*
* XP/W2K/W2K3 uses a buffer which is 2 times the actual needed space + 4 bytes
"FE2X"
* This extra buffer is used for Unicode to ANSI conversions in A-Calls
*/
- len = (len * 2) + 4;
- }
-
- SetLastError(0);
- return len;
+ SetLastError(0);
+ return (len * 2) + 4;
+
+ default:
+ SetLastError( lzfd == HFILE_ERROR ? ofs.nErrCode : ERROR_RESOURCE_DATA_NOT_FOUND
);
+ return 0;
+ }
}
/***********************************************************************
@@ -554,7 +335,11 @@
BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle,
DWORD datasize, LPVOID data )
{
- DWORD len;
+ static const char signature[4] = "FE2X";
+ DWORD len, offset, magic = 1;
+ HFILE lzfd;
+ OFSTRUCT ofs;
+ HMODULE hModule;
VS_VERSION_INFO_STRUCT32* vvis = data;
TRACE("(%s,%d,size=%d,data=%p)\n",
@@ -565,59 +350,58 @@
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
- len = VERSION_GetFileVersionInfo_PE(filename, datasize, data);
- /* 0xFFFFFFFF means: file is a PE module, but VERSION_INFO not found */
- if (len == 0xFFFFFFFF)
- {
- SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
- return FALSE;
- }
-
- if (!len)
- {
-#ifdef __REACTOS__
- SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
- return FALSE;
-#else /* __REACTOS__ */
- LPSTR filenameA;
-
- len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
- filenameA = HeapAlloc( GetProcessHeap(), 0, len );
- WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
-
- len = VERSION_GetFileVersionInfo_16(filenameA, datasize, data);
- HeapFree( GetProcessHeap(), 0, filenameA );
- /* 0xFFFFFFFF means: file exists, but VERSION_INFO not found */
- if (!len || len == 0xFFFFFFFF)
- {
- SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
- return FALSE;
- }
+
+ if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
+ {
+ if ((magic = find_version_resource( lzfd, &len, &offset )) > 1)
+ {
+ LZSeek( lzfd, offset, 0 /* SEEK_SET */ );
+ len = LZRead( lzfd, data, min( len, datasize ) );
+ }
+ LZClose( lzfd );
+ }
+
+ if ((magic == 1) && (hModule = LoadLibraryExW( filename, 0,
LOAD_LIBRARY_AS_DATAFILE )))
+ {
+ HRSRC hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ MAKEINTRESOURCEW(VS_FILE_INFO) );
+ if (hRsrc)
+ {
+ HGLOBAL hMem = LoadResource( hModule, hRsrc );
+ magic = IMAGE_NT_SIGNATURE;
+ len = min( SizeofResource(hModule, hRsrc), datasize );
+ memcpy( data, LockResource( hMem ), len );
+ FreeResource( hMem );
+ }
+ FreeLibrary( hModule );
+ }
+
+ switch (magic)
+ {
+ case IMAGE_OS2_SIGNATURE:
/* We have a 16bit resource. */
-#endif /* ! __REACTOS__ */
- }
- else
- {
- static const char signature[] = "FE2X";
- DWORD bufsize = vvis->wLength + strlen(signature);
- DWORD convbuf;
-
+ if (TRACE_ON(ver))
+ print_vffi_debug( (VS_FIXEDFILEINFO *)VersionInfo16_Value(
(VS_VERSION_INFO_STRUCT16 *)data ));
+ SetLastError(0);
+ return TRUE;
+
+ case IMAGE_NT_SIGNATURE:
/* We have a 32bit resource.
*
* XP/W2K/W2K3 uses a buffer which is 2 times the actual needed space + 4 bytes
"FE2X"
* This extra buffer is used for Unicode to ANSI conversions in A-Calls
*/
-
- /* information is truncated to datasize bytes */
- if (datasize >= bufsize)
- {
- convbuf = datasize - vvis->wLength;
- memcpy( ((char*)(data))+vvis->wLength, signature, convbuf > 4 ? 4 :
convbuf );
- }
- }
-
- SetLastError(0);
- return TRUE;
+ len = vvis->wLength + sizeof(signature);
+ if (datasize >= len) memcpy( (char*)data + vvis->wLength, signature,
sizeof(signature) );
+ if (TRACE_ON(ver))
+ print_vffi_debug( (VS_FIXEDFILEINFO *)VersionInfo32_Value( vvis ));
+ SetLastError(0);
+ return TRUE;
+
+ default:
+ SetLastError( lzfd == HFILE_ERROR ? ofs.nErrCode : ERROR_RESOURCE_DATA_NOT_FOUND
);
+ return FALSE;
+ }
}
/***********************************************************************
Modified: trunk/reactos/dll/win32/version/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/resource…
==============================================================================
--- trunk/reactos/dll/win32/version/resource.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/version/resource.c [iso-8859-1] Sun Mar 21 22:02:06 2010
@@ -36,14 +36,15 @@
#include "windef.h"
#include "winbase.h"
#include "lzexpand.h"
+#include "winuser.h"
+#include "winver.h"
+#undef VS_FILE_INFO
+#define VS_FILE_INFO 16
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "wine/debug.h"
-
-/* winnt.h */
-#define IMAGE_FILE_RESOURCE_DIRECTORY 2
WINE_DEFAULT_DEBUG_CHANNEL(ver);
@@ -91,56 +92,6 @@
}
-/**********************************************************************
- * find_entry_by_name
- *
- * Find an entry by name in a resource directory
- * Copied from loader/pe_resource.c
- */
-static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_DIRECTORY
*dir,
- LPCSTR name, const void *root
)
-{
- const IMAGE_RESOURCE_DIRECTORY *ret = NULL;
- LPWSTR nameW;
- DWORD namelen;
-
- if (!HIWORD(name)) return find_entry_by_id( dir, LOWORD(name), root );
- if (name[0] == '#')
- {
- return find_entry_by_id( dir, atoi(name+1), root );
- }
-
- namelen = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
- if ((nameW = HeapAlloc( GetProcessHeap(), 0, namelen * sizeof(WCHAR) )))
- {
- const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
- const IMAGE_RESOURCE_DIR_STRING_U *str;
- int min, max, res, pos;
-
- MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, namelen );
- namelen--; /* remove terminating null */
- entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
- min = 0;
- max = dir->NumberOfNamedEntries - 1;
- while (min <= max)
- {
- pos = (min + max) / 2;
- str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root +
entry[pos].u1.s1.NameOffset);
- res = strncmpiW( nameW, str->NameString, str->Length );
- if (!res && namelen == str->Length)
- {
- ret = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root +
entry[pos].u2.s3.OffsetToDirectory);
- break;
- }
- if (res < 0) max = pos - 1;
- else min = pos + 1;
- }
- HeapFree( GetProcessHeap(), 0, nameW );
- }
- return ret;
-}
-
-
/***********************************************************************
* read_xx_header [internal]
*/
@@ -153,7 +104,11 @@
if ( sizeof(mzh) != LZRead( lzfd, (LPSTR)&mzh, sizeof(mzh) ) )
return 0;
if ( mzh.e_magic != IMAGE_DOS_SIGNATURE )
+ {
+ if (!memcmp( &mzh, "\177ELF", 4 )) return 1; /* ELF */
+ if (*(UINT *)&mzh == 0xfeedface || *(UINT *)&mzh == 0xcefaedfe) return 1;
/* Mach-O */
return 0;
+ }
LZSeek( lzfd, mzh.e_lfanew, SEEK_SET );
if ( 2 != LZRead( lzfd, magic, 2 ) )
@@ -171,13 +126,13 @@
return 0;
}
-#ifndef __REACTOS__
/***********************************************************************
* find_ne_resource [internal]
*/
-static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
- DWORD *resLen, DWORD *resOff )
-{
+static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
+{
+ const WORD typeid = VS_FILE_INFO | 0x8000;
+ const WORD resid = VS_VERSION_INFO | 0x8000;
IMAGE_OS2_HEADER nehd;
NE_TYPEINFO *typeInfo;
NE_NAMEINFO *nameInfo;
@@ -210,55 +165,23 @@
/* Find resource */
typeInfo = (NE_TYPEINFO *)(resTab + 2);
-
- if (HIWORD(typeid) != 0) /* named type */
- {
- BYTE len = strlen( typeid );
- while (typeInfo->type_id)
- {
- if (!(typeInfo->type_id & 0x8000))
- {
- BYTE *p = resTab + typeInfo->type_id;
- if ((*p == len) && !strncasecmp( (char*)p+1, typeid, len )) goto
found_type;
- }
- typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
- typeInfo->count * sizeof(NE_NAMEINFO));
- }
- }
- else /* numeric type id */
- {
- WORD id = LOWORD(typeid) | 0x8000;
- while (typeInfo->type_id)
- {
- if (typeInfo->type_id == id) goto found_type;
- typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
- typeInfo->count * sizeof(NE_NAMEINFO));
- }
- }
- TRACE("No typeid entry found for %p\n", typeid );
+ while (typeInfo->type_id)
+ {
+ if (typeInfo->type_id == typeid) goto found_type;
+ typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
+ typeInfo->count * sizeof(NE_NAMEINFO));
+ }
+ TRACE("No typeid entry found\n" );
HeapFree( GetProcessHeap(), 0, resTab );
return FALSE;
found_type:
nameInfo = (NE_NAMEINFO *)(typeInfo + 1);
- if (HIWORD(resid) != 0) /* named resource */
- {
- BYTE len = strlen( resid );
- for (count = typeInfo->count; count > 0; count--, nameInfo++)
- {
- BYTE *p = resTab + nameInfo->id;
- if (nameInfo->id & 0x8000) continue;
- if ((*p == len) && !strncasecmp( (char*)p+1, resid, len )) goto
found_name;
- }
- }
- else /* numeric resource id */
- {
- WORD id = LOWORD(resid) | 0x8000;
- for (count = typeInfo->count; count > 0; count--, nameInfo++)
- if (nameInfo->id == id) goto found_name;
- }
- TRACE("No resid entry found for %p\n", typeid );
+ for (count = typeInfo->count; count > 0; count--, nameInfo++)
+ if (nameInfo->id == resid) goto found_name;
+
+ TRACE("No resid entry found\n" );
HeapFree( GetProcessHeap(), 0, resTab );
return FALSE;
@@ -270,13 +193,11 @@
HeapFree( GetProcessHeap(), 0, resTab );
return TRUE;
}
-#endif /* ! __REACTOS__ */
/***********************************************************************
* find_pe_resource [internal]
*/
-static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
- DWORD *resLen, DWORD *resOff )
+static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
{
IMAGE_NT_HEADERS pehd;
DWORD pehdoffset;
@@ -349,22 +270,22 @@
resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress);
resPtr = resDir;
- resPtr = find_entry_by_name( resPtr, typeid, resDir );
+ resPtr = find_entry_by_id( resPtr, VS_FILE_INFO, resDir );
if ( !resPtr )
{
- TRACE("No typeid entry found for %p\n", typeid );
+ TRACE("No typeid entry found\n" );
goto done;
}
- resPtr = find_entry_by_name( resPtr, resid, resDir );
+ resPtr = find_entry_by_id( resPtr, VS_VERSION_INFO, resDir );
if ( !resPtr )
{
- TRACE("No resid entry found for %p\n", resid );
+ TRACE("No resid entry found\n" );
goto done;
}
resPtr = find_entry_default( resPtr, resDir );
if ( !resPtr )
{
- TRACE("No default language entry found for %p\n", resid );
+ TRACE("No default language entry found\n" );
goto done;
}
@@ -395,95 +316,21 @@
}
-/*************************************************************************
- * GetFileResourceSize [VER.2]
- */
-DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType,
- LPCSTR lpszResId, LPDWORD lpdwFileOffset )
-{
- BOOL retv = FALSE;
- HFILE lzfd;
- OFSTRUCT ofs;
- DWORD reslen;
-
- TRACE("(%s,type=%p,id=%p,off=%p)\n",
- debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId );
-
- lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
- if ( lzfd < 0 ) return 0;
-
- switch ( read_xx_header( lzfd ) )
+/***********************************************************************
+ * find_version_resource [internal]
+ */
+DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset )
+{
+ DWORD magic = read_xx_header( lzfd );
+
+ switch (magic)
{
case IMAGE_OS2_SIGNATURE:
-#ifdef __REACTOS__
- ERR("OS2 Images not supported under ReactOS at this time.");
- retv = 0;
-#else
- retv = find_ne_resource( lzfd, lpszResType, lpszResId,
- &reslen, lpdwFileOffset );
-#endif
+ if (!find_ne_resource( lzfd, reslen, offset )) magic = 0;
break;
-
case IMAGE_NT_SIGNATURE:
- retv = find_pe_resource( lzfd, lpszResType, lpszResId,
- &reslen, lpdwFileOffset );
+ if (!find_pe_resource( lzfd, reslen, offset )) magic = 0;
break;
}
-
- LZClose( lzfd );
- return retv? reslen : 0;
-}
-
-
-/*************************************************************************
- * GetFileResource [VER.3]
- */
-DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType,
- LPCSTR lpszResId, DWORD dwFileOffset,
- DWORD dwResLen, LPVOID lpvData )
-{
- BOOL retv = FALSE;
- HFILE lzfd;
- OFSTRUCT ofs;
- DWORD reslen = dwResLen;
-
- TRACE("(%s,type=%p,id=%p,off=%d,len=%d,data=%p)\n",
- debugstr_a(lpszFileName), lpszResType, lpszResId,
- dwFileOffset, dwResLen, lpvData );
-
- lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
- if ( lzfd < 0 ) return 0;
-
- if ( !dwFileOffset )
- {
- switch ( read_xx_header( lzfd ) )
- {
- case IMAGE_OS2_SIGNATURE:
-#ifdef __REACTOS__
- ERR("OS2 Images not supported under ReactOS at this time.");
- retv = 0;
-#else
- retv = find_ne_resource( lzfd, lpszResType, lpszResId,
- &reslen, &dwFileOffset );
-#endif
- break;
-
- case IMAGE_NT_SIGNATURE:
- retv = find_pe_resource( lzfd, lpszResType, lpszResId,
- &reslen, &dwFileOffset );
- break;
- }
-
- if ( !retv )
- {
- LZClose( lzfd );
- return 0;
- }
- }
-
- LZSeek( lzfd, dwFileOffset, SEEK_SET );
- reslen = LZRead( lzfd, lpvData, min( reslen, dwResLen ) );
- LZClose( lzfd );
-
- return reslen;
-}
+ return magic;
+}
Removed: trunk/reactos/dll/win32/version/version_ros.diff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/version_…
==============================================================================
--- trunk/reactos/dll/win32/version/version_ros.diff [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/version/version_ros.diff (removed)
@@ -1,124 +1,0 @@
-Index: info.c
-===================================================================
---- info.c (revision 23123)
-+++ info.c (working copy)
-@@ -30,6 +30,7 @@
- #include "winbase.h"
- #include "winver.h"
- #include "winternl.h"
-+#include "winuser.h"
- #include "wine/winuser16.h"
- #include "wine/unicode.h"
- #include "winerror.h"
-@@ -303,6 +304,7 @@
- return len;
- }
-
-+#ifndef __REACTOS__
- /***********************************************************************
- * VERSION_GetFileVersionInfo_16 [internal]
- *
-@@ -439,6 +442,7 @@
-
- return len;
- }
-+#endif /* ! __REACTOS__ */
-
- /***********************************************************************
- * GetFileVersionInfoSizeW [VERSION.@]
-@@ -472,6 +475,10 @@
-
- if (!len)
- {
-+#ifdef __REACTOS__
-+ SetLastError(ERROR_FILE_NOT_FOUND);
-+ return 0;
-+#else /* __REACTOS__ */
- LPSTR filenameA;
-
- len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
-@@ -503,6 +510,7 @@
- * doesn't seem to be a problem (len is bigger than info->wLength).
- */
- len = (len - sizeof(VS_FIXEDFILEINFO)) * 4;
-+#endif /* ! __REACTOS__ */
- }
- else
- {
-@@ -567,6 +575,10 @@
-
- if (!len)
- {
-+#ifdef __REACTOS__
-+ SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
-+ return FALSE;
-+#else /* __REACTOS__ */
- LPSTR filenameA;
-
- len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
-@@ -582,6 +594,7 @@
- return FALSE;
- }
- /* We have a 16bit resource. */
-+#endif /* ! __REACTOS__ */
- }
- else
- {
-Index: resource.c
-===================================================================
---- resource.c (revision 23123)
-+++ resource.c (working copy)
-@@ -42,6 +42,9 @@
-
- #include "wine/debug.h"
-
-+/* winnt.h */
-+#define IMAGE_FILE_RESOURCE_DIRECTORY 2
-+
- WINE_DEFAULT_DEBUG_CHANNEL(ver);
-
-
-@@ -168,6 +171,7 @@
- return 0;
- }
-
-+#ifndef __REACTOS__
- /***********************************************************************
- * load_ne_resource [internal]
- */
-@@ -266,6 +271,7 @@
- HeapFree( GetProcessHeap(), 0, resTab );
- return TRUE;
- }
-+#endif /* ! __REACTOS__ */
-
- /***********************************************************************
- * load_pe_resource [internal]
-@@ -411,8 +416,13 @@
- switch ( read_xx_header( lzfd ) )
- {
- case IMAGE_OS2_SIGNATURE:
-+#ifdef __REACTOS__
-+ ERR("OS2 Images not supported under ReactOS at this time.");
-+ retv = 0;
-+#else
- retv = find_ne_resource( lzfd, lpszResType, lpszResId,
- &reslen, lpdwFileOffset );
-+#endif
- break;
-
- case IMAGE_NT_SIGNATURE:
-@@ -450,8 +460,13 @@
- switch ( read_xx_header( lzfd ) )
- {
- case IMAGE_OS2_SIGNATURE:
-+#ifdef __REACTOS__
-+ ERR("OS2 Images not supported under ReactOS at this time.");
-+ retv = 0;
-+#else
- retv = find_ne_resource( lzfd, lpszResType, lpszResId,
- &reslen, &dwFileOffset );
-+#endif
- break;
-
- case IMAGE_NT_SIGNATURE: