push 63c1876572cbb61a874995ad42ef27c14590d232
[wine/hacks.git] / dlls / advpack / tests / files.c
blob9ddd3bc0062d1f0f7fa19a7c9aeaeafa45de0cc7
1 /*
2 * Unit tests for advpack.dll file functions
4 * Copyright (C) 2006 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #include <windows.h>
23 #include <advpub.h>
24 #include <fci.h>
25 #include "wine/test.h"
27 /* make the max size large so there is only one cab file */
28 #define MEDIA_SIZE 999999999
29 #define FOLDER_THRESHOLD 900000
31 /* function pointers */
32 HMODULE hAdvPack;
33 static HRESULT (WINAPI *pAddDelBackupEntry)(LPCSTR, LPCSTR, LPCSTR, DWORD);
34 static HRESULT (WINAPI *pExtractFiles)(LPCSTR, LPCSTR, DWORD, LPCSTR, LPVOID, DWORD);
35 static HRESULT (WINAPI *pAdvInstallFile)(HWND,LPCSTR,LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD);
37 CHAR CURR_DIR[MAX_PATH];
39 static void init_function_pointers(void)
41 hAdvPack = LoadLibraryA("advpack.dll");
43 if (hAdvPack)
45 pAddDelBackupEntry = (void *)GetProcAddress(hAdvPack, "AddDelBackupEntry");
46 pExtractFiles = (void *)GetProcAddress(hAdvPack, "ExtractFiles");
47 pAdvInstallFile = (void*)GetProcAddress(hAdvPack, "AdvInstallFile");
51 /* creates a file with the specified name for tests */
52 static void createTestFile(const CHAR *name)
54 HANDLE file;
55 DWORD written;
57 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
58 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
59 WriteFile(file, name, strlen(name), &written, NULL);
60 WriteFile(file, "\n", strlen("\n"), &written, NULL);
61 CloseHandle(file);
64 static void create_test_files(void)
66 createTestFile("a.txt");
67 createTestFile("b.txt");
68 CreateDirectoryA("testdir", NULL);
69 createTestFile("testdir\\c.txt");
70 createTestFile("testdir\\d.txt");
71 CreateDirectoryA("dest", NULL);
74 static void delete_test_files(void)
76 DeleteFileA("a.txt");
77 DeleteFileA("b.txt");
78 DeleteFileA("testdir\\c.txt");
79 DeleteFileA("testdir\\d.txt");
80 RemoveDirectoryA("testdir");
81 RemoveDirectoryA("dest");
83 DeleteFileA("extract.cab");
86 static BOOL check_ini_file_attr(LPSTR filename)
88 BOOL ret;
89 DWORD expected = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY;
90 DWORD attr = GetFileAttributesA(filename);
92 ret = (attr & expected) && (attr != INVALID_FILE_ATTRIBUTES);
93 SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL);
95 return ret;
98 static void test_AddDelBackupEntry(void)
100 BOOL ret;
101 HRESULT res;
102 CHAR path[MAX_PATH];
103 CHAR windir[MAX_PATH];
105 lstrcpyA(path, CURR_DIR);
106 lstrcatA(path, "\\backup\\basename.INI");
108 /* native AddDelBackupEntry crashes if lpcszBaseName is NULL */
110 /* try a NULL file list */
111 res = pAddDelBackupEntry(NULL, "backup", "basename", AADBE_ADD_ENTRY);
112 ok(res == S_OK, "Expected S_OK, got %d\n", res);
113 ok(!DeleteFileA(path), "Expected path to not exist\n");
115 lstrcpyA(path, CURR_DIR);
116 lstrcatA(path, "\\backup\\.INI");
118 /* try an empty base name */
119 res = pAddDelBackupEntry("one\0two\0three\0", "backup", "", AADBE_ADD_ENTRY);
120 ok(res == S_OK, "Expected S_OK, got %d\n", res);
121 ok(!DeleteFileA(path), "Expected path to not exist\n");
123 lstrcpyA(path, CURR_DIR);
124 lstrcatA(path, "\\basename.INI");
126 /* try an invalid flag */
127 res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", 0);
128 ok(res == S_OK, "Expected S_OK, got %d\n", res);
129 ok(!DeleteFileA(path), "Expected path to not exist\n");
131 lstrcpyA(path, "c:\\basename.INI");
133 /* create the INF file */
134 res = pAddDelBackupEntry("one\0two\0three\0", "c:\\", "basename", AADBE_ADD_ENTRY);
135 ok(res == S_OK, "Expected S_OK, got %d\n", res);
136 ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
137 ok(DeleteFileA(path), "Expected path to exist\n");
139 lstrcpyA(path, CURR_DIR);
140 lstrcatA(path, "\\backup\\basename.INI");
142 /* try to create the INI file in a nonexistent directory */
143 RemoveDirectoryA("backup");
144 res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
145 ok(res == S_OK, "Expected S_OK, got %d\n", res);
146 ok(!check_ini_file_attr(path), "Expected ini file to not be hidden\n");
147 ok(!DeleteFileA(path), "Expected path to not exist\n");
149 /* try an existent, relative backup directory */
150 CreateDirectoryA("backup", NULL);
151 res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
152 ok(res == S_OK, "Expected S_OK, got %d\n", res);
153 ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
154 ok(DeleteFileA(path), "Expected path to exist\n");
155 RemoveDirectoryA("backup");
157 GetWindowsDirectoryA(windir, sizeof(windir));
158 sprintf(path, "%s\\basename.INI", windir);
160 /* try a NULL backup dir, INI is created in the windows directory */
161 res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", AADBE_ADD_ENTRY);
162 ok(res == S_OK, "Expected S_OK, got %d\n", res);
164 /* remove the entries with AADBE_DEL_ENTRY */
165 SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
166 res = pAddDelBackupEntry("one\0three\0", NULL, "basename", AADBE_DEL_ENTRY);
167 SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
168 ok(res == S_OK, "Expected S_OK, got %d\n", res);
169 ret = DeleteFileA(path);
170 ok(ret == TRUE ||
171 broken(ret == FALSE), /* win98 */
172 "Expected path to exist\n");
175 /* the FCI callbacks */
177 static void *mem_alloc(ULONG cb)
179 return HeapAlloc(GetProcessHeap(), 0, cb);
182 static void mem_free(void *memory)
184 HeapFree(GetProcessHeap(), 0, memory);
187 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
189 return TRUE;
192 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
194 return 0;
197 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
198 BOOL fContinuation, void *pv)
200 return 0;
203 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
205 HANDLE handle;
206 DWORD dwAccess = 0;
207 DWORD dwShareMode = 0;
208 DWORD dwCreateDisposition = OPEN_EXISTING;
210 dwAccess = GENERIC_READ | GENERIC_WRITE;
211 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
212 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
214 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
215 dwCreateDisposition = OPEN_EXISTING;
216 else
217 dwCreateDisposition = CREATE_NEW;
219 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
220 dwCreateDisposition, 0, NULL);
222 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
224 return (INT_PTR)handle;
227 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
229 HANDLE handle = (HANDLE)hf;
230 DWORD dwRead;
231 BOOL res;
233 res = ReadFile(handle, memory, cb, &dwRead, NULL);
234 ok(res, "Failed to ReadFile\n");
236 return dwRead;
239 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
241 HANDLE handle = (HANDLE)hf;
242 DWORD dwWritten;
243 BOOL res;
245 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
246 ok(res, "Failed to WriteFile\n");
248 return dwWritten;
251 static int fci_close(INT_PTR hf, int *err, void *pv)
253 HANDLE handle = (HANDLE)hf;
254 ok(CloseHandle(handle), "Failed to CloseHandle\n");
256 return 0;
259 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
261 HANDLE handle = (HANDLE)hf;
262 DWORD ret;
264 ret = SetFilePointer(handle, dist, NULL, seektype);
265 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
267 return ret;
270 static int fci_delete(char *pszFile, int *err, void *pv)
272 BOOL ret = DeleteFileA(pszFile);
273 ok(ret, "Failed to DeleteFile %s\n", pszFile);
275 return 0;
278 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
280 LPSTR tempname;
282 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
283 GetTempFileNameA(".", "xx", 0, tempname);
285 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
287 lstrcpyA(pszTempName, tempname);
288 HeapFree(GetProcessHeap(), 0, tempname);
289 return TRUE;
292 HeapFree(GetProcessHeap(), 0, tempname);
294 return FALSE;
297 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
298 USHORT *pattribs, int *err, void *pv)
300 BY_HANDLE_FILE_INFORMATION finfo;
301 FILETIME filetime;
302 HANDLE handle;
303 DWORD attrs;
304 BOOL res;
306 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
307 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
309 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
311 res = GetFileInformationByHandle(handle, &finfo);
312 ok(res, "Expected GetFileInformationByHandle to succeed\n");
314 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
315 FileTimeToDosDateTime(&filetime, pdate, ptime);
317 attrs = GetFileAttributes(pszName);
318 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
320 return (INT_PTR)handle;
323 static void add_file(HFCI hfci, char *file)
325 char path[MAX_PATH];
326 BOOL res;
328 lstrcpyA(path, CURR_DIR);
329 lstrcatA(path, "\\");
330 lstrcatA(path, file);
332 res = FCIAddFile(hfci, path, file, FALSE, get_next_cabinet, progress,
333 get_open_info, tcompTYPE_MSZIP);
334 ok(res, "Expected FCIAddFile to succeed\n");
337 static void set_cab_parameters(PCCAB pCabParams)
339 ZeroMemory(pCabParams, sizeof(CCAB));
341 pCabParams->cb = MEDIA_SIZE;
342 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
343 pCabParams->setID = 0xbeef;
344 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
345 lstrcatA(pCabParams->szCabPath, "\\");
346 lstrcpyA(pCabParams->szCab, "extract.cab");
349 static void create_cab_file(void)
351 CCAB cabParams;
352 HFCI hfci;
353 ERF erf;
354 static CHAR a_txt[] = "a.txt",
355 b_txt[] = "b.txt",
356 testdir_c_txt[] = "testdir\\c.txt",
357 testdir_d_txt[] = "testdir\\d.txt";
358 BOOL res;
360 set_cab_parameters(&cabParams);
362 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
363 fci_read, fci_write, fci_close, fci_seek, fci_delete,
364 get_temp_file, &cabParams, NULL);
366 ok(hfci != NULL, "Failed to create an FCI context\n");
368 add_file(hfci, a_txt);
369 add_file(hfci, b_txt);
370 add_file(hfci, testdir_c_txt);
371 add_file(hfci, testdir_d_txt);
373 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
374 ok(res, "Failed to flush the cabinet\n");
376 res = FCIDestroy(hfci);
377 ok(res, "Failed to destroy the cabinet\n");
380 static void test_ExtractFiles(void)
382 HRESULT hr;
383 char destFolder[MAX_PATH];
385 lstrcpyA(destFolder, CURR_DIR);
386 lstrcatA(destFolder, "\\");
387 lstrcatA(destFolder, "dest");
389 /* try NULL cab file */
390 hr = pExtractFiles(NULL, destFolder, 0, NULL, NULL, 0);
391 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
392 ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
394 /* try NULL destination */
395 hr = pExtractFiles("extract.cab", NULL, 0, NULL, NULL, 0);
396 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
397 ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
399 /* extract all files in the cab to nonexistent destination directory */
400 hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
401 ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) ||
402 hr == E_FAIL, /* win95 */
403 "Expected %08x or %08x, got %08x\n", E_FAIL,
404 HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), hr);
405 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
406 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
407 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
408 ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
410 /* extract all files in the cab to the destination directory */
411 CreateDirectoryA("dest", NULL);
412 hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
413 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
414 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
415 ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
416 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
417 ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
418 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
420 /* extract all files to a relative destination directory */
421 hr = pExtractFiles("extract.cab", "dest", 0, NULL, NULL, 0);
422 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
423 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
424 ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
425 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
426 ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
427 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
429 /* only extract two of the files from the cab */
430 hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:testdir\\c.txt", NULL, 0);
431 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
432 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
433 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
434 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
435 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
436 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
438 /* use valid chars before and after file list */
439 hr = pExtractFiles("extract.cab", "dest", 0, " :\t: a.txt:testdir\\c.txt \t:", NULL, 0);
440 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
441 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
442 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
443 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
444 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
445 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
447 /* use invalid chars before and after file list */
448 hr = pExtractFiles("extract.cab", "dest", 0, " +-\\ a.txt:testdir\\c.txt a_:", NULL, 0);
449 ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
450 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
451 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
452 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
454 /* try an empty file list */
455 hr = pExtractFiles("extract.cab", "dest", 0, "", NULL, 0);
456 ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
457 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
458 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
460 /* try a nonexistent file in the file list */
461 hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:idontexist:testdir\\c.txt", NULL, 0);
462 ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
463 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
464 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
465 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
468 static void test_AdvInstallFile(void)
470 HRESULT hr;
471 HMODULE hmod;
472 char CURR_DIR[MAX_PATH];
473 char destFolder[MAX_PATH];
475 hmod = LoadLibrary("setupapi.dll");
476 if (!hmod)
478 skip("setupapi.dll not present\n");
479 return;
482 FreeLibrary(hmod);
484 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
486 lstrcpyA(destFolder, CURR_DIR);
487 lstrcatA(destFolder, "\\");
488 lstrcatA(destFolder, "dest");
490 createTestFile("source.txt");
492 /* try invalid source directory */
493 hr = pAdvInstallFile(NULL, NULL, "source.txt", destFolder, "destination.txt", 0, 0);
494 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
495 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
497 /* try invalid source file */
498 hr = pAdvInstallFile(NULL, CURR_DIR, NULL, destFolder, "destination.txt", 0, 0);
499 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
500 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
502 /* try invalid destination directory */
503 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", NULL, "destination.txt", 0, 0);
504 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
505 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
507 /* try copying to nonexistent destination directory */
508 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder, "destination.txt", 0, 0);
509 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
510 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
512 /* native windows screws up if the source file doesn't exist */
514 /* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
515 createTestFile("dest\\destination.txt");
516 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder,
517 "destination.txt", AIF_NOOVERWRITE | AIF_QUIET, 0);
518 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
519 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
520 ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
522 DeleteFileA("source.txt");
525 START_TEST(files)
527 DWORD len;
528 char temp_path[MAX_PATH], prev_path[MAX_PATH];
530 init_function_pointers();
532 GetCurrentDirectoryA(MAX_PATH, prev_path);
533 GetTempPath(MAX_PATH, temp_path);
534 SetCurrentDirectoryA(temp_path);
536 lstrcpyA(CURR_DIR, temp_path);
537 len = lstrlenA(CURR_DIR);
539 if(len && (CURR_DIR[len - 1] == '\\'))
540 CURR_DIR[len - 1] = 0;
542 create_test_files();
543 create_cab_file();
545 test_AddDelBackupEntry();
546 test_ExtractFiles();
547 test_AdvInstallFile();
549 delete_test_files();
551 FreeLibrary(hAdvPack);
552 SetCurrentDirectoryA(prev_path);