https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a3797dba7a3bbb1eb4507…
commit a3797dba7a3bbb1eb45076bb49ca9cc6d3adc332
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Mon Dec 25 13:22:03 2017 +0100
[SHELL32] Deduplicate MAX_PROPERTY_SHEET_PAGE and AddPropSheetPageCallback(). #179
---
dll/win32/shell32/CShellLink.cpp | 1 -
dll/win32/shell32/dialogs/drive.cpp | 14 --------------
dll/win32/shell32/dialogs/folder_options.cpp | 2 --
dll/win32/shell32/dialogs/fprop.cpp | 16 ----------------
dll/win32/shell32/folders/CRecycleBin.cpp | 2 --
dll/win32/shell32/precomp.h | 18 ++++++++++++++++++
6 files changed, 18 insertions(+), 35 deletions(-)
diff --git a/dll/win32/shell32/CShellLink.cpp b/dll/win32/shell32/CShellLink.cpp
index 918c98e610..5b7b84dc41 100644
--- a/dll/win32/shell32/CShellLink.cpp
+++ b/dll/win32/shell32/CShellLink.cpp
@@ -144,7 +144,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
#define SHLINK_LOCAL 0
#define SHLINK_REMOTE 1
-#define MAX_PROPERTY_SHEET_PAGE 32
/* link file formats */
diff --git a/dll/win32/shell32/dialogs/drive.cpp b/dll/win32/shell32/dialogs/drive.cpp
index 3afbe80d8c..679afe6a57 100644
--- a/dll/win32/shell32/dialogs/drive.cpp
+++ b/dll/win32/shell32/dialogs/drive.cpp
@@ -21,8 +21,6 @@
#include "precomp.h"
-#define MAX_PROPERTY_SHEET_PAGE 32
-
WINE_DEFAULT_DEBUG_CHANNEL(shell);
typedef struct
@@ -109,18 +107,6 @@ GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize,
PULARGE_INTEGER TotalNum
return TRUE;
}
-static BOOL CALLBACK
-AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
-{
- PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam;
- if (ppsh->nPages < MAX_PROPERTY_SHEET_PAGE)
- {
- ppsh->phpage[ppsh->nPages++] = hPage;
- return TRUE;
- }
- return FALSE;
-}
-
typedef struct _DRIVE_PROP_PAGE
{
LPCSTR resname;
diff --git a/dll/win32/shell32/dialogs/folder_options.cpp
b/dll/win32/shell32/dialogs/folder_options.cpp
index 45908ff521..3bb39977ad 100644
--- a/dll/win32/shell32/dialogs/folder_options.cpp
+++ b/dll/win32/shell32/dialogs/folder_options.cpp
@@ -23,8 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL (fprop);
-#define MAX_PROPERTY_SHEET_PAGE (32)
-
/// Folder Options:
/// CLASSKEY = HKEY_CLASSES_ROOT\CLSID\{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}
/// DefaultIcon = %SystemRoot%\system32\SHELL32.dll,-210
diff --git a/dll/win32/shell32/dialogs/fprop.cpp b/dll/win32/shell32/dialogs/fprop.cpp
index 989a9ce6c1..784d6ec505 100644
--- a/dll/win32/shell32/dialogs/fprop.cpp
+++ b/dll/win32/shell32/dialogs/fprop.cpp
@@ -22,26 +22,10 @@
#include "precomp.h"
-#define MAX_PROPERTY_SHEET_PAGE 32
-
WINE_DEFAULT_DEBUG_CHANNEL(shell);
EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT
max_iface, IDataObject *pDataObj);
-static BOOL CALLBACK
-AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
-{
- PROPSHEETHEADERW *pHeader = (PROPSHEETHEADERW *)lParam;
-
- if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
- {
- pHeader->phpage[pHeader->nPages++] = hPage;
- return TRUE;
- }
-
- return FALSE;
-}
-
static UINT
LoadPropSheetHandlers(LPCWSTR pwszPath, PROPSHEETHEADERW *pHeader, UINT cMaxPages, HPSXA
*phpsxa, IDataObject *pDataObj)
{
diff --git a/dll/win32/shell32/folders/CRecycleBin.cpp
b/dll/win32/shell32/folders/CRecycleBin.cpp
index 51be9662cd..fb8c1d8dc1 100644
--- a/dll/win32/shell32/folders/CRecycleBin.cpp
+++ b/dll/win32/shell32/folders/CRecycleBin.cpp
@@ -24,8 +24,6 @@
#include <mmsystem.h>
#include <ntquery.h>
-#define MAX_PROPERTY_SHEET_PAGE 32
-
WINE_DEFAULT_DEBUG_CHANNEL(CRecycleBin);
typedef struct
diff --git a/dll/win32/shell32/precomp.h b/dll/win32/shell32/precomp.h
index dbea414a17..03166e37e6 100644
--- a/dll/win32/shell32/precomp.h
+++ b/dll/win32/shell32/precomp.h
@@ -93,4 +93,22 @@ extern const GUID CLSID_UnixDosFolder;
extern const GUID SHELL32_AdvtShortcutProduct;
extern const GUID SHELL32_AdvtShortcutComponent;
+#define MAX_PROPERTY_SHEET_PAGE 32
+
+extern inline
+BOOL
+CALLBACK
+AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
+{
+ PROPSHEETHEADERW *pHeader = (PROPSHEETHEADERW *)lParam;
+
+ if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
+ {
+ pHeader->phpage[pHeader->nPages++] = hPage;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
#endif /* _PRECOMP_H__ */