Compare commits

..

No commits in common. "master" and "2023.08.06" have entirely different histories.

16 changed files with 487 additions and 452 deletions

View File

@ -10,44 +10,32 @@ jobs:
build:
runs-on: windows-latest
steps:
- name: Install v141_xp
uses: thepwrtank18/install-vs-components@v1.0.0
with:
components: Microsoft.VisualStudio.Component.WinXP
- name: Checkout Source Tree
uses: actions/checkout@v3
- name: Setup TDM-GCC
run: |
choco install 7zip --version 22.1 -y
Invoke-WebRequest -Uri 'https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe' -OutFile 'C:\Windows\temp\TDM-GCC-64.exe'
New-Item -ItemType Directory -Path 'C:\TDM-GCC-64'
Start-Process '7z' -ArgumentList 'e C:\Windows\temp\TDM-GCC-64.exe -oC:\TDM-GCC-64 -y' -Wait
Start-Process '7z' -ArgumentList 'e C:\TDM-GCC-64\*.tar.xz -oC:\TDM-GCC-64 -y' -Wait
Start-Process '7z' -ArgumentList 'x C:\TDM-GCC-64\*.tar -oC:\TDM-GCC-64 -y' -Wait
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
- name: Setup folder directories
run: |
mkdir build
mkdir build\x86
mkdir build\x64
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Build xpmgr (x86)
run: |
windres icon.rc -O coff -F pe-i386 -o build\x86\icon_x86.res -v
C:\TDM-GCC-64\bin\g++.exe -m32 -o build\x86\xpmgr_x86 xpmgr.cpp build\x86\icon_x86.res -lole32 -luuid -loleaut32 -v
run: msbuild xpmgr.vcxproj /P:Configuration=Release /P:Platform=Win32
- name: Build xpmgr (x64)
run: |
windres icon.rc -O coff -o build\x64\icon_x64.res -v
C:\TDM-GCC-64\bin\g++.exe -o build\x64\xpmgr_x64 xpmgr.cpp build\x64\icon_x64.res -lole32 -luuid -loleaut32 -v
run: msbuild xpmgr.vcxproj /P:Configuration=Release /P:Platform=x64
- name: Upload build artifact (x86)
uses: actions/upload-artifact@v3.1.2
with:
name: xpmgr (x86)
path: .\build\x86
path: .\Win32\Release
- name: Upload build artifact (x64)
uses: actions/upload-artifact@v3.1.2
with:
name: xpmgr (x64)
path: .\build\x64
path: .\x64\Release

2
.gitignore vendored
View File

@ -32,8 +32,6 @@ bld/
[Oo]ut/
[Ll]og/
[Ll]ogs/
[Bb]uild/
cmake-build-debug/
# Visual Studio 2015/2017 cache/options directory
.vs/

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
</component>
</project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/xpmgr.iml" filepath="$PROJECT_DIR$/.idea/xpmgr.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

View File

@ -6,11 +6,11 @@ Command line interface for Windows XP license management, inspired by Microsoft'
In most cases, you'll need `xpmgr_x86.exe`.
If you have Windows XP Professional x64 Edition or a x64 version of Windows Server 2003, you need `xpmgr_x64.exe`.
If you have Windows XP Professional x64 Edition or an x64 version of Windows Server 2003, you need `xpmgr_x64.exe`.
If you have an Itanium version of Windows XP or Server 2003, Windows Product Activation is not on those editions, so there is no need for this tool.
If you're trying to manage products other than Windows, you need `xpmgr_x86.exe`, regardless of your architecture.
In general, don't use `xpmgr_debug_[arch].exe` unless you have a reason why.
`--GetProductID`: Gets the product ID (ex: `76477-755-3803223-21229`).
@ -24,9 +24,7 @@ If you're trying to manage products other than Windows, you need `xpmgr_x86.exe`
`--GetEvalLeft`: Gets the number of days before the evaluation period expires, in days. In non-evaluation copies of Windows, this should give an error instead.
`--Office2003`: This provides **EXPERIMENTAL** support for Office 2003. When this parameter is used, all other parameters except `--GetInstallationID` and `--SetConfirmationID` are disabled, and those two (attempt) to go what they do on Office 2003, rather than Windows.
`--BypassInstallCheck`: Disables the check to see if Office 2003 is installed. Intended for debugging purposes only. If it doesn't work without this enabled, it probably won't work with it either.
`--Office2003`: This provides **EXPERIMENTAL** support for Office 2003. When this parameter is used, all other parameters except `--GetInstallationID` and `--SetConfirmationID` are disabled, and those two (attempt) to go what they do on Office 2003, rather than Windows. Most likely, it will crash.
`--GetUsage`: Outputs all the commands you can use.
@ -34,18 +32,4 @@ If you're trying to manage products other than Windows, you need `xpmgr_x86.exe`
https://github.com/UMSKT/xpmgr/releases
## Building
Make sure Visual Studio 2017 or later is installed. Then, install [TDM-GCC](https://jmeubank.github.io/tdm-gcc/about/). Then, run, at the source folder:
```
mkdir build
mkdir build\x86
mkdir build\x64
windres icon.rc -F pe-i386 -O coff -o build\x86\icon_x86.res
g++ -m32 -o build\x86\xpmgr_x86 xpmgr.cpp build\x86\icon_x86.res -lole32 -luuid -loleaut32
windres icon.rc -O coff -o build\x64\icon_x64.res
g++ -o build\x64\xpmgr_x64 xpmgr.cpp build\x64\icon_x64.res -lole32 -luuid -loleaut32
```
Or, if you like one-liners:
```
mkdir build & mkdir build\x86 & mkdir build\x64 & windres icon.rc -F pe-i386 -O coff -o build\x86\icon_x86.res & g++ -m32 -o build\x86\xpmgr_x86 xpmgr.cpp build\x86\icon_x86.res -lole32 -luuid -loleaut32 & windres icon.rc -O coff -o build\x64\icon_x64.res & g++ -o build\x64\xpmgr_x64 xpmgr.cpp build\x64\icon_x64.res -lole32 -luuid -loleaut32
```
Make sure Visual Studio 2017 or later is installed, with the v141_xp toolchain. Then, `git clone`, open in VS, build, done.

View File

@ -1 +0,0 @@
id ICON "xpmgr.ico"

16
resource.h Normal file
View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by xpmgr.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

401
xpmgr.cpp
View File

@ -1,12 +1,14 @@
// ReSharper disable CppEnforceOverridingFunctionStyle
typedef struct IUnknown IUnknown;
#include <windows.h>
#include <iostream>
#include <comdef.h>
#include <comutil.h>
#include <regex>
#include <TlHelp32.h>
#pragma comment(lib, "comsuppw.lib")
#pragma comment(lib, "kernel32.lib")
// Check windows
#if _WIN32 || _WIN64
#if _WIN64
@ -16,28 +18,23 @@ typedef struct IUnknown IUnknown;
#endif
#endif
const char* specifiedProduct = nullptr;
const char* specifiedProduct = NULL;
// This is a really weird way of making a GUID. In short, this becomes ACADF079-CBCD-4032-83F2-FA47C4DB096F. Ignore the 0x and it makes sense.
static CLSID XP_CLSID = { 0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F} };
static IID XP_IID = { 0xB8CBAD79, 0x3F1F, 0x481A, { 0xBB, 0x0C, 0xE7, 0xBB, 0xD7, 0x7B, 0xDD, 0xD1 } };
static IID XP_IID = { 0xB8CBAD79, 0x3F1F, 0x481A, {0xBB, 0x0C, 0xE7, 0xBB, 0xD7, 0x7B, 0xDD, 0xD1} };
static CLSID O2003_CLSID = { 0x812034D2, 0x760F, 0x11CF, { 0x93, 0x70, 0x00, 0xAA, 0x00, 0xB8, 0xBF, 0x00 } };
static IID O2003_IID = { 0x00194002, 0xD9C3, 0x11D3, { 0x8D, 0x59, 0x00, 0x50, 0x04, 0x83, 0x84, 0xE3 } };
static CLSID O2003_CLSID = { 0x2DF8D04C, 0x5BFA, 0x101B, { 0xBD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0xDE, 0x52 } };
static IID O2003_IID = { 0x00194002, 0xD9C3, 0x11D3, { 0x8D, 0x59, 0x00, 0x50, 0x04, 0x83, 0x84, 0xE3 } };
#undef XP_INTERFACE
#define XP_INTERFACE ICOMLicenseAgent
DECLARE_INTERFACE_(ICOMLicenseAgent, IDispatch)
{
protected:
~ICOMLicenseAgent() = default;
public:
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG, AddRef)() PURE;
STDMETHOD_(ULONG, Release)() PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
/*** IDispatch methods ***/
STDMETHOD(GetTypeInfoCount)(THIS_ UINT FAR * pctinfo) PURE;
@ -80,21 +77,21 @@ public:
STDMETHOD(GetAddress2)(THIS_ BSTR * pbstrVal) PURE;
STDMETHOD(SetAddress2)(THIS_ BSTR bstrNewVal) PURE;
STDMETHOD(AsyncProcessHandshakeRequest)(THIS_ LONG bReviseCustInfo) PURE;
STDMETHOD(AsyncProcessNewLicenseRequest)() PURE;
STDMETHOD(AsyncProcessReissueLicenseRequest)() PURE;
STDMETHOD(AsyncProcessReviseCustInfoRequest)() PURE;
STDMETHOD(AsyncProcessNewLicenseRequest)(THIS) PURE;
STDMETHOD(AsyncProcessReissueLicenseRequest)(THIS) PURE;
STDMETHOD(AsyncProcessReviseCustInfoRequest)(THIS) PURE;
STDMETHOD(GetAsyncProcessReturnCode)(THIS_ ULONG * pdwRetCode) PURE;
STDMETHOD(AsyncProcessDroppedLicenseRequest)() PURE;
STDMETHOD(AsyncProcessDroppedLicenseRequest)(THIS) PURE;
STDMETHOD(GenerateInstallationId)(THIS_ BSTR * pbstrVal) PURE;
STDMETHOD(DepositConfirmationId)(THIS_ BSTR bstrVal, ULONG * pdwRetCode) PURE;
STDMETHOD(GetExpirationInfo)(THIS_ ULONG * pdwWPALeft, ULONG * pdwEvalLeft) PURE;
STDMETHOD(AsyncProcessRegistrationRequest)() PURE;
STDMETHOD(AsyncProcessRegistrationRequest)(THIS) PURE;
STDMETHOD(ProcessHandshakeRequest)(THIS_ LONG bReviseCustInfo) PURE;
STDMETHOD(ProcessNewLicenseRequest)() PURE;
STDMETHOD(ProcessDroppedLicenseRequest)() PURE;
STDMETHOD(ProcessReissueLicenseRequest)() PURE;
STDMETHOD(ProcessReviseCustInfoRequest)() PURE;
STDMETHOD(EnsureInternetConnection)() PURE;
STDMETHOD(ProcessNewLicenseRequest)(THIS) PURE;
STDMETHOD(ProcessDroppedLicenseRequest)(THIS) PURE;
STDMETHOD(ProcessReissueLicenseRequest)(THIS) PURE;
STDMETHOD(ProcessReviseCustInfoRequest)(THIS) PURE;
STDMETHOD(EnsureInternetConnection)(THIS) PURE;
STDMETHOD(SetProductKey)(THIS_ LPWSTR pszNewProductKey) PURE;
STDMETHOD(GetProductID)(THIS_ BSTR * pbstrVal) PURE;
STDMETHOD(VerifyCheckDigits)(THIS_ BSTR bstrCIDIID, LONG * pbValue) PURE;
@ -104,14 +101,10 @@ public:
#define O2003_INTERFACE ILicAgent
DECLARE_INTERFACE_(ILicAgent, IDispatch)
{
protected:
~ILicAgent() = default;
public:
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG, AddRef)() PURE;
STDMETHOD_(ULONG, Release)() PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
/*** IDispatch methods ***/
STDMETHOD(GetTypeInfoCount)(THIS_ UINT FAR * pctinfo) PURE;
@ -195,16 +188,16 @@ public:
STDMETHOD(GetDisconnectOption)(THIS_ int* pbRetVal) PURE;
STDMETHOD(SetDisconnectOption)(THIS_ int bNewVal) PURE;
STDMETHOD(AsyncProcessHandshakeRequest)(THIS_ int bReviseCustInfo) PURE;
STDMETHOD(AsyncProcessNewLicenseRequest)() PURE;
STDMETHOD(AsyncProcessReissueLicenseRequest)() PURE;
STDMETHOD(AsyncProcessRetailRenewalLicenseRequest)() PURE;
STDMETHOD(AsyncProcessReviseCustInfoRequest)() PURE;
STDMETHOD(AsyncProcessCCRenewalPriceRequest)() PURE;
STDMETHOD(AsyncProcessCCRenewalLicenseRequest)() PURE;
STDMETHOD(AsyncProcessNewLicenseRequest)(THIS) PURE;
STDMETHOD(AsyncProcessReissueLicenseRequest)(THIS) PURE;
STDMETHOD(AsyncProcessRetailRenewalLicenseRequest)(THIS) PURE;
STDMETHOD(AsyncProcessReviseCustInfoRequest)(THIS) PURE;
STDMETHOD(AsyncProcessCCRenewalPriceRequest)(THIS) PURE;
STDMETHOD(AsyncProcessCCRenewalLicenseRequest)(THIS) PURE;
STDMETHOD(GetAsyncProcessReturnCode)(THIS_ unsigned long* pdwRetCode) PURE;
STDMETHOD(IsUpgradeAvailable)(THIS_ int* pbUpgradeAvailable) PURE;
STDMETHOD(WantUpgrade)(THIS_ int bWantUpgrade) PURE;
STDMETHOD(AsyncProcessDroppedLicenseRequest)() PURE;
STDMETHOD(AsyncProcessDroppedLicenseRequest)(THIS) PURE;
STDMETHOD(GenerateInstallationId)(THIS_ BSTR * pbstrVal) PURE;
STDMETHOD(DepositConfirmationId)(THIS_ BSTR bstrVal, unsigned long* pdwRetCode) PURE;
STDMETHOD(VerifyCheckDigits)(THIS_ BSTR bstrCIDIID, int* pbValue) PURE;
@ -223,45 +216,37 @@ public:
};
static BOOL XP_ComInitialized = FALSE;
static ICOMLicenseAgent* XP_LicenseAgent = nullptr;
static ICOMLicenseAgent* XP_LicenseAgent = NULL;
static BOOL O2003_ComInitialized = FALSE;
static ILicAgent* O2003_LicenseAgent = nullptr;
static ILicAgent* O2003_LicenseAgent = NULL;
static BOOL XP_LoadLicenseManager()
{
if (!XP_ComInitialized) {
const HRESULT status = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
HRESULT status = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(status)) {
const char* errorString = "An error occurred at CoInitializeEx:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
std::cout << result;
std::cout << "An error occurred at CoInitializeEx: ", status;
return FALSE;
}
XP_ComInitialized = TRUE;
}
if (!XP_LicenseAgent) {
HRESULT status = CoCreateInstance(XP_CLSID, nullptr, CLSCTX_INPROC_SERVER, XP_IID, reinterpret_cast<void **>(&XP_LicenseAgent));
HRESULT status = CoCreateInstance(XP_CLSID, NULL, CLSCTX_INPROC_SERVER, XP_IID, (void**)&XP_LicenseAgent);
int good = 0;
if (SUCCEEDED(status)) {
ULONG dwRetCode;
status = XP_LicenseAgent->Initialize(0xC475 /* This needs to be changed, I believe it's causing the crashing.*/ , 3, nullptr, &dwRetCode);
status = XP_LicenseAgent->Initialize(0xC475 /* This needs to be changed, I believe it's causing the crashing.*/ , 3, 0, &dwRetCode);
if (SUCCEEDED(status) && dwRetCode == 0) {
good = 1;
}
else {
XP_LicenseAgent->Release();
XP_LicenseAgent = nullptr;
XP_LicenseAgent = NULL;
}
}
if (!good) {
const char* errorString = "An error occurred at CoCreateInstance:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
std::cout << result;
std::cout << "An error occurred at CoCreateInstance: " + status;
return FALSE;
}
}
@ -271,42 +256,29 @@ static BOOL XP_LoadLicenseManager()
static BOOL O2003_LoadLicenseManager()
{
if (!O2003_ComInitialized) {
const HRESULT status = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
HRESULT status = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(status)) {
const char* errorString = "An error occurred at CoInitializeEx:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
std::cout << result;
std::cout << "An error occurred at CoInitializeEx: ", status;
return FALSE;
}
O2003_ComInitialized = TRUE;
}
if (!O2003_LicenseAgent) {
HRESULT status = CoCreateInstance(O2003_CLSID, nullptr, CLSCTX_INPROC_SERVER, O2003_IID, reinterpret_cast<void **>(&O2003_LicenseAgent));
HRESULT status = CoCreateInstance(O2003_CLSID, NULL, CLSCTX_INPROC_SERVER, O2003_IID, (void**)&O2003_LicenseAgent);
int good = 0;
if (SUCCEEDED(status)) {
ULONG dwRetCode;
status = O2003_LicenseAgent->Initialize(0xC475, 3, nullptr, &dwRetCode);
status = O2003_LicenseAgent->Initialize(0xC475, 3, 0, &dwRetCode);
if (SUCCEEDED(status) && dwRetCode == 0) {
good = 1;
}
else {
O2003_LicenseAgent->Release();
O2003_LicenseAgent = nullptr;
const auto errorString = "An error occurred at Initialize:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X, %z\n", errorString, static_cast<unsigned int>(status), dwRetCode);
const auto result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X, %z\n", errorString, static_cast<unsigned int>(status), dwRetCode);
std::cout << result;
O2003_LicenseAgent = NULL;
}
}
if (!good) {
const auto errorString = "An error occurred at CoCreateInstance:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
const auto result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X\n", errorString, static_cast<unsigned int>(status));
std::cout << result;
std::cout << "An error occurred at CoCreateInstance: " + status;
return FALSE;
}
}
@ -314,9 +286,9 @@ static BOOL O2003_LoadLicenseManager()
}
#pragma region Internals
bool RegistryKeyExists(HKEY rootKey, const char* keyPath) {
bool RegistryKeyExists(HKEY rootKey, const wchar_t* keyPath) {
HKEY hKey;
const LSTATUS result = RegOpenKeyEx(rootKey, keyPath, 0, KEY_READ, &hKey);
LSTATUS result = RegOpenKeyEx(rootKey, keyPath, 0, KEY_READ, &hKey);
if (result == ERROR_SUCCESS) {
RegCloseKey(hKey);
@ -333,7 +305,7 @@ bool RegistryKeyExists(HKEY rootKey, const char* keyPath) {
wchar_t* convertCharArrayToLPCWSTR(const char* charArray)
{
auto* wString = new wchar_t[4096];
wchar_t* wString = new wchar_t[4096];
MultiByteToWideChar(CP_ACP, 0, charArray, -1, wString, 4096);
return wString;
}
@ -345,7 +317,7 @@ char* getCmdOption(char** begin, char** end, const std::string& option)
{
return *itr;
}
return nullptr;
return 0;
}
bool cmdOptionExists(char** begin, char** end, const std::string& option)
@ -355,10 +327,10 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option)
char* BstrToChar(BSTR bstr)
{
const int len = static_cast<int>(::SysStringLen(bstr));
const int bufSize = ::WideCharToMultiByte(CP_UTF8, 0, bstr, len, nullptr, 0, nullptr, nullptr);
const auto buffer = new char[bufSize + 1];
::WideCharToMultiByte(CP_UTF8, 0, bstr, len, buffer, bufSize, nullptr, nullptr);
int len = ::SysStringLen(bstr);
int bufSize = ::WideCharToMultiByte(CP_UTF8, 0, bstr, len, NULL, 0, NULL, NULL);
char* buffer = new char[bufSize + 1];
::WideCharToMultiByte(CP_UTF8, 0, bstr, len, buffer, bufSize, NULL, NULL);
buffer[bufSize] = '\0';
return buffer;
}
@ -366,71 +338,27 @@ char* BstrToChar(BSTR bstr)
ULONG ConvertToULONG(const char* str)
{
char* end;
const ULONG value = std::strtoul(str, &end, 10);
ULONG value = std::strtoul(str, &end, 10);
return value;
}
OLECHAR SizeToOLECHAR(size_t value)
{
// Convert size_t to wstring
const std::wstring wideString = std::to_wstring(value);
std::wstring wideString = std::to_wstring(value);
// Retrieve the first character from the wide string
const OLECHAR oChar = wideString[0];
OLECHAR oChar = wideString[0];
return oChar;
}
BSTR ConvertToBSTR(const std::string& str) {
const int size = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, nullptr, 0);
// ReSharper disable once CppLocalVariableMayBeConst
BSTR bstr = SysAllocStringLen(nullptr, size - 1);
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, bstr, size);
return bstr;
}
std::string ConvertToStdString(BSTR bstr) {
const int size = WideCharToMultiByte(CP_UTF8, 0, bstr, -1, nullptr, 0, nullptr, nullptr);
const auto buffer = new char[size];
WideCharToMultiByte(CP_UTF8, 0, bstr, -1, buffer, size, nullptr, nullptr);
std::string result(buffer);
delete[] buffer;
return result;
}
BSTR ConvertCharToBSTR(const char* charString) {
const int size = MultiByteToWideChar(CP_UTF8, 0, charString, -1, nullptr, 0);
// ReSharper disable once CppLocalVariableMayBeConst
BSTR bstr = SysAllocStringLen(nullptr, size - 1);
MultiByteToWideChar(CP_UTF8, 0, charString, -1, bstr, size);
return bstr;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
void safeStrncat(char* destination, const char* source, size_t size) {
const size_t destLen = strlen(destination);
const size_t srcLen = strlen(source);
if (destLen + srcLen < size) {
// fuck off Microsoft
strncat(destination, source, size - destLen - 1); // -1 for the null terminator
} else {
// Handle buffer overflow error
std::cout << "An error occurred at safeStrncat: Buffer overflow during strncat operation." << std::endl;
}
}
#pragma clang diagnostic pop
bool IsProcessRunning(const wchar_t* processName)
{
// ReSharper disable once CppLocalVariableMayBeConst
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE)
{
std::cout << "An error occurred at IsProcessRunning: Failed to create process snapshot." << std::endl;
std::cerr << "Failed to create process snapshot." << std::endl;
return false;
}
@ -439,7 +367,7 @@ bool IsProcessRunning(const wchar_t* processName)
if (!Process32FirstW(snapshot, &processEntry))
{
CloseHandle(snapshot);
std::cout << "An error occurred at IsProcessRunning: Failed to retrieve process information." << std::endl;
std::cerr << "Failed to retrieve process information." << std::endl;
return false;
}
@ -458,7 +386,6 @@ bool IsProcessRunning(const wchar_t* processName)
bool TerminateProcessByName(const wchar_t* processName)
{
// ReSharper disable once CppLocalVariableMayBeConst
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE)
{
@ -477,9 +404,8 @@ bool TerminateProcessByName(const wchar_t* processName)
{
if (wcscmp(processEntry.szExeFile, processName) == 0)
{
// ReSharper disable once CppLocalVariableMayBeConst
HANDLE processHandle = OpenProcess(PROCESS_TERMINATE, FALSE, processEntry.th32ProcessID);
if (processHandle != nullptr)
if (processHandle != NULL)
{
if (TerminateProcess(processHandle, 0))
{
@ -515,18 +441,11 @@ static BSTR XP_GetWPALeft() {
}
ULONG dwWPALeft = 0, dwEvalLeft = 0;
const HRESULT status = XP_LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
HRESULT status = XP_LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
if (FAILED(status)) {
XP_LicenseAgent->Release();
XP_LicenseAgent = nullptr;
const char* errorString = "An error occurred at CoInitializeEx:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
XP_LicenseAgent = NULL;
return SysAllocString(L"An error occurred at GetExpirationInfo: " + status);
}
if (dwWPALeft == 0x7FFFFFFF) {
return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated");
@ -540,18 +459,11 @@ static BSTR XP_GetEvalLeft() {
}
ULONG dwWPALeft = 0, dwEvalLeft = 0;
const HRESULT status = XP_LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
HRESULT status = XP_LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
if (FAILED(status)) {
XP_LicenseAgent->Release();
XP_LicenseAgent = nullptr;
const char* errorString = "An error occurred at GetExpirationInfo:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
XP_LicenseAgent = NULL;
return SysAllocString(L"An error occurred at GetExpirationInfo: " + status);
}
if (dwEvalLeft == 0x7FFFFFFF) {
return SysAllocString(L"An error occurred at GetEvalLeft: Not an evaluation copy");
@ -569,16 +481,9 @@ static BSTR XP_VerifyCheckDigits(BSTR cidChunk) {
}
LONG pbValue;
const HRESULT status = XP_LicenseAgent->VerifyCheckDigits(cidChunk, &pbValue);
HRESULT status = XP_LicenseAgent->VerifyCheckDigits(cidChunk, &pbValue);
if (FAILED(status) || !pbValue) {
char errorMessage[70] = "An error occurred at XP_VerifyCheckDigits:";
char pbValueChar[20];
snprintf(errorMessage, sizeof(errorMessage), "%ld", pbValue);
safeStrncat(errorMessage, pbValueChar, sizeof(errorMessage));
const int len = MultiByteToWideChar(CP_UTF8, 0, errorMessage, -1, nullptr, 0);
auto* oleCharString = new OLECHAR[len];
MultiByteToWideChar(CP_UTF8, 0, errorMessage, -1, oleCharString, len);
return SysAllocString(oleCharString);
return SysAllocString(L"An error occurred at XP_VerifyCheckDigits: " + pbValue);
}
return SysAllocString(L"Successfully verified CID chunk");
}
@ -592,9 +497,10 @@ static BSTR XP_SetConfirmationID(BSTR confirmationID) {
return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated");
}
const int length = static_cast<int>(SysStringLen(confirmationID));
//
int length = SysStringLen(confirmationID);
char* str = new char[length + 1];
WideCharToMultiByte(CP_UTF8, 0, confirmationID, length, str, length, nullptr, nullptr);
WideCharToMultiByte(CP_UTF8, 0, confirmationID, length, str, length, NULL, NULL);
str[length] = '\0';
std::string inputString(str);
@ -602,23 +508,15 @@ static BSTR XP_SetConfirmationID(BSTR confirmationID) {
for (size_t i = 0; i < inputString.length(); i += 6) {
std::string substring = inputString.substr(i, 6);
const char* cstr = substring.c_str();
if (0 != wcscmp(XP_VerifyCheckDigits(ConvertCharToBSTR(cstr)), L"Successfully verified CID chunk")) {
if (0 != wcscmp(XP_VerifyCheckDigits(_com_util::ConvertStringToBSTR(cstr)), L"Successfully verified CID chunk")) {
return SysAllocString(L"An error occurred at XP_VerifyCheckDigits: Check for misspelling");
}
}
ULONG dwRetCode;
const HRESULT status = XP_LicenseAgent->DepositConfirmationId(confirmationID, &dwRetCode);
HRESULT status = XP_LicenseAgent->DepositConfirmationId(confirmationID, &dwRetCode);
if (FAILED(status) || dwRetCode) {
const char* errorString = "An error occurred at DepositConfirmationId:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X %lu", errorString, static_cast<unsigned int>(status), dwRetCode);
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X %lu", errorString, static_cast<unsigned int>(status), dwRetCode);
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at DepositConfirmationId: " + status + dwRetCode);
}
system("rundll32 setupapi,InstallHinfSection DEL_OOBE_ACTIVATE 132 syssetup.inf"); // remove activation shortcuts
@ -634,21 +532,15 @@ static BSTR XP_GetInstallationID() {
if (!XP_LoadLicenseManager()) {
return SysAllocString(L"An error occurred at XP_LoadLicenseManager: Failed to load");
}
if (0 == wcscmp(XP_GetWPALeft(), L"An error occurred at GetWPALeft: Windows is activated")) {
return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated");
}
BSTR installationID = nullptr;
const HRESULT status = XP_LicenseAgent->GenerateInstallationId(&installationID);
BSTR installationID = NULL;
HRESULT status = XP_LicenseAgent->GenerateInstallationId(&installationID);
if (FAILED(status) || !installationID) {
const char* errorString = "An error occurred at GenerateInstallationId:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at GenerateInstallationId: " + status);
}
else {
return installationID;
@ -661,8 +553,8 @@ static BSTR XP_SetProductKey(LPWSTR productKey) {
}
std::wstring ws(productKey);
const std::string productKeyToRegex = std::string(ws.begin(), ws.end());
const std::regex pattern("[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}");
std::string productKeyToRegex = std::string(ws.begin(), ws.end());
std::regex pattern("[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}-[2346789BCDFGHJKMPQRTVWXY]{5}");
if (!std::regex_match(productKeyToRegex, pattern)) {
return SysAllocString(L"An error occurred at regex_match: Product key is invalid");
@ -672,16 +564,9 @@ static BSTR XP_SetProductKey(LPWSTR productKey) {
return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated");
}
const HRESULT status = XP_LicenseAgent->SetProductKey(productKey);
HRESULT status = XP_LicenseAgent->SetProductKey(productKey);
if (FAILED(status)) {
const char* errorString = "An error occurred at SetProductKey:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at SetProductKey: " + status);
}
else {
return SysAllocString(L"Successfully set product key");
@ -693,18 +578,11 @@ static BSTR XP_GetProductID() {
return SysAllocString(L"An error occurred at XP_LoadLicenseManager: Failed to load");
}
BSTR productID = nullptr;
BSTR productID = NULL;
const HRESULT status = XP_LicenseAgent->GetProductID(&productID);
HRESULT status = XP_LicenseAgent->GetProductID(&productID);
if (FAILED(status)) {
const char* errorString = "An error occurred at GetProductID:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at GetProductID: " + status);
}
else {
return productID;
@ -713,7 +591,6 @@ static BSTR XP_GetProductID() {
#pragma endregion
#pragma region Office 2003
// ReSharper disable once CppDeclaratorNeverUsed
static BSTR O2003_VerifyCheckDigits(BSTR cidChunk) {
if (!O2003_LoadLicenseManager()) {
return SysAllocString(L"An error occurred at O2003_LoadLicenseManager: Failed to load");
@ -722,17 +599,9 @@ static BSTR O2003_VerifyCheckDigits(BSTR cidChunk) {
// TODO: find a way to check office 2003 activation status
int pbValue;
const HRESULT status = O2003_LicenseAgent->VerifyCheckDigits(cidChunk, &pbValue);
HRESULT status = O2003_LicenseAgent->VerifyCheckDigits(cidChunk, &pbValue);
if (FAILED(status) || !pbValue) {
wchar_t error[] = L"An error occurred at XP_VerifyCheckDigits:";
const std::wstring numberStr = std::to_wstring(pbValue);
std::wstring result = error + numberStr;
wchar_t buffer[100];
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), L"%s 0x%X %d", error, status, pbValue);
return SysAllocString(buffer);
return SysAllocString(L"An error occurred at XP_VerifyCheckDigits: " + pbValue);
}
return SysAllocString(L"Successfully verified CID chunk");
}
@ -744,9 +613,9 @@ static BSTR O2003_SetConfirmationID(BSTR confirmationID) {
// TODO: find a way to check office 2003 activation status
const int length = static_cast<int>(SysStringLen(confirmationID));
int length = SysStringLen(confirmationID);
char* str = new char[length + 1];
WideCharToMultiByte(CP_UTF8, 0, confirmationID, length, str, length, nullptr, nullptr);
WideCharToMultiByte(CP_UTF8, 0, confirmationID, length, str, length, NULL, NULL);
str[length] = '\0';
std::string inputString(str);
@ -754,22 +623,15 @@ static BSTR O2003_SetConfirmationID(BSTR confirmationID) {
for (size_t i = 0; i < inputString.length(); i += 6) {
std::string substring = inputString.substr(i, 6);
const char* cstr = substring.c_str();
if (0 != wcscmp(XP_VerifyCheckDigits(ConvertToBSTR(cstr)), L"Successfully verified CID chunk")) {
if (0 != wcscmp(XP_VerifyCheckDigits(_com_util::ConvertStringToBSTR(cstr)), L"Successfully verified CID chunk")) {
return SysAllocString(L"An error occurred at XP_VerifyCheckDigits: Check for misspelling");
}
}
ULONG dwRetCode;
const HRESULT status = O2003_LicenseAgent->DepositConfirmationId(confirmationID, &dwRetCode);
HRESULT status = O2003_LicenseAgent->DepositConfirmationId(confirmationID, &dwRetCode);
if (FAILED(status) || dwRetCode) {
const char* errorString = "An error occurred at DepositConfirmationId:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X %lu", errorString, static_cast<unsigned int>(status), dwRetCode);
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X %lu", errorString, static_cast<unsigned int>(status), dwRetCode);
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at DepositConfirmationId: " + status + dwRetCode);
}
return SysAllocString(L"Successfully set confirmation ID");
@ -785,19 +647,12 @@ static BSTR O2003_GetInstallationID() {
// TODO: find a way to check office 2003 activation status
BSTR installationID = nullptr;
BSTR installationID = NULL;
std::cout << "DEBUG: installationID = NULL";
const HRESULT status = O2003_LicenseAgent->GenerateInstallationId(&installationID);
HRESULT status = O2003_LicenseAgent->GenerateInstallationId(&installationID);
std::cout << "DEBUG: GenerateInstallationID executed";
if (FAILED(status) || !installationID) {
const char* errorString = "An error occurred at GenerateInstallationId:";
const int bufferSize = snprintf(nullptr, 0, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
char* result = new char[bufferSize + 1];
snprintf(result, bufferSize + 1, "%s 0x%08X", errorString, static_cast<unsigned int>(status));
const int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, result, -1, nullptr, 0);
auto* wideResult = new OLECHAR[wideCharSize];
MultiByteToWideChar(CP_UTF8, 0, result, -1, wideResult, wideCharSize);
return SysAllocString(wideResult);
return SysAllocString(L"An error occurred at GenerateInstallationId: " + status);
}
else {
return installationID;
@ -806,8 +661,6 @@ static BSTR O2003_GetInstallationID() {
#pragma endregion
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
int main(int argc, char* argv[])
{
const char* text =
@ -830,11 +683,7 @@ int main(int argc, char* argv[])
if (cmdOptionExists(argv, argv + argc, "--Office2003")) {
#ifdef ENVIRONMENT32
if (cmdOptionExists(argv, argv + argc, "--BypassInstallCheck")) {
specifiedProduct = "Office2003";
}
else if (RegistryKeyExists(HKEY_CLASSES_ROOT, "CLSID\\{000C0114-0000-0000-C000-000000000046}")) {
if (RegistryKeyExists(HKEY_CLASSES_ROOT, L"CLSID\\{000C0114-0000-0000-C000-000000000046}")) {
specifiedProduct = "Office2003";
}
else {
@ -856,7 +705,7 @@ int main(int argc, char* argv[])
specifiedProduct = "WindowsNT5x";
#endif
if (std::strcmp(specifiedProduct, "WindowsNT5x") == 0) {
if (specifiedProduct == "WindowsNT5x") {
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
#ifdef ENVIRONMENT32
@ -870,86 +719,88 @@ int main(int argc, char* argv[])
else { // is PPC, megafart 386, whatever else
std::cout << "An error occurred at systemInfo: Incorrect version of xpmgr. Go to https://umskt.zulipchat.com if you want to help us make a version for your platform!";
}
return 1;
return 0;
}
#endif
OSVERSIONINFOEX info = {};
OSVERSIONINFOEX info;
memset(&info, 0, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&info));
GetVersionEx((LPOSVERSIONINFO)&info);
if (info.dwMajorVersion != 5) {
std::cout << "An error occurred at OSVERSIONINFOEX: Windows management only works on Windows NT 5.1 and 5.2.";
if (info.dwMajorVersion > 5) {
std::cout << " Use slmgr instead: https://learn.microsoft.com/en-us/windows-server/get-started/activation-slmgr-vbs-options";
return 3;
std::cout << " Use slmgr instead.";
return 0;
}
return 2;
return 0;
}
else {
if (info.dwMinorVersion != 1 && info.dwMinorVersion != 2) {
std::cout << "An error occurred at OSVERSIONINFOEX: Windows management only works on Windows NT 5.1 and 5.2.";
if (info.dwMinorVersion == 0) {
std::cout << " You should be fine anyways, since Windows 2000 doesn't use Product Activation.";
return 4;
return 0;
}
return 5;
std::cout << "An error occurred OSVERSIONINFOEX: Windows management only works on Windows NT 5.1 and 5.2.";
return 0;
}
}
}
if (cmdOptionExists(argv, argv + argc, "--GetInstallationID")) {
if (std::strcmp(specifiedProduct, "Office2003") == 0) {
std::cout << ConvertToStdString(O2003_GetInstallationID());
if (specifiedProduct == "Office2003") {
std::cout << _com_util::ConvertBSTRToString(O2003_GetInstallationID());
return 0;
}
std::cout << ConvertToStdString(XP_GetInstallationID());
std::cout << _com_util::ConvertBSTRToString(XP_GetInstallationID());
return 0;
}
else if (cmdOptionExists(argv, argv + argc, "--SetConfirmationID")) {
if (std::strcmp(specifiedProduct, "Office2003") == 0) {
std::cout << ConvertToStdString(O2003_SetConfirmationID(ConvertCharToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
if (specifiedProduct == "Office2003") {
std::cout << _com_util::ConvertBSTRToString(O2003_SetConfirmationID(_com_util::ConvertStringToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
return 0;
}
std::cout << ConvertToStdString(XP_SetConfirmationID(ConvertCharToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
std::cout << _com_util::ConvertBSTRToString(XP_SetConfirmationID(_com_util::ConvertStringToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
return 0;
}
else if (cmdOptionExists(argv, argv + argc, "--GetWPALeft")) {
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
if (specifiedProduct != "WindowsNT5x") {
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
return 6;
return 0;
}
std::cout << ConvertToStdString(XP_GetWPALeft());
std::cout << _com_util::ConvertBSTRToString(XP_GetWPALeft());
return 0;
}
else if (cmdOptionExists(argv, argv + argc, "--GetEvalLeft")) {
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
if (specifiedProduct != "WindowsNT5x") {
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
return 6;
return 0;
}
std::cout << ConvertToStdString(XP_GetEvalLeft());
std::cout << _com_util::ConvertBSTRToString(XP_GetEvalLeft());
return 0;
}
else if (cmdOptionExists(argv, argv + argc, "--SetProductKey")) {
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
if (specifiedProduct != "WindowsNT5x") {
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
return 6;
return 0;
}
std::cout << ConvertToStdString(XP_SetProductKey(convertCharArrayToLPCWSTR(getCmdOption(argv, argv + argc, "--SetProductKey"))));
std::cout << _com_util::ConvertBSTRToString(XP_SetProductKey(convertCharArrayToLPCWSTR(getCmdOption(argv, argv + argc, "--SetProductKey"))));
return 0;
}
else if (cmdOptionExists(argv, argv + argc, "--GetProductID")) {
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
if (specifiedProduct != "WindowsNT5x") {
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
return 6;
return 0;
}
std::cout << ConvertToStdString(XP_GetProductID());
std::cout << _com_util::ConvertBSTRToString(XP_GetProductID());
return 0;
}
else {
std::cout << "An error occurred at main: No arguments listed\n\n";
std::cout << text;
return 7;
return 0;
}
}
#pragma clang diagnostic pop
return 0;
}

BIN
xpmgr.rc Normal file

Binary file not shown.

37
xpmgr.sln Normal file
View File

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33723.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xpmgr", "xpmgr.vcxproj", "{F76E79ED-B941-49F6-A040-F560AA2B9E09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release with UPX|x64 = Release with UPX|x64
Release with UPX|x86 = Release with UPX|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Debug|x64.ActiveCfg = Debug|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Debug|x64.Build.0 = Debug|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Debug|x86.ActiveCfg = Debug|Win32
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Debug|x86.Build.0 = Debug|Win32
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release with UPX|x64.ActiveCfg = Release with UPX|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release with UPX|x64.Build.0 = Release with UPX|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release with UPX|x86.ActiveCfg = Release with UPX|Win32
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release with UPX|x86.Build.0 = Release with UPX|Win32
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release|x64.ActiveCfg = Release|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release|x64.Build.0 = Release|x64
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release|x86.ActiveCfg = Release|Win32
{F76E79ED-B941-49F6-A040-F560AA2B9E09}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92A0AD49-0BA8-4EFD-9F27-F8EA47684B07}
EndGlobalSection
EndGlobal

255
xpmgr.vcxproj Normal file
View File

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release with UPX|Win32">
<Configuration>Release with UPX</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release with UPX|x64">
<Configuration>Release with UPX</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{f76e79ed-b941-49f6-a040-f560aa2b9e09}</ProjectGuid>
<RootNamespace>xpmgr</RootNamespace>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.exe</TargetExt>
<TargetName>$(ProjectName)_x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|x64'">
<TargetExt>.exe</TargetExt>
<TargetName>$(ProjectName)_x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>$(ProjectName)_x86</TargetName>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|Win32'">
<TargetName>$(ProjectName)_x86</TargetName>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)_debug_x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>$(ProjectName)_debug_x86</TargetName>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup>
<XPDeprecationWarning>false</XPDeprecationWarning>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(SolutionDir)BuildTools\upx.exe" "$(TargetPath)" --ultra-brute --best --compress-icons=3 -o"$(TargetDir)xpmgr_upx_x86.exe"
del "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with UPX|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(SolutionDir)BuildTools\upx.exe" "$(TargetPath)" --ultra-brute --best --compress-icons=3 -o"$(TargetDir)xpmgr_upx_x64.exe"
del "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="xpmgr.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="xpmgr.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="xpmgr.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

37
xpmgr.vcxproj.filters Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="xpmgr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="xpmgr.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="xpmgr.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>