mirror of
https://github.com/UMSKT/xpmgr.git
synced 2026-07-03 21:04:21 +02:00
remove all O2003 stuff (broken)
This commit is contained in:
parent
c77a8d87bb
commit
bdebf4aac0
331
xpmgr.cpp
331
xpmgr.cpp
@ -22,9 +22,6 @@ const char* specifiedProduct = nullptr;
|
||||
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 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 } };
|
||||
|
||||
#undef XP_INTERFACE
|
||||
#define XP_INTERFACE ICOMLicenseAgent
|
||||
DECLARE_INTERFACE_(ICOMLicenseAgent, IDispatch)
|
||||
@ -100,134 +97,9 @@ public:
|
||||
STDMETHOD(VerifyCheckDigits)(THIS_ BSTR bstrCIDIID, LONG * pbValue) PURE;
|
||||
};
|
||||
|
||||
#undef O2003_INTERFACE
|
||||
#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;
|
||||
|
||||
/*** IDispatch methods ***/
|
||||
STDMETHOD(GetTypeInfoCount)(THIS_ UINT FAR * pctinfo) PURE;
|
||||
STDMETHOD(GetTypeInfo)(THIS_ UINT itinfo, LCID lcid, ITypeInfo FAR * FAR * pptinfo) PURE;
|
||||
STDMETHOD(GetIDsOfNames)(THIS_ REFIID riid, OLECHAR FAR * FAR * rgszNames, UINT cNames, LCID lcid, DISPID FAR * rgdispid) PURE;
|
||||
STDMETHOD(Invoke)(THIS_ DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR * pdispparams, VARIANT FAR * pvarResult, EXCEPINFO FAR * pexcepinfo, UINT FAR * puArgErr) PURE;
|
||||
|
||||
/*** ILicAgent methods ***/
|
||||
// ChatGPT actually got this right wtf
|
||||
STDMETHOD(Initialize)(THIS_ ULONG dwBPC, ULONG dwMode, BSTR bstrLicSource, ULONG * pdwRetCode) PURE;
|
||||
STDMETHOD(GetFirstName)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetFirstName)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetLastName)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetLastName)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetOrgName)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetOrgName)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetEmail)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetEmail)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetPhone)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetPhone)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetAddress1)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetAddress1)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetCity)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetCity)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetState)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetState)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetCountryCode)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetCountryCode)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetCountryDesc)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetCountryDesc)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetZip)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetZip)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetIsoLanguage)(THIS_ unsigned long* pdwVal) PURE;
|
||||
STDMETHOD(SetIsoLanguage)(THIS_ unsigned long dwNewVal) PURE;
|
||||
STDMETHOD(GetMSUpdate)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetMSUpdate)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetMSOffer)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetMSOffer)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetOtherOffer)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetOtherOffer)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetAddress2)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetAddress2)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(CheckSystemClock)(THIS_ unsigned long* pdwRetCode) PURE;
|
||||
STDMETHOD(GetExistingExpiryDate)(THIS_ DATE * pDateVal) PURE;
|
||||
STDMETHOD(GetNewExpiryDate)(THIS_ DATE * pDateVal) PURE;
|
||||
STDMETHOD(GetBillingFirstName)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingFirstName)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingLastName)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingLastName)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingPhone)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingPhone)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingAddress1)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingAddress1)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingAddress2)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingAddress2)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingCity)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingCity)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingState)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingState)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingCountryCode)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingCountryCode)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(GetBillingZip)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(SetBillingZip)(THIS_ BSTR bstrNewVal) PURE;
|
||||
STDMETHOD(SaveBillingInfo)(THIS_ int bSave, unsigned long* pdwRetVal) PURE;
|
||||
STDMETHOD(IsCCRenewalCountry)(THIS_ BSTR bstrCountryCode, int* pbRetVal) PURE;
|
||||
STDMETHOD(GetVATLabel)(THIS_ BSTR bstrCountryCode, BSTR * pbstrVATLabel) PURE;
|
||||
STDMETHOD(GetCCRenewalExpiryDate)(THIS_ DATE * pDateVal) PURE;
|
||||
STDMETHOD(SetVATNumber)(THIS_ BSTR bstrVATNumber) PURE;
|
||||
STDMETHOD(SetCreditCardType)(THIS_ BSTR bstrCCCode) PURE;
|
||||
STDMETHOD(SetCreditCardNumber)(THIS_ BSTR bstrCCNumber) PURE;
|
||||
STDMETHOD(SetCreditCardExpiryYear)(THIS_ unsigned long dwCCYear) PURE;
|
||||
STDMETHOD(SetCreditCardExpiryMonth)(THIS_ unsigned long dwCCMonth) PURE;
|
||||
STDMETHOD(GetCreditCardCount)(THIS_ unsigned long* pdwCount) PURE;
|
||||
STDMETHOD(GetCreditCardCode)(THIS_ unsigned long dwIndex, BSTR * pbstrCode) PURE;
|
||||
STDMETHOD(GetCreditCardName)(THIS_ unsigned long dwIndex, BSTR * pbstrName) PURE;
|
||||
STDMETHOD(GetVATNumber)(THIS_ BSTR * pbstrVATNumber) PURE;
|
||||
STDMETHOD(GetCreditCardType)(THIS_ BSTR * pbstrCCCode) PURE;
|
||||
STDMETHOD(GetCreditCardNumber)(THIS_ BSTR * pbstrCCNumber) PURE;
|
||||
STDMETHOD(GetCreditCardExpiryYear)(THIS_ unsigned long* pdwCCYear) PURE;
|
||||
STDMETHOD(GetCreditCardExpiryMonth)(THIS_ unsigned long* pdwCCMonth) PURE;
|
||||
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(GetAsyncProcessReturnCode)(THIS_ unsigned long* pdwRetCode) PURE;
|
||||
STDMETHOD(IsUpgradeAvailable)(THIS_ int* pbUpgradeAvailable) PURE;
|
||||
STDMETHOD(WantUpgrade)(THIS_ int bWantUpgrade) PURE;
|
||||
STDMETHOD(AsyncProcessDroppedLicenseRequest)() PURE;
|
||||
STDMETHOD(GenerateInstallationId)(THIS_ BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(DepositConfirmationId)(THIS_ BSTR bstrVal, unsigned long* pdwRetCode) PURE;
|
||||
STDMETHOD(VerifyCheckDigits)(THIS_ BSTR bstrCIDIID, int* pbValue) PURE;
|
||||
STDMETHOD(GetCurrentExpiryDate)(THIS_ DATE * pDateVal) PURE;
|
||||
STDMETHOD(CancelAsyncProcessRequest)(THIS_ int bIsLicenseRequest) PURE;
|
||||
STDMETHOD(GetCurrencyDescription)(THIS_ unsigned long dwCurrencyIndex, BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(GetPriceItemCount)(THIS_ unsigned long* pdwCount) PURE;
|
||||
STDMETHOD(GetPriceItemLabel)(THIS_ unsigned long dwIndex, BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(GetPriceItemValue)(THIS_ unsigned long dwCurrencyIndex, unsigned long dwIndex, BSTR * pbstrVal) PURE;
|
||||
STDMETHOD(GetInvoiceText)(THIS_ BSTR * pNewVal) PURE;
|
||||
STDMETHOD(GetBackendErrorMsg)(THIS_ BSTR * pbstrErrMsg) PURE;
|
||||
STDMETHOD(GetCurrencyOption)(THIS_ unsigned long* dwCurrencyOption) PURE;
|
||||
STDMETHOD(SetCurrencyOption)(THIS_ unsigned long dwCurrencyOption) PURE;
|
||||
STDMETHOD(GetEndOfLifeHtmlText)(THIS_ BSTR * pbstrHtmlText) PURE;
|
||||
STDMETHOD(DisplaySSLCert)(THIS_ unsigned long* dwRetCode) PURE;
|
||||
};
|
||||
|
||||
static BOOL XP_ComInitialized = FALSE;
|
||||
static ICOMLicenseAgent* XP_LicenseAgent = nullptr;
|
||||
|
||||
static BOOL O2003_ComInitialized = FALSE;
|
||||
static ILicAgent* O2003_LicenseAgent = nullptr;
|
||||
|
||||
static BOOL XP_LoadLicenseManager()
|
||||
{
|
||||
if (!XP_ComInitialized) {
|
||||
@ -268,68 +140,7 @@ static BOOL XP_LoadLicenseManager()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL O2003_LoadLicenseManager()
|
||||
{
|
||||
if (!O2003_ComInitialized) {
|
||||
const HRESULT status = CoInitializeEx(nullptr, 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;
|
||||
return FALSE;
|
||||
}
|
||||
O2003_ComInitialized = TRUE;
|
||||
}
|
||||
if (!O2003_LicenseAgent) {
|
||||
HRESULT status = CoCreateInstance(O2003_CLSID, nullptr, CLSCTX_INPROC_SERVER, O2003_IID, reinterpret_cast<void **>(&O2003_LicenseAgent));
|
||||
int good = 0;
|
||||
if (SUCCEEDED(status)) {
|
||||
ULONG dwRetCode;
|
||||
status = O2003_LicenseAgent->Initialize(0xC475, 3, nullptr, &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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#pragma region Internals
|
||||
bool RegistryKeyExists(HKEY rootKey, const char* keyPath) {
|
||||
HKEY hKey;
|
||||
const LSTATUS result = RegOpenKeyEx(rootKey, keyPath, 0, KEY_READ, &hKey);
|
||||
|
||||
if (result == ERROR_SUCCESS) {
|
||||
RegCloseKey(hKey);
|
||||
return true;
|
||||
}
|
||||
else if (result == ERROR_FILE_NOT_FOUND) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
std::cerr << "Error opening registry key. Error code: " << result << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t* convertCharArrayToLPCWSTR(const char* charArray)
|
||||
{
|
||||
@ -716,100 +527,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");
|
||||
}
|
||||
|
||||
// TODO: find a way to check office 2003 activation status
|
||||
|
||||
int pbValue;
|
||||
const 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, std::size(buffer), L"%s 0x%X %d", error, status, pbValue);
|
||||
|
||||
return SysAllocString(buffer);
|
||||
}
|
||||
return SysAllocString(L"Successfully verified CID chunk");
|
||||
}
|
||||
|
||||
static BSTR O2003_SetConfirmationID(BSTR confirmationID) {
|
||||
if (!O2003_LoadLicenseManager()) {
|
||||
return SysAllocString(L"An error occurred at O2003_LoadLicenseManager: Failed to load");
|
||||
}
|
||||
|
||||
// TODO: find a way to check office 2003 activation status
|
||||
|
||||
const int length = static_cast<int>(SysStringLen(confirmationID));
|
||||
char* str = new char[length + 1];
|
||||
WideCharToMultiByte(CP_UTF8, 0, confirmationID, length, str, length, nullptr, nullptr);
|
||||
str[length] = '\0';
|
||||
|
||||
std::string inputString(str);
|
||||
inputString.erase(std::remove(inputString.begin(), inputString.end(), '-'), inputString.end()); // remove -'s
|
||||
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")) {
|
||||
return SysAllocString(L"An error occurred at XP_VerifyCheckDigits: Check for misspelling");
|
||||
}
|
||||
}
|
||||
|
||||
ULONG dwRetCode;
|
||||
const 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"Successfully set confirmation ID");
|
||||
}
|
||||
|
||||
static BSTR O2003_GetInstallationID() {
|
||||
if (!O2003_LoadLicenseManager()) {
|
||||
return SysAllocString(L"An error occurred at O2003_LoadLicenseManager: Failed to load");
|
||||
}
|
||||
else {
|
||||
std::cout << "DEBUG: LoadLicenseManager checked";
|
||||
}
|
||||
|
||||
// TODO: find a way to check office 2003 activation status
|
||||
|
||||
BSTR installationID = nullptr;
|
||||
std::cout << "DEBUG: installationID = NULL";
|
||||
const 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);
|
||||
}
|
||||
else {
|
||||
return installationID;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
int main(int argc, char* argv[])
|
||||
@ -824,7 +541,7 @@ int main(int argc, char* argv[])
|
||||
"--GetEvalLeft: Gets the days before the evaluation period expires (Eval. copies only)\n"
|
||||
"--SetProductKey [pkey]: Sets/changes product key\n"
|
||||
"--GetProductID: Gets the product ID of Windows\n"
|
||||
"--Office2003: Manages Office 2003 rather than Windows [EXPERIMENTAL] (32-bit xpmgr only)\n"
|
||||
//"--Office2003: Manages Office 2003 rather than Windows [EXPERIMENTAL] (32-bit xpmgr only)\n"
|
||||
"--GetUsage: Displays this message";
|
||||
|
||||
if (cmdOptionExists(argv, argv + argc, "--GetUsage")) {
|
||||
@ -832,29 +549,7 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmdOptionExists(argv, argv + argc, "--Office2003")) {
|
||||
#ifdef ENVIRONMENT32
|
||||
|
||||
if (cmdOptionExists(argv, argv + argc, "--BypassInstallCheck") || RegistryKeyExists(HKEY_CLASSES_ROOT, "CLSID\\{000C0114-0000-0000-C000-000000000046}")) {
|
||||
specifiedProduct = "Office2003";
|
||||
} else {
|
||||
std::cout << "An error occurred at RegistryKeyExists: Office 2003 isn't detected (specifically, it's COM Module, responsible for activation). Please (re)install Office 2003, since you wouldn't be able to activate via the GUI anyway.";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
specifiedProduct = "WindowsNT5x";
|
||||
}
|
||||
#endif
|
||||
#ifdef ENVIRONMENT64
|
||||
std::cout << "An error occurred at ENVIRONMENT64: Please switch to the x86 version of xpmgr to manage Office 2003.";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENVIRONMENT64
|
||||
specifiedProduct = "WindowsNT5x";
|
||||
#endif
|
||||
|
||||
if (std::strcmp(specifiedProduct, "WindowsNT5x") == 0) {
|
||||
SYSTEM_INFO systemInfo;
|
||||
@ -898,51 +593,27 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
if (cmdOptionExists(argv, argv + argc, "--GetInstallationID") || cmdOptionExists(argv, argv + argc, "/dti")) {
|
||||
if (std::strcmp(specifiedProduct, "Office2003") == 0) {
|
||||
std::cout << ConvertToStdString(O2003_GetInstallationID());
|
||||
return 0;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_GetInstallationID());
|
||||
return 0;
|
||||
}
|
||||
else if (cmdOptionExists(argv, argv + argc, "--SetConfirmationID") || cmdOptionExists(argv, argv + argc, "/atp")) {
|
||||
if (std::strcmp(specifiedProduct, "Office2003") == 0) {
|
||||
std::cout << ConvertToStdString(O2003_SetConfirmationID(ConvertCharToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
|
||||
return 0;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_SetConfirmationID(ConvertCharToBSTR(getCmdOption(argv, argv + argc, "--SetConfirmationID"))));
|
||||
return 0;
|
||||
}
|
||||
else if (cmdOptionExists(argv, argv + argc, "--GetWPALeft")) {
|
||||
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
|
||||
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
|
||||
return 6;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_GetWPALeft());
|
||||
return 0;
|
||||
}
|
||||
else if (cmdOptionExists(argv, argv + argc, "--GetEvalLeft")) {
|
||||
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
|
||||
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
|
||||
return 6;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_GetEvalLeft());
|
||||
return 0;
|
||||
}
|
||||
|
||||
else if (cmdOptionExists(argv, argv + argc, "--SetProductKey") || cmdOptionExists(argv, argv + argc, "/ipk")) {
|
||||
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
|
||||
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
|
||||
return 6;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_SetProductKey(convertCharArrayToLPCWSTR(getCmdOption(argv, argv + argc, "--SetProductKey"))));
|
||||
return 0;
|
||||
}
|
||||
else if (cmdOptionExists(argv, argv + argc, "--GetProductID")) {
|
||||
if (std::strcmp(specifiedProduct, "WindowsNT5x") != 0) {
|
||||
std::cout << "An error occurred at specifiedProduct: This command is for Windows management only.";
|
||||
return 6;
|
||||
}
|
||||
std::cout << ConvertToStdString(XP_GetProductID());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user