30#define TEST_STRING1 "\\Application Name"
31#define TEST_STRING2 "%49001%\\Application Name"
34#define GUID_KEY "SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\guid"
35#define REG_VAL_EXISTS(key, value) !RegQueryValueExA(key, value, NULL, NULL, NULL, NULL)
36#define OPEN_GUID_KEY() !RegOpenKeyA(HKEY_LOCAL_MACHINE, GUID_KEY, &guid)
83 if (!pCloseINFEngine || !pDelNode || !pGetVersionFromFile ||
84 !pOpenINFEngine || !pSetPerUserSecValues || !pTranslateInfString)
86 win_skip(
"Needed functions are not available\n");
101 ok (
hr ==
S_OK,
"GetVersionFromFileEx(kernel32.dll) failed, returned "
103 trace(
"kernel32.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
108 ok (
hr ==
S_OK,
"GetVersionFromFileEx(kernel32.dll) failed, returned "
115 ok (
hr ==
S_OK,
"GetVersionFromFileEx(advpack.dll) failed, returned "
117 trace(
"advpack.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
122 ok (
hr ==
S_OK,
"GetVersionFromFileEx(advpack.dll) failed, returned "
140 if(currDir[currDirLen - 1] ==
'\\')
141 currDir[--currDirLen] = 0;
145 ok (
hr ==
E_FAIL,
"DelNode called with NULL pathname should return E_FAIL\n");
146 hr = pDelNode(
"", 0);
147 ok (
hr ==
E_FAIL,
"DelNode called with empty pathname should return E_FAIL\n");
154 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestFile1"), 0);
155 ok (
hr ==
S_OK,
"DelNode failed deleting a single file\n");
156 currDir[currDirLen] =
'\0';
160 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestDir"), 0);
161 ok (
hr ==
S_OK,
"DelNode failed deleting an empty directory\n");
162 currDir[currDirLen] =
'\0';
170 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestDir"), 0);
171 ok (
hr ==
S_OK,
"DelNode failed deleting a directory containing one file\n");
172 currDir[currDirLen] =
'\0';
188 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestDir"), 0);
189 ok (
hr ==
S_OK,
"DelNode failed deleting a directory containing multiple files\n");
206 DWORD dwNumberOfBytesWritten;
218 append_str(&
ptr,
"HKLM,\"Software\\Microsoft\\Windows\\CurrentVersion\",");
219 append_str(&
ptr,
"\"ProgramFilesDir\",,\"%%24%%\\%%LProgramF%%\"\n");
225 append_str(&
ptr,
"InstallDir=%%49001%%\\%%DefaultAppPath%%\n");
229 append_str(&
ptr,
"CustomHDestination=CustInstDestSection\n");
234 append_str(&
ptr,
"HKLM,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%\\%%LProgramF%%'\n");
236 append_str(&
ptr,
"'HKLM','Software\\Microsoft\\Windows\\CurrentVersion',");
239 append_str(&
ptr,
"HKLM,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%'\n");
258 hr = pTranslateInfString(
"c:\\a.inf",
"Options.NTx86",
"Options.NTx86",
262 "Expected E_INVALIDARG, 0x80070002 or 0x8007007e, got 0x%08x\n", (
UINT)
hr);
266 win_skip(
"WinNT 3.51 detected. Skipping tests for TranslateInfString()\n");
272 hr = pTranslateInfString(
inf_file,
"idontexist",
"Options.NTx86",
276 skip(
"TranslateInfString is broken\n");
285 hr = pTranslateInfString(
inf_file,
"Options.NTx86",
"idontexist",
288 "Expected SPAPI_E_LINE_NOT_FOUND or E_INVALIDARG, got 0x%08x\n", (
UINT)
hr);
292 hr = pTranslateInfString(
inf_file,
"Options.NTx86",
"Options.NTx86",
295 "Expected SPAPI_E_LINE_NOT_FOUND or E_INVALIDARG, got 0x%08x\n", (
UINT)
hr);
299 hr = pTranslateInfString(
inf_file,
"section",
"Options.NTx86",
302 "Expected ERROR_SUCCESS or E_FAIL, got 0x%08x\n", (
UINT)
hr);
335 win_skip(
"Skipping tests on win9x because of brokenness\n");
344 hr = pOpenINFEngine(
NULL,
"Options.NTx86", 0, &hinf,
NULL);
348 hr = pOpenINFEngine(
"",
"Options.NTx86", 0, &hinf,
NULL);
351 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND or E_UNEXPECTED), got %08x\n",
hr);
359 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
362 hr = pTranslateInfStringEx(
NULL,
inf_file,
"Options.NTx86",
"InstallDir",
367 hr = pTranslateInfStringEx(hinf,
NULL,
"Options.NTx86",
"InstallDir",
375 hr = pTranslateInfStringEx(hinf,
"",
"Options.NTx86",
"InstallDir",
377 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
381 ok(
size == 25,
"Expected size 25, got %d\n",
size);
390 hr = pTranslateInfStringEx(hinf,
inf_file,
"",
"InstallDir",
400 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"",
408 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"InstallDir",
410 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
414 ok(
size == 25,
"Expected size 25, got %d\n",
size);
418 hr = pCloseINFEngine(
NULL);
422 hr = pCloseINFEngine(hinf);
423 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
429 skip(
"can't open engine with install section (needs admin rights)\n");
433 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
439 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"InstallDir",
441 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
449 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result1",
451 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
460 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result2",
462 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
476 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result3",
478 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
486 hr = pCloseINFEngine(hinf);
487 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
495 DWORD dwNumberOfBytesWritten;
512 append_str(&
ptr,
"HKLM,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%'\n");
515 append_str(&
ptr,
"HKCU,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%'\n");
517 append_str(&
ptr,
"'HKLM','Software\\Microsoft\\Windows\\CurrentVersion',");
520 append_str(&
ptr,
"HKLM,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%'\n");
528 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
534 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result2",
536 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
543 hr = pCloseINFEngine(hinf);
544 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
589 hr = pSetPerUserSecValues(
NULL);
591 ok(
hr ==
S_OK,
"Expected S_OK, got %d\n",
hr);
597 hr = pSetPerUserSecValues(&peruser);
598 ok(
hr ==
S_OK,
"Expected S_OK, got %d\n",
hr);
603 hr = pSetPerUserSecValues(&peruser);
606 skip(
"SetPerUserSecValues is broken\n");
609 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
625 hr = pSetPerUserSecValues(&peruser);
626 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
642 hr = pSetPerUserSecValues(&peruser);
643 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
657 "rundll32.exe advpack.dll,UserInstStubWrapper guid"),
658 "Expected real stub\n");
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
#define ERROR_MOD_NOT_FOUND
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
#define check(expected, result)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static void get_progfiles_dir(void)
static void translateinfstring_test(void)
static BOOL init_function_pointers(void)
static CHAR APP_PATH[MAX_PATH]
#define REG_VAL_EXISTS(key, value)
static BOOL check_reg_str(HKEY hkey, LPCSTR name, LPCSTR value)
static void setperusersecvalues_test(void)
static CHAR PROG_FILES_ROOT[MAX_PATH]
static void delnode_test(void)
static void create_inf_file(void)
static DWORD APP_PATH_LEN
static void version_test(void)
static void WINAPIV append_str(char **str, const char *data,...)
static void translateinfstringex_test(void)
static CHAR PROG_FILES[MAX_PATH]
static BOOL check_reg_dword(HKEY hkey, LPCSTR name, DWORD value)
static __ms_va_list valist
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
#define SPAPI_E_LINE_NOT_FOUND
#define HRESULT_FROM_WIN32(x)
#define HKEY_LOCAL_MACHINE