Implement some ActCtx functions for msvcr80.dll

This commit is contained in:
2025-10-05 15:52:38 -06:00
parent 5a2f8e2926
commit b87fb5e472
9 changed files with 437 additions and 1 deletions

View File

@@ -5,6 +5,14 @@
namespace user32 {
constexpr uint32_t RT_STRING_ID = 6;
constexpr uintptr_t kDefaultKeyboardLayout = 0x04090409;
constexpr int UOI_FLAGS = 1;
constexpr DWORD WSF_VISIBLE = 0x0001;
struct USEROBJECTFLAGS {
BOOL fInherit;
BOOL fReserved;
DWORD dwFlags;
};
int WIN_FUNC LoadStringA(void* hInstance, unsigned int uID, char* lpBuffer, int cchBufferMax) {
HOST_CONTEXT_GUARD();
@@ -122,6 +130,48 @@ namespace user32 {
wibo::lastError = ERROR_SUCCESS;
return reinterpret_cast<HKL>(kDefaultKeyboardLayout);
}
HWINSTA WIN_FUNC GetProcessWindowStation() {
DEBUG_LOG("GetProcessWindowStation()\n");
static int kWindowStationStub;
wibo::lastError = ERROR_SUCCESS;
return reinterpret_cast<HWINSTA>(&kWindowStationStub);
}
BOOL WIN_FUNC GetUserObjectInformationA(HANDLE hObj, int nIndex, PVOID pvInfo, DWORD nLength,
LPDWORD lpnLengthNeeded) {
DEBUG_LOG("GetUserObjectInformationA(%p, %d, %p, %u, %p)\n", hObj, nIndex, pvInfo, nLength,
lpnLengthNeeded);
(void)hObj;
if (lpnLengthNeeded) {
*lpnLengthNeeded = sizeof(USEROBJECTFLAGS);
}
if (nIndex != UOI_FLAGS) {
wibo::lastError = ERROR_CALL_NOT_IMPLEMENTED;
return FALSE;
}
if (!pvInfo || nLength < sizeof(USEROBJECTFLAGS)) {
wibo::lastError = ERROR_INSUFFICIENT_BUFFER;
return FALSE;
}
auto *flags = reinterpret_cast<USEROBJECTFLAGS *>(pvInfo);
flags->fInherit = FALSE;
flags->fReserved = FALSE;
flags->dwFlags = WSF_VISIBLE;
wibo::lastError = ERROR_SUCCESS;
return TRUE;
}
HWND WIN_FUNC GetActiveWindow() {
DEBUG_LOG("GetActiveWindow()\n");
wibo::lastError = ERROR_SUCCESS;
return nullptr;
}
}
@@ -130,6 +180,9 @@ static void *resolveByName(const char *name) {
if (strcmp(name, "LoadStringW") == 0) return (void *) user32::LoadStringW;
if (strcmp(name, "MessageBoxA") == 0) return (void *) user32::MessageBoxA;
if (strcmp(name, "GetKeyboardLayout") == 0) return (void *) user32::GetKeyboardLayout;
if (strcmp(name, "GetProcessWindowStation") == 0) return (void *) user32::GetProcessWindowStation;
if (strcmp(name, "GetUserObjectInformationA") == 0) return (void *) user32::GetUserObjectInformationA;
if (strcmp(name, "GetActiveWindow") == 0) return (void *) user32::GetActiveWindow;
return nullptr;
}