From 15cbe19006525344f6bf1de75c4a1053de4c7558 Mon Sep 17 00:00:00 2001 From: CONIGUERO <64615687+CONIGUERO@users.noreply.github.com> Date: Sun, 9 Jul 2023 00:08:43 -0300 Subject: [PATCH] Refactor/Overhaul (#40) * major refactor/overhaul move generation implementation to libumskt/* decouple CLI/Options (and JSON) from generation implementation set groundwork for future shared library use standardized PIDGEN2/PIDGEN3 naming convention create a Windows Docker file for quick compilation add Windows resouce file/header so we have an application icon on windows use icon from @Endermanch (used with permission) add support for fully-static linux/muslc-based compilation add support for a dos/windows (i486+) binary using djgpp add Dockerfile to compile gcc/djgpp/watt32/openssl to provide DOS (DPMI) binaries add @Endermanch 's Vista+ documentation update Readme for recent credits * begin work on C linkage and emscripten buildpath * Update CMake to include and build Crypto++ * move dllmain.cpp to the correct directory * add rust port info to README.md * re-add dropped changes from rebase * update build config, specify windows XP version number for crypto++ * update dos-djgpp action to use new cmake builder and options * update dos-djgpp to use UMSKT hosted forks * update other workflows to include standard header * remove crypto++ from build config for now * use the new `shell` parameter in `threeal/cmake-action` TODO: move to a stable version (v1.3.0) when ready * use full commit hash because a shortened hash is unsupported * add the required {0} parameter? * add openssl 3.1.1 to windows github runners * ensure linux matrix build compiles on the correct arch --------- Co-authored-by: Neo <321592+Neo-Desktop@users.noreply.github.com> --- .dockerignore | 3 + .github/workflows/dos-djgpp.yml | 89 ++++++++++++ .github/workflows/linux.yml | 55 ++++++-- .github/workflows/windows.yml | 113 +++++++++++++-- .gitignore | 4 + .idea/.name | 1 + CMakeLists.txt | 177 +++++++++++++++++++++--- Dockerfile | 53 +++++++ Dockerfile.djgpp | 123 ++++++++++++++++ Dockerfile.emscripten | 64 +++++++++ Dockerfile.windows | 86 ++++++++++++ README.md | 13 +- doc/Vista+.md | 99 +++++++++++++ src/cli.cpp | 76 +++++----- src/cli.h | 36 +++++ src/header.h | 100 +------------ src/{ => libumskt/confid}/confid.cpp | 4 +- src/{ => libumskt/confid}/confid.h | 6 +- src/libumskt/debugoutput.cpp | 35 +++++ src/libumskt/libumskt.cpp | 60 ++++++++ src/libumskt/libumskt.h | 73 ++++++++++ src/libumskt/pidgen2/PIDGEN2.cpp | 135 ++++++++++++++++++ src/libumskt/pidgen2/PIDGEN2.h | 41 ++++++ src/{ => libumskt/pidgen3}/BINK1998.cpp | 40 +++--- src/{ => libumskt/pidgen3}/BINK1998.h | 8 +- src/{ => libumskt/pidgen3}/BINK2002.cpp | 42 +++--- src/{ => libumskt/pidgen3}/BINK2002.h | 8 +- src/libumskt/pidgen3/PIDGEN3.h | 54 ++++++++ src/{ => libumskt/pidgen3}/key.cpp | 11 +- src/{ => libumskt/pidgen3}/util.cpp | 10 +- src/typedefs.h | 59 ++++++++ src/windows/dllmain.cpp | 46 ++++++ src/windows/icon.ico | Bin 0 -> 9662 bytes src/windows/resource.h | 38 +++++ src/windows/umskt.rc | Bin 0 -> 4976 bytes 35 files changed, 1520 insertions(+), 242 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/dos-djgpp.yml create mode 100644 .idea/.name create mode 100644 Dockerfile create mode 100644 Dockerfile.djgpp create mode 100644 Dockerfile.emscripten create mode 100644 Dockerfile.windows create mode 100644 doc/Vista+.md rename src/{ => libumskt/confid}/confid.cpp (99%) rename src/{ => libumskt/confid}/confid.h (96%) create mode 100644 src/libumskt/debugoutput.cpp create mode 100644 src/libumskt/libumskt.cpp create mode 100644 src/libumskt/libumskt.h create mode 100644 src/libumskt/pidgen2/PIDGEN2.cpp create mode 100644 src/libumskt/pidgen2/PIDGEN2.h rename src/{ => libumskt/pidgen3}/BINK1998.cpp (89%) rename src/{ => libumskt/pidgen3}/BINK1998.h (96%) rename src/{ => libumskt/pidgen3}/BINK2002.cpp (92%) rename src/{ => libumskt/pidgen3}/BINK2002.h (96%) create mode 100644 src/libumskt/pidgen3/PIDGEN3.h rename src/{ => libumskt/pidgen3}/key.cpp (91%) rename src/{ => libumskt/pidgen3}/util.cpp (95%) create mode 100644 src/typedefs.h create mode 100644 src/windows/dllmain.cpp create mode 100644 src/windows/icon.ico create mode 100644 src/windows/resource.h create mode 100644 src/windows/umskt.rc diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c47eabb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +build*/ +cmake-build*/ +djgpp-build*/ diff --git a/.github/workflows/dos-djgpp.yml b/.github/workflows/dos-djgpp.yml new file mode 100644 index 0000000..b3e900c --- /dev/null +++ b/.github/workflows/dos-djgpp.yml @@ -0,0 +1,89 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Neo on 06/19/2023 +# @Maintainer Neo + +name: C/C++ CI (DOS DJGPP) + +on: workflow_dispatch + +env: + CMAKE_C_COMPILER: ${{ github.workspace }}/djgpp/bin/i586-pc-msdosdjgpp-gcc + CMAKE_CXX_COMPILER: ${{ github.workspace }}/djgpp/bin/i586-pc-msdosdjgpp-g++ + CMAKE_FIND_ROOT_PATH: ${{ github.workspace }}/djgpp + CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: NEVER + CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: ONLY + CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: ONLY + CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ONLY + WATT_ROOT: ${{ github.workspace }}/djgpp/watt32 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup build environment + run: | + sudo apt -y update + sudo apt -y install build-essential cmake wget 7zip git flex nasm libslang2-dev pkg-config libslang2-modules gcc-multilib + + - name: Download and Setup DJGPP Toolchain + run: | + wget https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/djgpp-linux64-gcc1220.tar.bz2 + tar xjf djgpp-linux64-gcc1220.tar.bz2 + cd ${{ github.workspace }}/djgpp + git clone https://github.com/UMSKT/Watt-32.git watt32 + cd watt32/util + make clean && make linux + cd ../src + source ${{ github.workspace }}/djgpp/setenv.sh + ./configur.sh djgpp + make -f djgpp.mak + ln -s ${{ github.workspace }}/djgpp/watt32/lib/libwatt.a ${{ github.workspace }}/djgpp/lib + + - name: Checkout and Cross Compile OpenSSL 3.1 + run: | + git clone https://github.com/UMSKT/openssl.git openssl + pushd openssl + git checkout openssl-3.1.1 + source ${{ github.workspace }}/djgpp/setenv + ./Configure no-threads -DOPENSSL_DEV_NO_ATOMICS --prefix=${{ github.workspace }}/djgpp DJGPP + make && make install + popd + + - name: Checkout Source Tree + uses: actions/checkout@v3 + + - name: Build + uses: threeal/cmake-action@v1.2.0 + with: + c-compiler: ${{ github.workspace }}/djgpp/i586-pc-msdosdjgpp/bin/gcc + cxx-compiler: ${{ github.workspace }}/djgpp/i586-pc-msdosdjgpp/bin/g++ + options: OPENSSL_ROOT_DIR:string=${{ github.workspace }}/djgpp DJGPP_WATT32=ON + run-build: true + + - name: Move files to correct directory + run: | + mkdir build/actions_upload + tar -czf WindowsXPKg_linux_x86_64.tar.gz -C build xpkey keys.json + mv WindowsXPKg_linux_x86_64.tgz build/actions_upload/ + + - name: Upload build artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: Build + path: build/actions_upload diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 34f8480..ce884c5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,3 +1,23 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by TheTank20 on 06/13/2023 +# @Maintainer Neo + name: C/C++ CI (Linux) on: @@ -9,27 +29,44 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + include: + - arch: x86 + - arch: x86_64 + - arch: aarch64 steps: - name: Checkout Source Tree uses: actions/checkout@v3 - - name: Setup build environment - run: | - sudo apt -y update - sudo apt -y install build-essential cmake libssl-dev - - - name: Configure and build WindowsXPKg - uses: threeal/cmake-action@v1.2.0 + - name: Setup latest Alpine Linux for ${{ matrix.arch }} + uses: jirutka/setup-alpine@v1 with: + packages: > + bash + build-base + cmake + git + musl-dev + openssl-dev + openssl-libs-static + arch: ${{ matrix.arch }} + shell-name: alpine-target.sh + + - name: Configure and build UMSKT + uses: threeal/cmake-action@7ef2eb8da6e5ec0a6de6b1ddc96987080bed06e8 + with: + options: MUSL_STATIC=ON run-build: true + shell: alpine-target.sh {0} - name: Move files to correct directory run: | mkdir -p build/actions_upload - mv build/xpkey build/keys.json build/actions_upload/ + mv build/umskt build/actions_upload/umskt - name: Upload build artifact uses: actions/upload-artifact@v3.1.2 with: - name: WindowsXPKg-linux-x86_64-static + name: UMSKT-linux-${{ matrix.arch }}-static path: build/actions_upload diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bfa5a6a..a6093a9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,3 +1,23 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by TheTank20 on 06/13/2023 +# @Maintainer Neo + name: C/C++ CI (Windows) on: @@ -7,31 +27,102 @@ on: branches: [ "master" ] jobs: - build: - + build-32bit: runs-on: windows-latest - steps: + # https://github.com/actions/runner-images/issues/6067#issuecomment-1213069040 + - name: Install Windows XP Support for Visual Studio + run: | + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" + $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" + $componentsToAdd = @( + "Microsoft.VisualStudio.Component.WinXP" + ) + [string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_} + $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + if ($process.ExitCode -eq 0) + { + Write-Host "components have been successfully added" + Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.* + } + else + { + Write-Host "components were not installed" + exit 1 + } + + - name: Download And Install 32-bit OpenSSL 3.1.1 + run: | + $installDir = "$Env:ProgramFiles\OpenSSL" + $installerURL = "https://slproweb.com/download/Win32OpenSSL-3_1_1.exe" + $installerName = "Win32OpenSSL-3_1_1.exe" + $installerPath = Join-Path -Path "${env:Temp}" -ChildPath "$installerName" + + (New-Object System.Net.WebClient).DownloadFile($installerURL, $installerPath) + + Remove-Item "$installDir" -Force -Recurse + $installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`"" + Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru + - name: Checkout Source Tree uses: actions/checkout@v3 - name: Setup MSBuild uses: microsoft/setup-msbuild@v1 - - name: Configure WindowsXPKg + - name: Configure UMSKT uses: threeal/cmake-action@v1.2.0 + with: + working-directory: build + generator: "Visual Studio 17 2022" + options: CMAKE_SYSTEM_VERSION="5.1.2600" + args: -A "Win32" -T v141_xp - - name: Build WindowsXPKg + - name: Build UMSKT working-directory: build run: msbuild ALL_BUILD.vcxproj /P:Configuration=Release - - name: Copy files and clean up output directory - run: | - del "build/Release/*.lib" - copy "keys.json" "build/Release/keys.json" - - name: Upload build artifact uses: actions/upload-artifact@v3.1.2 with: - name: WindowsXPKg-Win64 + name: UMSKT-Win32 + path: build/Release + + build-64bit: + runs-on: windows-latest + steps: + - name: Download And Install 64-bit OpenSSL 3.1.1 + run: | + $installDir = "$Env:ProgramFiles\OpenSSL" + $installerURL = "https://slproweb.com/download/Win64OpenSSL-3_1_1.exe" + $installerName = "Win64OpenSSL-3_1_1.exe" + $installerPath = Join-Path -Path "${env:Temp}" -ChildPath "$installerName" + + (New-Object System.Net.WebClient).DownloadFile($installerURL, $installerPath) + + Remove-Item "$installDir" -Force -Recurse + $installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`"" + Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru + + - name: Checkout Source Tree + uses: actions/checkout@v3 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + + - name: Configure UMSKT + uses: threeal/cmake-action@v1.2.0 + with: + generator: "Visual Studio 17 2022" + args: -A "x64" + + - name: Build UMSKT + working-directory: build + run: msbuild ALL_BUILD.vcxproj /P:Configuration=Release + + - name: Upload build artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: UMSKT-Win64 path: build/Release diff --git a/.gitignore b/.gitignore index 0afdac0..3d8ca8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ build/* +*.tar +*.exe +*.wasm +umskt ### NotepadPP template # Notepad++ backups # diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..a2a84e0 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +UMSKT \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index bdd5d26..36fda23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,46 +1,177 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.9) -PROJECT(WindowsXPKg) +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Andrew on 05/30/2023 +# @Maintainer Neo + +CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +PROJECT(UMSKT) SET(CMAKE_CXX_STANDARD 17) +SET(CMAKE_POSITION_INDEPENDENT_CODE ON) +OPTION(UMSKT_USE_SHARED_OPENSSL "Force linking against the system-wide OpenSSL library" OFF) +OPTION(MUSL_STATIC "Enable fully static builds in a muslc environment (i.e. Alpine Linux)" OFF) +OPTION(DJGPP_WATT32 "Enable compilation and linking with DJGPP/WATT32/OpenSSL" OFF) +OPTION(MSVC_MSDOS_STUB "Specify a custom MS-DOS stub for a 32-bit MSVC compilation" OFF) -SET(BUILD_SHARED_LIBS OFF) -SET(CMAKE_EXE_LINKER_FLAGS "-static") -SET(OPENSSL_USE_STATIC_LIBS TRUE) -SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) +SET(UMSKT_LINK_LIBS ${UMSKT_LINK_LIBS}) +SET(UMSKT_LINK_DIRS ${UMSKT_LINK_DIRS}) +IF(UMSKT_USE_SHARED_OPENSSL) + SET(OPENSSL_USE_STATIC_LIBS FALSE) + SET(OPENSSL_MSVC_STATIC_RT FALSE) + MESSAGE(WARNING "[UMSKT] Forcing shared OpenSSL runtime") +ELSE() + SET(OPENSSL_USE_STATIC_LIBS TRUE) + SET(OPENSSL_MSVC_STATIC_RT TRUE) +ENDIF() + +IF(DJGPP_WATT32) + SET(CMAKE_SYSTEM_NAME MSDOS) + SET(UMSKT_LINK_LIBS ${UMSKT_LINK_LIBS} ${DJGPP_WATT32}) + SET(UMSKT_LINK_DIRS ${UMSKT_LINK_DIRS} ${WATT_ROOT}/lib) +ENDIF() + +# find the system installed OpenSSL development library FIND_PACKAGE(OpenSSL REQUIRED) - -IF(!OPENSSL_FOUND) +IF(NOT OPENSSL_FOUND) MESSAGE(SEND_ERROR "OpenSSL Development Libraries Not Found") MESSAGE(SEND_ERROR "Please consult your package manager of choice to install the prerequisite") MESSAGE(SEND_ERROR "The package name is commonly called libssl-dev or openssl-dev depending on distribution") MESSAGE(FATAL_ERROR "Can not continue without OpenSSL") ENDIF() +# if we found shared libraries - do the following: +STRING(REGEX MATCH "(\\.so|\\.dll|\\.dylib)$" OPENSSL_CRYPTO_SHARED "${OPENSSL_CRYPTO_LIBRARY}") +IF(OPENSSL_CRYPTO_SHARED) + MESSAGE(STATUS "[UMSKT] Detected Shared library version of OpenSSL") + SET(BUILD_SHARED_LIBS ON) +ELSE() + MESSAGE(STATUS "[UMSKT] Detected Static Library version of OpenSSL") +ENDIF() + +# if we're compiling with MSVC, respect the DEBUG compile option +IF(MSVC) + SET(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + IF(NOT BUILD_SHARED_LIBS) + SET(CMAKE_CXX_FLAGS_RELEASE "/MT") + SET(CMAKE_CXX_FLAGS_DEBUG "/MTd") + ELSE() + SET(CMAKE_CXX_FLAGS_RELEASE "/MD") + SET(CMAKE_CXX_FLAGS_DEBUG "/MDd") + ENDIF() + SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO /NODEFAULTLIB:MSVCRT") + SET(CMAKE_ENABLE_EXPORTS ON) + SET(UMSKT_EXE_WINDOWS_EXTRA src/windows/umskt.rc) + SET(UMSKT_EXE_WINDOWS_DLL src/windows/dllmain.cpp) +ENDIF() + +IF(MUSL_STATIC) + MESSAGE(STATUS "[UMSKT] Performing a fully static build using muslc") + SET(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++") + SET(CMAKE_SHARED_LINKER_FLAGS "-static -static-libgcc -static-libstdc++") + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static-libstdc++") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") +ENDIF() + +# initalize cpm.CMake INCLUDE(cmake/CPM.cmake) -# Include JSON runtime library +# fetch cpm.CMake dependencies +# Include JSON development library CPMAddPackage( NAME nlohmann_json GITHUB_REPOSITORY nlohmann/json VERSION 3.11.2 ) -CPMAddPackage("gh:fmtlib/fmt#7.1.3") +# Include fmt development library +CPMAddPackage( + NAME fmt + GITHUB_REPOSITORY fmtlib/fmt + GIT_TAG 10.0.0 + VERSION 10.0.0 +) -CONFIGURE_FILE(keys.json keys.json COPYONLY) +# Include cmrc resource compiler +CPMAddPackage( + NAME cmrc + GITHUB_REPOSITORY vector-of-bool/cmrc + GIT_TAG 2.0.1 + VERSION 2.0.1 +) -ADD_LIBRARY(BINK1998 STATIC src/BINK1998.cpp) -TARGET_INCLUDE_DIRECTORIES(BINK1998 PUBLIC crypto) -TARGET_LINK_LIBRARIES(BINK1998 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) +# Include Crypto++ development library +#CPMAddPackage( +# NAME cryptopp-cmake +# GITHUB_REPOSITORY abdes/cryptopp-cmake +# GIT_TAG CRYPTOPP_8_8_0 +# VERSION 8.8.0 +# OPTIONS "CRYPTOPP_BUILD_TESTING OFF" +#) -ADD_LIBRARY(BINK2002 STATIC src/BINK2002.cpp) -TARGET_INCLUDE_DIRECTORIES(BINK2002 PUBLIC crypto) -TARGET_LINK_LIBRARIES(BINK2002 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) +#include googletest unit testing library +#CPMAddPackage( +# NAME googletest +# GITHUB_REPOSITORY google/googletest +# VERSION 1.13.0 +# OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt" +#) -ADD_LIBRARY(CONFID STATIC src/confid.cpp) -TARGET_INCLUDE_DIRECTORIES(CONFID PUBLIC crypto) -TARGET_LINK_LIBRARIES(CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) +### Resource compilation +CMRC_ADD_RESOURCE_LIBRARY(umskt-rc ALIAS umskt::rc NAMESPACE umskt keys.json) -ADD_EXECUTABLE(xpkey src/main.cpp src/key.cpp src/util.cpp src/cli.cpp) -TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto) -TARGET_LINK_LIBRARIES(xpkey BINK1998 BINK2002 CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) +SET(LIBUMSKT_SRC src/libumskt/libumskt.cpp src/libumskt/pidgen3/BINK1998.cpp src/libumskt/pidgen3/BINK2002.cpp src/libumskt/pidgen3/key.cpp src/libumskt/pidgen3/util.cpp src/libumskt/confid/confid.cpp src/libumskt/pidgen2/PIDGEN2.cpp src/libumskt/debugoutput.cpp) + +#### Separate Build Path for emscripten +IF (EMSCRIPTEN) + ADD_EXECUTABLE(umskt ${LIBUMSKT_SRC}) + TARGET_INCLUDE_DIRECTORIES(umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(umskt -static OpenSSL::Crypto cryptopp::cryptopp fmt) + SET(CMAKE_EXECUTABLE_SUFFIX ".html") + + SET_TARGET_PROPERTIES(umskt PROPERTIES COMPILE_FLAGS "-Os -sEXPORTED_RUNTIME_METHODS=ccall,cwrap") + SET_TARGET_PROPERTIES(umskt PROPERTIES LINK_FLAGS "-Os -sWASM=1 -sEXPORT_ALL=1 -sEXPORTED_RUNTIME_METHODS=ccall,cwrap --no-entry") +ELSE() + IF(NOT UMSKT_USE_SHARED_OPENSSL) + ### Static library compilation + ADD_LIBRARY(_umskt STATIC ${LIBUMSKT_SRC}) + TARGET_INCLUDE_DIRECTORIES(_umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(_umskt -static OpenSSL::Crypto fmt ${UMSKT_LINK_LIBS}) + ELSE() + ### Shared library compilation + ADD_LIBRARY(_umskt SHARED ${LIBUMSKT_SRC} ${UMSKT_EXE_WINDOWS_EXTRA} ${UMSKT_EXE_WINDOWS_DLL}) + TARGET_INCLUDE_DIRECTORIES(_umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(_umskt OpenSSL::Crypto fmt ${UMSKT_LINK_LIBS}) + TARGET_LINK_DIRECTORIES(_umskt PUBLIC ${UMSKT_LINK_DIRS}) + ENDIF() + + ### UMSKT executable compilation + ADD_EXECUTABLE(umskt src/main.cpp src/cli.cpp ${UMSKT_EXE_WINDOWS_EXTRA}) + TARGET_INCLUDE_DIRECTORIES(umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(umskt _umskt OpenSSL::Crypto fmt nlohmann_json::nlohmann_json umskt::rc ${UMSKT_LINK_LIBS}) + TARGET_LINK_DIRECTORIES(umskt PUBLIC ${UMSKT_LINK_DIRS}) + IF(MSVC AND MSVC_MSDOS_STUB) + SET_PROPERTY(TARGET umskt APPEND PROPERTY LINK_FLAGS /STUB:${MSVC_MSDOS_STUB}) + ENDIF() + + ### Copy Shared Libraries and dependency files + IF (OPENSSL_CRYPTO_SHARED) + GET_FILENAME_COMPONENT(OPENSSL_CRYPTO_LIBRARY_FILENAME ${OPENSSL_CRYPTO_LIBRARY} NAME) + CONFIGURE_FILE(${OPENSSL_CRYPTO_LIBRARY} "${CMAKE_CURRENT_BINARY_DIR}/${OPENSSL_CRYPTO_LIBRARY_FILENAME}" COPYONLY) + ENDIF() +ENDIF() diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..81cea46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Neo on 06/19/2023 +# @Maintainer Neo + +# Stage 1: Install Prereqisites +FROM alpine:latest as prereqisites + +# Install build dependencies +RUN apk add --no-cache \ + bash \ + build-base \ + cmake \ + git \ + musl-dev \ + openssl-dev \ + openssl-libs-static + + +# Stage 2: Build +FROM prereqisites as builder + +WORKDIR /src +COPY . /src + +# Build UMSKT from the local directory +RUN mkdir /src/build \ + && cd /src/build \ + && cmake -DMUSL_STATIC=ON .. \ + && make + +# Stage 3: Output +FROM scratch as output + +COPY --from=builder /src/build/umskt /umskt + +# invoke via +# docker build -o type=tar,dest=umskt.tar . diff --git a/Dockerfile.djgpp b/Dockerfile.djgpp new file mode 100644 index 0000000..4f0784a --- /dev/null +++ b/Dockerfile.djgpp @@ -0,0 +1,123 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Neo on 06/19/2023 +# @Maintainer Neo + +# Stage 1: Install Prerequisites +FROM alpine:latest as prerequisites + +# Stage 1: Install build dependencies +RUN apk add --no-cache \ + autoconf \ + automake \ + bash \ + bison \ + build-base \ + clang \ + cmake \ + coreutils \ + curl \ + elfutils-dev \ + findutils \ + git \ + gawk \ + flex \ + libelf \ + libslirp-dev \ + linux-headers \ + nasm \ + sed \ + slang-dev \ + texinfo \ + unzip \ + zlib-dev + + +FROM prerequisites as djgpp + +WORKDIR /tmp + +# Stage 2: compile djgpp for muslc +ENV DJGPP_PREFIX=/djgpp BUILD_VER=12.2.0-i386 +RUN git clone https://github.com/andrewwutw/build-djgpp.git djgpp \ + && cd djgpp \ + && cd script \ + && wget https://gist.github.com/Neo-Desktop/4cfd708f61f5847a7bf457d38db3b59f/raw/25d24cf509b0fc486d5d18ecb6656f120c3d0e51/12.2.0-i386 -O 12.2.0-i386 \ + && chmod +x 12.2.0-i386 \ + && cd ../patch \ + && wget https://gist.github.com/Neo-Desktop/4cfd708f61f5847a7bf457d38db3b59f/raw/25d24cf509b0fc486d5d18ecb6656f120c3d0e51/patch-alpine-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch -O patch-alpine-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch \ + && cd .. \ + && sed -i 's/i586/i386/g' setenv/setenv \ + && sed -i 's/i586/i386/g' setenv/setenv.bat \ + && ./build-djgpp.sh $BUILD_VER \ + && rm -rf /tmp/djgpp + +# Stage 3: compile watt32 for djgpp-i386 +FROM djgpp as watt32 +WORKDIR /djgpp +ENV WATT_ROOT=/djgpp/watt32 DJGPP_PREFIX=i386-pc-msdosdjgpp +SHELL ["/bin/bash", "-c"] +RUN git clone https://github.com/gvanem/Watt-32.git watt32 \ + && cd watt32/util \ + && make clean && make linux \ + && cd ../src \ + && source /djgpp/setenv \ + && ./configur.sh djgpp \ + && sed -i 's/i586/i386/g' djgpp.mak \ + && wget https://gist.github.com/Neo-Desktop/ad26e888d64b22a59c743ab4e21ac186/raw/c9a73e1eb75ba8857883ac5c08691d2fe5b82594/djgpp.err -O ../inc/sys/djgpp.err \ + && wget https://gist.github.com/Neo-Desktop/ad26e888d64b22a59c743ab4e21ac186/raw/c9a73e1eb75ba8857883ac5c08691d2fe5b82594/syserr.c -O build/djgpp/syserr.c \ + && make -f djgpp.mak \ + && ln -s /djgpp/watt32/lib/libwatt.a /djgpp/lib + +# Stage 4: compile OpenSSL for djgpp-i386/watt32 +FROM watt32 as openssl +WORKDIR /tmp +SHELL ["/bin/bash", "-c"] +RUN git clone https://github.com/openssl/openssl.git openssl \ + && cd openssl \ + && git checkout openssl-3.1.1 \ + && source /djgpp/setenv \ + && wget https://gist.github.com/Neo-Desktop/ad26e888d64b22a59c743ab4e21ac186/raw/c9a73e1eb75ba8857883ac5c08691d2fe5b82594/50-djgpp.conf.patch -O Configurations/50-djgpp.conf.patch \ + && git apply Configurations/50-djgpp.conf.patch \ + && ./Configure no-threads -DOPENSSL_DEV_NO_ATOMICS --prefix=/djgpp DJGPP \ + && make && make install + +# Stage 5: compile UMSKT +FROM openssl as build + +WORKDIR /src +COPY . /src + +ENV CC=/djgpp/bin/i386-pc-msdosdjgpp-gcc CXX=/djgpp/bin/i386-pc-msdosdjgpp-g++ PKG_CONFIG_PATH=/djgpp/lib/pkgconfig VERBOSE=1 +SHELL ["/bin/bash", "-c"] +# Build UMSKT from the local directory +RUN mkdir /src/build \ + && cd /src/build \ + && source /djgpp/setenv \ + && cmake -DDJGPP_WATT32=${WATT_ROOT}/lib/libwatt.a .. \ + && make + +CMD ["bash"] + +# Stage 6: Output +FROM scratch as output + +COPY --from=build /src/build/umskt.exe /umskt.exe + +# invoke via +# docker build -f Dockerfile.djgpp -o type=tar,dest=umskt-dos.tar . diff --git a/Dockerfile.emscripten b/Dockerfile.emscripten new file mode 100644 index 0000000..e7e6bad --- /dev/null +++ b/Dockerfile.emscripten @@ -0,0 +1,64 @@ +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Neo on 06/25/2023 +# @Maintainer Neo + +# Stage 1: Install Prerequisites +FROM emscripten/emsdk:latest as prerequisites +RUN apt update \ + && apt -y install pkg-config \ + && apt -y clean autoclean autoremove + +# Stage 2: compile OpenSSL for emscripten +FROM prerequisites as openssl +WORKDIR /tmp +ENV EMSCRIPTEN=/emsdk/upstream/emscripten VERBOSE=1 +RUN git clone https://github.com/openssl/openssl.git openssl \ + && cd openssl \ + && git checkout openssl-3.1.1 \ + && emconfigure ./Configure gcc -no-tests -no-asm -static -fPIC -no-sock -no-afalgeng -DOPENSSL_SYS_NETWARE -DSIG_DFL=0 -DSIG_IGN=0 -DHAVE_FORK=0 -DOPENSSL_NO_AFALGENG=1 --with-rand-seed=getrandom --prefix=$EMSCRIPTEN/cache/sysroot|| exit $? \ + && sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile \ + && emmake make -j 12 build_generated libssl.a libcrypto.a build_libs_nodep \ + && rm -rf $EMSCRIPTEN/cache/sysroot/include/openssl \ + && cp -R include/openssl $EMSCRIPTEN/cache/sysroot/include \ + && cp libcrypto.a libssl.a $EMSCRIPTEN/cache/sysroot/lib \ + && cp libcrypto.pc libssl.pc openssl.pc $EMSCRIPTEN/cache/sysroot/lib/pkgconfig/ \ + && cd .. \ + && rm -rf openssl + +# Stage 3: compile UMSKT +FROM openssl as build + +WORKDIR /src +COPY . /src + +# Build UMSKT from the local directory +RUN mkdir /src/build \ + && cd /src/build \ + && emcmake cmake .. \ + && emmake make + +CMD ["bash"] + +# Stage 4: Output +FROM scratch as output + +COPY --from=build /src/build/umskt.html /src/build/umskt.wasm /src/build/umskt.js / + +# invoke via +# docker build -f Dockerfile.emscripten -o type=tar,dest=umskt-wasm.tar . diff --git a/Dockerfile.windows b/Dockerfile.windows new file mode 100644 index 0000000..30711aa --- /dev/null +++ b/Dockerfile.windows @@ -0,0 +1,86 @@ +# escape=` + +# This file is a part of the UMSKT Project +# +# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# @FileCreated by Neo on 06/19/2023 +# @Maintainer Neo + +# Stage 1: Install Visual Studio +FROM mcr.microsoft.com/dotnet/framework/runtime:4.8.1 as visualstudio +# Download and install Build Tools for Visual Studio 2022 for native desktop workload. +#ADD https://aka.ms/vs/17/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe +ADD vs_buildtools.exe C:\TEMP\vs_buildtools.exe +RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` + --add Microsoft.VisualStudio.Workload.VCTools ` + --add Microsoft.VisualStudio.Workload.MSBuildTools ` + --add Microsoft.VisualStudio.Component.WinXP ` + --includeRecommended ` + --installPath C:\BuildTools \ + +# Stage 2: Install Chocolatey and Prereqisites +FROM visualstudio as prereqisites +WORKDIR C:\TEMP\ + +RUN ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass", "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"] +RUN ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass", "choco feature enable -n allowGlobalConfirmation"] +RUN ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass", "choco install git --params \"'/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration /NoGuiHereIntegration /NoShellHereIntegration /NoCredentialManager /SChannel'\""] + +#Install OpenSSL 32bit 3.1.1 +#ADD https://slproweb.com/download/Win32OpenSSL-3_1_1.msi C:\TEMP\Win32OpenSSL-3_1_1.msi +ADD Win32OpenSSL-3_1_1.msi C:\TEMP\Win32OpenSSL-3_1_1.msi +RUN msiexec /i C:\TEMP\Win32OpenSSL-3_1_1.msi /quiet /qn /norestart + +#Install OpenSSL 64bit 3.1.1 +#ADD https://slproweb.com/download/Win64OpenSSL-3_1_1.msi C:\TEMP\Win64OpenSSL-3_1_1.msi +ADD Win64OpenSSL-3_1_1.msi C:\TEMP\Win64OpenSSL-3_1_1.msi +RUN msiexec /i C:\TEMP\Win64OpenSSL-3_1_1.msi /quiet /qn /norestart + +# Stage 3: Build the 32-bit version of UMSKT +FROM prereqisites as Build32 +WORKDIR C:\umskt\ +COPY . C:\umskt\ + +RUN C:\BuildTools\Common7\Tools\VsDevCmd.bat && ` + mkdir C:\umskt\build && ` + cd C:\umskt\build && ` + cmake -DMSVC_MSDOS_STUB:string=..\umskt.exe .. -G "Visual Studio 17 2022" -A "Win32" -T v141_xp && ` + msbuild ALL_BUILD.vcxproj /P:Configuration=Release + +# Stage 4: Build the 64-bit version of UMSKT +FROM prereqisites as Build64 + +WORKDIR C:\umskt\ +COPY . C:\umskt\ + +ENV OPENSSL_ROOT_DIR="C:\Program Files\OpenSSL-Win64" +RUN C:\BuildTools\Common7\Tools\VsDevCmd.bat && ` + mkdir C:\umskt\build && ` + cd C:\umskt\build && ` + cmake .. && ` + msbuild ALL_BUILD.vcxproj /P:Configuration=Release + +# Stage 5: Copy binaries to an output/runtime image +FROM mcr.microsoft.com/dotnet/framework/runtime:4.8.1 as output + +COPY --from=Build32 C:\umskt\build\Release\umskt.exe C:\umskt\umskt.exe +COPY --from=Build64 C:\umskt\build\Release\umskt.exe C:\umskt\umskt64.exe + +#invoke via +# docker build -f Dockerfile.windows . +# docker run +# docker cp :C:\umskt umskt-win diff --git a/README.md b/README.md index 5945237..b5ec3d1 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ The list of people who have helped to bring the XP generation to where it is now * Neo-Desktop * WitherOrNot * TheTank20 +* InvoxiPlayGames +* brakmic (the list will be updated to add more collaborators) @@ -76,10 +78,19 @@ The list of people who have helped to bring the XP generation to where it is now ### **Development Requirements:** * `CMake, make, gcc` (`build-essential`) -* `OpenSSL 1.1.1+` (`libssl-dev`) * `git` #### Build Steps: 1. `git clone` 2. `cd build/ && cmake ../ && make` + + +----- + +### **Known Ports** + +| Language | Author | Repo URL | +|----------|-----------|-------------------------------------------------------| +| Rust | Alex Page | [anpage/umskt-rs](https://github.com/anpage/umskt-rs) | + diff --git a/doc/Vista+.md b/doc/Vista+.md new file mode 100644 index 0000000..67e36ee --- /dev/null +++ b/doc/Vista+.md @@ -0,0 +1,99 @@ +## 6. Product ID + +Product ID is 5 groups of decimals, e.g.: + +``` +AAAAA BBB CCCCCCC DD EEE +52273 005 6861993 09 146 +``` + +If you search `ProductID` in registry, you will find a product ID associated with your currently installed one. + +The meaning of each group of numbers: + +| Number | Meaning | +| --------- | ----------------------------------------------------------------------------------------------- | +| `AAAAA` | Product code. e.g.: `55661` for Windows Pro; `55660` for Windows Home. | +| `BBB` | First 3 effective number digits of Primary Product Serial. | +| `CCCCCCC` | Last 6 effective number digits of Primary Product Serial, and a digit of checksum. | +| `DD` | Public key index number for product validation. e.g.: Pro is 22, VLK is 23. | +| `EEE` | Nonce (random number), for generating different install ID when doing activation via telephone. | + +For `CCCCCCC` mentioned above, it had two parts including 1 digit and 6 digits. The checksum is calculated as follows: **Add all digits together (including the checksum digit), it is divisible by 7.** +For example: the last 6 digits of Primary Product Serial is `728439`, then `7 + 2 + 8 + 4 + 3 + 9 = 33` , then the checksum digit should be `2`, because `7 + 2 + 8 + 4 + 3 + 9 + 2 = 33 + 2 = 35`, and 35 is divisible by 7. So the `CCCCCCC` in Product ID should be `7284392`. + +## 7. OEM related mechanism + + +For licensed product to OEMs, starting from Windows XP, Microsoft is using SLP (System-Locked Preinstallation) technology, aka.: before installing the OS, lock in the motherboard with the OS. Windows XP used SLP 1.0, it works by detecting specific string set by OEM in BIOS. This method is easy to be spoofed, but the VLK crack is more easy to use so this method is not wide-spread. +From the Windows Vista, SLP upgraded to 2.0 . Primarily the change is using cryptographic key pairs to sign the data to prevent spoofing. This requires a special SLIC (Software Licensing Internal Code) table in BIOS to support this. +In Windows 7 series of product, SLP 2.1 is used, but there is no major changes in SLP for this revision, only updated the marker in SLIC to 2.1 . + +SLIC is the important part of SLP, usually directly backed in BIOS ROM, as the most underlying information of OS activation. SLIC contains the digital signature of OEM, when OS is activating, the upper level certificate must can be verified with the OEM information inside SLIC. SLIC usually contained inside SLDT(Software Licensing Description Table), which 374 bytes long, and SLDT itself is contained inside ACPI(Advanced Configuration and Power Management Interface). + +OEM certificate is a certification file provided by Microsoft, including to some mandatory information provided by OEM, the extension for the file is `xrm-ms`. The OEM certificate including the OEM identification information and digitally signed by Microsoft. When OS is activating, the OEM certificate must can be validated against SLIC. + +OEM product key seems no difference with retail product key, but OEM key is only valid for OEM activation, and it identifies the Windows product variation. Windows Vista cancelled the VLK model, only OEM activation is provided, and used SLP 2.0, used public key instead plain text for validation, caused difficulties for cracking. + +### Windows Vista (SLP 2.0) + +The procedure for SLP 2.0 verification is as follows: + +1. When installing Windows Vista, retail version user need to input the serial (CD-KEY) presented on the box. For users who got the OEM version of Windows Vista with the computer, they can find a sticker that corresponding the version they got with the computer, as a voucher for purchasing the Windows Vista OEM version. The system identifies different versions of Windows Vista based on their serial numbers, such as Home Basic, Home Advanced, Business, Ultimate, and so on. After installation, the serial number is converted into 4 sets of letters or numbers, which is the "Product ID" shown in the "System Properties". The second group is the "OEM" one, which is the serial number (CD-KEY) of the OEM version. From now on, the product ID replaces the CD-KEY , and the installer generates an OEM certificate for the OEM version of the installation . + +2. The information in the BIOS got loaded into RAM every time system boots. + +3. After logging into the Windows Vista, OS calls SLP service to check the licensed rights of running product, especially the activation status. It starts to identify the licensing status of the system based on the product ID. If no product ID is detected or no valid retail version product ID is detected, it is considered as inactivated. If a valid retail version product ID is detected, it is considered successfully activated. If an OEM version of the product ID is detected, continue with the OEM verification. + +4. If the OEM product ID is detected, the OEM verification process starts, and it will check the installed OEM certificate is valid. It mainly uses the SLIC public key from BIOS which is loaded into the RAM, to verify the digital signature of product certificate . If validation failed, it is considered as inactivated. + +5. Verify the OEM ID field between SLIC and RSDT (Root System Description Table), and compare the OEM ID field and OEM Table ID fields between SLIC and XSDT (Extended System Description Table). If they didn't match, it is considered as inactivated. + +6. After the above hurdles, the OEM license will be considered as activated. If not then fallback to inactivated and continue with normal procedure, like require user to activate the Windows. + +### Windows 7 (SLP 2.1) + +Windows 7 still retains the OEM activation policy, but using SLP 2.1 instead. + +Here is more detailed verification process: + +1. After the activation process starts, if the correct SLP Key is detected, the OEM activation process starts, otherwise the WPA activation (online or telephone activation) is performed. + +2. Detect the OEM certificate , and use the digital signature inside the OEM certificate to validate the it (Microsoft used their private key to sign the OEM certificate, and verified against the public key), if verified then continue on OEM activation process, otherwise continue on WPA activation process. + +3. Compare the OEM public key, OEM ID and various fields with the information presented in the OEM certificate . If they match (this means OEM public key and etc. are correct), then continue on OEM activation process, otherwise continue on WPA activation process. + +4. Use OEM public key verify against the digital signature of the Marker inside SLIC. if verified (this means the Message in the Marker is correct. ) then continue on OEM activation process, otherwise continue on WPA activation process. + +5. Verify the Windows Logo inside the Marker. If the Windows Logo is present, then continue on OEM activation process, otherwise continue on WPA activation process. + +6. Verify the version of Marker. If it's at least `0x20001` then continue on OEM activation process, otherwise OEM activation failed, and continue on WPA activation process. + +7. Compare the OEM ID and OEM Table ID against all corresponding ACPI table headers. If they match, then OEM activation completed successfully, otherwise continue on WPA activation process. + +Key points (Not containing all details, this info is only there to emphasize the key points of Microsoft encryption): + +1. OEM certificate contains + - Data (OEM ID and other information, Microsoft public key, etc.) + - Hash (Hash of data) + - Signature (Hash were signed with Microsoft private key) + +2. SLIC contains: + - Data (OEM ID, Marker version, etc., Microsoft public key, etc.) + - Hash (Hash the data) + - Signature (Hash were signed with Microsoft private key) + +3. First, use the public key to verify whether the signatures of OEM and SLIC, then, compare the OEM ID, public key and other information in OEM and SLIC to see whether they are the same; verify the Marker version is matching the type of system currently installed. + +* * * +Oh boy what a mess... + +This source is from CSDN.net, and this is a known "copy paste and profit" site that infamous in China. + +This article is old enough that the author is actually had integrity and cited all the actual juicy sources. However, all the actual juicy sources were long gone, because the BBS that the author cited is down,only unusable archives were left (reported by discord member @itsmefeng ). + +This article isn't providing enough information on how to crack the Windows Vista/7 activation process. We may need more actual good sources for this. + +For better understanding I provided some comment (as HTML comments for Markdown compatibility). Hopefully it will be useful. + +-- Some Anonymous Person diff --git a/src/cli.cpp b/src/cli.cpp index 4887293..df1dd53 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -21,18 +21,21 @@ */ #include "cli.h" -#include "confid.h" -#include "BINK1998.h" -#include "BINK2002.h" bool CLI::loadJSON(const fs::path& filename, json *output) { - if (!fs::exists(filename)) { + if (!filename.empty() && !fs::exists(filename)) { fmt::print("ERROR: File {} does not exist\n", filename.string()); return false; } - - std::ifstream f(filename); - *output = json::parse(f, nullptr, false, false); + else if (fs::exists(filename)) { + std::ifstream f(filename); + *output = json::parse(f, nullptr, false, false); + } + else if (filename.empty()) { + cmrc::embedded_filesystem fs = cmrc::umskt::get_filesystem(); + cmrc::file keys = fs.open("keys.json"); + *output = json::parse(keys, nullptr, false, false); + } if (output->is_discarded()) { fmt::print("ERROR: Unable to parse keys from {}\n", filename.string()); @@ -48,39 +51,40 @@ void CLI::showHelp(char *argv[]) { fmt::print("\t-h --help\tshow this message\n"); fmt::print("\t-v --verbose\tenable verbose output\n"); fmt::print("\t-n --number\tnumber of keys to generate (defaults to 1)\n"); - fmt::print("\t-f --file\tspecify which keys file to load (defaults to keys.json)\n"); + fmt::print("\t-f --file\tspecify which keys file to load\n"); fmt::print("\t-i --instid\tinstallation ID used to generate confirmation ID\n"); fmt::print("\t-b --binkid\tspecify which BINK identifier to load (defaults to 2E)\n"); fmt::print("\t-l --list\tshow which products/binks can be loaded\n"); fmt::print("\t-c --channelid\tspecify which Channel Identifier to use (defaults to 640)\n"); fmt::print("\t-s --serial\tspecifies a serial to use in the product ID (defaults to random, BINK1998 only)\n"); fmt::print("\t-V --validate\tproduct key to validate signature\n"); - fmt::print("\n\n"); + fmt::print("\n"); } int CLI::parseCommandLine(int argc, char* argv[], Options* options) { + // set default options *options = Options { "2E", - "keys.json", + "", "", "", 640, - false, 0, 1, false, false, false, false, + false, MODE_BINK1998_GENERATE }; - // set default options for (int i = 1; i < argc; i++) { std::string arg = argv[i]; if (arg == "-v" || arg == "--verbose") { options->verbose = true; + UMSKT::setDebugOutput(stderr); } else if (arg == "-h" || arg == "--help") { options->help = true; } else if (arg == "-n" || arg == "--number") { @@ -168,8 +172,20 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { } int CLI::validateCommandLine(Options* options, char *argv[], json *keys) { + if (options->help || options->error) { + if (options->error) { + fmt::print("error parsing command line options\n"); + } + showHelp(argv); + return 1; + } + if (options->verbose) { - fmt::print("Loading keys file {}\n", options->keysFilename); + if(options->keysFilename.empty()) { + fmt::print("Loading internal keys file\n"); + } else { + fmt::print("Loading keys file {}\n", options->keysFilename); + } } if (!loadJSON(options->keysFilename, keys)) { @@ -177,15 +193,11 @@ int CLI::validateCommandLine(Options* options, char *argv[], json *keys) { } if (options->verbose) { - fmt::print("Loaded keys from {} successfully\n",options->keysFilename); - } - - if (options->help || options->error) { - if (options->error) { - fmt::print("error parsing command line options\n"); + if(options->keysFilename.empty()) { + fmt::print("Loaded internal keys file successfully\n"); + } else { + fmt::print("Loaded keys from {} successfully\n",options->keysFilename); } - showHelp(argv); - return 1; } if (options->list) { @@ -223,8 +235,7 @@ int CLI::validateCommandLine(Options* options, char *argv[], json *keys) { return 0; } -void CLI::printID(DWORD *pid) -{ +void CLI::printID(DWORD *pid) { char raw[12]; char b[6], c[8]; int i, digit = 0; @@ -276,8 +287,8 @@ bool CLI::stripKey(const char *in_key, char out_key[PK_LENGTH]) { if (i >= PK_LENGTH) return false; // convert to uppercase - if character allowed, copy into array - for (int j = 0; j < strlen(pKeyCharset); j++) { - if (toupper(*p) == pKeyCharset[j]) { + for (int j = 0; j < strlen(PIDGEN3::pKeyCharset); j++) { + if (toupper(*p) == PIDGEN3::pKeyCharset[j]) { out_key[i++] = toupper(*p); continue; } @@ -321,7 +332,8 @@ CLI::CLI(Options options, json keys) { fmt::print("\n"); } - eCurve = initializeEllipticCurve( + + eCurve = PIDGEN3::initializeEllipticCurve( this->keys["BINK"][this->BINKID]["p"].get(), this->keys["BINK"][this->BINKID]["a"].get(), this->keys["BINK"][this->BINKID]["b"].get(), @@ -371,9 +383,9 @@ int CLI::BINK1998Generate() { bool bUpgrade = false; for (int i = 0; i < this->total; i++) { - BINK1998::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, nRaw, bUpgrade, this->pKey); + PIDGEN3::BINK1998::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, nRaw, bUpgrade, this->pKey); - bool isValid = BINK1998::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); + bool isValid = PIDGEN3::BINK1998::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); if (isValid) { CLI::printKey(this->pKey); if (i < this->total - 1 || this->options.verbose) { @@ -420,11 +432,11 @@ int CLI::BINK2002Generate() { fmt::print("> AuthInfo: {}\n", pAuthInfo); } - BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, false, this->pKey); + PIDGEN3::BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, false, this->pKey); CLI::printKey(this->pKey); fmt::print("\n"); - bool isValid = BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); + bool isValid = PIDGEN3::BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); if (isValid) { CLI::printKey(this->pKey); if (i < this->total - 1 || this->options.verbose) { @@ -464,7 +476,7 @@ int CLI::BINK1998Validate() { CLI::printKey(product_key); fmt::print("\n"); - if (!BINK1998::Verify(this->eCurve, this->genPoint, this->pubPoint, product_key)) { + if (!PIDGEN3::BINK1998::Verify(this->eCurve, this->genPoint, this->pubPoint, product_key)) { fmt::print("ERROR: Product key is invalid! Wrong BINK ID?\n"); return 1; } @@ -483,7 +495,7 @@ int CLI::BINK2002Validate() { CLI::printKey(product_key); fmt::print("\n"); - if (!BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, product_key)) { + if (!PIDGEN3::BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, product_key)) { fmt::print("ERROR: Product key is invalid! Wrong BINK ID?\n"); return 1; } diff --git a/src/cli.h b/src/cli.h index 2a14ee9..9c8c5c0 100644 --- a/src/cli.h +++ b/src/cli.h @@ -25,6 +25,42 @@ #include "header.h" +#include + +#include "libumskt/libumskt.h" +#include "libumskt/pidgen2/PIDGEN2.h" +#include "libumskt/pidgen3/PIDGEN3.h" +#include "libumskt/pidgen3/BINK1998.h" +#include "libumskt/pidgen3/BINK2002.h" +#include "libumskt/confid/confid.h" + +CMRC_DECLARE(umskt); + +enum MODE { + MODE_BINK1998_GENERATE = 0, + MODE_BINK2002_GENERATE = 1, + MODE_CONFIRMATION_ID = 2, + MODE_BINK1998_VALIDATE = 3, + MODE_BINK2002_VALIDATE = 4, +}; + +struct Options { + std::string binkid; + std::string keysFilename; + std::string instid; + std::string keyToCheck; + int channelID; + int serial; + int numKeys; + bool serialSet; + bool verbose; + bool help; + bool error; + bool list; + + MODE applicationMode; +}; + class CLI { Options options; json keys; diff --git a/src/header.h b/src/header.h index 10cbe93..9600584 100644 --- a/src/header.h +++ b/src/header.h @@ -23,18 +23,8 @@ #ifndef UMSKT_HEADER_H #define UMSKT_HEADER_H -#ifdef DEBUG -#include -#else -#define assert(x) /* nothing */ -#endif +#include "typedefs.h" -#include -#include -#include -#include - -#include #include #include #include @@ -45,95 +35,7 @@ #include #include -#include -#include -#include -#include -#include - -// Algorithm macros -#define PK_LENGTH 25 -#define NULL_TERMINATOR 1 - -#define FIELD_BITS 384 -#define FIELD_BYTES 48 -#define FIELD_BITS_2003 512 -#define FIELD_BYTES_2003 64 - -#define SHA_MSG_LENGTH_XP (4 + 2 * FIELD_BYTES) -#define SHA_MSG_LENGTH_2003 (3 + 2 * FIELD_BYTES_2003) - -#define NEXTSNBITS(field, n, offset) (((QWORD)(field) >> (offset)) & ((1ULL << (n)) - 1)) -#define FIRSTNBITS(field, n) NEXTSNBITS((field), (n), 0) - -#define HIBYTES(field, bytes) NEXTSNBITS((QWORD)(field), ((bytes) * 8), ((bytes) * 8)) -#define LOBYTES(field, bytes) FIRSTNBITS((QWORD)(field), ((bytes) * 8)) - -#define BYDWORD(n) (DWORD)(*((n) + 0) | *((n) + 1) << 8 | *((n) + 2) << 16 | *((n) + 3) << 24) -#define BITMASK(n) ((1ULL << (n)) - 1) - using json = nlohmann::json; namespace fs = std::filesystem; -enum MODE { - MODE_BINK1998_GENERATE = 0, - MODE_BINK2002_GENERATE = 1, - MODE_CONFIRMATION_ID = 2, - MODE_BINK1998_VALIDATE = 3, - MODE_BINK2002_VALIDATE = 4, -}; - -struct Options { - std::string binkid; - std::string keysFilename; - std::string instid; - std::string keyToCheck; - int channelID; - bool serialSet; - int serial; - int numKeys; - bool verbose; - bool help; - bool error; - bool list; - - MODE applicationMode; -}; - -// Type definitions -typedef bool BOOL; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef uint64_t QWORD; - -#ifdef __SIZEOF_INT128__ -typedef unsigned __int128 OWORD; -#endif - -// Global variables -extern Options options; - -// util.cpp -int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen); // Hello OpenSSL developers, please tell me, where is this function at? -void endian(BYTE *data, int length); - -EC_GROUP *initializeEllipticCurve( - std::string pSel, - std::string aSel, - std::string bSel, - std::string generatorXSel, - std::string generatorYSel, - std::string publicKeyXSel, - std::string publicKeyYSel, - EC_POINT *&genPoint, - EC_POINT *&pubPoint -); - -// key.cpp -extern char pKeyCharset[]; -void unbase24(BYTE *byteSeq, const char *cdKey); -void base24(char *cdKey, BYTE *byteSeq); - - #endif //UMSKT_HEADER_H diff --git a/src/confid.cpp b/src/libumskt/confid/confid.cpp similarity index 99% rename from src/confid.cpp rename to src/libumskt/confid/confid.cpp index 13acae9..b2a822c 100644 --- a/src/confid.cpp +++ b/src/libumskt/confid/confid.cpp @@ -62,7 +62,7 @@ inline QWORD ConfirmationID::__umul128(QWORD a, QWORD b, QWORD* hi) #else #define __umul128 _umul128 #endif -#elif defined(__i386__) || defined(_M_IX86) || defined(__arm__) +#elif defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(__EMSCRIPTEN__) inline QWORD ConfirmationID::__umul128(QWORD multiplier, QWORD multiplicand, QWORD *product_hi) { // multiplier = ab = a * 2^32 + b // multiplicand = cd = c * 2^32 + d @@ -87,6 +87,8 @@ inline QWORD ConfirmationID::__umul128(QWORD multiplier, QWORD multiplicand, QWO return product_lo; } +#else +#error Unknown architecture detected - please edit confid.cpp to tailor __umul128() your architecture #endif QWORD ConfirmationID::ui128_quotient_mod(QWORD lo, QWORD hi) diff --git a/src/confid.h b/src/libumskt/confid/confid.h similarity index 96% rename from src/confid.h rename to src/libumskt/confid/confid.h index 310adae..f96b9cb 100644 --- a/src/confid.h +++ b/src/libumskt/confid/confid.h @@ -23,7 +23,7 @@ #ifndef UMSKT_CONFID_H #define UMSKT_CONFID_H -#include "header.h" +#include "../libumskt.h" // Confirmation ID generator constants #define SUCCESS 0 @@ -40,7 +40,7 @@ typedef struct { QWORD v[2]; } TDivisor; -class ConfirmationID { +EXPORT class ConfirmationID { static QWORD residue_add(QWORD x, QWORD y); static QWORD residue_sub(QWORD x, QWORD y); static QWORD __umul128(QWORD a, QWORD b, QWORD* hi); @@ -65,7 +65,7 @@ class ConfirmationID { public: static int Generate(const char* installation_id_str, char confirmation_id[49]); - static int CLIRun(); + //EXPORT static int CLIRun(); }; #endif //UMSKT_CONFID_H diff --git a/src/libumskt/debugoutput.cpp b/src/libumskt/debugoutput.cpp new file mode 100644 index 0000000..3d0b95a --- /dev/null +++ b/src/libumskt/debugoutput.cpp @@ -0,0 +1,35 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 6/25/2023 + * @Maintainer Neo + */ + +#include "libumskt.h" + + +#ifdef _WIN32 +std::FILE* UMSKT::debug = std::fopen("NUL:", "w"); +#else +std::FILE* UMSKT::debug = std::fopen("/dev/null", "w"); +#endif + + +void UMSKT::setDebugOutput(std::FILE* input) { + debug = input; +} diff --git a/src/libumskt/libumskt.cpp b/src/libumskt/libumskt.cpp new file mode 100644 index 0000000..48d79b5 --- /dev/null +++ b/src/libumskt/libumskt.cpp @@ -0,0 +1,60 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 6/25/2023 + * @Maintainer Neo + */ + +#include "libumskt.h" +#include "confid/confid.h" +#include "pidgen3/PIDGEN3.h" +#include "pidgen3/BINK1998.h" +#include "pidgen3/BINK2002.h" +#include "pidgen2/PIDGEN2.h" + +FNEXPORT int ConfirmationID_Generate(const char* installation_id_str, char confirmation_id[49]) { + return ConfirmationID::Generate(installation_id_str, confirmation_id); +} + +FNEXPORT EC_GROUP* PIDGEN3_initializeEllipticCurve(char* pSel, char* aSel, char* bSel, char* generatorXSel, char* generatorYSel, char* publicKeyXSel, char* publicKeyYSel, EC_POINT *&genPoint, EC_POINT *&pubPoint) { + return PIDGEN3::initializeEllipticCurve(pSel, aSel, bSel, generatorXSel, generatorYSel, publicKeyXSel, publicKeyYSel, genPoint, pubPoint); +} + +FNEXPORT bool PIDGEN3_BINK1998_Verify(EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&pKey)[25]) { + return PIDGEN3::BINK1998::Verify(eCurve, basePoint, publicKey, pKey); +} + +FNEXPORT void PIDGEN3_BINK1998_Generate(EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, BIGNUM *privateKey, DWORD pSerial, BOOL pUpgrade,char (&pKey)[25]) { + return PIDGEN3::BINK1998::Generate(eCurve, basePoint, genOrder, privateKey, pSerial, pUpgrade, pKey); +} + +FNEXPORT bool PIDGEN3_BINK2002_Verify(EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&cdKey)[25]) { + return PIDGEN3::BINK2002::Verify(eCurve, basePoint, publicKey, cdKey); +} + +FNEXPORT void PIDGEN3_BINK2002_Generate(EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, BIGNUM *privateKey, DWORD pChannelID, DWORD pAuthInfo, BOOL pUpgrade, char (&pKey)[25]) { + return PIDGEN3::BINK2002::Generate(eCurve, basePoint, genOrder, privateKey, pChannelID, pAuthInfo, pUpgrade, pKey); +} + +FNEXPORT int PIDGEN2_GenerateRetail(char* channelID, char* &keyout) { + return PIDGEN2::GenerateRetail(channelID, keyout); +} + +FNEXPORT int PIDGEN2_GenerateOEM(char* year, char* day, char* oem, char* keyout) { + return PIDGEN2::GenerateOEM(year, day, oem, keyout); +} \ No newline at end of file diff --git a/src/libumskt/libumskt.h b/src/libumskt/libumskt.h new file mode 100644 index 0000000..e01d768 --- /dev/null +++ b/src/libumskt/libumskt.h @@ -0,0 +1,73 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 6/24/2023 + * @Maintainer Neo + */ + +#ifndef UMSKT_LIBUMSKT_H +#define UMSKT_LIBUMSKT_H + +#include "../typedefs.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +// Algorithm macros +#define PK_LENGTH 25 +#define NULL_TERMINATOR 1 + +#define FIELD_BITS 384 +#define FIELD_BYTES 48 +#define FIELD_BITS_2003 512 +#define FIELD_BYTES_2003 64 + +#define SHA_MSG_LENGTH_XP (4 + 2 * FIELD_BYTES) +#define SHA_MSG_LENGTH_2003 (3 + 2 * FIELD_BYTES_2003) + +#define NEXTSNBITS(field, n, offset) (((QWORD)(field) >> (offset)) & ((1ULL << (n)) - 1)) +#define FIRSTNBITS(field, n) NEXTSNBITS((field), (n), 0) + +#define HIBYTES(field, bytes) NEXTSNBITS((QWORD)(field), ((bytes) * 8), ((bytes) * 8)) +#define LOBYTES(field, bytes) FIRSTNBITS((QWORD)(field), ((bytes) * 8)) + +#define BYDWORD(n) (DWORD)(*((n) + 0) | *((n) + 1) << 8 | *((n) + 2) << 16 | *((n) + 3) << 24) +#define BITMASK(n) ((1ULL << (n)) - 1) + +class UMSKT { +public: + static std::FILE* debug; + class PIDGEN2; + class PIDGEN3; + class ConfigurationID; + + static void setDebugOutput(std::FILE* input); +}; + + +#endif //UMSKT_LIBUMSKT_H diff --git a/src/libumskt/pidgen2/PIDGEN2.cpp b/src/libumskt/pidgen2/PIDGEN2.cpp new file mode 100644 index 0000000..6a3b59e --- /dev/null +++ b/src/libumskt/pidgen2/PIDGEN2.cpp @@ -0,0 +1,135 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 06/17/2023 + * @Maintainer Neo + */ + +#include "PIDGEN2.h" + +const char* channelIDBlacklist [7] = {"333", "444", "555", "666", "777", "888", "999"}; +const char* validYears[8] = { "95", "96", "97", "98", "99", "00", "01", "02"}; + +bool PIDGEN2::isNumericString(char* input) { + for(int i = 0; i < strlen(input); i++) { + if (input[i] < '0' || input[i] > '9') { + return false; + } + } + + return true; +} + +int PIDGEN2::addDigits(char* input) { + int output = 0; + + if (!isNumericString(input)) { + return -1; + } + + for(int i = 0; i < strlen(input); i++) { + output += input[i] - '0'; + } + + return output; +} + +bool PIDGEN2::isValidChannelID(char* channelID) { + if (strlen(channelID) > 3) { + return false; + } + + for (int i = 0; i <= 6; i++) { + if (strcmp(channelID, channelIDBlacklist[i]) != 0) { + return false; + } + } + + return true; +} + +bool PIDGEN2::isValidOEMID(char* OEMID) { + if (!isNumericString(OEMID)) { + return false; + } + + if (strlen(OEMID) > 5) { + if (OEMID[0] != '0' || OEMID[1] != '0') { + return false; + } + } + + int mod = addDigits(OEMID); + + return (mod % 21 == 0); +} + +bool PIDGEN2::isValidYear(char* year) { + for (int i = 0; i <= 7; i++) { + if (year == validYears[i]) { + return false; + } + } + return true; +} + +bool PIDGEN2::isValidDay(char* day) { + if (!isNumericString(day)) { + return false; + } + + int iDay = std::stoi(day); + if (iDay == 0 || iDay >= 365) { + return false; + } + return true; +} + +bool PIDGEN2::isValidRetailProductID(char* productID) { + return true; +} + +int PIDGEN2::GenerateRetail(char* channelID, char* &keyout) { + if (!isValidChannelID(channelID)) { + return 1; + } + + return 0; +} + +int PIDGEN2::GenerateOEM(char* year, char* day, char* oem, char* &keyout) { + if (!isValidOEMID(oem)) { + int mod = addDigits(oem); + mod += mod % 21; + + strcpy(oem, fmt::format("{:07d}", mod).c_str()); + } + + if (!isValidYear(year)) { + strcpy(year, validYears[0]); + } + + if (!isValidDay(day)) { + int iday = std::stoi(day); + iday = (iday + 1) % 365; + } + + strcpy(keyout, fmt::format("{}{}-OEM-{}-{}", year, day, oem, oem).c_str()); + + return 0; +} \ No newline at end of file diff --git a/src/libumskt/pidgen2/PIDGEN2.h b/src/libumskt/pidgen2/PIDGEN2.h new file mode 100644 index 0000000..a59ae4c --- /dev/null +++ b/src/libumskt/pidgen2/PIDGEN2.h @@ -0,0 +1,41 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 06/17/2023 + * @Maintainer Neo + */ + +#ifndef UMSKT_PIDGEN2_H +#define UMSKT_PIDGEN2_H + +#include "../libumskt.h" + +EXPORT class PIDGEN2 { +public: + static bool isNumericString(char* input); + static bool isValidChannelID(char* channelID); + static bool isValidOEMID(char* OEMID); + static bool isValidYear(char* year); + static bool isValidDay(char* day); + static bool isValidRetailProductID(char* productID); + static int addDigits(char* input); + static int GenerateRetail(char* channelID, char* &keyout); + static int GenerateOEM(char* year, char* day, char* oem, char* &keyout); +}; + +#endif //UMSKT_PIDGEN2_H diff --git a/src/BINK1998.cpp b/src/libumskt/pidgen3/BINK1998.cpp similarity index 89% rename from src/BINK1998.cpp rename to src/libumskt/pidgen3/BINK1998.cpp index cda5a9d..dc40cbb 100644 --- a/src/BINK1998.cpp +++ b/src/libumskt/pidgen3/BINK1998.cpp @@ -30,7 +30,7 @@ #include "BINK1998.h" /* Unpacks a Windows XP-like Product Key. */ -void BINK1998::Unpack( +void PIDGEN3::BINK1998::Unpack( QWORD (&pRaw)[2], BOOL &pUpgrade, DWORD &pSerial, @@ -54,7 +54,7 @@ void BINK1998::Unpack( } /* Packs a Windows XP-like Product Key. */ -void BINK1998::Pack( +void PIDGEN3::BINK1998::Pack( QWORD (&pRaw)[2], BOOL pUpgrade, DWORD pSerial, @@ -71,7 +71,7 @@ void BINK1998::Pack( } /* Verifies a Windows XP-like Product Key. */ -bool BINK1998::Verify( +bool PIDGEN3::BINK1998::Verify( EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, @@ -89,19 +89,17 @@ bool BINK1998::Verify( BOOL pUpgrade; // Convert Base24 CD-key to bytecode. - unbase24((BYTE *)pRaw, pKey); + PIDGEN3::unbase24((BYTE *)pRaw, pKey); // Extract RPK, hash and signature from bytecode. Unpack(pRaw, pUpgrade, pSerial, pHash, pSignature); - if (options.verbose) { - fmt::print("Validation results:\n"); - fmt::print(" Upgrade: 0x{:08x}\n", pUpgrade); - fmt::print(" Serial: 0x{:08x}\n", pSerial); - fmt::print(" Hash: 0x{:08x}\n", pHash); - fmt::print(" Signature: 0x{:08x}\n", pSignature); - fmt::print("\n"); - } + fmt::print(UMSKT::debug, "Validation results:\n"); + fmt::print(UMSKT::debug, " Upgrade: 0x{:08x}\n", pUpgrade); + fmt::print(UMSKT::debug, " Serial: 0x{:08x}\n", pSerial); + fmt::print(UMSKT::debug, " Hash: 0x{:08x}\n", pHash); + fmt::print(UMSKT::debug, " Signature: 0x{:08x}\n", pSignature); + fmt::print(UMSKT::debug, "\n"); pData = pSerial << 1 | pUpgrade; @@ -177,7 +175,7 @@ bool BINK1998::Verify( } /* Generates a Windows XP-like Product Key. */ -void BINK1998::Generate( +void PIDGEN3::BINK1998::Generate( EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, @@ -266,14 +264,12 @@ void BINK1998::Generate( // Pack product key. Pack(pRaw, pUpgrade, pSerial, pHash, pSignature); - if (options.verbose) { - fmt::print("Generation results:\n"); - fmt::print(" Upgrade: 0x{:08x}\n", pUpgrade); - fmt::print(" Serial: 0x{:08x}\n", pSerial); - fmt::print(" Hash: 0x{:08x}\n", pHash); - fmt::print(" Signature: 0x{:08x}\n", pSignature); - fmt::print("\n"); - } + fmt::print(UMSKT::debug, "Generation results:\n"); + fmt::print(UMSKT::debug, " Upgrade: 0x{:08x}\n", pUpgrade); + fmt::print(UMSKT::debug, " Serial: 0x{:08x}\n", pSerial); + fmt::print(UMSKT::debug, " Hash: 0x{:08x}\n", pHash); + fmt::print(UMSKT::debug, " Signature: 0x{:08x}\n", pSignature); + fmt::print(UMSKT::debug, "\n"); EC_POINT_free(r); } while (pSignature > BITMASK(55)); @@ -290,4 +286,4 @@ void BINK1998::Generate( BN_free(y); BN_CTX_free(numContext); -} \ No newline at end of file +} diff --git a/src/BINK1998.h b/src/libumskt/pidgen3/BINK1998.h similarity index 96% rename from src/BINK1998.h rename to src/libumskt/pidgen3/BINK1998.h index f1a30b8..0260f60 100644 --- a/src/BINK1998.h +++ b/src/libumskt/pidgen3/BINK1998.h @@ -23,9 +23,10 @@ #ifndef UMSKT_BINK1998_H #define UMSKT_BINK1998_H -#include "header.h" +#include "PIDGEN3.h" -class BINK1998 { +EXPORT class PIDGEN3::BINK1998 { +public: static void Unpack( QWORD (&pRaw)[2], BOOL &pUpgrade, @@ -33,6 +34,7 @@ class BINK1998 { DWORD &pHash, QWORD &pSignature ); + static void Pack( QWORD (&pRaw)[2], BOOL pUpgrade, @@ -41,13 +43,13 @@ class BINK1998 { QWORD pSignature ); -public: static bool Verify( EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&pKey)[25] ); + static void Generate( EC_GROUP *eCurve, EC_POINT *basePoint, diff --git a/src/BINK2002.cpp b/src/libumskt/pidgen3/BINK2002.cpp similarity index 92% rename from src/BINK2002.cpp rename to src/libumskt/pidgen3/BINK2002.cpp index 80124ad..2246f97 100644 --- a/src/BINK2002.cpp +++ b/src/libumskt/pidgen3/BINK2002.cpp @@ -30,7 +30,7 @@ #include "BINK2002.h" /* Unpacks a Windows Server 2003-like Product Key. */ -void BINK2002::Unpack( +void PIDGEN3::BINK2002::Unpack( QWORD (&pRaw)[2], BOOL &pUpgrade, DWORD &pChannelID, @@ -60,7 +60,7 @@ void BINK2002::Unpack( } /* Packs a Windows Server 2003-like Product Key. */ -void BINK2002::Pack( +void PIDGEN3::BINK2002::Pack( QWORD (&pRaw)[2], BOOL pUpgrade, DWORD pChannelID, @@ -74,7 +74,7 @@ void BINK2002::Pack( } /* Verifies a Windows Server 2003-like Product Key. */ -bool BINK2002::Verify( +bool PIDGEN3::BINK2002::Verify( EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, @@ -100,15 +100,13 @@ bool BINK2002::Verify( pData = pChannelID << 1 | pUpgrade; - if (options.verbose) { - fmt::print("Validation results:\n"); - fmt::print(" Upgrade: 0x{:08x}\n", pUpgrade); - fmt::print("Channel ID: 0x{:08x}\n", pChannelID); - fmt::print(" Hash: 0x{:08x}\n", pHash); - fmt::print(" Signature: 0x{:08x}\n", pSignature); - fmt::print(" AuthInfo: 0x{:08x}\n", pAuthInfo); - fmt::print("\n"); - } + fmt::print(UMSKT::debug, "Validation results:\n"); + fmt::print(UMSKT::debug, " Upgrade: 0x{:08x}\n", pUpgrade); + fmt::print(UMSKT::debug, "Channel ID: 0x{:08x}\n", pChannelID); + fmt::print(UMSKT::debug, " Hash: 0x{:08x}\n", pHash); + fmt::print(UMSKT::debug, " Signature: 0x{:08x}\n", pSignature); + fmt::print(UMSKT::debug, " AuthInfo: 0x{:08x}\n", pAuthInfo); + fmt::print(UMSKT::debug, "\n"); BYTE msgDigest[SHA_DIGEST_LENGTH]{}, msgBuffer[SHA_MSG_LENGTH_2003]{}, @@ -208,7 +206,7 @@ bool BINK2002::Verify( } /* Generates a Windows Server 2003-like Product Key. */ -void BINK2002::Generate( +void PIDGEN3::BINK2002::Generate( EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, @@ -361,15 +359,13 @@ void BINK2002::Generate( // Pack product key. Pack(pRaw, pUpgrade, pChannelID, pHash, pSignature, pAuthInfo); - if (options.verbose) { - fmt::print("Generation results:\n"); - fmt::print(" Upgrade: 0x{:08x}\n", pUpgrade); - fmt::print("Channel ID: 0x{:08x}\n", pChannelID); - fmt::print(" Hash: 0x{:08x}\n", pHash); - fmt::print(" Signature: 0x{:08x}\n", pSignature); - fmt::print(" AuthInfo: 0x{:08x}\n", pAuthInfo); - fmt::print("\n"); - } + fmt::print(UMSKT::debug, "Generation results:\n"); + fmt::print(UMSKT::debug, " Upgrade: 0x{:08x}\n", pUpgrade); + fmt::print(UMSKT::debug, "Channel ID: 0x{:08x}\n", pChannelID); + fmt::print(UMSKT::debug, " Hash: 0x{:08x}\n", pHash); + fmt::print(UMSKT::debug, " Signature: 0x{:08x}\n", pSignature); + fmt::print(UMSKT::debug, " AuthInfo: 0x{:08x}\n", pAuthInfo); + fmt::print(UMSKT::debug, "\n"); EC_POINT_free(r); } while (pSignature > BITMASK(62) || noSquare); @@ -387,4 +383,4 @@ void BINK2002::Generate( BN_free(e); BN_CTX_free(numContext); -} \ No newline at end of file +} diff --git a/src/BINK2002.h b/src/libumskt/pidgen3/BINK2002.h similarity index 96% rename from src/BINK2002.h rename to src/libumskt/pidgen3/BINK2002.h index 6183d06..75a0e7d 100644 --- a/src/BINK2002.h +++ b/src/libumskt/pidgen3/BINK2002.h @@ -23,9 +23,10 @@ #ifndef UMSKT_BINK2002_H #define UMSKT_BINK2002_H -#include "header.h" +#include "PIDGEN3.h" -class BINK2002 { +EXPORT class PIDGEN3::BINK2002 { +public: static void Unpack( QWORD (&pRaw)[2], BOOL &pUpgrade, @@ -34,6 +35,7 @@ class BINK2002 { QWORD &pSignature, DWORD &pAuthInfo ); + static void Pack( QWORD (&pRaw)[2], BOOL pUpgrade, @@ -43,13 +45,13 @@ class BINK2002 { DWORD pAuthInfo ); -public: static bool Verify( EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&cdKey)[25] ); + static void Generate( EC_GROUP *eCurve, EC_POINT *basePoint, diff --git a/src/libumskt/pidgen3/PIDGEN3.h b/src/libumskt/pidgen3/PIDGEN3.h new file mode 100644 index 0000000..6f77de1 --- /dev/null +++ b/src/libumskt/pidgen3/PIDGEN3.h @@ -0,0 +1,54 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 6/24/2023 + * @Maintainer Neo + */ + +#ifndef UMSKT_PIDGEN3_H +#define UMSKT_PIDGEN3_H + +#include "../libumskt.h" + +class PIDGEN3 { +public: + class BINK1998; + class BINK2002; + + // util.cpp + static int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen); // Hello OpenSSL developers, please tell me, where is this function at? + static void endian(BYTE *data, int length); + static EC_GROUP* initializeEllipticCurve( + std::string pSel, + std::string aSel, + std::string bSel, + std::string generatorXSel, + std::string generatorYSel, + std::string publicKeyXSel, + std::string publicKeyYSel, + EC_POINT *&genPoint, + EC_POINT *&pubPoint + ); + + // key.cpp + static constexpr char pKeyCharset[] = "BCDFGHJKMPQRTVWXY2346789"; + static void unbase24(BYTE *byteSeq, const char *cdKey); + static void base24(char *cdKey, BYTE *byteSeq); +}; + +#endif //UMSKT_PIDGEN3_H diff --git a/src/key.cpp b/src/libumskt/pidgen3/key.cpp similarity index 91% rename from src/key.cpp rename to src/libumskt/pidgen3/key.cpp index 247d6ea..636669c 100644 --- a/src/key.cpp +++ b/src/libumskt/pidgen3/key.cpp @@ -20,13 +20,10 @@ * @Maintainer Andrew */ -#include "header.h" - -/* The allowed character set in a product key. */ -char pKeyCharset[] = "BCDFGHJKMPQRTVWXY2346789"; +#include "PIDGEN3.h" /* Converts from CD-key to a byte sequence. */ -void unbase24(BYTE *byteSeq, const char *cdKey) { +void PIDGEN3::unbase24(BYTE *byteSeq, const char *cdKey) { BYTE pDecodedKey[PK_LENGTH + NULL_TERMINATOR]{}; BIGNUM *y = BN_new(); @@ -63,7 +60,7 @@ void unbase24(BYTE *byteSeq, const char *cdKey) { } /* Converts from byte sequence to the CD-key. */ -void base24(char *cdKey, BYTE *byteSeq) { +void PIDGEN3::base24(char *cdKey, BYTE *byteSeq) { BYTE rbyteSeq[16]; BIGNUM *z; @@ -86,4 +83,4 @@ void base24(char *cdKey, BYTE *byteSeq) { cdKey[i] = pKeyCharset[BN_div_word(z, 24)]; BN_free(z); -} \ No newline at end of file +} diff --git a/src/util.cpp b/src/libumskt/pidgen3/util.cpp similarity index 95% rename from src/util.cpp rename to src/libumskt/pidgen3/util.cpp index dd36ead..b6aad7b 100644 --- a/src/util.cpp +++ b/src/libumskt/pidgen3/util.cpp @@ -20,7 +20,7 @@ * @Maintainer Andrew */ -#include "header.h" +#include "PIDGEN3.h" int randomRange() { return 4; // chosen by fair dice roll @@ -28,7 +28,7 @@ int randomRange() { } /* Convert data between endianness types. */ -void endian(BYTE *data, int length) { +void PIDGEN3::endian(BYTE *data, int length) { for (int i = 0; i < length / 2; i++) { BYTE temp = data[i]; data[i] = data[length - i - 1]; @@ -37,7 +37,7 @@ void endian(BYTE *data, int length) { } /* Initializes the elliptic curve. */ -EC_GROUP *initializeEllipticCurve( +EC_GROUP* PIDGEN3::initializeEllipticCurve( const std::string pSel, const std::string aSel, const std::string bSel, @@ -104,7 +104,7 @@ EC_GROUP *initializeEllipticCurve( return eCurve; } -int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen) { +int PIDGEN3::BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen) { if (a == nullptr || to == nullptr) return 0; @@ -117,4 +117,4 @@ int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen) { endian(to, tolen); return len; -} \ No newline at end of file +} diff --git a/src/typedefs.h b/src/typedefs.h new file mode 100644 index 0000000..b53787a --- /dev/null +++ b/src/typedefs.h @@ -0,0 +1,59 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 6/24/2023 + * @Maintainer Neo + */ + +#ifndef UMSKT_TYPEDEFS_H +#define UMSKT_TYPEDEFS_H + +#include +#include + +#ifdef DEBUG +#include +#else +#define assert(x) /* nothing */ +#endif + +#ifdef _MSC_VER +#define EXPORT extern "C" __declspec(dllexport) +#else +#define EXPORT extern "C" +#endif + +#ifdef __EMSCRIPTEN__ +#include +#define FNEXPORT EMSCRIPTEN_KEEPALIVE EXPORT +#else +#define FNEXPORT EXPORT +#endif + +// Type definitions +typedef bool BOOL; +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; +typedef uint64_t QWORD; + +#ifdef __SIZEOF_INT128__ +typedef unsigned __int128 OWORD; +#endif + +#endif //UMSKT_TYPEDEFS_H diff --git a/src/windows/dllmain.cpp b/src/windows/dllmain.cpp new file mode 100644 index 0000000..03d9ed3 --- /dev/null +++ b/src/windows/dllmain.cpp @@ -0,0 +1,46 @@ +/** + * This file is a part of the UMSKT Project + * + * Copyleft (C) 2019-2023 UMSKT Contributors (et.al.) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @FileCreated by Neo on 06/17/2023 + * @Maintainer Neo + */ + +#define WIN32_LEAN_AND_MEAN +#include +#include "resource.h" + +BOOLEAN WINAPI DllMain( IN HINSTANCE hDllHandle, + IN DWORD nReason, + IN LPVOID Reserved ) { + + BOOLEAN bSuccess = TRUE; + // Perform global initialization. + switch (nReason) { + case DLL_PROCESS_ATTACH: + // For optimization. + DisableThreadLibraryCalls(hDllHandle); + break; + + case DLL_PROCESS_DETACH: + break; + } + + return bSuccess; +} + +// end DllMain diff --git a/src/windows/icon.ico b/src/windows/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9f9598eb0fd5af55032b0f160da199ebd9366bf9 GIT binary patch literal 9662 zcmd5?3tW%q9{>NDVXYD79CpbZoY`g^m&05~+i@9l$!#=ZiYCq>K_p2`Lq# z zwLN&gmM|h@9x{i&Y7_4LhYlSYuwuoEg5cm_Y~H-NY|NN3*_=-Rf0H@LI{X#aKy7Sn zJlf9A?%s(LCvg4xbv$_R0Hvj+h>niNs8OS`$=i|WLcC7=<(h+oL#A+*mYbWa%pp5F zTRG=?lxb;c`I7WVqH!(A%UTJMLz))~uPjZQC|Q=8qmdLUM94TwPs} zlaqtfr%$6#pFXjC;kQIH;ze|*KF7U7v?sa}UlLyvJqU44GN)J76x;pbhaYkxBO_5( zR)(`@&%(vU1qB5KICA6&^z`%+__DEt&I`O$=GTIlta?+&S=F{jkgCU+NYy*-5AvEl zG3xQ}uWB7cR-L9ynR1Rci+lI(Av81;&d$z|wK#nEFnagy9mz3+32ox{n!4T$_lPD- z_M+9w!|3l5gJD65Xk)vlOx5u}@x1v*q8}kT^@p2{jm;Od-Rx7RPAPhml9Ga;pdhSY zzh05QpPwJvwQF~XFB(9+@d7VYzdq9=-1VnhsH6og&jD872R0M~om`GW)w*japD}@u zIP)U9_}o|8+S-0#Z*Q;YdR|^0l9H0(>FJ4GyLLg&9UUEoe-Izio%lWfQ;%cbetnv2 zsP)M-lsx8doKVGoSkO;U^)X1|7(*FH{9*p`jOELh@7l9x4<0^zh>VO3czAeV=gysq zFB1OEnl;8x-O`yO6z$bwLVJqdV7{!Z5`(Rp(vX2k-gsX0*hos`Hi6Ny(M ze?F&v|Ni|4&`%;WGgHz34I4H<^ybc;JCN%fv!0N2=6Ui`H#G8aZ(!)0_SS6AqA#|^ zBE1Zla=3(gQ;L(;H1cqRTbDk=)}r8sclfU+Lr$B%!&cUcmxh~MHbdZnc`*Z0DbkTfKg zSMeVfRD_RyypQiw%3+mVhzpT=09G0_wL25TelScR#sLJe;N`JBK+@gjO1^BBc8=ytv$(kgx1(q`?P0!7Yx`E z1*#4VkL01P{dMY52^OanqW*NZLf$Vi@RiA)&ysl5hk56rB} zBzB3vm_#%qp2@%Q_klk8ehK(7SFZ%V>{+>k%thjXPNP}g>t`HK z!%52B;0*B9fjsEirtr7`ORkkd$JD=6tk4u*> zDg3>?y_LK{)lVfPz9OE^9fW&ZVq}AVk6G8-Ee6NPe__1HJ_#Q>Uc$mF zz!!d(&|rvZILCD*Bv+|zQ+xw&`uk%D53wKNe?B}sT+tiJH@9!!uEbleiQ9Z5~<^<4sbu2zu6|4CF z|LjRe!y#sp`}HIm5VdLYo;E#u_Ov9=G$SLUj2=CD$U1rw_JlEg=OfXRh=>S?uFD!M zu(HEg8y^hXn83K1fe&nA%Cx$Sk~z2$(+J7wTekRbc;UvM%dxQt=;8{6e_yXWG&Mhk zLHlki{NJ@cjo04qxQyf9C93N#PoLXlY;zM6lK{zM&YU@efPesnBV}7QapJ`6&Ye4- z7x{{x7fAji{6BTPf-%PnF+HjR(;|Vd50=x9r=f}d%1l0U7qLiZr1hr30qG!Zd{1Yu z;je2OiFd8T6#p}5Uk>@X>f~0A%#}iC2(Sb zIW(|}eeH@VWOd{3ZXI6DKh#8C~7dV0{x< za0wW=w~GJYmqnoQqF}}U4-3jgqi-Bi$!P#lTiMH0>Pk){wkdmAk-e|4uM$sXP7-IO z$^J_6hWPk+tloE#KI0)4T?Nc8i{AX2zvzoq_RsX|h03_eVO9J)I2EG7JYVWrvf}?g z`Y{3Z+xM4!R%=51Uu|1MiAh(kTtRATDkL`$-zaq*u~*?N^^uB-3f#SWSD9yjw`_8% zWW1@8Yj^i&^LH+-n%~SAU|dKQ|K^rqXgJ@Wc3XdbVf-@K^ULi=?oc%!Sn_^LL9CSLrCse;Fn|MfM|-Q;L2If0>h9 zmo*UGx_$e$G7r72_nBi=U^z=Z=IKBWkDB~Nr|j-Q@i$NN|IjfWDkE3gZ2|OrAEDVy zpWEa%hR}H)$LIW}rjN7~o;PmXKvq_kvX_#)M)rlWFOm4PYSk)5uj~&bQP&^A_AX#e zv-s{p75D1$H;PWj&I(}LGvqJ!`wzQx#s7D3%7j+8(Pzo+TSAwR_*vT~{2e5(xq0)Z z;$y^ig}bbQ*aG7g7|#@RbG(jaH!74IUFINhRJd#ScXCNp8>ZfWdS#tQ$z0p;AQXQA;|=4s@- zgP2XUC2F%@QL`R$Ui|$1`}Y<7m)In^rQ|o_SLe?&M(V|r801+*y{W`H<^VE>zFsx? zcXLct<{HF$iW7Ct&}bGuGqHo|iFm|u9jq_@;{S!e#4^dBhwQ(HW>eg6*L|zGtV3;c zA2sWlDN_3r-y*(JbY6Ur)OAFM7A;x?eRB`WuR`%BQd<(gSzY$Zv3UUI&7F%gyf^Lm zafHwZ8_$`8&yCFS1#3|$)Th7<`Y9Slb^fw{>AfQx+P$avlfUFkwUPg8QnQiRBym=1 zuo7FV>(GuJJD|6<2!V{LH!1;%#&=7A`A2Kcq1W~j45rSA+}&8?x=cC5(w2;8&&H<) zra!-D?u{_&)5-K-^VhXJC;LT1qE>aP2@@u?kl0mHQi9^*VxkYf>}GR zVi@y-WX^%&2h|68#1`f{eYaK3L*xI)2Bc!*yhX4uGgJ77@_yD!%bI>RBIRA1czm*< zDu34KkLaUC<_g+M;@@D4m1I6D+Y!yg7S>__OHHlkNn-v?DF|L8p=(DvPPSKSL zcTNSjiL*S=-%~Sw*<=;L#Ks0LtgXb;mK?c9)-zd$mMdbE8c%io>EM)s`nsLhkh|m$ zwedYF`W`*0pGgf?@=eJTWF3l%ij;b+*o4NeW#4i>CK0m&iZCUx0%_Et8{|)wMm&!# znLlgtPs!h$_-#Xcm+(KaaU&+qG{M`Jr}3{%d7pfnki1RSK=KBuk!yUb*oWA-f8-qu+F1s_^h%_We=3ng_}^jO zk_W=ymFL1gjIkt^kmELMVimjB$iKV$9W)teCbb5sm)6E^g}yZP)TvV=vO-*dL_hd$ zUI~4D{p+kXL@!>v_~Ay%?KpjjyC5LIm%j|bG{JAOjRQRv8UV_%GTc6<%#zdRRlPCY1 zbFr206%vOxZQ6uGhYl%mLhR%6<;z%i;uaf~zf*+hQ==;I7c zZJy-+BL8073(#V+TO8jbd#;AWOSSL5`|e=sA*UzuXMI`rejbFx^p6Rtfk`c+&bV>o z^hS>!?L2bi$VAysif;-F3&WucS227?0c_(c6z(3(TgCUEW(*PjD;6%qM7Qu7{H0#l zuvNF0vRiU_(kS1l+Z_L^@Xw9(g^BSTspDMY053xJbW)F!xG1sZ1444GRxMk$?AX0~ z_t~tud9!YKjdDP*d7dy{>!ENz$8Q?R%%65L7R<7+sgXZ)+fs~HW}z=_w|sw%Hhuc^ zxN!gVG{hieMfk&f;Q~e8jl$q^$)+!lRz zwzESFb8v}Y9&6UXlz!BUwqQv^*W_;!1DX%DJjCa`tljd~Um9(=GvA#b|!)fz{-y_J&1-Z$mfICba^U{%(8jIA# z7^J2oDZVIK_WF#|ncUap(HG^?KV|S+KrnU2mi0K!>o(V8=|3%^zaHpYoIf+N43p26 zV9?$o)@dK2-HOERkGa20&R>J~(k>bxkS$j*T!@69(_O@vQ+nAmd8 zM?GRC^~Z;OI1y1D^soK~1_lm{8N*3Li;z9+pUMk3)elgq2u-i6oL8!`f}Do<++-^nEyXO&Ns8CN2`=I zV_z;S(odxl1Cc&odaI{;JU)NitDoxY@;rmL$#v=F{uk;s. + * + * @FileCreated by Neo on 6/17/2023 + * @Maintainer Neo + */ + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by umskt.rc +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/windows/umskt.rc b/src/windows/umskt.rc new file mode 100644 index 0000000000000000000000000000000000000000..df98e3002919733ef2d48bb3488224acb0265b71 GIT binary patch literal 4976 zcmdUzTTfzF6vx+dlYWO?eQ|ohYLhm-q^TmqkU=y9&WwqPL4=V8fq0weq*{nxgA$@jT^W`QwS$F6K>8M6W7$okCUy31^8UAwUvvkB*c z*_A__*rB!UCAWhe12M7R+3#_lFsCtCmD8!+Iqreu+G6h+H+St@+p!<*8=vjkckC50 z>*kmnH*j=eb7m9f;&lsZGpoSeh~H-`sOEA_oxgYdcI}$GN!lB5NZJgn;_KFB?b}c6 z-LW@k?6Egy6zrwnEOHZdCG806(zczy0F{YD55SY_VF--?Rzdc`m}_(9>uZ;+tmnG5 z&`7X7I2<_CgjJo{*jJKY7MP=-5&ZR7HGLFB28?)<#->Y{%x!qd-bIPOWZUO1t!}pO zX(rfn*NY_RBF&K1*uDm`&ph6jTz@!k+2TC7UCVNnc@zd&HrLgb<4<-FPWe!xDBqFB z?-)l88TDDFTXB3j&JTISD*H-HLn!68x^hmW9my*#2tvQNj3c+lh3kFp`X8Y85jx8G zh@KqmjWvj$7j}e&JKW#H)~Aebn7!iDy2H-T3*4e7uN1Am>$u3*5U-m;X~>zlj@~Sv zR|H8@vOvzoq1B*Kg?^;7XZ!Hebe_b8>>+!L#}=?{KCO?qC0^xq;Z^EW9Qd}##9}0-hRXKu{u;;%kul^XUZV~ z59xzb+L2Fw51t+SfnQ~K<@F+_L${5*QZ|ZtEMZ7++e@p7`#`l(Zd08}**e&3_A;c2 zIk0M9@dc#Hb7SIBexZAFFi2YIN!W&-Q=*56j;L=sPdzjNETR6 zNfUPgdnc|ZfYuaV>>R1f}lxnOmaC!f%$za8|s8Z!9#KC;)*Z_8Ke z8T75ryl2#un0;lxs4>w{UU>?QRT+Q7D{wjAY}gt3=M0aI)N?K$<4EtBr*QOd>1+~F z$}ur!B4066Kg>4|y)D^jJ+n*7qs1}cDeB0^%V;Ueke?R&DD_sio_W+iH}D(1Q`9@m z+12|iLv6^wJcpUY+W=)g!5c5Of##*lp{DnBFCN36%MYmF^lCRWH56;bBKKD5Bo?CAjy&6wfx6yjK>pVu$mXf7Rgs z(=+~hdtUM_jmi}RWY!CQbv=I=U+XPhIj)NTSx8m;<2yU$yZbf0+}R~vuD4De&!_RF K^>I~Pvi<`I4wDN2 literal 0 HcmV?d00001