https://git.reactos.org/?p=reactos.git;a=commitdiff;h=99efc2ae50fef55c182c5…
commit 99efc2ae50fef55c182c5576937ee99e6b926b3e
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Nov 23 15:56:42 2023 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Nov 23 16:26:30 2023 +0100
[PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes.
- windows.h:
* should define _WINDOWS_ and _INC_WINDOWS instead of _WINDOWS_H
* include winresrc.h if RC_INVOKED and not NOWINRES (Wine also agrees
with that)
* also, some .h included from there should _not_ be included if their
respective NO*** flags are defined.
- batclass.h: Use correct _WINDOWS_ guard.
- winsnmp.h:
* should define _INC_WINSNMP instead of _WINSNMP_H
* use _INC_WINDOWS instead of _WINDOWS_H
- afd.h, vgaddi.h: Use the correct guards.
- winnt.rh: Define the (SUB)LANG_* exactly as they are in the winnt.h,
otherwise we get macro redefinition compile errors.
NOTE: Ideally these .rh files should be auto-generated from their
corresponding .h files.
- afxres.h: Do not include the whole windows.h, but instead, only
the winres.h file, and only if RC_INVOKED is defined.
NOTE: Both afxres.h and winres.h do not really belong to the PSDK,
but belong instead to MFC. The reason why we have them here is twofold:
1. Wine used to have also winres.h (from where we got ours). This is
because the .rc resource files of some non-MFC modules were generated
with Visual Studio, which always includes afxres.h for these, and the
solution was to use a slightly less MFC-specific header: winres.h
(Wine commit cb08c82244673f26842e7a0766de90f091b5a493).
However, this winres.h has been since removed from Wine tree
(Wine commit 197f4059ab2af5f13f9c56faa26e3b4af902f869).
2. Few of our modules either use afxres.h or winres.h in their resource
files, and we still want to be able to compile them.
---
drivers/network/afd/include/afd.h | 1 -
sdk/include/psdk/afxres.h | 7 ++++--
sdk/include/psdk/batclass.h | 4 ++--
sdk/include/psdk/windows.h | 45 +++++++++++++++++++++++++++++++----
sdk/include/psdk/winnt.rh | 32 ++++++++++++-------------
sdk/include/psdk/winsnmp.h | 9 +++----
win32ss/drivers/displays/vga/vgaddi.h | 2 +-
7 files changed, 70 insertions(+), 30 deletions(-)
diff --git a/drivers/network/afd/include/afd.h b/drivers/network/afd/include/afd.h
index 2ddfcf4ad2d..df6ebdc7bae 100644
--- a/drivers/network/afd/include/afd.h
+++ b/drivers/network/afd/include/afd.h
@@ -16,7 +16,6 @@
#include <tdi.h>
#include <tcpioctl.h>
#define _WINBASE_
-#define _WINDOWS_H
#define _INC_WINDOWS
#include <windef.h>
#include <winsock2.h>
diff --git a/sdk/include/psdk/afxres.h b/sdk/include/psdk/afxres.h
index 717e10d2b6f..cc87b2ac223 100644
--- a/sdk/include/psdk/afxres.h
+++ b/sdk/include/psdk/afxres.h
@@ -5,8 +5,11 @@
extern "C" {
#endif
-#ifndef _WINDOWS_H
-#include <windows.h>
+#ifdef RC_INVOKED
+#ifndef _INC_WINDOWS
+#define _INC_WINDOWS
+ #include "winres.h"
+#endif
#endif
/* IDC_STATIC is documented in winuser.h, but not defined. */
diff --git a/sdk/include/psdk/batclass.h b/sdk/include/psdk/batclass.h
index f97140d9b05..584f041937c 100644
--- a/sdk/include/psdk/batclass.h
+++ b/sdk/include/psdk/batclass.h
@@ -157,7 +157,7 @@ typedef struct _BATTERY_STATUS {
LONG Rate;
} BATTERY_STATUS, *PBATTERY_STATUS;
-#ifndef _WINDOWS_H
+#ifndef _WINDOWS_
/* BATTERY_MINIPORT_INFO.XxxVersion */
#define BATTERY_CLASS_MAJOR_VERSION 0x0001
@@ -388,7 +388,7 @@ NTAPI
BatteryClassUnload(
_In_ PVOID ClassData);
-#endif /* _WINDOWS_H */
+#endif /* _WINDOWS_ */
#endif /* _BATCLASS_ */
diff --git a/sdk/include/psdk/windows.h b/sdk/include/psdk/windows.h
index 347b164c33d..af8f33410c1 100644
--- a/sdk/include/psdk/windows.h
+++ b/sdk/include/psdk/windows.h
@@ -10,8 +10,12 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifndef _WINDOWS_H
-#define _WINDOWS_H
+
+#ifndef _WINDOWS_
+#define _WINDOWS_
+
+#ifndef _INC_WINDOWS
+#define _INC_WINDOWS
#ifdef __GNUC__
#include <msvctarget.h>
@@ -44,11 +48,33 @@
#endif
-#ifdef RC_INVOKED
+#if defined(RC_INVOKED) && !defined(NOWINRES)
/* winresrc.h includes the necessary headers */
#include <winresrc.h>
+
#else
+#ifdef RC_INVOKED
+/* Turn off some modules to ensure RC files compile OK */
+#define NOATOM
+#define NOGDI
+#define NOGDICAPMASKS
+#define NOMETAFILE
+#define NOMINMAX
+#define NOMSG
+#define NOOPENFILE
+#define NORASTEROPS
+#define NOSCROLL
+#define NOSOUND
+#define NOSYSMETRICS
+#define NOTEXTMETRIC
+#define NOWH
+#define NOCOMM
+#define NOKANJI
+#define NOCRYPT
+#define NOMCX
+#endif /* RC_INVOKED */
+
#include <excpt.h>
#include <stdarg.h>
#include <windef.h>
@@ -60,29 +86,39 @@
#include <winver.h>
#include <winnetwk.h>
#include <winreg.h>
+
+#ifndef NOSERVICE
#include <winsvc.h>
+#endif
#ifndef WIN32_LEAN_AND_MEAN
#include <cderr.h>
#include <dde.h>
#include <ddeml.h>
#include <dlgs.h>
+
+#ifndef NOIME
#include <imm.h>
+#endif
+
#include <lzexpand.h>
#include <mmsystem.h>
#include <nb30.h>
#include <rpc.h>
#include <shellapi.h>
#include <winperf.h>
+
#ifndef NOCRYPT
#include <wincrypt.h>
#include <winefs.h>
#include <winscard.h>
#endif
+
#ifndef NOGDI
#include <commdlg.h>
#include <winspool.h>
#endif
+
#if defined(Win32_Winsock)
#warning "The Win32_Winsock macro name is deprecated.\
Please use __USE_W32_SOCKETS instead"
@@ -122,4 +158,5 @@
#undef BOOL
#endif
-#endif
+#endif /* _INC_WINDOWS */
+#endif /* _WINDOWS_ */
diff --git a/sdk/include/psdk/winnt.rh b/sdk/include/psdk/winnt.rh
index 38cefd61c53..40452071ba9 100644
--- a/sdk/include/psdk/winnt.rh
+++ b/sdk/include/psdk/winnt.rh
@@ -47,7 +47,7 @@
#define LANG_ARMENIAN 0x2b
#define LANG_ASSAMESE 0x4d
#define LANG_AZERBAIJANI 0x2c
-#define LANG_AZERI LANG_AZERBAIJANI
+#define LANG_AZERI 0x2c // LANG_AZERBAIJANI
#define LANG_BANGLA 0x45
#define LANG_BASHKIR 0x6d
#define LANG_BASQUE 0x2d
@@ -61,7 +61,7 @@
#define LANG_CENTRAL_KURDISH 0x92
#define LANG_CHEROKEE 0x5c
#define LANG_CHINESE 0x04
-#define LANG_CHINESE_SIMPLIFIED 0x0004
+#define LANG_CHINESE_SIMPLIFIED 0x04
#define LANG_CHINESE_TRADITIONAL 0x7c04
#define LANG_CORSICAN 0x83
#define LANG_CROATIAN 0x1a
@@ -73,7 +73,7 @@
#define LANG_ENGLISH 0x09
#define LANG_ESTONIAN 0x25
#define LANG_FAEROESE 0x38
-#define LANG_FARSI LANG_PERSIAN
+#define LANG_FARSI 0x29 // LANG_PERSIAN
#define LANG_FILIPINO 0x64
#define LANG_FINNISH 0x0b
#define LANG_FRENCH 0x0c
@@ -125,12 +125,12 @@
#define LANG_NORWEGIAN 0x14
#define LANG_OCCITAN 0x82
#define LANG_ODIA 0x48
-#define LANG_ORIYA LANG_ODIA
+#define LANG_ORIYA 0x48 // LANG_ODIA
#define LANG_PASHTO 0x63
#define LANG_PERSIAN 0x29
#define LANG_POLISH 0x15
#define LANG_PORTUGUESE 0x16
-#define LANG_PULAR LANG_FULAH
+#define LANG_PULAR 0x67 // LANG_FULAH
#define LANG_PUNJABI 0x46
#define LANG_QUECHUA 0x6b
#define LANG_ROMANIAN 0x18
@@ -159,7 +159,7 @@
#define LANG_THAI 0x1e
#define LANG_TIBETAN 0x51
#define LANG_TIGRINYA 0x73
-#define LANG_TIGRIGNA LANG_TIGRINYA
+#define LANG_TIGRIGNA 0x73 // LANG_TIGRINYA
#define LANG_TSWANA 0x32
#define LANG_TURKISH 0x1f
#define LANG_TURKMEN 0x42
@@ -168,12 +168,12 @@
#define LANG_UPPER_SORBIAN 0x2e
#define LANG_URDU 0x20
#define LANG_UZBEK 0x43
-#define LANG_VALENCIAN LANG_CATALAN
+#define LANG_VALENCIAN 0x03 // LANG_CATALAN
#define LANG_VIETNAMESE 0x2a
#define LANG_WELSH 0x52
#define LANG_WOLOF 0x88
#define LANG_XHOSA 0x34
-#define LANG_YAKUT LANG_SAKHA
+#define LANG_YAKUT 0x85 // LANG_SAKHA
#define LANG_YI 0x78
#define LANG_YORUBA 0x6a
#define LANG_ZULU 0x35
@@ -210,8 +210,8 @@
#define SUBLANG_ASSAMESE_INDIA 0x01
#define SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN 0x01
#define SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC 0x02
-#define SUBLANG_AZERI_LATIN SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN
-#define SUBLANG_AZERI_CYRILLIC SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC
+#define SUBLANG_AZERI_LATIN 0x01 // SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN
+#define SUBLANG_AZERI_CYRILLIC 0x02 //
SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC
#define SUBLANG_BANGLA_BANGLADESH 0x02
#define SUBLANG_BANGLA_INDIA 0x01
#define SUBLANG_BASHKIR_RUSSIA 0x01
@@ -298,7 +298,7 @@
#define SUBLANG_KAZAK_KAZAKHSTAN 0x01
#define SUBLANG_KHMER_CAMBODIA 0x01
#define SUBLANG_KICHE_GUATEMALA 0x01
-#define SUBLANG_KINYARWANDA_RWANDA 0X01
+#define SUBLANG_KINYARWANDA_RWANDA 0x01
#define SUBLANG_KONKANI_INDIA 0x01
#define SUBLANG_KOREAN 0x01
#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
@@ -324,13 +324,13 @@
#define SUBLANG_NORWEGIAN_NYNORSK 0x02
#define SUBLANG_OCCITAN_FRANCE 0x01
#define SUBLANG_ODIA_INDIA 0x01
-#define SUBLANG_ORIYA_INDIA SUBLANG_ODIA_INDIA
+#define SUBLANG_ORIYA_INDIA 0x01 // SUBLANG_ODIA_INDIA
#define SUBLANG_PASHTO_AFGHANISTAN 0x01
#define SUBLANG_PERSIAN_IRAN 0x01
#define SUBLANG_POLISH_POLAND 0x01
#define SUBLANG_PORTUGUESE 0x02
#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
-#define SUBLANG_PULAR_SENEGAL SUBLANG_FULAH_SENEGAL
+#define SUBLANG_PULAR_SENEGAL 0x02 // SUBLANG_FULAH_SENEGAL
#define SUBLANG_PUNJABI_INDIA 0x01
#define SUBLANG_PUNJABI_PAKISTAN 0x02
#define SUBLANG_QUECHUA_BOLIVIA 0x01
@@ -362,7 +362,7 @@
#define SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC 0x0c
#define SUBLANG_SINDHI_INDIA 0x01
#define SUBLANG_SINDHI_AFGHANISTAN 0x02
-#define SUBLANG_SINDHI_PAKISTAN SUBLANG_SINDHI_AFGHANISTAN
+#define SUBLANG_SINDHI_PAKISTAN 0x02 // SUBLANG_SINDHI_AFGHANISTAN
#define SUBLANG_SINHALESE_SRI_LANKA 0x01
#define SUBLANG_SLOVAK_SLOVAKIA 0x01
#define SUBLANG_SLOVENIAN_SLOVENIA 0x01
@@ -404,7 +404,7 @@
#define SUBLANG_TIBETAN_BHUTAN 0x02
#define SUBLANG_TIGRINYA_ERITREA 0x02
#define SUBLANG_TIGRINYA_ETHIOPIA 0x01
-#define SUBLANG_TIGRIGNA_ERITREA SUBLANG_TIGRINYA_ERITREA
+#define SUBLANG_TIGRIGNA_ERITREA 0x02 // SUBLANG_TIGRINYA_ERITREA
#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
#define SUBLANG_TSWANA_BOTSWANA 0x02
#define SUBLANG_TURKISH_TURKEY 0x01
@@ -421,7 +421,7 @@
#define SUBLANG_WELSH_UNITED_KINGDOM 0x01
#define SUBLANG_WOLOF_SENEGAL 0x01
#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
-#define SUBLANG_YAKUT_RUSSIA SUBLANG_SAKHA_RUSSIA
+#define SUBLANG_YAKUT_RUSSIA 0x01 // SUBLANG_SAKHA_RUSSIA
#define SUBLANG_YI_PRC 0x01
#define SUBLANG_YORUBA_NIGERIA 0x01
#define SUBLANG_ZULU_SOUTH_AFRICA 0x01
diff --git a/sdk/include/psdk/winsnmp.h b/sdk/include/psdk/winsnmp.h
index b61cddef057..08b97ee809c 100644
--- a/sdk/include/psdk/winsnmp.h
+++ b/sdk/include/psdk/winsnmp.h
@@ -21,10 +21,10 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifndef _WINSNMP_H
-#define _WINSNMP_H
+#ifndef _INC_WINSNMP
+#define _INC_WINSNMP
-#ifndef _WINDOWS_H
+#ifndef _INC_WINDOWS
#include <windows.h>
#endif
@@ -323,4 +323,5 @@ SNMPAPI_STATUS WINSNMPAPI
SnmpPasswordToKey(smiLPOCTETS,smiINT32,smiLPOCTETS);
}
#endif
#include <poppack.h>
-#endif
+
+#endif /* _INC_WINSNMP */
diff --git a/win32ss/drivers/displays/vga/vgaddi.h
b/win32ss/drivers/displays/vga/vgaddi.h
index e2b4ef46342..ef7e043268d 100644
--- a/win32ss/drivers/displays/vga/vgaddi.h
+++ b/win32ss/drivers/displays/vga/vgaddi.h
@@ -2,7 +2,7 @@
#define _VGADDI_PCH_
#define _WINBASE_
-#define _WINDOWS_H
+#define _INC_WINDOWS
#include <stdarg.h>
#include <windef.h>
#include <wingdi.h>