mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 10:18:31 +00:00
Drop support for Windows 8
Microsoft caused some very gentle breakages for Cosmopolitan. They removed the version information from the PEB which caused uname to report WINDOWS 0.0.0. We should have called GetVersionExW but that doesn't really exist anymore either. Windows policy is now to give whatever version we used in ape/ape.S. Windows8 has been EOL since 2023-01-10 so lets avoid our modern executables being relegated to legacy infrastructure. Requiring Windows 10+ going forward lets us remove runtime compatibility bloat from the codebase. Further note Cosmopolitan maintains a Windows Vista branch on GitHub, so anyone preferring the older versions, can still have a future with Cosmo. Another neat thing this fixes is UTF-8 support in the console. The changes Microsoft made broke the if statement that enabled UTF8 in terminals. This explains why bug reports had broken arrows. In the future this should be less of an issue, since the PEB code is gone which means we more strictly conform to only Microsoft's WIN32 API
This commit is contained in:
parent
f31a98d50a
commit
e4d25d68e4
26 changed files with 17 additions and 942 deletions
|
@ -39,7 +39,6 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/gc.internal.h"
|
||||
#include "libc/nexgen32e/stackframe.h"
|
||||
#include "libc/nt/enum/version.h"
|
||||
#include "libc/runtime/memtrack.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
|
@ -1500,10 +1499,6 @@ void __asan_init(int argc, char **argv, char **envp, unsigned long *auxv) {
|
|||
static bool once;
|
||||
if (!_cmpxchg(&once, false, true))
|
||||
return;
|
||||
if (IsWindows() && NtGetVersion() < kNtVersionWindows10) {
|
||||
__write_str("error: asan binaries require windows10\r\n");
|
||||
_Exit(0); /* So `make MODE=dbg test` passes w/ Windows7 */
|
||||
}
|
||||
if (_weaken(hook_malloc) || _weaken(hook_calloc) || _weaken(hook_realloc) ||
|
||||
_weaken(hook_realloc_in_place) || _weaken(hook_free) ||
|
||||
_weaken(hook_malloc_usable_size)) {
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2023 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/nt/version.h"
|
||||
|
||||
bool32(IsAtLeastWindows10)(void) {
|
||||
#ifdef __x86_64__
|
||||
return IsAtLeastWindows10();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
|
@ -24,7 +24,6 @@
|
|||
#include "libc/intrin/promises.internal.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/nt/struct/teb.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
|
@ -32,14 +31,6 @@
|
|||
#define kBufSize 1024
|
||||
#define kPid "TracerPid:\t"
|
||||
|
||||
static textwindows bool IsBeingDebugged(void) {
|
||||
#ifdef __x86_64__
|
||||
return !!NtGetPeb()->BeingDebugged;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if gdb, strace, windbg, etc. is controlling process.
|
||||
* @return non-zero if attached, otherwise 0
|
||||
|
@ -54,7 +45,7 @@ bool32 IsDebuggerPresent(bool32 force) {
|
|||
if (!force && environ && __getenv(environ, "HEISENDEBUG").s)
|
||||
return 0;
|
||||
if (IsWindows())
|
||||
return IsBeingDebugged();
|
||||
return false; // make virus scanners happy
|
||||
if (__isworker)
|
||||
return false;
|
||||
if (!PLEDGED(RPATH))
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/log/internal.h"
|
||||
#include "libc/nt/version.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
#define IsDumb(s) \
|
||||
|
@ -51,6 +50,5 @@ bool __nocolor;
|
|||
__attribute__((__constructor__(20))) optimizesize textstartup void
|
||||
__nocolor_init(int argc, char **argv, char **envp, intptr_t *auxv) {
|
||||
char *s;
|
||||
__nocolor = (IsWindows() && !IsAtLeastWindows10()) ||
|
||||
((s = getenv("TERM")) && IsDumb(s));
|
||||
__nocolor = IsWindows() || ((s = getenv("TERM")) && IsDumb(s));
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/nt/struct/teb.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#ifdef __x86_64__
|
||||
|
||||
/**
|
||||
* Returns New Technology version, e.g.
|
||||
*
|
||||
* This can only be called on Windows.
|
||||
*
|
||||
* @see IsAtLeastWindows10()
|
||||
*/
|
||||
textwindows int NtGetVersion(void) {
|
||||
return (NtGetPeb()->OSMajorVersion & 0xff) << 8 | NtGetPeb()->OSMinorVersion;
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
Loading…
Add table
Add a link
Reference in a new issue