1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-05 17:28:47 +00:00

advapi32/tests: Remove all files created by RegLoadAppKey tests.

This commit is contained in:
Piotr Caban 2024-03-21 20:21:16 +01:00 committed by Alexandre Julliard
parent cc62cdc1fd
commit b13477deb4

View File

@ -1673,31 +1673,26 @@ static void wait_file_available(char *path)
static void test_reg_load_app_key(void) static void test_reg_load_app_key(void)
{ {
DWORD ret, size; DWORD ret, size;
char temppath[MAX_PATH], hivefilepath[MAX_PATH]; char hivefilepath[2 * MAX_PATH], *p;
const BYTE test_data[] = "Hello World"; const BYTE test_data[] = "Hello World";
BYTE output[sizeof(test_data)]; BYTE output[sizeof(test_data)];
HKEY appkey = NULL; HKEY appkey = NULL;
GetTempPathA(sizeof(temppath), temppath); if (!set_privileges(SE_BACKUP_NAME, TRUE))
GetTempFileNameA(temppath, "key", 0, hivefilepath);
DeleteFileA(hivefilepath);
if (!set_privileges(SE_BACKUP_NAME, TRUE) ||
!set_privileges(SE_RESTORE_NAME, FALSE))
{ {
win_skip("Failed to set SE_BACKUP_NAME privileges, skipping tests\n"); win_skip("Failed to set SE_BACKUP_NAME privileges, skipping tests\n");
return; return;
} }
GetTempPathA(MAX_PATH, hivefilepath);
strcat(hivefilepath, "\\wine_reg_test");
CreateDirectoryA(hivefilepath, NULL);
strcat(hivefilepath, "\\saved_key");
ret = RegSaveKeyA(hkey_main, hivefilepath, NULL); ret = RegSaveKeyA(hkey_main, hivefilepath, NULL);
if (ret != ERROR_SUCCESS) ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
{
win_skip("Failed to save test key 0x%lx\n", ret);
return;
}
set_privileges(SE_BACKUP_NAME, FALSE); set_privileges(SE_BACKUP_NAME, FALSE);
set_privileges(SE_RESTORE_NAME, FALSE);
/* Test simple key load */ /* Test simple key load */
/* Check if the changes are saved */ /* Check if the changes are saved */
@ -1726,8 +1721,10 @@ static void test_reg_load_app_key(void)
RegCloseKey(appkey); RegCloseKey(appkey);
wait_file_available(hivefilepath); wait_file_available(hivefilepath);
ret = DeleteFileA(hivefilepath);
ok(ret, "couldn't delete hive file %ld\n", GetLastError()); p = strrchr(hivefilepath, '\\');
*p = 0;
delete_dir(hivefilepath);
} }
/* tests that show that RegConnectRegistry and /* tests that show that RegConnectRegistry and