mirror of
https://github.com/R2Northstar/NorthstarLauncher
synced 2026-08-23 20:26:04 -04:00
Fix crash in silver-bun (#679)
This commit is contained in:
parent
85a2fb9c56
commit
d3ee91c1f5
1 changed files with 12 additions and 2 deletions
14
primedev/thirdparty/silver-bun/module.cpp
vendored
14
primedev/thirdparty/silver-bun/module.cpp
vendored
|
|
@ -15,11 +15,21 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
CModule::CModule(HMODULE hModule)
|
||||
{
|
||||
m_pModuleBase = reinterpret_cast<uintptr_t>(hModule);
|
||||
MODULEINFO mInfo {0};
|
||||
|
||||
if (hModule && hModule != INVALID_HANDLE_VALUE)
|
||||
GetModuleInformation(GetCurrentProcess(), hModule, &mInfo, sizeof(MODULEINFO));
|
||||
|
||||
m_nModuleSize = static_cast<size_t>(mInfo.SizeOfImage);
|
||||
m_pModuleBase = reinterpret_cast<uintptr_t>(mInfo.lpBaseOfDll);
|
||||
|
||||
if (!m_nModuleSize || !m_pModuleBase)
|
||||
return;
|
||||
|
||||
CHAR szModuleName[MAX_PATH];
|
||||
DWORD dwSize = GetModuleFileNameA(hModule, szModuleName, sizeof(szModuleName));
|
||||
m_ModuleName = strrchr(szModuleName, '\\') + 1;
|
||||
char* chLast = strrchr(szModuleName, '\\');
|
||||
m_ModuleName = chLast == nullptr ? szModuleName : chLast + 1;
|
||||
|
||||
|
||||
Init();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue