From 5517e09c9d25f01cbf49e13f117381df5e698012 Mon Sep 17 00:00:00 2001
From: Konstantin Shabanov <mail@etehtsea.me>
Date: Tue, 11 May 2021 18:29:06 +0700
Subject: [PATCH 2/3] Rename OS_9X to OS_WIN95ORGREATER

Unify with the current mingw64-headers
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/dc7ef298837d4581200a3bed660aed36818c1b00/
---
 src/dynlib.c    |  2 +-
 src/w32.c       |  4 ++--
 src/w32common.h |  2 +-
 src/w32fns.c    | 10 +++++-----
 src/w32heap.c   |  4 ++--
 src/w32notify.c |  2 +-
 src/w32proc.c   |  8 ++++----
 src/w32term.c   |  4 ++--
 src/w32term.h   |  2 +-
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/dynlib.c b/src/dynlib.c
index 1338e9109c..2d263fb3ec 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -133,11 +133,11 @@ dynlib_addr (void (*funcptr) (void), const char **fname, const char **symname)
   wchar_t mfn_w[MAX_PATH];
   char mfn_a[MAX_PATH];
   void *addr = (void *) funcptr;
 
   /* Step 1: Find the handle of the module where ADDR lives.  */
-  if (os_subtype == OS_9X
+  if (os_subtype == OS_WIN95ORGREATER
       /* Windows NT family version before XP (v5.1).  */
       || ((w32_major_version + (w32_minor_version > 0)) < 6))
     {
       MEMORY_BASIC_INFORMATION mbi;
 
diff --git a/src/w32.c b/src/w32.c
index 467e6cb427..635c882431 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4745,11 +4745,11 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force)
   strcpy (temp, map_w32_filename (oldname, NULL));
 
   /* volume_info is set indirectly by map_w32_filename.  */
   oldname_dev = volume_info.serialnum;
 
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_WIN95ORGREATER)
     {
       char * o;
       char * p;
       int    i = 0;
       char oldname_a[MAX_PATH];
@@ -10466,11 +10466,11 @@ shutdown_handler (DWORD type)
 /* On Windows 9X, load UNICOWS.DLL and return its handle, or die.  On
    NT, return a handle to GDI32.DLL.  */
 HANDLE
 maybe_load_unicows_dll (void)
 {
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_WIN95ORGREATER)
     {
       HANDLE ret = LoadLibrary ("Unicows.dll");
       if (ret)
 	{
 	  /* These two functions are present on Windows 9X as stubs
diff --git a/src/w32common.h b/src/w32common.h
index cbe05c5d8d..53b3376f7c 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -39,11 +39,11 @@ #define get_w32_minor_version()  	w32_minor_version
 extern int    	      w32_major_version;
 extern int    	      w32_minor_version;
 extern int    	      w32_build_number;
 
 enum {
-  OS_9X = 1,
+  OS_WIN95ORGREATER = 1,
   OS_NT
 };
 
 extern int os_subtype;
 
diff --git a/src/w32fns.c b/src/w32fns.c
index 43bee6147b..02edd8929f 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7989,11 +7989,11 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
 
       path = map_w32_filename (SSDATA (encoded_file), NULL);
 
       /* The Unicode version of SHFileOperation is not supported on
 	 Windows 9X. */
-      if (w32_unicode_filenames && os_subtype != OS_9X)
+      if (w32_unicode_filenames && os_subtype != OS_WIN95ORGREATER)
 	{
 	  SHFILEOPSTRUCTW file_op_w;
 	  /* We need one more element beyond MAX_PATH because this is
 	     a list of file names, with the last element double-null
 	     terminated. */
@@ -9293,21 +9293,21 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
   strtok (pname_buf, ",");
   /* We want to know more than the printer name */
   if (!OpenPrinter (pname_buf, &hPrn, NULL))
     return Qnil;
   /* GetPrinterW is not supported by unicows.dll.  */
-  if (w32_unicode_filenames && os_subtype != OS_9X)
+  if (w32_unicode_filenames && os_subtype != OS_WIN95ORGREATER)
     GetPrinterW (hPrn, 2, NULL, 0, &dwNeeded);
   else
     GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded);
   if (dwNeeded == 0)
     {
       ClosePrinter (hPrn);
       return Qnil;
     }
   /* Call GetPrinter again with big enough memory block.  */
-  if (w32_unicode_filenames && os_subtype != OS_9X)
+  if (w32_unicode_filenames && os_subtype != OS_WIN95ORGREATER)
     {
       /* Allocate memory for the PRINTER_INFO_2 struct.  */
       ppi2w = xmalloc (dwNeeded);
       err = GetPrinterW (hPrn, 2, (LPBYTE)ppi2w, dwNeeded, &dwReturned);
       ClosePrinter (hPrn);
@@ -9439,11 +9439,11 @@ cache_system_info (void)
   version.data = GetVersion ();
   w32_major_version = version.info.major;
   w32_minor_version = version.info.minor;
 
   if (version.info.platform & 0x8000)
-    os_subtype = OS_9X;
+    os_subtype = OS_WIN95ORGREATER;
   else
     os_subtype = OS_NT;
 
   /* Cache page size, allocation unit, processor type, etc.  */
   GetSystemInfo (&sysinfo_cache);
@@ -9452,11 +9452,11 @@ cache_system_info (void)
   /* Cache os info.  */
   osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
   GetVersionEx (&osinfo_cache);
 
   w32_build_number = osinfo_cache.dwBuildNumber;
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_WIN95ORGREATER)
     w32_build_number &= 0xffff;
 
   w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
 }
 
diff --git a/src/w32heap.c b/src/w32heap.c
index e002f72608..c4cbcd14f8 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -267,11 +267,11 @@ init_heap (bool use_dynamic_heap)
 	    DebPrint (("Enabling Low Fragmentation Heap failed: error %ld\n",
 		       GetLastError ()));
 	}
 #endif
 
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_WIN95ORGREATER)
         {
           the_malloc_fn = malloc_after_dump_9x;
           the_realloc_fn = realloc_after_dump_9x;
           the_free_fn = free_after_dump_9x;
         }
