This commit is contained in:
Vichingo455
2025-03-23 15:26:15 +01:00
parent cacf40b6cd
commit ad8366918e
72 changed files with 10255 additions and 2 deletions

31
shared/LegacyUpdate.c Normal file
View File

@@ -0,0 +1,31 @@
#include "stdafx.h"
#include <windows.h>
#include "Registry.h"
static LPWSTR _installPath;
EXTERN_C HRESULT GetInstallPath(LPWSTR *path) {
*path = (LPWSTR)LocalAlloc(LPTR, MAX_PATH * sizeof(WCHAR));
HRESULT hr = S_OK;
if (!_installPath) {
DWORD size = 0;
hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\LegacyUpdate", L"InstallLocation", KEY_WOW64_64KEY, &_installPath, &size);
if (SUCCEEDED(hr)) {
lstrcpy(*path, _installPath);
return S_OK;
}
// Do our best to guess where it should be
LPWSTR programFiles;
hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", L"ProgramFilesDir", KEY_WOW64_64KEY, &programFiles, &size);
if (SUCCEEDED(hr)) {
_installPath = (LPWSTR)LocalAlloc(LPTR, MAX_PATH * sizeof(WCHAR));
wsprintf(_installPath, L"%ls\\Legacy Update", programFiles);
LocalFree(programFiles);
}
}
lstrcpy(*path, _installPath);
return hr;
}