From 909468c4dc6c21661b6b3a75c2ec120ed7a05e34 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 31 Jan 2025 08:15:36 +0900 Subject: [PATCH] [SDK][SHELL32][SHLWAPI][SHLWAPI_APITEST] Split IShellFolder helpers hack (#7685) Splitting the hack will improve our code quality. JIRA issue: N/A - Add sdk/include/reactos/ishellfolder_helpers.h header file. - Split conflicting code. --- dll/win32/shell32/precomp.h | 2 +- dll/win32/shlwapi/utils.cpp | 9 +--- .../apitests/shlwapi/IShellFolderHelpers.cpp | 2 +- sdk/include/reactos/ishellfolder_helpers.h | 51 +++++++++++++++++++ sdk/include/reactos/shlobj_undoc.h | 1 - sdk/include/reactos/shlwapi_undoc.h | 35 ------------- 6 files changed, 54 insertions(+), 46 deletions(-) create mode 100644 sdk/include/reactos/ishellfolder_helpers.h diff --git a/dll/win32/shell32/precomp.h b/dll/win32/shell32/precomp.h index 6d65aeac056..267ed1d44c9 100644 --- a/dll/win32/shell32/precomp.h +++ b/dll/win32/shell32/precomp.h @@ -42,8 +42,8 @@ #include #include -#define SHLWAPI_ISHELLFOLDER_HELPERS #include +#include #include #undef ShellExecute diff --git a/dll/win32/shlwapi/utils.cpp b/dll/win32/shlwapi/utils.cpp index 8cfb8ab2d61..51a881363c7 100644 --- a/dll/win32/shlwapi/utils.cpp +++ b/dll/win32/shlwapi/utils.cpp @@ -21,15 +21,8 @@ #include #include -/* - * HACK! - */ -#undef IShellFolder_GetDisplayNameOf -#undef IShellFolder_ParseDisplayName -#undef IShellFolder_CompareIDs - -#define SHLWAPI_ISHELLFOLDER_HELPERS /* HACK! */ #include +#include #include diff --git a/modules/rostests/apitests/shlwapi/IShellFolderHelpers.cpp b/modules/rostests/apitests/shlwapi/IShellFolderHelpers.cpp index 588ef3f329c..0a94af1c3e7 100644 --- a/modules/rostests/apitests/shlwapi/IShellFolderHelpers.cpp +++ b/modules/rostests/apitests/shlwapi/IShellFolderHelpers.cpp @@ -10,8 +10,8 @@ #include #include -#define SHLWAPI_ISHELLFOLDER_HELPERS #include +#include static INT s_nStep = 0; diff --git a/sdk/include/reactos/ishellfolder_helpers.h b/sdk/include/reactos/ishellfolder_helpers.h new file mode 100644 index 00000000000..28591f71589 --- /dev/null +++ b/sdk/include/reactos/ishellfolder_helpers.h @@ -0,0 +1,51 @@ +/* + * PROJECT: ReactOS header + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: SHLWAPI IShellFolder helpers + * COPYRIGHT: Copyright 2009 Andrew Hill + * Copyright 2025 Katayama Hirofumi MZ + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* HACK! These function names are conflicting with functions. */ +#undef IShellFolder_GetDisplayNameOf +#undef IShellFolder_ParseDisplayName +#undef IShellFolder_CompareIDs + +HRESULT WINAPI +IShellFolder_GetDisplayNameOf( + _In_ IShellFolder *psf, + _In_ LPCITEMIDLIST pidl, + _In_ SHGDNF uFlags, + _Out_ LPSTRRET lpName, + _In_ DWORD dwRetryFlags); + +/* Flags for IShellFolder_GetDisplayNameOf */ +#define SFGDNO_RETRYWITHFORPARSING 0x00000001 +#define SFGDNO_RETRYALWAYS 0x80000000 + +HRESULT WINAPI +IShellFolder_ParseDisplayName( + _In_ IShellFolder *psf, + _In_ HWND hwndOwner, + _In_ LPBC pbcReserved, + _In_ LPOLESTR lpszDisplayName, + _Out_ ULONG *pchEaten, + _Out_ PIDLIST_RELATIVE *ppidl, + _Out_ ULONG *pdwAttributes); + +EXTERN_C HRESULT WINAPI +IShellFolder_CompareIDs( + _In_ IShellFolder *psf, + _In_ LPARAM lParam, + _In_ PCUIDLIST_RELATIVE pidl1, + _In_ PCUIDLIST_RELATIVE pidl2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/sdk/include/reactos/shlobj_undoc.h b/sdk/include/reactos/shlobj_undoc.h index b0392644ecd..c7f080ede36 100644 --- a/sdk/include/reactos/shlobj_undoc.h +++ b/sdk/include/reactos/shlobj_undoc.h @@ -9,7 +9,6 @@ #pragma once -#define SHLWAPI_ISHELLFOLDER_HELPERS #include // For ASSOCQUERY #ifdef __cplusplus diff --git a/sdk/include/reactos/shlwapi_undoc.h b/sdk/include/reactos/shlwapi_undoc.h index d4b2cf3fd1d..2ca22001c21 100644 --- a/sdk/include/reactos/shlwapi_undoc.h +++ b/sdk/include/reactos/shlwapi_undoc.h @@ -376,41 +376,6 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid); #define SHACF_WIN95SHLEXEC 0x00000200 /* Geoff Chappell */ DWORD WINAPI SHGetAppCompatFlags(DWORD dwMask); -/* - * HACK! These functions are conflicting with inline functions... - * We provide a macro option SHLWAPI_ISHELLFOLDER_HELPERS for using these functions. - */ -#ifdef SHLWAPI_ISHELLFOLDER_HELPERS -HRESULT WINAPI -IShellFolder_GetDisplayNameOf( - _In_ IShellFolder *psf, - _In_ LPCITEMIDLIST pidl, - _In_ SHGDNF uFlags, - _Out_ LPSTRRET lpName, - _In_ DWORD dwRetryFlags); - -/* Flags for IShellFolder_GetDisplayNameOf */ -#define SFGDNO_RETRYWITHFORPARSING 0x00000001 -#define SFGDNO_RETRYALWAYS 0x80000000 - -HRESULT WINAPI -IShellFolder_ParseDisplayName( - _In_ IShellFolder *psf, - _In_ HWND hwndOwner, - _In_ LPBC pbcReserved, - _In_ LPOLESTR lpszDisplayName, - _Out_ ULONG *pchEaten, - _Out_ PIDLIST_RELATIVE *ppidl, - _Out_ ULONG *pdwAttributes); - -EXTERN_C HRESULT WINAPI -IShellFolder_CompareIDs( - _In_ IShellFolder *psf, - _In_ LPARAM lParam, - _In_ PCUIDLIST_RELATIVE pidl1, - _In_ PCUIDLIST_RELATIVE pidl2); -#endif /* SHLWAPI_ISHELLFOLDER_HELPERS */ - /***************************************************************************** * IAssociationElementOld interface *