Win32ApiWindowsGamesEmulation.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #if IL2CPP_TARGET_WINDOWS_GAMES
  3. #include "os/Win32/WindowsHeaders.h"
  4. #include <WinSock2.h>
  5. #include "os/ErrorCodes.h"
  6. extern "C"
  7. {
  8. #define GetLongPathName GetLongPathNameW
  9. #define GetUserName GetUserNameW
  10. #define ReplaceFile ReplaceFileW
  11. typedef
  12. BOOL
  13. (PASCAL FAR * LPFN_DISCONNECTEX)(
  14. _In_ SOCKET s,
  15. _Inout_opt_ LPOVERLAPPED lpOverlapped,
  16. _In_ DWORD dwFlags,
  17. _In_ DWORD dwReserved
  18. );
  19. #define WSAID_DISCONNECTEX \
  20. {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
  21. inline DWORD WINAPI GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer)
  22. {
  23. const wchar_t* name = L"T:\\";
  24. const size_t nameLen = wcslen(name);
  25. memcpy(lpBuffer, name, nameLen * sizeof(wchar_t));
  26. lpBuffer[nameLen] = L'\0';
  27. return (DWORD)nameLen;
  28. }
  29. inline DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer)
  30. {
  31. memmove(lpszLongPath, lpszShortPath, cchBuffer * sizeof(wchar_t));
  32. return cchBuffer;
  33. }
  34. inline BOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved)
  35. {
  36. SetLastError(il2cpp::os::kErrorCallNotImplemented);
  37. return FALSE;
  38. }
  39. inline BOOL WINAPI LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped)
  40. {
  41. SetLastError(il2cpp::os::kErrorCallNotImplemented);
  42. return FALSE;
  43. }
  44. inline BOOL WINAPI UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped)
  45. {
  46. SetLastError(il2cpp::os::kErrorCallNotImplemented);
  47. return FALSE;
  48. }
  49. inline HANDLE WINAPI CreateSemaphore(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
  50. {
  51. return ::CreateSemaphoreEx(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName, 0, SEMAPHORE_ALL_ACCESS);
  52. }
  53. inline BOOL WINAPI GetUserNameW(LPWSTR lpBuffer, LPDWORD pcbBuffer)
  54. {
  55. SetLastError(il2cpp::os::kErrorCallNotImplemented);
  56. return FALSE;
  57. }
  58. }
  59. #endif //IL2CPP_TARGET_WINDOWS_GAMES