Commit Graph

29 Commits

Author SHA1 Message Date
Simon Lindholm 90101d8bc1 Minor cppcheck lint fixes 2023-10-16 20:08:52 +02:00
Simon Lindholm b1dd93d7b7 Zero out TIB
Not for any particular reason, but having it contain non-deterministic
stack garbage seems like a bad idea.
2023-10-16 20:05:34 +02:00
Luke Street 5a4af7d51b
Ensure we don't reallocate during 2GB address space block (#49)
* Ensure we don't reallocate during 2GB address space block

* Use std::string_view and std::from_chars to avoid allocations

* Use MAP_FIXED instead of MAP_FIXED_NOREPLACE

* Use raw syscalls and stack buffer

* Use exit(1)
2023-10-03 21:26:30 -04:00
Luke Street c4de05946d
Fix `TlsGetValue` & more (#48)
`TlsGetValue` disambiguates 0 and an error by relying on `GetLastError`. Depending on the program state, `GetLastError` could be non-0, even though `TlsGetValue` succeeded. Resolve this by always setting `wibo::lastError`. This matches the behavior described by the documentation.

Additionally, when reading resources, later versions of mwcc and mwld call `GetModuleHandleA` with the program path, and then call `LoadStringA` on that handle. Support this behavior by _actually_ loading the PE at the path passed in to `GetModuleHandleA`, instead of assuming it's the current program.

(This is especially useful because sjiswrap relies on overriding `GetModuleFileNameA`, so the wrapped program reads its own resources, rather than sjiswrap's.)

Other small changes:
- Add ms-win-crt `exit` & run atexit funcs
- Implements vcruntime `memmove`
- Implements kernel32 `GetModuleFileNameA`
2023-10-01 23:56:35 -04:00
Ethan Roseman 8a6aacb82d
GetLocaleInfoW (#47)
* GetLocaleInfoW for ee-as.exe 991111b

* Try to do it the right way

* 3rd time's the charm?

* round 4

* it doesn't matter now what happens i will never give up the fight

* comments

* fin
2023-09-22 09:13:56 +09:00
ConorB 218b4d7d76
Implement enough process handling logic to make psyq4.0 happy (#46)
* Implement enough process handling logic to make psyq4.0 happy

* revert gitignore

* data type update

* PR review

* DEBUG_LOG mistake

---------

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
2023-09-18 15:05:47 +09:00
Ethan Roseman 6a420668e5
CorExitProcess for armcc_41_1440 (#44)
* Implement CorExitProcess for armcc_41_1440

* Fix function signature, add dll coverage
2023-09-12 22:44:56 +09:00
Ethan Roseman b7e8e5fb80
3 msvcrt funcs (#42)
* msvcrt funcs

* fix empty final line

* Promment
2023-09-11 04:22:01 +09:00
Luke Street 94b44fd697
Everything needed to run simple Rust programs (#40)
* Everything needed to run simple Rust programs

* Add IsDBCSLeadByte implementation

* Address PR comments
2023-09-10 12:07:23 +09:00
ConorB 3e2d84fa69
Force VirtualAlloc allocations to fall below the 2GB mark (#36)
Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
2023-06-02 21:30:45 +02:00
Parker e83af50b10
Properly implement GetCurrentProcessID, GetCurrentThreadId (#35) 2023-04-01 11:13:21 +02:00
Luke Street 9837ce0bf4
Pass absolute path to exe in argv[0] (#31) 2023-01-23 16:35:50 +01:00
Simon Lindholm ffe30a626b Fix cmdline backslash escaping 2022-07-31 13:17:14 +02:00
Simon Lindholm e54657b55f Misc minor improvements 2022-07-29 23:39:42 +02:00
Simon Lindholm c47665f8ae Improve TIB 2022-07-28 00:13:36 +02:00
Simon Lindholm ff947fb707 Fix Heap{Re,}Alloc 2022-07-27 21:27:27 +01:00
Simon Lindholm ced712df09 Clean up function resolution a little 2022-07-18 23:02:55 +02:00
Simon Lindholm 228bf4663e File handles 2022-07-04 00:42:47 +02:00
Mark Street b9f6c4c64e
Add support for SN compilers (#4)
* More kernel32 functions implemented poorly

* fix a smattering of issues to make cc1n64 work

* fix issues breaking psyq aspsx

* Return lowercase Windows paths if uppercase path doesnt exist

* Add SetStdHandle

* Add super naive FormatMessageA

* Case insensitive file matching

* PR comments

* Adding CompareString* + SetEnvironmentVariableA functions

Co-authored-by: Ash Wolf <ninji@wuffs.org>
Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
2022-07-03 23:27:48 +09:00
Ethan Roseman d92f0d1d08
Readme changes, github actions ci, test (#1)
* Readme changes, github actions ci, test

* Std flag change for older GCC versions"

* Install gcc multilib

* test fix and formatting

* Don't segfault on nonexistant file and show error instead

* Update ci.yml

* PR comments

* remove silly bit
2022-07-01 04:23:00 +09:00
Simon Lindholm f11759cc71 mwcc 4.* 2022-06-29 17:34:38 +02:00
Simon Lindholm 916c10543d ole32 2022-06-29 17:26:24 +02:00
Simon Lindholm 6281fa2da7 Support more mwcc versions 2022-06-29 16:57:11 +02:00
Simon Lindholm 81e85504de Improve logging 2022-06-29 16:56:36 +02:00
Simon Lindholm 1a9d5d5a86 resources 2022-06-29 13:19:45 +02:00
Simon Lindholm e6dc3b4ffd Command line parsing 2022-06-29 01:29:26 +02:00
Simon Lindholm 82c05df74e more 2022-06-29 01:07:04 +02:00
Simon Lindholm 3fd1f6a30c wip 2022-06-28 23:08:23 +02:00
Ash Wolf d1a4fd35a7 first commit 2022-06-13 02:20:18 +02:00