mirror of https://github.com/decompals/wibo.git
Handle some more armcc versions
This commit is contained in:
parent
bd4c09e743
commit
93b99a4f24
|
@ -90,7 +90,7 @@ namespace kernel32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WIN_FUNC SetLastError(unsigned int dwErrCode) {
|
void WIN_FUNC SetLastError(unsigned int dwErrCode) {
|
||||||
DEBUG_LOG("SetLastError %u\n", dwErrCode);
|
// DEBUG_LOG("SetLastError %u\n", dwErrCode);
|
||||||
wibo::lastError = dwErrCode;
|
wibo::lastError = dwErrCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,6 +746,12 @@ namespace kernel32 {
|
||||||
/*
|
/*
|
||||||
* Console Nonsense
|
* Console Nonsense
|
||||||
*/
|
*/
|
||||||
|
int WIN_FUNC GetConsoleMode(void *hConsoleHandle, unsigned int *lpMode) {
|
||||||
|
DEBUG_LOG("GetConsoleMode %p", hConsoleHandle);
|
||||||
|
*lpMode = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int WIN_FUNC SetConsoleCtrlHandler(void *HandlerRoutine, unsigned int Add) {
|
unsigned int WIN_FUNC SetConsoleCtrlHandler(void *HandlerRoutine, unsigned int Add) {
|
||||||
DEBUG_LOG("SetConsoleCtrlHandler\n");
|
DEBUG_LOG("SetConsoleCtrlHandler\n");
|
||||||
// This is a function that gets called when doing ^C
|
// This is a function that gets called when doing ^C
|
||||||
|
@ -800,6 +806,20 @@ namespace kernel32 {
|
||||||
return path.size();
|
return path.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int WIN_FUNC GetCurrentDirectoryW(unsigned int uSize, uint16_t *lpBuffer) {
|
||||||
|
DEBUG_LOG("GetCurrentDirectoryW\n");
|
||||||
|
|
||||||
|
std::filesystem::path cwd = std::filesystem::current_path();
|
||||||
|
std::string path = files::pathToWindows(cwd);
|
||||||
|
|
||||||
|
assert(path.size() < uSize);
|
||||||
|
const char *pathCstr = path.c_str();
|
||||||
|
for (size_t i = 0; i < path.size() + 1; i++) {
|
||||||
|
lpBuffer[i] = pathCstr[i] & 0xFF;
|
||||||
|
}
|
||||||
|
return path.size();
|
||||||
|
}
|
||||||
|
|
||||||
void* WIN_FUNC GetModuleHandleA(const char* lpModuleName) {
|
void* WIN_FUNC GetModuleHandleA(const char* lpModuleName) {
|
||||||
DEBUG_LOG("GetModuleHandleA %s\n", lpModuleName);
|
DEBUG_LOG("GetModuleHandleA %s\n", lpModuleName);
|
||||||
|
|
||||||
|
@ -1165,6 +1185,11 @@ namespace kernel32 {
|
||||||
return (void *) 0x100006;
|
return (void *) 0x100006;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WIN_FUNC HeapSetInformation(void *HeapHandle, int HeapInformationClass, void *HeapInformation, size_t HeapInformationLength) {
|
||||||
|
DEBUG_LOG("HeapSetInformation %p %d\n", HeapHandle, HeapInformationClass);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int WIN_FUNC HeapFree(void *hHeap, unsigned int dwFlags, void *lpMem) {
|
unsigned int WIN_FUNC HeapFree(void *hHeap, unsigned int dwFlags, void *lpMem) {
|
||||||
DEBUG_LOG("HeapFree(heap=%p, flags=%x, mem=%p)\n", hHeap, dwFlags, lpMem);
|
DEBUG_LOG("HeapFree(heap=%p, flags=%x, mem=%p)\n", hHeap, dwFlags, lpMem);
|
||||||
free(lpMem);
|
free(lpMem);
|
||||||
|
@ -1209,6 +1234,14 @@ namespace kernel32 {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *WIN_FUNC EncodePointer(void *Ptr) {
|
||||||
|
return Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *WIN_FUNC DecodePointer(void *Ptr) {
|
||||||
|
return Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
int WIN_FUNC CompareStringA(int Locale, unsigned int dwCmpFlags, const char *lpString1, unsigned int cchCount1, const char *lpString2, unsigned int cchCount2) {
|
int WIN_FUNC CompareStringA(int Locale, unsigned int dwCmpFlags, const char *lpString1, unsigned int cchCount1, const char *lpString2, unsigned int cchCount2) {
|
||||||
if (cchCount1 < 0)
|
if (cchCount1 < 0)
|
||||||
cchCount1 = strlen(lpString1);
|
cchCount1 = strlen(lpString1);
|
||||||
|
@ -1298,6 +1331,11 @@ namespace kernel32 {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WIN_FUNC QueryPerformanceFrequency(uint64_t *lpFrequency) {
|
||||||
|
*lpFrequency = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int WIN_FUNC IsDebuggerPresent() {
|
unsigned int WIN_FUNC IsDebuggerPresent() {
|
||||||
DEBUG_LOG("IsDebuggerPresent\n");
|
DEBUG_LOG("IsDebuggerPresent\n");
|
||||||
// If the current process is not running in the context of a debugger, the return value is zero.
|
// If the current process is not running in the context of a debugger, the return value is zero.
|
||||||
|
@ -1345,6 +1383,14 @@ namespace kernel32 {
|
||||||
printf("Aborting due to exception\n");
|
printf("Aborting due to exception\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WIN_FUNC InterlockedIncrement(int *Addend) {
|
||||||
|
return *Addend += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WIN_FUNC InterlockedDecrement(int *Addend) {
|
||||||
|
return *Addend -= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *wibo::resolveKernel32(const char *name) {
|
void *wibo::resolveKernel32(const char *name) {
|
||||||
|
@ -1393,10 +1439,13 @@ void *wibo::resolveKernel32(const char *name) {
|
||||||
if (strcmp(name, "GlobalFree") == 0) return (void *) kernel32::GlobalFree;
|
if (strcmp(name, "GlobalFree") == 0) return (void *) kernel32::GlobalFree;
|
||||||
if (strcmp(name, "GlobalFlags") == 0) return (void *) kernel32::GlobalFlags;
|
if (strcmp(name, "GlobalFlags") == 0) return (void *) kernel32::GlobalFlags;
|
||||||
if (strcmp(name, "GetCurrentDirectoryA") == 0) return (void *) kernel32::GetCurrentDirectoryA;
|
if (strcmp(name, "GetCurrentDirectoryA") == 0) return (void *) kernel32::GetCurrentDirectoryA;
|
||||||
|
if (strcmp(name, "GetCurrentDirectoryW") == 0) return (void *) kernel32::GetCurrentDirectoryW;
|
||||||
if (strcmp(name, "FindResourceA") == 0) return (void *) kernel32::FindResourceA;
|
if (strcmp(name, "FindResourceA") == 0) return (void *) kernel32::FindResourceA;
|
||||||
if (strcmp(name, "SetHandleCount") == 0) return (void *) kernel32::SetHandleCount;
|
if (strcmp(name, "SetHandleCount") == 0) return (void *) kernel32::SetHandleCount;
|
||||||
if (strcmp(name, "FormatMessageA") == 0) return (void *) kernel32::FormatMessageA;
|
if (strcmp(name, "FormatMessageA") == 0) return (void *) kernel32::FormatMessageA;
|
||||||
if (strcmp(name, "GetComputerNameA") == 0) return (void *) kernel32::GetComputerNameA;
|
if (strcmp(name, "GetComputerNameA") == 0) return (void *) kernel32::GetComputerNameA;
|
||||||
|
if (strcmp(name, "EncodePointer") == 0) return (void *) kernel32::EncodePointer;
|
||||||
|
if (strcmp(name, "DecodePointer") == 0) return (void *) kernel32::DecodePointer;
|
||||||
|
|
||||||
// processenv.h
|
// processenv.h
|
||||||
if (strcmp(name, "GetCommandLineA") == 0) return (void *) kernel32::GetCommandLineA;
|
if (strcmp(name, "GetCommandLineA") == 0) return (void *) kernel32::GetCommandLineA;
|
||||||
|
@ -1412,6 +1461,7 @@ void *wibo::resolveKernel32(const char *name) {
|
||||||
if (strcmp(name, "SetStdHandle") == 0) return (void *) kernel32::SetStdHandle;
|
if (strcmp(name, "SetStdHandle") == 0) return (void *) kernel32::SetStdHandle;
|
||||||
if (strcmp(name, "DuplicateHandle") == 0) return (void *) kernel32::DuplicateHandle;
|
if (strcmp(name, "DuplicateHandle") == 0) return (void *) kernel32::DuplicateHandle;
|
||||||
if (strcmp(name, "CloseHandle") == 0) return (void *) kernel32::CloseHandle;
|
if (strcmp(name, "CloseHandle") == 0) return (void *) kernel32::CloseHandle;
|
||||||
|
if (strcmp(name, "GetConsoleMode") == 0) return (void *) kernel32::GetConsoleMode;
|
||||||
if (strcmp(name, "SetConsoleCtrlHandler") == 0) return (void *) kernel32::SetConsoleCtrlHandler;
|
if (strcmp(name, "SetConsoleCtrlHandler") == 0) return (void *) kernel32::SetConsoleCtrlHandler;
|
||||||
if (strcmp(name, "GetConsoleScreenBufferInfo") == 0) return (void *) kernel32::GetConsoleScreenBufferInfo;
|
if (strcmp(name, "GetConsoleScreenBufferInfo") == 0) return (void *) kernel32::GetConsoleScreenBufferInfo;
|
||||||
|
|
||||||
|
@ -1466,10 +1516,10 @@ void *wibo::resolveKernel32(const char *name) {
|
||||||
// heapapi.h
|
// heapapi.h
|
||||||
if (strcmp(name, "HeapCreate") == 0) return (void *) kernel32::HeapCreate;
|
if (strcmp(name, "HeapCreate") == 0) return (void *) kernel32::HeapCreate;
|
||||||
if (strcmp(name, "GetProcessHeap") == 0) return (void *) kernel32::GetProcessHeap;
|
if (strcmp(name, "GetProcessHeap") == 0) return (void *) kernel32::GetProcessHeap;
|
||||||
|
if (strcmp(name, "HeapSetInformation") == 0) return (void *) kernel32::HeapSetInformation;
|
||||||
if (strcmp(name, "HeapAlloc") == 0) return (void *) kernel32::HeapAlloc;
|
if (strcmp(name, "HeapAlloc") == 0) return (void *) kernel32::HeapAlloc;
|
||||||
if (strcmp(name, "HeapReAlloc") == 0) return (void *) kernel32::HeapReAlloc;
|
if (strcmp(name, "HeapReAlloc") == 0) return (void *) kernel32::HeapReAlloc;
|
||||||
if (strcmp(name, "HeapSize") == 0) return (void *) kernel32::HeapSize;
|
if (strcmp(name, "HeapSize") == 0) return (void *) kernel32::HeapSize;
|
||||||
|
|
||||||
if (strcmp(name, "HeapFree") == 0) return (void *) kernel32::HeapFree;
|
if (strcmp(name, "HeapFree") == 0) return (void *) kernel32::HeapFree;
|
||||||
|
|
||||||
// memoryapi.h
|
// memoryapi.h
|
||||||
|
@ -1483,6 +1533,7 @@ void *wibo::resolveKernel32(const char *name) {
|
||||||
|
|
||||||
// profileapi.h
|
// profileapi.h
|
||||||
if (strcmp(name, "QueryPerformanceCounter") == 0) return (void *) kernel32::QueryPerformanceCounter;
|
if (strcmp(name, "QueryPerformanceCounter") == 0) return (void *) kernel32::QueryPerformanceCounter;
|
||||||
|
if (strcmp(name, "QueryPerformanceFrequency") == 0) return (void *) kernel32::QueryPerformanceFrequency;
|
||||||
|
|
||||||
// debugapi.h
|
// debugapi.h
|
||||||
if (strcmp(name, "IsDebuggerPresent") == 0) return (void *) kernel32::IsDebuggerPresent;
|
if (strcmp(name, "IsDebuggerPresent") == 0) return (void *) kernel32::IsDebuggerPresent;
|
||||||
|
@ -1496,6 +1547,8 @@ void *wibo::resolveKernel32(const char *name) {
|
||||||
|
|
||||||
// winnt.h
|
// winnt.h
|
||||||
if (strcmp(name, "RtlUnwind") == 0) return (void *) kernel32::RtlUnwind;
|
if (strcmp(name, "RtlUnwind") == 0) return (void *) kernel32::RtlUnwind;
|
||||||
|
if (strcmp(name, "InterlockedIncrement") == 0) return (void *) kernel32::InterlockedIncrement;
|
||||||
|
if (strcmp(name, "InterlockedDecrement") == 0) return (void *) kernel32::InterlockedDecrement;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue