mirror of
https://github.com/UMSKT/xpmgr.git
synced 2026-11-05 22:47:54 +01:00
Compare commits
9
Commits
2023.06.18
...
2023.07.06
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24c9c67b9d | ||
|
|
eb5afa20ea | ||
|
|
abcccb9f44 | ||
|
|
5772b8f2f3 | ||
|
|
b831b05b60 | ||
|
|
c02f2ac27e | ||
|
|
25058b9cad | ||
|
|
545b33b4c0 | ||
|
|
fee22a67c6 |
No files matched your search
@@ -2,6 +2,16 @@
|
|||||||
Command line interface for Windows XP license management, inspired by Microsoft's "slmgr".
|
Command line interface for Windows XP license management, inspired by Microsoft's "slmgr".
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
**You need to download the right version for your edition of Windows XP/2003!**
|
||||||
|
|
||||||
|
In most cases, you'll need `xpmgr_x86.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 edition of XP or Server 2003, or a version of XP/Server 2003 we don't even know about, we unfortunately don't have a build for you. We can use your help to make one, though! Contact us at https://umskt.zulipchat.com.*
|
||||||
|
|
||||||
|
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`).
|
`--GetProductID`: Gets the product ID (ex: `76477-755-3803223-21229`).
|
||||||
|
|
||||||
`--SetProductKey`: Sets the product key (tested to work with dashes).
|
`--SetProductKey`: Sets the product key (tested to work with dashes).
|
||||||
@@ -10,8 +20,15 @@ Command line interface for Windows XP license management, inspired by Microsoft'
|
|||||||
|
|
||||||
`--SetConfirmationID`: Sets a Confirmation ID (tested to work with dashes).
|
`--SetConfirmationID`: Sets a Confirmation ID (tested to work with dashes).
|
||||||
|
|
||||||
|
`--GetWPALeft`: Gets the number of days before activation is required, in days. If successfully activated, this should be 2147483647.
|
||||||
|
|
||||||
|
`--GetEvalLeft`: Gets the number of days before the evaluation period expires, in days. In most cases, this should be 2147483647.
|
||||||
|
|
||||||
Make sure you do commands right, since, as of now, there's no checking to make sure it's correct or not!
|
Make sure you do commands right, since, as of now, there's no checking to make sure it's correct or not!
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
https://github.com/UMSKT/xpmgr/releases
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
Due to GitHub not wanting to cooperate with auto-building for Windows XP (who would have thought?), you need to build it yourself.
|
Due to GitHub not wanting to cooperate with auto-building for Windows XP (who would have thought?), you need to build it yourself.
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,26 @@
|
|||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <atlconv.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <comutil.h>
|
#include <comutil.h>
|
||||||
|
|
||||||
#pragma comment(lib, "comsuppw.lib")
|
#pragma comment(lib, "comsuppw.lib")
|
||||||
#pragma comment(lib, "kernel32.lib")
|
#pragma comment(lib, "kernel32.lib")
|
||||||
|
|
||||||
|
// Check windows
|
||||||
|
#if _WIN32 || _WIN64
|
||||||
|
#if _WIN64
|
||||||
|
#define ENVIRONMENT64
|
||||||
|
#else
|
||||||
|
#define ENVIRONMENT32
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// The magic numbers, interface, and LoadLicenseManager() function was made by diamondggg on MyDigitalLife.
|
// The magic numbers, interface, and LoadLicenseManager() function was made by diamondggg on MyDigitalLife.
|
||||||
// LoadLicenseManager() was modified to suit a CLI rather than a GUI.
|
// LoadLicenseManager() was modified to suit a CLI rather than a GUI.
|
||||||
// Everything else was made by TheTank20.
|
// Everything else was either made by TheTank20 or copy pasted from StackOverflow.
|
||||||
static wchar_t strings[14][256];
|
static wchar_t strings[14][256];
|
||||||
|
|
||||||
static CLSID licdllCLSID = { 0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F} };
|
static CLSID licdllCLSID = { 0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F} };
|
||||||
@@ -132,13 +143,41 @@ static BOOL LoadLicenseManager()
|
|||||||
LicenseAgent = NULL;
|
LicenseAgent = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (dwWPALeft == 0x7FFFFFFF) {
|
return TRUE;
|
||||||
std::cout << "An error occurred: dwWPALeft is 0x7FFFFFFF";
|
}
|
||||||
|
|
||||||
|
static BSTR GetWPALeft() {
|
||||||
|
if (!LoadLicenseManager()) {
|
||||||
|
return SysAllocString(L"Failed to load license manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG dwWPALeft = 0, dwEvalLeft = 0;
|
||||||
|
HRESULT status = LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
|
||||||
|
if (FAILED(status)) {
|
||||||
|
std::cout << "An error occurred at GetExpirationInfo: " + status;
|
||||||
LicenseAgent->Release();
|
LicenseAgent->Release();
|
||||||
LicenseAgent = NULL;
|
LicenseAgent = NULL;
|
||||||
return FALSE;
|
return SysAllocString(L"Failed to get expiration info");
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
return SysAllocString(_bstr_t(dwWPALeft).Detach());
|
||||||
|
}
|
||||||
|
|
||||||
|
static BSTR GetEvalLeft() {
|
||||||
|
if (!LoadLicenseManager()) {
|
||||||
|
return SysAllocString(L"Failed to load license manager");
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG dwWPALeft = 0, dwEvalLeft = 0;
|
||||||
|
HRESULT status = LicenseAgent->GetExpirationInfo(&dwWPALeft, &dwEvalLeft);
|
||||||
|
if (FAILED(status)) {
|
||||||
|
std::cout << "An error occurred at GetExpirationInfo: " + status;
|
||||||
|
LicenseAgent->Release();
|
||||||
|
LicenseAgent = NULL;
|
||||||
|
return SysAllocString(L"Failed to get expiration info");
|
||||||
|
}
|
||||||
|
|
||||||
|
return SysAllocString(_bstr_t(dwEvalLeft).Detach());
|
||||||
}
|
}
|
||||||
|
|
||||||
static BSTR SetConfirmationID(BSTR confirmationID) {
|
static BSTR SetConfirmationID(BSTR confirmationID) {
|
||||||
@@ -210,25 +249,64 @@ wchar_t* convertCharArrayToLPCWSTR(const char* charArray)
|
|||||||
return wString;
|
return wString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* getCmdOption(char** begin, char** end, const std::string& option)
|
||||||
|
{
|
||||||
|
char** itr = std::find(begin, end, option);
|
||||||
|
if (itr != end && ++itr != end)
|
||||||
|
{
|
||||||
|
return *itr;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cmdOptionExists(char** begin, char** end, const std::string& option)
|
||||||
|
{
|
||||||
|
return std::find(begin, end, option) != end;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if (std::string(argv[1]) == "--GetInstallationID") {
|
SYSTEM_INFO systemInfo;
|
||||||
|
GetNativeSystemInfo(&systemInfo);
|
||||||
|
#ifdef ENVIRONMENT32
|
||||||
|
if (systemInfo.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL) { // running under WOW64
|
||||||
|
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { // is AMD64
|
||||||
|
std::cout << "An error occurred: Incorrect version of xpmgr. You need to download the x64 version.";
|
||||||
|
}
|
||||||
|
else { // is IA64, PPC, megafart 386, whatever else
|
||||||
|
std::cout << "An error occurred: Incorrect version of xpmgr. Go to https://umskt.zulipchat.com if you want to help us make a version for your platform!";
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (cmdOptionExists(argv, argv+argc, "--GetInstallationID")) {
|
||||||
std::cout << _com_util::ConvertBSTRToString(GetInstallationID());
|
std::cout << _com_util::ConvertBSTRToString(GetInstallationID());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (std::string(argv[1]) == "--SetConfirmationID") {
|
else if (cmdOptionExists(argv, argv + argc, "--SetConfirmationID")) {
|
||||||
std::cout << _com_util::ConvertBSTRToString(SetConfirmationID(_com_util::ConvertStringToBSTR(argv[2])));
|
std::cout << _com_util::ConvertBSTRToString(SetConfirmationID(_com_util::ConvertStringToBSTR(getCmdOption(argv, argv+argc, "--SetConfirmationID"))));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (std::string(argv[1]) == "--SetProductKey") {
|
else if (cmdOptionExists(argv, argv + argc, "--SetProductKey")) {
|
||||||
std::cout << _com_util::ConvertBSTRToString(SetProductKey(convertCharArrayToLPCWSTR(argv[2])));
|
std::cout << _com_util::ConvertBSTRToString(SetProductKey(convertCharArrayToLPCWSTR(getCmdOption(argv, argv + argc, "--SetProductKey"))));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (std::string(argv[1]) == "--GetProductID") {
|
else if (cmdOptionExists(argv, argv + argc, "--GetProductID")) {
|
||||||
std::cout << _com_util::ConvertBSTRToString(GetProductID());
|
std::cout << _com_util::ConvertBSTRToString(GetProductID());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (cmdOptionExists(argv, argv + argc, "--GetWPALeft")) {
|
||||||
|
std::cout << _com_util::ConvertBSTRToString(GetWPALeft());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (cmdOptionExists(argv, argv + argc, "--GetEvalLeft")) {
|
||||||
|
std::cout << _com_util::ConvertBSTRToString(GetEvalLeft());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "Please put in arguments";
|
std::cout << "Please put in arguments";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
+21
-2
@@ -23,7 +23,7 @@
|
|||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<ProjectGuid>{f76e79ed-b941-49f6-a040-f560aa2b9e09}</ProjectGuid>
|
<ProjectGuid>{f76e79ed-b941-49f6-a040-f560aa2b9e09}</ProjectGuid>
|
||||||
<RootNamespace>xpmgr</RootNamespace>
|
<RootNamespace>xpmgr</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -70,6 +70,23 @@
|
|||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|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)'=='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>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
@@ -106,6 +123,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@@ -120,6 +138,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|||||||
Reference in new issue
Block a user