Author: cwittich Date: Sun Jun 7 15:12:48 2009 New Revision: 41329
URL: http://svn.reactos.org/svn/reactos?rev=41329&view=rev Log: sync version with wine 1.1.23
Removed: trunk/reactos/dll/win32/version/ver16.c Modified: trunk/reactos/dll/win32/version/info.c trunk/reactos/dll/win32/version/install.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?re... ============================================================================== --- trunk/reactos/dll/win32/version/info.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/info.c [iso-8859-1] Sun Jun 7 15:12:48 2009 @@ -555,7 +555,7 @@ DWORD datasize, LPVOID data ) { DWORD len; - VS_VERSION_INFO_STRUCT32* vvis = (VS_VERSION_INFO_STRUCT32*)data; + VS_VERSION_INFO_STRUCT32* vvis = data;
TRACE("(%s,%d,size=%d,data=%p)\n", debugstr_w(filename), handle, datasize, data ); @@ -677,6 +677,7 @@ if (!strncmpiW( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) return child;
+ if (!(child->wLength)) return NULL; child = VersionInfo32_Next( child ); }
@@ -688,7 +689,7 @@ * * Gets a value from a 16-bit NE resource */ -static BOOL WINAPI VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, +static BOOL VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen ) { while ( *lpSubBlock ) @@ -732,7 +733,7 @@ * * Gets a value from a 32-bit PE resource */ -static BOOL WINAPI VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, +static BOOL VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen ) { TRACE("lpSubBlock : (%s)\n", debugstr_w(lpSubBlock)); @@ -781,13 +782,16 @@ { static const char rootA[] = "\"; static const char varfileinfoA[] = "\VarFileInfo\Translation"; - const VS_VERSION_INFO_STRUCT16 *info = (const VS_VERSION_INFO_STRUCT16 *)pBlock; + const VS_VERSION_INFO_STRUCT16 *info = pBlock;
TRACE("(%p,%s,%p,%p)\n", pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
if (!pBlock) return FALSE; + + if (lpSubBlock == NULL || lpSubBlock[0] == '\0') + lpSubBlock = rootA;
if ( !VersionInfoIs16( info ) ) { @@ -815,7 +819,7 @@ LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4; DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
- len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)*lplpBuffer, -1, + len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1, lpBufferA + pos, info->wLength - pos, NULL, NULL); *lplpBuffer = lpBufferA + pos; *puLen = len; @@ -832,17 +836,21 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen ) { + static const WCHAR nullW[] = { 0 }; static const WCHAR rootW[] = { '\', 0 }; static const WCHAR varfileinfoW[] = { '\','V','a','r','F','i','l','e','I','n','f','o', '\','T','r','a','n','s','l','a','t','i','o','n', 0 };
- const VS_VERSION_INFO_STRUCT32 *info = (const VS_VERSION_INFO_STRUCT32 *)pBlock; + const VS_VERSION_INFO_STRUCT32 *info = pBlock;
TRACE("(%p,%s,%p,%p)\n", pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
if (!pBlock) return FALSE; + + if (lpSubBlock == NULL || lpSubBlock[0] == nullW[0]) + lpSubBlock = rootW;
if ( VersionInfoIs16( info ) ) { @@ -871,7 +879,7 @@ DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock; DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
- len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*lplpBuffer, -1, + len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1, lpBufferW + pos, max/sizeof(WCHAR) - pos ); *lplpBuffer = lpBufferW + pos; *puLen = len;
Modified: trunk/reactos/dll/win32/version/install.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/install.c... ============================================================================== --- trunk/reactos/dll/win32/version/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/install.c [iso-8859-1] Sun Jun 7 15:12:48 2009 @@ -535,7 +535,7 @@ LPCWSTR destdir,LPCWSTR curdir,LPWSTR tmpfile,PUINT tmpfilelen ) { LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL; - DWORD ret; + DWORD ret = 0; UINT len;
if (srcfilename) @@ -543,34 +543,50 @@ len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL ); if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL ); - } - if (srcdir) + else + ret = VIF_OUTOFMEMORY; + } + if (srcdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL ); if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL ); - } - if (destfilename) + else + ret = VIF_OUTOFMEMORY; + } + if (destfilename && !ret) { len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL ); if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL ); - } - if (destdir) + else + ret = VIF_OUTOFMEMORY; + } + if (destdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL ); if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL ); - } - if (curdir) + else + ret = VIF_OUTOFMEMORY; + } + if (curdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL ); if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL ); - } - len = *tmpfilelen * sizeof(WCHAR); - wtmpf = HeapAlloc( GetProcessHeap(), 0, len ); - ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len); + else + ret = VIF_OUTOFMEMORY; + } + if (!ret) + { + len = *tmpfilelen * sizeof(WCHAR); + wtmpf = HeapAlloc( GetProcessHeap(), 0, len ); + if (!wtmpf) + ret = VIF_OUTOFMEMORY; + } + if (!ret) + ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len); if (!ret) *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen ); else if (ret & VIF_BUFFTOOSMALL)
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 Jun 7 15:12:48 2009 @@ -173,7 +173,7 @@
#ifndef __REACTOS__ /*********************************************************************** - * load_ne_resource [internal] + * find_ne_resource [internal] */ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, DWORD *resLen, DWORD *resOff ) @@ -273,7 +273,7 @@ #endif /* ! __REACTOS__ */
/*********************************************************************** - * load_pe_resource [internal] + * find_pe_resource [internal] */ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, DWORD *resLen, DWORD *resOff ) @@ -348,7 +348,7 @@ /* Find resource */ resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress);
- resPtr = (const IMAGE_RESOURCE_DIRECTORY*)resDir; + resPtr = resDir; resPtr = find_entry_by_name( resPtr, typeid, resDir ); if ( !resPtr ) { @@ -406,9 +406,8 @@ OFSTRUCT ofs; DWORD reslen;
- TRACE("(%s,type=0x%x,id=0x%x,off=%p)\n", - debugstr_a(lpszFileName), (LONG)lpszResType, (LONG)lpszResId, - lpszResId ); + 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;
Removed: trunk/reactos/dll/win32/version/ver16.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/ver16.c?r... ============================================================================== --- trunk/reactos/dll/win32/version/ver16.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/ver16.c (removed) @@ -1,122 +1,0 @@ -/* - * Implementation of VER.DLL - * - * Copyright 1999 Ulrich Weigand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <stdarg.h> - -#include "windef.h" -#include "wine/winbase16.h" -#include "winver.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ver); - - -/************************************************************************* - * GetFileVersionInfoSize [VER.6] - */ -DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle ) -{ - TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle ); - return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle ); -} - -/************************************************************************* - * GetFileVersionInfo [VER.7] - */ -DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle, - DWORD cbBuf, LPVOID lpvData ) -{ - TRACE("(%s, %08x, %d, %p)\n", - debugstr_a(lpszFileName), handle, cbBuf, lpvData ); - - return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData ); -} - -/************************************************************************* - * VerFindFile [VER.8] - */ -DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename, - LPSTR lpszWinDir, LPSTR lpszAppDir, - LPSTR lpszCurDir, UINT16 *lpuCurDirLen, - LPSTR lpszDestDir, UINT16 *lpuDestDirLen ) -{ - UINT curDirLen, destDirLen; - DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir, - lpszCurDir, &curDirLen, lpszDestDir, &destDirLen ); - - *lpuCurDirLen = (UINT16)curDirLen; - *lpuDestDirLen = (UINT16)destDirLen; - return retv; -} - -/************************************************************************* - * VerInstallFile [VER.9] - */ -DWORD WINAPI VerInstallFile16( UINT16 flags, - LPSTR lpszSrcFilename, LPSTR lpszDestFilename, - LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir, - LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen ) -{ - UINT filelen; - DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename, - lpszSrcDir, lpszDestDir, lpszCurDir, - lpszTmpFile, &filelen); - - *lpwTmpFileLen = (UINT16)filelen; - return retv; -} - -/************************************************************************* - * VerLanguageName [VER.10] - */ -DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang ) -{ - return VerLanguageNameA( uLang, lpszLang, cbLang ); -} - -/************************************************************************* - * VerQueryValue [VER.11] - */ -DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock, - SEGPTR *lpspBuffer, UINT16 *lpcb ) -{ - LPVOID lpvBlock = MapSL( spvBlock ); - LPVOID buffer = lpvBlock; - UINT buflen; - DWORD retv; - - TRACE("(%p, %s, %p, %p)\n", - lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb ); - - retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen ); - if ( !retv ) return FALSE; - - if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 ) - { - FIXME("offset %08X too large relative to %04X:%04X\n", - (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) ); - return FALSE; - } - - if (lpcb) *lpcb = buflen; - *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock)); - - return retv; -}