https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d59f5ae2a5d0b6fc33e58…
commit d59f5ae2a5d0b6fc33e58963023eab42d20e6fe7
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Nov 15 20:37:09 2021 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Fri Dec 31 21:27:30 2021 +0100
[SHELL32][SHELL32_APITEST] Implement SHCreateFileDataObject
---
dll/win32/shell32/CIDLDataObj.cpp | 12 ++++++++
dll/win32/shell32/shell32.spec | 2 +-
modules/rostests/apitests/shell32/CMakeLists.txt | 1 +
.../apitests/shell32/SHCreateDataObject.cpp | 2 +-
...teDataObject.cpp => SHCreateFileDataObject.cpp} | 32 ++++++++++++----------
modules/rostests/apitests/shell32/testlist.c | 2 ++
sdk/include/reactos/shlobj_undoc.h | 1 +
7 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/dll/win32/shell32/CIDLDataObj.cpp b/dll/win32/shell32/CIDLDataObj.cpp
index 0559402cc6d..bbbd959528e 100644
--- a/dll/win32/shell32/CIDLDataObj.cpp
+++ b/dll/win32/shell32/CIDLDataObj.cpp
@@ -400,3 +400,15 @@ HRESULT WINAPI SHCreateDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT
cidl, PCUIT
}
return E_FAIL;
}
+
+/*************************************************************************
+ * SHCreateFileDataObject [SHELL32.740]
+ *
+ */
+
+HRESULT WINAPI SHCreateFileDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl, IDataObject* pDataInner, IDataObject** ppDataObj)
+{
+ if (pDataInner)
+ UNIMPLEMENTED;
+ return IDataObject_Constructor(NULL, pidlFolder, apidl, cidl, TRUE, ppDataObj);
+}
diff --git a/dll/win32/shell32/shell32.spec b/dll/win32/shell32/shell32.spec
index 7457ec4eb37..c050a87a122 100644
--- a/dll/win32/shell32/shell32.spec
+++ b/dll/win32/shell32/shell32.spec
@@ -450,7 +450,7 @@
731 stdcall -noname -stub SHRegisterDarwinLink(long long long)
732 stdcall -noname SHReValidateDarwinCache()
733 stdcall -noname CheckDiskSpace()
-740 stub -noname SHCreateFileDataObject
+740 stdcall -noname SHCreateFileDataObject(ptr long ptr ptr ptr)
743 stdcall SHCreateFileExtractIconW(wstr long ptr ptr)
744 stub -noname Create_IEnumUICommand
745 stub -noname Create_IUIElement
diff --git a/modules/rostests/apitests/shell32/CMakeLists.txt
b/modules/rostests/apitests/shell32/CMakeLists.txt
index 9ebf9404a2d..3f5c4b33ad5 100644
--- a/modules/rostests/apitests/shell32/CMakeLists.txt
+++ b/modules/rostests/apitests/shell32/CMakeLists.txt
@@ -20,6 +20,7 @@ list(APPEND SOURCE
SHAppBarMessage.cpp
SHChangeNotify.cpp
SHCreateDataObject.cpp
+ SHCreateFileDataObject.cpp
SHCreateFileExtractIconW.cpp
SHParseDisplayName.cpp
ShellExecCmdLine.cpp
diff --git a/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
b/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
index 00f4ec11077..847986171b2 100644
--- a/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
+++ b/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
@@ -2,7 +2,7 @@
* PROJECT: ReactOS api tests
* LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Test for SHCreateDataObject
- * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen(a)reactos.org)
+ * COPYRIGHT: Copyright 2019 Mark Jansen <mark.jansen(a)reactos.org>
*/
#include "shelltest.h"
diff --git a/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
b/modules/rostests/apitests/shell32/SHCreateFileDataObject.cpp
similarity index 91%
copy from modules/rostests/apitests/shell32/SHCreateDataObject.cpp
copy to modules/rostests/apitests/shell32/SHCreateFileDataObject.cpp
index 00f4ec11077..697650d51d2 100644
--- a/modules/rostests/apitests/shell32/SHCreateDataObject.cpp
+++ b/modules/rostests/apitests/shell32/SHCreateFileDataObject.cpp
@@ -1,8 +1,10 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
- * PURPOSE: Test for SHCreateDataObject
- * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen(a)reactos.org)
+ * PURPOSE: Test for SHCreateFileDataObject
+ * COPYRIGHT: Copyright 2019-2021 Mark Jansen <mark.jansen(a)reactos.org>
+ *
+ * This is 99% the same as the test for SHCreateDataObject, except that this always has 4
data types (TestDefaultFormat)
*/
#include "shelltest.h"
@@ -13,14 +15,14 @@
static DWORD g_WinVersion;
-typedef HRESULT (WINAPI *tSHCreateDataObject)(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl, IDataObject *pdtInner, REFIID riid, void **ppv);
-static tSHCreateDataObject pSHCreateDataObject;
+typedef HRESULT(WINAPI* tSHCreateFileDataObject)(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl, IDataObject* pDataInner, IDataObject** ppDataObj);
+static tSHCreateFileDataObject pSHCreateFileDataObject;
static void TestAdviseAndCanonical(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUIDLIST_RELATIVE_ARRAY apidl)
{
CComPtr<IDataObject> spDataObj;
- HRESULT hr = pSHCreateDataObject(pidlFolder, cidl, apidl, NULL,
IID_PPV_ARG(IDataObject, &spDataObj));
+ HRESULT hr = pSHCreateFileDataObject(pidlFolder, cidl, apidl, NULL, &spDataObj);
ok_hex(hr, S_OK);
if (!SUCCEEDED(hr))
@@ -144,7 +146,7 @@ static void TestFilenameW(PVOID pData, SIZE_T Size, LPCWSTR
ExpectRoot, LPCWSTR
static void TestDefaultFormat(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUIDLIST_RELATIVE_ARRAY apidl)
{
CComPtr<IDataObject> spDataObj;
- HRESULT hr = pSHCreateDataObject(pidlFolder, cidl, apidl, NULL,
IID_PPV_ARG(IDataObject, &spDataObj));
+ HRESULT hr = pSHCreateFileDataObject(pidlFolder, cidl, apidl, NULL, &spDataObj);
ok_hex(hr, S_OK);
if (!SUCCEEDED(hr))
@@ -186,7 +188,7 @@ static void TestDefaultFormat(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUIDLIST
Count++;
}
trace("Got %u formats\n", Count);
- ULONG ExpectedCount = (g_WinVersion < _WIN32_WINNT_WIN8) ? 1 : 4;
+ ULONG ExpectedCount = 4;
ok_int(Count, (int)ExpectedCount);
ok_hex(hr, S_FALSE);
@@ -242,10 +244,10 @@ static void TestDefaultFormat(PCIDLIST_ABSOLUTE pidlFolder, UINT
cidl, PCUIDLIST
}
else
{
- if (g_WinVersion < _WIN32_WINNT_VISTA)
+ //if (g_WinVersion < _WIN32_WINNT_VISTA)
ok(hr == E_INVALIDARG, "0x%x (0x%x(%s))\n", (unsigned int)hr,
Expected[Count], szExpected);
- else
- ok(hr == DV_E_FORMATETC, "0x%x (0x%x(%s))\n", (unsigned int)hr,
Expected[Count], szExpected);
+ //else
+ // ok(hr == DV_E_FORMATETC, "0x%x (0x%x(%s))\n", (unsigned
int)hr, Expected[Count], szExpected);
}
if (SUCCEEDED(hr))
@@ -267,7 +269,7 @@ static void TestDefaultFormat(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUIDLIST
static void TestSetAndGetExtraFormat(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUIDLIST_RELATIVE_ARRAY apidl)
{
CComPtr<IDataObject> spDataObj;
- HRESULT hr = pSHCreateDataObject(pidlFolder, cidl, apidl, NULL,
IID_PPV_ARG(IDataObject, &spDataObj));
+ HRESULT hr = pSHCreateFileDataObject(pidlFolder, cidl, apidl, NULL, &spDataObj);
ok_hex(hr, S_OK);
if (!SUCCEEDED(hr))
@@ -398,14 +400,14 @@ static void TestSetAndGetExtraFormat(PCIDLIST_ABSOLUTE pidlFolder,
UINT cidl, PC
ok_size_t(size, 0);
}
-START_TEST(SHCreateDataObject)
+START_TEST(SHCreateFileDataObject)
{
HRESULT hr;
- pSHCreateDataObject =
(tSHCreateDataObject)GetProcAddress(GetModuleHandleA("shell32.dll"),
"SHCreateDataObject");
- if (!pSHCreateDataObject)
+ pSHCreateFileDataObject =
(tSHCreateFileDataObject)GetProcAddress(GetModuleHandleA("shell32.dll"),
MAKEINTRESOURCEA(740));
+ if (!pSHCreateFileDataObject)
{
- skip("shell32!SHCreateDataObject not exported\n");
+ skip("shell32!SHCreateFileDataObject not exported\n");
return;
}
diff --git a/modules/rostests/apitests/shell32/testlist.c
b/modules/rostests/apitests/shell32/testlist.c
index 7c306faa1a7..ac5dd174e40 100644
--- a/modules/rostests/apitests/shell32/testlist.c
+++ b/modules/rostests/apitests/shell32/testlist.c
@@ -22,6 +22,7 @@ extern void func_PathResolve(void);
extern void func_SHAppBarMessage(void);
extern void func_SHChangeNotify(void);
extern void func_SHCreateDataObject(void);
+extern void func_SHCreateFileDataObject(void);
extern void func_SHCreateFileExtractIconW(void);
extern void func_ShellExecCmdLine(void);
extern void func_ShellExecuteEx(void);
@@ -53,6 +54,7 @@ const struct test winetest_testlist[] =
{ "SHAppBarMessage", func_SHAppBarMessage },
{ "SHChangeNotify", func_SHChangeNotify },
{ "SHCreateDataObject", func_SHCreateDataObject },
+ { "SHCreateFileDataObject", func_SHCreateFileDataObject },
{ "SHCreateFileExtractIconW", func_SHCreateFileExtractIconW },
{ "ShellExecCmdLine", func_ShellExecCmdLine },
{ "ShellExecuteEx", func_ShellExecuteEx },
diff --git a/sdk/include/reactos/shlobj_undoc.h b/sdk/include/reactos/shlobj_undoc.h
index 56e7d7c21a3..a4cf836d7a2 100644
--- a/sdk/include/reactos/shlobj_undoc.h
+++ b/sdk/include/reactos/shlobj_undoc.h
@@ -711,6 +711,7 @@ DECLARE_INTERFACE_(ITrayPriv, IUnknown)
HANDLE WINAPI SHCreateDesktop(IShellDesktopTray*);
BOOL WINAPI SHDesktopMessageLoop(HANDLE);
+HRESULT WINAPI SHCreateFileDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl, IDataObject* pDataInner, IDataObject** ppDataObj);
#ifdef __cplusplus
} /* extern "C" */