@@ -310,11 +310,11 @@ init_heap (bool use_dynamic_heap)
 	  fprintf (stderr, "Cannot build Emacs without RtlCreateHeap being available; exiting.\n");
 	  exit (-1);
 	}
       heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params);
 
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_WIN95ORGREATER)
         {
           fprintf (stderr, "Cannot dump Emacs on Windows 9X; exiting.\n");
           exit (-1);
         }
       else
diff --git a/src/w32notify.c b/src/w32notify.c
index b9e9063392..a525979cd8 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -564,11 +564,11 @@ DEFUN ("w32notify-add-watch", Fw32notify_add_watch,
   char *errstr;
 
   CHECK_LIST (filter);
 
   /* The underlying features are available only since XP.  */
-  if (os_subtype == OS_9X
+  if (os_subtype == OS_WIN95ORGREATER
       || (w32_major_version == 5 && w32_minor_version < 1))
     {
       errno = ENOSYS;
       report_file_notify_error ("Watching filesystem events is not supported",
 				Qnil);
diff --git a/src/w32proc.c b/src/w32proc.c
index ffa56e135d..082dd61f76 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -621,11 +621,11 @@ init_timers (void)
 {
   /* GetThreadTimes is not available on all versions of Windows, so
      need to probe for its availability dynamically, and call it
      through a pointer.  */
   s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */
-  if (os_subtype != OS_9X)
+  if (os_subtype != OS_WIN95ORGREATER)
     s_pfn_Get_Thread_Times = (GetThreadTimes_Proc)
       get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes");
 
   /* Make sure we start with zeroed out itimer structures, since
      dumping may have left there traces of threads long dead.  */
@@ -2652,11 +2652,11 @@ find_child_console (HWND hwnd, LPARAM arg)
     {
       char window_class[32];
 
       GetClassName (hwnd, window_class, sizeof (window_class));
       if (strcmp (window_class,
-		  (os_subtype == OS_9X)
+		  (os_subtype == OS_WIN95ORGREATER)
 		  ? "tty"
 		  : "ConsoleWindowClass") == 0)
 	{
 	  cp->hwnd = hwnd;
 	  return FALSE;
@@ -2876,11 +2876,11 @@ sys_kill (pid_t pid, int sig)
   else
     {
       if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
 	{
 #if 1
-	  if (os_subtype == OS_9X)
+	  if (os_subtype == OS_WIN95ORGREATER)
 	    {
 /*
    Another possibility is to try terminating the VDM out-right by
    calling the Shell VxD (id 0x17) V86 interface, function #4
    "SHELL_Destroy_VM", ie.
@@ -3791,11 +3791,11 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
 	  || strcmp (locname, "POSIX") == 0))
     return (ignore_case ? stricmp (s1, s2) : strcmp (s1, s2));
 
   if (!g_b_init_compare_string_w)
     {
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_WIN95ORGREATER)
 	{
 	  pCompareStringW = (CompareStringW_Proc)
             get_proc_addr (LoadLibrary ("Unicows.dll"),
                                   "CompareStringW");
 	  if (!pCompareStringW)
diff --git a/src/w32term.c b/src/w32term.c
index 4f910296ec..e13b402f75 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -7636,11 +7636,11 @@ syms_of_w32term (void)
 specified by `file-name-coding-system'.
 
 This variable is set to non-nil by default when Emacs runs on Windows
 systems of the NT family, including W2K, XP, Vista, Windows 7 and
 Windows 8.  It is set to nil on Windows 9X.  */);
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_WIN95ORGREATER)
     w32_unicode_filenames = 0;
   else
     w32_unicode_filenames = 1;
 
   DEFVAR_BOOL ("w32-use-native-image-API",
@@ -7653,11 +7653,11 @@ syms_of_w32term (void)
 library is available only since W2K, therefore this variable is
 unconditionally set to nil on older systems.  */);
 
   /* For now, disabled by default, since this is an experimental feature.  */
 #if 0 && HAVE_NATIVE_IMAGE_API
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_WIN95ORGREATER)
     w32_use_native_image_api = 0;
   else
     w32_use_native_image_api = 1;
 #else
   w32_use_native_image_api = 0;
diff --git a/src/w32term.h b/src/w32term.h
index 7d351df871..c38a5bf486 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -759,11 +759,11 @@ #define FILE_NOTIFICATIONS_SIZE 16384
 #ifdef WINDOWSNT
 /* Keyboard hooks.  */
 extern void setup_w32_kbdhook (void);
 extern void remove_w32_kbdhook (void);
 extern int check_w32_winkey_state (int);
-#define w32_kbdhook_active (os_subtype != OS_9X)
+#define w32_kbdhook_active (os_subtype != OS_WIN95ORGREATER)
 #else
 #define w32_kbdhook_active 0
 #endif
 
 /* Keypad command key support.  W32 doesn't have virtual keys defined
-- 
2.31.1

