Skip to content

Commit

Permalink
use getfileresource16 instead of getfileversioninfoA and sizeA
Browse files Browse the repository at this point in the history
  • Loading branch information
cracyc committed Aug 4, 2020
1 parent c1a8ddf commit d854fa0
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions ver/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "windef.h"
#include "wine/winbase16.h"
#include "winuser.h"
#include "winver.h"
#include "lzexpand.h"
#include "wine/unicode.h"
Expand Down Expand Up @@ -507,13 +508,14 @@ DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
{
BOOL ret;
TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
ret = GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
ret = GetFileResourceSize16( lpszFileName, VS_FILE_INFO, VS_VERSION_INFO, NULL );
if (!ret)
{
char path[MAX_PATH];
if (findfile( lpszFileName, path, MAX_PATH ))
ret = GetFileVersionInfoSizeA( (LPSTR)path, lpdwHandle );
ret = GetFileResourceSize16( lpszFileName, VS_FILE_INFO, VS_VERSION_INFO, NULL );
}
*lpdwHandle = NULL;
return ret;
}

Expand All @@ -527,19 +529,13 @@ DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
char *buf;
TRACE("(%s, %08x, %d, %p)\n",
debugstr_a(lpszFileName), handle, cbBuf, lpvData );
if (!(size = GetFileVersionInfoSize16(lpszFileName, handle)))
return 0;
buf = (char *)HeapAlloc(GetProcessHeap(), 0, size);
ret = GetFileVersionInfoA( lpszFileName, handle, size, (LPVOID)buf );
ret = GetFileResource16( lpszFileName, VS_FILE_INFO, VS_VERSION_INFO, NULL, cbBuf, lpvData );
if (!ret)
{
char path[MAX_PATH];
if (findfile( lpszFileName, path, MAX_PATH ));
ret = GetFileVersionInfoA( (LPSTR)path, handle, size, (LPVOID)buf );
if (findfile( lpszFileName, path, MAX_PATH ))
ret = GetFileResource16( lpszFileName, VS_FILE_INFO, VS_VERSION_INFO, NULL, cbBuf, lpvData );
}
if (ret)
memcpy(lpvData, buf, min(size, cbBuf));
HeapFree(GetProcessHeap(), 0, buf);
return ret;
}

Expand Down

0 comments on commit d854fa0

Please sign in to comment.