fix not compiling with TCC, avoid shellapi.h

This commit is contained in:
UnknownShadow200 2021-07-24 12:21:04 +10:00
parent bb9d8fb29f
commit 5aaefd4510
3 changed files with 26 additions and 24 deletions

View File

@ -281,21 +281,20 @@ cc_result Audio_IsFinished(struct AudioContext* ctx, cc_bool* finished) {
/*########################################################################################################################* /*########################################################################################################################*
*------------------------------------------------------WinMM backend------------------------------------------------------* *------------------------------------------------------WinMM backend------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
/* === BEGIN WINDOWS HEADERS === */ #define WIN32_LEAN_AND_MEAN
typedef unsigned long DWORD; #define NOSERVICE
typedef unsigned short WORD; #define NOMCX
typedef unsigned int UINT; #define NOIME
typedef char CHAR; #ifndef UNICODE
typedef cc_uintptr DWORD_PTR; #define UNICODE
typedef char* LPSTR; #define _UNICODE
#endif
#include <windows.h>
#define WINAPI __stdcall
#define DECLSPEC_IMPORT __declspec(dllimport)
/* === BEGIN mmsyscom.h === */ /* === BEGIN mmsyscom.h === */
#define CALLBACK_NULL 0x00000000l #define CALLBACK_NULL 0x00000000l
typedef UINT MMRESULT; typedef UINT MMRESULT;
#define WINMMAPI DECLSPEC_IMPORT #define WINMMAPI DECLSPEC_IMPORT
/* === BEGIN mmeapi.h === */ /* === BEGIN mmeapi.h === */
typedef struct WAVEHDR_ { typedef struct WAVEHDR_ {
LPSTR lpData; LPSTR lpData;
@ -330,7 +329,7 @@ WINMMAPI MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, UINT h
WINMMAPI MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize); WINMMAPI MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize);
WINMMAPI MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize); WINMMAPI MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize);
WINMMAPI MMRESULT WINAPI waveOutReset(HWAVEOUT hwo); WINMMAPI MMRESULT WINAPI waveOutReset(HWAVEOUT hwo);
/* === END WINDOWS HEADERS === */ /* === END mmeapi.h === */
struct AudioContext { struct AudioContext {
HWAVEOUT handle; HWAVEOUT handle;

View File

@ -386,19 +386,18 @@ static cc_result Http_BackendDo(struct HttpRequest* req, cc_string* url) {
/*########################################################################################################################* /*########################################################################################################################*
*-----------------------------------------------------WinINet backend-----------------------------------------------------* *-----------------------------------------------------WinINet backend-----------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
/* === BEGIN WINDOWS HEADERS === */ #define WIN32_LEAN_AND_MEAN
typedef unsigned long DWORD; #define NOSERVICE
typedef int BOOL; #define NOMCX
typedef unsigned short WORD; #define NOIME
typedef void* PVOID; #ifndef UNICODE
typedef const char* PCSTR; #define UNICODE
typedef cc_uintptr DWORD_PTR; #define _UNICODE
#endif
#include <windows.h>
#define WINAPI _stdcall
#define WINBASEAPI __declspec(dllimport)
WINBASEAPI DWORD WINAPI GetLastError(void);
/* === BEGIN wininet.h === */ /* === BEGIN wininet.h === */
#define INETAPI __declspec(dllimport) #define INETAPI DECLSPEC_IMPORT
typedef PVOID HINTERNET; typedef PVOID HINTERNET;
typedef WORD INTERNET_PORT; typedef WORD INTERNET_PORT;
@ -430,7 +429,7 @@ INETAPI BOOL WINAPI HttpQueryInfoA(HINTERNET hRequest, DWORD infoLevel, PVOID bu
INETAPI BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hRequest, PCSTR headers, DWORD headersLength, DWORD modifiers); INETAPI BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hRequest, PCSTR headers, DWORD headersLength, DWORD modifiers);
INETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET hConnect, PCSTR verb, PCSTR objectName, PCSTR version, PCSTR referrer, PCSTR* acceptTypes, DWORD flags, DWORD_PTR context); INETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET hConnect, PCSTR verb, PCSTR objectName, PCSTR version, PCSTR referrer, PCSTR* acceptTypes, DWORD flags, DWORD_PTR context);
INETAPI BOOL WINAPI HttpSendRequestA(HINTERNET hRequest, PCSTR headers, DWORD headersLength, PVOID optional, DWORD optionalLength); INETAPI BOOL WINAPI HttpSendRequestA(HINTERNET hRequest, PCSTR headers, DWORD headersLength, PVOID optional, DWORD optionalLength);
/* === END WINDOWS HEADERS === */ /* === END wininet.h === */
/* caches connections to web servers */ /* caches connections to web servers */
struct HttpCacheEntry { struct HttpCacheEntry {

View File

@ -19,9 +19,13 @@
#include <windows.h> #include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <shellapi.h>
#include <wincrypt.h> #include <wincrypt.h>
/* === BEGIN shellapi.h === */
#define SHELLAPI DECLSPEC_IMPORT
SHELLAPI HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpOperation, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
/* === END shellapi.h === */
static HANDLE heap; static HANDLE heap;
const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION;
const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND;