Throughout, change check for running under Windows NT to 'iswinnt'.

* dcrt0.cc (set_os_type): Set 'iswinnt' appropriately.
* cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating cygheap.
(cygheap_setup_for_child_cleanup): New function.  Standard function to call
after calling CreateProcess to cleanup cygheap info passed to child.
(cygheap_fixup_in_child): Copy cygheap from shared memory into allocated space
under Windows 9x or if can't relocate shared space under NT.
* cygheap.h: Declare new function.
* spawn.cc (spawn_guts): Use cygheap_fixup_in_child.
* fork.cc (fork_parent): Ditto.
* winsup.h: Declare iswinnt.
This commit is contained in:
Christopher Faylor 2001-08-04 21:10:52 +00:00
parent 17195d08bc
commit e5ba4c060e
27 changed files with 105 additions and 76 deletions

View File

@ -1,3 +1,20 @@
Sat Aug 4 16:52:03 2001 Christopher Faylor <cgf@cygnus.com>
Throughout, change check for running under Windows NT to 'iswinnt'.
* dcrt0.cc (set_os_type): Set 'iswinnt' appropriately.
* cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating
cygheap.
(cygheap_setup_for_child_cleanup): New function. Standard function to
call after calling CreateProcess to cleanup cygheap info passed to
child.
(cygheap_fixup_in_child): Copy cygheap from shared memory into
allocated space under Windows 9x or if can't relocate shared space
under NT.
* cygheap.h: Declare new function.
* spawn.cc (spawn_guts): Use cygheap_fixup_in_child.
* fork.cc (fork_parent): Ditto.
* winsup.h: Declare iswinnt.
2001-08-04 Egor Duda <deo@logos-m.ru>
* dtable.cc (dtable::release): Avoid messing with console when

View File

