Compare commits

..

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

1 changed files with 10 additions and 6 deletions

View File

@ -532,7 +532,7 @@ static BSTR XP_GetWPALeft() {
return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated"); return SysAllocString(L"An error occurred at GetWPALeft: Windows is activated");
} }
wchar_t buffer[16]; wchar_t buffer[16];
swprintf(buffer, L"%lu", dwWPALeft); swprintf_s(buffer, 16, L"%lu", dwWPALeft);
return SysAllocString(buffer); return SysAllocString(buffer);
} }
@ -559,7 +559,7 @@ static BSTR XP_GetEvalLeft() {
return SysAllocString(L"An error occurred at GetEvalLeft: Not an evaluation copy"); return SysAllocString(L"An error occurred at GetEvalLeft: Not an evaluation copy");
} }
wchar_t buffer[16]; wchar_t buffer[16];
swprintf(buffer, L"%lu", dwWPALeft); swprintf_s(buffer, 16, L"%lu", dwWPALeft);
return SysAllocString(buffer); return SysAllocString(buffer);
} }
@ -734,7 +734,7 @@ static BSTR O2003_VerifyCheckDigits(BSTR cidChunk) {
std::wstring result = error + numberStr; std::wstring result = error + numberStr;
wchar_t buffer[100]; wchar_t buffer[100];
swprintf(buffer, std::size(buffer), L"%s 0x%X %d", error, status, pbValue); swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), L"%s 0x%X %d", error, status, pbValue);
return SysAllocString(buffer); return SysAllocString(buffer);
} }
@ -835,9 +835,13 @@ int main(int argc, char* argv[])
if (cmdOptionExists(argv, argv + argc, "--Office2003")) { if (cmdOptionExists(argv, argv + argc, "--Office2003")) {
#ifdef ENVIRONMENT32 #ifdef ENVIRONMENT32
if (cmdOptionExists(argv, argv + argc, "--BypassInstallCheck") || RegistryKeyExists(HKEY_CLASSES_ROOT, "CLSID\\{000C0114-0000-0000-C000-000000000046}")) { if (cmdOptionExists(argv, argv + argc, "--BypassInstallCheck")) {
specifiedProduct = "Office2003"; specifiedProduct = "Office2003";
} else { }
else if (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."; 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; return 0;
} }