diff options
-rw-r--r-- | src/libw32dll/w32codec.c | 66 | ||||
-rw-r--r-- | src/libw32dll/wine/Makefile.am | 12 | ||||
-rw-r--r-- | src/libw32dll/wine/afl.c | 5 | ||||
-rw-r--r-- | src/libw32dll/wine/config.h | 5 | ||||
-rw-r--r-- | src/libw32dll/wine/driver.c | 25 | ||||
-rw-r--r-- | src/libw32dll/wine/driver.h | 3 | ||||
-rw-r--r-- | src/libw32dll/wine/elfdll.c | 5 | ||||
-rw-r--r-- | src/libw32dll/wine/ext.c | 102 | ||||
-rw-r--r-- | src/libw32dll/wine/ext.h | 15 | ||||
-rw-r--r-- | src/libw32dll/wine/loader.h | 2 | ||||
-rw-r--r-- | src/libw32dll/wine/module.c | 2 | ||||
-rw-r--r-- | src/libw32dll/wine/pe_image.c | 8 | ||||
-rw-r--r-- | src/libw32dll/wine/pe_resource.c | 1 | ||||
-rw-r--r-- | src/libw32dll/wine/registry.c | 14 | ||||
-rw-r--r-- | src/libw32dll/wine/resource.c | 1 | ||||
-rw-r--r-- | src/libw32dll/wine/resource.h | 9 | ||||
-rw-r--r-- | src/libw32dll/wine/vfl.c | 38 | ||||
-rw-r--r-- | src/libw32dll/wine/win32.c | 32 | ||||
-rw-r--r-- | src/libw32dll/wine/win32.h | 215 |
19 files changed, 413 insertions, 147 deletions
diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index a74b843fa..fece0e57e 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: w32codec.c,v 1.8 2001/06/21 17:34:23 guenter Exp $ + * $Id: w32codec.c,v 1.9 2001/07/04 14:05:09 uid56437 Exp $ * * routines for using w32 codecs * @@ -55,7 +55,8 @@ typedef struct w32v_decoder_s { int flipped ; unsigned char buf[128*1024]; void *our_out_buffer; - int size; + int size; + long outfmt; } w32v_decoder_t; typedef struct w32a_decoder_s { @@ -162,7 +163,12 @@ static char* get_vids_codec_name(w32v_decoder_t *this, return NULL; } -#define IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y') +#define IMGFMT_YUY2 mmioFOURCC('Y','U','Y','2') +#define IMGFMT_YV12 mmioFOURCC('Y','V','1','2') +#define IMGFMT_32RGB mmioFOURCC( 32,'R','G','B') +#define IMGFMT_24RGB mmioFOURCC( 24,'R','G','B') +#define IMGFMT_16RGB mmioFOURCC( 16,'R','G','B') +#define IMGFMT_15RGB mmioFOURCC( 15,'R','G','B') static int w32v_can_handle (video_decoder_t *this_gen, int buf_type) { return ((buf_type & 0xFFFF0000) == BUF_VIDEO_AVI) ; @@ -180,7 +186,19 @@ static void w32v_init (video_decoder_t *this_gen, vo_instance_t *video_out) { static void w32v_init_codec (w32v_decoder_t *this) { HRESULT ret; - int outfmt = IMGFMT_YUY2; + uint32_t vo_cap; + int outfmt; + + vo_cap = this->video_out->get_capabilities (this->video_out); + if (vo_cap & VO_CAP_YUY2) + outfmt = IMGFMT_YUY2; + else if (vo_cap & VO_CAP_YV12) + outfmt = IMGFMT_YV12; + else { + printf ("video output driver doesn't support YUY2/YV12 !!\n"); + this->decoder_ok = 0; + return; + } memset(&this->o_bih, 0, sizeof(BITMAPINFOHEADER)); this->o_bih.biSize = sizeof(BITMAPINFOHEADER); @@ -203,10 +221,12 @@ static void w32v_init_codec (w32v_decoder_t *this) { if(outfmt==IMGFMT_YUY2) this->o_bih.biBitCount=16; + else if (outfmt==IMGFMT_YV12) + this->o_bih.biBitCount=12; else this->o_bih.biBitCount=outfmt&0xFF;// //24; - this->o_bih.biSizeImage = this->o_bih.biWidth*this->o_bih.biHeight*(this->o_bih.biBitCount/8); + this->o_bih.biSizeImage = this->o_bih.biWidth*this->o_bih.biHeight*this->o_bih.biBitCount/8; /* if(!flipped) @@ -216,6 +236,8 @@ static void w32v_init_codec (w32v_decoder_t *this) { if(outfmt==IMGFMT_YUY2 && !this->yuv_hack_needed) this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); + else if(outfmt==IMGFMT_YV12 && !this->yuv_hack_needed) + this->o_bih.biCompression = mmioFOURCC('Y','V','1','2'); ret = ICDecompressQuery(this->hic, &this->bih, &this->o_bih); @@ -232,22 +254,19 @@ static void w32v_init_codec (w32v_decoder_t *this) { return; } - if (this->yuv_hack_needed) { + if (outfmt==IMGFMT_YUY2 && this->yuv_hack_needed) { this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); + } else if (outfmt==IMGFMT_YV12 && this->yuv_hack_needed) { + this->o_bih.biCompression = mmioFOURCC('Y','V','1','2'); } this->size = 0; - if (!( (this->video_out->get_capabilities (this->video_out)) & VO_CAP_YUY2)) { - printf ("video output driver doesn't support YUY2 !!\n"); - this->decoder_ok = 0; - return; - } - this->our_out_buffer = malloc (this->o_bih.biSizeImage); this->video_out->open (this->video_out); + this->outfmt = outfmt; this->decoder_ok = 1; } @@ -288,7 +307,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->bih.biWidth, this->bih.biHeight, 42, - IMGFMT_YUY2, + this->outfmt /*IMGFMT_YUY2*/, this->video_step); ret = ICDecompress(this->hic, ICDECOMPRESS_NOTKEYFRAME, @@ -302,6 +321,25 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } else img->bFrameBad = 0; + if (img->copy) { +#warning: need to check 'dest' stuff for the YUY2 case + /* note: dest stuff works with video_out_xshm & YV12 */ + + int height = abs(this->o_bih.biHeight); + int stride = this->o_bih.biWidth; + uint8_t* dest[3]; + + dest[0] = img->base[0]; + dest[2] = dest[0] + height * this->o_bih.biWidth; + dest[1] = dest[2] + height * this->o_bih.biWidth / 4; + while ((height -= 16) >= 0) { + img->copy(img, dest); + dest[0] += 16 * stride; + dest[1] += 4 * stride; + dest[2] += 4 * stride; + } + } + img->draw(img); img->free(img); @@ -329,7 +367,7 @@ static char *w32v_get_id(void) { static int w32a_can_handle (audio_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_AUDIO_AVI) ; + return ((buf_type & 0xFFFF0000) == BUF_AUDIO_AVI); } static char* get_auds_codec_name(w32a_decoder_t *this, int id){ diff --git a/src/libw32dll/wine/Makefile.am b/src/libw32dll/wine/Makefile.am index 9c32a5bdc..3d2539a09 100644 --- a/src/libw32dll/wine/Makefile.am +++ b/src/libw32dll/wine/Makefile.am @@ -3,14 +3,14 @@ EXTRA_DIST = stubs.s noinst_LTLIBRARIES = $(wine_lib) ## -## this wine lib seems to be very sensitive with cflags, so we override -## all of them. ## -CFLAGS = @BUILD_LIB_STATIC@ -fno-omit-frame-pointer @X_CFLAGS@ \ - -DWIN32_PATH=\"@w32_path@\" -D_REENTRANT -pipe +CFLAGS = @GLOBAL_CFLAGS@@BUILD_LIB_STATIC@ @X_CFLAGS@ -fno-omit-frame-pointer \ + -Wmissing-prototypes -Wimplicit-function-declaration \ + -DWIN32_PATH=\"@w32_path@\" -DEBUG_CFLAGS = @BUILD_LIB_STATIC@ -fno-omit-frame-pointer @X_CFLAGS@ \ - -DWIN32_PATH=\\\"@w32_path@\\\" -D_REENTRANT -pipe -g +DEBUG_CFLAGS = @DEBUG_CFLAGS@ @BUILD_LIB_STATIC@ @X_CFLAGS@ -fno-omit-frame-pointer \ + -Wmissing-prototypes -Wimplicit-function-declaration \ + -DWIN32_PATH=\\\"@w32_path@\\\" if HAVE_W32DLL diff --git a/src/libw32dll/wine/afl.c b/src/libw32dll/wine/afl.c index 2a6768db0..9e009d331 100644 --- a/src/libw32dll/wine/afl.c +++ b/src/libw32dll/wine/afl.c @@ -22,6 +22,7 @@ #include "config.h" #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "winbase.h" @@ -38,9 +39,7 @@ #pragma pack(1) #define OpenDriverA DrvOpen -extern HDRVR VFWAPI DrvOpen(long); #define CloseDriver DrvClose -extern HDRVR VFWAPI DrvClose(long); static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) { @@ -274,7 +273,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, { PWINE_ACMDRIVERID padid; - TRACE("('%s', '%x', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule); + TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid->pszDriverAlias = (char*)malloc(strlen(pszDriverAlias)+1); diff --git a/src/libw32dll/wine/config.h b/src/libw32dll/wine/config.h index 1809714b8..f10850d9e 100644 --- a/src/libw32dll/wine/config.h +++ b/src/libw32dll/wine/config.h @@ -3,7 +3,9 @@ * we need all these tests and checks in our * configure.in */ - +#if 1 +#include "../../config.h" +#else /* include/config.h. Generated automatically by configure. */ /* include/config.h.in. Generated automatically from configure.in by autoheader. */ @@ -447,3 +449,4 @@ /* Define if you have the xpg4 library (-lxpg4). */ /* #undef HAVE_LIBXPG4 */ +#endif diff --git a/src/libw32dll/wine/driver.c b/src/libw32dll/wine/driver.c index e0820d4c8..53d82ccb5 100644 --- a/src/libw32dll/wine/driver.c +++ b/src/libw32dll/wine/driver.c @@ -11,14 +11,17 @@ #include "pe_image.h" #include "winreg.h" #include "vfw.h" +#include "win32.h" #include "registry.h" #ifdef __FreeBSD__ #include <sys/time.h> #endif -//#define WIN32_PATH "/usr/lib/win32" - +#if 1 +#define STORE_ALL /**/ +#define REST_ALL /**/ +#else #define STORE_ALL \ __asm__ ( \ "push %%ebx\n\t" \ @@ -34,20 +37,10 @@ "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; @@ -115,8 +108,8 @@ void DrvClose(HDRVR hdrvr) } -#ifndef STATIC_WIN32_PATH -char* def_path=WIN32_PATH; // path to codecs +#ifdef WIN32_PATH +char* def_path=WIN32_PATH; // path to codecs #else char* def_path="/usr/lib/win32"; // path to codecs #endif @@ -125,7 +118,7 @@ char* win32_codec_name=NULL; // must be set before calling DrvOpen() !!! HDRVR DrvOpen(LPARAM lParam2) { - ICOPEN *icopen=lParam2; + ICOPEN *icopen=(ICOPEN*)lParam2; UINT uDrvResult; HDRVR hDriver; NPDRVR npDriver; diff --git a/src/libw32dll/wine/driver.h b/src/libw32dll/wine/driver.h index dc8661aa3..e9c9f9d04 100644 --- a/src/libw32dll/wine/driver.h +++ b/src/libw32dll/wine/driver.h @@ -109,4 +109,7 @@ DWORD WINAPI GetDriverFlags( HDRVR hDriver ); #define WINE_GDF_16BIT 0x10000000 #endif +extern HDRVR DrvOpen(LPARAM lParam2); +extern void DrvClose(HDRVR hdrvr); + #endif /* __WINE_DRIVER_H */ diff --git a/src/libw32dll/wine/elfdll.c b/src/libw32dll/wine/elfdll.c index 3b6923668..b8fe03d74 100644 --- a/src/libw32dll/wine/elfdll.c +++ b/src/libw32dll/wine/elfdll.c @@ -40,11 +40,6 @@ modref_list; extern modref_list* local_wm; -/*------------------ HACKS -----------------*/ -extern DWORD fixup_imports(WINE_MODREF *wm); -extern void dump_exports(HMODULE hModule); -/*---------------- END HACKS ---------------*/ - //char *extra_ld_library_path = "/usr/lib/win32"; extern char* def_path; diff --git a/src/libw32dll/wine/ext.c b/src/libw32dll/wine/ext.c index 1847d6b34..865ff73d9 100644 --- a/src/libw32dll/wine/ext.c +++ b/src/libw32dll/wine/ext.c @@ -6,20 +6,23 @@ * ********************************************************/ #include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> #ifdef HAVE_MALLOC_H #include <malloc.h> -#else -#include <stdlib.h> #endif -#include <stdio.h> -#include <unistd.h> #include <sys/mman.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <stdarg.h> #include "windef.h" -//#include "winbase.h" +#include "winbase.h" +#include "debugtools.h" +#include "heap.h" +#include "ext.h" + int dbg_header_err( const char *dbg_channel, const char *func ) { return 0; @@ -36,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; } @@ -52,12 +55,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); @@ -65,7 +68,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) { free(mem); return 1; @@ -73,34 +76,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(LPCSTR c1, LPCSTR c2) { return strcasecmp(c1,c2); } -int lstrcpynA(char* dest, const char* src, int num) +char* WINAPI lstrcpynA(char* dest, const char* 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) @@ -110,8 +113,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 retval = dest; int moved=0; if((dest==0) || (src==0)) return 0; @@ -120,10 +124,11 @@ int lstrcpynWtoA(char* dest, const char* src, int count) *dest=*src; moved++; if(*src==0) - return moved; + break; src++; dest++; } + return retval; } int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n) { @@ -149,7 +154,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; @@ -157,14 +162,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; @@ -176,7 +181,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) +char* HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) { int size, i; char* answer; @@ -305,7 +310,7 @@ typedef struct file_mapping_s { int mapping_size; char* name; - HANDLE handle; + void* handle; struct file_mapping_s* next; struct file_mapping_s* prev; }file_mapping; @@ -324,24 +329,27 @@ 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 hFile, LPSECURITY_ATTRIBUTES lpAttr, + DWORD flProtect, + DWORD dwMaxHigh, DWORD dwMaxLow, + LPCSTR name) { + int filedesc = (int)hFile; unsigned int len; - HANDLE answer; + void* answer; int anon=0; int mmap_access=0; - if(hFile<0) + if(filedesc<0) { anon=1; - hFile=open("/dev/zero", O_RDWR); - if(hFile<0) + filedesc=open("/dev/zero", O_RDWR); + if(filedesc<0) return 0; } if(!anon) { - len=lseek(hFile, 0, SEEK_END); - lseek(hFile, 0, SEEK_SET); + len=lseek(filedesc, 0, SEEK_END); + lseek(filedesc, 0, SEEK_SET); } else len=dwMaxLow; @@ -350,10 +358,10 @@ DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name) else mmap_access |=PROT_READ|PROT_WRITE; - answer=(HANDLE)mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0); + answer=mmap(NULL, len, mmap_access, MAP_PRIVATE, filedesc, 0); if(anon) - close(hFile); - if(answer!=(HANDLE)-1) + close(filedesc); + if(answer!=(void*)-1) { if(fm==0) { @@ -378,12 +386,12 @@ DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name) fm->mapping_size=len; if(anon) - close(hFile); - return answer; + close(filedesc); + return (HANDLE)answer; } return (HANDLE)0; } -int UnmapViewOfFile(HANDLE handle) +WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle) { file_mapping* p; int result; @@ -420,7 +428,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); @@ -490,7 +498,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; @@ -511,8 +519,8 @@ 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) @@ -542,12 +550,12 @@ 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) @@ -559,7 +567,7 @@ HANDLE OpenFileMappingA(long access, long prot, char* name) if(p->name==0) continue; if(strcmp(p->name, name)==0) - return p->handle; + return (HANDLE)p->handle; } return 0; } diff --git a/src/libw32dll/wine/ext.h b/src/libw32dll/wine/ext.h new file mode 100644 index 000000000..8cbea2a1b --- /dev/null +++ b/src/libw32dll/wine/ext.h @@ -0,0 +1,15 @@ + +#ifndef loader_ext_h +#define loader_ext_h + +#include "windef.h" + +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/src/libw32dll/wine/loader.h b/src/libw32dll/wine/loader.h index e2ee82c75..d26e0d876 100644 --- a/src/libw32dll/wine/loader.h +++ b/src/libw32dll/wine/loader.h @@ -49,7 +49,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); #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ diff --git a/src/libw32dll/wine/module.c b/src/libw32dll/wine/module.c index 1d4415838..9b921b09b 100644 --- a/src/libw32dll/wine/module.c +++ b/src/libw32dll/wine/module.c @@ -209,7 +209,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) diff --git a/src/libw32dll/wine/pe_image.c b/src/libw32dll/wine/pe_image.c index 123f4ce7d..274813f13 100644 --- a/src/libw32dll/wine/pe_image.c +++ b/src/libw32dll/wine/pe_image.c @@ -34,10 +34,10 @@ * to 4096 byte boundaries on disk. */ #include "config.h" -#include "config.h" #include <errno.h> #include <assert.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -54,7 +54,7 @@ #include "pe_image.h" #include "module.h" #include "debugtools.h" - +#include "ext.h" #include "win32.h" #define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x))) @@ -64,7 +64,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 +236,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; diff --git a/src/libw32dll/wine/pe_resource.c b/src/libw32dll/wine/pe_resource.c index 1620b20c0..6d9bbb7e8 100644 --- a/src/libw32dll/wine/pe_resource.c +++ b/src/libw32dll/wine/pe_resource.c @@ -22,6 +22,7 @@ //#include "process.h" //#include "stackframe.h" #include "debugtools.h" +#include "ext.h" /********************************************************************** * HMODULE32toPE_MODREF diff --git a/src/libw32dll/wine/registry.c b/src/libw32dll/wine/registry.c index 23110ce59..aadf13f5b 100644 --- a/src/libw32dll/wine/registry.c +++ b/src/libw32dll/wine/registry.c @@ -40,14 +40,14 @@ static reg_handle_t* head=0; #define DIR -25 -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 +65,7 @@ static void create_registry(){ reg_size=2; save_registry(); } -static void open_registry() +static void open_registry(void) { int fd; int i; @@ -119,7 +119,7 @@ error: return; } -static void save_registry() +static void save_registry(void) { int fd, i, len; struct passwd* pwent; @@ -225,7 +225,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; diff --git a/src/libw32dll/wine/resource.c b/src/libw32dll/wine/resource.c index ecb3cf90a..5a5079eef 100644 --- a/src/libw32dll/wine/resource.c +++ b/src/libw32dll/wine/resource.c @@ -21,6 +21,7 @@ #include "module.h" #include "debugtools.h" #include "winerror.h" +#include "resource.h" #define CP_ACP 0 WORD WINE_LanguageId=0x409;//english diff --git a/src/libw32dll/wine/resource.h b/src/libw32dll/wine/resource.h new file mode 100644 index 000000000..b4b011a13 --- /dev/null +++ b/src/libw32dll/wine/resource.h @@ -0,0 +1,9 @@ +#ifndef wine_resource_h +#define wine_resource_h + +#include "winbase.h" + +extern INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, + LPSTR buffer, INT buflen ); + +#endif diff --git a/src/libw32dll/wine/vfl.c b/src/libw32dll/wine/vfl.c index 02e6f5b6c..13353d1ad 100644 --- a/src/libw32dll/wine/vfl.c +++ b/src/libw32dll/wine/vfl.c @@ -12,6 +12,8 @@ #include "vfw.h" #include "winestring.h" #include "driver.h" +#include "win32.h" +#include "loader.h" #include "avifmt.h" #define FIXME_(X) printf @@ -19,23 +21,12 @@ long VFWAPI VideoForWindowsVersion(void); -extern void* my_mreq(int size, int to_zero); -extern void DrvClose(HDRVR hdrvr); -extern int my_release(char* memory); - -long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits); - -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); - -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 +#define STORE_ALL /**/ +#define REST_ALL /**/ +#else #define STORE_ALL \ __asm__ ( \ "push %%ebx\n\t" \ @@ -51,14 +42,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] @@ -289,9 +275,11 @@ LRESULT VFWAPI ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) { LRESULT ret; WINE_HIC *whic = (WINE_HIC*)hic; - char qw[200]; +#if 0 + char qw[200]; __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw)); +#endif STORE_ALL; /*__asm__ ( @@ -302,7 +290,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); @@ -323,7 +313,7 @@ LRESULT VFWAPI ICClose(HIC hic) { my_release(whic); return 0; } -int VFWAPI ICDoSomething() +int VFWAPI ICDoSomething(void) { return 0; } diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 294616efc..df06fe53b 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -31,7 +31,7 @@ #include "winerror.h" #include "debugtools.h" #include "module.h" - +#include "resource.h" #include "registry.h" #include "loader.h" @@ -98,7 +98,7 @@ static void longcount(long long* z) } #endif -void dbgprintf(char* fmt, ...) +static void dbgprintf(char* fmt, ...) { #ifdef DETAILED_OUT #if 1 @@ -127,7 +127,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) @@ -211,7 +211,7 @@ void* my_mreq(int size, int to_zero) *(int*)answer=size; return (int*)answer+1; } -int my_release(char* memory) +int my_release(void* memory) { if(memory==0)return 0; free(memory-4); @@ -301,17 +301,15 @@ 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; + else + result = (void*)pdrv->hDriverModule; dbgprintf("GetDriverModuleHandle(%x)\n", pdrv); - return pdrv->hDriverModule; + return result; } void* WINAPI expGetModuleHandleA(const char* name) @@ -728,14 +726,14 @@ int WINAPI expGetCurrentThreadId() dbgprintf("GetCurrentThreadId() \n"); 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; @@ -826,14 +824,14 @@ int WINAPI expLoadStringA(long instance, long id, void* buf, long size) return LoadStringA(instance, id, buf, size); } -long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, char* s2, int siz2) +long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2) { #warning FIXME dbgprintf("MB2WCh\n"); dbgprintf("WARNING: Unsupported call: MBToWCh %s\n", s1); if(s2==0) return 1; - s2[0]=s2[1]=0; + s2[0]=0; return 1; } long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3) diff --git a/src/libw32dll/wine/win32.h b/src/libw32dll/wine/win32.h index 327cfb298..2969fac16 100644 --- a/src/libw32dll/wine/win32.h +++ b/src/libw32dll/wine/win32.h @@ -1 +1,214 @@ -int ext_unknown(); +#ifndef win_win32_h +#define win_win32_h + +#include <time.h> + +#include "windef.h" +#include "winbase.h" + +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); +extern void* LookupExternalByName(const char* library, const char* name); + +#endif |