Subject: Re: How to detect win9 vs NT?
From: [email-masked] (Geoffrey Noer)

18 Aug 1998 23:21:29 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: [email-masked]
Cc: [email-masked]

On Sun, Aug 16, 1998 at 11:22:53AM -0400, [email-masked] wrote:
>
> Are we going to assume that things should run correctly only on the
> type of system they were built on?  I suppose there are things which
> might be fixed to facilitate builds, but I thought that cpu_time()
> and clock() should check at run time the first time they are called
> to see which system is running.

Yes, runtime is the way to go for this sort of thing.  The
development version of Cygwin32 checks the type of OS running when the
DLL loads.  It stores the result in a global variable that is
consulted whenever a runtime choice needs to be made.  Appended is the
code that does this (from winsup/dcrt0.cc in the development
snapshots).

-- 
Geoffrey Noer
[email-masked]

-------------------------- snip ------------------------------

enum os_type {winNT, win95, win98, win32s, unknown};

/* remember the type of Win32 OS being run for future use. */
os_type NO_COPY os_being_run;

/* set_os_type: Set global variable os_being_run with type of Win32
   operating system being run.  This information is used internally
   to manage the inconsistency in Win32 API calls between Win32
   OSes. */
/* Cygwin32 internal */
static
void
set_os_type ()
{
  OSVERSIONINFO os_version_info;
  os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

  GetVersionEx (&os_version_info);

  switch (os_version_info.dwPlatformId)
    {
      case VER_PLATFORM_WIN32_NT:
        os_being_run = winNT;
        break;
      case VER_PLATFORM_WIN32_WINDOWS:
        if (os_version_info.dwMinorVersion == 0)
          os_being_run = win95;
        else /* os_version_info.dwMinorVersion == 10 */
          os_being_run = win98;
        break;
      case VER_PLATFORM_WIN32s:
        os_being_run = win32s;
        break;
      default:
        os_being_run = unknown;
        break;
    }
}
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".