Commit ab91c216 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

version: Fix the VerQueryValueA/W() prototypes.

parent d252693a
...@@ -206,7 +206,7 @@ typedef struct ...@@ -206,7 +206,7 @@ typedef struct
} VS_VERSION_INFO_STRUCT32; } VS_VERSION_INFO_STRUCT32;
#define VersionInfoIs16( ver ) \ #define VersionInfoIs16( ver ) \
( ((VS_VERSION_INFO_STRUCT16 *)ver)->szKey[0] >= ' ' ) ( ((const VS_VERSION_INFO_STRUCT16 *)ver)->szKey[0] >= ' ' )
#define DWORD_ALIGN( base, ptr ) \ #define DWORD_ALIGN( base, ptr ) \
( (LPBYTE)(base) + ((((LPBYTE)(ptr) - (LPBYTE)(base)) + 3) & ~3) ) ( (LPBYTE)(base) + ((((LPBYTE)(ptr) - (LPBYTE)(base)) + 3) & ~3) )
...@@ -217,10 +217,10 @@ typedef struct ...@@ -217,10 +217,10 @@ typedef struct
DWORD_ALIGN( (ver), (ver)->szKey + strlenW((ver)->szKey) + 1 ) DWORD_ALIGN( (ver), (ver)->szKey + strlenW((ver)->szKey) + 1 )
#define VersionInfo16_Children( ver ) \ #define VersionInfo16_Children( ver ) \
(VS_VERSION_INFO_STRUCT16 *)( VersionInfo16_Value( ver ) + \ (const VS_VERSION_INFO_STRUCT16 *)( VersionInfo16_Value( ver ) + \
( ( (ver)->wValueLength + 3 ) & ~3 ) ) ( ( (ver)->wValueLength + 3 ) & ~3 ) )
#define VersionInfo32_Children( ver ) \ #define VersionInfo32_Children( ver ) \
(VS_VERSION_INFO_STRUCT32 *)( VersionInfo32_Value( ver ) + \ (const VS_VERSION_INFO_STRUCT32 *)( VersionInfo32_Value( ver ) + \
( ( (ver)->wValueLength * \ ( ( (ver)->wValueLength * \
((ver)->wType? 2 : 1) + 3 ) & ~3 ) ) ((ver)->wType? 2 : 1) + 3 ) & ~3 ) )
...@@ -632,10 +632,10 @@ BOOL WINAPI GetFileVersionInfoA( LPCSTR filename, DWORD handle, ...@@ -632,10 +632,10 @@ BOOL WINAPI GetFileVersionInfoA( LPCSTR filename, DWORD handle,
/*********************************************************************** /***********************************************************************
* VersionInfo16_FindChild [internal] * VersionInfo16_FindChild [internal]
*/ */
static VS_VERSION_INFO_STRUCT16 *VersionInfo16_FindChild( VS_VERSION_INFO_STRUCT16 *info, static const VS_VERSION_INFO_STRUCT16 *VersionInfo16_FindChild( const VS_VERSION_INFO_STRUCT16 *info,
LPCSTR szKey, UINT cbKey ) LPCSTR szKey, UINT cbKey )
{ {
VS_VERSION_INFO_STRUCT16 *child = VersionInfo16_Children( info ); const VS_VERSION_INFO_STRUCT16 *child = VersionInfo16_Children( info );
while ((char *)child < (char *)info + info->wLength ) while ((char *)child < (char *)info + info->wLength )
{ {
...@@ -652,10 +652,10 @@ static VS_VERSION_INFO_STRUCT16 *VersionInfo16_FindChild( VS_VERSION_INFO_STRUCT ...@@ -652,10 +652,10 @@ static VS_VERSION_INFO_STRUCT16 *VersionInfo16_FindChild( VS_VERSION_INFO_STRUCT
/*********************************************************************** /***********************************************************************
* VersionInfo32_FindChild [internal] * VersionInfo32_FindChild [internal]
*/ */
static VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT32 *info, static const VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( const VS_VERSION_INFO_STRUCT32 *info,
LPCWSTR szKey, UINT cbKey ) LPCWSTR szKey, UINT cbKey )
{ {
VS_VERSION_INFO_STRUCT32 *child = VersionInfo32_Children( info ); const VS_VERSION_INFO_STRUCT32 *child = VersionInfo32_Children( info );
while ((char *)child < (char *)info + info->wLength ) while ((char *)child < (char *)info + info->wLength )
{ {
...@@ -673,7 +673,7 @@ static VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT ...@@ -673,7 +673,7 @@ static VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT
* *
* Gets a value from a 16-bit NE resource * Gets a value from a 16-bit NE resource
*/ */
static BOOL WINAPI VersionInfo16_QueryValue( VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, static BOOL WINAPI VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock,
LPVOID *lplpBuffer, UINT *puLen ) LPVOID *lplpBuffer, UINT *puLen )
{ {
while ( *lpSubBlock ) while ( *lpSubBlock )
...@@ -717,7 +717,7 @@ static BOOL WINAPI VersionInfo16_QueryValue( VS_VERSION_INFO_STRUCT16 *info, LPC ...@@ -717,7 +717,7 @@ static BOOL WINAPI VersionInfo16_QueryValue( VS_VERSION_INFO_STRUCT16 *info, LPC
* *
* Gets a value from a 32-bit PE resource * Gets a value from a 32-bit PE resource
*/ */
static BOOL WINAPI VersionInfo32_QueryValue( VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, static BOOL WINAPI 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));
...@@ -761,12 +761,12 @@ static BOOL WINAPI VersionInfo32_QueryValue( VS_VERSION_INFO_STRUCT32 *info, LPC ...@@ -761,12 +761,12 @@ static BOOL WINAPI VersionInfo32_QueryValue( VS_VERSION_INFO_STRUCT32 *info, LPC
/*********************************************************************** /***********************************************************************
* VerQueryValueA [VERSION.@] * VerQueryValueA [VERSION.@]
*/ */
BOOL WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock, BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
LPVOID *lplpBuffer, UINT *puLen ) LPVOID *lplpBuffer, UINT *puLen )
{ {
static const char rootA[] = "\\"; static const char rootA[] = "\\";
static const char varfileinfoA[] = "\\VarFileInfo\\Translation"; static const char varfileinfoA[] = "\\VarFileInfo\\Translation";
VS_VERSION_INFO_STRUCT16 *info = (VS_VERSION_INFO_STRUCT16 *)pBlock; const VS_VERSION_INFO_STRUCT16 *info = (const VS_VERSION_INFO_STRUCT16 *)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 );
...@@ -791,8 +791,11 @@ BOOL WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock, ...@@ -791,8 +791,11 @@ BOOL WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock,
if (ret && strcasecmp( lpSubBlock, rootA ) && strcasecmp( lpSubBlock, varfileinfoA )) if (ret && strcasecmp( lpSubBlock, rootA ) && strcasecmp( lpSubBlock, varfileinfoA ))
{ {
/* Set lpBuffer so it points to the 'empty' area where we store
* the converted strings
*/
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4; LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
DWORD pos = (LPSTR)*lplpBuffer - (LPSTR)pBlock; DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)*lplpBuffer, -1, len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)*lplpBuffer, -1,
lpBufferA + pos, info->wLength - pos, NULL, NULL); lpBufferA + pos, info->wLength - pos, NULL, NULL);
...@@ -808,14 +811,14 @@ BOOL WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock, ...@@ -808,14 +811,14 @@ BOOL WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock,
/*********************************************************************** /***********************************************************************
* VerQueryValueW [VERSION.@] * VerQueryValueW [VERSION.@]
*/ */
BOOL WINAPI VerQueryValueW( LPVOID pBlock, LPCWSTR lpSubBlock, BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
LPVOID *lplpBuffer, UINT *puLen ) LPVOID *lplpBuffer, UINT *puLen )
{ {
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 };
VS_VERSION_INFO_STRUCT32 *info = (VS_VERSION_INFO_STRUCT32 *)pBlock; const VS_VERSION_INFO_STRUCT32 *info = (const VS_VERSION_INFO_STRUCT32 *)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 );
...@@ -840,8 +843,11 @@ BOOL WINAPI VerQueryValueW( LPVOID pBlock, LPCWSTR lpSubBlock, ...@@ -840,8 +843,11 @@ BOOL WINAPI VerQueryValueW( LPVOID pBlock, LPCWSTR lpSubBlock,
if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW )) if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW ))
{ {
/* Set lpBuffer so it points to the 'empty' area where we store
* the converted strings
*/
LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength); LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
DWORD pos = (LPSTR)*lplpBuffer - (LPSTR)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, (LPCSTR)*lplpBuffer, -1,
......
...@@ -159,8 +159,8 @@ DWORD WINAPI VerInstallFileW(UINT,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWST ...@@ -159,8 +159,8 @@ DWORD WINAPI VerInstallFileW(UINT,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWST
DWORD WINAPI VerLanguageNameA(UINT,LPSTR,UINT); DWORD WINAPI VerLanguageNameA(UINT,LPSTR,UINT);
DWORD WINAPI VerLanguageNameW(UINT,LPWSTR,UINT); DWORD WINAPI VerLanguageNameW(UINT,LPWSTR,UINT);
#define VerLanguageName WINELIB_NAME_AW(VerLanguageName) #define VerLanguageName WINELIB_NAME_AW(VerLanguageName)
BOOL WINAPI VerQueryValueA(LPVOID,LPCSTR,LPVOID*,UINT*); BOOL WINAPI VerQueryValueA(LPCVOID,LPCSTR,LPVOID*,UINT*);
BOOL WINAPI VerQueryValueW(LPVOID,LPCWSTR,LPVOID*,UINT*); BOOL WINAPI VerQueryValueW(LPCVOID,LPCWSTR,LPVOID*,UINT*);
#define VerQueryValue WINELIB_NAME_AW(VerQueryValue) #define VerQueryValue WINELIB_NAME_AW(VerQueryValue)
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR,LPDWORD); DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR,LPDWORD);
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR,LPDWORD); DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR,LPDWORD);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment