[Wine-patches] version: Fix processing "\\\\VarFileInfo\\\\Translation" (eterbug #4656)
Alexander Morozov
amorozov на etersoft.ru
Чт Янв 14 17:47:57 MSK 2010
----------- следующая часть -----------
From 14bc9890794550c74b66d47469e712434cc08f94 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 14 Jan 2010 17:28:21 +0300
Subject: [PATCH] version: Fix processing "\\\\VarFileInfo\\\\Translation" (eterbug #4656).
---
dlls/version/info.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/dlls/version/info.c b/dlls/version/info.c
index 95dadaf..6a37d79 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -762,13 +762,66 @@ static BOOL VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCW
}
/***********************************************************************
+ * VERSION_IsRootOrTranslationA [internal]
+ */
+static BOOL VERSION_IsRootOrTranslationA( LPCSTR value )
+{
+ static const char varfileinfoA[] = "VarFileInfo\\";
+ static const char translationA[] = "Translation";
+
+ BOOL check_translation = FALSE;
+ UINT len;
+
+ while (*value)
+ {
+ if (*value == '\\')
+ ++value;
+ else if (check_translation && !strcasecmp( value, translationA ))
+ return TRUE;
+ else if (!strncasecmp( value, varfileinfoA, len = strlen(varfileinfoA) ))
+ {
+ check_translation = TRUE;
+ value += len;
+ }
+ else return FALSE;
+ }
+ return TRUE;
+}
+
+/***********************************************************************
+ * VERSION_IsRootOrTranslationW [internal]
+ */
+static BOOL VERSION_IsRootOrTranslationW( LPCWSTR value )
+{
+ static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o','\\', 0 };
+ static const WCHAR translationW[] = { '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
+
+ BOOL check_translation = FALSE;
+ UINT len;
+
+ while (*value)
+ {
+ if (*value == '\\')
+ ++value;
+ else if (check_translation && !strcmpiW( value, translationW ))
+ return TRUE;
+ else if (!strncmpiW( value, varfileinfoW, len = strlenW(varfileinfoW) ))
+ {
+ check_translation = TRUE;
+ value += len;
+ }
+ else return FALSE;
+ }
+ return TRUE;
+}
+
+/***********************************************************************
* VerQueryValueA [VERSION.@]
*/
BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
LPVOID *lplpBuffer, PUINT puLen )
{
static const char rootA[] = "\\";
- static const char varfileinfoA[] = "\\VarFileInfo\\Translation";
const VS_VERSION_INFO_STRUCT16 *info = pBlock;
TRACE("(%p,%s,%p,%p)\n",
@@ -798,7 +851,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
HeapFree(GetProcessHeap(), 0, lpSubBlockW);
- if (ret && strcasecmp( lpSubBlock, rootA ) && strcasecmp( lpSubBlock, varfileinfoA ))
+ if (ret && !VERSION_IsRootOrTranslationA( lpSubBlock ))
{
/* Set lpBuffer so it points to the 'empty' area where we store
* the converted strings
@@ -825,8 +878,6 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
{
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 = pBlock;
@@ -857,7 +908,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
HeapFree(GetProcessHeap(), 0, lpSubBlockA);
- if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW ))
+ if (ret && !VERSION_IsRootOrTranslationW( lpSubBlock ))
{
/* Set lpBuffer so it points to the 'empty' area where we store
* the converted strings
--
1.6.5.7
Подробная информация о списке рассылки Wine-patches