move GetLastErrorString and FreeLastErrorString to loader source file
This commit is contained in:
parent
04840af6d3
commit
7bfd1c795b
|
@ -56,31 +56,3 @@ bool VerifyWow64()
|
|||
|
||||
return (bIsWow64 != FALSE);
|
||||
}
|
||||
|
||||
LPTSTR GetLastErrorString()
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
|
||||
// Translate ErrorCode to String.
|
||||
LPTSTR Error = nullptr;
|
||||
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
err,
|
||||
0,
|
||||
(LPTSTR)&Error,
|
||||
0,
|
||||
NULL) == 0) {
|
||||
// Failed in translating.
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
void FreeLastErrorString(LPTSTR Error)
|
||||
{
|
||||
if (Error) {
|
||||
::LocalFree(Error);
|
||||
Error = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,3 @@ extern bool IsOptionalAddressRange(const int index);
|
|||
extern int AddressRangeGetSystemFlags(const int index);
|
||||
|
||||
extern bool VerifyWow64();
|
||||
|
||||
extern LPTSTR GetLastErrorString();
|
||||
extern void FreeLastErrorString(LPTSTR Error);
|
||||
extern void OutputMessage(const char* msg);
|
||||
|
|
|
@ -104,6 +104,33 @@ void OutputMessage(const char* msg)
|
|||
}
|
||||
}
|
||||
|
||||
LPTSTR GetLastErrorString()
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
|
||||
// Translate ErrorCode to String.
|
||||
LPTSTR Error = nullptr;
|
||||
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
err,
|
||||
0,
|
||||
(LPTSTR)&Error,
|
||||
0,
|
||||
NULL) == 0) {
|
||||
// Failed in translating.
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
void FreeLastErrorString(LPTSTR Error)
|
||||
{
|
||||
if (Error) {
|
||||
::LocalFree(Error);
|
||||
Error = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#define EMULATION_DLL "cxbxr-emu.dll"
|
||||
|
||||
DWORD CALLBACK rawMain()
|
||||
|
|
Loading…
Reference in New Issue