@ -41,6 +41,9 @@ char *buckets[NBUCKETS] = {0};
#define N0 ((_cmalloc_entry *) NULL)
#define to_cmalloc(s) ((_cmalloc_entry *) (((char *) (s)) - (int) (N0->data)))
#define CFMAP_OPTIONS (SEC_RESERVE | PAGE_READWRITE)
#define MVMAP_OPTIONS (FILE_MAP_WRITE)
extern "C" {
static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
}
@ -48,17 +51,10 @@ static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
inline static void
init_cheap ()
{
HANDLE cygheap_h;
cygheap_h = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_none_nih,
PAGE_READWRITE | SEC_RESERVE, 0, CYGHEAPSIZE,
NULL);
cygheap = (init_cygheap *) MapViewOfFileEx (cygheap_h,
FILE_MAP_READ | FILE_MAP_WRITE,
0, 0, 0, NULL);
CloseHandle (cygheap_h);
cygheap = (init_cygheap *) VirtualAlloc (NULL, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
if (!cygheap)
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
cygheap_max = cygheap + 1;
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
cygheap_max = cygheap + 1;
}
void __stdcall
@ -68,10 +64,8 @@ cygheap_setup_for_child (child_info *ci)
cygheap_protect->acquire ();
unsigned n = (char *) cygheap_max - (char *) cygheap;
ci->cygheap_h = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_none,
PAGE_READWRITE | SEC_RESERVE, 0,
CYGHEAPSIZE, NULL);
newcygheap = MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
0, 0, 0, NULL);
CFMAP_OPTIONS, 0, CYGHEAPSIZE, NULL);
newcygheap = MapViewOfFileEx (ci->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL);
if (!VirtualAlloc (newcygheap, n, MEM_COMMIT, PAGE_READWRITE))
api_fatal ("couldn't allocate new cygwin heap for child, %E");
memcpy (newcygheap, cygheap, n);
@ -83,26 +77,38 @@ cygheap_setup_for_child (child_info *ci)
return;
}
void __stdcall
cygheap_setup_for_child_cleanup (child_info *ci)
{
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
}
/* Called by fork or spawn to reallocate cygwin heap */
void __stdcall
cygheap_fixup_in_child (child_info *ci, bool execed)
{
cygheap = ci->cygheap;
cygheap_max = ci->cygheap_max;
#if 0
if (!DuplicateHandle (hMainProc, ci->cygheap_h,
hMainProc, &cygheap_h, 0, 0,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
cygheap_h = ci->cygheap_h;
#endif
VirtualFree (cygheap, CYGHEAPSIZE, MEM_DECOMMIT);
VirtualFree (cygheap, 0, MEM_RELEASE);
if (MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
0, 0, CYGHEAPSIZE, cygheap) != cygheap)
api_fatal ("Couldn't allocate space for child's cygwin heap from %p, to %p, %E",
cygheap, cygheap_max);
void *addr = iswinnt ? cygheap : NULL;
void *newaddr;
newaddr = MapViewOfFileEx (ci->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, addr);
if (!iswinnt || newaddr != addr)
{
DWORD n = (DWORD) cygheap_max - (DWORD) cygheap;
/* Reserve cygwin heap in same spot as parent */
if (!VirtualAlloc (cygheap, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS))
api_fatal ("Couldn't reserve space for cygwin's heap (%p) in child, cygheap, %E", cygheap);
/* Allocate same amount of memory as parent */
if (!VirtualAlloc (cygheap, n, MEM_COMMIT, PAGE_READWRITE))
api_fatal ("Couldn't allocate space for child's heap %p, size %d, %E",
cygheap, n);
memcpy (cygheap, newaddr, n);
UnmapViewOfFile (newaddr);
}
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
cygheap_init ();
if (execed)

View File

@ -168,6 +168,7 @@ extern void *cygheap_max;
class child_info;
void __stdcall cygheap_setup_for_child (child_info *ci) __attribute__ ((regparm(1)));
void __stdcall cygheap_setup_for_child_cleanup (child_info *ci) __attribute__ ((regparm(1)));
void __stdcall cygheap_fixup_in_child (child_info *, bool);
extern "C" {
void __stdcall cfree (void *) __attribute__ ((regparm(1)));

View File

@ -156,6 +156,7 @@ do_global_ctors (void (**in_pfunc)(), int force)
/* remember the type of Win32 OS being run for future use. */
os_type NO_COPY os_being_run;
char NO_COPY osname[40];
bool iswinnt;
/* set_os_type: Set global variable os_being_run with type of Win32
operating system being run. This information is used internally
@ -171,11 +172,13 @@ set_os_type ()
os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
GetVersionEx (&os_version_info);
iswinnt = 0;
switch (os_version_info.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
os_being_run = winNT;
os = "NT";
iswinnt = 1;
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (os_version_info.dwMinorVersion == 0)
@ -539,7 +542,7 @@ static NO_COPY STARTUPINFO si;
child_info_fork NO_COPY *child_proc_info = NULL;
static MEMORY_BASIC_INFORMATION sm;
#define CYGWIN_GUARD ((os_being_run == winNT) ? PAGE_GUARD : PAGE_NOACCESS)
#define CYGWIN_GUARD ((iswinnt) ? PAGE_GUARD : PAGE_NOACCESS)
// __inline__ void
extern void

View File

@ -87,7 +87,7 @@ delqueue_list::process_queue ()
int res = GetLastError ();
empty = 0;
if (res == ERROR_SHARING_VIOLATION ||
(os_being_run != winNT && res == ERROR_ACCESS_DENIED))
(!iswinnt && res == ERROR_ACCESS_DENIED))
{
/* File still inuse, that's ok */
syscall_printf ("Still using %s", name[i]);

View File

@ -375,7 +375,7 @@ rmdir (const char *dir)
{
/* On 9X ERROR_ACCESS_DENIED is returned if you try to remove
a non-empty directory. */
if (os_being_run != winNT)
if (!iswinnt)
set_errno (ENOTEMPTY);
else
__seterrno ();

View File

@ -658,7 +658,7 @@ environ_init (char **envp, int envc)
#ifdef NTSEC_ON_BY_DEFAULT
/* Set ntsec explicit as default, if NT is running */
if (os_being_run == winNT)
if (iswinnt)
allow_ntsec = TRUE;
#endif

View File

@ -568,7 +568,7 @@ fhandler_base::write (const void *ptr, size_t len)
if (get_append_p ())
SetFilePointer (get_handle(), 0, 0, FILE_END);
else if (os_being_run != winNT && get_check_win95_lseek_bug ())
else if (!iswinnt && get_check_win95_lseek_bug ())
{
/* Note: this bug doesn't happen on NT4, even though the documentation
for WriteFile() says that it *may* happen on any OS. */
@ -1417,7 +1417,7 @@ fhandler_disk_file::lock (int cmd, struct flock *fl)
BOOL res;
if (os_being_run == winNT)
if (iswinnt)
{
DWORD lock_flags = (cmd == F_SETLK) ? LOCKFILE_FAIL_IMMEDIATELY : 0;
lock_flags |= (fl->l_type == F_WRLCK) ? LOCKFILE_EXCLUSIVE_LOCK : 0;

View File

@ -418,7 +418,7 @@ public:
/* This strange test is due to the fact that we can't rely on
Windows shells to "do the right thing" with pipes. Apparently
the can keep one end of the pipe open when it shouldn't be. */
BOOL is_slow () {return os_being_run == winNT;}
BOOL is_slow () {return iswinnt;}
select_record *select_read (select_record *s);
select_record *select_write (select_record *s);
select_record *select_except (select_record *s);

View File

@ -312,7 +312,7 @@ fhandler_console::read (void *pv, size_t buflen)
part is to distinguish whether the right Alt key should be
recognized as Alt, or as AltGr. */
bool meta;
if (os_being_run == winNT)
if (iswinnt)
/* WinNT: AltGr is reported as Ctrl+Alt, and Ctrl+Alt is
treated just like AltGr. However, if Ctrl+Alt+key generates
an ASCII control character, interpret is as META. */

View File

@ -91,7 +91,7 @@ fhandler_dev_floppy::lseek (off_t offset, int whence)
DWORD low;
LONG high = 0;
if (os_being_run == winNT)
if (iswinnt)
{
DISK_GEOMETRY di;
PARTITION_INFORMATION pi;

View File

@ -28,7 +28,7 @@ fhandler_dev_mem::fhandler_dev_mem (const char *name, int nunit)
unit (nunit)
{
/* Reading physical memory only supported on NT/W2K. */
if (os_being_run != winNT)
if (!iswinnt)
{
mem_size = 0;
return;
@ -74,7 +74,7 @@ fhandler_dev_mem::~fhandler_dev_mem (void)
int
fhandler_dev_mem::open (const char *, int flags, mode_t)
{
if (os_being_run != winNT)
if (!iswinnt)
{
set_errno (ENOENT);
debug_printf ("%s is accessible under NT/W2K only",
@ -413,7 +413,7 @@ fhandler_dev_mem::fstat (struct stat *buf)
memset (buf, 0, sizeof *buf);
buf->st_mode = S_IFCHR;
if (os_being_run != winNT)
if (!iswinnt)
buf->st_mode |= S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH;

View File

@ -116,7 +116,7 @@ fork_copy (PROCESS_INFORMATION &pi, const char *what, ...)
debug_printf ("done");
return 1;
err:
err:
TerminateProcess (pi.hProcess, 1);
set_errno (EAGAIN);
return 0;
@ -458,7 +458,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
npid = 0;
}
}
out:
out:
#endif
char sa_buf[1024];
@ -477,7 +477,7 @@ out:
&pi);
CloseHandle (hParent);
ForceCloseHandle1 (ch.cygheap_h, passed_cygheap_h);
cygheap_setup_for_child_cleanup (&ch);
if (!rc)
{
@ -607,7 +607,7 @@ out:
return forked->pid;
/* Common cleanup code for failure cases */
cleanup:
cleanup:
/* Remember to de-allocate the fd table. */
if (pi.hProcess)
ForceCloseHandle1 (pi.hProcess, childhProc);

View File

@ -83,7 +83,7 @@ class mmap_record
/* Allocate one bit per page */
map_map_ = (DWORD *) calloc (MAPSIZE(PAGE_CNT (size_to_map_)),
sizeof (DWORD));
if (os_being_run == winNT)
if (iswinnt)
{
DWORD old_prot;
if (!VirtualProtect (base_address_, size_to_map_,
@ -144,7 +144,7 @@ mmap_record::map_map (DWORD off, DWORD len)
off = find_empty (len);
if (off != (DWORD)-1)
{
if (os_being_run == winNT
if (iswinnt
&& !VirtualProtect (base_address_ + off * getpagesize (),
len * getpagesize (), prot, &old_prot))
syscall_printf ("-1 = map_map (): %E");
@ -157,7 +157,7 @@ mmap_record::map_map (DWORD off, DWORD len)
}
off -= offset_;
DWORD start = off / getpagesize ();
if (os_being_run == winNT
if (iswinnt
&& !VirtualProtect (base_address_ + start * getpagesize (),
len * getpagesize (), prot, &old_prot))
syscall_printf ("-1 = map_map (): %E");
@ -174,7 +174,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len)
DWORD off = addr - base_address_;
off /= getpagesize ();
len = PAGE_CNT (len);
if (os_being_run == winNT
if (iswinnt
&& !VirtualProtect (base_address_ + off * getpagesize (),
len * getpagesize (), PAGE_NOACCESS, &old_prot))
syscall_printf ("-1 = unmap_map (): %E");
@ -192,7 +192,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len)
void
mmap_record::fixup_map ()
{
if (os_being_run != winNT)
if (!iswinnt)
return;
DWORD prot, old_prot;
@ -426,7 +426,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
/* copy-on-write doesn't work correctly on 9x. To have at least read
access we use *READ mapping on 9x when appropriate. It will still
fail when needing write access, though. */
if ((flags & MAP_PRIVATE) && (os_being_run == winNT || (prot & ~PROT_READ)))
if ((flags & MAP_PRIVATE) && (iswinnt || (prot & ~PROT_READ)))
access = FILE_MAP_COPY;
SetResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
@ -437,7 +437,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
* CV: This assumption isn't correct. See Microsoft Platform SDK, Memory,
* description of call `MapViewOfFileEx'.
*/
if ((os_being_run != winNT) && (flags & MAP_FIXED))
if ((!iswinnt) && (flags & MAP_FIXED))
{
set_errno (EINVAL);
syscall_printf ("-1 = mmap(): win95 and MAP_FIXED");
@ -745,7 +745,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
/* On 9x/ME try first to open the mapping by name when opening a
shared file object. This is needed since 9x/ME only shares
objects between processes by name. What a mess... */
if (os_being_run != winNT
if (!iswinnt
&& get_handle () != INVALID_HANDLE_VALUE
&& get_device () == FH_DISK
&& !(access & FILE_MAP_COPY))

View File

@ -122,7 +122,7 @@ WSADATA wsadata;
static SOCKET __stdcall
set_socket_inheritance (SOCKET sock)
{
if (os_being_run == winNT)
if (iswinnt)
(void) SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
else
{
@ -1292,9 +1292,9 @@ getdomainname (char *domain, int len)
* Punt for now and assume MS-TCP on Win95.
*/
reg_key r (HKEY_LOCAL_MACHINE, KEY_READ,
(os_being_run != winNT) ? "System" : "SYSTEM",
(!iswinnt) ? "System" : "SYSTEM",
"CurrentControlSet", "Services",
(os_being_run != winNT) ? "MSTCP" : "Tcpip",
(!iswinnt) ? "MSTCP" : "Tcpip",
NULL);
/* FIXME: Are registry keys case sensitive? */

View File

@ -393,7 +393,7 @@ winpids::init (bool winpid)
DWORD
winpids::enum_init (bool winpid)
{
if (os_being_run == winNT)
if (iswinnt)
enum_processes = &winpids::enumNT;
else
enum_processes = &winpids::enum9x;

View File

@ -185,7 +185,7 @@ public:
extern __inline pid_t
cygwin_pid (pid_t pid)
{
return (pid_t) (os_being_run == winNT) ? pid : -(int) pid;
return (pid_t) (iswinnt) ? pid : -(int) pid;
}
void __stdcall pinfo_init (char **, int);

View File

@ -108,7 +108,7 @@ extern "C"
HANDLE
cygwin_logon_user (const struct passwd *pw, const char *password)
{
if (os_being_run != winNT)
if (!iswinnt)
{
set_errno (ENOSYS);
return INVALID_HANDLE_VALUE;
@ -1063,7 +1063,7 @@ static int
get_nt_attribute (const char *file, int *attribute,
uid_t *uidret, gid_t *gidret)
{
if (os_being_run != winNT)
if (!iswinnt)
return 0;
syscall_printf ("file: %s", file);
@ -1286,7 +1286,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
{
BOOL dummy;
if (os_being_run != winNT)
if (!iswinnt)
return NULL;
if (!sd_ret || !sd_size_ret)
@ -1557,7 +1557,7 @@ static int
set_nt_attribute (const char *file, uid_t uid, gid_t gid,
const char *logsrv, int attribute)
{
if (os_being_run != winNT)
if (!iswinnt)
return 0;
DWORD sd_size = 4096;

View File

@ -675,7 +675,7 @@ skip_arg_parsing:
MALLOC_CHECK;
if (envblock)
free (envblock);
ForceCloseHandle1 (ciresrv.cygheap_h, passed_cygheap_h);
cygheap_setup_for_child_cleanup (&ciresrv);
MALLOC_CHECK;
/* Set errno now so that debugging messages from it appear before our
@ -718,6 +718,7 @@ skip_arg_parsing:
strace.execing = 1;
hExeced = pi.hProcess;
strcpy (myself->progname, real_path);
close_all_files ();
}
else
{

View File

@ -134,7 +134,7 @@ _unlink (const char *ourname)
/* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing
violation. So, set lasterr to ERROR_SHARING_VIOLATION in this case
to simplify tests. */
if (os_being_run != winNT && lasterr == ERROR_ACCESS_DENIED
if (!iswinnt && lasterr == ERROR_ACCESS_DENIED
&& !win32_name.isremote ())
lasterr = ERROR_SHARING_VIOLATION;
@ -152,7 +152,7 @@ _unlink (const char *ourname)
bool delete_on_close_ok;
delete_on_close_ok = !win32_name.isremote () && os_being_run == winNT;
delete_on_close_ok = !win32_name.isremote () && iswinnt;
/* Attempt to use "delete on close" semantics to handle removing
a file which may be open. */
@ -590,7 +590,7 @@ _link (const char *a, const char *b)
}
/* Try to make hard link first on Windows NT */
if (os_being_run == winNT)
if (iswinnt)
{
HANDLE hFileSource;
@ -707,7 +707,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid)
if (check_null_empty_str_errno (name))
return -1;
if (os_being_run != winNT) // real chown only works on NT
if (!iswinnt) // real chown only works on NT
res = 0; // return zero (and do nothing) under Windows 9x
else
{
@ -1074,7 +1074,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
dtype = real_path.get_drive_type ();
if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) ||
(os_being_run == winNT
(iswinnt
&& dtype != DRIVE_NO_ROOT_DIR
&& dtype != DRIVE_UNKNOWN)))
{
@ -1338,7 +1338,7 @@ _rename (const char *oldpath, const char *newpath)
&& GetLastError () != ERROR_FILE_EXISTS))
goto done;
if (os_being_run == winNT)
if (iswinnt)
{
if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
MOVEFILE_REPLACE_EXISTING))
@ -1462,7 +1462,7 @@ check_posix_perm (const char *fname, int v)
extern int allow_ntea, allow_ntsec, allow_smbntsec;
/* Windows 95/98/ME don't support file system security at all. */
if (os_being_run != winNT)
if (!iswinnt)
return 0;
/* ntea is ok for supporting permission bits but it doesn't support
@ -2008,7 +2008,7 @@ extern "C" int
seteuid (uid_t uid)
{
sigframe thisframe (mainthread);
if (os_being_run == winNT)
if (iswinnt)
{
char orig_username[UNLEN + 1];
char orig_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
@ -2223,7 +2223,7 @@ extern "C" int
setegid (gid_t gid)
{
sigframe thisframe (mainthread);
if (os_being_run == winNT)
if (iswinnt)
{
if (gid != (gid_t) -1)
{

View File

@ -59,7 +59,7 @@ sysconf (int in)
#endif
case _SC_NPROCESSORS_CONF:
case _SC_NPROCESSORS_ONLN:
if (os_being_run != winNT)
if (!iswinnt)
return 1;
/*FALLTHRU*/
case _SC_PHYS_PAGES:

View File

@ -300,7 +300,7 @@ syslog (int priority, const char *message, ...)
return;
}
if (os_being_run != winNT)
if (!iswinnt)
{
/* Add a priority string - not needed for NT
as NT has its own priority codes. */
@ -336,7 +336,7 @@ syslog (int priority, const char *message, ...)
msg_strings[0] = total_msg;
if (os_being_run == winNT)
if (iswinnt)
{
/* For NT, open the event log and send the message */
HANDLE hEventSrc = RegisterEventSourceA (NULL, (process_ident != NULL) ?

View File

@ -457,7 +457,7 @@ int
pthread_cond::TimedWait (DWORD dwMilliseconds)
{
DWORD rv;
if (os_being_run != winNT)
if (!iswinnt)
{
// FIXME: race condition (potentially drop events
// Possible solution (single process only) - place this in a critical section.

View File

@ -56,7 +56,7 @@ times (struct tms * buf)
/* Ticks is in milliseconds, convert to our ticks. Use long long to prevent
overflow. */
clock_t tc = (clock_t) ((long long) ticks * CLOCKS_PER_SEC / 1000);
if (os_being_run == winNT)
if (iswinnt)
{
GetProcessTimes (hMainProc, &creation_time, &exit_time,
&kernel_time, &user_time);

View File

@ -392,7 +392,7 @@ tty::common_init (fhandler_pty_master *ptym)
/* Allow the others to open us (for handle duplication) */
if ((os_being_run == winNT) &&
if ((iswinnt) &&
(SetKernelObjectSecurity (hMainProc, DACL_SECURITY_INFORMATION,
get_null_sd ()) == FALSE))
small_printf ("Can't set process security, %E");

View File

@ -40,7 +40,7 @@ internal_getlogin (cygheap_user &user)
user.set_name (username);
debug_printf ("GetUserName() = %s", user.name ());
if (os_being_run == winNT)
if (iswinnt)
{
LPWKSTA_USER_INFO_1 wui;
NET_API_STATUS ret;

View File

@ -65,6 +65,7 @@ extern "C" DWORD WINAPI GetLastError (void);
/* Used for runtime OS check/decisions. */
enum os_type {winNT = 1, win95, win98, winME, win32s, unknown};
extern os_type os_being_run;
extern bool iswinnt;
enum codepage_type {ansi_cp, oem_cp};
extern codepage_type current_codepage;