github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/includes/windows.h (about)

     1  
     2  #include <stddef.h>
     3  #include <sys/socket.h>
     4  #include <unistd.h>
     5  
     6  #define __cdecl
     7  #define __fastcall
     8  #define __stdcall
     9  #define WINAPI
    10  #define WINAPIV
    11  
    12  #define VOID void
    13  #define FALSE 0
    14  #define TRUE 1
    15  
    16  #define MAX_PATH 260
    17  #define INFINITE ((DWORD)-1)
    18  
    19  #define BYTE _cxgo_uint8
    20  #define WORD _cxgo_uint16
    21  #define DWORD _cxgo_uint32
    22  #define QWORD _cxgo_uint64
    23  
    24  #define _BYTE _cxgo_uint8
    25  #define _WORD _cxgo_uint16
    26  #define _DWORD _cxgo_uint32
    27  #define _QWORD _cxgo_uint64
    28  
    29  #define BOOL int
    30  
    31  #define CHAR _cxgo_int8
    32  #define WCHAR wchar_t
    33  
    34  #define INT int
    35  #define UINT unsigned int
    36  #define LONG long
    37  #define ULONG unsigned long
    38  #define LONGLONG long long
    39  #define ULONGLONG unsigned long long
    40  
    41  #define PLONG LONG*
    42  
    43  #define LPVOID VOID*
    44  #define LPBOOL BOOL*
    45  #define LPBYTE BYTE*
    46  #define LPWORD WORD*
    47  #define LPDWORD DWORD*
    48  #define LPQWORD QWORD*
    49  
    50  #define WORD_PTR WORD*
    51  #define DWORD_PTR DWORD*
    52  #define QWORD_PTR QWORD*
    53  
    54  #define LPCCH const char*
    55  #define LPCSTR const char*
    56  #define LPSTR char*
    57  #define LPCWSTR const wchar_t*
    58  #define LPWSTR wchar_t*
    59  
    60  #define INT_PTR intptr_t
    61  #define UINT_PTR uintptr_t
    62  
    63  typedef void* HINSTANCE;
    64  typedef void* HMODULE;
    65  typedef int HANDLE;
    66  typedef int HWND;
    67  typedef int HDC;
    68  typedef int HIMC;
    69  
    70  typedef INT_PTR LRESULT;
    71  typedef INT_PTR LSTATUS;
    72  typedef INT_PTR LPARAM;
    73  typedef UINT_PTR WPARAM;
    74  
    75  typedef struct _REGKEY* HKEY;
    76  typedef HKEY* PHKEY;
    77  #define HKEY_LOCAL_MACHINE ((HKEY)1)
    78  
    79  typedef int SOCKET;
    80  
    81  typedef int LCID;
    82  typedef int REGSAM;
    83  
    84  typedef struct {
    85  	WORD wFormatTag;
    86  	WORD nChannels;
    87  	DWORD nSamplesPerSec;
    88  	DWORD nAvgBytesPerSec;
    89  	WORD nBlockAlign;
    90  } WAVEFORMAT;
    91  
    92  typedef struct _WAVEOUT {};
    93  
    94  #define HWAVEOUT struct _WAVEOUT*
    95  
    96  #define LPWAVEFORMAT WAVEFORMAT*
    97  #define LPHWAVEOUT HWAVEOUT*
    98  
    99  #pragma pack(push, 1)
   100  typedef struct {
   101  	WORD wFormatTag;
   102  	WORD nChannels;
   103  	DWORD nSamplesPerSec;
   104  	DWORD nAvgBytesPerSec;
   105  	WORD nBlockAlign;
   106  	WORD wBitsPerSample;
   107  	WORD cbSize;
   108  } WAVEFORMATEX;
   109  
   110  typedef struct {
   111  	WAVEFORMATEX wfx;
   112  	WORD wID;
   113  	DWORD fdwFlags;
   114  	WORD nBlockSize;
   115  	WORD nFramesPerBlock;
   116  	WORD nCodecDelay;
   117  } MPEGLAYER3WAVEFORMAT;
   118  #pragma pack(pop)
   119  
   120  typedef struct _GUID {
   121  	DWORD Data1;
   122  	WORD Data2;
   123  	WORD Data3;
   124  	BYTE Data4[8];
   125  } GUID;
   126  typedef GUID IID;
   127  
   128  typedef struct _SYSTEMTIME {
   129  	WORD wYear;
   130  	WORD wMonth;
   131  	WORD wDayOfWeek;
   132  	WORD wDay;
   133  	WORD wHour;
   134  	WORD wMinute;
   135  	WORD wSecond;
   136  	WORD wMilliseconds;
   137  } SYSTEMTIME, *LPSYSTEMTIME;
   138  
   139  typedef struct _MEMORYSTATUS {
   140  	DWORD dwLength;
   141  } MEMORYSTATUS, *LPMEMORYSTATUS;
   142  
   143  typedef union _LARGE_INTEGER {
   144  	QWORD QuadPart;
   145  	DWORD LowPart;
   146  } LARGE_INTEGER, *PLARGE_INTEGER;
   147  
   148  typedef struct _FILETIME {
   149  	DWORD dwLowDateTime;
   150  	DWORD dwHighDateTime;
   151  } FILETIME, *LPFILETIME;
   152  
   153  typedef struct _SECURITY_ATTRIBUTES {
   154  } SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
   155  
   156  typedef struct _CRITICAL_SECTION {
   157  	void* opaque;
   158  } CRITICAL_SECTION, *LPCRITICAL_SECTION;
   159  
   160  typedef struct _OSVERSIONINFOA {
   161  	DWORD dwOSVersionInfoSize;
   162  	DWORD dwMajorVersion;
   163  	DWORD dwMinorVersion;
   164  	DWORD dwBuildNumber;
   165  	DWORD dwPlatformId;
   166  	BYTE szCSDVersion[128];
   167  } OSVERSIONINFOA, *LPOSVERSIONINFOA;
   168  
   169  typedef struct _WIN32_FIND_DATAA {
   170  	DWORD dwFileAttributes;
   171  	FILETIME ftCreationTime;
   172  	FILETIME ftLastAccessTime;
   173  	FILETIME ftLastWriteTime;
   174  	DWORD nFileSizeHigh;
   175  	DWORD nFileSizeLow;
   176  	DWORD dwReserved0;
   177  	DWORD dwReserved1;
   178  	CHAR cFileName[MAX_PATH];
   179  	CHAR cAlternateFileName[14];
   180  } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
   181  
   182  typedef struct _OVERLAPPED {
   183  } OVERLAPPED, *LPOVERLAPPED;
   184  
   185  typedef struct _RECT {
   186  	LONG left;
   187  	LONG top;
   188  	LONG right;
   189  	LONG bottom;
   190  } RECT, *LPRECT;
   191  
   192  typedef struct _POINT {
   193  	LONG x;
   194  	LONG y;
   195  } POINT;
   196  
   197  typedef struct WSAData {
   198  	WORD wVersion;
   199  	WORD wHighVersion;
   200  	CHAR szDescription[257];
   201  	CHAR szSystemStatus[129];
   202  	WORD iMaxSockets;
   203  	WORD iMaxUdpDg;
   204  	LPVOID lpVendorInfo;
   205  } WSADATA, *LPWSADATA;
   206  
   207  struct _stat {
   208  	DWORD st_dev;
   209  	WORD st_ino;
   210  	WORD st_mode;
   211  	WORD st_nlink;
   212  	WORD st_uid;
   213  	WORD st_gid;
   214  	DWORD st_rdev;
   215  	DWORD st_size;
   216  	DWORD st_mtime;
   217  	DWORD st_atime;
   218  	DWORD st_ctime;
   219  };
   220  
   221  struct in_addr {
   222  	union {
   223  		DWORD S_addr;
   224  	} S_un;
   225  };
   226  
   227  #define _strdup strdup
   228  #define _strcmpi strcasecmp
   229  #define _strnicmp strncasecmp
   230  #define _fileno fileno
   231  #define _read read
   232  #define _write write
   233  #define _close close
   234  #define _onexit atexit
   235  
   236  unsigned int _control87(unsigned int new_, unsigned int mask);
   237  unsigned int _controlfp(unsigned int new_, unsigned int mask);
   238  int _open(const char* filename, int oflag, ...);
   239  int _chmod(const char* filename, int mode);
   240  int _access(const char* filename, int mode);
   241  int _stat(const char* path, struct _stat* buffer);
   242  int _mkdir(const char* path);
   243  int _unlink(const char* filename);
   244  char* _getcwd(char* buffer, int maxlen);
   245  uintptr_t _beginthread(void(__cdecl* start_address)(void*), unsigned int stack_size, void* arglist);
   246  char* _strrev(char* str);
   247  char* _itoa(int val, char* s, int radix);
   248  wchar_t* _itow(int val, wchar_t* s, int radix);
   249  void _makepath(char* path, const char* drive, const char* dir, const char* fname, const char* ext);
   250  void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext);
   251  
   252  VOID WINAPI DebugBreak();
   253  BOOL WINAPI CloseHandle(HANDLE hObject);
   254  DWORD WINAPI GetLastError();
   255  VOID WINAPI GetLocalTime(LPSYSTEMTIME lpSystemTime);
   256  HANDLE WINAPI FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
   257  BOOL WINAPI FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
   258  BOOL WINAPI FindClose(HANDLE hFindFile);
   259  HANDLE WINAPI CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
   260  			  LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
   261  			  DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
   262  BOOL WINAPI ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead,
   263  		     LPOVERLAPPED lpOverlapped);
   264  DWORD WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
   265  BOOL WINAPI CopyFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists);
   266  BOOL WINAPI DeleteFileA(LPCSTR lpFileName);
   267  BOOL WINAPI MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
   268  BOOL WINAPI CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   269  BOOL WINAPI RemoveDirectoryA(LPCSTR lpPathName);
   270  DWORD WINAPI GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
   271  BOOL WINAPI SetCurrentDirectoryA(LPCSTR lpPathName);
   272  int WINAPI GetDateFormatA(LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpDate, LPCSTR lpFormat, LPSTR lpDateStr,
   273  			  int cchDate);
   274  LSTATUS WINAPI RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
   275  LSTATUS WINAPI RegQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData,
   276  				LPDWORD lpcbData);
   277  LSTATUS WINAPI RegSetValueExA(HKEY, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData);
   278  LSTATUS WINAPI RegCloseKey(HKEY hKey);
   279  int WINAPI MulDiv(int nNumber, int nNumerator, int nDenominator);
   280  LSTATUS WINAPI RegCreateKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions,
   281  			       REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult,
   282  			       LPDWORD lpdwDisposition);
   283  VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer);
   284  DWORD WINAPI GetModuleFileNameA(HMODULE hModule, LPSTR lpFileName, DWORD nSize);
   285  BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER* lpPerformanceCount);
   286  BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER* lpFrequency);
   287  VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
   288  VOID WINAPI DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
   289  VOID WINAPI EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
   290  VOID WINAPI LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
   291  BOOL WINAPI HeapDestroy(HANDLE hHeap);
   292  BOOL WINAPI GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
   293  VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString);
   294  HINSTANCE WINAPI ShellExecuteA(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory,
   295  			       INT nShowCmd);
   296  int WINAPI GetTimeFormatA(LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpTime, LPCSTR lpFormat, LPSTR lpTimeStr,
   297  			  int cchTime);
   298  BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime);
   299  LONG WINAPI CompareFileTime(const FILETIME* lpFileTime1, const FILETIME* lpFileTime2);
   300  HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES lpSecurityAttributes, BOOL bInitialOwner, LPCSTR lpName);
   301  BOOL WINAPI ReleaseMutex(HANDLE hMutex);
   302  BOOL WINAPI SetEvent(HANDLE hEvent);
   303  DWORD WINAPI WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
   304  char* WINAPI inet_ntoa(struct in_addr in);
   305  int WINAPI WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar,
   306  			       LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar);
   307  
   308  LONG InterlockedExchange(volatile LONG* Target, LONG Value);
   309  LONG InterlockedDecrement(volatile LONG* Addend);
   310  LONG InterlockedIncrement(volatile LONG* Addend);
   311  int WINAPI MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
   312  int WINAPI WSAStartup(WORD wVersionRequested, struct WSAData* lpWSAData);
   313  int WINAPI WSACleanup();
   314  int WINAPI closesocket(SOCKET s);
   315  int WINAPI ioctlsocket(SOCKET s, long cmd, unsigned long* argp);
   316  int WINAPI WSAGetLastError();
   317  SOCKET WINAPI socket(int domain, int type, int protocol);
   318  int WINAPI setsockopt(SOCKET s, int level, int opt, const void* value, unsigned int len);
   319  int WINAPI bind(int sockfd, const struct sockaddr* addr, unsigned int addrlen);
   320  int WINAPI recvfrom(int sockfd, void* buffer, unsigned int length, int flags, struct sockaddr* addr,
   321  		    unsigned int* addrlen);
   322  int WINAPI sendto(int sockfd, void* buffer, unsigned int length, int flags, const struct sockaddr* addr,
   323  		  unsigned int addrlen);