Commit 972c61d3 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

version: Return ERROR_RESOURCE_DATA_NOT_FOUND if the file does not have version information.

parent ea41e863
......@@ -252,6 +252,10 @@ static DWORD VERSION_GetFileVersionInfo_PE( LPCWSTR filename, DWORD datasize, LP
if(!hModule)
{
WARN("Could not load %s\n", debugstr_w(filename));
if (GetLastError() == ERROR_BAD_EXE_FORMAT)
return 0xFFFFFFFF;
return 0;
}
hRsrc = FindResourceW(hModule,
......
......@@ -44,6 +44,18 @@
"ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \
"expected, got %u\n", GetLastError());
static void create_file(const CHAR *name)
{
HANDLE file;
DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
WriteFile(file, name, strlen(name), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
CloseHandle(file);
}
static void test_info_size(void)
{ DWORD hdl, retval;
char mypath[MAX_PATH] = "";
......@@ -153,6 +165,19 @@ static void test_info_size(void)
}
else
trace("skipping GetModuleFileNameA(NULL,..) failed\n");
create_file("test.txt");
/* no version info */
SetLastError(0xdeadbeef);
hdl = 0xcafe;
retval = GetFileVersionInfoSizeA("test.txt", &hdl);
ok(retval == 0, "Expected 0, got %d\n", retval);
ok(hdl == 0, "Expected 0, got %d\n", hdl);
ok(GetLastError() == ERROR_RESOURCE_DATA_NOT_FOUND,
"Expected ERROR_RESOURCE_DATA_NOT_FOUND, got %d\n", GetLastError());
DeleteFileA("test.txt");
}
static void VersionDwordLong2String(DWORDLONG Version, LPSTR lpszVerString)
......
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