From a26b39974fb992cb400c6e9aff0a02737c2f4f59 Mon Sep 17 00:00:00 2001 From: jkeil Date: Thu, 12 Jul 2001 15:27:48 +0000 Subject: Add prototypes to wine/loader stuff, so that we can catch __stdcall function attribute mismatch between caller/caller. wine/loader is less sensitive to optimization now. (now that avifile-0.6 has the same patch installed, we're a bit closer to their CVS tree) Speed up win32 "QueryPerformanceFrequency" emulation on solaris. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1308 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/Makefile | 15 +- loader/afl.c | 13 +- loader/config.h | 74 --------- loader/driver.c | 47 +++--- loader/driver.h | 11 ++ loader/elfdll.c | 2 +- loader/ext.c | 78 +++++---- loader/ext.h | 15 ++ loader/loader.h | 3 +- loader/module.c | 10 +- loader/pe_image.c | 32 ++-- loader/pe_resource.c | 1 + loader/registry.c | 20 ++- loader/resource.c | 3 + loader/setup_FS.c | 11 +- loader/setup_FS.h | 10 ++ loader/vfl.c | 49 +++--- loader/win32.c | 181 +++++++++++++-------- loader/win32.h | 211 +++++++++++++++++++++++- loader/wine/config.h | 442 --------------------------------------------------- loader/wine/vfw.h | 2 +- 21 files changed, 533 insertions(+), 697 deletions(-) delete mode 100644 loader/config.h create mode 100644 loader/driver.h create mode 100644 loader/ext.h create mode 100644 loader/setup_FS.h delete mode 100644 loader/wine/config.h (limited to 'loader') diff --git a/loader/Makefile b/loader/Makefile index c04ec0a4ec..1b5ea406ec 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -1,18 +1,25 @@ include ../config.mak # Generated automatically from Makefile.in by configure. -DEFINES=-rdynamic -fPIC $(WIN32_PATH) $(CDOPT) -D__WINE__ -Ddbg_printf=__vprintf \ +DEFINES=$(WIN32_PATH) -D__WINE__ -Ddbg_printf=__vprintf \ -DTRACE=__vprintf # -DDETAILED_OUT LIB_OBJECTS= setup_FS.o pe_image.o module.o \ ext.o win32.o driver.o pe_resource.o \ resource.o registry.o elfdll.o afl.o vfl.o -CFLAGS=-g -I. +# gcc-3.0 produces buggy code for acmStreamOpen() with +# "-O3 -fomit-frame-pointer" or "-O2 -fomit-frame-pointer +# -finline-functions -frename-registers" (code is OK with sole -O2), +# the bad code accesses parameters via %ebp without setting up a +# propper %ebp first! +# -fno-omit-frame-pointer works around this gcc-3.0 bug. gcc-2.95.2 is OK. +WARN_FLAGS = -Wmissing-prototypes -Wimplicit-function-declaration +CFLAGS=-I. -I.. $(OPTFLAGS) $(EXTRA_INC) $(WARN_FLAGS) -fno-omit-frame-pointer +#CFLAGS=-I. -I.. -O $(WARN_FLAGS) -g #-fno-omit-frame-pointer -CDOPT=-g all: libloader.a - + clean: -rm -f *.o libloader.a diff --git a/loader/afl.c b/loader/afl.c index 7816a3f139..bf79e75f27 100644 --- a/loader/afl.c +++ b/loader/afl.c @@ -22,8 +22,11 @@ #include #include +#include #include +#include "win32.h" + #include #include #include @@ -34,11 +37,13 @@ #include #include #include "wineacm.h" -#pragma pack(1) +#include "ext.h" +#include "driver.h" + #define OpenDriverA DrvOpen -extern HDRVR VFWAPI DrvOpen(long); #define CloseDriver DrvClose -extern HDRVR VFWAPI DrvClose(long); + +#pragma pack(1) static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) { @@ -394,6 +399,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw int wfxSrcSize; int wfxDstSize; + //printf("gcc-3.0 bug, pwfxSrc=%p, pwfxSrc->cbSize=%d\n", pwfxSrc, pwfxSrc->cbSize); + TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); diff --git a/loader/config.h b/loader/config.h deleted file mode 100644 index 15ff49d602..0000000000 --- a/loader/config.h +++ /dev/null @@ -1,74 +0,0 @@ - -/* include/config.h. Generated automatically by configure. */ -/* include/config.h.in. Generated automatically from configure.in by autoheader. */ -#define USE_SDL 1 -/* #undef QUIET */ -/* #undef TIMING */ -/* #undef DETAILED_OUT */ -#define MMX 1 -#define HAVE_LIBXXF86DGA 1 -#define HAVE_LIBXXF86VM 1 -#define USE_TSC 1 - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if you have the ftime function. */ -#define HAVE_FTIME 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the gettimeofday function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the dl library (-ldl). */ -#define HAVE_LIBDL 1 - -/* Define if you have the jpeg library (-ljpeg). */ -#define HAVE_LIBJPEG 1 diff --git a/loader/driver.c b/loader/driver.c index 6133409680..e7b870402d 100644 --- a/loader/driver.c +++ b/loader/driver.c @@ -1,29 +1,38 @@ #include #include - #ifdef HAVE_MALLOC_H #include -#else +#endif #include +#ifdef __FreeBSD__ +#include #endif +#include #include #include #include #include #include - -//#include "com.h" -//typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); - - -#ifdef __FreeBSD__ -#include -#endif +#include +#include "driver.h" +#if 1 +/* + * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to + * WINAPI/no-WINAPI bustage. + * + * There should be no need for the STORE_ALL/REST_ALL hack once all + * function definitions agree with their prototypes (WINAPI-wise) and + * we make sure, that we do not call these functions without a proper + * prototype in scope. + */ +#define STORE_ALL /**/ +#define REST_ALL /**/ +#else #define STORE_ALL \ - __asm__ ( \ + __asm__( \ "push %%ebx\n\t" \ "push %%ecx\n\t" \ "push %%edx\n\t" \ @@ -31,25 +40,16 @@ "push %%edi\n\t"::) #define REST_ALL \ - __asm__ ( \ + __asm__( \ "pop %%edi\n\t" \ "pop %%esi\n\t" \ "pop %%edx\n\t" \ "pop %%ecx\n\t" \ "pop %%ebx\n\t"::) +#endif -typedef struct { - UINT uDriverSignature; - HINSTANCE hDriverModule; - DRIVERPROC DriverProc; - DWORD dwDriverID; -} DRVR; - -typedef DRVR *PDRVR; -typedef DRVR *NPDRVR; -typedef DRVR *LPDRVR; static DWORD dwDrvID = 0; @@ -119,10 +119,9 @@ void DrvClose(HDRVR hdrvr) } -extern char* def_path; //=WIN32_PATH; // path to codecs char* win32_codec_name=NULL; // must be set before calling DrvOpen() !!! -HDRVR +HDRVR VFWAPI DrvOpen(LPARAM lParam2) { ICOPEN *icopen=(ICOPEN *) lParam2; diff --git a/loader/driver.h b/loader/driver.h new file mode 100644 index 0000000000..5f055fef43 --- /dev/null +++ b/loader/driver.h @@ -0,0 +1,11 @@ + +#ifndef loader_driver_h +#define loader_driver_h + +#include +#include + +extern HDRVR VFWAPI DrvOpen(LPARAM lParam2); +extern void DrvClose(HDRVR hdrvr); + +#endif diff --git a/loader/elfdll.c b/loader/elfdll.c index b4cf623995..840868c6b7 100644 --- a/loader/elfdll.c +++ b/loader/elfdll.c @@ -9,9 +9,9 @@ #include #include +#include #include -#include #include //#include //#include diff --git a/loader/ext.c b/loader/ext.c index 1b27f9bda2..8fec3951d1 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -6,10 +6,10 @@ * ********************************************************/ #include +#include +#include #ifdef HAVE_MALLOC_H #include -#else -#include #endif #include #include @@ -18,7 +18,11 @@ #include #include #include -//#include +#include +#include +#include +#include "ext.h" + int dbg_header_err( const char *dbg_channel, const char *func ) { return 0; @@ -35,7 +39,7 @@ int dbg_header_trace( const char *dbg_channel, const char *func ) { return 0; } -int dbg_vprintf( const char *format, ... ) +int dbg_vprintf( const char *format, va_list args ) { return 0; } @@ -50,12 +54,12 @@ int __vprintf( const char *format, ... ) return 0; } -int GetProcessHeap() +HANDLE WINAPI GetProcessHeap(void) { return 1; } -void* HeapAlloc(int heap, int flags, int size) +LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size) { if(flags & 0x8) return calloc(size, 1); @@ -63,7 +67,7 @@ void* HeapAlloc(int heap, int flags, int size) return malloc(size); } -int HeapFree(int heap, int flags, void* mem) +WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags,LPVOID mem) { if (mem) free(mem); return 1; @@ -71,34 +75,34 @@ int HeapFree(int heap, int flags, void* mem) static int last_error; -int GetLastError() +DWORD WINAPI GetLastError(void) { return last_error; } -int SetLastError(int error) +VOID WINAPI SetLastError(DWORD error) { - return last_error=error; + last_error = error; } -int ReadFile(int handle, void* mem, unsigned long size, long* result, long flags) +WIN_BOOL WINAPI ReadFile(HANDLE handle,LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags) { *result=read(handle, mem, size); return *result; } -int lstrcmpiA(const char* c1, const char* c2) +int WINAPI lstrcmpiA(const char* c1, const char* c2) { return strcasecmp(c1,c2); } -int lstrcpynA(char* dest, const char* src, int num) +LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num) { - return strncmp(dest,src,num); + return strncpy(dest,src,num); } -int lstrlenA(const char* s) +int WINAPI lstrlenA(const char* s) { return strlen(s); } -int lstrlenW(const short* s) +INT WINAPI lstrlenW(LPCWSTR s) { int l; if(!s) @@ -108,8 +112,9 @@ int lstrlenW(const short* s) l++; return l; } -int lstrcpynWtoA(char* dest, const char* src, int count) +LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count) { + LPSTR rval = dest; int moved=0; if((dest==0) || (src==0)) return 0; @@ -118,10 +123,11 @@ int lstrcpynWtoA(char* dest, const char* src, int count) *dest=*src; moved++; if(*src==0) - return moved; + break; src++; dest++; } + return rval; } int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n) { @@ -147,7 +153,7 @@ int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n) } -int IsBadReadPtr(void* data, int size) +WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size) { if(size==0) return 0; @@ -155,14 +161,14 @@ int IsBadReadPtr(void* data, int size) return 1; return 0; } -char* HEAP_strdupA(const char* string) +LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string) { // return strdup(string); char* answ=malloc(strlen(string)+1); strcpy(answ, string); return answ; } -short* HEAP_strdupAtoW(void* heap, void* hz, const char* string) +LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string) { int size, i; short* answer; @@ -174,7 +180,7 @@ short* HEAP_strdupAtoW(void* heap, void* hz, const char* string) answer[i]=(short)string[i]; return answer; } -char* HEAP_strdupWtoA(void* heap, void* hz, const short* string) +LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) { int size, i; char* answer; @@ -322,9 +328,12 @@ static file_mapping* fm=0; #define PAGE_GUARD 0x100 #define PAGE_NOCACHE 0x200 -HANDLE CreateFileMappingA(int hFile, void* lpAttr, -DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name) +HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, + DWORD flProtect, + DWORD dwMaxHigh, DWORD dwMaxLow, + LPCSTR name) { + int hFile = (int)handle; unsigned int len; HANDLE answer; int anon=0; @@ -381,7 +390,7 @@ DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name) } return (HANDLE)0; } -int UnmapViewOfFile(HANDLE handle) +WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle) { file_mapping* p; int result; @@ -389,7 +398,7 @@ int UnmapViewOfFile(HANDLE handle) return (HANDLE)0; for(p=fm; p; p=p->next) { - if(p->handle==handle) + if(p->handle==(HANDLE)handle) { result=munmap((void*)handle, p->mapping_size); if(p->next)p->next->prev=p->prev; @@ -418,7 +427,7 @@ static virt_alloc* vm=0; #define MEM_COMMIT 0x00001000 #define MEM_RESERVE 0x00002000 -void* VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protection) +void* WINAPI VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protection) { void* answer; int fd=open("/dev/zero", O_RDWR); @@ -488,7 +497,7 @@ void* VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protection) return answer; } } -int VirtualFree(void* address, int t1, int t2)//not sure +WIN_BOOL WINAPI VirtualFree(LPVOID address, DWORD t1, DWORD t2)//not sure { virt_alloc* str=vm; int answer; @@ -509,8 +518,10 @@ int VirtualFree(void* address, int t1, int t2)//not sure return -1; } -int WideCharToMultiByte(unsigned int codepage, long flags, const short* src, - int srclen,char* dest, int destlen, const char* defch, int* used_defch) +INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, + LPCWSTR src, INT srclen, + LPSTR dest, INT destlen, + LPCSTR defch, WIN_BOOL*used_defch) { int i; if(src==0) @@ -541,12 +552,13 @@ int WideCharToMultiByte(unsigned int codepage, long flags, const short* src, } return min(srclen, destlen); } -int MultiByteToWideChar(unsigned int codepage,long flags, const char* src, int srclen, - short* dest, int destlen) +INT WINAPI MultiByteToWideChar(UINT codepage, DWORD flags, + LPCSTR src, INT srclen, + LPWSTR dest, INT destlen) { return 0; } -HANDLE OpenFileMappingA(long access, long prot, char* name) +HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name) { file_mapping* p; if(fm==0) diff --git a/loader/ext.h b/loader/ext.h new file mode 100644 index 0000000000..f6b121e9b7 --- /dev/null +++ b/loader/ext.h @@ -0,0 +1,15 @@ + +#ifndef loader_ext_h +#define loader_ext_h + +#include + +extern LPVOID FILE_dommap( int unix_handle, LPVOID start, + DWORD size_high, DWORD size_low, + DWORD offset_high, DWORD offset_low, + int prot, int flags ); +extern int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low ); +extern int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n); +extern int __vprintf( const char *format, ... ); + +#endif diff --git a/loader/loader.h b/loader/loader.h index 6b758d0217..e2b1207be8 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -279,7 +279,8 @@ MMRESULT WINAPI acmStreamUnprepareHeader( ); void MSACM_RegisterAllDrivers(void); -int WINAPI LoadStringA(long instance, long id, void* buf, long size); +INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, + LPSTR buffer, INT buflen ); #ifdef __cplusplus } diff --git a/loader/module.c b/loader/module.c index 61a886d025..e2eb306cc2 100644 --- a/loader/module.c +++ b/loader/module.c @@ -15,6 +15,11 @@ #include #include +#ifdef HAVE_LIBDL +#include +#include +#endif + /* #ifdef __linux__ #include @@ -48,6 +53,7 @@ struct modify_ldt_ldt_s { #include #include #include +#include "win32.h" struct modref_list_t; @@ -79,7 +85,7 @@ WINE_MODREF *MODULE_FindModule(LPCSTR m) return list->wm; } -void MODULE_RemoveFromList(WINE_MODREF *mod) +static void MODULE_RemoveFromList(WINE_MODREF *mod) { modref_list* list=local_wm; if(list==0) @@ -478,7 +484,7 @@ FARPROC MODULE_GetProcAddress( return retproc; #ifdef HAVE_LIBDL case MODULE32_ELF: - retproc = (FARPROC) dlsym( wm->module, function); + retproc = (FARPROC) dlsym( (void*)wm->module, function); if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); return retproc; #endif diff --git a/loader/pe_image.c b/loader/pe_image.c index 51af59bd0b..55d8ef34dd 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -34,16 +34,19 @@ * to 4096 byte boundaries on disk. */ #include -#include #include #include +#include #include #include #include #include #include #include +#ifdef HAVE_ALLOCA_H +#include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif @@ -54,6 +57,7 @@ #include #include #include +#include #include "win32.h" @@ -64,7 +68,7 @@ extern void* LookupExternal(const char* library, int ordinal); extern void* LookupExternalByName(const char* library, const char* name); -void dump_exports( HMODULE hModule ) +static void dump_exports( HMODULE hModule ) { char *Module; int i, j; @@ -236,7 +240,7 @@ FARPROC PE_FindExportedFunction( } } -DWORD fixup_imports( WINE_MODREF *wm ) +static DWORD fixup_imports( WINE_MODREF *wm ) { IMAGE_IMPORT_DESCRIPTOR *pe_imp; PE_MODREF *pem; @@ -561,7 +565,6 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) } } - load_addr = nt->OptionalHeader.ImageBase; vma_size = calc_vma_size( hModule ); @@ -881,17 +884,26 @@ void PE_UnloadLibrary(WINE_MODREF *wm) * due to the PROCESS_Create stuff. */ -/* Called if the library is loaded or freed. - * NOTE: if a thread attaches a DLL, the current thread will only do - * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH - * (SDK) +#if 0 +/* + * so this is a dirty hack. + * Why do we need it? + * + * Disable it for now, let's see if it breaks something */ -extern void This_Is_Dirty_Hack() +static void This_Is_Dirty_Hack(void) { void* mem=alloca(0x20000); *(int*)mem=0x1234; } +#endif + +/* Called if the library is loaded or freed. + * NOTE: if a thread attaches a DLL, the current thread will only do + * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH + * (SDK) + */ WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) { WIN_BOOL retv = TRUE; @@ -927,7 +939,9 @@ WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) break; } TRACE("for %s\n", wm->filename); +#if 0 This_Is_Dirty_Hack(); +#endif retv = entry( wm->module, type, lpReserved ); } diff --git a/loader/pe_resource.c b/loader/pe_resource.c index 7edfac614b..e0dc60bd3c 100644 --- a/loader/pe_resource.c +++ b/loader/pe_resource.c @@ -22,6 +22,7 @@ //#include "process.h" //#include "stackframe.h" #include +#include /********************************************************************** * HMODULE32toPE_MODREF diff --git a/loader/registry.c b/loader/registry.c index c9b0f11676..9c6b0a6450 100644 --- a/loader/registry.c +++ b/loader/registry.c @@ -1,7 +1,9 @@ #include #include +#include #include +#include #include #include @@ -11,6 +13,8 @@ #include #include +#include + //#undef TRACE //#define TRACE printf struct reg_value @@ -40,14 +44,14 @@ static reg_handle_t* head=0; extern char *get_path(char *); -static void create_registry(); -static void open_registry(); -static void save_registry(); +static void create_registry(void); +static void open_registry(void); +static void save_registry(void); -static void create_registry(){ +static void create_registry(void){ if(regs) { printf("Logic error: create_registry() called with existing registry\n"); @@ -65,7 +69,7 @@ static void create_registry(){ reg_size=2; save_registry(); } -static void open_registry() +static void open_registry(void) { int fd; int i; @@ -120,7 +124,7 @@ error: return; } -static void save_registry() +static void save_registry(void) { int fd, i, len; // struct passwd* pwent; @@ -227,7 +231,7 @@ static char* build_keyname(long key, const char* subkey) strcat(full_name, subkey); return full_name; } -struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len) +static struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len) { reg_handle_t* t; struct reg_value* v; @@ -263,7 +267,7 @@ struct reg_value* insert_reg_value(int handle, const char* name, int type, const return v; } -static void init_registry() +static void init_registry(void) { #ifdef DETAILED_OUT printf("Initializing registry\n"); diff --git a/loader/resource.c b/loader/resource.c index 1c5b4654d8..aea0948784 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -20,6 +21,8 @@ #include #include #include +#include + #define CP_ACP 0 WORD WINE_LanguageId=0x409;//english diff --git a/loader/setup_FS.c b/loader/setup_FS.c index 588d4f2a1c..8bab360ceb 100644 --- a/loader/setup_FS.c +++ b/loader/setup_FS.c @@ -10,7 +10,7 @@ #ifdef __linux__ #include #include -#else +#else /* !__linux__ */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include @@ -22,7 +22,9 @@ /* solaris x86: add missing prototype for sysi86() */ extern int sysi86(int, void*); #define TEB_SEL_IDX NUMSYSLDTS -#endif +#endif /* __svr4__ */ + + #define LDT_ENTRIES 8192 #define LDT_ENTRY_SIZE 8 @@ -42,7 +44,10 @@ struct modify_ldt_ldt_s { #define MODIFY_LDT_CONTENTS_DATA 0 #define MODIFY_LDT_CONTENTS_STACK 1 #define MODIFY_LDT_CONTENTS_CODE 2 -#endif +#endif /* !__linux__ */ + +#include "setup_FS.h" + /* user level (privilege level: 3) ldt (1<<2) segment selector */ diff --git a/loader/setup_FS.h b/loader/setup_FS.h new file mode 100644 index 0000000000..616af1d210 --- /dev/null +++ b/loader/setup_FS.h @@ -0,0 +1,10 @@ + +#ifndef setup_FS_h +#define setup_FS_h + +extern void setup_FS_Segment(void); +extern void Setup_LDT_Keeper(void); +extern void Restore_LDT_Keeper(void); + + +#endif diff --git a/loader/vfl.c b/loader/vfl.c index a16986aa33..d15518c35e 100644 --- a/loader/vfl.c +++ b/loader/vfl.c @@ -6,6 +6,9 @@ #include #include +#include "win32.h" +#include "loader.h" + #include "wine/winbase.h" #include "wine/windef.h" #include "wine/winuser.h" @@ -13,29 +16,31 @@ #include "wine/winestring.h" #include "wine/driver.h" #include "wine/avifmt.h" +#include "driver.h" + #define FIXME_(X) printf #define FIXME printf -long VFWAPI VideoForWindowsVersion(void); - -extern void* my_mreq(int size, int to_zero); -extern void DrvClose(HDRVR hdrvr); -extern int my_release(void* memory); - -long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits); +#define OpenDriverA DrvOpen +#define CloseDriver DrvClose -WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo); -LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb); -HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode); -HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler); +long VFWAPI VideoForWindowsVersion(void); -LRESULT VFWAPI ICClose(HIC hic); -LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2); -HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags); -#define OpenDriverA DrvOpen -extern HDRVR VFWAPI DrvOpen(long); +#if 1 +/* + * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to + * WINAPI/no-WINAPI bustage. + * + * There should be no need for the STORE_ALL/REST_ALL hack once all + * function definitions agree with their prototypes (WINAPI-wise) and + * we make sure, that we do not call these functions without a proper + * prototype in scope. + */ +#define STORE_ALL /**/ +#define REST_ALL /**/ +#else #define STORE_ALL \ __asm__ ( \ "push %%ebx\n\t" \ @@ -51,15 +56,9 @@ extern HDRVR VFWAPI DrvOpen(long); "pop %%edx\n\t" \ "pop %%ecx\n\t" \ "pop %%ebx\n\t"::) +#endif -typedef struct { - unsigned int uDriverSignature; - void* hDriverModule; - DRIVERPROC DriverProc; - long dwDriverID; -} DRVR; - /*********************************************************************** * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2] * Returns the version in major.minor form. @@ -351,7 +350,9 @@ ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) { WINE_HIC *whic = (WINE_HIC*)hic; char qw[200]; +#if 0 __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw)); +#endif STORE_ALL; /*__asm__ ( @@ -362,7 +363,9 @@ ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) { );*/ ret = whic->driverproc(whic->private,1,msg,lParam1,lParam2); REST_ALL; +#if 0 __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw)); +#endif // } else // ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2); diff --git a/loader/win32.c b/loader/win32.c index 4b06552570..848616b2a0 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -28,6 +28,9 @@ #include #include #include +#if HAVE_LIBKSTAT +#include +#endif #include #include @@ -77,8 +80,6 @@ static void c_longcount_tsc(long long* z) "popl %%ebx\n\t" ::"a"(z)); } -#include -#include static unsigned int c_localcount_notsc() { struct timeval tv; @@ -100,12 +101,13 @@ static void c_longcount_notsc(long long* z) result+=limit*tv.tv_usec; *z=result; } -static unsigned int localcount_stub(); -static void longcount_stub(long long*); + +static unsigned int localcount_stub(void); +static void longcount_stub(long long* z); static unsigned int (*localcount)()=localcount_stub; static void (*longcount)(long long*)=longcount_stub; -static unsigned int localcount_stub() +static unsigned int localcount_stub(void) { unsigned int regs[4]; do_cpuid(regs); @@ -139,7 +141,7 @@ static void longcount_stub(long long* z) } int LOADER_DEBUG=1; -inline void dbgprintf(char* fmt, ...) +static inline void dbgprintf(char* fmt, ...) { #ifdef DETAILED_OUT if(LOADER_DEBUG) @@ -168,7 +170,7 @@ char export_names[500][30]={ static unsigned char* heap=NULL; static int heap_counter=0; -void test_heap() +static void test_heap() { int offset=0; if(heap==0) @@ -326,7 +328,7 @@ extern int unk_exp1; char extcode[20000];// place for 200 unresolved exports int pos=0; -int WINAPI ext_unknown() +int WINAPI ext_unknown(void) { printf("Unknown func called\n"); return 0; @@ -403,18 +405,13 @@ int CDECL exp_initterm(int v1, int v2) return 0; } -typedef struct { - unsigned int uDriverSignature; - void* hDriverModule; - void* DriverProc; - unsigned int dwDriverID; -} DRVR; - void* WINAPI expGetDriverModuleHandle(DRVR* pdrv) { void* result; - if (pdrv==NULL) result=NULL; - result=pdrv->hDriverModule; + if (pdrv==NULL) + result=NULL; + else + result=(void*) pdrv->hDriverModule; dbgprintf("GetDriverModuleHandle(0x%x) => 0x%x\n", pdrv, result); return result; } @@ -992,15 +989,14 @@ int WINAPI expGetCurrentProcess() dbgprintf("GetCurrentProcess() => %d\n", getpid()); return getpid(); } -struct tls_s; -typedef struct tls_s + +struct tls_s { void* value; int used; struct tls_s* prev; struct tls_s* next; -}tls_t; - +}; tls_t* g_tls=NULL; void* WINAPI expTlsAlloc() @@ -1131,12 +1127,12 @@ long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* result=i; } if(s1) - dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s', - size %d, dest buffer 0x%x, dest size %d) => %d\n", + dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s', " + "size %d, dest buffer 0x%x, dest size %d) => %d\n", v1, v2, s1, s1, siz1, s2, siz2, result); else - dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL, - size %d, dest buffer 0x%x, dest size %d) =>\n", + dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL, " + "size %d, dest buffer 0x%x, dest size %d) =>\n", v1, v2, siz1, s2, siz2, result); return result; } @@ -1305,7 +1301,86 @@ long WINAPI expQueryPerformanceCounter(long long* z) return 1; } -static double old_freq() +/* + * return CPU clock (in kHz), using linux's /proc filesystem (/proc/cpuinfo) + */ +static double linux_cpuinfo_freq() +{ + double freq=-1; + FILE *f; + char line[200]; + char *s,*value; + + f = fopen ("/proc/cpuinfo", "r"); + if (f != NULL) { + while (fgets(line,sizeof(line),f)!=NULL) { + /* NOTE: the ':' is the only character we can rely on */ + if (!(value = strchr(line,':'))) + continue; + /* terminate the valuename */ + *value++ = '\0'; + /* skip any leading spaces */ + while (*value==' ') value++; + if ((s=strchr(value,'\n'))) + *s='\0'; + + if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz")) + && sscanf(value, "%lf", &freq) == 1) { + freq*=1000; + break; + } + } + fclose(f); + } + return freq; +} + + +static double +solaris_kstat_freq() +{ +#if HAVE_LIBKSTAT + /* + * try to extract the CPU speed from the solaris kernel's kstat data + */ + kstat_ctl_t *kc; + kstat_t *ksp; + kstat_named_t *kdata; + int mhz = 0; + + kc = kstat_open(); + if (kc != NULL) + { + ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0"); + + /* kstat found and name/value pairs? */ + if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED) + { + /* read the kstat data from the kernel */ + if (kstat_read(kc, ksp, NULL) != -1) + { + /* + * lookup desired "clock_MHz" entry, check the expected + * data type + */ + kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz"); + if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32) + mhz = kdata->value.i32; + } + } + kstat_close(kc); + } + + if (mhz > 0) + return mhz * 1000.; +#endif /* HAVE_LIBKSTAT */ + return -1; // kstat stuff is not available, CPU freq is unknown +} + +/* + * Measure CPU freq using the pentium's time stamp counter register (TSC) + */ +static double tsc_freq() { static double ofreq=0.0; int i; @@ -1320,48 +1395,18 @@ static double old_freq() ofreq = (double)(y-x)/1000.; return ofreq; } + static double CPU_Freq() { -//#ifdef USE_TSC - FILE *f = fopen ("/proc/cpuinfo", "r"); - char line[200]; - char model[200]="unknown"; - char flags[500]=""; - char *s,*value; - double freq=-1; + double freq; - if (!f) - { - //printf("Can't open /proc/cpuinfo for reading\n"); - return old_freq(); - } - while (fgets(line,200,f)!=NULL) - { - /* NOTE: the ':' is the only character we can rely on */ - if (!(value = strchr(line,':'))) - continue; - /* terminate the valuename */ - *value++ = '\0'; - /* skip any leading spaces */ - while (*value==' ') value++; - if ((s=strchr(value,'\n'))) - *s='\0'; + if ((freq = linux_cpuinfo_freq()) > 0) + return freq; - if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))) - { - sscanf(value, "%lf", &freq); - freq*=1000; - break; - } - continue; - - } - fclose(f); - if(freq<0)return old_freq(); + if ((freq = solaris_kstat_freq()) > 0) return freq; -//#else -// return old_freq(); -//#endif + + return tsc_freq(); } long WINAPI expQueryPerformanceFrequency(long long* z) @@ -1658,12 +1703,12 @@ long WINAPI expCreateFileMappingA(int hFile, void* lpAttr, { long result=CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name); if(!name) - dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, - flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n", + dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, " + "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n", hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, result); else - dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, - flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n", + dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, " + "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n", hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name, name, result); return result; } @@ -2746,7 +2791,7 @@ void* LookupExternalByName(const char* library, const char* name) // return (void*)ext_unknown; } -int my_garbagecollection() +int my_garbagecollection(void) { #ifdef GARBAGE alc_list* pp,*ppsv; diff --git a/loader/win32.h b/loader/win32.h index 327cfb2989..e5db659438 100644 --- a/loader/win32.h +++ b/loader/win32.h @@ -1 +1,210 @@ -int ext_unknown(); +#ifndef loader_win32_h +#define loader_win32_h + +#include + +#include +#include +#include + +extern void* my_mreq(int size, int to_zero); +extern int my_release(void* memory); +extern int my_size(char* memory); +extern int my_garbagecollection(void); + + +typedef struct { + UINT uDriverSignature; + HINSTANCE hDriverModule; + DRIVERPROC DriverProc; + DWORD dwDriverID; +} DRVR; + +typedef DRVR *PDRVR; +typedef DRVR *NPDRVR; +typedef DRVR *LPDRVR; + +typedef struct tls_s tls_t; + +extern int WINAPI ext_unknown(void); + +extern int WINAPI expIsBadWritePtr(void* ptr, unsigned int count); +extern int WINAPI expIsBadReadPtr(void* ptr, unsigned int count); +extern int WINAPI expDisableThreadLibraryCalls(int module); +extern void* WINAPI expGetDriverModuleHandle(DRVR* pdrv); +extern void* WINAPI expGetModuleHandleA(const char* name); +extern void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, void* lpStartAddress, + void* lpParameter, long dwFlags, long* dwThreadId); +extern void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset, + char bInitialState, const char* name); +extern void* WINAPI expSetEvent(void* event); +extern void* WINAPI expResetEvent(void* event); +extern void* WINAPI expWaitForSingleObject(void* object, int duration); +extern WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v); +extern void WINAPI expGetSystemInfo(SYSTEM_INFO* si); +extern long WINAPI expGetVersion(void); +long WINAPI expGetVersionExA(OSVERSIONINFOA* c); +extern HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size); +extern void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size); +extern long WINAPI expHeapDestroy(void* heap); +extern long WINAPI expHeapFree(int arg1, int arg2, void* ptr); +extern long WINAPI expHeapSize(int heap, int flags, void* pointer); +extern long WINAPI expGetProcessHeap(void); +extern void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4); +extern int WINAPI expVirtualFree(void* v1, int v2, int v3); +extern void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c); +extern void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c); +extern void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c); +extern void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c); +extern int WINAPI expGetCurrentThreadId(void); +extern int WINAPI expGetCurrentProcess(void); +extern void* WINAPI expTlsAlloc(void); +extern int WINAPI expTlsSetValue(tls_t* index, void* value); +extern void* WINAPI expTlsGetValue(tls_t* index); +extern int WINAPI expTlsFree(tls_t* index); +extern void* WINAPI expLocalAlloc(int flags, int size); +extern void* WINAPI expLocalLock(void* z); +extern void* WINAPI expGlobalAlloc(int flags, int size); +extern void* WINAPI expGlobalLock(void* z); +extern int WINAPI expLoadStringA(long instance, long id, void* buf, long size); +extern long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2); +extern long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3); +extern long WINAPI expGetVersionExA(OSVERSIONINFOA* c); +extern HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name); +extern long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count); +extern long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey); +extern long WINAPI expRegCloseKey(long key); + +extern long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count); +extern long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved, + void* classs, long options, long security, + void* sec_attr, int* newkey, int* status); +extern long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size); +extern long WINAPI expRegOpenKeyA (long hKey, LPCSTR lpSubKey, int* phkResult); +extern long WINAPI expQueryPerformanceCounter(long long* z); +extern long WINAPI expQueryPerformanceFrequency(long long* z); +extern long WINAPI exptimeGetTime(void); +extern void* WINAPI expLocalHandle(void* v); +extern void* WINAPI expGlobalHandle(void* v); +extern int WINAPI expGlobalUnlock(void* v); +extern void* WINAPI expGlobalFree(void* v); +extern void* WINAPI expGlobalReAlloc(void* v, int size, int flags); +extern int WINAPI expLocalUnlock(void* v); +extern void* WINAPI expLocalFree(void* v); +extern HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type); +extern HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res); +extern void* WINAPI expLockResource(long res); +extern int WINAPI expFreeResource(long res); +extern int WINAPI expCloseHandle(long v1); +extern const char* WINAPI expGetCommandLineA(void); +extern LPWSTR WINAPI expGetEnvironmentStringsW(void); +extern void * WINAPI expRtlZeroMemory(void *p, size_t len); +extern void * WINAPI expRtlMoveMemory(void *dst, void *src, size_t len); +extern void * WINAPI expRtlFillMemory(void *p, int ch, size_t len); +extern int WINAPI expFreeEnvironmentStringsW(short* strings); +extern int WINAPI expFreeEnvironmentStringsA(char* strings); +extern LPWSTR WINAPI expGetEnvironmentStringsW(void); +LPCSTR WINAPI expGetEnvironmentStrings(void); +extern int WINAPI expGetStartupInfoA(STARTUPINFOA *s); +extern int WINAPI expGetStdHandle(int z); +extern int WINAPI expGetFileType(int handle); +extern int WINAPI expSetHandleCount(int count); +extern int WINAPI expGetACP(void); +extern int WINAPI expGetModuleFileNameA(int module, char* s, int len); +extern int WINAPI expSetUnhandledExceptionFilter(void* filter); +extern int WINAPI expLoadLibraryA(char* name); +extern int WINAPI expFreeLibrary(int module); +extern void* WINAPI expGetProcAddress(HMODULE mod, char* name); +extern long WINAPI expCreateFileMappingA(int hFile, void* lpAttr, + long flProtect, long dwMaxHigh, long dwMaxLow, const char* name); +extern long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name); +extern void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, DWORD offLow, DWORD size); +extern void* WINAPI expUnmapViewOfFile(void* view); +extern void* WINAPI expSleep(int time); +extern void* WINAPI expCreateCompatibleDC(int hdc); +extern int WINAPI expGetDeviceCaps(int hdc, int unk); +extern WIN_BOOL WINAPI expDeleteDC(int hdc); +extern int WINAPI expGetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename); +extern int WINAPI expGetProfileIntA(const char* appname, const char* keyname, int default_value); +extern int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname, + const char* def_val, char* dest, unsigned int len, const char* filename); +extern int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keyname, + const char* string, const char* filename); +extern int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2); +extern int WINAPI expSizeofResource(int v1, int v2); +extern int WINAPI expGetLastError(void); +extern void WINAPI expSetLastError(int error); +extern long WINAPI exptimeGetTime(void); +extern int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax); +extern int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle); +extern int WINAPI expIsBadStringPtrW(const short* string, int nchars); +extern int WINAPI expIsBadStringPtrA(const char* string, int nchars); +extern long WINAPI expInterlockedIncrement( long* dest ); +extern long WINAPI expInterlockedDecrement( long* dest ); +extern void WINAPI expOutputDebugStringA( const char* string ); +extern int WINAPI expGetDC(int hwnd); +extern int WINAPI expGetDesktopWindow(void); +extern int WINAPI expReleaseDC(int hwnd, int hdc); +extern int WINAPI expLoadCursorA(int handle,LPCSTR name); +extern int WINAPI expSetCursor(void *cursor); +extern int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe); +extern int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation); +extern void WINAPI expGetLocalTime(SYSTEMTIME* systime); +extern int WINAPI expGetSystemTime(SYSTEMTIME* systime); +extern int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size); +extern void* WINAPI expCoTaskMemAlloc(ULONG cb); +extern void WINAPI expCoTaskMemFree(void* cb); +extern long WINAPI expCoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, + long dwClsContext, GUID* riid, void** ppv); +extern int WINAPI expIsRectEmpty(CONST RECT *lprc); +extern unsigned int WINAPI expGetTempPathA(unsigned int len, char* path); +extern HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd); +extern WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA p); +extern WIN_BOOL WINAPI expFindClose(HANDLE h); +extern UINT WINAPI expSetErrorMode(UINT i); +extern UINT WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c); +extern WIN_BOOL WINAPI expDeleteFileA(LPCSTR s); +extern WIN_BOOL WINAPI expFileTimeToLocalFileTime(const FILETIME* cpf, LPFILETIME pf); +extern UINT WINAPI expGetTempFileNameA(LPCSTR cs1,LPCSTR cs2,UINT i,LPSTR ps); +extern HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2, + LPSECURITY_ATTRIBUTES p1, DWORD i3,DWORD i4,HANDLE i5); +extern LPCSTR WINAPI expGetSystemDirectoryA(void); +extern WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused); +extern WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LPOVERLAPPED unused); +extern DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence); +extern HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName, + LPARAM lParam2); +HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName, + LPARAM lParam2) ; +extern WIN_BOOL WINAPI expGetProcessAffinityMask(HANDLE hProcess, + LPDWORD lpProcessAffinityMask, + LPDWORD lpSystemAffinityMask); +extern DWORD WINAPI expRegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count, + LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count ); +extern INT WINAPI expMulDiv(int nNumber,int nNumerator,int nDenominator); +extern LONG WINAPI explstrcmpiA(const char* str1, const char* str2); +extern LONG WINAPI explstrlenA(const char* str1); +extern LONG WINAPI explstrcpyA(char* str1, const char* str2); +extern LONG WINAPI expInterlockedExchange(long *dest, long l); + +extern void* CDECL expmalloc(int size); +extern void CDECL expfree(void* mem); +extern void* CDECL expnew(int size); +extern int CDECL expdelete(void* memory); +extern int CDECL exp_initterm(int v1, int v2); + +extern int expwsprintfA(char* string, char* format, ...); +extern char* expstrrchr(char* string, int value); +extern char* expstrchr(char* string, int value); +extern int expstrlen(char* str); +extern int expstrcpy(char* str1, const char* str2); +extern int expstrcmp(const char* str1, const char* str2); +extern int expstrcat(char* str1, const char* str2); +extern int expisalnum(int c); +extern int expmemmove(void* dest, void* src, int n); +extern int expmemcmp(void* dest, void* src, int n); +extern void *expmemcpy(void* dest, void* src, int n) ; +extern time_t exptime(time_t* t); +extern void* LookupExternal(const char* library, int ordinal); + +#endif diff --git a/loader/wine/config.h b/loader/wine/config.h deleted file mode 100644 index dc651b3d89..0000000000 --- a/loader/wine/config.h +++ /dev/null @@ -1,442 +0,0 @@ -/* include/config.h. Generated automatically by configure. */ -/* include/config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have and it should be used (not on Ultrix). */ -#define HAVE_ALLOCA_H 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -/* #undef STACK_DIRECTION */ - -/* Define if the `S_IS*' macros in do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Define if symbols declared in assembly code need an underscore prefix */ -/* #undef NEED_UNDERSCORE_PREFIX */ - -/* Define to use .string instead of .ascii */ -#define HAVE_ASM_STRING 1 - -/* Define if struct msghdr contains msg_accrights */ -/* #undef HAVE_MSGHDR_ACCRIGHTS */ - -/* Define if struct sockaddr_un contains sun_len */ -/* #undef HAVE_SOCKADDR_SUN_LEN */ - -/* Define if you have the Xxf86dga library (-lXxf86dga). */ -#define HAVE_LIBXXF86DGA 1 - -/* Define if you have the Xxf86dga library version 2.0 (-lXxf86dga). */ -/* #undef HAVE_LIBXXF86DGA2 */ - -/* Define if you have the X Shm extension */ -#define HAVE_LIBXXSHM 1 - -/* Define if you have the Xxf86vm library */ -#define HAVE_LIBXXF86VM 1 - -/* Define if you have the Xpm library */ -#define HAVE_LIBXXPM 1 - -/* Define if you have the Open Sound system. */ -#define HAVE_OSS 1 - -/* Define if you have the Open Sound system (MIDI interface). */ -#define HAVE_OSS_MIDI 1 - -/* Define if X libraries are not reentrant (compiled without -D_REENTRANT). */ -/* #undef NO_REENTRANT_X11 */ - -/* Define if libc is not reentrant */ -/* #undef NO_REENTRANT_LIBC */ - -/* Define if libc uses __errno_location for reentrant errno */ -#define HAVE__ERRNO_LOCATION 1 - -/* Define if libc uses __error for reentrant errno */ -/* #undef HAVE__ERROR */ - -/* Define if libc uses ___errno for reentrant errno */ -/* #undef HAVE___ERRNO */ - -/* Define if libc uses __thr_errno for reentrant errno */ -/* #undef HAVE__THR_ERRNO */ - -/* Define if all debug messages are to be compiled out */ -/* #undef NO_DEBUG_MSGS */ - -/* Define if TRACE messages are to be compiled out */ -/* #undef NO_TRACE_MSGS */ - -/* Define if the struct statfs has the member bavail */ -#define STATFS_HAS_BAVAIL 1 - -/* Define if the struct statfs has the member bfree */ -#define STATFS_HAS_BFREE 1 - -/* Define if the struct statfs is defined by */ -#define STATFS_DEFINED_BY_SYS_VFS 1 - -/* Define if the struct statfs is defined by */ -#define STATFS_DEFINED_BY_SYS_STATFS 1 - -/* Define if the struct statfs is defined by */ -/* #undef STATFS_DEFINED_BY_SYS_MOUNT */ - -/* Define if ncurses have the new resizeterm function */ -#define HAVE_RESIZETERM 1 - -/* Define if ncurses have the new getbkgd function */ -#define HAVE_GETBKGD 1 - -/* Define if IPX should use netipx/ipx.h from libc */ -#define HAVE_IPX_GNU 1 - -/* Define if IPX includes are taken from Linux kernel */ -/* #undef HAVE_IPX_LINUX */ - -/* Define if Mesa is present on the system or not */ -/* #undef HAVE_LIBMESAGL */ - -/* Define if the system has dynamic link library support with the dl* API */ -#define HAVE_DL_API 1 - -/* Define if defines the Linux 2.2 joystick API */ -#define HAVE_LINUX_22_JOYSTICK_API 1 - -/* Define if the OpenGL implementation supports the GL_EXT_color_table extension */ -/* #undef HAVE_GL_COLOR_TABLE */ - -/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */ -/* #undef HAVE_GL_PALETTED_TEXTURE */ - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* Define if you have the __libc_fork function. */ -/* #undef HAVE___LIBC_FORK */ - -/* Define if you have the _lwp_create function. */ -/* #undef HAVE__LWP_CREATE */ - -/* Define if you have the clone function. */ -#define HAVE_CLONE 1 - -/* Define if you have the connect function. */ -#define HAVE_CONNECT 1 - -/* Define if you have the dlopen function. */ -/* #undef HAVE_DLOPEN */ - -/* Define if you have the gethostbyname function. */ -#define HAVE_GETHOSTBYNAME 1 - -/* Define if you have the getnetbyaddr function. */ -#define HAVE_GETNETBYADDR 1 - -/* Define if you have the getnetbyname function. */ -#define HAVE_GETNETBYNAME 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the getprotobyname function. */ -#define HAVE_GETPROTOBYNAME 1 - -/* Define if you have the getprotobynumber function. */ -#define HAVE_GETPROTOBYNUMBER 1 - -/* Define if you have the getservbyport function. */ -#define HAVE_GETSERVBYPORT 1 - -/* Define if you have the getsockopt function. */ -#define HAVE_GETSOCKOPT 1 - -/* Define if you have the inet_network function. */ -#define HAVE_INET_NETWORK 1 - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the openpty function. */ -#define HAVE_OPENPTY 1 - -/* Define if you have the rfork function. */ -/* #undef HAVE_RFORK */ - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the sendmsg function. */ -#define HAVE_SENDMSG 1 - -/* Define if you have the settimeofday function. */ -#define HAVE_SETTIMEOFDAY 1 - -/* Define if you have the sigaltstack function. */ -#define HAVE_SIGALTSTACK 1 - -/* Define if you have the statfs function. */ -#define HAVE_STATFS 1 - -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strncasecmp function. */ -#define HAVE_STRNCASECMP 1 - -/* Define if you have the tcgetattr function. */ -#define HAVE_TCGETATTR 1 - -/* Define if you have the timegm function. */ -#define HAVE_TIMEGM 1 - -/* Define if you have the usleep function. */ -#define HAVE_USLEEP 1 - -/* Define if you have the vfscanf function. */ -#define HAVE_VFSCANF 1 - -/* Define if you have the wait4 function. */ -#define HAVE_WAIT4 1 - -/* Define if you have the waitpid function. */ -#define HAVE_WAITPID 1 - -/* Define if you have the header file. */ -/* #undef HAVE_GL_GL_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_GL_GLX_H */ - -/* Define if you have the header file. */ -#define HAVE_X11_XLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_X11_EXTENSIONS_XSHM_H 1 - -/* Define if you have the header file. */ -#define HAVE_X11_EXTENSIONS_XF86DGA_H 1 - -/* Define if you have the header file. */ -#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1 - -/* Define if you have the header file. */ -#define HAVE_X11_XPM_H 1 - -/* Define if you have the header file. */ -#define HAVE_A_OUT_H 1 - -/* Define if you have the header file. */ -#define HAVE_A_OUT_H 1 - -/* Define if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define if you have the header file. */ -#define HAVE_ARPA_NAMESER_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_CURSES_H */ - -/* Define if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if you have the header file. */ -#define HAVE_ELF_H 1 - -/* Define if you have the header file. */ -#define HAVE_FLOAT_H 1 - -/* Define if you have the header file. */ -#define HAVE_LIBIO_H 1 - -/* Define if you have the header file. */ -#define HAVE_LINK_H 1 - -/* Define if you have the header file. */ -#define HAVE_LINUX_CDROM_H 1 - -/* Define if you have the header file. */ -#define HAVE_LINUX_JOYSTICK_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_LINUX_UCDROM_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_MACHINE_SOUNDCARD_H */ - -/* Define if you have the header file. */ -#define HAVE_NCURSES_H 1 - -/* Define if you have the header file. */ -#define HAVE_NET_IF_H 1 - -/* Define if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define if you have the header file. */ -#define HAVE_NETINET_TCP_H 1 - -/* Define if you have the header file. */ -#define HAVE_PTY_H 1 - -/* Define if you have the header file. */ -#define HAVE_RESOLV_H 1 - -/* Define if you have the header file. */ -#define HAVE_SCHED_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SOCKET_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SOUNDCARD_H */ - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_CDIO_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_ERRNO_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FILIO_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_IPC_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_LWP_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_MODEM_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_MOUNT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_MSG_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_REG_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SHM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SIGNAL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_SOCKIO_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_SOUNDCARD_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STATFS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_STRTIO_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_SYSCALL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_V86_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_V86INTR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_VFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_VM86_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYSCALL_H 1 - -/* Define if you have the header file. */ -#define HAVE_UCONTEXT_H 1 - -/* Define if you have the header file. */ -#define HAVE_WCTYPE_H 1 - -/* Define if you have the curses library (-lcurses). */ -/* #undef HAVE_LIBCURSES */ - -/* Define if you have the i386 library (-li386). */ -/* #undef HAVE_LIBI386 */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the mmap library (-lmmap). */ -/* #undef HAVE_LIBMMAP */ - -/* Define if you have the ncurses library (-lncurses). */ -#define HAVE_LIBNCURSES 1 - -/* Define if you have the ossaudio library (-lossaudio). */ -/* #undef HAVE_LIBOSSAUDIO */ - -/* Define if you have the w library (-lw). */ -/* #undef HAVE_LIBW */ - -/* Define if you have the xpg4 library (-lxpg4). */ -/* #undef HAVE_LIBXPG4 */ diff --git a/loader/wine/vfw.h b/loader/wine/vfw.h index a72da79c89..85bce6d983 100644 --- a/loader/wine/vfw.h +++ b/loader/wine/vfw.h @@ -442,7 +442,7 @@ LRESULT VFWAPI ICClose(HIC hic); LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2); HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags); -int VFWAPI ICDoSomething(); +int VFWAPI ICDoSomething(void); long VFWAPIV ICDrawBegin( HIC hic, -- cgit v1.2.3