This is a very stripped down version[1], with only CommandLineToArgvW (typically used with GetCommandLineW() - which we already have), ShellExecute and FindExecutable, which don't require any new structs, and where used constants already exist at our winuser.h . Pretty cheap, and hopefully covers some meaningful new use cases[2]. Requires linking with -lshell32 . [1] original full version: http://download.savannah.nongnu.org/releases/tinycc/winapi-full-for-0.9.27.zip [2] Can now build "less" for windows - https://github.com/gwsw/less/ . Add -luser32 to LIBS at Makefile.wng (mingw makefile), then (gnu make): make -f Makefile.wng CC=tcc less.exe
Unified · Split
| @@ -0,0 +1,59 @@ | |||
| 1 | /** | ||
| 2 | * This file has no copyright assigned and is placed in the Public Domain. | ||
| 3 | * This file is part of the w64 mingw-runtime package. | ||
| 4 | * No warranty is given; refer to the file DISCLAIMER within this package. | ||
| 5 | */ | ||
| 6 | #ifndef _INC_SHELLAPI | ||
| 7 | #define _INC_SHELLAPI | ||
| 8 | |||
| 9 | #ifndef WINSHELLAPI | ||
| 10 | #if !defined(_SHELL32_) | ||
| 11 | #define WINSHELLAPI DECLSPEC_IMPORT | ||
| 12 | #else | ||
| 13 | #define WINSHELLAPI | ||
| 14 | #endif | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #ifndef SHSTDAPI | ||
| 18 | #if !defined(_SHELL32_) | ||
| 19 | #define SHSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI | ||
| 20 | #define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI | ||
| 21 | #else | ||
| 22 | #define SHSTDAPI STDAPI | ||
| 23 | #define SHSTDAPI_(type) STDAPI_(type) | ||
| 24 | #endif | ||
| 25 | #endif | ||
| 26 | |||
| 27 | /* SHDOCAPI[_] definitions not required in this TinyCC minimal header */ | ||
| 28 | |||
| 29 | #if !defined(_WIN64) | ||
| 30 | #include <pshpack1.h> | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #ifdef __cplusplus | ||
| 34 | extern "C" { | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #ifdef UNICODE | ||
| 38 | #define ShellExecute ShellExecuteW | ||
| 39 | #define FindExecutable FindExecutableW | ||
| 40 | #else | ||
| 41 | #define ShellExecute ShellExecuteA | ||
| 42 | #define FindExecutable FindExecutableA | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* minimal subset distributed with TinyCC. nShowCmd is at winuser.h */ | ||
| 46 | SHSTDAPI_(HINSTANCE) ShellExecuteA(HWND hwnd,LPCSTR lpOperation,LPCSTR lpFile,LPCSTR lpParameters,LPCSTR lpDirectory,INT nShowCmd); | ||
| 47 | SHSTDAPI_(HINSTANCE) ShellExecuteW(HWND hwnd,LPCWSTR lpOperation,LPCWSTR lpFile,LPCWSTR lpParameters,LPCWSTR lpDirectory,INT nShowCmd); | ||
| 48 | SHSTDAPI_(HINSTANCE) FindExecutableA(LPCSTR lpFile,LPCSTR lpDirectory,LPSTR lpResult); | ||
| 49 | SHSTDAPI_(HINSTANCE) FindExecutableW(LPCWSTR lpFile,LPCWSTR lpDirectory,LPWSTR lpResult); | ||
| 50 | SHSTDAPI_(LPWSTR *) CommandLineToArgvW(LPCWSTR lpCmdLine,int*pNumArgs); | ||
| 51 | |||
| 52 | #ifdef __cplusplus | ||
| 53 | } | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #if !defined(_WIN64) | ||
| 57 | #include <poppack.h> | ||
| 58 | #endif | ||
| 59 | #endif | ||