#include <stdio.h>
#include <stdarg.h>
#include <windows.h>
#include <advpub.h>
#include <assert.h>
#include "wine/test.h"
Go to the source code of this file.
◆ GUID_KEY
#define GUID_KEY "SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\guid" |
◆ OPEN_GUID_KEY
◆ REG_VAL_EXISTS
◆ TEST_STRING1
#define TEST_STRING1 "\\Application Name" |
◆ TEST_STRING2
#define TEST_STRING2 "%49001%\\Application Name" |
◆ append_str()
Definition at line 192 of file advpack.c.
193{
195
200}
ACPI_SIZE strlen(const char *String)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
Referenced by create_inf_file(), and translateinfstringex_test().
◆ check_reg_dword()
Definition at line 560 of file advpack.c.
561{
564
567
569}
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
#define check(expected, result)
Referenced by setperusersecvalues_test().
◆ check_reg_str()
◆ create_inf_file()
Definition at line 202 of file advpack.c.
203{
206 DWORD dwNumberOfBytesWritten;
209
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");
240
243}
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static void WINAPIV append_str(char **str, const char *data,...)
static CHAR PROG_FILES[MAX_PATH]
Referenced by check_dirid(), test_cmdline(), test_driver_install(), test_inffilelist(), test_inffilelistA(), test_install_class(), test_install_from(), test_install_svc_from(), test_LaunchINFSection(), test_LaunchINFSectionEx(), test_profile_items(), test_registry(), test_RunSetupCommand(), test_SetupCopyOEMInf(), test_SetupDiInstallClassExA(), test_SetupGetInfInformation(), test_SetupGetSourceFileLocation(), test_SetupGetSourceInfo(), test_SetupGetTargetPath(), test_SetupInstallServicesFromInfSectionExA(), test_SetupInstallServicesFromInfSectionExW(), translateinfstring_test(), and translateinfstringex_test().
◆ delnode_test()
Definition at line 128 of file advpack.c.
129{
134
135
136
139
140 if(currDir[currDirLen - 1] == '\\')
141 currDir[--currDirLen] = 0;
142
143
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");
148
149
154 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestFile1"), 0);
155 ok (
hr ==
S_OK,
"DelNode failed deleting a single file\n");
156 currDir[currDirLen] = '\0';
157
158
160 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestDir"), 0);
161 ok (
hr ==
S_OK,
"DelNode failed deleting an empty directory\n");
162 currDir[currDirLen] = '\0';
163
164
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';
173
174
188 hr = pDelNode(
lstrcatA(currDir,
"\\DelNodeTestDir"), 0);
189 ok (
hr ==
S_OK,
"DelNode failed deleting a directory containing multiple files\n");
190}
#define INVALID_HANDLE_VALUE
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Referenced by START_TEST().
◆ get_progfiles_dir()
Definition at line 53 of file advpack.c.
54{
57
61
66}
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
static CHAR APP_PATH[MAX_PATH]
static CHAR PROG_FILES_ROOT[MAX_PATH]
static DWORD APP_PATH_LEN
#define HKEY_LOCAL_MACHINE
Referenced by START_TEST().
◆ HRESULT()
◆ init_function_pointers()
static BOOL init_function_pointers |
( |
void |
| ) |
|
|
static |
Definition at line 68 of file advpack.c.
69{
71
74
82
83 if (!pCloseINFEngine || !pDelNode || !pGetVersionFromFile ||
84 !pOpenINFEngine || !pSetPerUserSecValues || !pTranslateInfString)
85 {
86 win_skip(
"Needed functions are not available\n");
89 }
90
92}
#define GetProcAddress(x, y)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Referenced by START_TEST().
◆ setperusersecvalues_test()
static void setperusersecvalues_test |
( |
void |
| ) |
|
|
static |
Definition at line 571 of file advpack.c.
572{
576
584
585
586 if (0)
587 {
588
589 hr = pSetPerUserSecValues(
NULL);
591 ok(
hr ==
S_OK,
"Expected S_OK, got %d\n",
hr);
593 }
594
595
597 hr = pSetPerUserSecValues(&peruser);
598 ok(
hr ==
S_OK,
"Expected S_OK, got %d\n",
hr);
600
601
603 hr = pSetPerUserSecValues(&peruser);
605 {
606 skip(
"SetPerUserSecValues is broken\n");
607 return;
608 }
609 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
622
623
625 hr = pSetPerUserSecValues(&peruser);
626 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
638
639
642 hr = pSetPerUserSecValues(&peruser);
643 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
650 {
657 "rundll32.exe advpack.dll,UserInstStubWrapper guid"),
658 "Expected real stub\n");
659 }
660
662}
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
#define REG_VAL_EXISTS(key, value)
static BOOL check_reg_str(HKEY hkey, LPCSTR name, LPCSTR value)
static BOOL check_reg_dword(HKEY hkey, LPCSTR name, DWORD value)
Referenced by START_TEST().
◆ START_TEST()
Definition at line 664 of file advpack.c.
665{
667 return;
668
669
670
671
674
676
682
684}
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
static void get_progfiles_dir(void)
static void translateinfstring_test(void)
static BOOL init_function_pointers(void)
static void setperusersecvalues_test(void)
static void delnode_test(void)
static void version_test(void)
static void translateinfstringex_test(void)
◆ translateinfstring_test()
static void translateinfstring_test |
( |
void |
| ) |
|
|
static |
Definition at line 245 of file advpack.c.
246{
250
252
253
256
257
258 hr = pTranslateInfString(
"c:\\a.inf",
"Options.NTx86",
"Options.NTx86",
262 "Expected E_INVALIDARG, 0x80070002 or 0x8007007e, got 0x%08x\n", (
UINT)
hr);
263
265 {
266 win_skip(
"WinNT 3.51 detected. Skipping tests for TranslateInfString()\n");
267 return;
268 }
269
270
272 hr = pTranslateInfString(
inf_file,
"idontexist",
"Options.NTx86",
275 {
276 skip(
"TranslateInfString is broken\n");
277 return;
278 }
282
284
285 hr = pTranslateInfString(
inf_file,
"Options.NTx86",
"idontexist",
288 "Expected SPAPI_E_LINE_NOT_FOUND or E_INVALIDARG, got 0x%08x\n", (
UINT)
hr);
289
291
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);
296
298
299 hr = pTranslateInfString(
inf_file,
"section",
"Options.NTx86",
302 "Expected ERROR_SUCCESS or E_FAIL, got 0x%08x\n", (
UINT)
hr);
303
305 {
308 }
309
311
316 {
319 }
320
323}
int strcmp(const char *String1, const char *String2)
#define ERROR_MOD_NOT_FOUND
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static void create_inf_file(void)
#define SPAPI_E_LINE_NOT_FOUND
#define HRESULT_FROM_WIN32(x)
Referenced by START_TEST().
◆ translateinfstringex_test()
static void translateinfstringex_test |
( |
void |
| ) |
|
|
static |
Definition at line 325 of file advpack.c.
326{
331
334 {
335 win_skip(
"Skipping tests on win9x because of brokenness\n");
336 return;
337 }
338
340
341
342
343
344 hr = pOpenINFEngine(
NULL,
"Options.NTx86", 0, &hinf,
NULL);
346
347
348 hr = pOpenINFEngine(
"",
"Options.NTx86", 0, &hinf,
NULL);
351 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND or E_UNEXPECTED), got %08x\n",
hr);
352
353
356
357
359 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
360
361
362 hr = pTranslateInfStringEx(
NULL,
inf_file,
"Options.NTx86",
"InstallDir",
365
366
367 hr = pTranslateInfStringEx(hinf,
NULL,
"Options.NTx86",
"InstallDir",
370
371
375 hr = pTranslateInfStringEx(hinf,
"",
"Options.NTx86",
"InstallDir",
377 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
379 {
381 ok(
size == 25,
"Expected size 25, got %d\n",
size);
382 }
383
384
388
389
390 hr = pTranslateInfStringEx(hinf,
inf_file,
"",
"InstallDir",
393
394
398
399
400 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"",
403
404
408 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"InstallDir",
410 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
412 {
414 ok(
size == 25,
"Expected size 25, got %d\n",
size);
415 }
416
417
418 hr = pCloseINFEngine(
NULL);
420
421
422 hr = pCloseINFEngine(hinf);
423 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
424
425
428 {
429 skip(
"can't open engine with install section (needs admin rights)\n");
431 return;
432 }
433 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
434
435
439 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"InstallDir",
441 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
444
445
449 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result1",
451 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
456
460 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result2",
462 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
467
468 {
472
476 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result3",
478 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
483 }
484
485
486 hr = pCloseINFEngine(hinf);
487 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
488
490
491
492 {
495 DWORD dwNumberOfBytesWritten;
498
512 append_str(&
ptr,
"HKLM,\"Software\\Garbage\",\"ProgramFilesDir\",,'%%24%%'\n");
513
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");
521
524 }
525
526
528 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
529
530
534 hr = pTranslateInfStringEx(hinf,
inf_file,
"Options.NTx86",
"Result2",
536 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
541
542
543 hr = pCloseINFEngine(hinf);
544 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
545
547}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Referenced by START_TEST().
◆ version_test()
Definition at line 94 of file advpack.c.
95{
98
101 ok (
hr ==
S_OK,
"GetVersionFromFileEx(kernel32.dll) failed, returned "
103 trace(
"kernel32.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
105
108 ok (
hr ==
S_OK,
"GetVersionFromFileEx(kernel32.dll) failed, returned "
112
115 ok (
hr ==
S_OK,
"GetVersionFromFileEx(advpack.dll) failed, returned "
117 trace(
"advpack.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
119
122 ok (
hr ==
S_OK,
"GetVersionFromFileEx(advpack.dll) failed, returned "
126}
Referenced by START_TEST().
◆ APP_PATH
◆ APP_PATH_LEN
◆ BOOL
◆ DWORD
◆ hAdvPack
◆ inf_file
◆ LPCSTR
◆ LPDWORD
◆ LPSTR
◆ LPVOID
◆ PCSTR
◆ PDWORD
◆ PROG_FILES
◆ PROG_FILES_ROOT
◆ PSTR
◆ PVOID