SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
- return DeleteFileW(pwszCatalogFile);
+
+ /* Only delete when there is a filename and no path */
+ if (pwszCatalogFile && pwszCatalogFile[0] != 0 &&
+ !strchrW(pwszCatalogFile, '\\') && !strchrW(pwszCatalogFile, '/') &&
+ !strchrW(pwszCatalogFile, ':'))
+ {
+ static const WCHAR slashW[] = {'\\',0};
+ WCHAR *target;
+ DWORD len;
+
+ len = strlenW(ca->path) + strlenW(pwszCatalogFile) + 2;
+ if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+ {
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+ strcpyW(target, ca->path);
+ strcatW(target, slashW);
+ strcatW(target, pwszCatalogFile);
+
+ DeleteFileW(target);
+
+ HeapFree(GetProcessHeap(), 0, target);
+ }
+
+ return TRUE;
}
/***********************************************************************
}
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, 0, 0);
if ((p = strrchr(catfile, '\\'))) p++;
+ memset(catfileW, 0, sizeof(catfileW));
MultiByteToWideChar(0, 0, p, -1, catfileW, MAX_PATH);
/* winetest.cat will be created */
/* Remove the catalog file with the unique name */
ret = pCryptCATAdminRemoveCatalog(hcatadmin, catfileW, 0);
- todo_wine
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
/* Remove the winetest.cat catalog file, first with the full path. This should not succeed
* according to MSDN */
ret = pCryptCATAdminRemoveCatalog(hcatadmin, info.wszCatalogFile, 0);
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
- /* The call succeeds but the file is not removed */
+ /* The call succeeded with the full path but the file is not removed */
attrs = GetFileAttributes(catfilepath);
- todo_wine
ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath);
+ /* Given only the filename the file is removed */
ret = pCryptCATAdminRemoveCatalog(hcatadmin, basenameW, 0);
- todo_wine
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
attrs = GetFileAttributes(catfilepath);
ok(attrs == INVALID_FILE_ATTRIBUTES, "Expected %s to be removed\n", catfilepath);