Commit Graph

10 Commits

Author SHA1 Message Date
Simon Lindholm 90101d8bc1 Minor cppcheck lint fixes 2023-10-16 20:08:52 +02: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
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
Simon Lindholm ced712df09 Clean up function resolution a little 2022-07-18 23:02:55 +02:00
Ryan Burns b86a542fe2
Explicitly link std::filesystem as needed (#14)
* Fix cmake install command

PROGRAMS specifies executable files, while TARGETS specifies cmake
targets. This install command happened to work when doing an in-tree
build (build dir == source dir) but will otherwise fail.

* Explicitly link std::filesystem as needed

On some older compilers, std::filesystem is provided as a separate
library from the C++ standard library. For example, on GCC 8, one must
explicitly link with -lstdc++fs.

We can use a drop-in https://github.com/vector-of-bool/CMakeCM module to
automate detection of and linking against this auxiliary library when needed.

* Add missing include

std::min is in <algorithm> header
This is transitively included in libstdc++ (GCC)
but not in libc++ (Clang)

(Encountered when testing -lc++fs auxiliary library linking in Clang 7)
2022-07-08 02:02:27 +09: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
Simon Lindholm 1a9d5d5a86 resources 2022-06-29 13:19:45 +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