From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/setupapi/devinst.c | 19 +++++++++++++++---- dlls/setupapi/tests/devinst.c | 6 +++--- dlls/setupapi/tests/misc.c | 8 +------- 3 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 3676a08c566..718fe66adbe 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -6179,7 +6179,9 @@ BOOL WINAPI SetupUninstallOEMInfA(const char *inf_file, DWORD flags, void *reser */ BOOL WINAPI SetupUninstallOEMInfW(const WCHAR *inf_file, DWORD flags, void *reserved) { + struct driver_package package; WCHAR target[MAX_PATH]; + DWORD ret;
TRACE("inf_file %s, flags %#lx, reserved %p.\n", debugstr_w(inf_file), flags, reserved);
@@ -6195,12 +6197,21 @@ BOOL WINAPI SetupUninstallOEMInfW(const WCHAR *inf_file, DWORD flags, void *rese wcscat(target, L"\inf\"); wcscat(target, inf_file);
- if (flags & SUOI_FORCEDELETE) - return DeleteFileW(target); + if ((ret = parse_inf(&package, target))) + { + SetLastError(ret); + return FALSE; + }
- FIXME("not deleting %s\n", debugstr_w(target)); + if (package.already_installed) + ret = driver_package_delete(&package); + else + ret = ERROR_FILE_NOT_FOUND;
- return TRUE; + driver_package_cleanup(&package); + + SetLastError(ret); + return !ret; }
HRESULT WINAPI DriverStoreFindDriverPackageW(const WCHAR *inf_path, void *unk1, diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 194fa50f6d0..6bbb7f25778 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -3912,7 +3912,7 @@ static void test_copy_oem_inf(struct testsign_context *ctx) *(strrchr(pnf, '.') + 1) = 'p';
ret = SetupUninstallOEMInfA(strrchr(dest, '\') + 1, 0, NULL); - ok(ret, "Failed to uninstall '%s', error %#lx.\n", dest, GetLastError()); + todo_wine ok(ret, "Failed to uninstall '%s', error %#lx.\n", dest, GetLastError()); todo_wine ok(!file_exists(dest), "Expected inf '%s' not to exist.\n", dest); DeleteFileA(dest); todo_wine ok(!file_exists(pnf), "Expected pnf '%s' not to exist.\n", pnf); @@ -3950,7 +3950,7 @@ static void test_copy_oem_inf(struct testsign_context *ctx) ok(strcmp(dest, orig_dest), "Expected INF files to be copied to different paths.\n");
ret = SetupUninstallOEMInfA(strrchr(dest, '\') + 1, 0, NULL); - ok(ret, "Failed to uninstall '%s', error %#lx.\n", dest, GetLastError()); + todo_wine ok(ret, "Failed to uninstall '%s', error %#lx.\n", dest, GetLastError()); todo_wine ok(!file_exists(dest), "Expected inf '%s' not to exist.\n", dest); DeleteFileA(dest); strcpy(pnf, dest); @@ -3958,7 +3958,7 @@ static void test_copy_oem_inf(struct testsign_context *ctx) todo_wine ok(!file_exists(pnf), "Expected pnf '%s' not to exist.\n", pnf);
ret = SetupUninstallOEMInfA(strrchr(orig_dest, '\') + 1, 0, NULL); - ok(ret, "Failed to uninstall '%s', error %#lx.\n", orig_dest, GetLastError()); + todo_wine ok(ret, "Failed to uninstall '%s', error %#lx.\n", orig_dest, GetLastError()); todo_wine ok(!file_exists(orig_dest), "Expected inf '%s' not to exist.\n", dest); DeleteFileA(orig_dest); strcpy(pnf, dest); diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c index adace3324de..e82246bbad3 100644 --- a/dlls/setupapi/tests/misc.c +++ b/dlls/setupapi/tests/misc.c @@ -412,19 +412,13 @@ static void test_SetupUninstallOEMInf(void)
SetLastError(0xdeadbeef); ret = SetupUninstallOEMInfA("", 0, NULL); - todo_wine - { ok(!ret, "Expected failure\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); - } + todo_wine ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupUninstallOEMInfA("nonexistent.inf", 0, NULL); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); - } }
struct default_callback_context