https://git.reactos.org/?p=reactos.git;a=commitdiff;h=90aff8dd09213c84752ec…
commit 90aff8dd09213c84752ecbaa472f6076cef15b7e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Aug 13 07:51:45 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Aug 13 07:51:45 2020 +0900
[SHELL32_APITEST] Strengthen SHChangeNotify testcase more (#3038)
- Add tests on SHCNRF_InterruptLevel and SHCNRF_RecursiveInterrupt.
- Don't use clipboard for data exchange.
- Close Explorer Cabinets before tests.
CORE-13950
---
.../rostests/apitests/shell32/SHChangeNotify.cpp | 242 +++++++++++++++------
modules/rostests/apitests/shell32/SHChangeNotify.h | 5 +-
modules/rostests/apitests/shell32/shell-notify.cpp | 49 +++--
3 files changed, 203 insertions(+), 93 deletions(-)
diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.cpp
b/modules/rostests/apitests/shell32/SHChangeNotify.cpp
index 229a221037e..cd5b45c646c 100644
--- a/modules/rostests/apitests/shell32/SHChangeNotify.cpp
+++ b/modules/rostests/apitests/shell32/SHChangeNotify.cpp
@@ -5,6 +5,8 @@
* COPYRIGHT: Copyright 2020 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com)
*/
+// NOTE: This test program closes the Explorer cabinets before tests.
+
#include "shelltest.h"
#include <shlwapi.h>
#include <stdio.h>
@@ -21,7 +23,7 @@ typedef void (*ACTION)(void);
typedef struct TEST_ENTRY
{
INT line;
- LONG event;
+ DWORD event;
LPCVOID item1;
LPCVOID item2;
LPCSTR pattern;
@@ -91,61 +93,107 @@ DoAction8(void)
static const TEST_ENTRY s_TestEntriesMode0[] =
{
- {__LINE__, SHCNE_MKDIR, s_dir1, NULL, "000100000", NULL, s_dir1,
L""},
- {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "000100000", NULL, s_dir2,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "000010000", NULL, s_dir2,
L""},
- {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "000100000", DoAction1, s_dir2,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "000010000", NULL, s_dir2,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "000010000", DoAction2, s_dir2,
L""},
- {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "000100000", DoAction1, s_dir2,
L""},
- {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "000000010", NULL, s_dir2,
s_dir3},
- {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "000000010", DoAction3,
s_dir2, s_dir3},
- {__LINE__, SHCNE_CREATE, s_file1, NULL, "010000000", NULL, s_file1,
L""},
- {__LINE__, SHCNE_CREATE, s_file1, s_file2, "010000000", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_CREATE, s_file1, NULL, "010000000", DoAction4, s_file1,
L""},
- {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "100000000", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "100000000", DoAction5,
s_file1, s_file2},
- {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "100000000", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_UPDATEITEM, s_file1, NULL, "000000100", NULL, s_file1,
L""},
- {__LINE__, SHCNE_UPDATEITEM, s_file2, NULL, "000000100", NULL, s_file2,
L""},
- {__LINE__, SHCNE_UPDATEITEM, s_file1, s_file2, "000000100", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_UPDATEITEM, s_file2, s_file1, "000000100", NULL, s_file2,
s_file1},
- {__LINE__, SHCNE_DELETE, s_file1, NULL, "001000000", NULL, s_file1,
L""},
- {__LINE__, SHCNE_DELETE, s_file2, NULL, "001000000", NULL, s_file2,
L""},
- {__LINE__, SHCNE_DELETE, s_file2, s_file1, "001000000", NULL, s_file2,
s_file1},
- {__LINE__, SHCNE_DELETE, s_file1, s_file2, "001000000", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_DELETE, s_file2, NULL, "001000000", DoAction6, s_file2,
L""},
- {__LINE__, SHCNE_DELETE, s_file2, NULL, "001000000", NULL, s_file2,
L""},
- {__LINE__, SHCNE_DELETE, s_file1, NULL, "001000000", NULL, s_file1,
L""},
- {__LINE__, SHCNE_UPDATEDIR, s_file1, NULL, "000001000", NULL, s_file1,
L""},
- {__LINE__, SHCNE_UPDATEDIR, s_file2, NULL, "000001000", NULL, s_file2,
L""},
- {__LINE__, SHCNE_UPDATEDIR, s_file1, s_file2, "000001000", NULL, s_file1,
s_file2},
- {__LINE__, SHCNE_UPDATEDIR, s_file2, s_file1, "000001000", NULL, s_file2,
s_file1},
- {__LINE__, SHCNE_UPDATEDIR, s_dir1, NULL, "000001000", NULL, s_dir1,
L""},
- {__LINE__, SHCNE_UPDATEDIR, s_dir2, NULL, "000001000", NULL, s_dir2,
L""},
- {__LINE__, SHCNE_UPDATEDIR, s_dir1, s_dir2, "000001000", NULL, s_dir1,
s_dir2},
- {__LINE__, SHCNE_UPDATEDIR, s_dir2, s_dir1, "000001000", NULL, s_dir2,
s_dir1},
- {__LINE__, SHCNE_RMDIR, s_dir1, NULL, "000010000", NULL, s_dir1,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "000010000", NULL, s_dir2,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir3, NULL, "000010000", NULL, s_dir3,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir1, s_dir2, "000010000", NULL, s_dir1,
s_dir2},
- {__LINE__, SHCNE_RMDIR, s_dir1, s_dir3, "000010000", NULL, s_dir1,
s_dir3},
- {__LINE__, SHCNE_RMDIR, s_dir2, s_dir1, "000010000", NULL, s_dir2,
s_dir1},
- {__LINE__, SHCNE_RMDIR, s_dir2, s_dir3, "000010000", NULL, s_dir2,
s_dir3},
- {__LINE__, SHCNE_RMDIR, s_dir3, NULL, "000010000", NULL, s_dir3,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir3, NULL, "000010000", DoAction7, s_dir3,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir1, NULL, "000010000", NULL, s_dir1,
L""},
- {__LINE__, SHCNE_RMDIR, s_dir1, NULL, "000010000", DoAction8, s_dir1,
L""},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, NULL, DoAction1, NULL, NULL},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00001000", NULL, s_dir2,
L""},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00001000", DoAction2, s_dir2,
L""},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00010000", DoAction1, s_dir2,
L""},
+ {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "00000001", NULL, s_dir2,
s_dir3},
+ {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "00000001", DoAction3,
s_dir2, s_dir3},
+ {__LINE__, SHCNE_CREATE, s_file1, NULL, "01000000", NULL, s_file1,
L""},
+ {__LINE__, SHCNE_CREATE, s_file1, s_file2, "01000000", NULL, s_file1,
s_file2},
+ {__LINE__, SHCNE_CREATE, s_file1, NULL, "01000000", DoAction4, s_file1,
L""},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "10000000", NULL, s_file1,
s_file2},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "10000000", DoAction5,
s_file1, s_file2},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "10000000", NULL, s_file1,
s_file2},
+ {__LINE__, SHCNE_UPDATEITEM, s_file1, NULL, "00000010", NULL, s_file1,
L""},
+ {__LINE__, SHCNE_UPDATEITEM, s_file2, NULL, "00000010", NULL, s_file2,
L""},
+ {__LINE__, SHCNE_DELETE, s_file1, NULL, "00100000", NULL, s_file1,
L""},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00100000", NULL, s_file2,
L""},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00100000", DoAction6, s_file2,
L""},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00100000", NULL, s_file2,
L""},
+ {__LINE__, SHCNE_DELETE, s_file1, NULL, "00100000", NULL, s_file1,
L""},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00001000", NULL, s_dir2,
L""},
+ {__LINE__, SHCNE_RMDIR, s_dir3, NULL, "00001000", DoAction7, s_dir3,
L""},
+ {__LINE__, SHCNE_RMDIR, s_dir1, NULL, "00001000", NULL, s_dir1,
L""},
+ {__LINE__, SHCNE_RMDIR, s_dir1, NULL, "00001000", DoAction8, s_dir1,
L""},
};
#define s_TestEntriesMode1 s_TestEntriesMode0
#define s_TestEntriesMode2 s_TestEntriesMode0
+static const TEST_ENTRY s_TestEntriesMode3[] =
+{
+ {__LINE__, DONT_SEND, s_dir2, NULL, NULL, DoAction1, NULL, NULL},
+ {__LINE__, DONT_SEND, s_dir2, NULL, "00001000", DoAction2, s_dir2,
L""},
+ {__LINE__, DONT_SEND, s_dir2, NULL, "00010000", DoAction1, s_dir2,
L""},
+ {__LINE__, DONT_SEND, s_dir2, s_dir3, "00000001", DoAction3, s_dir2,
s_dir3},
+ {__LINE__, DONT_SEND, s_file1, NULL, "01000000", DoAction4, s_file1,
L""},
+ {__LINE__, DONT_SEND, s_file1, s_file2, "10000000", DoAction5, s_file1,
s_file2},
+ {__LINE__, DONT_SEND, s_file2, NULL, "00100000", DoAction6, s_file2,
L""},
+ {__LINE__, DONT_SEND, s_dir3, NULL, "00001000", DoAction7, s_dir3,
L""},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_MKDIR, s_dir2, NULL, "00000000", NULL,
NULL, NULL},
+};
+
+static const TEST_ENTRY s_TestEntriesMode4[] =
+{
+ {__LINE__, DONT_SEND, s_dir2, NULL, NULL, DoAction1, NULL, NULL},
+ {__LINE__, DONT_SEND, s_dir2, NULL, "00001000", DoAction2, s_dir2,
L""},
+ {__LINE__, DONT_SEND, s_dir2, NULL, "00010000", DoAction1, s_dir2,
L""},
+ {__LINE__, DONT_SEND, s_dir2, s_dir3, "00000001", DoAction3, s_dir2,
s_dir3},
+ {__LINE__, DONT_SEND, s_file1, NULL, "01000000", DoAction4, s_file1,
L""},
+ {__LINE__, DONT_SEND, s_file1, s_file2, "10000000", DoAction5, s_file1,
s_file2},
+ {__LINE__, DONT_SEND, s_file2, NULL, "00100000", DoAction6, s_file2,
L""},
+ {__LINE__, DONT_SEND, s_dir3, NULL, "00001000", DoAction7, s_dir3,
L""},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_MKDIR, s_dir2, NULL, "00000000", NULL,
NULL, NULL},
+};
+
+static const TEST_ENTRY s_TestEntriesMode5[] =
+{
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00000000", DoAction1, NULL, NULL},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_RMDIR, s_dir2, NULL, "00000000", DoAction2, NULL, NULL},
+ {__LINE__, SHCNE_MKDIR, s_dir2, NULL, "00000000", DoAction1, NULL, NULL},
+ {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "00000000", NULL, NULL,
NULL},
+ {__LINE__, SHCNE_RENAMEFOLDER, s_dir2, s_dir3, "00000000", DoAction3, NULL,
NULL},
+ {__LINE__, SHCNE_CREATE, s_file1, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_CREATE, s_file1, s_file2, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_CREATE, s_file1, NULL, "00000000", DoAction4, NULL,
NULL},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "00000000", NULL, NULL,
NULL},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "00000000", DoAction5, NULL,
NULL},
+ {__LINE__, SHCNE_RENAMEITEM, s_file1, s_file2, "00000000", NULL, NULL,
NULL},
+ {__LINE__, SHCNE_UPDATEITEM, s_file1, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_UPDATEITEM, s_file2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_UPDATEITEM, s_file1, s_file2, "00000000", NULL, NULL,
NULL},
+ {__LINE__, SHCNE_UPDATEITEM, s_file2, s_file1, "00000000", NULL, NULL,
NULL},
+ {__LINE__, SHCNE_DELETE, s_file1, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_DELETE, s_file2, s_file1, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_DELETE, s_file1, s_file2, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00000000", DoAction6, NULL,
NULL},
+ {__LINE__, SHCNE_DELETE, s_file2, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_DELETE, s_file1, NULL, "00000000", NULL, NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir1, NULL, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir2, NULL, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir3, NULL, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir1, s_dir2, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir1, s_dir3, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir2, s_dir1, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir2, s_dir3, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir3, NULL, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir3, NULL, "00000000",
DoAction7, NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir1, NULL, "00000000", NULL,
NULL, NULL},
+ {__LINE__, SHCNE_INTERRUPT | SHCNE_RMDIR, s_dir1, NULL, "00000000",
DoAction8, NULL, NULL},
+};
+
LPCSTR PatternFromFlags(DWORD flags)
{
- static char s_buf[TYPE_FREESPACE + 1 + 1];
+ static char s_buf[TYPE_RENAMEFOLDER + 1 + 1];
DWORD i;
- for (i = 0; i <= TYPE_FREESPACE; ++i)
+ for (i = 0; i <= TYPE_RENAMEFOLDER; ++i)
{
s_buf[i] = (char)('0' + !!(flags & (1 << i)));
}
@@ -154,22 +202,17 @@ LPCSTR PatternFromFlags(DWORD flags)
}
static BOOL
-DoGetClipText(LPWSTR pszPath1, LPWSTR pszPath2)
+DoGetPaths(LPWSTR pszPath1, LPWSTR pszPath2)
{
pszPath1[0] = pszPath2[0] = 0;
- if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
- return FALSE;
-
- if (!OpenClipboard(NULL))
- return FALSE;
-
WCHAR szText[MAX_PATH * 2];
- HGLOBAL hGlobal = GetClipboardData(CF_UNICODETEXT);
- LPWSTR psz = (LPWSTR)GlobalLock(hGlobal);
- lstrcpynW(szText, psz, _countof(szText));
- GlobalUnlock(hGlobal);
- CloseClipboard();
+ szText[0] = 0;
+ if (FILE *fp = fopen(TEMP_FILE, "rb"))
+ {
+ fread(szText, 1, sizeof(szText), fp);
+ fclose(fp);
+ }
LPWSTR pch = wcschr(szText, L'|');
if (pch == NULL)
@@ -193,22 +236,46 @@ DoTestEntry(const TEST_ENTRY *entry)
{
SHChangeNotify(entry->event, SHCNF_PATHW | SHCNF_FLUSH, entry->item1,
entry->item2);
}
+ else
+ {
+ SHChangeNotify(0, SHCNF_FLUSH, NULL, NULL);
+ }
DWORD flags = SendMessageW(s_hwnd, WM_GET_NOTIFY_FLAGS, 0, 0);
LPCSTR pattern = PatternFromFlags(flags);
- ok(lstrcmpA(pattern, entry->pattern) == 0, "Line %d: pattern mismatch
'%s'\n", entry->line, pattern);
+ if (entry->pattern)
+ {
+ ok(lstrcmpA(pattern, entry->pattern) == 0 ||
+ lstrcmpA(pattern, "00000100") == 0, // SHCNE_UPDATEDIR
+ "Line %d: pattern mismatch '%s'\n", entry->line,
pattern);
+ }
SendMessageW(s_hwnd, WM_SET_PATHS, 0, 0);
+ Sleep(50);
WCHAR szPath1[MAX_PATH], szPath2[MAX_PATH];
- BOOL bOK = DoGetClipText(szPath1, szPath2);
- if (entry->path1)
- ok(bOK && lstrcmpiW(entry->path1, szPath1) == 0,
- "Line %d: path1 mismatch '%S' (%d)\n", entry->line,
szPath1, bOK);
- if (entry->path2)
- ok(bOK && lstrcmpiW(entry->path2, szPath2) == 0,
- "Line %d: path2 mismatch '%S' (%d)\n", entry->line,
szPath2, bOK);
+ szPath1[0] = szPath2[0] = 0;
+ BOOL bOK = DoGetPaths(szPath1, szPath2);
+
+ if (lstrcmpA(pattern, "00000100") == 0) // SHCNE_UPDATEDIR
+ {
+ if (entry->path1)
+ ok(bOK && lstrcmpiW(s_dir1, szPath1) == 0,
+ "Line %d: path1 mismatch '%S' (%d)\n", entry->line,
szPath1, bOK);
+ if (entry->path2)
+ ok(bOK && lstrcmpiW(L"", szPath2) == 0,
+ "Line %d: path2 mismatch '%S' (%d)\n", entry->line,
szPath2, bOK);
+ }
+ else
+ {
+ if (entry->path1)
+ ok(bOK && lstrcmpiW(entry->path1, szPath1) == 0,
+ "Line %d: path1 mismatch '%S' (%d)\n", entry->line,
szPath1, bOK);
+ if (entry->path2)
+ ok(bOK && lstrcmpiW(entry->path2, szPath2) == 0,
+ "Line %d: path2 mismatch '%S' (%d)\n", entry->line,
szPath2, bOK);
+ }
SendMessageW(s_hwnd, WM_CLEAR_FLAGS, 0, 0);
}
@@ -220,6 +287,20 @@ DoInit(void)
CreateDirectoryW(s_dir1, NULL);
+ // close Explorer before tests
+ INT i, nCount = 50;
+ for (i = 0; i < nCount; ++i)
+ {
+ HWND hwnd = FindWindowW(L"CabinetWClass", NULL);
+ if (hwnd == NULL)
+ break;
+
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ Sleep(100);
+ }
+ if (i == nCount)
+ skip("Unable to close Explorer cabinet\n");
+
return PathIsDirectoryW(s_dir1);
}
@@ -231,6 +312,7 @@ DoEnd(HWND hwnd)
RemoveDirectoryW(s_dir3);
RemoveDirectoryW(s_dir2);
RemoveDirectoryW(s_dir1);
+ DeleteFileA(TEMP_FILE);
SendMessageW(s_hwnd, WM_COMMAND, IDOK, 0);
}
@@ -259,6 +341,9 @@ GetSubProgramPath(void)
static void
JustDoIt(INT nMode)
{
+ trace("nMode: %d\n", nMode);
+ SHChangeNotify(0, SHCNF_FLUSH, NULL, NULL);
+
if (!DoInit())
{
skip("Unable to initialize.\n");
@@ -300,6 +385,24 @@ JustDoIt(INT nMode)
DoTestEntry(&s_TestEntriesMode0[i]);
}
break;
+ case 3:
+ for (size_t i = 0; i < _countof(s_TestEntriesMode3); ++i)
+ {
+ DoTestEntry(&s_TestEntriesMode3[i]);
+ }
+ break;
+ case 4:
+ for (size_t i = 0; i < _countof(s_TestEntriesMode4); ++i)
+ {
+ DoTestEntry(&s_TestEntriesMode4[i]);
+ }
+ break;
+ case 5:
+ for (size_t i = 0; i < _countof(s_TestEntriesMode5); ++i)
+ {
+ DoTestEntry(&s_TestEntriesMode5[i]);
+ }
+ break;
}
DoEnd(s_hwnd);
@@ -324,4 +427,7 @@ START_TEST(SHChangeNotify)
JustDoIt(0);
JustDoIt(1);
JustDoIt(2);
+ JustDoIt(3);
+ JustDoIt(4);
+ JustDoIt(5);
}
diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.h
b/modules/rostests/apitests/shell32/SHChangeNotify.h
index 7a5cbc4f988..71389513eb2 100644
--- a/modules/rostests/apitests/shell32/SHChangeNotify.h
+++ b/modules/rostests/apitests/shell32/SHChangeNotify.h
@@ -1,5 +1,7 @@
#pragma once
+#define TEMP_FILE "shell-notify-temporary.txt"
+
typedef enum TYPE
{
TYPE_RENAMEITEM,
@@ -9,8 +11,7 @@ typedef enum TYPE
TYPE_RMDIR,
TYPE_UPDATEDIR,
TYPE_UPDATEITEM,
- TYPE_RENAMEFOLDER,
- TYPE_FREESPACE
+ TYPE_RENAMEFOLDER
} TYPE;
#define WM_SHELL_NOTIFY (WM_USER + 100)
diff --git a/modules/rostests/apitests/shell32/shell-notify.cpp
b/modules/rostests/apitests/shell32/shell-notify.cpp
index 8f7043b96a4..367f43dc482 100644
--- a/modules/rostests/apitests/shell32/shell-notify.cpp
+++ b/modules/rostests/apitests/shell32/shell-notify.cpp
@@ -14,7 +14,7 @@ static HWND s_hwnd = NULL;
static const WCHAR s_szName[] = L"SHChangeNotify testcase";
static INT s_nMode;
-static BYTE s_counters[TYPE_FREESPACE + 1];
+static BYTE s_counters[TYPE_RENAMEFOLDER + 1];
static UINT s_uRegID = 0;
static WCHAR s_path1[MAX_PATH], s_path2[MAX_PATH];
@@ -50,6 +50,22 @@ OnCreate(HWND hwnd)
nSources = SHCNRF_ShellLevel | SHCNRF_NewDelivery;
break;
+ case 3:
+ s_entry.fRecursive = TRUE;
+ nSources = SHCNRF_InterruptLevel | SHCNRF_RecursiveInterrupt |
SHCNRF_NewDelivery;
+ break;
+
+ case 4:
+ s_entry.fRecursive = FALSE;
+ nSources = SHCNRF_InterruptLevel | SHCNRF_NewDelivery;
+ break;
+
+ case 5:
+ s_entry.fRecursive = TRUE;
+ nSources = SHCNRF_InterruptLevel | SHCNRF_RecursiveInterrupt |
SHCNRF_NewDelivery;
+ s_entry.pidl = NULL;
+ break;
+
default:
return FALSE;
}
@@ -144,7 +160,6 @@ DoShellNotify(HWND hwnd, PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE
pidl2, LONG lE
s_counters[TYPE_RENAMEFOLDER] = 1;
break;
case SHCNE_FREESPACE:
- s_counters[TYPE_FREESPACE] = 1;
break;
case SHCNE_EXTENDED_EVENT:
break;
@@ -177,6 +192,9 @@ OnShellNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT
OnGetNotifyFlags(HWND hwnd)
{
+ if (s_uRegID == 0)
+ return 0xFFFFFFFF;
+
DWORD dwFlags = 0;
for (size_t i = 0; i < _countof(s_counters); ++i)
{
@@ -187,34 +205,19 @@ OnGetNotifyFlags(HWND hwnd)
}
static void
-DoSetClipText(HWND hwnd)
+DoSetPaths(HWND hwnd)
{
- if (!OpenClipboard(hwnd))
- return;
-
- EmptyClipboard();
-
WCHAR szText[MAX_PATH * 2];
lstrcpyW(szText, s_path1);
lstrcatW(szText, L"|");
lstrcatW(szText, s_path2);
- DWORD cbText = (lstrlenW(szText) + 1) * sizeof(WCHAR);
- HGLOBAL hGlobal = GlobalAlloc(GHND | GMEM_SHARE, cbText);
- if (hGlobal)
+ if (FILE *fp = fopen(TEMP_FILE, "wb"))
{
- LPWSTR psz = (LPWSTR)GlobalLock(hGlobal);
- if (psz)
- {
- CopyMemory(psz, szText, cbText);
- GlobalUnlock(hGlobal);
-
- SetClipboardData(CF_UNICODETEXT, hGlobal);
- }
+ fwrite(szText, (lstrlenW(szText) + 1) * sizeof(WCHAR), 1, fp);
+ fflush(fp);
+ fclose(fp);
}
-
- CloseClipboard();
- Sleep(60);
}
static LRESULT CALLBACK
@@ -244,7 +247,7 @@ WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case WM_SET_PATHS:
- DoSetClipText(hwnd);
+ DoSetPaths(hwnd);
break;
default: