2020-02-22 19:00:42 +00:00
|
|
|
#include "linux/windows/winbase.h"
|
|
|
|
|
|
|
|
#include <errno.h>
|
2020-06-24 08:34:01 +01:00
|
|
|
#include <iostream>
|
2020-06-30 15:43:06 +01:00
|
|
|
#include <chrono>
|
|
|
|
#include <thread>
|
2020-11-27 13:48:53 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-02-22 19:00:42 +00:00
|
|
|
|
|
|
|
DWORD WINAPI GetLastError(void)
|
|
|
|
{
|
|
|
|
return errno;
|
|
|
|
}
|
2020-06-24 08:34:01 +01:00
|
|
|
|
|
|
|
void DeleteCriticalSection(CRITICAL_SECTION * criticalSection)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitializeCriticalSection(CRITICAL_SECTION * criticalSection)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnterCriticalSection(CRITICAL_SECTION * criticalSection)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void LeaveCriticalSection(CRITICAL_SECTION * criticalSection)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:48:53 +00:00
|
|
|
BOOL SetCurrentDirectory(LPCSTR path)
|
|
|
|
{
|
|
|
|
const int res = chdir(path);
|
|
|
|
return res == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-06-24 08:34:01 +01:00
|
|
|
void OutputDebugString(const char * str)
|
|
|
|
{
|
2020-06-30 15:43:06 +01:00
|
|
|
std::cerr << str;
|
2020-06-24 08:34:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExitProcess(int status)
|
|
|
|
{
|
2020-07-12 09:55:51 +01:00
|
|
|
throw status;
|
2020-06-24 08:34:01 +01:00
|
|
|
}
|
2020-06-30 15:43:06 +01:00
|
|
|
|
|
|
|
DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,BOOL,DWORD)
|
|
|
|
{
|
|
|
|
return WAIT_FAILED;
|
|
|
|
}
|
|
|
|
|
2020-07-01 18:27:40 +01:00
|
|
|
DWORD WINAPI WaitForSingleObject(const HANDLE,DWORD)
|
|
|
|
{
|
|
|
|
return WAIT_FAILED;
|
|
|
|
}
|
|
|
|
|
2020-06-30 15:43:06 +01:00
|
|
|
BOOL WINAPI GetExitCodeThread(HANDLE,LPDWORD code)
|
|
|
|
{
|
|
|
|
*code = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI SetEvent(HANDLE)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI Sleep(DWORD ms)
|
|
|
|
{
|
|
|
|
std::this_thread::sleep_for (std::chrono::milliseconds(ms));
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI SetThreadPriority(HANDLE,INT)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI CreateEvent(LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)
|
|
|
|
{
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES,SIZE_T,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD)
|
|
|
|
{
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER*counter)
|
|
|
|
{
|
|
|
|
const auto now = std::chrono::steady_clock::now();
|
|
|
|
const auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
|
|
|
|
counter->QuadPart = ms.count();
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-07-01 18:27:40 +01:00
|
|
|
|
|
|
|
HANDLE CreateSemaphore(
|
|
|
|
LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
|
|
|
|
LONG lInitialCount,
|
|
|
|
LONG lMaximumCount,
|
|
|
|
LPCSTR lpName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|