sync version with wine 1.1.23

svn path=/trunk/; revision=41329
This commit is contained in:
Christoph von Wittich 2009-06-07 11:12:48 +00:00
parent 281ab9c777
commit 2fafd4ae3d
4 changed files with 44 additions and 143 deletions

View file

@ -555,7 +555,7 @@ BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle,
DWORD datasize, LPVOID data ) DWORD datasize, LPVOID data )
{ {
DWORD len; 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", TRACE("(%s,%d,size=%d,data=%p)\n",
debugstr_w(filename), handle, datasize, data ); debugstr_w(filename), handle, datasize, data );
@ -677,6 +677,7 @@ static const VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( const VS_VERSION
if (!strncmpiW( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) if (!strncmpiW( child->szKey, szKey, cbKey ) && !child->szKey[cbKey])
return child; return child;
if (!(child->wLength)) return NULL;
child = VersionInfo32_Next( child ); child = VersionInfo32_Next( child );
} }
@ -688,7 +689,7 @@ static const VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( const VS_VERSION
* *
* Gets a value from a 16-bit NE resource * 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 ) LPVOID *lplpBuffer, UINT *puLen )
{ {
while ( *lpSubBlock ) while ( *lpSubBlock )
@ -732,7 +733,7 @@ static BOOL WINAPI VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *inf
* *
* Gets a value from a 32-bit PE resource * 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 ) LPVOID *lplpBuffer, UINT *puLen )
{ {
TRACE("lpSubBlock : (%s)\n", debugstr_w(lpSubBlock)); TRACE("lpSubBlock : (%s)\n", debugstr_w(lpSubBlock));
@ -781,7 +782,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
{ {
static const char rootA[] = "\\"; static const char rootA[] = "\\";
static const char varfileinfoA[] = "\\VarFileInfo\\Translation"; 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", TRACE("(%p,%s,%p,%p)\n",
pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen ); pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
@ -789,6 +790,9 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
if (!pBlock) if (!pBlock)
return FALSE; return FALSE;
if (lpSubBlock == NULL || lpSubBlock[0] == '\0')
lpSubBlock = rootA;
if ( !VersionInfoIs16( info ) ) if ( !VersionInfoIs16( info ) )
{ {
BOOL ret; BOOL ret;
@ -815,7 +819,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4; LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock; 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); lpBufferA + pos, info->wLength - pos, NULL, NULL);
*lplpBuffer = lpBufferA + pos; *lplpBuffer = lpBufferA + pos;
*puLen = len; *puLen = len;
@ -832,11 +836,12 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
LPVOID *lplpBuffer, PUINT puLen ) LPVOID *lplpBuffer, PUINT puLen )
{ {
static const WCHAR nullW[] = { 0 };
static const WCHAR rootW[] = { '\\', 0 }; static const WCHAR rootW[] = { '\\', 0 };
static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o', 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 }; '\\','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", TRACE("(%p,%s,%p,%p)\n",
pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen ); pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
@ -844,6 +849,9 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
if (!pBlock) if (!pBlock)
return FALSE; return FALSE;
if (lpSubBlock == NULL || lpSubBlock[0] == nullW[0])
lpSubBlock = rootW;
if ( VersionInfoIs16( info ) ) if ( VersionInfoIs16( info ) )
{ {
BOOL ret; BOOL ret;
@ -871,7 +879,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock; DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength; 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 ); lpBufferW + pos, max/sizeof(WCHAR) - pos );
*lplpBuffer = lpBufferW + pos; *lplpBuffer = lpBufferW + pos;
*puLen = len; *puLen = len;

View file

@ -535,7 +535,7 @@ DWORD WINAPI VerInstallFileW(
LPCWSTR destdir,LPCWSTR curdir,LPWSTR tmpfile,PUINT tmpfilelen ) LPCWSTR destdir,LPCWSTR curdir,LPWSTR tmpfile,PUINT tmpfilelen )
{ {
LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL; LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL;
DWORD ret; DWORD ret = 0;
UINT len; UINT len;
if (srcfilename) if (srcfilename)
@ -543,34 +543,50 @@ DWORD WINAPI VerInstallFileW(
len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len ))) if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
else
ret = VIF_OUTOFMEMORY;
} }
if (srcdir) if (srcdir && !ret)
{ {
len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL );
if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len ))) if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL );
else
ret = VIF_OUTOFMEMORY;
} }
if (destfilename) if (destfilename && !ret)
{ {
len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL );
if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len ))) if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL );
else
ret = VIF_OUTOFMEMORY;
} }
if (destdir) if (destdir && !ret)
{ {
len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL );
if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len ))) if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL );
else
ret = VIF_OUTOFMEMORY;
} }
if (curdir) if (curdir && !ret)
{ {
len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL );
if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len ))) if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL );
else
ret = VIF_OUTOFMEMORY;
} }
len = *tmpfilelen * sizeof(WCHAR); if (!ret)
wtmpf = HeapAlloc( GetProcessHeap(), 0, len ); {
ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len); 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) if (!ret)
*tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen ); *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen );
else if (ret & VIF_BUFFTOOSMALL) else if (ret & VIF_BUFFTOOSMALL)

View file

@ -173,7 +173,7 @@ static int read_xx_header( HFILE lzfd )
#ifndef __REACTOS__ #ifndef __REACTOS__
/*********************************************************************** /***********************************************************************
* load_ne_resource [internal] * find_ne_resource [internal]
*/ */
static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
DWORD *resLen, DWORD *resOff ) DWORD *resLen, DWORD *resOff )
@ -273,7 +273,7 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
#endif /* ! __REACTOS__ */ #endif /* ! __REACTOS__ */
/*********************************************************************** /***********************************************************************
* load_pe_resource [internal] * find_pe_resource [internal]
*/ */
static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
DWORD *resLen, DWORD *resOff ) DWORD *resLen, DWORD *resOff )
@ -348,7 +348,7 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
/* Find resource */ /* Find resource */
resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress); resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress);
resPtr = (const IMAGE_RESOURCE_DIRECTORY*)resDir; resPtr = resDir;
resPtr = find_entry_by_name( resPtr, typeid, resDir ); resPtr = find_entry_by_name( resPtr, typeid, resDir );
if ( !resPtr ) if ( !resPtr )
{ {
@ -406,9 +406,8 @@ DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType,
OFSTRUCT ofs; OFSTRUCT ofs;
DWORD reslen; DWORD reslen;
TRACE("(%s,type=0x%x,id=0x%x,off=%p)\n", TRACE("(%s,type=%p,id=%p,off=%p)\n",
debugstr_a(lpszFileName), (LONG)lpszResType, (LONG)lpszResId, debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId );
lpszResId );
lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ ); lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
if ( lzfd < 0 ) return 0; if ( lzfd < 0 ) return 0;

View file

@ -1,122 +0,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;
}