mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 04:04:53 +01:00
Fix CI to use BAT files only for win build.
For consistency have the CI use the same build path as
the end-user builds.
Use where.exe from wine-10.0.
CI's version is a stub. Use one that actually works, until the CI gets
updated.
Also, fix broken RtlGenRandom by importing ADVAPI32's GetUserNameW(),
and calling GetModuleHandleW() / GetProcAddress() for SystemFunction032().
Instead of trying to use a fake import lib.
Bonus: Can now use the host system's username as the default for the
steam user name instead of "Noob".
("Noob" is still used as the fallback if this call fails, or the host
system's username is invalid.)
This commit is contained in:
parent
abd8300d47
commit
74d22df42e
17 changed files with 926 additions and 317 deletions
31
dll/base.cpp
31
dll/base.cpp
|
|
@ -19,14 +19,37 @@
|
|||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
HMODULE hadvapi32 = NULL;
|
||||
BOOLEAN (NTAPI *real_RtlGenRandom)(PVOID,ULONG) = NULL;
|
||||
|
||||
static void
|
||||
randombytes(char * const buf, const size_t size)
|
||||
{
|
||||
while (!RtlGenRandom((PVOID) buf, (ULONG) size)) {
|
||||
PRINT_DEBUG("RtlGenRandom ERROR\n");
|
||||
Sleep(100);
|
||||
PRINT_DEBUG("%s %p %zu.\n", "mine_RtlGenRandom() called.", buf, size);
|
||||
if (hadvapi32 == NULL) {
|
||||
hadvapi32 = GetModuleHandleW(L"advapi32.dll");
|
||||
if (hadvapi32 == NULL) {
|
||||
PRINT_DEBUG("%s.\n", "GetModuleHandle() failed for advapi32.dll");
|
||||
}
|
||||
PRINT_DEBUG("advapi32.dll handle: 0x%x.\n", hadvapi32);
|
||||
}
|
||||
|
||||
if (hadvapi32 != NULL &&
|
||||
real_RtlGenRandom == NULL) {
|
||||
real_RtlGenRandom = (BOOLEAN(NTAPI *)(PVOID,ULONG))GetProcAddress(hadvapi32, "SystemFunction036");
|
||||
if (real_RtlGenRandom == NULL) {
|
||||
PRINT_DEBUG("%s.\n", "GetProcAddress() failed for RtlGenRandom()");
|
||||
}
|
||||
PRINT_DEBUG("real_RtlGenRandom address: 0x%p.\n", real_RtlGenRandom);
|
||||
}
|
||||
if (real_RtlGenRandom != NULL) {
|
||||
PRINT_DEBUG("%s.\n", "Calling real_RtlGenRandom");
|
||||
while (!real_RtlGenRandom((PVOID) buf, (ULONG) size)) {
|
||||
PRINT_DEBUG("RtlGenRandom ERROR\n");
|
||||
Sleep(100);
|
||||
}
|
||||
PRINT_DEBUG("%s.\n", "real_RtlGenRandom returned");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string get_env_variable(std::string name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue