diff --git a/reactos/dll/win32/version/info.c b/reactos/dll/win32/version/info.c index df5a7d2c96a..c91a8a2c384 100644 --- a/reactos/dll/win32/version/info.c +++ b/reactos/dll/win32/version/info.c @@ -247,11 +247,9 @@ static DWORD VERSION_GetFileVersionInfo_PE( LPCWSTR filename, DWORD datasize, LP TRACE("%s\n", debugstr_w(filename)); - hModule = GetModuleHandleW(filename); - if(!hModule) + if (!GetModuleHandleExW(0, filename, &hModule)) hModule = LoadLibraryExW(filename, 0, LOAD_LIBRARY_AS_DATAFILE); - else - hModule = LoadLibraryExW(filename, 0, 0); + if(!hModule) { WARN("Could not load %s\n", debugstr_w(filename)); @@ -594,12 +592,12 @@ BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle, /* We have a 16bit resource. */ #endif /* ! __REACTOS__ */ } - else + else { static const char signature[] = "FE2X"; DWORD bufsize = vvis->wLength + strlen(signature); DWORD convbuf; - + /* We have a 32bit resource. * * XP/W2K/W2K3 uses a buffer which is 2 times the actual needed space + 4 bytes "FE2X" @@ -775,7 +773,7 @@ static BOOL WINAPI VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *inf * VerQueryValueA [VERSION.@] */ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock, - LPVOID *lplpBuffer, UINT *puLen ) + LPVOID *lplpBuffer, PUINT puLen ) { static const char rootA[] = "\\"; static const char varfileinfoA[] = "\\VarFileInfo\\Translation"; @@ -784,7 +782,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock, TRACE("(%p,%s,%p,%p)\n", pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen ); - if (!pBlock) + if (!pBlock) return FALSE; if ( !VersionInfoIs16( info ) ) @@ -828,7 +826,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock, * VerQueryValueW [VERSION.@] */ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, - LPVOID *lplpBuffer, UINT *puLen ) + LPVOID *lplpBuffer, PUINT puLen ) { static const WCHAR rootW[] = { '\\', 0 }; static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o', diff --git a/reactos/dll/win32/version/install.c b/reactos/dll/win32/version/install.c index 9adde59089b..5ff25e7b38f 100644 --- a/reactos/dll/win32/version/install.c +++ b/reactos/dll/win32/version/install.c @@ -123,13 +123,13 @@ static int testFileExistenceW( const WCHAR *path, const WCHAR *file, BOOL excl ) */ DWORD WINAPI VerFindFileA( DWORD flags, - LPSTR lpszFilename, - LPSTR lpszWinDir, - LPSTR lpszAppDir, + LPCSTR lpszFilename, + LPCSTR lpszWinDir, + LPCSTR lpszAppDir, LPSTR lpszCurDir, - UINT *lpuCurDirLen, + PUINT lpuCurDirLen, LPSTR lpszDestDir, - UINT *lpuDestDirLen ) + PUINT lpuDestDirLen ) { DWORD retval = 0; const char *curDir; @@ -220,9 +220,9 @@ DWORD WINAPI VerFindFileA( /***************************************************************************** * VerFindFileW [VERSION.@] */ -DWORD WINAPI VerFindFileW( DWORD flags,LPWSTR lpszFilename,LPWSTR lpszWinDir, - LPWSTR lpszAppDir, LPWSTR lpszCurDir,UINT *lpuCurDirLen, - LPWSTR lpszDestDir,UINT *lpuDestDirLen ) +DWORD WINAPI VerFindFileW( DWORD flags,LPCWSTR lpszFilename,LPCWSTR lpszWinDir, + LPCWSTR lpszAppDir, LPWSTR lpszCurDir,PUINT lpuCurDirLen, + LPWSTR lpszDestDir,PUINT lpuDestDirLen ) { static const WCHAR emptyW; DWORD retval = 0; @@ -361,8 +361,8 @@ _error2vif(DWORD error) { * VerInstallFileA [VERSION.@] */ DWORD WINAPI VerInstallFileA( - DWORD flags,LPSTR srcfilename,LPSTR destfilename,LPSTR srcdir, - LPSTR destdir,LPSTR curdir,LPSTR tmpfile,UINT *tmpfilelen ) + DWORD flags,LPCSTR srcfilename,LPCSTR destfilename,LPCSTR srcdir, + LPCSTR destdir,LPCSTR curdir,LPSTR tmpfile,PUINT tmpfilelen ) { LPCSTR pdest; char destfn[260],tmpfn[260],srcfn[260]; @@ -529,8 +529,8 @@ DWORD WINAPI VerInstallFileA( * VerInstallFileW [VERSION.@] */ DWORD WINAPI VerInstallFileW( - DWORD flags,LPWSTR srcfilename,LPWSTR destfilename,LPWSTR srcdir, - LPWSTR destdir,LPWSTR curdir,LPWSTR tmpfile,UINT *tmpfilelen ) + DWORD flags,LPCWSTR srcfilename,LPCWSTR destfilename,LPCWSTR srcdir, + LPCWSTR destdir,LPCWSTR curdir,LPWSTR tmpfile,PUINT tmpfilelen ) { LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL; DWORD ret; diff --git a/reactos/dll/win32/version/resource.c b/reactos/dll/win32/version/resource.c index 9207b678611..dc432c3a2be 100644 --- a/reactos/dll/win32/version/resource.c +++ b/reactos/dll/win32/version/resource.c @@ -39,7 +39,6 @@ #include "wine/unicode.h" #include "wine/winbase16.h" -#include "wine/winuser16.h" #include "wine/debug.h" @@ -295,7 +294,7 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, pehdoffset = LZSeek( lzfd, 0, SEEK_CUR ); if ( sizeof(pehd) != LZRead( lzfd, (LPSTR)&pehd, sizeof(pehd) ) ) return 0; - resDataDir = pehd.OptionalHeader.DataDirectory+IMAGE_FILE_RESOURCE_DIRECTORY; + resDataDir = pehd.OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE; if ( !resDataDir->Size ) { TRACE("No resources in PE dll\n" ); diff --git a/reactos/dll/win32/version/version.rbuild b/reactos/dll/win32/version/version.rbuild index ee8e5e17af1..57bbe5c78f7 100644 --- a/reactos/dll/win32/version/version.rbuild +++ b/reactos/dll/win32/version/version.rbuild @@ -1,13 +1,12 @@ + + . include/reactos/wine - - - 0x600 - 0x501 - 0x501 + 0x600 + 0x600 wine lz32 kernel32 diff --git a/reactos/dll/win32/version/version_ros.diff b/reactos/dll/win32/version/version_ros.diff index 76151743bf2..8aa61131a5a 100644 --- a/reactos/dll/win32/version/version_ros.diff +++ b/reactos/dll/win32/version/version_ros.diff @@ -10,7 +10,7 @@ Index: info.c #include "wine/winuser16.h" #include "wine/unicode.h" #include "winerror.h" -@@ -304,6 +305,7 @@ +@@ -302,6 +303,7 @@ return len; } @@ -18,7 +18,7 @@ Index: info.c /*********************************************************************** * VERSION_GetFileVersionInfo_16 [internal] * -@@ -437,6 +440,7 @@ +@@ -435,6 +438,7 @@ return len; } @@ -26,7 +26,7 @@ Index: info.c /*********************************************************************** * GetFileVersionInfoSizeW [VERSION.@] -@@ -470,6 +473,10 @@ +@@ -468,6 +471,10 @@ if (!len) { @@ -37,7 +37,7 @@ Index: info.c LPSTR filenameA; len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL ); -@@ -501,6 +508,7 @@ +@@ -499,6 +506,7 @@ * doesn't seem to be a problem (len is bigger than info->wLength). */ len = (len - sizeof(VS_FIXEDFILEINFO)) * 4; @@ -45,7 +45,7 @@ Index: info.c } else { -@@ -565,6 +573,10 @@ +@@ -563,6 +571,10 @@ if (!len) { @@ -56,7 +56,7 @@ Index: info.c LPSTR filenameA; len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL ); -@@ -580,6 +592,7 @@ +@@ -578,6 +590,7 @@ return FALSE; } /* We have a 16bit resource. */ @@ -64,71 +64,11 @@ Index: info.c } else { -@@ -784,6 +784,9 @@ - TRACE("(%p,%s,%p,%p)\n", - pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen ); - -+ if (!pBlock) -+ return FALSE; -+ - if ( !VersionInfoIs16( info ) ) - { - BOOL ret; -@@ -836,6 +839,9 @@ - TRACE("(%p,%s,%p,%p)\n", - pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen ); - -+ if (!pBlock) -+ return FALSE; -+ - if ( VersionInfoIs16( info ) ) - { - BOOL ret; -Index: install.c -=================================================================== ---- install.c (revision 23123) -+++ install.c (working copy) -@@ -122,7 +122,7 @@ - * Reimplementation of VerFindFile from original stub. - */ - DWORD WINAPI VerFindFileA( -- UINT flags, -+ DWORD flags, - LPSTR lpszFilename, - LPSTR lpszWinDir, - LPSTR lpszAppDir, -@@ -220,7 +220,7 @@ - /***************************************************************************** - * VerFindFileW [VERSION.@] - */ --DWORD WINAPI VerFindFileW( UINT flags,LPWSTR lpszFilename,LPWSTR lpszWinDir, -+DWORD WINAPI VerFindFileW( DWORD flags,LPWSTR lpszFilename,LPWSTR lpszWinDir, - LPWSTR lpszAppDir, LPWSTR lpszCurDir,UINT *lpuCurDirLen, - LPWSTR lpszDestDir,UINT *lpuDestDirLen ) - { -@@ -361,7 +361,7 @@ - * VerInstallFileA [VERSION.@] - */ - DWORD WINAPI VerInstallFileA( -- UINT flags,LPSTR srcfilename,LPSTR destfilename,LPSTR srcdir, -+ DWORD flags,LPSTR srcfilename,LPSTR destfilename,LPSTR srcdir, - LPSTR destdir,LPSTR curdir,LPSTR tmpfile,UINT *tmpfilelen ) - { - LPCSTR pdest; -@@ -529,7 +529,7 @@ - * VerInstallFileW [VERSION.@] - */ - DWORD WINAPI VerInstallFileW( -- UINT flags,LPWSTR srcfilename,LPWSTR destfilename,LPWSTR srcdir, -+ DWORD flags,LPWSTR srcfilename,LPWSTR destfilename,LPWSTR srcdir, - LPWSTR destdir,LPWSTR curdir,LPWSTR tmpfile,UINT *tmpfilelen ) - { - LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL; Index: resource.c =================================================================== --- resource.c (revision 23123) +++ resource.c (working copy) -@@ -43,6 +43,9 @@ +@@ -42,6 +42,9 @@ #include "wine/debug.h" @@ -138,7 +78,7 @@ Index: resource.c WINE_DEFAULT_DEBUG_CHANNEL(ver); -@@ -169,6 +172,7 @@ +@@ -168,6 +171,7 @@ return 0; } @@ -146,7 +86,7 @@ Index: resource.c /*********************************************************************** * load_ne_resource [internal] */ -@@ -267,6 +272,7 @@ +@@ -266,6 +271,7 @@ HeapFree( GetProcessHeap(), 0, resTab ); return TRUE; } @@ -154,7 +94,7 @@ Index: resource.c /*********************************************************************** * load_pe_resource [internal] -@@ -412,8 +417,13 @@ +@@ -411,8 +416,13 @@ switch ( read_xx_header( lzfd ) ) { case IMAGE_OS2_SIGNATURE: @@ -168,7 +108,7 @@ Index: resource.c break; case IMAGE_NT_SIGNATURE: -@@ -451,8 +461,13 @@ +@@ -450,8 +460,13 @@ switch ( read_xx_header( lzfd ) ) { case IMAGE_OS2_SIGNATURE: