From 6696d40cfce9d075db6499fedea716b2e86b7132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 18 May 2025 22:29:40 +0200 Subject: [PATCH] [SDK] Introduce winbase_undoc.h for undocumented exported kernel32 definitions (#8019) This header is based on the following files from the official Windows 10.0.10240.0 PSDK, a copy of which can be found at: - https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/minwin/winbasep.h - https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/minwin/wbasek.h --- CODEOWNERS | 2 + base/services/schedsvc/job.c | 1 + base/services/schedsvc/precomp.h | 1 - base/system/services/database.c | 3 +- base/system/winlogon/screensaver.c | 1 + base/system/winlogon/winlogon.h | 4 +- dll/win32/kernel32/include/kernel32.h | 3 -- dll/win32/kernel32/k32.h | 1 + dll/win32/shell32/shelldesktop/shelldesktop.h | 1 - dll/win32/shell32/shellmenu/shellmenu.h | 1 - dll/win32/shell32/shlexec.cpp | 4 +- sdk/include/psdk/winbase.h | 3 ++ sdk/include/reactos/undocuser.h | 9 +++- sdk/include/reactos/winbase_undoc.h | 41 +++++++++++++++++++ win32ss/pch.h | 7 ++-- win32ss/user/ntuser/main.c | 8 +--- 16 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 sdk/include/reactos/winbase_undoc.h diff --git a/CODEOWNERS b/CODEOWNERS index 94cc93ebfe6..d28ad14505e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -432,6 +432,8 @@ # M: # R: HBelusca, Hermès Bélusca-Maïto # S: Maintained +/sdk/include/reactos/winbase_undoc.h @HBelusca +/subsystems/win/basesrv/ /win32ss/user/winsrv/ /win32ss/user/winsrv/usersrv/harderror.c @HBelusca diff --git a/base/services/schedsvc/job.c b/base/services/schedsvc/job.c index e29d2732716..cdf84f7f8c7 100644 --- a/base/services/schedsvc/job.c +++ b/base/services/schedsvc/job.c @@ -9,6 +9,7 @@ /* INCLUDES *****************************************************************/ #include "precomp.h" +#include WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); diff --git a/base/services/schedsvc/precomp.h b/base/services/schedsvc/precomp.h index f3c3e4255cf..b17c45524a4 100644 --- a/base/services/schedsvc/precomp.h +++ b/base/services/schedsvc/precomp.h @@ -12,7 +12,6 @@ #include #include #include -#include #include diff --git a/base/system/services/database.c b/base/system/services/database.c index 2202459e9c4..3ea19631415 100644 --- a/base/system/services/database.c +++ b/base/system/services/database.c @@ -14,11 +14,10 @@ #include "services.h" +#include #include #include -#include - #define NDEBUG #include diff --git a/base/system/winlogon/screensaver.c b/base/system/winlogon/screensaver.c index 6f37bf57362..6930435476e 100644 --- a/base/system/winlogon/screensaver.c +++ b/base/system/winlogon/screensaver.c @@ -9,6 +9,7 @@ /* INCLUDES *****************************************************************/ #include "winlogon.h" +#include /* FUNCTIONS ****************************************************************/ diff --git a/base/system/winlogon/winlogon.h b/base/system/winlogon/winlogon.h index 066749597e7..b995bf923d4 100644 --- a/base/system/winlogon/winlogon.h +++ b/base/system/winlogon/winlogon.h @@ -47,8 +47,8 @@ /* PSEH for SEH Support */ #include -#include -#include +#include +#include BOOL WINAPI diff --git a/dll/win32/kernel32/include/kernel32.h b/dll/win32/kernel32/include/kernel32.h index c331e45f465..cd64ed7653f 100644 --- a/dll/win32/kernel32/include/kernel32.h +++ b/dll/win32/kernel32/include/kernel32.h @@ -56,9 +56,6 @@ #define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) #define __ENDTRY _SEH2_END -/* Undocumented CreateProcess flag */ -#define STARTF_SHELLPRIVATE 0x400 - typedef struct _CODEPAGE_ENTRY { LIST_ENTRY Entry; diff --git a/dll/win32/kernel32/k32.h b/dll/win32/kernel32/k32.h index c84dabe0086..c9a3c52eaad 100644 --- a/dll/win32/kernel32/k32.h +++ b/dll/win32/kernel32/k32.h @@ -17,6 +17,7 @@ #define WIN32_NO_STATUS #include #include +#include #include #include #include diff --git a/dll/win32/shell32/shelldesktop/shelldesktop.h b/dll/win32/shell32/shelldesktop/shelldesktop.h index 4c088eec87b..e85d9e273a9 100644 --- a/dll/win32/shell32/shelldesktop/shelldesktop.h +++ b/dll/win32/shell32/shelldesktop/shelldesktop.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "CChangeNotifyServer.h" diff --git a/dll/win32/shell32/shellmenu/shellmenu.h b/dll/win32/shell32/shellmenu/shellmenu.h index 411239240e8..b3aa9065d09 100644 --- a/dll/win32/shell32/shellmenu/shellmenu.h +++ b/dll/win32/shell32/shellmenu/shellmenu.h @@ -49,7 +49,6 @@ #include #include #include -#include #include #include diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp index 91c89c10bc2..d5c3675eb84 100644 --- a/dll/win32/shell32/shlexec.cpp +++ b/dll/win32/shell32/shlexec.cpp @@ -21,15 +21,13 @@ */ #include "precomp.h" +#include #include WINE_DEFAULT_DEBUG_CHANNEL(exec); EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath); -#ifndef STARTF_SHELLPRIVATE -#define STARTF_SHELLPRIVATE 0x400 // From kernel32.h -#endif #define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY) typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, diff --git a/sdk/include/psdk/winbase.h b/sdk/include/psdk/winbase.h index 1d5d50ff224..48310ab6a36 100644 --- a/sdk/include/psdk/winbase.h +++ b/sdk/include/psdk/winbase.h @@ -536,6 +536,9 @@ extern "C" { #define STARTF_TITLEISAPPID 0x00001000 #define STARTF_PREVENTPINNING 0x00002000 #endif /* (WINVER >= 0x400) */ +#if (WINVER >= 0x0600) +#define STARTF_UNTRUSTEDSOURCE 0x00008000 +#endif /* (WINVER >= 0x0600) */ #define TC_NORMAL 0 #define TC_HARDERR 1 diff --git a/sdk/include/reactos/undocuser.h b/sdk/include/reactos/undocuser.h index 9d0413515c9..da2e7e35bfe 100644 --- a/sdk/include/reactos/undocuser.h +++ b/sdk/include/reactos/undocuser.h @@ -1,6 +1,8 @@ #ifndef _UNDOCUSER_H #define _UNDOCUSER_H +#pragma once + #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ @@ -159,10 +161,13 @@ extern "C" { #define DFCS_MENUARROWDOWN 0x0010 // -// Undocumented flags for CreateProcess +// Win32-user-specific undocumented flags for CreateProcess // +#ifndef STARTF_INHERITDESKTOP #define STARTF_INHERITDESKTOP 0x40000000 #define STARTF_SCREENSAVER 0x80000000 +#endif + #define MOD_WINLOGON_SAS 0x8000 @@ -414,4 +419,4 @@ typedef enum tagSETIMEHOTKEY_ACTION } /* extern "C" */ #endif /* defined(__cplusplus) */ -#endif +#endif /* _UNDOCUSER_H */ diff --git a/sdk/include/reactos/winbase_undoc.h b/sdk/include/reactos/winbase_undoc.h new file mode 100644 index 00000000000..2f0f5624fc8 --- /dev/null +++ b/sdk/include/reactos/winbase_undoc.h @@ -0,0 +1,41 @@ +/* + * PROJECT: ReactOS SDK + * LICENSE: Dual-licensed: + * LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Undocumented Base API definitions, absent from winbase.h + * COPYRIGHT: Copyright 2025 Hermès Bélusca-Maïto + * + * REMARK: This header is based on the following files from the official + * Windows 10.0.10240.0 PSDK, a copy of which can be found at: + * - https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/minwin/winbasep.h + * - https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/minwin/wbasek.h + */ + +#ifndef _WINBASE_UNDOC_H +#define _WINBASE_UNDOC_H + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Undocumented flags for CreateProcess + */ +#if (WINVER >= 0x400) +#define STARTF_HASSHELLDATA 0x00000400 // As seen in um/minwin/winbasep.h +#define STARTF_SHELLPRIVATE STARTF_HASSHELLDATA // ReactOS-specific name +#endif /* (WINVER >= 0x400) */ +#if (WINVER >= 0x0A00) +#define STARTF_TITLEISLOCALALLOCED 0x00004000 +#endif /* (WINVER >= 0x0A00) */ +#define STARTF_INHERITDESKTOP 0x40000000 +#define STARTF_SCREENSAVER 0x80000000 + +#ifdef __cplusplus +} +#endif + +#endif /* _WINBASE_UNDOC_H */ diff --git a/win32ss/pch.h b/win32ss/pch.h index 203f4853582..935dc6d62b6 100644 --- a/win32ss/pch.h +++ b/win32ss/pch.h @@ -35,9 +35,10 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #define MAKEINTATOM(i) (LPWSTR)((ULONG_PTR)((WORD)(i))) #define WINBASEAPI -#define STARTF_USESHOWWINDOW 1 -#define STARTF_USESIZE 2 -#define STARTF_USEPOSITION 4 +#define STARTF_USESHOWWINDOW 0x00000001 +#define STARTF_USESIZE 0x00000002 +#define STARTF_USEPOSITION 0x00000004 +#define STARTF_USEHOTKEY 0x00000200 #include // Needed because windef.h messes up CDECL for whatever diff --git a/win32ss/user/ntuser/main.c b/win32ss/user/ntuser/main.c index 675008be13a..8a1843b1ecc 100644 --- a/win32ss/user/ntuser/main.c +++ b/win32ss/user/ntuser/main.c @@ -8,18 +8,12 @@ #include #include +#include #define NDEBUG #include #include -#ifndef STARTF_USEHOTKEY -#define STARTF_USEHOTKEY 0x0200 -#endif -#ifndef STARTF_SHELLPRIVATE -#define STARTF_SHELLPRIVATE 0x0400 -#endif - HANDLE hModuleWin; NTSTATUS ExitProcessCallback(PEPROCESS Process);