diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3841a63 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +colorchord2/windows/colorchord.def +colorchord2/colorchord.def \ No newline at end of file diff --git a/colorchord2/DisplayHIDAPI.c b/colorchord2/DisplayHIDAPI.c index 40792a1..5e4dd70 100644 --- a/colorchord2/DisplayHIDAPI.c +++ b/colorchord2/DisplayHIDAPI.c @@ -9,7 +9,6 @@ #include "hidapi.h" #include "color.h" #include -#include struct HIDAPIOutDriver { @@ -58,7 +57,7 @@ static void * LEDOutThread( void * v ) } led->readyFlag = 0; } - usleep(100); + OGUSleep(100); } return 0; } @@ -86,7 +85,7 @@ static void LEDUpdate(void * id, struct NoteFinder*nf) int leds_this_round = 0; int ledbid = 0; - while( led->readyFlag ) usleep(100); + while( led->readyFlag ) OGUSleep(100); int lastledplace = 1; led->last_leds[0] = 0; diff --git a/colorchord2/DisplayNetwork.c b/colorchord2/DisplayNetwork.c index 1a4dac5..deba2d0 100644 --- a/colorchord2/DisplayNetwork.c +++ b/colorchord2/DisplayNetwork.c @@ -9,10 +9,12 @@ #include #include "color.h" #include "DrawFunctions.h" -#include -#ifdef WIN32 +#if defined(WIN32) || defined(WINDOWS) #include +#ifdef TCC +#include +#endif #define MSG_NOSIGNAL 0 #else #include diff --git a/colorchord2/OutputCells.c b/colorchord2/OutputCells.c index 502f985..4f5bee6 100644 --- a/colorchord2/OutputCells.c +++ b/colorchord2/OutputCells.c @@ -12,7 +12,6 @@ #include "color.h" #include #include -#include extern float DeltaFrameTime; extern double Now; diff --git a/colorchord2/OutputLinear.c b/colorchord2/OutputLinear.c index bac98ae..5c3d334 100644 --- a/colorchord2/OutputLinear.c +++ b/colorchord2/OutputLinear.c @@ -12,7 +12,6 @@ #include "color.h" #include #include -#include struct LEDOutDriver { diff --git a/colorchord2/OutputProminent.c b/colorchord2/OutputProminent.c index a9cfb6c..c9f1792 100644 --- a/colorchord2/OutputProminent.c +++ b/colorchord2/OutputProminent.c @@ -11,7 +11,6 @@ #include "color.h" #include #include -#include struct ProminentDriver { diff --git a/colorchord2/default.conf b/colorchord2/default.conf index 6bc9161..41f76a5 100644 --- a/colorchord2/default.conf +++ b/colorchord2/default.conf @@ -18,7 +18,7 @@ play = 0 rec = 1 channels = 2 samplerate = 44100 -wininput = 0 +wininput = 1 #Compiled version will default this. #sound_source = ALSA diff --git a/colorchord2/dft.c b/colorchord2/dft.c index 2ee7174..a28a758 100644 --- a/colorchord2/dft.c +++ b/colorchord2/dft.c @@ -420,7 +420,9 @@ uint16_t Sdatspace[FIXBINS*4]; //(advances,places,isses,icses) static uint8_t Sdo_this_octave[BINCYCLE]; static int16_t Saccum_octavebins[OCTAVES]; static uint8_t Swhichoctaveplace; +#ifndef INCLUDING_EMBEDDED uint16_t embeddedbins[FIXBINS]; //This is updated every time the DFT hits the octavecount, or 1/32 updates. +#endif //From: http://stackoverflow.com/questions/1100090/looking-for-an-efficient-integer-square-root-algorithm-for-arm-thumb2 /** diff --git a/colorchord2/main.c b/colorchord2/main.c index 5d782ac..4136a90 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -17,10 +17,11 @@ #include "parameters.h" #include "hook.h" #include "configs.h" +#include struct SoundDriver * sd; -#ifdef WIN32 +#if defined(WIN32) || defined(USE_WINDOWS) #include #define ESCAPE_KEY 0x1B @@ -41,8 +42,8 @@ double Now = 0; int lastfps; short screenx, screeny; -struct DriverInstances * outdriver[MAX_OUT_DRIVERS]; +struct DriverInstances * outdriver[MAX_OUT_DRIVERS]; int headless = 0; REGISTER_PARAM( headless, PAINT ); int set_screenx = 640; REGISTER_PARAM( set_screenx, PAINT ); @@ -159,18 +160,19 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun *samplesp = samplesr; } - int main(int argc, char ** argv) { int i; - +#ifdef TCC + ManuallyRegisterDevices(); +#endif + printf( "Output Drivers:\n" ); for( i = 0; i < MAX_OUT_DRIVERS; i++ ) { if( ODList[i].Name ) printf( "\t%s\n", ODList[i].Name ); } - -#ifdef WIN32 +#if defined(WIN32) || defined(USE_WINDOWS) WSADATA wsaData; WSAStartup(0x202, &wsaData); diff --git a/colorchord2/os_generic.c b/colorchord2/os_generic.c index effe5eb..da281e3 100644 --- a/colorchord2/os_generic.c +++ b/colorchord2/os_generic.c @@ -2,7 +2,6 @@ #include "os_generic.h" - #ifdef USE_WINDOWS #include @@ -49,15 +48,16 @@ double OGGetFileTime( const char * file ) } -og_thread_t OGCreateThread( void * (function)( void * ), void * parameter ) +og_thread_t OGCreateThread( void * (routine)( void * ), void * parameter ) { - return (og_thread_t)CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)function, parameter, 0, 0 ); + return (og_thread_t)CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)routine, parameter, 0, 0 ); } void * OGJoinThread( og_thread_t ot ) { WaitForSingleObject( ot, INFINITE ); CloseHandle( ot ); + return 0; } void OGCancelThread( og_thread_t ot ) @@ -93,28 +93,23 @@ og_sema_t OGCreateSema() return (og_sema_t)sem; } - - -typedef LONG NTSTATUS; - -typedef NTSTATUS (NTAPI *_NtQuerySemaphore)( - HANDLE SemaphoreHandle, - DWORD SemaphoreInformationClass, /* Would be SEMAPHORE_INFORMATION_CLASS */ - PVOID SemaphoreInformation, /* but this is to much to dump here */ - ULONG SemaphoreInformationLength, - PULONG ReturnLength OPTIONAL -); - - -typedef struct _SEMAPHORE_BASIC_INFORMATION { - ULONG CurrentCount; - ULONG MaximumCount; -} SEMAPHORE_BASIC_INFORMATION; - - int OGGetSema( og_sema_t os ) { + typedef LONG NTSTATUS; HANDLE sem = (HANDLE)os; + typedef NTSTATUS (NTAPI *_NtQuerySemaphore)( + HANDLE SemaphoreHandle, + DWORD SemaphoreInformationClass, /* Would be SEMAPHORE_INFORMATION_CLASS */ + PVOID SemaphoreInformation, /* but this is to much to dump here */ + ULONG SemaphoreInformationLength, + PULONG ReturnLength OPTIONAL + ); + + typedef struct _SEMAPHORE_BASIC_INFORMATION { + ULONG CurrentCount; + ULONG MaximumCount; + } SEMAPHORE_BASIC_INFORMATION; + static _NtQuerySemaphore NtQuerySemaphore; SEMAPHORE_BASIC_INFORMATION BasicInfo; @@ -158,9 +153,8 @@ void OGDeleteSema( og_sema_t os ) #else -#ifndef _GNU_SOURCE #define _GNU_SOURCE -#endif + #include #include diff --git a/colorchord2/os_generic.h b/colorchord2/os_generic.h index c7de7db..163f2db 100644 --- a/colorchord2/os_generic.h +++ b/colorchord2/os_generic.h @@ -1,9 +1,8 @@ //Copyright 2015 <>< Charles Lohr under the NewBSD or MIT/x11 License. - #ifndef _OS_GENERIC_H #define _OS_GENERIC_H -#ifdef WIN32 +#if defined( WIN32 ) || defined (WINDOWS) || defined( _WIN32) #define USE_WINDOWS #endif @@ -12,12 +11,7 @@ extern "C" { #endif -#define EXECUTE_AT_BOOT( x, y ) \ - \ - void fn##x() __attribute__((constructor)); \ - void fn##x() \ - { y; } \ - + //Things that shouldn't be macro'd double OGGetAbsoluteTime(); void OGSleep( int is ); @@ -55,7 +49,7 @@ void OGDeleteSema( og_sema_t os ); #endif -//Date Stamp: 2014-06-12 +//Date Stamp: 2012-02-15 /* NOTE: Portions (namely the top section) are part of headers from other diff --git a/colorchord2/outdrivers.h b/colorchord2/outdrivers.h index 60f56ce..db3afce 100644 --- a/colorchord2/outdrivers.h +++ b/colorchord2/outdrivers.h @@ -41,6 +41,6 @@ struct DriverInstances * SetupOutDriver( ); void RegOutDriver( const char * ron, struct DriverInstances * (*Init)( ) ); #define REGISTER_OUT_DRIVER( name ) \ - EXECUTE_AT_BOOT( r##name, RegOutDriver( #name, name ) ); + void REGISTER##name() __attribute__((constructor)) { RegOutDriver( #name, name ); } #endif diff --git a/colorchord2/parameters.h b/colorchord2/parameters.h index f23bacd..b6c2fe2 100644 --- a/colorchord2/parameters.h +++ b/colorchord2/parameters.h @@ -58,8 +58,7 @@ void SetParametersFromString( const char * string ); void AddCallback( const char * name, ParamCallbackT t, void * v ); #define REGISTER_PARAM( parameter_name, type ) \ - void Register##parameter_name() __attribute__((constructor)); \ - void Register##parameter_name() { RegisterValue( #parameter_name, type, ¶meter_name, sizeof( parameter_name ) ); } + void REGISTER##parameter_name() __attribute__((constructor)) { RegisterValue( #parameter_name, type, ¶meter_name, sizeof( parameter_name ) ); } #endif diff --git a/colorchord2/sound.c b/colorchord2/sound.c index df7ff1c..9f03707 100644 --- a/colorchord2/sound.c +++ b/colorchord2/sound.c @@ -55,7 +55,6 @@ struct SoundDriver * InitSound( const char * driver_name, SoundCBType cb ) { int i; struct SoundDriver * ret = 0; - if( driver_name == 0 || strlen( driver_name ) == 0 ) { //Search for a driver. @@ -74,6 +73,7 @@ struct SoundDriver * InitSound( const char * driver_name, SoundCBType cb ) } else { + printf( "Initializing sound. Recommended driver: %s\n", driver_name ); for( i = 0; i < MAX_SOUND_DRIVERS; i++ ) { if( SoundDrivers[i] == 0 ) diff --git a/colorchord2/sound.h b/colorchord2/sound.h index 0bfe9b9..d83ed9b 100644 --- a/colorchord2/sound.h +++ b/colorchord2/sound.h @@ -34,5 +34,8 @@ void CloseSound( struct SoundDriver * soundobject ); //Called by various sound drivers. Notice priority must be greater than 0. Priority of 0 or less will not register. void RegSound( int priority, const char * name, SoundInitFn * fn ); +#define REGISTER_SOUND( sounddriver, priority, name, function ) \ + void REGISTER##sounddriver() __attribute__((constructor)) { RegSound( priority, name, function ); } + #endif diff --git a/colorchord2/sound_alsa.c b/colorchord2/sound_alsa.c index 64dc720..1161c1e 100644 --- a/colorchord2/sound_alsa.c +++ b/colorchord2/sound_alsa.c @@ -337,5 +337,5 @@ void * InitSoundAlsa( SoundCBType cb ) return InitASound(r); } -EXECUTE_AT_BOOT( AlsaSoundReg, RegSound( 10, "ALSA", InitSoundAlsa ) ); +REGISTER_SOUND( AlsaSound, 10, "ALSA", InitSoundAlsa ); diff --git a/colorchord2/sound_null.c b/colorchord2/sound_null.c index 47d5415..d7f8d16 100644 --- a/colorchord2/sound_null.c +++ b/colorchord2/sound_null.c @@ -41,6 +41,5 @@ void * InitSoundNull( SoundCBType cb ) } - -EXECUTE_AT_BOOT( NullSoundReg, RegSound( 1, "NULL", InitSoundNull ) ); +REGISTER_SOUND( NullSound, 1, "NULL", InitSoundNull ); diff --git a/colorchord2/sound_pulse.c b/colorchord2/sound_pulse.c index 2cecc35..4664c2e 100644 --- a/colorchord2/sound_pulse.c +++ b/colorchord2/sound_pulse.c @@ -374,6 +374,6 @@ fail: -EXECUTE_AT_BOOT( PulseSoundReg, RegSound( 11, "PULSE", InitSoundPulse ) ); +REGISTER_SOUND( PulseSound, 11, "PULSE", InitSoundPulse ); diff --git a/colorchord2/sound_win.c b/colorchord2/sound_win.c index 684e61c..559b87f 100644 --- a/colorchord2/sound_win.c +++ b/colorchord2/sound_win.c @@ -4,9 +4,9 @@ #include "parameters.h" #include "sound.h" #include "os_generic.h" -#include #include #include +#include #if defined(WIN32) #pragma comment(lib,"winmm.lib") @@ -106,7 +106,8 @@ static struct SoundDriverWin * InitWinSound( struct SoundDriverWin * r ) { int i; WAVEFORMATEX wfmt; - + memset( &wfmt, 0, sizeof(wfmt) ); + printf ("WFMT Size (debugging temp for TCC): %d\n", sizeof(wfmt) ); if( GetParameterI( "play", 0 ) ) { fprintf( stderr, "Error: This Windows Sound Driver does not support playback.\n" ); @@ -136,7 +137,7 @@ static struct SoundDriverWin * InitWinSound( struct SoundDriverWin * r ) int p = waveInOpen(&r->hMyWave, dwdevice, &wfmt,(DWORD)(void*)(&HANDLEMIC) , 0, CALLBACK_FUNCTION); - printf( "WIO: %d\n", p ); //On real windows, returns 11 + printf( "WIO: %d\n", p ); for ( i=0;ihMyWave); - printf( "WIS: %d\n", p ); //On real windows returns 5. + printf( "WIS: %d\n", p ); return r; } @@ -159,7 +160,7 @@ static struct SoundDriverWin * InitWinSound( struct SoundDriverWin * r ) void * InitSoundWin( SoundCBType cb ) { - struct SoundDriverWin * r = malloc( sizeof( struct SoundDriverWin ) ); + struct SoundDriverWin * r = (struct SoundDriverWin *)malloc( sizeof( struct SoundDriverWin ) ); r->CloseFn = CloseSoundWin; r->SoundStateFn = SoundStateWin; @@ -177,5 +178,5 @@ void * InitSoundWin( SoundCBType cb ) return InitWinSound(r); } -EXECUTE_AT_BOOT( WinSoundReg, RegSound( 10, "WIN", InitSoundWin ) ); +REGISTER_SOUND( SoundWin, 10, "WIN", InitSoundWin ); diff --git a/colorchord2/util.c b/colorchord2/util.c index d1e2d4e..9d1c8c4 100644 --- a/colorchord2/util.c +++ b/colorchord2/util.c @@ -2,8 +2,8 @@ //This file may be used in whole or part in any way for any purpose by anyone //without restriction. -#include "util.h" #include +#include "util.h" #include //Take the absolute distance between two points on a torus. diff --git a/colorchord2/windows/32/WS2_32.Lib b/colorchord2/windows/32/WS2_32.Lib new file mode 100644 index 0000000..750a539 Binary files /dev/null and b/colorchord2/windows/32/WS2_32.Lib differ diff --git a/colorchord2/windows/32/WinMM.Lib b/colorchord2/windows/32/WinMM.Lib new file mode 100644 index 0000000..7459425 Binary files /dev/null and b/colorchord2/windows/32/WinMM.Lib differ diff --git a/colorchord2/windows/64/WS2_32.Lib b/colorchord2/windows/64/WS2_32.Lib new file mode 100644 index 0000000..1ff5934 Binary files /dev/null and b/colorchord2/windows/64/WS2_32.Lib differ diff --git a/colorchord2/windows/64/WinMM.Lib b/colorchord2/windows/64/WinMM.Lib new file mode 100644 index 0000000..0c66d27 Binary files /dev/null and b/colorchord2/windows/64/WinMM.Lib differ diff --git a/colorchord2/windows/compile.bat b/colorchord2/windows/compile.bat new file mode 100644 index 0000000..32f1031 --- /dev/null +++ b/colorchord2/windows/compile.bat @@ -0,0 +1,8 @@ +@echo off +echo Unzip https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.26-win64-bin.zip to C:\tcc +set CFLAGS=-v -DHIDAPI -DWINDOWS -DWIN32 -DTCC -DRUNTIME_SYMNUM -Os -Itccinc -DINCLUDING_EMBEDDED -I.. -I. -I../../embeddedcommon -rdynamic -g +set LDFLAGS=-lkernel32 -lgdi32 -luser32 -lsetupapi -ldbghelp -ltcc1 -lwinmm -lws2_32 +set SOURCES=..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\DisplayNetwork.c ..\DisplayArray.c ..\DisplayHIDAPI.c ..\DisplayOUTDriver.c ..\DisplayPie.c ..\DrawFunctions.c ..\filter.c ..\hidapi.c ..\hook.c ..\main.c ..\os_generic.c ..\outdrivers.c ..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c ..\parameters.c ..\sound.c ..\sound_win.c ..\sound_null.c ..\util.c ..\WinDriver.c ..\notefinder.c ..\..\embeddedcommon\DFT32.c tcc_stubs.c symbol_enumerator.c +set ARCH_SPECIFIC=-L32 +@echo on +C:\tcc\tcc %CFLAGS% %ARCH_SPECIFIC% %SOURCES% %LDFLAGS% -o ..\colorchord.exe \ No newline at end of file diff --git a/colorchord2/windows/math.h b/colorchord2/windows/math.h new file mode 100644 index 0000000..cd5ee3d --- /dev/null +++ b/colorchord2/windows/math.h @@ -0,0 +1,926 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _MATH_H_ +#define _MATH_H_ + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + +#include <_mingw.h> + +struct exception; + +#pragma pack(push,_CRT_PACKING) + +#define _DOMAIN 1 +#define _SING 2 +#define _OVERFLOW 3 +#define _UNDERFLOW 4 +#define _TLOSS 5 +#define _PLOSS 6 + +#ifndef __STRICT_ANSI__ +#ifndef NO_OLDNAMES +#define DOMAIN _DOMAIN +#define SING _SING +#define OVERFLOW _OVERFLOW +#define UNDERFLOW _UNDERFLOW +#define TLOSS _TLOSS +#define PLOSS _PLOSS +#endif +#endif + +#ifndef __STRICT_ANSI__ +#define M_E 2.71828182845904523536 +#define M_LOG2E 1.44269504088896340736 +#define M_LOG10E 0.434294481903251827651 +#define M_LN2 0.693147180559945309417 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.785398163397448309616 +#define M_1_PI 0.318309886183790671538 +#define M_2_PI 0.636619772367581343076 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.707106781186547524401 +#endif + +#ifndef __STRICT_ANSI__ +/* See also float.h */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _EXCEPTION_DEFINED +#define _EXCEPTION_DEFINED + struct _exception { + int type; + char *name; + double arg1; + double arg2; + double retval; + }; +#endif + +#ifndef _COMPLEX_DEFINED +#define _COMPLEX_DEFINED + struct _complex { + double x,y; + }; +#endif + +#define EDOM 33 +#define ERANGE 34 + +#ifndef _HUGE +#ifdef _MSVCRT_ + extern double *_HUGE; +#else + extern double *_imp___HUGE; +#define _HUGE (*_imp___HUGE) +#endif +#endif + +#define HUGE_VAL _HUGE + +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif + double __cdecl acos(double _X); + double __cdecl asin(double _X); + double __cdecl atan(double _X); + double __cdecl atan2(double _Y,double _X); +#ifndef _SIGN_DEFINED +#define _SIGN_DEFINED + _CRTIMP double __cdecl _copysign (double _Number,double _Sign); + _CRTIMP double __cdecl _chgsign (double _X); +#endif + double __cdecl cos(double _X); + double __cdecl cosh(double _X); + double __cdecl exp(double _X); + double __cdecl expm1(double _X); + double __cdecl fabs(double _X); + double __cdecl fmod(double _X,double _Y); + double __cdecl log(double _X); + double __cdecl log10(double _X); + double __cdecl pow(double _X,double _Y); + double __cdecl sin(double _X); + double __cdecl sinh(double _X); + double __cdecl tan(double _X); + double __cdecl tanh(double _X); + double __cdecl sqrt(double _X); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + + _CRTIMP double __cdecl _cabs(struct _complex _ComplexA); + double __cdecl ceil(double _X); + double __cdecl floor(double _X); + double __cdecl frexp(double _X,int *_Y); + double __cdecl _hypot(double _X,double _Y); + _CRTIMP double __cdecl _j0(double _X); + _CRTIMP double __cdecl _j1(double _X); + _CRTIMP double __cdecl _jn(int _X,double _Y); + double __cdecl ldexp(double _X,int _Y); +#ifndef _CRT_MATHERR_DEFINED +#define _CRT_MATHERR_DEFINED + int __cdecl _matherr(struct _exception *_Except); +#endif + double __cdecl modf(double _X,double *_Y); + _CRTIMP double __cdecl _y0(double _X); + _CRTIMP double __cdecl _y1(double _X); + _CRTIMP double __cdecl _yn(int _X,double _Y); + +#if(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _set_SSE2_enable(int _Flag); + /* from libmingwex */ + float __cdecl _hypotf(float _X,float _Y); +#endif + + float frexpf(float _X,int *_Y); + float __cdecl ldexpf(float _X,int _Y); + long double __cdecl ldexpl(long double _X,int _Y); + float __cdecl acosf(float _X); + float __cdecl asinf(float _X); + float __cdecl atanf(float _X); + float __cdecl atan2f(float _X,float _Y); + float __cdecl cosf(float _X); + float __cdecl sinf(float _X); + float __cdecl tanf(float _X); + float __cdecl coshf(float _X); + float __cdecl sinhf(float _X); + float __cdecl tanhf(float _X); + float __cdecl expf(float _X); + float __cdecl expm1f(float _X); + float __cdecl logf(float _X); + float __cdecl log10f(float _X); + float __cdecl modff(float _X,float *_Y); + float __cdecl powf(float _X,float _Y); + float __cdecl sqrtf(float _X); + float __cdecl ceilf(float _X); + float __cdecl floorf(float _X); + float __cdecl fmodf(float _X,float _Y); + float __cdecl _hypotf(float _X,float _Y); + float __cdecl fabsf(float _X); +#if !defined(__ia64__) + /* from libmingwex */ + float __cdecl _copysignf (float _Number,float _Sign); + float __cdecl _chgsignf (float _X); + float __cdecl _logbf(float _X); + float __cdecl _nextafterf(float _X,float _Y); + int __cdecl _finitef(float _X); + int __cdecl _isnanf(float _X); + int __cdecl _fpclassf(float _X); +#endif + +#ifndef __cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } +#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y))) +#define _matherrl _matherr + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign((double)(_Number),(double)(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } + +#if !defined (__ia64__) + __CRT_INLINE float __cdecl fabsf (float x) + { + return fabs(x); + } + + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#endif +#else + // cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE long double modfl(long double _X,long double *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (long double)_Di; + return (_Df); + } + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign(static_cast(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign(static_cast(_Number),static_cast(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } +#ifndef __ia64__ + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#ifndef __x86_64 + __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } + __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } + __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } + __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } + __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } + __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } + __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } + __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } + __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } + __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } + __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } + __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } + __CRT_INLINE float modff(float _X,float *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (float)_Di; + return ((float)_Df); + } + __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } + __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } + __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } + __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } + __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } + __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } +#endif +#endif +#endif + +#ifndef NO_OLDNAMES +#define matherr _matherr + +#define HUGE _HUGE + /* double __cdecl cabs(struct _complex _X); */ + double __cdecl hypot(double _X,double _Y); + _CRTIMP double __cdecl j0(double _X); + _CRTIMP double __cdecl j1(double _X); + _CRTIMP double __cdecl jn(int _X,double _Y); + _CRTIMP double __cdecl y0(double _X); + _CRTIMP double __cdecl y1(double _X); + _CRTIMP double __cdecl yn(int _X,double _Y); +#endif + +#ifndef __NO_ISOCEXT +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ + || !defined __STRICT_ANSI__ || defined __GLIBCPP__ + +#define NAN (0.0F/0.0F) +#define HUGE_VALF (1.0F/0.0F) +#define HUGE_VALL (1.0L/0.0L) +#define INFINITY (1.0F/0.0F) + + +#define FP_NAN 0x0100 +#define FP_NORMAL 0x0400 +#define FP_INFINITE (FP_NAN | FP_NORMAL) +#define FP_ZERO 0x4000 +#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO) + /* 0x0200 is signbit mask */ + + + /* + We can't __CRT_INLINE float or double, because we want to ensure truncation + to semantic type before classification. + (A normal long double value might become subnormal when + converted to double, and zero when converted to float.) + */ + + extern int __cdecl __fpclassifyf (float); + extern int __cdecl __fpclassify (double); + extern int __cdecl __fpclassifyl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ + : sizeof (x) == sizeof (double) ? __fpclassify (x) \ + : __fpclassifyl (x)) + + /* 7.12.3.2 */ +#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0) + + /* 7.12.3.3 */ +#define isinf(x) (fpclassify(x) == FP_INFINITE) + + /* 7.12.3.4 */ + /* We don't need to worry about trucation here: + A NaN stays a NaN. */ +#define isnan(x) (fpclassify(x) == FP_NAN) + + /* 7.12.3.5 */ +#define isnormal(x) (fpclassify(x) == FP_NORMAL) + + /* 7.12.3.6 The signbit macro */ + + extern int __cdecl __signbitf (float); + extern int __cdecl __signbit (double); + extern int __cdecl __signbitl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ + : sizeof (x) == sizeof (double) ? __signbit (x) \ + : __signbitl (x)) + + extern double __cdecl exp2(double); + extern float __cdecl exp2f(float); + extern long double __cdecl exp2l(long double); + +#define FP_ILOGB0 ((int)0x80000000) +#define FP_ILOGBNAN ((int)0x80000000) + extern int __cdecl ilogb (double); + extern int __cdecl ilogbf (float); + extern int __cdecl ilogbl (long double); + + extern double __cdecl log1p(double); + extern float __cdecl log1pf(float); + extern long double __cdecl log1pl(long double); + + extern double __cdecl log2 (double); + extern float __cdecl log2f (float); + extern long double __cdecl log2l (long double); + + extern double __cdecl logb (double); + extern float __cdecl logbf (float); + extern long double __cdecl logbl (long double); + + __CRT_INLINE double __cdecl logb (double x) + { + double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE float __cdecl logbf (float x) + { + float res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE long double __cdecl logbl (long double x) + { + long double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + extern long double __cdecl modfl (long double, long double*); + + /* 7.12.6.13 */ + extern double __cdecl scalbn (double, int); + extern float __cdecl scalbnf (float, int); + extern long double __cdecl scalbnl (long double, int); + + extern double __cdecl scalbln (double, long); + extern float __cdecl scalblnf (float, long); + extern long double __cdecl scalblnl (long double, long); + + /* 7.12.7.1 */ + /* Implementations adapted from Cephes versions */ + extern double __cdecl cbrt (double); + extern float __cdecl cbrtf (float); + extern long double __cdecl cbrtl (long double); + + __CRT_INLINE float __cdecl hypotf (float x, float y) + { return (float) hypot (x, y);} + extern long double __cdecl hypotl (long double, long double); + + extern long double __cdecl powl (long double, long double); + extern long double __cdecl expl(long double); + extern long double __cdecl expm1l(long double); + extern long double __cdecl coshl(long double); + extern long double __cdecl fabsl (long double); + extern long double __cdecl acosl(long double); + extern long double __cdecl asinl(long double); + extern long double __cdecl atanl(long double); + extern long double __cdecl atan2l(long double,long double); + extern long double __cdecl sinhl(long double); + extern long double __cdecl tanhl(long double); + + /* 7.12.8.1 The erf functions */ + extern double __cdecl erf (double); + extern float __cdecl erff (float); + /* TODO + extern long double __cdecl erfl (long double); + */ + + /* 7.12.8.2 The erfc functions */ + extern double __cdecl erfc (double); + extern float __cdecl erfcf (float); + /* TODO + extern long double __cdecl erfcl (long double); + */ + + /* 7.12.8.3 The lgamma functions */ + extern double __cdecl lgamma (double); + extern float __cdecl lgammaf (float); + extern long double __cdecl lgammal (long double); + + /* 7.12.8.4 The tgamma functions */ + extern double __cdecl tgamma (double); + extern float __cdecl tgammaf (float); + extern long double __cdecl tgammal (long double); + + extern long double __cdecl ceill (long double); + extern long double __cdecl floorl (long double); + extern long double __cdecl frexpl(long double,int *); + extern long double __cdecl log10l(long double); + extern long double __cdecl logl(long double); + extern long double __cdecl cosl(long double); + extern long double __cdecl sinl(long double); + extern long double __cdecl tanl(long double); + extern long double sqrtl(long double); + + /* 7.12.9.3 */ + extern double __cdecl nearbyint ( double); + extern float __cdecl nearbyintf (float); + extern long double __cdecl nearbyintl (long double); + + /* 7.12.9.4 */ + /* round, using fpu control word settings */ + __CRT_INLINE double __cdecl rint (double x) + { + double retval; + __asm__ ( + "fldl %1\n" + "frndint \n" + "fstl %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE float __cdecl rintf (float x) + { + float retval; + __asm__ ( + "flds %1\n" + "frndint \n" + "fsts %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE long double __cdecl rintl (long double x) + { + long double retval; + __asm__ ( + "fldt %1\n" + "frndint \n" + "fstt %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + /* 7.12.9.5 */ + __CRT_INLINE long __cdecl lrint (double x) + { + long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintf (float x) + { + long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintl (long double x) + { + long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrint (double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintf (float x) + { + long long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintl (long double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + #define FE_TONEAREST 0x0000 + #define FE_DOWNWARD 0x0400 + #define FE_UPWARD 0x0800 + #define FE_TOWARDZERO 0x0c00 + + __CRT_INLINE double trunc (double _x) + { + double retval; + unsigned short saved_cw; + unsigned short tmp_cw; + __asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */ + tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)) + | FE_TOWARDZERO; + __asm__ ("fldcw %0;" : : "m" (tmp_cw)); + __asm__ ("fldl %1;" + "frndint;" + "fstl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */ + __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */ + return retval; + } + + /* 7.12.9.6 */ + /* round away from zero, regardless of fpu control word settings */ + extern double __cdecl round (double); + extern float __cdecl roundf (float); + extern long double __cdecl roundl (long double); + + /* 7.12.9.7 */ + extern long __cdecl lround (double); + extern long __cdecl lroundf (float); + extern long __cdecl lroundl (long double); + + extern long long __cdecl llround (double); + extern long long __cdecl llroundf (float); + extern long long __cdecl llroundl (long double); + + /* 7.12.9.8 */ + /* round towards zero, regardless of fpu control word settings */ + extern double __cdecl trunc (double); + extern float __cdecl truncf (float); + extern long double __cdecl truncl (long double); + + extern long double __cdecl fmodl (long double, long double); + + /* 7.12.10.2 */ + extern double __cdecl remainder (double, double); + extern float __cdecl remainderf (float, float); + extern long double __cdecl remainderl (long double, long double); + + /* 7.12.10.3 */ + extern double __cdecl remquo(double, double, int *); + extern float __cdecl remquof(float, float, int *); + extern long double __cdecl remquol(long double, long double, int *); + + /* 7.12.11.1 */ + extern double __cdecl copysign (double, double); /* in libmoldname.a */ + extern float __cdecl copysignf (float, float); + extern long double __cdecl copysignl (long double, long double); + + /* 7.12.11.2 Return a NaN */ + extern double __cdecl nan(const char *tagp); + extern float __cdecl nanf(const char *tagp); + extern long double __cdecl nanl(const char *tagp); + +#ifndef __STRICT_ANSI__ +#define _nan() nan("") +#define _nanf() nanf("") +#define _nanl() nanl("") +#endif + + /* 7.12.11.3 */ + extern double __cdecl nextafter (double, double); /* in libmoldname.a */ + extern float __cdecl nextafterf (float, float); + extern long double __cdecl nextafterl (long double, long double); + + /* 7.12.11.4 The nexttoward functions: TODO */ + + /* 7.12.12.1 */ + /* x > y ? (x - y) : 0.0 */ + extern double __cdecl fdim (double x, double y); + extern float __cdecl fdimf (float x, float y); + extern long double __cdecl fdiml (long double x, long double y); + + /* fmax and fmin. + NaN arguments are treated as missing data: if one argument is a NaN + and the other numeric, then these functions choose the numeric + value. */ + + /* 7.12.12.2 */ + extern double __cdecl fmax (double, double); + extern float __cdecl fmaxf (float, float); + extern long double __cdecl fmaxl (long double, long double); + + /* 7.12.12.3 */ + extern double __cdecl fmin (double, double); + extern float __cdecl fminf (float, float); + extern long double __cdecl fminl (long double, long double); + + /* 7.12.13.1 */ + /* return x * y + z as a ternary op */ + extern double __cdecl fma (double, double, double); + extern float __cdecl fmaf (float, float, float); + extern long double __cdecl fmal (long double, long double, long double); + + +#if 0 // gr: duplicate, see below + /* 7.12.14 */ + /* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +#if __GNUC__ >= 3 + +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isunordered(x, y) __builtin_isunordered(x, y) + +#else + /* helper */ + __CRT_INLINE int __cdecl + __fp_unordered_compare (long double x, long double y){ + unsigned short retval; + __asm__ ("fucom %%st(1);" + "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); + return retval; + } + +#define isgreater(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0) +#define isless(x, y) ((__fp_unordered_compare (y, x) \ + & 0x4500) == 0) +#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \ + & FP_INFINITE) == 0) +#define islessequal(x, y) ((__fp_unordered_compare(y, x) \ + & FP_INFINITE) == 0) +#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \ + & FP_SUBNORMAL) == 0) +#define isunordered(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0x4500) + +#endif +#endif //0 + + +#endif /* __STDC_VERSION__ >= 199901L */ +#endif /* __NO_ISOCEXT */ + +#ifdef __cplusplus +} +extern "C++" { + template inline _Ty _Pow_int(_Ty _X,int _Y) { + unsigned int _N; + if(_Y >= 0) _N = (unsigned int)_Y; + else _N = (unsigned int)(-_Y); + for(_Ty _Z = _Ty(1);;_X *= _X) { + if((_N & 1)!=0) _Z *= _X; + if((_N >>= 1)==0) return (_Y < 0 ? _Ty(1) / _Z : _Z); + } + } +} +#endif + +#pragma pack(pop) + +/* 7.12.14 */ +/* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +/* Mini libm (inline __fpclassify*, __signbit* and variants) */ + +/* TCC uses 8 bytes for double and long double, so effectively the l variants + * are never used. For now, they just run the normal (double) variant. + */ + +/* + * most of the code in this file is taken from MUSL rs-1.0 (MIT license) + * - musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0 + * - License: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0 + */ + +/******************************************************************************* + Start of code based on MUSL +*******************************************************************************/ +/* +musl as a whole is licensed under the following standard MIT license: + +---------------------------------------------------------------------- +Copyright © 2005-2014 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- +*/ + +/* fpclassify */ + +__CRT_INLINE int __cdecl __fpclassify (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i>>52 & 0x7ff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyf (float x) { + union {float f; uint32_t i;} u = {x}; + int e = u.i>>23 & 0xff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyl (long double x) { + return __fpclassify(x); +} + + +/* signbit */ + +__CRT_INLINE int __cdecl __signbit (double x) { + union {double d; uint64_t i;} y = { x }; + return y.i>>63; +} + +__CRT_INLINE int __cdecl __signbitf (float x) { + union {float f; uint32_t i; } y = { x }; + return y.i>>31; +} + +__CRT_INLINE int __cdecl __signbitl (long double x) { + return __signbit(x); +} + + +/* fmin*, fmax* */ + +#define TCCFP_FMIN_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? x : y) : \ + x < y ? x : y) + +__CRT_INLINE double __cdecl fmin (double x, double y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE float __cdecl fminf (float x, float y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE long double __cdecl fminl (long double x, long double y) { + return TCCFP_FMIN_EVAL; +} + +#define TCCFP_FMAX_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? y : x) : \ + x < y ? y : x) + +__CRT_INLINE double __cdecl fmax (double x, double y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE float __cdecl fmaxf (float x, float y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE long double __cdecl fmaxl (long double x, long double y) { + return TCCFP_FMAX_EVAL; +} + + +/* *round* */ + +#define TCCFP_FORCE_EVAL(x) do { \ +if (sizeof(x) == sizeof(float)) { \ + volatile float __x; \ + __x = (x); \ +} else if (sizeof(x) == sizeof(double)) { \ + volatile double __x; \ + __x = (x); \ +} else { \ + volatile long double __x; \ + __x = (x); \ +} \ +} while(0) + +__CRT_INLINE double __cdecl round (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double y; + + if (e >= 0x3ff+52) + return x; + if (u.i >> 63) + x = -x; + if (e < 0x3ff-1) { + /* raise inexact if x!=0 */ + TCCFP_FORCE_EVAL(x + 0x1p52); + return 0*u.f; + } + y = (double)(x + 0x1p52) - 0x1p52 - x; + if (y > 0.5) + y = y + x - 1; + else if (y <= -0.5) + y = y + x + 1; + else + y = y + x; + if (u.i >> 63) + y = -y; + return y; +} + +__CRT_INLINE long __cdecl lround (double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llround (double x) { + return round(x); +} + +__CRT_INLINE float __cdecl roundf (float x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundf (float x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundf (float x) { + return round(x); +} + +__CRT_INLINE long double __cdecl roundl (long double x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundl (long double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundl (long double x) { + return round(x); +} + + + +#endif /* End _MATH_H_ */ + diff --git a/colorchord2/windows/mmsystem.h b/colorchord2/windows/mmsystem.h new file mode 100644 index 0000000..3eb06a4 --- /dev/null +++ b/colorchord2/windows/mmsystem.h @@ -0,0 +1,1950 @@ + +#ifndef _MMSYSTEM_H +#define _MMSYSTEM_H +#if __GNUC__ >=3 +#pragma GCC system_header +#endif +#pragma pack(push,1) +#ifdef __cplusplus +extern "C" { +#endif + +#if defined( TCC ) || defined (TinyCC) || defined(TINYCC) +#define _STRUCT_NAME(x) x +typedef UINT* LPUINT; +#endif + +#define WINMMAPI DECLSPEC_IMPORT +#define _loadds +#define _huge +#define MAXPNAMELEN 32 +#define MAXERRORLENGTH 256 +#define MAX_JOYSTICKOEMVXDNAME 260 +#define _MMRESULT_ +#define TIME_MS 1 +#define TIME_SAMPLES 2 +#define TIME_BYTES 4 +#define TIME_SMPTE 8 +#define TIME_MIDI 16 +#define TIME_TICKS 32 +#define MAKEFOURCC(c0,c1,c2,c3) ((DWORD)(BYTE)(c0)|((DWORD)(BYTE)(c1)<<8)|((DWORD)(BYTE)(c2)<<16)|((DWORD)(BYTE)(c3)<<24)) +#ifndef mmioFOURCC +#define mmioFOURCC(c0,c1,c2,c3) MAKEFOURCC(c0,c1,c2,c3) +#endif +#define MM_JOY1MOVE 0x3A0 +#define MM_JOY2MOVE 0x3A1 +#define MM_JOY1ZMOVE 0x3A2 +#define MM_JOY2ZMOVE 0x3A3 +#define MM_JOY1BUTTONDOWN 0x3B5 +#define MM_JOY2BUTTONDOWN 0x3B6 +#define MM_JOY1BUTTONUP 0x3B7 +#define MM_JOY2BUTTONUP 0x3B8 +#define MM_MCINOTIFY 0x3B9 +#define MM_WOM_OPEN 0x3BB +#define MM_WOM_CLOSE 0x3BC +#define MM_WOM_DONE 0x3BD +#define MM_WIM_OPEN 0x3BE +#define MM_WIM_CLOSE 0x3BF +#define MM_WIM_DATA 0x3C0 +#define MM_MIM_OPEN 0x3C1 +#define MM_MIM_CLOSE 0x3C2 +#define MM_MIM_DATA 0x3C3 +#define MM_MIM_LONGDATA 0x3C4 +#define MM_MIM_ERROR 0x3C5 +#define MM_MIM_LONGERROR 0x3C6 +#define MM_MOM_OPEN 0x3C7 +#define MM_MOM_CLOSE 0x3C8 +#define MM_MOM_DONE 0x3C9 +#define MM_DRVM_OPEN 0x3D0 +#define MM_DRVM_CLOSE 0x3D1 +#define MM_DRVM_DATA 0x3D2 +#define MM_DRVM_ERROR 0x3D3 +#define MM_STREAM_OPEN 0x3D4 +#define MM_STREAM_CLOSE 0x3D5 +#define MM_STREAM_DONE 0x3D6 +#define MM_STREAM_ERROR 0x3D7 +#define MM_MOM_POSITIONCB 0x3CA +#define MM_MCISIGNAL 0x3CB +#define MM_MIM_MOREDATA 0x3CC +#define MM_MIXM_LINE_CHANGE 0x3D0 +#define MM_MIXM_CONTROL_CHANGE 0x3D1 +#define MMSYSERR_BASE 0 +#define WAVERR_BASE 32 +#define MIDIERR_BASE 64 +#define TIMERR_BASE 96 +#define JOYERR_BASE 160 +#define MCIERR_BASE 256 +#define MIXERR_BASE 1024 +#define MCI_STRING_OFFSET 512 +#define MCI_VD_OFFSET 1024 +#define MCI_CD_OFFSET 1088 +#define MCI_WAVE_OFFSET 1152 +#define MCI_SEQ_OFFSET 1216 +#define MMSYSERR_NOERROR 0 +#define MMSYSERR_ERROR (MMSYSERR_BASE+1) +#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE+2) +#define MMSYSERR_NOTENABLED (MMSYSERR_BASE+3) +#define MMSYSERR_ALLOCATED (MMSYSERR_BASE+4) +#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE+5) +#define MMSYSERR_NODRIVER (MMSYSERR_BASE+6) +#define MMSYSERR_NOMEM (MMSYSERR_BASE+7) +#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE+8) +#define MMSYSERR_BADERRNUM (MMSYSERR_BASE+9) +#define MMSYSERR_INVALFLAG (MMSYSERR_BASE+10) +#define MMSYSERR_INVALPARAM (MMSYSERR_BASE+11) +#define MMSYSERR_HANDLEBUSY (MMSYSERR_BASE+12) +#define MMSYSERR_INVALIDALIAS (MMSYSERR_BASE+13) +#define MMSYSERR_BADDB (MMSYSERR_BASE+14) +#define MMSYSERR_KEYNOTFOUND (MMSYSERR_BASE+15) +#define MMSYSERR_READERROR (MMSYSERR_BASE+16) +#define MMSYSERR_WRITEERROR (MMSYSERR_BASE+17) +#define MMSYSERR_DELETEERROR (MMSYSERR_BASE+18) +#define MMSYSERR_VALNOTFOUND (MMSYSERR_BASE+19) +#define MMSYSERR_NODRIVERCB (MMSYSERR_BASE+20) +#define MMSYSERR_LASTERROR (MMSYSERR_BASE+20) +#define DRV_LOAD 1 +#define DRV_ENABLE 2 +#define DRV_OPEN 3 +#define DRV_CLOSE 4 +#define DRV_DISABLE 5 +#define DRV_FREE 6 +#define DRV_CONFIGURE 7 +#define DRV_QUERYCONFIGURE 8 +#define DRV_INSTALL 9 +#define DRV_REMOVE 10 +#define DRV_EXITSESSION 11 +#define DRV_POWER 15 +#define DRV_RESERVED 0x800 +#define DRV_USER 0x4000 +#define DRVCNF_CANCEL 0 +#define DRVCNF_OK 1 +#define DRVCNF_RESTART 2 +#define DRV_CANCEL DRVCNF_CANCEL +#define DRV_OK DRVCNF_OK +#define DRV_RESTART DRVCNF_RESTART +#define DRV_MCI_FIRST DRV_RESERVED +#define DRV_MCI_LAST (DRV_RESERVED+0xFFF) +#define CALLBACK_TYPEMASK 0x70000 +#define CALLBACK_NULL 0 +#define CALLBACK_WINDOW 0x10000 +#define CALLBACK_TASK 0x20000 +#define CALLBACK_FUNCTION 0x30000 +#define CALLBACK_THREAD CALLBACK_TASK +#define CALLBACK_EVENT 0x50000 +#define SND_SYNC 0 +#define SND_ASYNC 1 +#define SND_NODEFAULT 2 +#define SND_MEMORY 4 +#define SND_LOOP 8 +#define SND_NOSTOP 16 +#define SND_NOWAIT 0x2000 +#define SND_ALIAS 0x10000 +#define SND_ALIAS_ID 0x110000 +#define SND_FILENAME 0x20000 +#define SND_RESOURCE 0x40004 +#define SND_PURGE 0x40 +#define SND_APPLICATION 0x80 +#define SND_ALIAS_START 0 +#define sndAlias(c0,c1) (SND_ALIAS_START+(DWORD)(BYTE)(c0)|((DWORD)(BYTE)(c1)<<8)) +#define SND_ALIAS_SYSTEMASTERISK sndAlias('S','*') +#define SND_ALIAS_SYSTEMQUESTION sndAlias('S','?') +#define SND_ALIAS_SYSTEMHAND sndAlias('S','H') +#define SND_ALIAS_SYSTEMEXIT sndAlias('S','E') +#define SND_ALIAS_SYSTEMSTART sndAlias('S','S') +#define SND_ALIAS_SYSTEMWELCOME sndAlias('S','W') +#define SND_ALIAS_SYSTEMEXCLAMATION sndAlias('S','!') +#define SND_ALIAS_SYSTEMDEFAULT sndAlias('S','D') +#define WAVERR_BADFORMAT (WAVERR_BASE + 0) +#define WAVERR_STILLPLAYING (WAVERR_BASE + 1) +#define WAVERR_UNPREPARED (WAVERR_BASE + 2) +#define WAVERR_SYNC (WAVERR_BASE + 3) +#define WAVERR_LASTERROR (WAVERR_BASE + 3) +#define WOM_OPEN MM_WOM_OPEN +#define WOM_CLOSE MM_WOM_CLOSE +#define WOM_DONE MM_WOM_DONE +#define WIM_OPEN MM_WIM_OPEN +#define WIM_CLOSE MM_WIM_CLOSE +#define WIM_DATA MM_WIM_DATA +#define WAVE_MAPPER ((UINT)-1) +#define WAVE_FORMAT_QUERY 1 +#define WAVE_ALLOWSYNC 2 +#define WAVE_MAPPED 4 +#define WAVE_FORMAT_DIRECT 8 +#define WAVE_FORMAT_DIRECT_QUERY (WAVE_FORMAT_QUERY|WAVE_FORMAT_DIRECT) +#define WHDR_DONE 1 +#define WHDR_PREPARED 2 +#define WHDR_BEGINLOOP 4 +#define WHDR_ENDLOOP 8 +#define WHDR_INQUEUE 16 +#define WAVECAPS_PITCH 1 +#define WAVECAPS_PLAYBACKRATE 2 +#define WAVECAPS_VOLUME 4 +#define WAVECAPS_LRVOLUME 8 +#define WAVECAPS_SYNC 16 +#define WAVECAPS_SAMPLEACCURATE 32 +#define WAVECAPS_DIRECTSOUND 64 +#define WAVE_INVALIDFORMAT 0 +#define WAVE_FORMAT_1M08 1 +#define WAVE_FORMAT_1S08 2 +#define WAVE_FORMAT_1M16 4 +#define WAVE_FORMAT_1S16 8 +#define WAVE_FORMAT_2M08 16 +#define WAVE_FORMAT_2S08 32 +#define WAVE_FORMAT_2M16 64 +#define WAVE_FORMAT_2S16 128 +#define WAVE_FORMAT_4M08 256 +#define WAVE_FORMAT_4S08 512 +#define WAVE_FORMAT_4M16 1024 +#define WAVE_FORMAT_4S16 2048 +#define WAVE_FORMAT_PCM 1 +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#define MIDIERR_UNPREPARED MIDIERR_BASE +#define MIDIERR_STILLPLAYING (MIDIERR_BASE+1) +#define MIDIERR_NOMAP (MIDIERR_BASE+2) +#define MIDIERR_NOTREADY (MIDIERR_BASE+3) +#define MIDIERR_NODEVICE (MIDIERR_BASE+4) +#define MIDIERR_INVALIDSETUP (MIDIERR_BASE+5) +#define MIDIERR_BADOPENMODE (MIDIERR_BASE+6) +#define MIDIERR_DONT_CONTINUE (MIDIERR_BASE+7) +#define MIDIERR_LASTERROR (MIDIERR_BASE+7) +#define MIDIPATCHSIZE 128 +#define MIM_OPEN MM_MIM_OPEN +#define MIM_CLOSE MM_MIM_CLOSE +#define MIM_DATA MM_MIM_DATA +#define MIM_LONGDATA MM_MIM_LONGDATA +#define MIM_ERROR MM_MIM_ERROR +#define MIM_LONGERROR MM_MIM_LONGERROR +#define MOM_OPEN MM_MOM_OPEN +#define MOM_CLOSE MM_MOM_CLOSE +#define MOM_DONE MM_MOM_DONE +#define MIM_MOREDATA MM_MIM_MOREDATA +#define MOM_POSITIONCB MM_MOM_POSITIONCB +#define MIDIMAPPER ((UINT)-1) +#define MIDI_MAPPER ((UINT)-1) +#define MIDI_IO_STATUS 32 +#define MIDI_CACHE_ALL 1 +#define MIDI_CACHE_BESTFIT 2 +#define MIDI_CACHE_QUERY 3 +#define MIDI_UNCACHE 4 +#define MOD_MIDIPORT 1 +#define MOD_SYNTH 2 +#define MOD_SQSYNTH 3 +#define MOD_FMSYNTH 4 +#define MOD_MAPPER 5 +#define MIDICAPS_VOLUME 1 +#define MIDICAPS_LRVOLUME 2 +#define MIDICAPS_CACHE 4 +#define MIDICAPS_STREAM 8 +#define MHDR_DONE 1 +#define MHDR_PREPARED 2 +#define MHDR_INQUEUE 4 +#define MHDR_ISSTRM 8 +#define MEVT_F_SHORT 0 +#define MEVT_F_LONG 0x80000000 +#define MEVT_F_CALLBACK 0x40000000 +#define MEVT_EVENTTYPE(x) ((BYTE)(((x)>>24)&0xFF)) +#define MEVT_EVENTPARM(x) ((DWORD)((x)&0xFFFFFFL)) +#define MEVT_SHORTMSG 0 +#define MEVT_TEMPO 1 +#define MEVT_NOP 2 +#define MEVT_LONGMSG ((BYTE)0x80) +#define MEVT_COMMENT ((BYTE)0x82) +#define MEVT_VERSION ((BYTE)0x84) +#define MIDISTRM_ERROR (-2) +#define MIDIPROP_SET 0x80000000 +#define MIDIPROP_GET 0x40000000 +#define MIDIPROP_TIMEDIV 1 +#define MIDIPROP_TEMPO 2 +#define AUX_MAPPER ((UINT)-1) +#define AUXCAPS_CDAUDIO 1 +#define AUXCAPS_AUXIN 2 +#define AUXCAPS_VOLUME 1 +#define AUXCAPS_LRVOLUME 2 +#define MIXER_SHORT_NAME_CHARS 16 +#define MIXER_LONG_NAME_CHARS 64 +#define MIXERR_INVALLINE MIXERR_BASE +#define MIXERR_INVALCONTROL (MIXERR_BASE+1) +#define MIXERR_INVALVALUE (MIXERR_BASE+2) +#define MIXERR_LASTERROR (MIXERR_BASE+2) +#define MIXER_OBJECTF_HANDLE 0x80000000 +#define MIXER_OBJECTF_MIXER 0 +#define MIXER_OBJECTF_HMIXER (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIXER) +#define MIXER_OBJECTF_WAVEOUT 0x10000000 +#define MIXER_OBJECTF_HWAVEOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEOUT) +#define MIXER_OBJECTF_WAVEIN 0x20000000 +#define MIXER_OBJECTF_HWAVEIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEIN) +#define MIXER_OBJECTF_MIDIOUT 0x30000000 +#define MIXER_OBJECTF_HMIDIOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIOUT) +#define MIXER_OBJECTF_MIDIIN 0x40000000 +#define MIXER_OBJECTF_HMIDIIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIIN) +#define MIXER_OBJECTF_AUX 0x50000000 +#define MIXERLINE_LINEF_ACTIVE 1 +#define MIXERLINE_LINEF_DISCONNECTED 0x8000 +#define MIXERLINE_LINEF_SOURCE 0x80000000 +#define MIXERLINE_COMPONENTTYPE_DST_FIRST 0 +#define MIXERLINE_COMPONENTTYPE_DST_UNDEFINED MIXERLINE_COMPONENTTYPE_DST_FIRST +#define MIXERLINE_COMPONENTTYPE_DST_DIGITAL (MIXERLINE_COMPONENTTYPE_DST_FIRST+1) +#define MIXERLINE_COMPONENTTYPE_DST_LINE (MIXERLINE_COMPONENTTYPE_DST_FIRST+2) +#define MIXERLINE_COMPONENTTYPE_DST_MONITOR (MIXERLINE_COMPONENTTYPE_DST_FIRST+3) +#define MIXERLINE_COMPONENTTYPE_DST_SPEAKERS (MIXERLINE_COMPONENTTYPE_DST_FIRST+4) +#define MIXERLINE_COMPONENTTYPE_DST_HEADPHONES (MIXERLINE_COMPONENTTYPE_DST_FIRST+5) +#define MIXERLINE_COMPONENTTYPE_DST_TELEPHONE (MIXERLINE_COMPONENTTYPE_DST_FIRST+6) +#define MIXERLINE_COMPONENTTYPE_DST_WAVEIN (MIXERLINE_COMPONENTTYPE_DST_FIRST+7) +#define MIXERLINE_COMPONENTTYPE_DST_VOICEIN (MIXERLINE_COMPONENTTYPE_DST_FIRST+8) +#define MIXERLINE_COMPONENTTYPE_DST_LAST (MIXERLINE_COMPONENTTYPE_DST_FIRST+8) +#define MIXERLINE_COMPONENTTYPE_SRC_FIRST 0x1000 +#define MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED MIXERLINE_COMPONENTTYPE_SRC_FIRST +#define MIXERLINE_COMPONENTTYPE_SRC_DIGITAL (MIXERLINE_COMPONENTTYPE_SRC_FIRST+1) +#define MIXERLINE_COMPONENTTYPE_SRC_LINE (MIXERLINE_COMPONENTTYPE_SRC_FIRST+2) +#define MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE (MIXERLINE_COMPONENTTYPE_SRC_FIRST+3) +#define MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER (MIXERLINE_COMPONENTTYPE_SRC_FIRST+4) +#define MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC (MIXERLINE_COMPONENTTYPE_SRC_FIRST+5) +#define MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE (MIXERLINE_COMPONENTTYPE_SRC_FIRST+6) +#define MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER (MIXERLINE_COMPONENTTYPE_SRC_FIRST+7) +#define MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT (MIXERLINE_COMPONENTTYPE_SRC_FIRST+8) +#define MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY (MIXERLINE_COMPONENTTYPE_SRC_FIRST+9) +#define MIXERLINE_COMPONENTTYPE_SRC_ANALOG (MIXERLINE_COMPONENTTYPE_SRC_FIRST+10) +#define MIXERLINE_COMPONENTTYPE_SRC_LAST (MIXERLINE_COMPONENTTYPE_SRC_FIRST+10) +#define MIXERLINE_TARGETTYPE_UNDEFINED 0 +#define MIXERLINE_TARGETTYPE_WAVEOUT 1 +#define MIXERLINE_TARGETTYPE_WAVEIN 2 +#define MIXERLINE_TARGETTYPE_MIDIOUT 3 +#define MIXERLINE_TARGETTYPE_MIDIIN 4 +#define MIXERLINE_TARGETTYPE_AUX 5 +#define MIXER_GETLINEINFOF_DESTINATION 0 +#define MIXER_GETLINEINFOF_SOURCE 1 +#define MIXER_GETLINEINFOF_LINEID 2 +#define MIXER_GETLINEINFOF_COMPONENTTYPE 3 +#define MIXER_GETLINEINFOF_TARGETTYPE 4 +#define MIXER_GETLINEINFOF_QUERYMASK 15 +#define MIXERCONTROL_CONTROLF_UNIFORM 1 +#define MIXERCONTROL_CONTROLF_MULTIPLE 2 +#define MIXERCONTROL_CONTROLF_DISABLED 0x80000000 +#define MIXERCONTROL_CT_CLASS_MASK 0xF0000000 +#define MIXERCONTROL_CT_CLASS_CUSTOM 0 +#define MIXERCONTROL_CT_CLASS_METER 0x10000000 +#define MIXERCONTROL_CT_CLASS_SWITCH 0x20000000 +#define MIXERCONTROL_CT_CLASS_NUMBER 0x30000000 +#define MIXERCONTROL_CT_CLASS_SLIDER 0x40000000 +#define MIXERCONTROL_CT_CLASS_FADER 0x50000000 +#define MIXERCONTROL_CT_CLASS_TIME 0x60000000 +#define MIXERCONTROL_CT_CLASS_LIST 0x70000000 +#define MIXERCONTROL_CT_SUBCLASS_MASK 0xF000000 +#define MIXERCONTROL_CT_SC_SWITCH_BOOLEAN 0 +#define MIXERCONTROL_CT_SC_SWITCH_BUTTON 0x1000000 +#define MIXERCONTROL_CT_SC_METER_POLLED 0 +#define MIXERCONTROL_CT_SC_TIME_MICROSECS 0 +#define MIXERCONTROL_CT_SC_TIME_MILLISECS 0x1000000 +#define MIXERCONTROL_CT_SC_LIST_SINGLE 0 +#define MIXERCONTROL_CT_SC_LIST_MULTIPLE 0x1000000 +#define MIXERCONTROL_CT_UNITS_MASK 0xFF0000 +#define MIXERCONTROL_CT_UNITS_CUSTOM 0 +#define MIXERCONTROL_CT_UNITS_BOOLEAN 0x10000 +#define MIXERCONTROL_CT_UNITS_SIGNED 0x20000 +#define MIXERCONTROL_CT_UNITS_UNSIGNED 0x30000 +#define MIXERCONTROL_CT_UNITS_DECIBELS 0x40000 +#define MIXERCONTROL_CT_UNITS_PERCENT 0x50000 +#define MIXERCONTROL_CONTROLTYPE_CUSTOM (MIXERCONTROL_CT_CLASS_CUSTOM|MIXERCONTROL_CT_UNITS_CUSTOM) +#define MIXERCONTROL_CONTROLTYPE_BOOLEANMETER (MIXERCONTROL_CT_CLASS_METER|MIXERCONTROL_CT_SC_METER_POLLED|MIXERCONTROL_CT_UNITS_BOOLEAN) +#define MIXERCONTROL_CONTROLTYPE_SIGNEDMETER (MIXERCONTROL_CT_CLASS_METER|MIXERCONTROL_CT_SC_METER_POLLED|MIXERCONTROL_CT_UNITS_SIGNED) +#define MIXERCONTROL_CONTROLTYPE_PEAKMETER (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER+1) +#define MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER (MIXERCONTROL_CT_CLASS_METER|MIXERCONTROL_CT_SC_METER_POLLED|MIXERCONTROL_CT_UNITS_UNSIGNED) +#define MIXERCONTROL_CONTROLTYPE_BOOLEAN (MIXERCONTROL_CT_CLASS_SWITCH|MIXERCONTROL_CT_SC_SWITCH_BOOLEAN|MIXERCONTROL_CT_UNITS_BOOLEAN) +#define MIXERCONTROL_CONTROLTYPE_ONOFF (MIXERCONTROL_CONTROLTYPE_BOOLEAN+1) +#define MIXERCONTROL_CONTROLTYPE_MUTE (MIXERCONTROL_CONTROLTYPE_BOOLEAN+2) +#define MIXERCONTROL_CONTROLTYPE_MONO (MIXERCONTROL_CONTROLTYPE_BOOLEAN+3) +#define MIXERCONTROL_CONTROLTYPE_LOUDNESS (MIXERCONTROL_CONTROLTYPE_BOOLEAN+4) +#define MIXERCONTROL_CONTROLTYPE_STEREOENH (MIXERCONTROL_CONTROLTYPE_BOOLEAN+5) +#define MIXERCONTROL_CONTROLTYPE_BUTTON (MIXERCONTROL_CT_CLASS_SWITCH|MIXERCONTROL_CT_SC_SWITCH_BUTTON|MIXERCONTROL_CT_UNITS_BOOLEAN) +#define MIXERCONTROL_CONTROLTYPE_DECIBELS (MIXERCONTROL_CT_CLASS_NUMBER|MIXERCONTROL_CT_UNITS_DECIBELS) +#define MIXERCONTROL_CONTROLTYPE_SIGNED (MIXERCONTROL_CT_CLASS_NUMBER|MIXERCONTROL_CT_UNITS_SIGNED) +#define MIXERCONTROL_CONTROLTYPE_UNSIGNED (MIXERCONTROL_CT_CLASS_NUMBER|MIXERCONTROL_CT_UNITS_UNSIGNED) +#define MIXERCONTROL_CONTROLTYPE_PERCENT (MIXERCONTROL_CT_CLASS_NUMBER|MIXERCONTROL_CT_UNITS_PERCENT) +#define MIXERCONTROL_CONTROLTYPE_SLIDER (MIXERCONTROL_CT_CLASS_SLIDER|MIXERCONTROL_CT_UNITS_SIGNED) +#define MIXERCONTROL_CONTROLTYPE_PAN (MIXERCONTROL_CONTROLTYPE_SLIDER+1) +#define MIXERCONTROL_CONTROLTYPE_QSOUNDPAN (MIXERCONTROL_CONTROLTYPE_SLIDER+2) +#define MIXERCONTROL_CONTROLTYPE_FADER (MIXERCONTROL_CT_CLASS_FADER|MIXERCONTROL_CT_UNITS_UNSIGNED) +#define MIXERCONTROL_CONTROLTYPE_VOLUME (MIXERCONTROL_CONTROLTYPE_FADER+1) +#define MIXERCONTROL_CONTROLTYPE_BASS (MIXERCONTROL_CONTROLTYPE_FADER+2) +#define MIXERCONTROL_CONTROLTYPE_TREBLE (MIXERCONTROL_CONTROLTYPE_FADER+3) +#define MIXERCONTROL_CONTROLTYPE_EQUALIZER (MIXERCONTROL_CONTROLTYPE_FADER+4) +#define MIXERCONTROL_CONTROLTYPE_SINGLESELECT (MIXERCONTROL_CT_CLASS_LIST|MIXERCONTROL_CT_SC_LIST_SINGLE|MIXERCONTROL_CT_UNITS_BOOLEAN) +#define MIXERCONTROL_CONTROLTYPE_MUX (MIXERCONTROL_CONTROLTYPE_SINGLESELECT+1) +#define MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT (MIXERCONTROL_CT_CLASS_LIST|MIXERCONTROL_CT_SC_LIST_MULTIPLE|MIXERCONTROL_CT_UNITS_BOOLEAN) +#define MIXERCONTROL_CONTROLTYPE_MIXER (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT+1) +#define MIXERCONTROL_CONTROLTYPE_MICROTIME (MIXERCONTROL_CT_CLASS_TIME|MIXERCONTROL_CT_SC_TIME_MICROSECS|MIXERCONTROL_CT_UNITS_UNSIGNED) +#define MIXERCONTROL_CONTROLTYPE_MILLITIME (MIXERCONTROL_CT_CLASS_TIME|MIXERCONTROL_CT_SC_TIME_MILLISECS|MIXERCONTROL_CT_UNITS_UNSIGNED) +#define MIXER_GETLINECONTROLSF_ALL 0 +#define MIXER_GETLINECONTROLSF_ONEBYID 1 +#define MIXER_GETLINECONTROLSF_ONEBYTYPE 2 +#define MIXER_GETLINECONTROLSF_QUERYMASK 15 +#define MIXER_GETCONTROLDETAILSF_VALUE 0 +#define MIXER_GETCONTROLDETAILSF_LISTTEXT 1 +#define MIXER_GETCONTROLDETAILSF_QUERYMASK 15 +#define MIXER_SETCONTROLDETAILSF_VALUE 0 +#define MIXER_SETCONTROLDETAILSF_CUSTOM 1 +#define MIXER_SETCONTROLDETAILSF_QUERYMASK 15 +#define TIMERR_NOERROR 0 +#define TIMERR_NOCANDO (TIMERR_BASE+1) +#define TIMERR_STRUCT (TIMERR_BASE+33) +#define TIME_ONESHOT 0 +#define TIME_PERIODIC 1 +#define TIME_CALLBACK_FUNCTION 0 +#define TIME_CALLBACK_EVENT_SET 16 +#define TIME_CALLBACK_EVENT_PULSE 32 +#if (WINVER >= 0x0501) +#define TIME_KILL_SYNCHRONOUS 0x0100 +#endif +#define JOYERR_NOERROR (0) +#define JOYERR_PARMS (JOYERR_BASE+5) +#define JOYERR_NOCANDO (JOYERR_BASE+6) +#define JOYERR_UNPLUGGED (JOYERR_BASE+7) +#define JOY_BUTTON1 1 +#define JOY_BUTTON2 2 +#define JOY_BUTTON3 4 +#define JOY_BUTTON4 8 +#define JOY_BUTTON1CHG 256 +#define JOY_BUTTON2CHG 512 +#define JOY_BUTTON3CHG 1024 +#define JOY_BUTTON4CHG 2048 +#define JOY_BUTTON5 257 +#define JOY_BUTTON6 513 +#define JOY_BUTTON7 1025 +#define JOY_BUTTON8 2049 +#define JOY_BUTTON9 256 +#define JOY_BUTTON10 512 +#define JOY_BUTTON11 1024 +#define JOY_BUTTON12 2048 +#define JOY_BUTTON13 4096 +#define JOY_BUTTON14 8192 +#define JOY_BUTTON15 16384 +#define JOY_BUTTON16 32768 +#define JOY_BUTTON17 65536 +#define JOY_BUTTON18 0x20000 +#define JOY_BUTTON19 0x40000 +#define JOY_BUTTON20 0x80000 +#define JOY_BUTTON21 0x100000 +#define JOY_BUTTON22 0x200000 +#define JOY_BUTTON23 0x400000 +#define JOY_BUTTON24 0x800000 +#define JOY_BUTTON25 0x1000000 +#define JOY_BUTTON26 0x2000000 +#define JOY_BUTTON27 0x4000000 +#define JOY_BUTTON28 0x8000000 +#define JOY_BUTTON29 0x10000000 +#define JOY_BUTTON30 0x20000000 +#define JOY_BUTTON31 0x40000000 +#define JOY_BUTTON32 0x80000000 +#define JOY_POVCENTERED ((WORD)-1) +#define JOY_POVFORWARD 0 +#define JOY_POVRIGHT 9000 +#define JOY_POVBACKWARD 18000 +#define JOY_POVLEFT 27000 +#define JOY_RETURNX 1 +#define JOY_RETURNY 2 +#define JOY_RETURNZ 4l +#define JOY_RETURNR 8 +#define JOY_RETURNU 16 +#define JOY_RETURNV 32 +#define JOY_RETURNPOV 64 +#define JOY_RETURNBUTTONS 128 +#define JOY_RETURNRAWDATA 256 +#define JOY_RETURNPOVCTS 512 +#define JOY_RETURNCENTERED 1024 +#define JOY_USEDEADZONE 2048 +#define JOY_RETURNALL (JOY_RETURNX|JOY_RETURNY|JOY_RETURNZ|JOY_RETURNR|JOY_RETURNU|JOY_RETURNV|JOY_RETURNPOV|JOY_RETURNBUTTONS) +#define JOY_CAL_READALWAYS 0x10000 +#define JOY_CAL_READXYONLY 0x20000 +#define JOY_CAL_READ3 0x40000 +#define JOY_CAL_READ4 0x80000 +#define JOY_CAL_READXONLY 0x100000 +#define JOY_CAL_READYONLY 0x200000 +#define JOY_CAL_READ5 0x400000 +#define JOY_CAL_READ6 0x800000 +#define JOY_CAL_READZONLY 0x1000000 +#define JOY_CAL_READRONLY 0x2000000 +#define JOY_CAL_READUONLY 0x4000000 +#define JOY_CAL_READVONLY 0x8000000 +#define JOYSTICKID1 0 +#define JOYSTICKID2 1 +#define JOYCAPS_HASZ 1 +#define JOYCAPS_HASR 2 +#define JOYCAPS_HASU 4 +#define JOYCAPS_HASV 8 +#define JOYCAPS_HASPOV 16 +#define JOYCAPS_POV4DIR 32 +#define JOYCAPS_POVCTS 64 +#define MMIOERR_BASE 256 +#define MMIOERR_FILENOTFOUND (MMIOERR_BASE+1) +#define MMIOERR_OUTOFMEMORY (MMIOERR_BASE+2) +#define MMIOERR_CANNOTOPEN (MMIOERR_BASE+3) +#define MMIOERR_CANNOTCLOSE (MMIOERR_BASE+4) +#define MMIOERR_CANNOTREAD (MMIOERR_BASE+5) +#define MMIOERR_CANNOTWRITE (MMIOERR_BASE+6) +#define MMIOERR_CANNOTSEEK (MMIOERR_BASE+7) +#define MMIOERR_CANNOTEXPAND (MMIOERR_BASE+8) +#define MMIOERR_CHUNKNOTFOUND (MMIOERR_BASE+9) +#define MMIOERR_UNBUFFERED (MMIOERR_BASE+10) +#define MMIOERR_PATHNOTFOUND (MMIOERR_BASE+11) +#define MMIOERR_ACCESSDENIED (MMIOERR_BASE+12) +#define MMIOERR_SHARINGVIOLATION (MMIOERR_BASE+13) +#define MMIOERR_NETWORKERROR (MMIOERR_BASE+14) +#define MMIOERR_TOOMANYOPENFILES (MMIOERR_BASE+15) +#define MMIOERR_INVALIDFILE (MMIOERR_BASE+16) +#define CFSEPCHAR '+' +#define MMIO_RWMODE 3 +#define MMIO_SHAREMODE 0x70 +#define MMIO_CREATE 0x1000 +#define MMIO_PARSE 256 +#define MMIO_DELETE 512 +#define MMIO_EXIST 0x4000 +#define MMIO_ALLOCBUF 0x10000 +#define MMIO_GETTEMP 0x20000 +#define MMIO_DIRTY 0x10000000 +#define MMIO_READ 0 +#define MMIO_WRITE 1 +#define MMIO_READWRITE 2 +#define MMIO_COMPAT 0 +#define MMIO_EXCLUSIVE 16 +#define MMIO_DENYWRITE 32 +#define MMIO_DENYREAD 0x30 +#define MMIO_DENYNONE 64 +#define MMIO_FHOPEN 16 +#define MMIO_EMPTYBUF 16 +#define MMIO_TOUPPER 16 +#define MMIO_INSTALLPROC 0x10000 +#define MMIO_GLOBALPROC 0x10000000 +#define MMIO_REMOVEPROC 0x20000 +#define MMIO_UNICODEPROC 0x1000000 +#define MMIO_FINDPROC 0x40000 +#define MMIO_FINDCHUNK 16 +#define MMIO_FINDRIFF 32 +#define MMIO_FINDLIST 64 +#define MMIO_CREATERIFF 32 +#define MMIO_CREATELIST 64 +#define MMIOM_READ MMIO_READ +#define MMIOM_WRITE MMIO_WRITE +#define MMIOM_SEEK 2 +#define MMIOM_OPEN 3 +#define MMIOM_CLOSE 4 +#define MMIOM_WRITEFLUSH 5 +#define MMIOM_RENAME 6 +#define MMIOM_USER 0x8000 +#define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') +#define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') +#define FOURCC_DOS mmioFOURCC('D', 'O', 'S', ' ') +#define FOURCC_MEM mmioFOURCC('M', 'E', 'M', ' ') +#define MMIO_DEFAULTBUFFER 8192 +#define MCIERR_INVALID_DEVICE_ID (MCIERR_BASE+1) +#define MCIERR_UNRECOGNIZED_KEYWORD (MCIERR_BASE+3) +#define MCIERR_UNRECOGNIZED_COMMAND (MCIERR_BASE+5) +#define MCIERR_HARDWARE (MCIERR_BASE+6) +#define MCIERR_INVALID_DEVICE_NAME (MCIERR_BASE+7) +#define MCIERR_OUT_OF_MEMORY (MCIERR_BASE+8) +#define MCIERR_DEVICE_OPEN (MCIERR_BASE+9) +#define MCIERR_CANNOT_LOAD_DRIVER (MCIERR_BASE+10) +#define MCIERR_MISSING_COMMAND_STRING (MCIERR_BASE+11) +#define MCIERR_PARAM_OVERFLOW (MCIERR_BASE+12) +#define MCIERR_MISSING_STRING_ARGUMENT (MCIERR_BASE+13) +#define MCIERR_BAD_INTEGER (MCIERR_BASE+14) +#define MCIERR_PARSER_INTERNAL (MCIERR_BASE+15) +#define MCIERR_DRIVER_INTERNAL (MCIERR_BASE+16) +#define MCIERR_MISSING_PARAMETER (MCIERR_BASE+17) +#define MCIERR_UNSUPPORTED_FUNCTION (MCIERR_BASE+18) +#define MCIERR_FILE_NOT_FOUND (MCIERR_BASE+19) +#define MCIERR_DEVICE_NOT_READY (MCIERR_BASE+20) +#define MCIERR_INTERNAL (MCIERR_BASE+21) +#define MCIERR_DRIVER (MCIERR_BASE+22) +#define MCIERR_CANNOT_USE_ALL (MCIERR_BASE+23) +#define MCIERR_MULTIPLE (MCIERR_BASE+24) +#define MCIERR_EXTENSION_NOT_FOUND (MCIERR_BASE+25) +#define MCIERR_OUTOFRANGE (MCIERR_BASE+26) +#define MCIERR_FLAGS_NOT_COMPATIBLE (MCIERR_BASE+28) +#define MCIERR_FILE_NOT_SAVED (MCIERR_BASE+30) +#define MCIERR_DEVICE_TYPE_REQUIRED (MCIERR_BASE+31) +#define MCIERR_DEVICE_LOCKED (MCIERR_BASE+32) +#define MCIERR_DUPLICATE_ALIAS (MCIERR_BASE+33) +#define MCIERR_BAD_CONSTANT (MCIERR_BASE+34) +#define MCIERR_MUST_USE_SHAREABLE (MCIERR_BASE+35) +#define MCIERR_MISSING_DEVICE_NAME (MCIERR_BASE+36) +#define MCIERR_BAD_TIME_FORMAT (MCIERR_BASE+37) +#define MCIERR_NO_CLOSING_QUOTE (MCIERR_BASE+38) +#define MCIERR_DUPLICATE_FLAGS (MCIERR_BASE+39) +#define MCIERR_INVALID_FILE (MCIERR_BASE+40) +#define MCIERR_NULL_PARAMETER_BLOCK (MCIERR_BASE+41) +#define MCIERR_UNNAMED_RESOURCE (MCIERR_BASE+42) +#define MCIERR_NEW_REQUIRES_ALIAS (MCIERR_BASE+43) +#define MCIERR_NOTIFY_ON_AUTO_OPEN (MCIERR_BASE+44) +#define MCIERR_NO_ELEMENT_ALLOWED (MCIERR_BASE+45) +#define MCIERR_NONAPPLICABLE_FUNCTION (MCIERR_BASE+46) +#define MCIERR_ILLEGAL_FOR_AUTO_OPEN (MCIERR_BASE+47) +#define MCIERR_FILENAME_REQUIRED (MCIERR_BASE+48) +#define MCIERR_EXTRA_CHARACTERS (MCIERR_BASE+49) +#define MCIERR_DEVICE_NOT_INSTALLED (MCIERR_BASE+50) +#define MCIERR_GET_CD (MCIERR_BASE+51) +#define MCIERR_SET_CD (MCIERR_BASE+52) +#define MCIERR_SET_DRIVE (MCIERR_BASE+53) +#define MCIERR_DEVICE_LENGTH (MCIERR_BASE+54) +#define MCIERR_DEVICE_ORD_LENGTH (MCIERR_BASE+55) +#define MCIERR_NO_INTEGER (MCIERR_BASE+56) +#define MCIERR_WAVE_OUTPUTSINUSE (MCIERR_BASE+64) +#define MCIERR_WAVE_SETOUTPUTINUSE (MCIERR_BASE+65) +#define MCIERR_WAVE_INPUTSINUSE (MCIERR_BASE+66) +#define MCIERR_WAVE_SETINPUTINUSE (MCIERR_BASE+67) +#define MCIERR_WAVE_OUTPUTUNSPECIFIED (MCIERR_BASE+68) +#define MCIERR_WAVE_INPUTUNSPECIFIED (MCIERR_BASE+69) +#define MCIERR_WAVE_OUTPUTSUNSUITABLE (MCIERR_BASE+70) +#define MCIERR_WAVE_SETOUTPUTUNSUITABLE (MCIERR_BASE+71) +#define MCIERR_WAVE_INPUTSUNSUITABLE (MCIERR_BASE+72) +#define MCIERR_WAVE_SETINPUTUNSUITABLE (MCIERR_BASE+73) +#define MCIERR_SEQ_DIV_INCOMPATIBLE (MCIERR_BASE+80) +#define MCIERR_SEQ_PORT_INUSE (MCIERR_BASE+81) +#define MCIERR_SEQ_PORT_NONEXISTENT (MCIERR_BASE+82) +#define MCIERR_SEQ_PORT_MAPNODEVICE (MCIERR_BASE+83) +#define MCIERR_SEQ_PORT_MISCERROR (MCIERR_BASE+84) +#define MCIERR_SEQ_TIMER (MCIERR_BASE+85) +#define MCIERR_SEQ_PORTUNSPECIFIED (MCIERR_BASE+86) +#define MCIERR_SEQ_NOMIDIPRESENT (MCIERR_BASE+87) +#define MCIERR_NO_WINDOW (MCIERR_BASE+90) +#define MCIERR_CREATEWINDOW (MCIERR_BASE+91) +#define MCIERR_FILE_READ (MCIERR_BASE+92) +#define MCIERR_FILE_WRITE (MCIERR_BASE+93) +#define MCIERR_NO_IDENTITY (MCIERR_BASE+94) +#define MCIERR_CUSTOM_DRIVER_BASE (MCIERR_BASE+256) +#define MCI_FIRST DRV_MCI_FIRST +#define MCI_OPEN 0x803 +#define MCI_CLOSE 0x804 +#define MCI_ESCAPE 0x805 +#define MCI_PLAY 0x806 +#define MCI_SEEK 0x807 +#define MCI_STOP 0x808 +#define MCI_PAUSE 0x809 +#define MCI_INFO 0x80A +#define MCI_GETDEVCAPS 0x80B +#define MCI_SPIN 0x80C +#define MCI_SET 0x80D +#define MCI_STEP 0x80E +#define MCI_RECORD 0x80F +#define MCI_SYSINFO 0x810 +#define MCI_BREAK 0x811 +#define MCI_SAVE 0x813 +#define MCI_STATUS 0x814 +#define MCI_CUE 0x830 +#define MCI_REALIZE 0x840 +#define MCI_WINDOW 0x841 +#define MCI_PUT 0x842 +#define MCI_WHERE 0x843 +#define MCI_FREEZE 0x844 +#define MCI_UNFREEZE 0x845 +#define MCI_LOAD 0x850 +#define MCI_CUT 0x851 +#define MCI_COPY 0x852 +#define MCI_PASTE 0x853 +#define MCI_UPDATE 0x854 +#define MCI_RESUME 0x855 +#define MCI_DELETE 0x856 +#define MCI_USER_MESSAGES (DRV_MCI_FIRST+0x400) +#define MCI_LAST 0xFFF +#define MCI_ALL_DEVICE_ID ((MCIDEVICEID)-1) +#define MCI_DEVTYPE_VCR 513 +#define MCI_DEVTYPE_VIDEODISC 514 +#define MCI_DEVTYPE_OVERLAY 515 +#define MCI_DEVTYPE_CD_AUDIO 516 +#define MCI_DEVTYPE_DAT 517 +#define MCI_DEVTYPE_SCANNER 518 +#define MCI_DEVTYPE_ANIMATION 519 +#define MCI_DEVTYPE_DIGITAL_VIDEO 520 +#define MCI_DEVTYPE_OTHER 521 +#define MCI_DEVTYPE_WAVEFORM_AUDIO 522 +#define MCI_DEVTYPE_SEQUENCER 523 +#define MCI_DEVTYPE_FIRST MCI_DEVTYPE_VCR +#define MCI_DEVTYPE_LAST MCI_DEVTYPE_SEQUENCER +#define MCI_DEVTYPE_FIRST_USER 0x1000 +#define MCI_MODE_NOT_READY (MCI_STRING_OFFSET+12) +#define MCI_MODE_STOP (MCI_STRING_OFFSET+13) +#define MCI_MODE_PLAY (MCI_STRING_OFFSET+14) +#define MCI_MODE_RECORD (MCI_STRING_OFFSET+15) +#define MCI_MODE_SEEK (MCI_STRING_OFFSET+16) +#define MCI_MODE_PAUSE (MCI_STRING_OFFSET+17) +#define MCI_MODE_OPEN (MCI_STRING_OFFSET+18) +#define MCI_FORMAT_MILLISECONDS 0 +#define MCI_FORMAT_HMS 1 +#define MCI_FORMAT_MSF 2 +#define MCI_FORMAT_FRAMES 3 +#define MCI_FORMAT_SMPTE_24 4 +#define MCI_FORMAT_SMPTE_25 5 +#define MCI_FORMAT_SMPTE_30 6 +#define MCI_FORMAT_SMPTE_30DROP 7 +#define MCI_FORMAT_BYTES 8 +#define MCI_FORMAT_SAMPLES 9 +#define MCI_FORMAT_TMSF 10 +#define MCI_MSF_MINUTE(t) ((BYTE)(t)) +#define MCI_MSF_SECOND(t) ((BYTE)(((WORD)(t))>>8)) +#define MCI_MSF_FRAME(t) ((BYTE)((t)>>16)) +#define MCI_MAKE_MSF(m,s,f) ((DWORD)(((BYTE)(m)|((WORD)(s)<<8))|(((DWORD)(BYTE)(f))<<16))) +#define MCI_TMSF_TRACK(t) ((BYTE)(t)) +#define MCI_TMSF_MINUTE(t) ((BYTE)(((WORD)(t))>>8)) +#define MCI_TMSF_SECOND(t) ((BYTE)((t)>>16)) +#define MCI_TMSF_FRAME(t) ((BYTE)((t)>>24)) +#define MCI_MAKE_TMSF(t,m,s,f) ((DWORD)(((BYTE)(t)|((WORD)(m)<<8))|(((DWORD)(BYTE)(s)|((WORD)(f)<<8))<<16))) +#define MCI_HMS_HOUR(t) ((BYTE)(t)) +#define MCI_HMS_MINUTE(t) ((BYTE)(((WORD)(t))>>8)) +#define MCI_HMS_SECOND(t) ((BYTE)((t)>>16)) +#define MCI_MAKE_HMS(h,m,s) ((DWORD)(((BYTE)(h)|((WORD)(m)<<8))|(((DWORD)(BYTE)(s))<<16))) +#define MCI_NOTIFY_SUCCESSFUL 1 +#define MCI_NOTIFY_SUPERSEDED 2 +#define MCI_NOTIFY_ABORTED 4 +#define MCI_NOTIFY_FAILURE 8 +#define MCI_NOTIFY 1 +#define MCI_WAIT 2 +#define MCI_FROM 4 +#define MCI_TO 8 +#define MCI_TRACK 16 +#define MCI_OPEN_SHAREABLE 256 +#define MCI_OPEN_ELEMENT 512 +#define MCI_OPEN_ALIAS 1024 +#define MCI_OPEN_ELEMENT_ID 2048 +#define MCI_OPEN_TYPE_ID 0x1000 +#define MCI_OPEN_TYPE 0x2000 +#define MCI_SEEK_TO_START 256 +#define MCI_SEEK_TO_END 512 +#define MCI_STATUS_ITEM 256 +#define MCI_STATUS_START 512 +#define MCI_STATUS_LENGTH 1 +#define MCI_STATUS_POSITION 2 +#define MCI_STATUS_NUMBER_OF_TRACKS 3 +#define MCI_STATUS_MODE 4 +#define MCI_STATUS_MEDIA_PRESENT 5 +#define MCI_STATUS_TIME_FORMAT 6 +#define MCI_STATUS_READY 7 +#define MCI_STATUS_CURRENT_TRACK 8 +#define MCI_INFO_PRODUCT 256 +#define MCI_INFO_FILE 512 +#define MCI_INFO_MEDIA_UPC 1024 +#define MCI_INFO_MEDIA_IDENTITY 2048 +#define MCI_INFO_NAME 0x1000 +#define MCI_INFO_COPYRIGHT 0x2000 +#define MCI_GETDEVCAPS_ITEM 256 +#define MCI_GETDEVCAPS_CAN_RECORD 1 +#define MCI_GETDEVCAPS_HAS_AUDIO 2 +#define MCI_GETDEVCAPS_HAS_VIDEO 3 +#define MCI_GETDEVCAPS_DEVICE_TYPE 4 +#define MCI_GETDEVCAPS_USES_FILES 5 +#define MCI_GETDEVCAPS_COMPOUND_DEVICE 6 +#define MCI_GETDEVCAPS_CAN_EJECT 7 +#define MCI_GETDEVCAPS_CAN_PLAY 8 +#define MCI_GETDEVCAPS_CAN_SAVE 9 +#define MCI_SYSINFO_QUANTITY 256 +#define MCI_SYSINFO_OPEN 512 +#define MCI_SYSINFO_NAME 1024 +#define MCI_SYSINFO_INSTALLNAME 2048 +#define MCI_SET_DOOR_OPEN 256 +#define MCI_SET_DOOR_CLOSED 512 +#define MCI_SET_TIME_FORMAT 1024 +#define MCI_SET_AUDIO 2048 +#define MCI_SET_VIDEO 0x1000 +#define MCI_SET_ON 0x2000 +#define MCI_SET_OFF 0x4000 +#define MCI_SET_AUDIO_ALL 0 +#define MCI_SET_AUDIO_LEFT 1 +#define MCI_SET_AUDIO_RIGHT 2 +#define MCI_BREAK_KEY 256 +#define MCI_BREAK_HWND 512 +#define MCI_BREAK_OFF 1024 +#define MCI_RECORD_INSERT 256 +#define MCI_RECORD_OVERWRITE 512 +#define MCI_SAVE_FILE 256 +#define MCI_LOAD_FILE 256 +#define MCI_VD_MODE_PARK (MCI_VD_OFFSET+1) +#define MCI_VD_MEDIA_CLV (MCI_VD_OFFSET+2) +#define MCI_VD_MEDIA_CAV (MCI_VD_OFFSET+3) +#define MCI_VD_MEDIA_OTHER (MCI_VD_OFFSET+4) +#define MCI_VD_FORMAT_TRACK 0x4001 +#define MCI_VD_PLAY_REVERSE 0x10000 +#define MCI_VD_PLAY_FAST 0x20000 +#define MCI_VD_PLAY_SPEED 0x40000 +#define MCI_VD_PLAY_SCAN 0x80000 +#define MCI_VD_PLAY_SLOW 0x100000 +#define MCI_VD_SEEK_REVERSE 0x10000 +#define MCI_VD_STATUS_SPEED 0x4002 +#define MCI_VD_STATUS_FORWARD 0x4003 +#define MCI_VD_STATUS_MEDIA_TYPE 0x4004 +#define MCI_VD_STATUS_SIDE 0x4005 +#define MCI_VD_STATUS_DISC_SIZE 0x4006 +#define MCI_VD_GETDEVCAPS_CLV 0x10000 +#define MCI_VD_GETDEVCAPS_CAV 0x20000 +#define MCI_VD_SPIN_UP 0x10000 +#define MCI_VD_SPIN_DOWN 0x20000 +#define MCI_VD_GETDEVCAPS_CAN_REVERSE 0x4002 +#define MCI_VD_GETDEVCAPS_FAST_RATE 0x4003 +#define MCI_VD_GETDEVCAPS_SLOW_RATE 0x4004 +#define MCI_VD_GETDEVCAPS_NORMAL_RATE 0x4005 +#define MCI_VD_STEP_FRAMES 0x10000 +#define MCI_VD_STEP_REVERSE 0x20000 +#define MCI_VD_ESCAPE_STRING 256 +#define MCI_CDA_STATUS_TYPE_TRACK 0x4001 +#define MCI_CDA_TRACK_AUDIO MCI_CD_OFFSET +#define MCI_CDA_TRACK_OTHER (MCI_CD_OFFSET+1) +#define MCI_WAVE_PCM MCI_WAVE_OFFSET +#define MCI_WAVE_MAPPER (MCI_WAVE_OFFSET+1) +#define MCI_WAVE_OPEN_BUFFER 0x10000 +#define MCI_WAVE_SET_FORMATTAG 0x10000 +#define MCI_WAVE_SET_CHANNELS 0x20000 +#define MCI_WAVE_SET_SAMPLESPERSEC 0x40000 +#define MCI_WAVE_SET_AVGBYTESPERSEC 0x80000 +#define MCI_WAVE_SET_BLOCKALIGN 0x100000 +#define MCI_WAVE_SET_BITSPERSAMPLE 0x200000 +#define MCI_WAVE_INPUT 0x400000 +#define MCI_WAVE_OUTPUT 0x800000 +#define MCI_WAVE_STATUS_FORMATTAG 0x4001 +#define MCI_WAVE_STATUS_CHANNELS 0x4002 +#define MCI_WAVE_STATUS_SAMPLESPERSEC 0x4003 +#define MCI_WAVE_STATUS_AVGBYTESPERSEC 0x4004 +#define MCI_WAVE_STATUS_BLOCKALIGN 0x4005 +#define MCI_WAVE_STATUS_BITSPERSAMPLE 0x4006 +#define MCI_WAVE_STATUS_LEVEL 0x4007 +#define MCI_WAVE_SET_ANYINPUT 0x4000000 +#define MCI_WAVE_SET_ANYOUTPUT 0x8000000 +#define MCI_WAVE_GETDEVCAPS_INPUTS 0x4001 +#define MCI_WAVE_GETDEVCAPS_OUTPUTS 0x4002 +#define MCI_SEQ_DIV_PPQN MCI_SEQ_OFFSET +#define MCI_SEQ_DIV_SMPTE_24 (MCI_SEQ_OFFSET+1) +#define MCI_SEQ_DIV_SMPTE_25 (MCI_SEQ_OFFSET+2) +#define MCI_SEQ_DIV_SMPTE_30DROP (MCI_SEQ_OFFSET+3) +#define MCI_SEQ_DIV_SMPTE_30 (MCI_SEQ_OFFSET+4) +#define MCI_SEQ_FORMAT_SONGPTR 0x4001 +#define MCI_SEQ_FILE 0x4002 +#define MCI_SEQ_MIDI 0x4003 +#define MCI_SEQ_SMPTE 0x4004 +#define MCI_SEQ_NONE 65533 +#define MCI_SEQ_MAPPER 65535 +#define MCI_SEQ_STATUS_TEMPO 0x4002 +#define MCI_SEQ_STATUS_PORT 0x4003 +#define MCI_SEQ_STATUS_SLAVE 0x4007 +#define MCI_SEQ_STATUS_MASTER 0x4008 +#define MCI_SEQ_STATUS_OFFSET 0x4009 +#define MCI_SEQ_STATUS_DIVTYPE 0x400A +#define MCI_SEQ_STATUS_NAME 0x400B +#define MCI_SEQ_STATUS_COPYRIGHT 0x400C +#define MCI_SEQ_SET_TEMPO 0x10000 +#define MCI_SEQ_SET_PORT 0x20000 +#define MCI_SEQ_SET_SLAVE 0x40000 +#define MCI_SEQ_SET_MASTER 0x80000 +#define MCI_SEQ_SET_OFFSET 0x1000000 +#define MCI_ANIM_OPEN_WS 0x10000 +#define MCI_ANIM_OPEN_PARENT 0x20000 +#define MCI_ANIM_OPEN_NOSTATIC 0x40000 +#define MCI_ANIM_PLAY_SPEED 0x10000 +#define MCI_ANIM_PLAY_REVERSE 0x20000 +#define MCI_ANIM_PLAY_FAST 0x40000 +#define MCI_ANIM_PLAY_SLOW 0x80000 +#define MCI_ANIM_PLAY_SCAN 0x100000 +#define MCI_ANIM_STEP_REVERSE 0x10000 +#define MCI_ANIM_STEP_FRAMES 0x20000 +#define MCI_ANIM_STATUS_SPEED 0x4001 +#define MCI_ANIM_STATUS_FORWARD 0x4002 +#define MCI_ANIM_STATUS_HWND 0x4003 +#define MCI_ANIM_STATUS_HPAL 0x4004 +#define MCI_ANIM_STATUS_STRETCH 0x4005 +#define MCI_ANIM_INFO_TEXT 0x10000 +#define MCI_ANIM_GETDEVCAPS_CAN_REVERSE 0x4001 +#define MCI_ANIM_GETDEVCAPS_FAST_RATE 0x4002 +#define MCI_ANIM_GETDEVCAPS_SLOW_RATE 0x4003 +#define MCI_ANIM_GETDEVCAPS_NORMAL_RATE 0x4004 +#define MCI_ANIM_GETDEVCAPS_PALETTES 0x4006 +#define MCI_ANIM_GETDEVCAPS_CAN_STRETCH 0x4007 +#define MCI_ANIM_GETDEVCAPS_MAX_WINDOWS 0x4008 +#define MCI_ANIM_REALIZE_NORM 0x10000 +#define MCI_ANIM_REALIZE_BKGD 0x20000 +#define MCI_ANIM_WINDOW_HWND 0x10000 +#define MCI_ANIM_WINDOW_STATE 0x40000 +#define MCI_ANIM_WINDOW_TEXT 0x80000 +#define MCI_ANIM_WINDOW_ENABLE_STRETCH 0x100000 +#define MCI_ANIM_WINDOW_DISABLE_STRETCH 0x200000 +#define MCI_ANIM_WINDOW_DEFAULT 0xL +#define MCI_ANIM_RECT 0x10000 +#define MCI_ANIM_PUT_SOURCE 0x20000 +#define MCI_ANIM_PUT_DESTINATION 0x40000 +#define MCI_ANIM_WHERE_SOURCE 0x20000 +#define MCI_ANIM_WHERE_DESTINATION 0x40000 +#define MCI_ANIM_UPDATE_HDC 0x20000 +#define MCI_OVLY_OPEN_WS 0x10000 +#define MCI_OVLY_OPEN_PARENT 0x20000 +#define MCI_OVLY_STATUS_HWND 0x4001 +#define MCI_OVLY_STATUS_STRETCH 0x4002 +#define MCI_OVLY_INFO_TEXT 0x10000 +#define MCI_OVLY_GETDEVCAPS_CAN_STRETCH 0x4001 +#define MCI_OVLY_GETDEVCAPS_CAN_FREEZE 0x4002 +#define MCI_OVLY_GETDEVCAPS_MAX_WINDOWS 0x4003 +#define MCI_OVLY_WINDOW_HWND 0x10000 +#define MCI_OVLY_WINDOW_STATE 0x40000 +#define MCI_OVLY_WINDOW_TEXT 0x80000 +#define MCI_OVLY_WINDOW_ENABLE_STRETCH 0x100000 +#define MCI_OVLY_WINDOW_DISABLE_STRETCH 0x200000 +#define MCI_OVLY_WINDOW_DEFAULT 0xL +#define MCI_OVLY_RECT 0x10000 +#define MCI_OVLY_PUT_SOURCE 0x20000 +#define MCI_OVLY_PUT_DESTINATION 0x40000 +#define MCI_OVLY_PUT_FRAME 0x80000 +#define MCI_OVLY_PUT_VIDEO 0x100000 +#define MCI_OVLY_WHERE_SOURCE 0x20000 +#define MCI_OVLY_WHERE_DESTINATION 0x40000 +#define MCI_OVLY_WHERE_FRAME 0x80000 +#define MCI_OVLY_WHERE_VIDEO 0x100000 +#define NEWTRANSPARENT 3 +#define QUERYROPSUPPORT 40 +#define SELECTDIB 41 +#define DIBINDEX(n) MAKELONG((n),0x10FF) +#define SC_SCREENSAVE 0xF140 +#define CAPS1 94 +#define C1_TRANSPARENT 1 +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif +#ifndef SEEK_END +#define SEEK_END 2 +#endif + +typedef DWORD MCIERROR; +typedef UINT MCIDEVICEID; +typedef UINT(CALLBACK *YIELDPROC)(MCIDEVICEID,DWORD); +typedef UINT MMVERSION; +typedef UINT MMRESULT; +typedef struct mmtime_tag { + UINT wType; + union { + DWORD ms; + DWORD sample; + DWORD cb; + DWORD ticks; + struct { + BYTE hour; + BYTE min; + BYTE sec; + BYTE frame; + BYTE fps; + BYTE dummy; + BYTE pad[2]; + } smpte; + struct { + DWORD songptrpos; + } midi; + } u; +} MMTIME,*PMMTIME,*LPMMTIME; +DECLARE_HANDLE(HDRVR); +typedef struct tagDRVCONFIGINFO { + DWORD dwDCISize; + LPCWSTR lpszDCISectionName; + LPCWSTR lpszDCIAliasName; +} DRVCONFIGINFO,*PDRVCONFIGINFO,*LPDRVCONFIGINFO; +typedef struct DRVCONFIGINFOEX { + DWORD dwDCISize; + LPCWSTR lpszDCISectionName; + LPCWSTR lpszDCIAliasName; + DWORD dnDevNode; +} DRVCONFIGINFOEX,*PDRVCONFIGINFOEX,*LPDRVCONFIGINFOEX; +typedef LRESULT(CALLBACK* DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM); +typedef void (CALLBACK DRVCALLBACK)(HDRVR,UINT,DWORD,DWORD,DWORD); +typedef DRVCALLBACK *LPDRVCALLBACK; +typedef DRVCALLBACK *PDRVCALLBACK; +DECLARE_HANDLE(HWAVE); +DECLARE_HANDLE(HWAVEIN); +DECLARE_HANDLE(HWAVEOUT); +typedef HWAVEIN *LPHWAVEIN; +typedef HWAVEOUT *LPHWAVEOUT; +typedef DRVCALLBACK WAVECALLBACK; +typedef WAVECALLBACK *LPWAVECALLBACK; +typedef struct wavehdr_tag { + LPSTR lpData; + DWORD dwBufferLength; + DWORD dwBytesRecorded; + DWORD dwUser; + DWORD dwFlags; + DWORD dwLoops; + struct wavehdr_tag *lpNext; + DWORD reserved; +} WAVEHDR,*PWAVEHDR,*LPWAVEHDR; +typedef struct tagWAVEOUTCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + DWORD dwSupport; +} WAVEOUTCAPSA,*PWAVEOUTCAPSA,*LPWAVEOUTCAPSA; +typedef struct tagWAVEOUTCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + DWORD dwSupport; +} WAVEOUTCAPSW,*PWAVEOUTCAPSW,*LPWAVEOUTCAPSW; +typedef struct tagWAVEINCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; +} WAVEINCAPSA,*PWAVEINCAPSA,*LPWAVEINCAPSA; +typedef struct tagWAVEINCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; +} WAVEINCAPSW,*PWAVEINCAPSW,*LPWAVEINCAPSW; +typedef struct waveformat_tag { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; +} WAVEFORMAT,*PWAVEFORMAT,*LPWAVEFORMAT; +typedef struct pcmwaveformat_tag { + WAVEFORMAT wf; + WORD wBitsPerSample; +} PCMWAVEFORMAT, *PPCMWAVEFORMAT,*LPPCMWAVEFORMAT; +#ifndef _LPCWAVEFORMATEX_DEFINED +#define _LPCWAVEFORMATEX_DEFINED +#define _WAVEFORMATEX_ +typedef struct tWAVEFORMATEX { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; +} WAVEFORMATEX,*PWAVEFORMATEX,*LPWAVEFORMATEX; +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#endif +DECLARE_HANDLE(HMIDI); +DECLARE_HANDLE(HMIDIIN); +DECLARE_HANDLE(HMIDIOUT); +DECLARE_HANDLE(HMIDISTRM); +typedef HMIDI *LPHMIDI; +typedef HMIDIIN *LPHMIDIIN; +typedef HMIDIOUT *LPHMIDIOUT; +typedef HMIDISTRM *LPHMIDISTRM; +typedef DRVCALLBACK MIDICALLBACK; +typedef MIDICALLBACK *LPMIDICALLBACK; +typedef WORD PATCHARRAY[MIDIPATCHSIZE]; +typedef WORD *LPPATCHARRAY; +typedef WORD KEYARRAY[MIDIPATCHSIZE]; +typedef WORD *LPKEYARRAY; +typedef struct tagMIDIOUTCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + WORD wTechnology; + WORD wVoices; + WORD wNotes; + WORD wChannelMask; + DWORD dwSupport; +} MIDIOUTCAPSA,*PMIDIOUTCAPSA,*LPMIDIOUTCAPSA; +typedef struct tagMIDIOUTCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + WORD wTechnology; + WORD wVoices; + WORD wNotes; + WORD wChannelMask; + DWORD dwSupport; +} MIDIOUTCAPSW,*PMIDIOUTCAPSW,*LPMIDIOUTCAPSW; +typedef struct tagMIDIINCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + DWORD dwSupport; +} MIDIINCAPSA,*PMIDIINCAPSA,*LPMIDIINCAPSA; +typedef struct tagMIDIINCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwSupport; +} MIDIINCAPSW,*PMIDIINCAPSW,*NPMIDIINCAPSW,*LPMIDIINCAPSW; +typedef struct midihdr_tag { + LPSTR lpData; + DWORD dwBufferLength; + DWORD dwBytesRecorded; + DWORD dwUser; + DWORD dwFlags; + struct midihdr_tag *lpNext; + DWORD reserved; + DWORD dwOffset; + DWORD dwReserved[8]; +} MIDIHDR,*PMIDIHDR,*LPMIDIHDR; +typedef struct midievent_tag { + DWORD dwDeltaTime; + DWORD dwStreamID; + DWORD dwEvent; + DWORD dwParms[1]; +} MIDIEVENT; +typedef struct midistrmbuffver_tag { + DWORD dwVersion; + DWORD dwMid; + DWORD dwOEMVersion; +} MIDISTRMBUFFVER; +typedef struct midiproptimediv_tag { + DWORD cbStruct; + DWORD dwTimeDiv; +} MIDIPROPTIMEDIV,*LPMIDIPROPTIMEDIV; +typedef struct midiproptempo_tag { + DWORD cbStruct; + DWORD dwTempo; +} MIDIPROPTEMPO,*LPMIDIPROPTEMPO; +typedef struct tagAUXCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + WORD wTechnology; + WORD wReserved1; + DWORD dwSupport; +} AUXCAPSA,*PAUXCAPSA,*LPAUXCAPSA; +typedef struct tagAUXCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + WORD wTechnology; + WORD wReserved1; + DWORD dwSupport; +} AUXCAPSW,*PAUXCAPSW,*LPAUXCAPSW; +DECLARE_HANDLE(HMIXEROBJ); +typedef HMIXEROBJ *LPHMIXEROBJ; +DECLARE_HANDLE(HMIXER); +typedef HMIXER *LPHMIXER; +typedef struct tagMIXERCAPSA { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + DWORD fdwSupport; + DWORD cDestinations; +} MIXERCAPSA,*PMIXERCAPSA,*LPMIXERCAPSA; +typedef struct tagMIXERCAPSW { + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD fdwSupport; + DWORD cDestinations; +} MIXERCAPSW,*PMIXERCAPSW,*LPMIXERCAPSW; +typedef struct tagMIXERLINEA { + DWORD cbStruct; + DWORD dwDestination; + DWORD dwSource; + DWORD dwLineID; + DWORD fdwLine; + DWORD dwUser; + DWORD dwComponentType; + DWORD cChannels; + DWORD cConnections; + DWORD cControls; + CHAR szShortName[MIXER_SHORT_NAME_CHARS]; + CHAR szName[MIXER_LONG_NAME_CHARS]; + struct { + DWORD dwType; + DWORD dwDeviceID; + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + CHAR szPname[MAXPNAMELEN]; + } Target; +} MIXERLINEA,*PMIXERLINEA,*LPMIXERLINEA; +typedef struct tagMIXERLINEW { + DWORD cbStruct; + DWORD dwDestination; + DWORD dwSource; + DWORD dwLineID; + DWORD fdwLine; + DWORD dwUser; + DWORD dwComponentType; + DWORD cChannels; + DWORD cConnections; + DWORD cControls; + WCHAR szShortName[MIXER_SHORT_NAME_CHARS]; + WCHAR szName[MIXER_LONG_NAME_CHARS]; + struct { + DWORD dwType; + DWORD dwDeviceID; + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + } Target; +} MIXERLINEW,*PMIXERLINEW,*LPMIXERLINEW; +typedef struct tagMIXERCONTROLA { + DWORD cbStruct; + DWORD dwControlID; + DWORD dwControlType; + DWORD fdwControl; + DWORD cMultipleItems; + CHAR szShortName[MIXER_SHORT_NAME_CHARS]; + CHAR szName[MIXER_LONG_NAME_CHARS]; + union { + _ANONYMOUS_STRUCT struct { + LONG lMinimum; + LONG lMaximum; + }_STRUCT_NAME(s); + _ANONYMOUS_STRUCT struct { + DWORD dwMinimum; + DWORD dwMaximum; + }_STRUCT_NAME(s1); + DWORD dwReserved[6]; + } Bounds; + union { + DWORD cSteps; + DWORD cbCustomData; + DWORD dwReserved[6]; + } Metrics; +} MIXERCONTROLA,*PMIXERCONTROLA,*LPMIXERCONTROLA; +typedef struct tagMIXERCONTROLW { + DWORD cbStruct; + DWORD dwControlID; + DWORD dwControlType; + DWORD fdwControl; + DWORD cMultipleItems; + WCHAR szShortName[MIXER_SHORT_NAME_CHARS]; + WCHAR szName[MIXER_LONG_NAME_CHARS]; + union { + _ANONYMOUS_STRUCT struct { + LONG lMinimum; + LONG lMaximum; + }_STRUCT_NAME(s); + _ANONYMOUS_STRUCT struct { + DWORD dwMinimum; + DWORD dwMaximum; + }_STRUCT_NAME(s1); + DWORD dwReserved[6]; + } Bounds; + union { + DWORD cSteps; + DWORD cbCustomData; + DWORD dwReserved[6]; + } Metrics; +} MIXERCONTROLW,*PMIXERCONTROLW,*LPMIXERCONTROLW; +typedef struct tagMIXERLINECONTROLSA { + DWORD cbStruct; + DWORD dwLineID; + _ANONYMOUS_UNION union { + DWORD dwControlID; + DWORD dwControlType; + } DUMMYUNIONNAME; + DWORD cControls; + DWORD cbmxctrl; + LPMIXERCONTROLA pamxctrl; +} MIXERLINECONTROLSA,*PMIXERLINECONTROLSA,*LPMIXERLINECONTROLSA; +typedef struct tagMIXERLINECONTROLSW { + DWORD cbStruct; + DWORD dwLineID; + _ANONYMOUS_UNION union { + DWORD dwControlID; + DWORD dwControlType; + } DUMMYUNIONNAME; + DWORD cControls; + DWORD cbmxctrl; + LPMIXERCONTROLW pamxctrl; +} MIXERLINECONTROLSW,*PMIXERLINECONTROLSW,*LPMIXERLINECONTROLSW; +typedef struct tMIXERCONTROLDETAILS { + DWORD cbStruct; + DWORD dwControlID; + DWORD cChannels; + _ANONYMOUS_UNION union { + HWND hwndOwner; + DWORD cMultipleItems; + } DUMMYUNIONNAME; + DWORD cbDetails; + PVOID paDetails; +} MIXERCONTROLDETAILS,*PMIXERCONTROLDETAILS,*LPMIXERCONTROLDETAILS; +typedef struct tagMIXERCONTROLDETAILS_LISTTEXTA { + DWORD dwParam1; + DWORD dwParam2; + CHAR szName[MIXER_LONG_NAME_CHARS]; +} MIXERCONTROLDETAILS_LISTTEXTA,*PMIXERCONTROLDETAILS_LISTTEXTA,*LPMIXERCONTROLDETAILS_LISTTEXTA; +typedef struct tagMIXERCONTROLDETAILS_LISTTEXTW { + DWORD dwParam1; + DWORD dwParam2; + WCHAR szName[MIXER_LONG_NAME_CHARS]; +} MIXERCONTROLDETAILS_LISTTEXTW,*PMIXERCONTROLDETAILS_LISTTEXTW,*LPMIXERCONTROLDETAILS_LISTTEXTW; +typedef struct tMIXERCONTROLDETAILS_BOOLEAN { + LONG fValue; +} MIXERCONTROLDETAILS_BOOLEAN,*PMIXERCONTROLDETAILS_BOOLEAN,*LPMIXERCONTROLDETAILS_BOOLEAN; +typedef struct tMIXERCONTROLDETAILS_SIGNED { + LONG lValue; +} MIXERCONTROLDETAILS_SIGNED,*PMIXERCONTROLDETAILS_SIGNED,*LPMIXERCONTROLDETAILS_SIGNED; +typedef struct tMIXERCONTROLDETAILS_UNSIGNED { + DWORD dwValue; +} MIXERCONTROLDETAILS_UNSIGNED,*PMIXERCONTROLDETAILS_UNSIGNED,*LPMIXERCONTROLDETAILS_UNSIGNED; +typedef void(CALLBACK TIMECALLBACK)(UINT,UINT,DWORD,DWORD,DWORD); +typedef TIMECALLBACK *LPTIMECALLBACK; +typedef struct timecaps_tag { + UINT wPeriodMin; + UINT wPeriodMax; +} TIMECAPS,*PTIMECAPS,*LPTIMECAPS; +typedef struct tagJOYCAPSA { + WORD wMid; + WORD wPid; + CHAR szPname[MAXPNAMELEN]; + UINT wXmin; + UINT wXmax; + UINT wYmin; + UINT wYmax; + UINT wZmin; + UINT wZmax; + UINT wNumButtons; + UINT wPeriodMin; + UINT wPeriodMax; + UINT wRmin; + UINT wRmax; + UINT wUmin; + UINT wUmax; + UINT wVmin; + UINT wVmax; + UINT wCaps; + UINT wMaxAxes; + UINT wNumAxes; + UINT wMaxButtons; + CHAR szRegKey[MAXPNAMELEN]; + CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; +} JOYCAPSA,*PJOYCAPSA,*LPJOYCAPSA; +typedef struct tagJOYCAPSW { + WORD wMid; + WORD wPid; + WCHAR szPname[MAXPNAMELEN]; + UINT wXmin; + UINT wXmax; + UINT wYmin; + UINT wYmax; + UINT wZmin; + UINT wZmax; + UINT wNumButtons; + UINT wPeriodMin; + UINT wPeriodMax; + UINT wRmin; + UINT wRmax; + UINT wUmin; + UINT wUmax; + UINT wVmin; + UINT wVmax; + UINT wCaps; + UINT wMaxAxes; + UINT wNumAxes; + UINT wMaxButtons; + WCHAR szRegKey[MAXPNAMELEN]; + WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; +} JOYCAPSW,*PJOYCAPSW,*LPJOYCAPSW; +typedef struct joyinfo_tag { + UINT wXpos; + UINT wYpos; + UINT wZpos; + UINT wButtons; +} JOYINFO,*PJOYINFO,*LPJOYINFO; +typedef struct joyinfoex_tag { + DWORD dwSize; + DWORD dwFlags; + DWORD dwXpos; + DWORD dwYpos; + DWORD dwZpos; + DWORD dwRpos; + DWORD dwUpos; + DWORD dwVpos; + DWORD dwButtons; + DWORD dwButtonNumber; + DWORD dwPOV; + DWORD dwReserved1; + DWORD dwReserved2; +} JOYINFOEX,*PJOYINFOEX,*LPJOYINFOEX; +typedef DWORD FOURCC; +typedef char *HPSTR; +DECLARE_HANDLE(HMMIO); +typedef LRESULT (CALLBACK MMIOPROC)(LPSTR,UINT,LPARAM,LPARAM); +typedef MMIOPROC *LPMMIOPROC; +typedef struct _MMIOINFO { + DWORD dwFlags; + FOURCC fccIOProc; + LPMMIOPROC pIOProc; + UINT wErrorRet; + HTASK htask; + LONG cchBuffer; + HPSTR pchBuffer; + HPSTR pchNext; + HPSTR pchEndRead; + HPSTR pchEndWrite; + LONG lBufOffset; + LONG lDiskOffset; + DWORD adwInfo[3]; + DWORD dwReserved1; + DWORD dwReserved2; + HMMIO hmmio; +} MMIOINFO,*PMMIOINFO,*LPMMIOINFO; +typedef const MMIOINFO *LPCMMIOINFO; +typedef struct _MMCKINFO { + FOURCC ckid; + DWORD cksize; + FOURCC fccType; + DWORD dwDataOffset; + DWORD dwFlags; +} MMCKINFO,*PMMCKINFO,*LPMMCKINFO; +typedef const MMCKINFO *LPCMMCKINFO; +typedef struct tagMCI_GENERIC_PARMS { + DWORD dwCallback; +} MCI_GENERIC_PARMS,*PMCI_GENERIC_PARMS,*LPMCI_GENERIC_PARMS; +typedef struct tagMCI_OPEN_PARMSA { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCSTR lpstrDeviceType; + LPCSTR lpstrElementName; + LPCSTR lpstrAlias; +} MCI_OPEN_PARMSA,*PMCI_OPEN_PARMSA,*LPMCI_OPEN_PARMSA; +typedef struct tagMCI_OPEN_PARMSW { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCWSTR lpstrDeviceType; + LPCWSTR lpstrElementName; + LPCWSTR lpstrAlias; +} MCI_OPEN_PARMSW,*PMCI_OPEN_PARMSW,*LPMCI_OPEN_PARMSW; +typedef struct tagMCI_PLAY_PARMS { + DWORD dwCallback; + DWORD dwFrom; + DWORD dwTo; +} MCI_PLAY_PARMS,*PMCI_PLAY_PARMS,*LPMCI_PLAY_PARMS; +typedef struct tagMCI_SEEK_PARMS { + DWORD dwCallback; + DWORD dwTo; +} MCI_SEEK_PARMS, *PMCI_SEEK_PARMS,*LPMCI_SEEK_PARMS; +typedef struct tagMCI_STATUS_PARMS { + DWORD dwCallback; + DWORD dwReturn; + DWORD dwItem; + DWORD dwTrack; +} MCI_STATUS_PARMS,*PMCI_STATUS_PARMS,*LPMCI_STATUS_PARMS; +typedef struct tagMCI_INFO_PARMSA { + DWORD dwCallback; + LPSTR lpstrReturn; + DWORD dwRetSize; +} MCI_INFO_PARMSA,*LPMCI_INFO_PARMSA; +typedef struct tagMCI_INFO_PARMSW { + DWORD dwCallback; + LPWSTR lpstrReturn; + DWORD dwRetSize; +} MCI_INFO_PARMSW,*LPMCI_INFO_PARMSW; +typedef struct tagMCI_GETDEVCAPS_PARMS { + DWORD dwCallback; + DWORD dwReturn; + DWORD dwItem; +} MCI_GETDEVCAPS_PARMS,*PMCI_GETDEVCAPS_PARMS,*LPMCI_GETDEVCAPS_PARMS; +typedef struct tagMCI_SYSINFO_PARMSA { + DWORD dwCallback; + LPSTR lpstrReturn; + DWORD dwRetSize; + DWORD dwNumber; + UINT wDeviceType; +} MCI_SYSINFO_PARMSA,*PMCI_SYSINFO_PARMSA,*LPMCI_SYSINFO_PARMSA; +typedef struct tagMCI_SYSINFO_PARMSW { + DWORD dwCallback; + LPWSTR lpstrReturn; + DWORD dwRetSize; + DWORD dwNumber; + UINT wDeviceType; +} MCI_SYSINFO_PARMSW,*PMCI_SYSINFO_PARMSW,*LPMCI_SYSINFO_PARMSW; +typedef struct tagMCI_SET_PARMS { + DWORD dwCallback; + DWORD dwTimeFormat; + DWORD dwAudio; +} MCI_SET_PARMS,*PMCI_SET_PARMS,*LPMCI_SET_PARMS; +typedef struct tagMCI_BREAK_PARMS { + DWORD dwCallback; + int nVirtKey; + HWND hwndBreak; +} MCI_BREAK_PARMS,*PMCI_BREAK_PARMS,*LPMCI_BREAK_PARMS; +typedef struct tagMCI_SAVE_PARMSA { + DWORD dwCallback; + LPCSTR lpfilename; +} MCI_SAVE_PARMSA,*PMCI_SAVE_PARMSA,*LPMCI_SAVE_PARMSA; +typedef struct tagMCI_SAVE_PARMSW { + DWORD dwCallback; + LPCWSTR lpfilename; +} MCI_SAVE_PARMSW,*PMCI_SAVE_PARMSW,*LPMCI_SAVE_PARMSW; +typedef struct tagMCI_LOAD_PARMSA { + DWORD dwCallback; + LPCSTR lpfilename; +} MCI_LOAD_PARMSA,*PMCI_LOAD_PARMSA,*LPMCI_LOAD_PARMSA; +typedef struct tagMCI_LOAD_PARMSW { + DWORD dwCallback; + LPCWSTR lpfilename; +} MCI_LOAD_PARMSW,*PMCI_LOAD_PARMSW,*LPMCI_LOAD_PARMSW; +typedef struct tagMCI_RECORD_PARMS { + DWORD dwCallback; + DWORD dwFrom; + DWORD dwTo; +} MCI_RECORD_PARMS,*LPMCI_RECORD_PARMS; +typedef struct tagMCI_VD_PLAY_PARMS { + DWORD dwCallback; + DWORD dwFrom; + DWORD dwTo; + DWORD dwSpeed; +} MCI_VD_PLAY_PARMS,*PMCI_VD_PLAY_PARMS,*LPMCI_VD_PLAY_PARMS; +typedef struct tagMCI_VD_STEP_PARMS { + DWORD dwCallback; + DWORD dwFrames; +} MCI_VD_STEP_PARMS,*PMCI_VD_STEP_PARMS,*LPMCI_VD_STEP_PARMS; +typedef struct tagMCI_VD_ESCAPE_PARMSA { + DWORD dwCallback; + LPCSTR lpstrCommand; +} MCI_VD_ESCAPE_PARMSA,*PMCI_VD_ESCAPE_PARMSA,*LPMCI_VD_ESCAPE_PARMSA; +typedef struct tagMCI_VD_ESCAPE_PARMSW { + DWORD dwCallback; + LPCWSTR lpstrCommand; +} MCI_VD_ESCAPE_PARMSW,*PMCI_VD_ESCAPE_PARMSW,*LPMCI_VD_ESCAPE_PARMSW; +typedef struct tagMCI_WAVE_OPEN_PARMSA { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCSTR lpstrDeviceType; + LPCSTR lpstrElementName; + LPCSTR lpstrAlias; + DWORD dwBufferSeconds; +} MCI_WAVE_OPEN_PARMSA,*PMCI_WAVE_OPEN_PARMSA,*LPMCI_WAVE_OPEN_PARMSA; +typedef struct tagMCI_WAVE_OPEN_PARMSW { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCWSTR lpstrDeviceType; + LPCWSTR lpstrElementName; + LPCWSTR lpstrAlias; + DWORD dwBufferSeconds; +} MCI_WAVE_OPEN_PARMSW,*PMCI_WAVE_OPEN_PARMSW,*LPMCI_WAVE_OPEN_PARMSW; +typedef struct tagMCI_WAVE_DELETE_PARMS { + DWORD dwCallback; + DWORD dwFrom; + DWORD dwTo; +} MCI_WAVE_DELETE_PARMS, *PMCI_WAVE_DELETE_PARMS,*LPMCI_WAVE_DELETE_PARMS; +typedef struct tagMCI_WAVE_SET_PARMS { + DWORD dwCallback; + DWORD dwTimeFormat; + DWORD dwAudio; + UINT wInput; + UINT wOutput; + WORD wFormatTag; + WORD wReserved2; + WORD nChannels; + WORD wReserved3; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wReserved4; + WORD wBitsPerSample; + WORD wReserved5; +} MCI_WAVE_SET_PARMS,*PMCI_WAVE_SET_PARMS,*LPMCI_WAVE_SET_PARMS; + +LRESULT WINAPI CloseDriver(HDRVR,LONG,LONG); +HDRVR WINAPI OpenDriver(LPCWSTR,LPCWSTR,LONG); +LRESULT WINAPI SendDriverMessage(HDRVR,UINT,LONG,LONG); +HMODULE WINAPI DrvGetModuleHandle(HDRVR); +HMODULE WINAPI GetDriverModuleHandle(HDRVR); +LRESULT WINAPI DefDriverProc(DWORD,HDRVR,UINT,LPARAM,LPARAM); +UINT WINAPI mmsystemGetVersion(void); +#define OutputDebugStr OutputDebugString +BOOL WINAPI sndPlaySoundA(LPCSTR,UINT); +BOOL WINAPI sndPlaySoundW(LPCWSTR,UINT); +BOOL WINAPI PlaySoundA(LPCSTR,HMODULE,DWORD); +BOOL WINAPI PlaySoundW(LPCWSTR,HMODULE,DWORD); +UINT WINAPI waveOutGetNumDevs(void); +MMRESULT WINAPI waveOutGetDevCapsA(UINT,LPWAVEOUTCAPSA,UINT); +MMRESULT WINAPI waveOutGetDevCapsW(UINT,LPWAVEOUTCAPSW,UINT); +MMRESULT WINAPI waveOutGetVolume(HWAVEOUT,PDWORD); +MMRESULT WINAPI waveOutSetVolume(HWAVEOUT,DWORD); +MMRESULT WINAPI waveOutGetErrorTextA(MMRESULT,LPSTR,UINT); +MMRESULT WINAPI waveOutGetErrorTextW(MMRESULT,LPWSTR,UINT); +MMRESULT WINAPI waveOutOpen(LPHWAVEOUT,UINT,LPCWAVEFORMATEX,DWORD,DWORD,DWORD); +MMRESULT WINAPI waveOutClose(HWAVEOUT); +MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT,LPWAVEHDR,UINT); +MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT,LPWAVEHDR,UINT); +MMRESULT WINAPI waveOutWrite(HWAVEOUT,LPWAVEHDR,UINT); +MMRESULT WINAPI waveOutPause(HWAVEOUT); +MMRESULT WINAPI waveOutRestart(HWAVEOUT); +MMRESULT WINAPI waveOutReset(HWAVEOUT); +MMRESULT WINAPI waveOutBreakLoop(HWAVEOUT); +MMRESULT WINAPI waveOutGetPosition(HWAVEOUT,LPMMTIME,UINT); +MMRESULT WINAPI waveOutGetPitch(HWAVEOUT,PDWORD); +MMRESULT WINAPI waveOutSetPitch(HWAVEOUT,DWORD); +MMRESULT WINAPI waveOutGetPlaybackRate(HWAVEOUT,PDWORD); +MMRESULT WINAPI waveOutSetPlaybackRate(HWAVEOUT,DWORD); +MMRESULT WINAPI waveOutGetID(HWAVEOUT,LPUINT); +MMRESULT WINAPI waveOutMessage(HWAVEOUT,UINT,DWORD,DWORD); +UINT WINAPI waveInGetNumDevs(void); +MMRESULT WINAPI waveInGetDevCapsA(UINT,LPWAVEINCAPSA,UINT); +MMRESULT WINAPI waveInGetDevCapsW(UINT,LPWAVEINCAPSW,UINT); +MMRESULT WINAPI waveInGetErrorTextA(MMRESULT,LPSTR,UINT); +MMRESULT WINAPI waveInGetErrorTextW(MMRESULT,LPWSTR,UINT); +MMRESULT WINAPI waveInOpen(LPHWAVEIN,UINT,LPCWAVEFORMATEX,DWORD*,DWORD*,DWORD); +//MMRESULT WINAPI waveInOpen(LPHWAVEIN,UINT,LPCWAVEFORMATEX,DWORD,DWORD,DWORD); +MMRESULT WINAPI waveInClose(HWAVEIN); +MMRESULT WINAPI waveInPrepareHeader(HWAVEIN,LPWAVEHDR,UINT); +MMRESULT WINAPI waveInUnprepareHeader(HWAVEIN,LPWAVEHDR,UINT); +MMRESULT WINAPI waveInAddBuffer(HWAVEIN,LPWAVEHDR,UINT); +MMRESULT WINAPI waveInStart(HWAVEIN); +MMRESULT WINAPI waveInStop(HWAVEIN); +MMRESULT WINAPI waveInReset(HWAVEIN); +MMRESULT WINAPI waveInGetPosition(HWAVEIN,LPMMTIME,UINT); +MMRESULT WINAPI waveInGetID(HWAVEIN,LPUINT); +MMRESULT WINAPI waveInMessage(HWAVEIN,UINT,DWORD,DWORD); +UINT WINAPI midiOutGetNumDevs(void); +MMRESULT WINAPI midiStreamOpen(LPHMIDISTRM,LPUINT,DWORD,DWORD,DWORD,DWORD); +MMRESULT WINAPI midiStreamClose(HMIDISTRM); +MMRESULT WINAPI midiStreamProperty(HMIDISTRM,LPBYTE,DWORD); +MMRESULT WINAPI midiStreamPosition(HMIDISTRM,LPMMTIME,UINT); +MMRESULT WINAPI midiStreamOut(HMIDISTRM,LPMIDIHDR,UINT); +MMRESULT WINAPI midiStreamPause(HMIDISTRM); +MMRESULT WINAPI midiStreamRestart(HMIDISTRM); +MMRESULT WINAPI midiStreamStop(HMIDISTRM); +MMRESULT WINAPI midiConnect(HMIDI,HMIDIOUT,PVOID); +MMRESULT WINAPI midiDisconnect(HMIDI,HMIDIOUT,PVOID); +MMRESULT WINAPI midiOutGetDevCapsA(UINT,LPMIDIOUTCAPSA,UINT); +MMRESULT WINAPI midiOutGetDevCapsW(UINT,LPMIDIOUTCAPSW,UINT); +MMRESULT WINAPI midiOutGetVolume(HMIDIOUT,PDWORD); +MMRESULT WINAPI midiOutSetVolume(HMIDIOUT,DWORD); +MMRESULT WINAPI midiOutGetErrorTextA(MMRESULT,LPSTR,UINT); +MMRESULT WINAPI midiOutGetErrorTextW(MMRESULT,LPWSTR,UINT); +MMRESULT WINAPI midiOutOpen(LPHMIDIOUT,UINT,DWORD,DWORD,DWORD); +MMRESULT WINAPI midiOutClose(HMIDIOUT); +MMRESULT WINAPI midiOutPrepareHeader(HMIDIOUT,LPMIDIHDR,UINT); +MMRESULT WINAPI midiOutUnprepareHeader(HMIDIOUT,LPMIDIHDR,UINT); +MMRESULT WINAPI midiOutShortMsg(HMIDIOUT,DWORD); +MMRESULT WINAPI midiOutLongMsg(HMIDIOUT,LPMIDIHDR,UINT); +MMRESULT WINAPI midiOutReset(HMIDIOUT); +MMRESULT WINAPI midiOutCachePatches(HMIDIOUT,UINT,LPWORD,UINT); +MMRESULT WINAPI midiOutCacheDrumPatches(HMIDIOUT,UINT,LPWORD,UINT); +MMRESULT WINAPI midiOutGetID(HMIDIOUT,LPUINT); +MMRESULT WINAPI midiOutMessage(HMIDIOUT,UINT,DWORD,DWORD); +UINT WINAPI midiInGetNumDevs(void); +MMRESULT WINAPI midiInGetDevCapsA(UINT,LPMIDIINCAPSA,UINT); +MMRESULT WINAPI midiInGetDevCapsW(UINT,LPMIDIINCAPSW,UINT); +MMRESULT WINAPI midiInGetErrorTextA(MMRESULT,LPSTR,UINT); +MMRESULT WINAPI midiInGetErrorTextW(MMRESULT,LPWSTR,UINT); +MMRESULT WINAPI midiInOpen(LPHMIDIIN,UINT,DWORD,DWORD,DWORD); +MMRESULT WINAPI midiInClose(HMIDIIN); +MMRESULT WINAPI midiInPrepareHeader(HMIDIIN,LPMIDIHDR,UINT); +MMRESULT WINAPI midiInUnprepareHeader(HMIDIIN,LPMIDIHDR,UINT); +MMRESULT WINAPI midiInAddBuffer(HMIDIIN,LPMIDIHDR,UINT); +MMRESULT WINAPI midiInStart(HMIDIIN); +MMRESULT WINAPI midiInStop(HMIDIIN); +MMRESULT WINAPI midiInReset(HMIDIIN); +MMRESULT WINAPI midiInGetID(HMIDIIN,LPUINT); +MMRESULT WINAPI midiInMessage(HMIDIIN,UINT,DWORD,DWORD); +UINT WINAPI auxGetNumDevs(void); +MMRESULT WINAPI auxGetDevCapsA(UINT,LPAUXCAPSA,UINT); +MMRESULT WINAPI auxGetDevCapsW(UINT,LPAUXCAPSW,UINT); +MMRESULT WINAPI auxSetVolume(UINT,DWORD); +MMRESULT WINAPI auxGetVolume(UINT,PDWORD); +MMRESULT WINAPI auxOutMessage(UINT,UINT,DWORD,DWORD); +UINT WINAPI mixerGetNumDevs(void); +MMRESULT WINAPI mixerGetDevCapsA(UINT,LPMIXERCAPSA,UINT); +MMRESULT WINAPI mixerGetDevCapsW(UINT,LPMIXERCAPSW,UINT); +MMRESULT WINAPI mixerOpen(LPHMIXER,UINT,DWORD,DWORD,DWORD); +MMRESULT WINAPI mixerClose(HMIXER); +DWORD WINAPI mixerMessage(HMIXER,UINT,DWORD,DWORD); +MMRESULT WINAPI mixerGetLineInfoA(HMIXEROBJ,LPMIXERLINEA,DWORD); +MMRESULT WINAPI mixerGetLineInfoW(HMIXEROBJ,LPMIXERLINEW,DWORD); +MMRESULT WINAPI mixerGetID(HMIXEROBJ,PUINT,DWORD); +MMRESULT WINAPI mixerGetLineControlsA(HMIXEROBJ,LPMIXERLINECONTROLSA,DWORD); +MMRESULT WINAPI mixerGetLineControlsW(HMIXEROBJ,LPMIXERLINECONTROLSW,DWORD); +MMRESULT WINAPI mixerGetControlDetailsA(HMIXEROBJ,LPMIXERCONTROLDETAILS,DWORD); +MMRESULT WINAPI mixerGetControlDetailsW(HMIXEROBJ,LPMIXERCONTROLDETAILS,DWORD); +MMRESULT WINAPI mixerSetControlDetails(HMIXEROBJ,LPMIXERCONTROLDETAILS,DWORD); +MMRESULT WINAPI timeGetSystemTime(LPMMTIME,UINT); +DWORD WINAPI timeGetTime(void); +MMRESULT WINAPI timeSetEvent(UINT,UINT,LPTIMECALLBACK,DWORD,UINT); +MMRESULT WINAPI timeKillEvent(UINT); +MMRESULT WINAPI timeGetDevCaps(LPTIMECAPS,UINT); +MMRESULT WINAPI timeBeginPeriod(UINT); +MMRESULT WINAPI timeEndPeriod(UINT); +UINT WINAPI joyGetNumDevs(void); +MMRESULT WINAPI joyGetDevCapsA(UINT,LPJOYCAPSA,UINT); +MMRESULT WINAPI joyGetDevCapsW(UINT,LPJOYCAPSW,UINT); +MMRESULT WINAPI joyGetPos(UINT,LPJOYINFO); +MMRESULT WINAPI joyGetPosEx(UINT,LPJOYINFOEX); +MMRESULT WINAPI joyGetThreshold(UINT,LPUINT); +MMRESULT WINAPI joyReleaseCapture(UINT); +MMRESULT WINAPI joySetCapture(HWND,UINT,UINT,BOOL); +MMRESULT WINAPI joySetThreshold(UINT,UINT); +FOURCC WINAPI mmioStringToFOURCCA(LPCSTR,UINT); +FOURCC WINAPI mmioStringToFOURCCW(LPCWSTR,UINT); +LPMMIOPROC WINAPI mmioInstallIOProcA(FOURCC,LPMMIOPROC,DWORD); +LPMMIOPROC WINAPI mmioInstallIOProcW(FOURCC,LPMMIOPROC,DWORD); +HMMIO WINAPI mmioOpenA(LPSTR,LPMMIOINFO,DWORD); +HMMIO WINAPI mmioOpenW(LPWSTR,LPMMIOINFO,DWORD); +MMRESULT WINAPI mmioRenameA(LPCSTR,LPCSTR,LPCMMIOINFO,DWORD); +MMRESULT WINAPI mmioRenameW(LPCWSTR,LPCWSTR,LPCMMIOINFO,DWORD); +MMRESULT WINAPI mmioClose(HMMIO,UINT); +LONG WINAPI mmioRead(HMMIO,HPSTR,LONG); +LONG WINAPI mmioWrite(HMMIO,LPCSTR,LONG); +LONG WINAPI mmioSeek(HMMIO,LONG,int); +MMRESULT WINAPI mmioGetInfo(HMMIO,LPMMIOINFO,UINT); +MMRESULT WINAPI mmioSetInfo(HMMIO,LPCMMIOINFO,UINT); +MMRESULT WINAPI mmioSetBuffer(HMMIO,LPSTR,LONG,UINT); +MMRESULT WINAPI mmioFlush(HMMIO,UINT); +MMRESULT WINAPI mmioAdvance(HMMIO,LPMMIOINFO,UINT); +LRESULT WINAPI mmioSendMessage(HMMIO,UINT,LPARAM,LPARAM); +MMRESULT WINAPI mmioDescend(HMMIO,LPMMCKINFO,const MMCKINFO*,UINT); +MMRESULT WINAPI mmioAscend(HMMIO,LPMMCKINFO,UINT); +MMRESULT WINAPI mmioCreateChunk(HMMIO,LPMMCKINFO,UINT); +MCIERROR WINAPI mciSendCommandA(MCIDEVICEID,UINT,DWORD,DWORD); +MCIERROR WINAPI mciSendCommandW(MCIDEVICEID,UINT,DWORD,DWORD); +MCIERROR WINAPI mciSendStringA(LPCSTR,LPSTR,UINT,HWND); +MCIERROR WINAPI mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND); +MCIDEVICEID WINAPI mciGetDeviceIDA(LPCSTR); +MCIDEVICEID WINAPI mciGetDeviceIDW(LPCWSTR); +MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDA(DWORD,LPCSTR); +MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDW(DWORD,LPCWSTR); +BOOL WINAPI mciGetErrorStringA(MCIERROR,LPSTR,UINT); +BOOL WINAPI mciGetErrorStringW(MCIERROR,LPWSTR,UINT); +BOOL WINAPI mciSetYieldProc(MCIDEVICEID,YIELDPROC,DWORD); +HTASK WINAPI mciGetCreatorTask(MCIDEVICEID); +YIELDPROC WINAPI mciGetYieldProc(MCIDEVICEID,PDWORD); + +typedef struct tagMCI_SEQ_SET_PARMS { + DWORD dwCallback; + DWORD dwTimeFormat; + DWORD dwAudio; + DWORD dwTempo; + DWORD dwPort; + DWORD dwSlave; + DWORD dwMaster; + DWORD dwOffset; +} MCI_SEQ_SET_PARMS,*PMCI_SEQ_SET_PARMS,*LPMCI_SEQ_SET_PARMS; +typedef struct tagMCI_ANIM_OPEN_PARMSA { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCSTR lpstrDeviceType; + LPCSTR lpstrElementName; + LPCSTR lpstrAlias; + DWORD dwStyle; + HWND hWndParent; +} MCI_ANIM_OPEN_PARMSA,*PMCI_ANIM_OPEN_PARMSA,*LPMCI_ANIM_OPEN_PARMSA; +typedef struct tagMCI_ANIM_OPEN_PARMSW { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCWSTR lpstrDeviceType; + LPCWSTR lpstrElementName; + LPCWSTR lpstrAlias; + DWORD dwStyle; + HWND hWndParent; +} MCI_ANIM_OPEN_PARMSW,*PMCI_ANIM_OPEN_PARMSW,*LPMCI_ANIM_OPEN_PARMSW; +typedef struct tagMCI_ANIM_PLAY_PARMS { + DWORD dwCallback; + DWORD dwFrom; + DWORD dwTo; + DWORD dwSpeed; +} MCI_ANIM_PLAY_PARMS,*PMCI_ANIM_PLAY_PARMS,*LPMCI_ANIM_PLAY_PARMS; +typedef struct tagMCI_ANIM_STEP_PARMS { + DWORD dwCallback; + DWORD dwFrames; +} MCI_ANIM_STEP_PARMS,*PMCI_ANIM_STEP_PARMS,*LPMCI_ANIM_STEP_PARMS; +typedef struct tagMCI_ANIM_WINDOW_PARMSA { + DWORD dwCallback; + HWND hWnd; + UINT nCmdShow; + LPCSTR lpstrText; +} MCI_ANIM_WINDOW_PARMSA,*PMCI_ANIM_WINDOW_PARMSA,*LPMCI_ANIM_WINDOW_PARMSA; +typedef struct tagMCI_ANIM_WINDOW_PARMSW { + DWORD dwCallback; + HWND hWnd; + UINT nCmdShow; + LPCWSTR lpstrText; +} MCI_ANIM_WINDOW_PARMSW,*PMCI_ANIM_WINDOW_PARMSW,*LPMCI_ANIM_WINDOW_PARMSW; +typedef struct tagMCI_ANIM_RECT_PARMS { + DWORD dwCallback; +#ifdef MCI_USE_OFFEXT + POINT ptOffset; + POINT ptExtent; +#else + RECT rc; +#endif +} MCI_ANIM_RECT_PARMS,*PMCI_ANIM_RECT_PARMS,*LPMCI_ANIM_RECT_PARMS; +typedef struct tagMCI_ANIM_UPDATE_PARMS { + DWORD dwCallback; + RECT rc; + HDC hDC; +} MCI_ANIM_UPDATE_PARMS,*PMCI_ANIM_UPDATE_PARMS,*LPMCI_ANIM_UPDATE_PARMS; +typedef struct tagMCI_OVLY_OPEN_PARMSA { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCSTR lpstrDeviceType; + LPCSTR lpstrElementName; + LPCSTR lpstrAlias; + DWORD dwStyle; + HWND hWndParent; +} MCI_OVLY_OPEN_PARMSA,*PMCI_OVLY_OPEN_PARMSA,*LPMCI_OVLY_OPEN_PARMSA; +typedef struct tagMCI_OVLY_OPEN_PARMSW { + DWORD dwCallback; + MCIDEVICEID wDeviceID; + LPCWSTR lpstrDeviceType; + LPCWSTR lpstrElementName; + LPCWSTR lpstrAlias; + DWORD dwStyle; + HWND hWndParent; +} MCI_OVLY_OPEN_PARMSW,*PMCI_OVLY_OPEN_PARMSW,*LPMCI_OVLY_OPEN_PARMSW; +typedef struct tagMCI_OVLY_WINDOW_PARMSA { + DWORD dwCallback; + HWND hWnd; + UINT nCmdShow; + LPCSTR lpstrText; +} MCI_OVLY_WINDOW_PARMSA,*PMCI_OVLY_WINDOW_PARMSA,*LPMCI_OVLY_WINDOW_PARMSA; +typedef struct tagMCI_OVLY_WINDOW_PARMSW { + DWORD dwCallback; + HWND hWnd; + UINT nCmdShow; + LPCWSTR lpstrText; +} MCI_OVLY_WINDOW_PARMSW,*PMCI_OVLY_WINDOW_PARMSW,*LPMCI_OVLY_WINDOW_PARMSW; +typedef struct tagMCI_OVLY_RECT_PARMS { + DWORD dwCallback; +#ifdef MCI_USE_OFFEXT + POINT ptOffset; + POINT ptExtent; +#else + RECT rc; +#endif +} MCI_OVLY_RECT_PARMS,*PMCI_OVLY_RECT_PARMS,*LPMCI_OVLY_RECT_PARMS; +typedef struct tagMCI_OVLY_SAVE_PARMSA { + DWORD dwCallback; + LPCSTR lpfilename; + RECT rc; +} MCI_OVLY_SAVE_PARMSA,*PMCI_OVLY_SAVE_PARMSA,*LPMCI_OVLY_SAVE_PARMSA; +typedef struct tagMCI_OVLY_SAVE_PARMSW { + DWORD dwCallback; + LPCWSTR lpfilename; + RECT rc; +} MCI_OVLY_SAVE_PARMSW,*PMCI_OVLY_SAVE_PARMSW,*LPMCI_OVLY_SAVE_PARMSW; +typedef struct tagMCI_OVLY_LOAD_PARMSA { + DWORD dwCallback; + LPCSTR lpfilename; + RECT rc; +} MCI_OVLY_LOAD_PARMSA,*PMCI_OVLY_LOAD_PARMSA,*LPMCI_OVLY_LOAD_PARMSA; +typedef struct tagMCI_OVLY_LOAD_PARMSW { + DWORD dwCallback; + LPCWSTR lpfilename; + RECT rc; +} MCI_OVLY_LOAD_PARMSW,*PMCI_OVLY_LOAD_PARMSW,*LPMCI_OVLY_LOAD_PARMSW; + +#ifdef UNICODE +typedef WAVEOUTCAPSW WAVEOUTCAPS,*PWAVEOUTCAPS,*LPWAVEOUTCAPS; +typedef WAVEINCAPSW WAVEINCAPS,*PWAVEINCAPS,*LPWAVEINCAPS; +typedef MIDIOUTCAPSW MIDIOUTCAPS,*PMIDIOUTCAPS,*LPMIDIOUTCAPS; +typedef MIDIINCAPSW MIDIINCAPS,*PMIDIINCAPS,*LPMIDIINCAPS; +typedef AUXCAPSW AUXCAPS,*PAUXCAPS,*LPAUXCAPS; +typedef MIXERCAPSW MIXERCAPS,*PMIXERCAPS,*LPMIXERCAPS; +typedef MIXERLINEW MIXERLINE,*PMIXERLINE,*LPMIXERLINE; +typedef MIXERCONTROLW MIXERCONTROL,*PMIXERCONTROL,*LPMIXERCONTROL; +typedef MIXERLINECONTROLSW MIXERLINECONTROLS,*PMIXERLINECONTROLS,*LPMIXERLINECONTROLS; +typedef MIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXT,*PMIXERCONTROLDETAILS_LISTTEXT,*LPMIXERCONTROLDETAILS_LISTTEXT; +typedef JOYCAPSW JOYCAPS,*PJOYCAPS,*LPJOYCAPS; +typedef MCI_OPEN_PARMSW MCI_OPEN_PARMS,*PMCI_OPEN_PARMS,*LPMCI_OPEN_PARMS; +typedef MCI_INFO_PARMSW MCI_INFO_PARMS,*LPMCI_INFO_PARMS; +typedef MCI_SYSINFO_PARMSW MCI_SYSINFO_PARMS,*PMCI_SYSINFO_PARMS,*LPMCI_SYSINFO_PARMS; +typedef MCI_SAVE_PARMSW MCI_SAVE_PARMS,*PMCI_SAVE_PARMS,*LPMCI_SAVE_PARMS; +typedef MCI_LOAD_PARMSW MCI_LOAD_PARMS,*PMCI_LOAD_PARMS,*LPMCI_LOAD_PARMS; +typedef MCI_VD_ESCAPE_PARMSW MCI_VD_ESCAPE_PARMS,*PMCI_VD_ESCAPE_PARMS,*LPMCI_VD_ESCAPE_PARMS; +typedef MCI_WAVE_OPEN_PARMSW MCI_WAVE_OPEN_PARMS,*PMCI_WAVE_OPEN_PARMS,*LPMCI_WAVE_OPEN_PARMS; +typedef MCI_ANIM_OPEN_PARMSW MCI_ANIM_OPEN_PARMS,*PMCI_ANIM_OPEN_PARMS,*LPMCI_ANIM_OPEN_PARMS; +typedef MCI_ANIM_WINDOW_PARMSW MCI_ANIM_WINDOW_PARMS,*PMCI_ANIM_WINDOW_PARMS,*LPMCI_ANIM_WINDOW_PARMS; +typedef MCI_OVLY_OPEN_PARMSW MCI_OVLY_OPEN_PARMS,*PMCI_OVLY_OPEN_PARMS,*LPMCI_OVLY_OPEN_PARMS; +typedef MCI_OVLY_WINDOW_PARMSW MCI_OVLY_WINDOW_PARMS,*PMCI_OVLY_WINDOW_PARMS,*LPMCI_OVLY_WINDOW_PARMS; +typedef MCI_OVLY_SAVE_PARMSW MCI_OVLY_SAVE_PARMS,*PMCI_OVLY_SAVE_PARMS,*LPMCI_OVLY_SAVE_PARMS; +#define sndPlaySound sndPlaySoundW +#define PlaySound PlaySoundW +#define waveOutGetDevCaps waveOutGetDevCapsW +#define waveOutGetErrorText waveOutGetErrorTextW +#define waveInGetDevCaps waveInGetDevCapsW +#define waveInGetErrorText waveInGetErrorTextW +#define midiOutGetDevCaps midiOutGetDevCapsW +#define midiOutGetErrorText midiOutGetErrorTextW +#define midiInGetDevCaps midiInGetDevCapsW +#define midiInGetErrorText midiInGetErrorTextW +#define auxGetDevCaps auxGetDevCapsW +#define mixerGetDevCaps mixerGetDevCapsW +#define mixerGetLineInfo mixerGetLineInfoW +#define mixerGetLineControls mixerGetLineControlsW +#define mixerGetControlDetails mixerGetControlDetailsW +#define joyGetDevCaps joyGetDevCapsW +#define mmioInstallIOProc mmioInstallIOProcW +#define mmioStringToFOURCC mmioStringToFOURCCW +#define mmioOpen mmioOpenW +#define mmioRename mmioRenameW +#define mciSendCommand mciSendCommandW +#define mciSendString mciSendStringW +#define mciGetDeviceID mciGetDeviceIDW +#define mciGetDeviceIDFromElementID mciGetDeviceIDFromElementIDW +#define mciGetErrorString mciGetErrorStringW +#else +typedef WAVEOUTCAPSA WAVEOUTCAPS,*PWAVEOUTCAPS,*LPWAVEOUTCAPS; +typedef WAVEINCAPSA WAVEINCAPS,*PWAVEINCAPS,*LPWAVEINCAPS; +typedef MIDIOUTCAPSA MIDIOUTCAPS,*PMIDIOUTCAPS,*LPMIDIOUTCAPS; +typedef MIDIINCAPSA MIDIINCAPS,*PMIDIINCAPS,*LPMIDIINCAPS; +typedef AUXCAPSA AUXCAPS,*PAUXCAPS,*LPAUXCAPS; +typedef MIXERCAPSA MIXERCAPS,*PMIXERCAPS,*LPMIXERCAPS; +typedef MIXERLINEA MIXERLINE,*PMIXERLINE,*LPMIXERLINE; +typedef MIXERCONTROLA MIXERCONTROL,*PMIXERCONTROL,*LPMIXERCONTROL; +typedef MIXERLINECONTROLSA MIXERLINECONTROLS,*PMIXERLINECONTROLS,*LPMIXERLINECONTROLS; +typedef MIXERCONTROLDETAILS_LISTTEXTA MIXERCONTROLDETAILS_LISTTEXT,*PMIXERCONTROLDETAILS_LISTTEXT,*LPMIXERCONTROLDETAILS_LISTTEXT; +typedef JOYCAPSA JOYCAPS,*PJOYCAPS,*LPJOYCAPS; +typedef MCI_OPEN_PARMSA MCI_OPEN_PARMS,*PMCI_OPEN_PARMS,*LPMCI_OPEN_PARMS; +typedef MCI_INFO_PARMSA MCI_INFO_PARMS,*LPMCI_INFO_PARMS; +typedef MCI_SYSINFO_PARMSA MCI_SYSINFO_PARMS,*PMCI_SYSINFO_PARMS,*LPMCI_SYSINFO_PARMS; +typedef MCI_SAVE_PARMSA MCI_SAVE_PARMS,*PMCI_SAVE_PARMS,*LPMCI_SAVE_PARMS; +typedef MCI_LOAD_PARMSA MCI_LOAD_PARMS,*PMCI_LOAD_PARMS,*LPMCI_LOAD_PARMS; +typedef MCI_VD_ESCAPE_PARMSA MCI_VD_ESCAPE_PARMS,*PMCI_VD_ESCAPE_PARMS,*LPMCI_VD_ESCAPE_PARMS; +typedef MCI_WAVE_OPEN_PARMSA MCI_WAVE_OPEN_PARMS,*PMCI_WAVE_OPEN_PARMS,*LPMCI_WAVE_OPEN_PARMS; +typedef MCI_ANIM_OPEN_PARMSA MCI_ANIM_OPEN_PARMS,*PMCI_ANIM_OPEN_PARMS,*LPMCI_ANIM_OPEN_PARMS; +typedef MCI_ANIM_WINDOW_PARMSA MCI_ANIM_WINDOW_PARMS,*PMCI_ANIM_WINDOW_PARMS,*LPMCI_ANIM_WINDOW_PARMS; +typedef MCI_OVLY_OPEN_PARMSA MCI_OVLY_OPEN_PARMS,*PMCI_OVLY_OPEN_PARMS,*LPMCI_OVLY_OPEN_PARMS; +typedef MCI_OVLY_WINDOW_PARMSA MCI_OVLY_WINDOW_PARMS,*PMCI_OVLY_WINDOW_PARMS,*LPMCI_OVLY_WINDOW_PARMS; +typedef MCI_OVLY_SAVE_PARMSA MCI_OVLY_SAVE_PARMS,*PMCI_OVLY_SAVE_PARMS,*LPMCI_OVLY_SAVE_PARMS; +#define sndPlaySound sndPlaySoundA +#define PlaySound PlaySoundA +#define waveOutGetDevCaps waveOutGetDevCapsA +#define waveOutGetErrorText waveOutGetErrorTextA +#define waveInGetDevCaps waveInGetDevCapsA +#define waveInGetErrorText waveInGetErrorTextA +#define midiOutGetDevCaps midiOutGetDevCapsA +#define midiOutGetErrorText midiOutGetErrorTextA +#define midiInGetDevCaps midiInGetDevCapsA +#define midiInGetErrorText midiInGetErrorTextA +#define auxGetDevCaps auxGetDevCapsA +#define mixerGetDevCaps mixerGetDevCapsA +#define mixerGetLineInfo mixerGetLineInfoA +#define mixerGetLineControls mixerGetLineControlsA +#define mixerGetControlDetails mixerGetControlDetailsA +#define joyGetDevCaps joyGetDevCapsA +#define mmioInstallIOProc mmioInstallIOProcA +#define mmioStringToFOURCC mmioStringToFOURCCA +#define mmioOpen mmioOpenA +#define mmioRename mmioRenameA +#define mciSendCommand mciSendCommandA +#define mciSendString mciSendStringA +#define mciGetDeviceID mciGetDeviceIDA +#define mciGetDeviceIDFromElementID mciGetDeviceIDFromElementIDA +#define mciGetErrorString mciGetErrorStringA +#endif +#ifdef __cplusplus +} +#endif +#pragma pack(pop) +#endif diff --git a/colorchord2/windows/symbol_enumerator.c b/colorchord2/windows/symbol_enumerator.c new file mode 100644 index 0000000..fcb3727 --- /dev/null +++ b/colorchord2/windows/symbol_enumerator.c @@ -0,0 +1,245 @@ +#include +#include "symbol_enumerator.h" + +#if defined( WIN32 ) || defined( WINDOWS ) || defined( USE_WINDOWS ) || defined( _WIN32 ) + +#include + +typedef struct _SYMBOL_INFO { + ULONG SizeOfStruct; + ULONG TypeIndex; + ULONG64 Reserved[2]; + ULONG Index; + ULONG Size; + ULONG64 ModBase; + ULONG Flags; + ULONG64 Value; + ULONG64 Address; + ULONG Register; + ULONG Scope; + ULONG Tag; + ULONG NameLen; + ULONG MaxNameLen; + TCHAR Name[1]; +} SYMBOL_INFO, *PSYMBOL_INFO; +typedef struct _IMAGEHLP_STACK_FRAME { + ULONG64 InstructionOffset; + ULONG64 ReturnOffset; + ULONG64 FrameOffset; + ULONG64 StackOffset; + ULONG64 BackingStoreOffset; + ULONG64 FuncTableEntry; + ULONG64 Params[4]; + ULONG64 Reserved[5]; + BOOL Virtual; + ULONG Reserved2; +} IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME; + + +typedef BOOL (*PSYM_ENUMERATESYMBOLS_CALLBACK)( + PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext + ); + +BOOL WINAPI SymEnumSymbols( + HANDLE hProcess, + ULONG64 BaseOfDll, + PCTSTR Mask, + PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, + const PVOID UserContext +); + +BOOL WINAPI SymInitialize( + HANDLE hProcess, + PCTSTR UserSearchPath, + BOOL fInvadeProcess +); + +BOOL WINAPI SymCleanup( + HANDLE hProcess +); + +BOOL CALLBACK __cdecl mycb( + PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext + ){ + SymEnumeratorCallback cb = (SymEnumeratorCallback)UserContext; + return !cb( "", &pSymInfo->Name[0], (void*)pSymInfo->Address, (long) pSymInfo->Size ); + } + +int EnumerateSymbols( SymEnumeratorCallback cb ) +{ + HANDLE proc = GetCurrentProcess(); + if( !SymInitialize( proc, 0, 1 ) ) return -1; + if( !SymEnumSymbols( proc, 0, "*!*", &mycb, (void*)cb ) ) + { + SymCleanup(proc); + return -2; + } + SymCleanup(proc); + return 0; +} + +#else + + +#include +#include +#include +#include +#include + +#ifndef __GNUC__ +#define __int128_t long long long +#endif + +#include +#include + +#define UINTS_PER_WORD (__WORDSIZE / (CHAR_BIT * sizeof (unsigned int))) + + + struct dl_phdr_info { + ElfW(Addr) dlpi_addr; /* Base address of object */ + const char *dlpi_name; /* (Null-terminated) name of + object */ + const ElfW(Phdr) *dlpi_phdr; /* Pointer to array of + ELF program headers + for this object */ + ElfW(Half) dlpi_phnum; /* # of items in dlpi_phdr */ + }; + + + +void dl_iterate_phdr( void*, void*); + + +static ElfW(Word) gnu_hashtab_symbol_count(const unsigned int *const table) +{ + const unsigned int *const bucket = table + 4 + table[2] * (unsigned int)(UINTS_PER_WORD); + unsigned int b = table[0]; + unsigned int max = 0U; + + while (b-->0U) + if (bucket[b] > max) + max = bucket[b]; + + return (ElfW(Word))max; +} + +static static void *dynamic_pointer(const ElfW(Addr) addr, + const ElfW(Addr) base, const ElfW(Phdr) *const header, const ElfW(Half) headers) +{ + if (addr) { + ElfW(Half) h; + + for (h = 0; h < headers; h++) + if (header[h].p_type == PT_LOAD) + if (addr >= base + header[h].p_vaddr && + addr < base + header[h].p_vaddr + header[h].p_memsz) + return (void *)addr; + } + + return NULL; +} + +//Mostly based off of http://stackoverflow.com/questions/29903049/get-names-and-addresses-of-exported-functions-from-in-linux +static int callback(struct dl_phdr_info *info, + size_t size, void *data) +{ + SymEnumeratorCallback cb = (SymEnumeratorCallback)data; + const ElfW(Addr) base = info->dlpi_addr; + const ElfW(Phdr) *const header = info->dlpi_phdr; + const ElfW(Half) headers = info->dlpi_phnum; + const char *libpath, *libname; + ElfW(Half) h; + + if (info->dlpi_name && info->dlpi_name[0]) + libpath = info->dlpi_name; + else + libpath = ""; + + libname = strrchr(libpath, '/'); + + if (libname && libname[0] == '/' && libname[1]) + libname++; + else + libname = libpath; + + for (h = 0; h < headers; h++) + { + if (header[h].p_type == PT_DYNAMIC) + { + const ElfW(Dyn) *entry = (const ElfW(Dyn) *)(base + header[h].p_vaddr); + const ElfW(Word) *hashtab; + const ElfW(Sym) *symtab = NULL; + const char *strtab = NULL; + ElfW(Word) symbol_count = 0; + + for (; entry->d_tag != DT_NULL; entry++) + { + switch (entry->d_tag) + { + case DT_HASH: + hashtab = dynamic_pointer(entry->d_un.d_ptr, base, header, headers); + if (hashtab) + symbol_count = hashtab[1]; + break; + case DT_GNU_HASH: + hashtab = dynamic_pointer(entry->d_un.d_ptr, base, header, headers); + if (hashtab) + { + ElfW(Word) count = gnu_hashtab_symbol_count(hashtab); + if (count > symbol_count) + symbol_count = count; + } + break; + case DT_STRTAB: + strtab = dynamic_pointer(entry->d_un.d_ptr, base, header, headers); + break; + case DT_SYMTAB: + symtab = dynamic_pointer(entry->d_un.d_ptr, base, header, headers); + break; + } + } + + if (symtab && strtab && symbol_count > 0) { + ElfW(Word) s; + + for (s = 0; s < symbol_count; s++) { + const char *name; + void *const ptr = dynamic_pointer(base + symtab[s].st_value, base, header, headers); + int result; + + if (!ptr) + continue; + + if (symtab[s].st_name) + name = strtab + symtab[s].st_name; + else + name = ""; + + result = cb( libpath, name, ptr, symtab[s].st_size ); + if( result ) return result; //Bail early. + } + } + } + } + return 0; +} + + + + + +int EnumerateSymbols( SymEnumeratorCallback cb ) +{ + dl_iterate_phdr( callback, cb ); +} + + + + +#endif diff --git a/colorchord2/windows/symbol_enumerator.h b/colorchord2/windows/symbol_enumerator.h new file mode 100644 index 0000000..87e033b --- /dev/null +++ b/colorchord2/windows/symbol_enumerator.h @@ -0,0 +1,12 @@ +#ifndef _SYMBOL_ENUMERATOR_H +#define _SYMBOL_ENUMERATOR_H + +//Enumerates all symbols in the currently loaded excutable. +//Don't forget to compile with -rdynamic! + +//Return 0 to continue search. 1 to stop. +typedef int (*SymEnumeratorCallback)( const char * path, const char * name, void * location, long size ); + +int EnumerateSymbols( SymEnumeratorCallback cb ); + +#endif diff --git a/colorchord2/windows/tcc_stubs.c b/colorchord2/windows/tcc_stubs.c new file mode 100644 index 0000000..c6dfc76 --- /dev/null +++ b/colorchord2/windows/tcc_stubs.c @@ -0,0 +1,80 @@ + +#include <_mingw.h> + +#define REMATH(x) double __cdecl x( double f ); float x##f(float v) { return x(v); } + +int SymnumCheck( const char * path, const char * name, void * location, long size ) +{ + if( strncmp( name, "REGISTER", 8 ) == 0 ) + { + typedef void (*sf)(); + sf fn = (sf)location; + fn(); + } + return 0; +} + + + +void ManuallyRegisterDevices() +{ + EnumerateSymbols( SymnumCheck ); +} + +REMATH( acos ); +REMATH( cos ); +REMATH( sin ); +REMATH( sqrt ); +REMATH( asin ); +REMATH( exp ); +REMATH( fmod ); +REMATH( pow ); + +double __cdecl strtod (const char* str, char** endptr); +float strtof( const char* str, char** endptr) +{ + return strtod( str, endptr ); +} + +double __cdecl atan2(double a, double b); +float atan2f(float a, float b) +{ + return atan2( a, b ); +} + +//From http://stackoverflow.com/questions/40159892/using-asprintf-on-windows +int __cdecl vsprintf_s( + char *buffer, + size_t numberOfElements, + const char *format, + va_list argptr +); + +int asprintf(char **strp, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int r = vasprintf(strp, fmt, ap); + va_end(ap); + return r; +} + +int vasprintf(char **strp, const char *fmt, va_list ap) { + // _vscprintf tells you how big the buffer needs to be + int len = _vscprintf(fmt, ap); + if (len == -1) { + return -1; + } + size_t size = (size_t)len + 1; + char *str = (char*)malloc(size); + if (!str) { + return -1; + } + // _vsprintf_s is the "secure" version of vsprintf + int r = vsprintf_s(str, len + 1, fmt, ap); + if (r == -1) { + free(str); + return -1; + } + *strp = str; + return r; +} \ No newline at end of file diff --git a/colorchord2/windows/winsock2.h b/colorchord2/windows/winsock2.h new file mode 100644 index 0000000..d318eb6 --- /dev/null +++ b/colorchord2/windows/winsock2.h @@ -0,0 +1,1303 @@ +/* + + Definitions for winsock 2 + + Contributed by the WINE project. + + Portions Copyright (c) 1980, 1983, 1988, 1993 + The Regents of the University of California. All rights reserved. + + Portions Copyright (c) 1993 by Digital Equipment Corporation. + */ + +#if !(defined _WINSOCK2_H || defined _WINSOCK_H) +#define _WINSOCK2_H +#define _WINSOCK_H /* to prevent later inclusion of winsock.h */ +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + +#define _GNU_H_WINDOWS32_SOCKETS + +#include + +#ifndef WINSOCK_API_LINKAGE +#ifdef __W32API_USE_DLLIMPORT__ +#define WINSOCK_API_LINKAGE DECLSPEC_IMPORT +#else +#define WINSOCK_API_LINKAGE +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/* Names common to Winsock1.1 and Winsock2 */ +#if !defined ( _BSDTYPES_DEFINED ) +/* also defined in gmon.h and in cygwin's sys/types */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#define _BSDTYPES_DEFINED +#endif /* ! def _BSDTYPES_DEFINED */ +typedef u_int SOCKET; +#ifndef FD_SETSIZE +#define FD_SETSIZE 64 +#endif + +/* shutdown() how types */ +#define SD_RECEIVE 0x00 +#define SD_SEND 0x01 +#define SD_BOTH 0x02 + +#ifndef _SYS_TYPES_FD_SET +/* fd_set may be defined by the newlib + * if __USE_W32_SOCKETS not defined. + */ +#ifdef fd_set +#undef fd_set +#endif +typedef struct fd_set { + u_int fd_count; + SOCKET fd_array[FD_SETSIZE]; +} fd_set; +int PASCAL __WSAFDIsSet(SOCKET,fd_set*); +#ifndef FD_CLR +#define FD_CLR(fd,set) do { u_int __i;\ +for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\ + if (((fd_set *)(set))->fd_array[__i] == (fd)) {\ + while (__i < ((fd_set *)(set))->fd_count-1) {\ + ((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\ + __i++;\ + }\ + ((fd_set*)(set))->fd_count--;\ + break;\ + }\ +}\ +} while (0) +#endif +#ifndef FD_SET +/* this differs from the define in winsock.h and in cygwin sys/types.h */ +#define FD_SET(fd, set) do { u_int __i;\ +for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\ + if (((fd_set *)(set))->fd_array[__i] == (fd)) {\ + break;\ + }\ +}\ +if (__i == ((fd_set *)(set))->fd_count) {\ + if (((fd_set *)(set))->fd_count < FD_SETSIZE) {\ + ((fd_set *)(set))->fd_array[__i] = (fd);\ + ((fd_set *)(set))->fd_count++;\ + }\ +}\ +} while(0) +#endif +#ifndef FD_ZERO +#define FD_ZERO(set) (((fd_set *)(set))->fd_count=0) +#endif +#ifndef FD_ISSET +#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set)) +#endif +#elif !defined (USE_SYS_TYPES_FD_SET) +#warning "fd_set and associated macros have been defined in sys/types. \ + This may cause runtime problems with W32 sockets" +#endif /* ndef _SYS_TYPES_FD_SET */ +#if !(defined (__INSIDE_CYGWIN__) || (__INSIDE_MSYS__)) +#ifndef _TIMEVAL_DEFINED /* also in sys/time.h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec != (uvp)->tv_sec) ? \ + ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ + ((tvp)->tv_usec cmp (uvp)->tv_usec)) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ +struct hostent { + char *h_name; + char **h_aliases; + short h_addrtype; + short h_length; + char **h_addr_list; +#define h_addr h_addr_list[0] +}; +struct linger { + u_short l_onoff; + u_short l_linger; +}; +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ +#define IOCPARM_MASK 0x7f +#define IOC_VOID 0x20000000 +#define IOC_OUT 0x40000000 +#define IOC_IN 0x80000000 +#define IOC_INOUT (IOC_IN|IOC_OUT) + +#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +#define _IO(x,y) (IOC_VOID|((x)<<8)|(y)) +#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) +#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) +#define FIONBIO _IOW('f', 126, u_long) +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ + +#define FIONREAD _IOR('f', 127, u_long) +#define FIOASYNC _IOW('f', 125, u_long) +#define SIOCSHIWAT _IOW('s', 0, u_long) +#define SIOCGHIWAT _IOR('s', 1, u_long) +#define SIOCSLOWAT _IOW('s', 2, u_long) +#define SIOCGLOWAT _IOR('s', 3, u_long) +#define SIOCATMARK _IOR('s', 7, u_long) + +#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +struct netent { + char * n_name; + char **n_aliases; + short n_addrtype; + u_long n_net; +}; +struct servent { + char *s_name; + char **s_aliases; + short s_port; + char *s_proto; +}; +struct protoent { + char *p_name; + char **p_aliases; + short p_proto; +}; +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ + +#define IPPROTO_IP 0 +#define IPPROTO_ICMP 1 +#define IPPROTO_IGMP 2 +#define IPPROTO_GGP 3 +#define IPPROTO_TCP 6 +#define IPPROTO_PUP 12 +#define IPPROTO_UDP 17 +#define IPPROTO_IDP 22 +#define IPPROTO_ND 77 +#define IPPROTO_RAW 255 +#define IPPROTO_MAX 256 +/* IPv6 options */ +#define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options */ +#define IPPROTO_IPV6 41 /* IPv6 header */ +#define IPPROTO_ROUTING 43 /* IPv6 Routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ESP 50 /* encapsulating security payload */ +#define IPPROTO_AH 51 /* authentication header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 Destination options */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 +#define IPPORT_RESERVED 1024 +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 +struct in_addr { + union { + struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { u_short s_w1,s_w2; } S_un_w; + u_long S_addr; + } S_un; +#define s_addr S_un.S_addr +#define s_host S_un.S_un_b.s_b2 +#define s_net S_un.S_un_b.s_b1 +#define s_imp S_un.S_un_w.s_w2 +#define s_impno S_un.S_un_b.s_b4 +#define s_lh S_un.S_un_b.s_b3 +}; +#define IN_CLASSA(i) (((long)(i)&0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 +#define IN_CLASSB(i) (((long)(i)&0xc0000000)==0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 +#define IN_CLASSC(i) (((long)(i)&0xe0000000)==0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0xff +#define INADDR_ANY (u_long)0 +#define INADDR_LOOPBACK 0x7f000001 +#define INADDR_BROADCAST (u_long)0xffffffff +#define INADDR_NONE 0xffffffff +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; +#define WSADESCRIPTION_LEN 256 +#define WSASYS_STATUS_LEN 128 +typedef struct WSAData { + WORD wVersion; + WORD wHighVersion; + char szDescription[WSADESCRIPTION_LEN+1]; + char szSystemStatus[WSASYS_STATUS_LEN+1]; + unsigned short iMaxSockets; + unsigned short iMaxUdpDg; + char * lpVendorInfo; +} WSADATA; +typedef WSADATA *LPWSADATA; + +#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +#define IP_OPTIONS 1 +#define SO_DEBUG 1 +#define SO_ACCEPTCONN 2 +#define SO_REUSEADDR 4 +#define SO_KEEPALIVE 8 +#define SO_DONTROUTE 16 +#define SO_BROADCAST 32 +#define SO_USELOOPBACK 64 +#define SO_LINGER 128 +#define SO_OOBINLINE 256 +#define SO_DONTLINGER (u_int)(~SO_LINGER) +#define SO_EXCLUSIVEADDRUSE ((u_int)(~SO_REUSEADDR)) +#define SO_SNDBUF 0x1001 +#define SO_RCVBUF 0x1002 +#define SO_SNDLOWAT 0x1003 +#define SO_RCVLOWAT 0x1004 +#define SO_SNDTIMEO 0x1005 +#define SO_RCVTIMEO 0x1006 +#define SO_ERROR 0x1007 +#define SO_TYPE 0x1008 +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ + +#define INVALID_SOCKET (SOCKET)(~0) +#define SOCKET_ERROR (-1) +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define TCP_NODELAY 0x0001 +#define AF_UNSPEC 0 +#define AF_UNIX 1 +#define AF_INET 2 +#define AF_IMPLINK 3 +#define AF_PUP 4 +#define AF_CHAOS 5 +#define AF_IPX 6 +#define AF_NS 6 +#define AF_ISO 7 +#define AF_OSI AF_ISO +#define AF_ECMA 8 +#define AF_DATAKIT 9 +#define AF_CCITT 10 +#define AF_SNA 11 +#define AF_DECnet 12 +#define AF_DLI 13 +#define AF_LAT 14 +#define AF_HYLINK 15 +#define AF_APPLETALK 16 +#define AF_NETBIOS 17 +#define AF_VOICEVIEW 18 +#define AF_FIREFOX 19 +#define AF_UNKNOWN1 20 +#define AF_BAN 21 +#define AF_ATM 22 +#define AF_INET6 23 +#define AF_CLUSTER 24 +#define AF_12844 25 +#define AF_IRDA 26 +#define AF_NETDES 28 +#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +#define AF_MAX 29 +struct sockaddr { + u_short sa_family; + char sa_data[14]; +}; + +/* Portable IPv6/IPv4 version of sockaddr. Based on RFC 2553. + Pad to force 8 byte alignment and maximum size of 128 bytes. */ + +/* + * Desired design of maximum size and alignment + */ +#define _SS_MAXSIZE 128 +#define _SS_ALIGNSIZE (sizeof (__int64)) +/* + * Definitions used for sockaddr_storage structure paddings design. + */ +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) \ + + _SS_PAD1SIZE \ + + _SS_ALIGNSIZE)) +struct sockaddr_storage { + short ss_family; + char __ss_pad1[_SS_PAD1SIZE]; /* pad to 8 */ + __int64 __ss_align; /* force alignment */ + char __ss_pad2[_SS_PAD2SIZE]; /* pad to 128 */ +}; +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ + +struct sockproto { + u_short sp_family; + u_short sp_protocol; +}; +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_IPX AF_IPX +#define PF_ISO AF_ISO +#define PF_OSI AF_OSI +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_VOICEVIEW AF_VOICEVIEW +#define PF_FIREFOX AF_FIREFOX +#define PF_UNKNOWN1 AF_UNKNOWN1 +#define PF_BAN AF_BAN +#define PF_ATM AF_ATM +#define PF_INET6 AF_INET6 +#define PF_MAX AF_MAX +#define SOL_SOCKET 0xffff +#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +#define SOMAXCONN 0x7fffffff /* (5) in WinSock1.1 */ +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ +#define MSG_MAXIOVLEN 16 +#define MSG_PARTIAL 0x8000 +#define MAXGETHOSTSTRUCT 1024 + +#define FD_READ_BIT 0 +#define FD_READ (1 << FD_READ_BIT) +#define FD_WRITE_BIT 1 +#define FD_WRITE (1 << FD_WRITE_BIT) +#define FD_OOB_BIT 2 +#define FD_OOB (1 << FD_OOB_BIT) +#define FD_ACCEPT_BIT 3 +#define FD_ACCEPT (1 << FD_ACCEPT_BIT) +#define FD_CONNECT_BIT 4 +#define FD_CONNECT (1 << FD_CONNECT_BIT) +#define FD_CLOSE_BIT 5 +#define FD_CLOSE (1 << FD_CLOSE_BIT) +/* winsock1.1 defines stop at FD_CLOSE (32) */ +#define FD_QOS_BIT 6 +#define FD_QOS (1 << FD_QOS_BIT) +#define FD_GROUP_QOS_BIT 7 +#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT) +#define FD_ROUTING_INTERFACE_CHANGE_BIT 8 +#define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT) +#define FD_ADDRESS_LIST_CHANGE_BIT 9 +#define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT) +#define FD_MAX_EVENTS 10 +#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1) + +#ifndef WSABASEERR +#define WSABASEERR 10000 +#define WSAEINTR (WSABASEERR+4) +#define WSAEBADF (WSABASEERR+9) +#define WSAEACCES (WSABASEERR+13) +#define WSAEFAULT (WSABASEERR+14) +#define WSAEINVAL (WSABASEERR+22) +#define WSAEMFILE (WSABASEERR+24) +#define WSAEWOULDBLOCK (WSABASEERR+35) +#define WSAEINPROGRESS (WSABASEERR+36) /* deprecated on WinSock2 */ +#define WSAEALREADY (WSABASEERR+37) +#define WSAENOTSOCK (WSABASEERR+38) +#define WSAEDESTADDRREQ (WSABASEERR+39) +#define WSAEMSGSIZE (WSABASEERR+40) +#define WSAEPROTOTYPE (WSABASEERR+41) +#define WSAENOPROTOOPT (WSABASEERR+42) +#define WSAEPROTONOSUPPORT (WSABASEERR+43) +#define WSAESOCKTNOSUPPORT (WSABASEERR+44) +#define WSAEOPNOTSUPP (WSABASEERR+45) +#define WSAEPFNOSUPPORT (WSABASEERR+46) +#define WSAEAFNOSUPPORT (WSABASEERR+47) +#define WSAEADDRINUSE (WSABASEERR+48) +#define WSAEADDRNOTAVAIL (WSABASEERR+49) +#define WSAENETDOWN (WSABASEERR+50) +#define WSAENETUNREACH (WSABASEERR+51) +#define WSAENETRESET (WSABASEERR+52) +#define WSAECONNABORTED (WSABASEERR+53) +#define WSAECONNRESET (WSABASEERR+54) +#define WSAENOBUFS (WSABASEERR+55) +#define WSAEISCONN (WSABASEERR+56) +#define WSAENOTCONN (WSABASEERR+57) +#define WSAESHUTDOWN (WSABASEERR+58) +#define WSAETOOMANYREFS (WSABASEERR+59) +#define WSAETIMEDOUT (WSABASEERR+60) +#define WSAECONNREFUSED (WSABASEERR+61) +#define WSAELOOP (WSABASEERR+62) +#define WSAENAMETOOLONG (WSABASEERR+63) +#define WSAEHOSTDOWN (WSABASEERR+64) +#define WSAEHOSTUNREACH (WSABASEERR+65) +#define WSAENOTEMPTY (WSABASEERR+66) +#define WSAEPROCLIM (WSABASEERR+67) +#define WSAEUSERS (WSABASEERR+68) +#define WSAEDQUOT (WSABASEERR+69) +#define WSAESTALE (WSABASEERR+70) +#define WSAEREMOTE (WSABASEERR+71) +#define WSAEDISCON (WSABASEERR+101) +#define WSASYSNOTREADY (WSABASEERR+91) +#define WSAVERNOTSUPPORTED (WSABASEERR+92) +#define WSANOTINITIALISED (WSABASEERR+93) +#define WSAHOST_NOT_FOUND (WSABASEERR+1001) +#define WSATRY_AGAIN (WSABASEERR+1002) +#define WSANO_RECOVERY (WSABASEERR+1003) +#define WSANO_DATA (WSABASEERR+1004) + +/* WinSock2 specific error codes */ +#define WSAENOMORE (WSABASEERR+102) +#define WSAECANCELLED (WSABASEERR+103) +#define WSAEINVALIDPROCTABLE (WSABASEERR+104) +#define WSAEINVALIDPROVIDER (WSABASEERR+105) +#define WSAEPROVIDERFAILEDINIT (WSABASEERR+106) +#define WSASYSCALLFAILURE (WSABASEERR+107) +#define WSASERVICE_NOT_FOUND (WSABASEERR+108) +#define WSATYPE_NOT_FOUND (WSABASEERR+109) +#define WSA_E_NO_MORE (WSABASEERR+110) +#define WSA_E_CANCELLED (WSABASEERR+111) +#define WSAEREFUSED (WSABASEERR+112) + +/* WS QualityofService errors */ +#define WSA_QOS_RECEIVERS (WSABASEERR + 1005) +#define WSA_QOS_SENDERS (WSABASEERR + 1006) +#define WSA_QOS_NO_SENDERS (WSABASEERR + 1007) +#define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008) +#define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009) +#define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010) +#define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011) +#define WSA_QOS_BAD_STYLE (WSABASEERR + 1012) +#define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013) +#define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014) +#define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015) +#define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016) +#define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017) +#define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018) +#define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019) +#define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020) +#define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021) +#define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022) +#define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023) +#define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024) +#define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025) +#define WSA_QOS_EFLOWDESC (WSABASEERR + 1026) +#define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027) +#define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028) +#define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029) +#define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030) +#define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031) + +#endif /* !WSABASEERR */ + +#define WSANO_ADDRESS WSANO_DATA +#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +#define h_errno WSAGetLastError() +#define HOST_NOT_FOUND WSAHOST_NOT_FOUND +#define TRY_AGAIN WSATRY_AGAIN +#define NO_RECOVERY WSANO_RECOVERY +#define NO_DATA WSANO_DATA +#define NO_ADDRESS WSANO_ADDRESS +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ +WINSOCK_API_LINKAGE SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*); +WINSOCK_API_LINKAGE int PASCAL bind(SOCKET,const struct sockaddr*,int); +WINSOCK_API_LINKAGE int PASCAL closesocket(SOCKET); +WINSOCK_API_LINKAGE int PASCAL connect(SOCKET,const struct sockaddr*,int); +WINSOCK_API_LINKAGE int PASCAL ioctlsocket(SOCKET,long,u_long *); +WINSOCK_API_LINKAGE int PASCAL getpeername(SOCKET,struct sockaddr*,int*); +WINSOCK_API_LINKAGE int PASCAL getsockname(SOCKET,struct sockaddr*,int*); +WINSOCK_API_LINKAGE int PASCAL getsockopt(SOCKET,int,int,char*,int*); +WINSOCK_API_LINKAGE unsigned long PASCAL inet_addr(const char*); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr); +WINSOCK_API_LINKAGE int PASCAL listen(SOCKET,int); +WINSOCK_API_LINKAGE int PASCAL recv(SOCKET,char*,int,int); +WINSOCK_API_LINKAGE int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*); +WINSOCK_API_LINKAGE int PASCAL send(SOCKET,const char*,int,int); +WINSOCK_API_LINKAGE int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int); +WINSOCK_API_LINKAGE int PASCAL setsockopt(SOCKET,int,int,const char*,int); +WINSOCK_API_LINKAGE int PASCAL shutdown(SOCKET,int); +WINSOCK_API_LINKAGE SOCKET PASCAL socket(int,int,int); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int); +WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*); +typedef SOCKET (PASCAL * LPFN_ACCEPT)(SOCKET, struct sockaddr*,int *); +typedef int (PASCAL * LPFN_BIND)(SOCKET, const struct sockaddr*,int); +typedef int (PASCAL * LPFN_CLOSESOCKET)(SOCKET); +typedef int (PASCAL * LPFN_CONNECT)(SOCKET, const struct sockaddr*,int); +typedef int (PASCAL * LPFN_IOCTLSOCKET)(SOCKET, long, u_long*); +typedef int (PASCAL * LPFN_GETPEERNAME)(SOCKET, struct sockaddr*, int*); +typedef int(PASCAL * LPFN_GETSOCKNAME)(SOCKET, struct sockaddr*, int*); +typedef int(PASCAL * LPFN_GETSOCKOPT)(SOCKET, int, int, char*, int*); +typedef u_long(PASCAL * LPFN_HTONL)(u_long); +typedef u_short(PASCAL * LPFN_HTONS)(u_short); +typedef unsigned long(PASCAL * LPFN_INET_ADDR)(const char*); +typedef char*(PASCAL * LPFN_INET_NTOA)(struct in_addr); +typedef int(PASCAL * LPFN_LISTEN)(SOCKET, int); +typedef u_long(PASCAL * LPFN_NTOHL)(u_long); +typedef u_short(PASCAL * LPFN_NTOHS)(u_short); +typedef int(PASCAL * LPFN_RECV)(SOCKET, char*, int, int); +typedef int(PASCAL * LPFN_RECVFROM)(SOCKET, char*, int, int, struct sockaddr*, int*); +typedef int(PASCAL * LPFN_SELECT)(int, fd_set*, fd_set*, fd_set*, const struct timeval*); +typedef int(PASCAL * LPFN_SEND)(SOCKET, const char*, int, int); +typedef int(PASCAL * LPFN_SENDTO)(SOCKET, const char*, int, int, const struct sockaddr*, int); +typedef int(PASCAL * LPFN_SETSOCKOPT)(SOCKET, int, int, const char*, int); +typedef int(PASCAL * LPFN_SHUTDOWN)(SOCKET, int); +typedef SOCKET(PASCAL * LPFN_SOCKET)(int, int, int); +typedef struct hostent*(PASCAL * LPFN_GETHOSTBYADDR)( const char*, int, int); +typedef struct hostent*(PASCAL * LPFN_GETHOSTBYNAME)( const char*); +typedef int(PASCAL * LPFN_GETHOSTNAME)(char*, int); +typedef struct servent*(PASCAL * LPFN_GETSERVBYPORT)(int, const char*); +typedef struct servent*(PASCAL * LPFN_GETSERVBYNAME)(const char*, const char*); +typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNUMBER)(int); +typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNAME)(const char*); + +WINSOCK_API_LINKAGE int PASCAL WSAStartup(WORD,LPWSADATA); +WINSOCK_API_LINKAGE int PASCAL WSACleanup(void); +WINSOCK_API_LINKAGE void PASCAL WSASetLastError(int); +WINSOCK_API_LINKAGE int PASCAL WSAGetLastError(void); +WINSOCK_API_LINKAGE typedef int(PASCAL * LPFN_WSASTARTUP)(WORD, LPWSADATA); +typedef int(PASCAL * LPFN_WSACLEANUP)(void); +typedef void(PASCAL * LPFN_WSASETLASTERROR)(int); +typedef int(PASCAL * LPFN_WSAGETLASTERROR)(void); +/* + * Pseudo-blocking functions are deprecated in WinSock2 + * spec. Use threads instead. + */ +WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking(void); +WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook(void); +WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook(FARPROC); +WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall(void); +typedef BOOL(PASCAL * LPFN_WSAISBLOCKING)(void); +typedef int(PASCAL * LPFN_WSAUNHOOKBLOCKINGHOOK)(void); +typedef FARPROC (PASCAL * LPFN_WSASETBLOCKINGHOOK)(FARPROC); +typedef int(PASCAL * LPFN_WSACANCELBLOCKINGCALL)(void); + +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int); +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int); +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int); +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int); +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int); +WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int); +WINSOCK_API_LINKAGE int PASCAL WSACancelAsyncRequest(HANDLE); +WINSOCK_API_LINKAGE int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long); +typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYNAME)(HWND, u_int, const char *, const char *, char *, int); +typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYPORT)(HWND, u_int, int, const char *, char *, int); +typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNAME)(HWND, u_int, const char*, char*, int); +typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND, u_int, int, char*, int); +typedef HANDLE(PASCAL * LPFN_WSAASYNCGETHOSTBYADDR)(HWND, u_int, const char*, int, int, char*, int); +typedef int(PASCAL * LPFN_WSACANCELASYNCREQUEST)(HANDLE); +typedef int(PASCAL * LPFN_WSAASYNCSELECT)(SOCKET, HWND, u_int, long); +#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) +WINSOCK_API_LINKAGE u_long PASCAL htonl(u_long); +WINSOCK_API_LINKAGE u_long PASCAL ntohl(u_long); +WINSOCK_API_LINKAGE u_short PASCAL htons(u_short); +WINSOCK_API_LINKAGE u_short PASCAL ntohs(u_short); +WINSOCK_API_LINKAGE int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*); +#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ + +int PASCAL gethostname(char*,int); + +#define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e) +#define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error) +#define WSAGETASYNCBUFLEN(l) LOWORD(l) +#define WSAGETASYNCERROR(l) HIWORD(l) +#define WSAGETSELECTEVENT(l) LOWORD(l) +#define WSAGETSELECTERROR(l) HIWORD(l) + +typedef struct sockaddr SOCKADDR; +typedef struct sockaddr *PSOCKADDR; +typedef struct sockaddr *LPSOCKADDR; +typedef struct sockaddr_storage SOCKADDR_STORAGE, *PSOCKADDR_STORAGE; +typedef struct sockaddr_in SOCKADDR_IN; +typedef struct sockaddr_in *PSOCKADDR_IN; +typedef struct sockaddr_in *LPSOCKADDR_IN; +typedef struct linger LINGER; +typedef struct linger *PLINGER; +typedef struct linger *LPLINGER; +typedef struct in_addr IN_ADDR; +typedef struct in_addr *PIN_ADDR; +typedef struct in_addr *LPIN_ADDR; +typedef struct fd_set FD_SET; +typedef struct fd_set *PFD_SET; +typedef struct fd_set *LPFD_SET; +typedef struct hostent HOSTENT; +typedef struct hostent *PHOSTENT; +typedef struct hostent *LPHOSTENT; +typedef struct servent SERVENT; +typedef struct servent *PSERVENT; +typedef struct servent *LPSERVENT; +typedef struct protoent PROTOENT; +typedef struct protoent *PPROTOENT; +typedef struct protoent *LPPROTOENT; +typedef struct timeval TIMEVAL; +typedef struct timeval *PTIMEVAL; +typedef struct timeval *LPTIMEVAL; + +/* winsock2 additions */ +#define ADDR_ANY INADDR_ANY + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 +#define IN_CLASSD_NSHIFT 28 +#define IN_CLASSD_HOST 0x0fffffff +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define FROM_PROTOCOL_INFO (-1) + +#define SO_DONTLINGER (u_int)(~SO_LINGER) +#define SO_GROUP_ID 0x2001 +#define SO_GROUP_PRIORITY 0x2002 +#define SO_MAX_MSG_SIZE 0x2003 +#define SO_PROTOCOL_INFOA 0x2004 +#define SO_PROTOCOL_INFOW 0x2005 +#ifdef UNICODE +#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW +#else +#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA +#endif +#define PVD_CONFIG 0x3001 + +#define MSG_INTERRUPT 0x10 +#define MSG_MAXIOVLEN 16 + +#define WSAAPI WINAPI +#define WSAEVENT HANDLE +#define LPWSAEVENT LPHANDLE +#define WSAOVERLAPPED OVERLAPPED +typedef struct _OVERLAPPED *LPWSAOVERLAPPED; + +#define WSA_IO_PENDING (ERROR_IO_PENDING) +#define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE) +#define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE) +#define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER) +#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY) +#define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED) + +#define WSA_INVALID_EVENT ((WSAEVENT)NULL) +#define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS) +#define WSA_WAIT_FAILED ((DWORD)-1L) +#define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0) +#define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION) +#define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT) +#define WSA_INFINITE (INFINITE) + +typedef struct _WSABUF { + unsigned long len; + char *buf; +} WSABUF, *LPWSABUF; + +typedef enum +{ + BestEffortService, + ControlledLoadService, + PredictiveService, + GuaranteedDelayService, + GuaranteedService +} GUARANTEE; + +/* TODO: FLOWSPEC and related definitions belong in qos.h */ + +/* + Windows Sockets 2 Application Programming Interface, + revision 2.2.2 (1997) uses the type uint32 for SERVICETYPE + and the elements of _flowspec, but the type uint32 is not defined + or used anywhere else in the w32api. For now, just use + unsigned int, which is 32 bits on _WIN32 and _WIN64. +*/ + +typedef unsigned int SERVICETYPE; +typedef struct _flowspec +{ + unsigned int TokenRate; + unsigned int TokenBucketSize; + unsigned int PeakBandwidth; + unsigned int Latency; + unsigned int DelayVariation; + SERVICETYPE ServiceType; + unsigned int MaxSduSize; + unsigned int MinimumPolicedSize; + } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC; + +typedef struct _QualityOfService +{ + FLOWSPEC SendingFlowspec; + FLOWSPEC ReceivingFlowspec; + WSABUF ProviderSpecific; +} QOS, *LPQOS; + +#define CF_ACCEPT 0x0000 +#define CF_REJECT 0x0001 +#define CF_DEFER 0x0002 +#define SD_RECEIVE 0x00 +#define SD_SEND 0x01 +#define SD_BOTH 0x02 +typedef unsigned int GROUP; + +#define SG_UNCONSTRAINED_GROUP 0x01 +#define SG_CONSTRAINED_GROUP 0x02 +typedef struct _WSANETWORKEVENTS { + long lNetworkEvents; + int iErrorCode[FD_MAX_EVENTS]; +} WSANETWORKEVENTS, *LPWSANETWORKEVENTS; + +#define MAX_PROTOCOL_CHAIN 7 + +#define BASE_PROTOCOL 1 +#define LAYERED_PROTOCOL 0 + +typedef enum _WSAESETSERVICEOP +{ + RNRSERVICE_REGISTER=0, + RNRSERVICE_DEREGISTER, + RNRSERVICE_DELETE +} WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP; + +typedef struct _AFPROTOCOLS { + INT iAddressFamily; + INT iProtocol; +} AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS; + +typedef enum _WSAEcomparator +{ + COMP_EQUAL = 0, + COMP_NOTLESS +} WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR; + +typedef struct _WSAVersion +{ + DWORD dwVersion; + WSAECOMPARATOR ecHow; +} WSAVERSION, *PWSAVERSION, *LPWSAVERSION; + +#ifndef __CSADDR_T_DEFINED /* also in nspapi.h */ +#define __CSADDR_T_DEFINED +typedef struct _SOCKET_ADDRESS { + LPSOCKADDR lpSockaddr; + INT iSockaddrLength; +} SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS; +typedef struct _CSADDR_INFO { + SOCKET_ADDRESS LocalAddr; + SOCKET_ADDRESS RemoteAddr; + INT iSocketType; + INT iProtocol; +} CSADDR_INFO,*PCSADDR_INFO,*LPCSADDR_INFO; +#endif + +typedef struct _SOCKET_ADDRESS_LIST { + INT iAddressCount; + SOCKET_ADDRESS Address[1]; +} SOCKET_ADDRESS_LIST, * LPSOCKET_ADDRESS_LIST; + +#ifndef __BLOB_T_DEFINED /* also in wtypes.h and nspapi.h */ +#define __BLOB_T_DEFINED +typedef struct _BLOB { + ULONG cbSize; + BYTE *pBlobData; +} BLOB,*PBLOB,*LPBLOB; +#endif + +typedef struct _WSAQuerySetA +{ + DWORD dwSize; + LPSTR lpszServiceInstanceName; + LPGUID lpServiceClassId; + LPWSAVERSION lpVersion; + LPSTR lpszComment; + DWORD dwNameSpace; + LPGUID lpNSProviderId; + LPSTR lpszContext; + DWORD dwNumberOfProtocols; + LPAFPROTOCOLS lpafpProtocols; + LPSTR lpszQueryString; + DWORD dwNumberOfCsAddrs; + LPCSADDR_INFO lpcsaBuffer; + DWORD dwOutputFlags; + LPBLOB lpBlob; +} WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA; + +typedef struct _WSAQuerySetW +{ + DWORD dwSize; + LPWSTR lpszServiceInstanceName; + LPGUID lpServiceClassId; + LPWSAVERSION lpVersion; + LPWSTR lpszComment; + DWORD dwNameSpace; + LPGUID lpNSProviderId; + LPWSTR lpszContext; + DWORD dwNumberOfProtocols; + LPAFPROTOCOLS lpafpProtocols; + LPWSTR lpszQueryString; + DWORD dwNumberOfCsAddrs; + LPCSADDR_INFO lpcsaBuffer; + DWORD dwOutputFlags; + LPBLOB lpBlob; +} WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW; + +#ifdef UNICODE +typedef WSAQUERYSETW WSAQUERYSET; +typedef PWSAQUERYSETW PWSAQUERYSET; +typedef LPWSAQUERYSETW LPWSAQUERYSET; +#else +typedef WSAQUERYSETA WSAQUERYSET; +typedef PWSAQUERYSETA PWSAQUERYSET; +typedef LPWSAQUERYSETA LPWSAQUERYSET; +#endif + +#define LUP_DEEP 0x0001 +#define LUP_CONTAINERS 0x0002 +#define LUP_NOCONTAINERS 0x0004 +#define LUP_NEAREST 0x0008 +#define LUP_RETURN_NAME 0x0010 +#define LUP_RETURN_TYPE 0x0020 +#define LUP_RETURN_VERSION 0x0040 +#define LUP_RETURN_COMMENT 0x0080 +#define LUP_RETURN_ADDR 0x0100 +#define LUP_RETURN_BLOB 0x0200 +#define LUP_RETURN_ALIASES 0x0400 +#define LUP_RETURN_QUERY_STRING 0x0800 +#define LUP_RETURN_ALL 0x0FF0 +#define LUP_RES_SERVICE 0x8000 +#define LUP_FLUSHCACHE 0x1000 +#define LUP_FLUSHPREVIOUS 0x2000 + +typedef struct _WSANSClassInfoA +{ + LPSTR lpszName; + DWORD dwNameSpace; + DWORD dwValueType; + DWORD dwValueSize; + LPVOID lpValue; +} WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA; + +typedef struct _WSANSClassInfoW +{ + LPWSTR lpszName; + DWORD dwNameSpace; + DWORD dwValueType; + DWORD dwValueSize; + LPVOID lpValue; +} WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW; + +#ifdef UNICODE +typedef WSANSCLASSINFOW WSANSCLASSINFO; +typedef PWSANSCLASSINFOW PWSANSCLASSINFO; +typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO; +#else +typedef WSANSCLASSINFOA WSANSCLASSINFO; +typedef PWSANSCLASSINFOA PWSANSCLASSINFO; +typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO; +#endif + +typedef struct _WSAServiceClassInfoA +{ + LPGUID lpServiceClassId; + LPSTR lpszServiceClassName; + DWORD dwCount; + LPWSANSCLASSINFOA lpClassInfos; +} WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA; + +typedef struct _WSAServiceClassInfoW +{ + LPGUID lpServiceClassId; + LPWSTR lpszServiceClassName; + DWORD dwCount; + LPWSANSCLASSINFOW lpClassInfos; +} WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW; + +#ifdef UNICODE +typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO; +typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO; +typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO; +#else +typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO; +typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO; +typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO; +#endif + +typedef struct _WSANAMESPACE_INFOA { + GUID NSProviderId; + DWORD dwNameSpace; + BOOL fActive; + DWORD dwVersion; + LPSTR lpszIdentifier; +} WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA; + +typedef struct _WSANAMESPACE_INFOW { + GUID NSProviderId; + DWORD dwNameSpace; + BOOL fActive; + DWORD dwVersion; + LPWSTR lpszIdentifier; +} WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW; + +#ifdef UNICODE +typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO; +typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO; +typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO; +#else +typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO; +typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO; +typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO; +#endif + +typedef struct _WSAPROTOCOLCHAIN { + int ChainLen; + DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; +} WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN; + +#define WSAPROTOCOL_LEN 255 + +typedef struct _WSAPROTOCOL_INFOA { + DWORD dwServiceFlags1; + DWORD dwServiceFlags2; + DWORD dwServiceFlags3; + DWORD dwServiceFlags4; + DWORD dwProviderFlags; + GUID ProviderId; + DWORD dwCatalogEntryId; + WSAPROTOCOLCHAIN ProtocolChain; + int iVersion; + int iAddressFamily; + int iMaxSockAddr; + int iMinSockAddr; + int iSocketType; + int iProtocol; + int iProtocolMaxOffset; + int iNetworkByteOrder; + int iSecurityScheme; + DWORD dwMessageSize; + DWORD dwProviderReserved; + CHAR szProtocol[WSAPROTOCOL_LEN+1]; +} WSAPROTOCOL_INFOA, *LPWSAPROTOCOL_INFOA; + +typedef struct _WSAPROTOCOL_INFOW { + DWORD dwServiceFlags1; + DWORD dwServiceFlags2; + DWORD dwServiceFlags3; + DWORD dwServiceFlags4; + DWORD dwProviderFlags; + GUID ProviderId; + DWORD dwCatalogEntryId; + WSAPROTOCOLCHAIN ProtocolChain; + int iVersion; + int iAddressFamily; + int iMaxSockAddr; + int iMinSockAddr; + int iSocketType; + int iProtocol; + int iProtocolMaxOffset; + int iNetworkByteOrder; + int iSecurityScheme; + DWORD dwMessageSize; + DWORD dwProviderReserved; + WCHAR szProtocol[WSAPROTOCOL_LEN+1]; +} WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW; + +typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP *, DWORD); +typedef void (WINAPI *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPWSAOVERLAPPED, DWORD); + + +#ifdef UNICODE +typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO; +typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO; +#else +typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO; +typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO; +#endif + +/* Needed for XP & .NET Server function WSANSPIoctl. */ +typedef enum _WSACOMPLETIONTYPE { + NSP_NOTIFY_IMMEDIATELY = 0, + NSP_NOTIFY_HWND, + NSP_NOTIFY_EVENT, + NSP_NOTIFY_PORT, + NSP_NOTIFY_APC +} WSACOMPLETIONTYPE, * PWSACOMPLETIONTYPE, * LPWSACOMPLETIONTYPE; +typedef struct _WSACOMPLETION { + WSACOMPLETIONTYPE Type; + union { + struct { + HWND hWnd; + UINT uMsg; + WPARAM context; + } WindowMessage; + struct { + LPWSAOVERLAPPED lpOverlapped; + } Event; + struct { + LPWSAOVERLAPPED lpOverlapped; + LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc; + } Apc; + struct { + LPWSAOVERLAPPED lpOverlapped; + HANDLE hPort; + ULONG_PTR Key; + } Port; + } Parameters; +} WSACOMPLETION, *PWSACOMPLETION, *LPWSACOMPLETION; + +#define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001 +#define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002 +#define PFL_HIDDEN 0x00000004 +#define PFL_MATCHES_PROTOCOL_ZERO 0x00000008 +#define XP1_CONNECTIONLESS 0x00000001 +#define XP1_GUARANTEED_DELIVERY 0x00000002 +#define XP1_GUARANTEED_ORDER 0x00000004 +#define XP1_MESSAGE_ORIENTED 0x00000008 +#define XP1_PSEUDO_STREAM 0x00000010 +#define XP1_GRACEFUL_CLOSE 0x00000020 +#define XP1_EXPEDITED_DATA 0x00000040 +#define XP1_CONNECT_DATA 0x00000080 +#define XP1_DISCONNECT_DATA 0x00000100 +#define XP1_SUPPORT_BROADCAST 0x00000200 +#define XP1_SUPPORT_MULTIPOINT 0x00000400 +#define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800 +#define XP1_MULTIPOINT_DATA_PLANE 0x00001000 +#define XP1_QOS_SUPPORTED 0x00002000 +#define XP1_INTERRUPT 0x00004000 +#define XP1_UNI_SEND 0x00008000 +#define XP1_UNI_RECV 0x00010000 +#define XP1_IFS_HANDLES 0x00020000 +#define XP1_PARTIAL_MESSAGE 0x00040000 + +#define BIGENDIAN 0x0000 +#define LITTLEENDIAN 0x0001 + +#define SECURITY_PROTOCOL_NONE 0x0000 +#define JL_SENDER_ONLY 0x01 +#define JL_RECEIVER_ONLY 0x02 +#define JL_BOTH 0x04 +#define WSA_FLAG_OVERLAPPED 0x01 +#define WSA_FLAG_MULTIPOINT_C_ROOT 0x02 +#define WSA_FLAG_MULTIPOINT_C_LEAF 0x04 +#define WSA_FLAG_MULTIPOINT_D_ROOT 0x08 +#define WSA_FLAG_MULTIPOINT_D_LEAF 0x10 +#define IOC_UNIX 0x00000000 +#define IOC_WS2 0x08000000 +#define IOC_PROTOCOL 0x10000000 +#define IOC_VENDOR 0x18000000 + +#define _WSAIO(x,y) (IOC_VOID|(x)|(y)) +#define _WSAIOR(x,y) (IOC_OUT|(x)|(y)) +#define _WSAIOW(x,y) (IOC_IN|(x)|(y)) +#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y)) + +#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1) +#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2) +#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3) +#define SIO_FLUSH _WSAIO(IOC_WS2,4) +#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5) +#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6) +#define SIO_GET_QOS _WSAIORW(IOC_WS2,7) +#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8) +#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9) +#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10) +#define SIO_SET_QOS _WSAIOW(IOC_WS2,11) +#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12) +#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13) +#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20) +#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21) +#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22) +#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23) +#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24) +#define SIO_NSP_NOTIFY_CHANGE _WSAIOW(IOC_WS2,25) + +#define TH_NETDEV 0x00000001 +#define TH_TAPI 0x00000002 + +WINSOCK_API_LINKAGE SOCKET WINAPI WSAAccept(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD); +WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD); +WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringW(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD); +WINSOCK_API_LINKAGE BOOL WINAPI WSACloseEvent(WSAEVENT); +WINSOCK_API_LINKAGE int WINAPI WSAConnect(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS); +WINSOCK_API_LINKAGE WSAEVENT WINAPI WSACreateEvent(void); +WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketA(SOCKET, DWORD, LPWSAPROTOCOL_INFOA); +WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketW(SOCKET, DWORD, LPWSAPROTOCOL_INFOW); +WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD, LPWSANAMESPACE_INFOA); +WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD, LPWSANAMESPACE_INFOW); +WINSOCK_API_LINKAGE int WINAPI WSAEnumNetworkEvents(SOCKET, WSAEVENT, LPWSANETWORKEVENTS); +WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsA(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD); +WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsW(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD); +WINSOCK_API_LINKAGE int WINAPI WSAEventSelect(SOCKET, WSAEVENT, long); +WINSOCK_API_LINKAGE BOOL WINAPI WSAGetOverlappedResult(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD); +WINSOCK_API_LINKAGE BOOL WINAPI WSAGetQOSByName(SOCKET, LPWSABUF, LPQOS); +WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoA(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA); +WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoW(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW); +WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID, LPSTR, LPDWORD); +WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID, LPWSTR, LPDWORD); +WINSOCK_API_LINKAGE int WINAPI WSAHtonl(SOCKET, unsigned long, unsigned long *); +WINSOCK_API_LINKAGE int WINAPI WSAHtons(SOCKET, unsigned short, unsigned short *); +WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA); +WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW); +WINSOCK_API_LINKAGE int WINAPI WSAIoctl(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +WINSOCK_API_LINKAGE SOCKET WINAPI WSAJoinLeaf(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD); +WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA, DWORD, LPHANDLE); +WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions, DWORD, LPHANDLE); +WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextA(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA); +WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextW(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW); +WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceEnd(HANDLE); +WINSOCK_API_LINKAGE int WINAPI WSANSPIoctl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION); /* XP or .NET Server */ +WINSOCK_API_LINKAGE int WINAPI WSANtohl(SOCKET, unsigned long, unsigned long *); +WINSOCK_API_LINKAGE int WINAPI WSANtohs(SOCKET, unsigned short, unsigned short *); +WINSOCK_API_LINKAGE int WINAPI WSARecv(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +WINSOCK_API_LINKAGE int WINAPI WSARecvDisconnect(SOCKET, LPWSABUF); +WINSOCK_API_LINKAGE int WINAPI WSARecvFrom(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +WINSOCK_API_LINKAGE INT WINAPI WSARemoveServiceClass(LPGUID); +WINSOCK_API_LINKAGE BOOL WINAPI WSAResetEvent(WSAEVENT); +WINSOCK_API_LINKAGE int WINAPI WSASend(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +WINSOCK_API_LINKAGE int WINAPI WSASendDisconnect(SOCKET, LPWSABUF); +WINSOCK_API_LINKAGE int WINAPI WSASendTo(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +WINSOCK_API_LINKAGE BOOL WINAPI WSASetEvent(WSAEVENT); +WINSOCK_API_LINKAGE INT WSAAPI WSASetServiceA(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD); +WINSOCK_API_LINKAGE INT WINAPI WSASetServiceW(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD); +WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketA(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD); +WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketW(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD); +WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressA(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT); +WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressW(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT); +WINSOCK_API_LINKAGE DWORD WINAPI WSAWaitForMultipleEvents(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL); + +typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD); +typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD); +typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD); +typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT); +typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS); +typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void); +typedef int (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET, DWORD, LPWSAPROTOCOL_INFOA); +typedef int (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET, DWORD, LPWSAPROTOCOL_INFOW); +typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD, LPWSANAMESPACE_INFOA); +typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD, LPWSANAMESPACE_INFOW); +typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS); +typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD); +typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD); +typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET, WSAEVENT, long); +typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD); +typedef BOOL (WINAPI *LPFN_WSAGETQOSBYNAME)(SOCKET, LPWSABUF, LPQOS); +typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA); +typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW); +typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID, LPSTR, LPDWORD); +typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID, LPWSTR, LPDWORD); +typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET, unsigned long, unsigned long *); +typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET, unsigned short, unsigned short *); +typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA); +typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW); +typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +typedef SOCKET (WINAPI *LPFN_WSAJOINLEAF)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD); +typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA, DWORD, LPHANDLE); +typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW, DWORD, LPHANDLE); +typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA); +typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW); +typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE); +typedef int (WINAPI *LPFN_WSANSPIoctl)(HANDLE, DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION); +typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET, unsigned long, unsigned long *); +typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET, unsigned short, unsigned short *); +typedef int (WINAPI *LPFN_WSARECV)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET, LPWSABUF); +typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID); +typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT); +typedef int (WINAPI *LPFN_WSASEND)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET, LPWSABUF); +typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); +typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT); +typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD); +typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD); +typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD); +typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD); +typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT); +typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT); +typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL); + +#ifdef UNICODE +#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW +#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW +#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW +#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW +#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW +#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW +#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW +#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW +#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW +#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW +#define LPFN_WSASOCKET LPFN_WSASOCKETW +#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW +#define WSAAddressToString WSAAddressToStringW +#define WSADuplicateSocket WSADuplicateSocketW +#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW +#define WSAEnumProtocols WSAEnumProtocolsW +#define WSAGetServiceClassInfo WSAGetServiceClassInfoW +#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW +#define WSASetService WSASetServiceW +#define WSASocket WSASocketW +#define WSAStringToAddress WSAStringToAddressW +#define WSALookupServiceBegin WSALookupServiceBeginW +#define WSALookupServiceNext WSALookupServiceNextW +#define WSAInstallServiceClass WSAInstallServiceClassW +#else +#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA +#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW +#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA +#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA +#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA +#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA +#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA +#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA +#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA +#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA +#define LPFN_WSASOCKET LPFN_WSASOCKETA +#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA +#define WSAAddressToString WSAAddressToStringA +#define WSADuplicateSocket WSADuplicateSocketA +#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA +#define WSAEnumProtocols WSAEnumProtocolsA +#define WSAGetServiceClassInfo WSAGetServiceClassInfoA +#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA +#define WSAInstallServiceClass WSAInstallServiceClassA +#define WSALookupServiceBegin WSALookupServiceBeginA +#define WSALookupServiceNext WSALookupServiceNextA +#define WSASocket WSASocketA +#define WSAStringToAddress WSAStringToAddressA +#define WSASetService WSASetServiceA +#endif + +#ifdef __cplusplus +} +#endif +#endif