From 957da4ee07e8e8f163ee8ce0795cedf2b3b3dff7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 29 Nov 2017 17:00:47 -0600 Subject: [PATCH] shell32: Implement the DeleteGroup() command for Progman DDE. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/shell32/dde.c | 26 ++++++++++++++++++++++++++ dlls/shell32/tests/progman_dde.c | 6 ------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index 3a18d3a7bfe..a1aac151fdd 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -120,6 +120,7 @@ static WCHAR *get_programs_path(WCHAR *name) static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) { static const WCHAR create_groupW[] = {'C','r','e','a','t','e','G','r','o','u','p',0}; + static const WCHAR delete_groupW[] = {'D','e','l','e','t','e','G','r','o','u','p',0}; if (!strcmpiW(command, create_groupW)) { @@ -134,6 +135,31 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) HeapFree(GetProcessHeap(), 0, path); } + else if (!strcmpiW(command, delete_groupW)) + { + WCHAR *path, *path2; + SHFILEOPSTRUCTW shfos = {0}; + int ret; + + if (argc < 1) return DDE_FNOTPROCESSED; + + path = get_programs_path(argv[0]); + + path2 = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 2) * sizeof(*path)); + strcpyW(path2, path); + path2[strlenW(path) + 1] = 0; + + shfos.wFunc = FO_DELETE; + shfos.pFrom = path2; + shfos.fFlags = FOF_NOCONFIRMATION; + + ret = SHFileOperationW(&shfos); + + HeapFree(GetProcessHeap(), 0, path2); + HeapFree(GetProcessHeap(), 0, path); + + if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; + } else { FIXME("unhandled command %s\n", debugstr_w(command)); diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c index 73a79a849e3..c5fd262acd1 100644 --- a/dlls/shell32/tests/progman_dde.c +++ b/dlls/shell32/tests/progman_dde.c @@ -347,10 +347,8 @@ static void test_progman_dde(DWORD instance, HCONV hConv) /* DeleteGroup Test */ error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]"); - todo_wine { ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error); ok(!check_exists("Group1"), "directory should not exist\n"); - } /* Compound Execute String Command */ sprintf(comptext, "[CreateGroup(Group3)][AddItem(%s,f1g3Name)][AddItem(%s,f2g3Name)]", f1g3, f2g3); @@ -365,10 +363,8 @@ static void test_progman_dde(DWORD instance, HCONV hConv) } error = dde_execute(instance, hConv, "[DeleteGroup(Group3)]"); - todo_wine { ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error); ok(!check_exists("Group3"), "directory should not exist\n"); - } /* Full Parameters of Add Item */ /* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */ @@ -392,10 +388,8 @@ static void test_progman_dde2(DWORD instance, HCONV hConv) ok(check_window_exists(Group2Title), "window not created\n"); error = dde_execute(instance, hConv, "[DeleteGroup(Group2)]"); - todo_wine { ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error); ok(!check_exists("Group2"), "directory should not exist\n"); - } } START_TEST(progman_dde)