Author SHA1 Message Date
TheTank20 24c9c67b9d Update README.md 2023-07-06 21:57:18 -05:00
TheTank20 eb5afa20ea Update README.md 2023-07-06 21:53:55 -05:00
thepwrtank18 abcccb9f44 Set file names to be different on compile time 2023-07-06 21:47:32 -05:00
thepwrtank18 5772b8f2f3 Fix x64 Edition 2023-07-06 21:39:28 -05:00
thepwrtank18 b831b05b60 credits 2023-06-18 11:06:23 -05:00
TheTank20 c02f2ac27e Update README.md 2023-06-18 11:02:40 -05:00
thepwrtank18 25058b9cad Merge branch 'master' of https://github.com/UMSKT/xpmgr 2023-06-18 11:00:02 -05:00
thepwrtank18 545b33b4c0 added GetWPALeft and GetEvalLeft 2023-06-18 10:59:54 -05:00
TheTank20 fee22a67c6 Update README.md 2023-06-18 01:04:37 -05:00
3 changed files with 127 additions and 13 deletions

No files matched your search

+17
View File
@@ -2,6 +2,16 @@
Command line interface for Windows XP license management, inspired by Microsoft's "slmgr".
## 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`).
`--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).
`--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!
## Releases
https://github.com/UMSKT/xpmgr/releases
## Building
Due to GitHub not wanting to cooperate with auto-building for Windows XP (who would have thought?), you need to build it yourself.
+89 -11
View File
@@ -6,15 +6,26 @@
#include <commctrl.h>
#include <stdint.h>
#include <intrin.h>
#include <algorithm>
#include <atlconv.h>
#include <iostream>
#include <comutil.h>
#pragma comment(lib, "comsuppw.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.
// 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 CLSID licdllCLSID = { 0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F} };
@@ -132,13 +143,41 @@ static BOOL LoadLicenseManager()
LicenseAgent = NULL;
return FALSE;
}
if (dwWPALeft == 0x7FFFFFFF) {
std::cout << "An error occurred: dwWPALeft is 0x7FFFFFFF";
return TRUE;
}
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 = 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) {
@@ -210,25 +249,64 @@ wchar_t* convertCharArrayToLPCWSTR(const char* charArray)
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[])
{
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());
return 0;
}
else if (std::string(argv[1]) == "--SetConfirmationID") {
std::cout << _com_util::ConvertBSTRToString(SetConfirmationID(_com_util::ConvertStringToBSTR(argv[2])));
else if (cmdOptionExists(argv, argv + argc, "--SetConfirmationID")) {
std::cout << _com_util::ConvertBSTRToString(SetConfirmationID(_com_util::ConvertStringToBSTR(getCmdOption(argv, argv+argc, "--SetConfirmationID"))));
return 0;
}
else if (std::string(argv[1]) == "--SetProductKey") {
std::cout << _com_util::ConvertBSTRToString(SetProductKey(convertCharArrayToLPCWSTR(argv[2])));
else if (cmdOptionExists(argv, argv + argc, "--SetProductKey")) {
std::cout << _com_util::ConvertBSTRToString(SetProductKey(convertCharArrayToLPCWSTR(getCmdOption(argv, argv + argc, "--SetProductKey"))));
return 0;
}
else if (std::string(argv[1]) == "--GetProductID") {
else if (cmdOptionExists(argv, argv + argc, "--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 {
std::cout << "Please put in arguments";
return 0;
}
return 0;
}
+21 -2
View File
@@ -23,7 +23,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{f76e79ed-b941-49f6-a040-f560aa2b9e09}</ProjectGuid>
<RootNamespace>xpmgr</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -48,7 +48,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -70,6 +70,23 @@
<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|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'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@@ -106,6 +123,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -120,6 +138,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>