corrections to make everyone happy, it now compiles with Clang, MSVC, and MinGW!

This commit is contained in:
Alexander Frick
2025-11-26 02:20:11 -06:00
parent 96b7272158
commit b88680a20b
7 changed files with 64 additions and 40 deletions
+19 -2
View File
@@ -1,6 +1,20 @@
#pragma once
#include <WinSDKVer.h>
#ifndef STRICT
#define STRICT
#endif
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef __MINGW32__
#include <WinSDKVer.h>
#endif // not __MINGW32__
#ifndef WINVER
#define WINVER _WIN32_WINNT_WINXP
@@ -21,9 +35,12 @@
#define _ATL_XP_TARGETING
#endif // _ATL_XP_TARGETING
#include <SDKDDKVer.h>
#ifndef __MINGW32__
#include <SDKDDKVer.h>
#endif // not __MINGW32__
#include <windows.h>
#include <combaseapi.h>
#include <commctrl.h>
#include <commdlg.h>
#include <tchar.h>
+3 -1
View File
@@ -5,7 +5,9 @@
#pragma once
#pragma code_page(65001) // UTF-8
#ifdef __clang__
#pragma code_page(65001) // UTF-8
#endif // __clang__
#include "version.h"
+22 -1
View File
@@ -2,7 +2,23 @@
#include "globals.h"
static bool is_win11;
namespace {
static bool is_win11;
static ULONG NT_MAJOR = 0;
static ULONG NT_MINOR = 0;
static ULONG NT_BUILD = 0;
static std::wstring NT_CSD_VERSION;
static std::string NT_SERVICE_PACK;
static USHORT NT_SUITE;
static UCHAR NT_TYPE;
}
HANDLE LoadImageFromDLL(LPCWSTR dllName,
UINT resourceId,
@@ -431,11 +447,16 @@ std::string const GetNTString() {
// See http://ref.x86asm.net/coder32.html
void ImmediateDebugCrash() {
#if defined(_WIN32) && !defined(_WIN64)
#ifdef __MINGW32__
asm("int3\n\t"
"ud2");
#else
// 32 bit assembly code
__asm int 3 // Execute int3 interrupt
__asm {
UD2 // Execute 0x0F, 0x0B
}
#endif // __MINGW32__
#elif defined(_WIN64) // x86_64
/* MSVC-specific x64 ud2 since MSVC doesn't allow inline assembly
when compiling for x64 */
+14 -16
View File
@@ -1,27 +1,25 @@
#ifndef XP_ACTIVATE32_UTILS_H_
#define XP_ACTIVATE32_UTILS_H_
#ifdef __MINGW32__
extern "C" {
static __inline__ __attribute__((always_inline)) unsigned long long __emulu(
const unsigned int a, const unsigned int b) {
unsigned long long retval;
__asm__("mull %[b]" : "=A"(retval) : [a] "a"(a), [b] "rm"(b));
return retval;
}
}
#define __noop(...) ((void)0)
#endif // __MINGW32__
#include <intrin.h>
#include "constants.h"
#include "framework.h"
extern wchar_t strings[16][256];
namespace {
static ULONG NT_MAJOR = 0;
static ULONG NT_MINOR = 0;
static ULONG NT_BUILD = 0;
static std::wstring NT_CSD_VERSION;
static std::string NT_SERVICE_PACK;
static USHORT NT_SUITE;
static UCHAR NT_TYPE;
}
static std::string NT_FEATURE_VERSION;
static std::string NT_POST_STRING;
+3 -1
View File
@@ -1,7 +1,9 @@
#ifndef XP_ACTIVATE32_VERSION_H_
#define XP_ACTIVATE32_VERSION_H_
#pragma code_page(65001) // UTF-8
#ifdef __clang__
#pragma code_page(65001) // UTF-8
#endif // __clang__
// Macro to convert to string
#if !defined(_STRINGIZER) && !defined(STRINGIZE)
+2 -5
View File
@@ -1038,14 +1038,11 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
int WINAPI wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ WCHAR *pCmdLine,
_In_ INT nCmdShow) {
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) {
UNREFERENCED_PARAMETER(hPrevInstance);
/* Assign global HINSTANCE */
g_hInstance = hInstance;
MSG Msg;
//MSG Msg;
long err_status;
// Allow and allocate conhost
+1 -14
View File
@@ -1,23 +1,10 @@
#ifndef XP_ACTIVATE32_H_
#define XP_ACTIVATE32_H_
#include <intrin.h>
#include "constants.h"
#include "framework.h"
#include "resource.h"
#ifndef STRICT
#define STRICT
#endif
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include "utils.h"
typedef struct {
ui64 u[2];