advpack: fix test
Markus Amsler
markus.amsler at oribi.org
Mon Nov 14 18:39:47 CST 2005
TranslateInfString test fails on my Windows 2000 (German) box, because
the ProgramFilesDir path is hardcoded to C:\Progam Files, mine is
C:\Programme. I haven't tested it on Win9x.
Changelog:
Markus Amsler <markus.amsler at oribi.org>
Don't hardcode ProgramFilesDir, get it from the registry.
-------------- next part --------------
Index: dlls/advpack/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/advpack/tests/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- dlls/advpack/tests/Makefile.in 14 Feb 2005 11:02:46 -0000 1.2
+++ dlls/advpack/tests/Makefile.in 15 Nov 2005 00:34:14 -0000
@@ -3,7 +3,7 @@
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = advpack.dll
-IMPORTS = user32 kernel32
+IMPORTS = advapi32 user32 kernel32
CTESTS = \
advpack.c
Index: dlls/advpack/tests/advpack.c
===================================================================
RCS file: /home/wine/wine/dlls/advpack/tests/advpack.c,v
retrieving revision 1.8
diff -u -r1.8 advpack.c
--- dlls/advpack/tests/advpack.c 14 Nov 2005 12:27:39 -0000 1.8
+++ dlls/advpack/tests/advpack.c 15 Nov 2005 00:34:14 -0000
@@ -25,7 +25,7 @@
#include <assert.h>
#include "wine/test.h"
-#define TEST_STRING1 "C:\\Program Files\\Application Name"
+#define TEST_STRING1 "\\Application Name"
#define TEST_STRING2 "%49001%\\Application Name"
static HRESULT (WINAPI *pGetVersionFromFile)(LPSTR,LPDWORD,LPDWORD,BOOL);
@@ -171,11 +171,29 @@
static void translateinfstring_test()
{
HRESULT hr;
+ LONG ret;
char buffer[MAX_PATH];
- DWORD dwSize;
+ char prgDir[MAX_PATH];
+ DWORD dwSize, prgDirSize;
+ HKEY hKey;
create_inf_file();
+ /* get ProgramFilesDir from registry */
+ ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
+ 0, KEY_QUERY_VALUE, &hKey);
+ assert(ret == ERROR_SUCCESS);
+
+ dwSize = MAX_PATH;
+ ret = RegQueryValueExA(hKey, "ProgramFilesDir", NULL, NULL,(LPBYTE)prgDir, &dwSize);
+ assert(ret == ERROR_SUCCESS);
+
+ ret = RegCloseKey (hKey);
+ assert(ret == ERROR_SUCCESS);
+
+ lstrcat(prgDir, TEST_STRING1);
+ prgDirSize = lstrlen(prgDir) + 1;
+
/* pass in a couple invalid parameters */
hr = pTranslateInfString(NULL, NULL, NULL, NULL, buffer, MAX_PATH, &dwSize, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", (UINT)hr);
@@ -218,8 +236,8 @@
if(hr == ERROR_SUCCESS)
todo_wine
{
- ok(!strcmp(buffer, TEST_STRING1), "Expected %s, got %s\n", TEST_STRING1, buffer);
- ok(dwSize == 34, "Expected size 34, got %ld\n", dwSize);
+ ok(!strcmp(buffer, prgDir), "Expected %s, got %s\n", prgDir, buffer);
+ ok(dwSize == prgDirSize, "Expected size %ld, got %ld\n", prgDirSize, dwSize);
}
buffer[0] = 0;
More information about the wine-patches
mailing list