From: Jason Edmeades Subject: [PATCH 4/4] cmd: ftype failed to clear file associations Message-Id: <20180925074002.16485-4-us@edmeades.me.uk> Date: Tue, 25 Sep 2018 08:40:02 +0100 In-Reply-To: <20180925074002.16485-1-us@edmeades.me.uk> References: <20180925074002.16485-1-us@edmeades.me.uk> If a file association was set (e.g. ftype fred=xxx), ftype fred= needs to clear it, but previously it failed to do so --- Fixes a fixme from the tests and implements a test for the patch which adds ShellExecute support for launching programs Signed-off-by: Jason Edmeades --- programs/cmd/builtins.c | 6 +++--- programs/cmd/tests/test_builtins.cmd | 9 +++++++++ programs/cmd/tests/test_builtins.cmd.exp | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 25b98813ba..879cb8dcb6 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -4939,11 +4939,11 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) { /* If nothing after '=' then clear value - only valid for ASSOC */ if (*newValue == 0x00) { - if (assoc) rc = RegDeleteKeyW(key, args); - if (assoc && rc == ERROR_SUCCESS) { + rc = RegDeleteTreeW(key, args); + if (rc == ERROR_SUCCESS) { WINE_TRACE("HKCR Key '%s' deleted\n", wine_dbgstr_w(args)); - } else if (assoc && rc != ERROR_FILE_NOT_FOUND) { + } else if (rc != ERROR_FILE_NOT_FOUND) { WCMD_print_error(); errorlevel = 2; diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 79233d8d6f..0651056d1f 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2398,6 +2398,12 @@ echo echo +++>> tmp.cmd echo ftype footype>> tmp.cmd cmd /c tmp.cmd +echo --- testing association +ftype footype=cmd.exe /c "echo '%%1'" +echo dummy>test.foo +test.foo +del test.foo + echo --- resetting association assoc .foo= @@ -2429,6 +2435,9 @@ echo .foo=footype echo footype=foo_opencmd echo +++ echo footype=foo_opencmd +echo --- testing association +echo footype=cmd.exe /c "echo '%%1'" +echo Skipped as not enough permissions echo --- resetting association echo original value diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 797a9cc8ae..52759f1b69 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1430,8 +1430,11 @@ footype=foo_opencmd footype=foo_opencmd +++ footype=foo_opencmd +--- testing association +footype=cmd.exe /c "echo '%1'" +'@drive@@path@foobar\test.foo'@or_broken@Skipped as not enough permissions --- resetting association -@todo_wine@original value@or_broken@buggyXP@or_broken@!WINE_FOO! +original value@or_broken@buggyXP@or_broken@!WINE_FOO! ------------ Testing CALL ------------ --- external script foo@space@ -- 2.17.1