1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 20:27:23 +00:00

sync with avifile

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2070 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-10-04 02:21:47 +00:00
parent d60f718c2e
commit 4f3776f018
23 changed files with 543 additions and 358 deletions

View File

@ -4,7 +4,7 @@ include ../config.mak
DEFINES=$(WIN32_PATH) -D__WINE__ -Ddbg_printf=__vprintf \
-DTRACE=__vprintf # -DDETAILED_OUT
LIB_OBJECTS= setup_FS.o pe_image.o module.o \
LIB_OBJECTS= ldt_keeper.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

View File

@ -19,7 +19,7 @@
***************************************************************************/
#include <config.h>
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
@ -27,17 +27,18 @@
#include "win32.h"
#include <wine/winbase.h>
#include <wine/windef.h>
#include <wine/winuser.h>
#include <wine/vfw.h>
#include <wine/winestring.h>
#include <wine/driver.h>
#include <wine/winerror.h>
#include <wine/msacm.h>
#include <wine/msacmdrv.h>
#include "wine/winbase.h"
#include "wine/windef.h"
#include "wine/winuser.h"
#include "wine/vfw.h"
#include "wine/winestring.h"
#include "wine/driver.h"
#include "wine/winerror.h"
#include "wine/msacm.h"
#include "wine/msacmdrv.h"
#include "wineacm.h"
#include "ext.h"
#include "driver.h"
#define OpenDriverA DrvOpen

View File

@ -2,8 +2,8 @@
#ifndef loader_driver_h
#define loader_driver_h
#include <wine/windef.h>
#include <wine/vfw.h>
//#include "wine/windef.h"
//#include "wine/vfw.h"
extern HDRVR VFWAPI DrvOpen(LPARAM lParam2);
extern void DrvClose(HDRVR hdrvr);

View File

@ -4,12 +4,13 @@
Copyright 2001 Eugene Kuznetsov (divx@euro.ru)
*********************************************************/
#include "DS_AudioDecoder.h"
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include "DS_AudioDecoder.h"
#include <string.h>
#include <stdio.h>
// using namespace std;
#define __MODULE__ "DirectShow audio decoder"
const GUID FORMAT_WaveFormatEx = {
0x05589f81, 0xc356, 0x11CE,
@ -24,17 +25,16 @@ const GUID MEDIASUBTYPE_PCM = {
{ 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 }
};
using namespace std;
typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
DS_AudioDecoder::DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf)
: IAudioDecoder(info, wf), m_pDS_Filter(0), m_sVhdr(0), m_sVhdr2(0)
{
m_sVhdr=new char[18 + wf->cbSize];
memcpy(m_sVhdr, wf, 18 + wf->cbSize);
m_sVhdr2=new char[18 + wf->cbSize];
memcpy(m_sVhdr2, m_sVhdr, 18 + wf->cbSize);
int sz = 18 + wf->cbSize;
m_sVhdr=new char[sz];
memcpy(m_sVhdr, wf, sz);
m_sVhdr2=new char[sz];
memcpy(m_sVhdr2, m_sVhdr, sz);
WAVEFORMATEX* pWF=(WAVEFORMATEX*)m_sVhdr2;
pWF->wFormatTag=1;
pWF->wBitsPerSample=16;
@ -51,7 +51,7 @@ DS_AudioDecoder::DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf)
m_sOurType.bFixedSizeSamples=true;
m_sOurType.bTemporalCompression=false;
m_sOurType.pUnk=0;
m_sOurType.cbFormat=18+wf->cbSize;
m_sOurType.cbFormat=sz;
m_sOurType.pbFormat=m_sVhdr;
memset(&m_sDestType, 0, sizeof(m_sDestType));
@ -62,7 +62,7 @@ DS_AudioDecoder::DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf)
m_sDestType.bTemporalCompression=false;
m_sDestType.lSampleSize=2*wf->nChannels;
m_sDestType.pUnk=0;
m_sDestType.cbFormat=18;
m_sDestType.cbFormat=pWF->cbSize;
m_sDestType.pbFormat=m_sVhdr2;
try
@ -95,19 +95,19 @@ DS_AudioDecoder::~DS_AudioDecoder()
delete m_pDS_Filter;
}
int DS_AudioDecoder::Convert(const void* in_data, size_t in_size,
void* out_data, size_t out_size,
size_t* size_read, size_t* size_written)
int DS_AudioDecoder::Convert(const void* in_data, uint_t in_size,
void* out_data, uint_t out_size,
uint_t* size_read, uint_t* size_written)
{
if (!in_data || !out_data)
return -1;
size_t written = 0;
size_t read = 0;
uint_t written = 0;
uint_t read = 0;
in_size -= in_size%in_fmt.nBlockAlign;
while (in_size>0)
{
size_t frame_size=0;
uint_t frame_size=0;
char* frame_pointer;
// m_pOurOutput->SetFramePointer(out_data+written);
m_pDS_Filter->m_pOurOutput->SetFramePointer(&frame_pointer);
@ -116,7 +116,7 @@ int DS_AudioDecoder::Convert(const void* in_data, size_t in_size,
m_pDS_Filter->m_pAll->vt->GetBuffer(m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
if(!sample)
{
Debug cerr<<"DS_AudioDecoder::Convert() Error: null sample"<<endl;
Debug printf("DS_AudioDecoder::Convert() Error: null sample\n");
break;
}
char* ptr;

View File

@ -1,7 +1,7 @@
#include "DS_Filter.h"
//#include "../loader/loader.h"
#include <libwin32.h>
#include <string>
#include "libwin32.h"
//#include <string>
#include <stdio.h>
#include <string.h>
@ -213,7 +213,10 @@ void DS_Filter::Stop()
if (m_iState == 2)
{
m_pAll->vt->Release((IUnknown*)m_pAll);
m_pFilter->vt->Stop(m_pFilter); // causes weird crash ??? FIXME
if (m_pFilter)
m_pFilter->vt->Stop(m_pFilter); // causes weird crash ??? FIXME
else
printf("m_pFilter is NULL!\n");
m_pAll = 0;
m_iState = 1;
}

View File

@ -9,9 +9,9 @@
#include "interfaces.h"
#include "DS_VideoDecoder.h"
#include <wine/winerror.h>
#include <libwin32.h>
//#include <cpuinfo.h>
#include "wine/winerror.h"
#include "ldt_keeper.h"
//#include <wine/winerror.h>
#include <unistd.h>
#include <fcntl.h>
@ -24,10 +24,6 @@
#define __MODULE__ "DirectShow_VideoDecoder"
#include "ldt_keeper.h"
extern "C" char* def_path;
using namespace std;
DS_VideoDecoder::DS_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip)

View File

@ -1,6 +1,6 @@
#include "allocator.h"
#include <com.h>
#include <wine/winerror.h>
#include "com.h"
#include "wine/winerror.h"
#include <stdio.h>
//#undef Debug

View File

@ -1,5 +1,5 @@
#include "cmediasample.h"
#include <wine/winerror.h>
#include "wine/winerror.h"
#include <stdio.h>
#include <string.h>

View File

@ -1,12 +1,12 @@
#ifndef GUIDS_H
#define GUIDS_H
#include <com.h>
#include <wine/winbase.h>
#include <wine/windef.h>
#include <wine/winuser.h>
#include <wine/vfw.h>
//#include <formats.h>
#include "com.h"
#include "wine/winbase.h"
#include "wine/windef.h"
#include "wine/winuser.h"
#include "wine/vfw.h"
extern int DSHOW_DEBUG;
#define Debug if(DSHOW_DEBUG)

View File

@ -1,5 +1,5 @@
#include "inputpin.h"
#include <wine/winerror.h>
#include "wine/winerror.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -49,24 +49,17 @@ class CEnumPins: public IEnumPins
public:
CEnumPins(IPin*, IPin* =0);
~CEnumPins(){delete vt;}
static long STDCALL Next (
IEnumPins * This,
/* [in] */ unsigned long cMediaTypes,
/* [size_is][out] */ IPin **ppMediaTypes,
/* [out] */ unsigned long *pcFetched);
static long STDCALL Skip (
IEnumPins * This,
/* [in] */ unsigned long cMediaTypes);
static long STDCALL Reset (
IEnumPins * This);
static long STDCALL Clone (
IEnumPins * This,
/* [out] */ IEnumPins **ppEnum);
static long STDCALL Next (IEnumPins * This,
/* [in] */ unsigned long cMediaTypes,
/* [size_is][out] */ IPin **ppMediaTypes,
/* [out] */ unsigned long *pcFetched);
static long STDCALL Skip (IEnumPins * This,
/* [in] */ unsigned long cMediaTypes);
static long STDCALL Reset (IEnumPins * This);
static long STDCALL Clone (IEnumPins * This,
/* [out] */ IEnumPins **ppEnum);
};
GUID CEnumPins::interfaces[]=
{
IID_IUnknown,

View File

@ -9,7 +9,7 @@ Created using freely-available DirectX 8.0 SDK
*/
#include <com.h>
#include "com.h"
#include "guids.h"
#ifndef STDCALL

View File

@ -36,6 +36,8 @@
#include <string>
#include <stdio.h>
typedef unsigned int uint_t; // use as generic type -
typedef unsigned int fourcc_t;
struct FatalError

View File

@ -1,7 +1,7 @@
#include "outputpin.h"
#include "allocator.h"
#include "iunk.h"
#include <wine/winerror.h>
#include "wine/winerror.h"
#include <cstdio>
#include <cstring>

View File

@ -7,10 +7,10 @@
#ifdef HAVE_LIBDL
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <wine/windef.h>
//#include <wine/global.h>

View File

@ -67,7 +67,7 @@ LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size)
return malloc(size);
}
WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags,LPVOID mem)
WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags, LPVOID mem)
{
if (mem) free(mem);
return 1;
@ -82,15 +82,15 @@ DWORD WINAPI GetLastError(void)
VOID WINAPI SetLastError(DWORD error)
{
last_error = error;
last_error=error;
}
WIN_BOOL WINAPI ReadFile(HANDLE handle,LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags)
WIN_BOOL WINAPI ReadFile(HANDLE handle, LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags)
{
*result=read(handle, mem, size);
return *result;
}
int WINAPI lstrcmpiA(const char* c1, const char* c2)
INT WINAPI lstrcmpiA(LPCSTR c1, LPCSTR c2)
{
return strcasecmp(c1,c2);
}
@ -98,7 +98,7 @@ LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num)
{
return strncpy(dest,src,num);
}
int WINAPI lstrlenA(const char* s)
INT WINAPI lstrlenA(LPCSTR s)
{
return strlen(s);
}
@ -114,7 +114,7 @@ INT WINAPI lstrlenW(LPCWSTR s)
}
LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
{
LPSTR rval = dest;
LPSTR result = dest;
int moved=0;
if((dest==0) || (src==0))
return 0;
@ -127,14 +127,16 @@ LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
src++;
dest++;
}
return rval;
return result;
}
int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n)
{
/*
if(s1==0)
return;
if(s2==0)
return;
*/
while(n>0)
{
if(*s1<*s2)
@ -309,7 +311,7 @@ typedef struct file_mapping_s
{
int mapping_size;
char* name;
HANDLE handle;
LPVOID handle;
struct file_mapping_s* next;
struct file_mapping_s* prev;
}file_mapping;
@ -335,7 +337,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
{
int hFile = (int)handle;
unsigned int len;
HANDLE answer;
LPVOID answer;
int anon=0;
int mmap_access=0;
if(hFile<0)
@ -357,10 +359,10 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
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, hFile, 0);
if(anon)
close(hFile);
if(answer!=(HANDLE)-1)
if(answer!=(LPVOID)-1)
{
if(fm==0)
{
@ -386,7 +388,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
if(anon)
close(hFile);
return answer;
return (HANDLE)answer;
}
return (HANDLE)0;
}
@ -395,10 +397,10 @@ WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
file_mapping* p;
int result;
if(fm==0)
return (HANDLE)0;
return 0;
for(p=fm; p; p=p->next)
{
if(p->handle==(HANDLE)handle)
if(p->handle==handle)
{
result=munmap((void*)handle, p->mapping_size);
if(p->next)p->next->prev=p->prev;
@ -427,7 +429,7 @@ static virt_alloc* vm=0;
#define MEM_COMMIT 0x00001000
#define MEM_RESERVE 0x00002000
void* WINAPI VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protection)
LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protection)
{
void* answer;
int fd=open("/dev/zero", O_RDWR);
@ -474,7 +476,7 @@ void* WINAPI VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protecti
if(answer==(void*)-1)
{
printf("Error no %d\n", errno);
printf("VirtualAlloc(0x%08X, %d) failed\n", address, size);
printf("VirtualAlloc(0x%p, %ld) failed\n", address, size);
return NULL;
}
else
@ -497,7 +499,7 @@ void* WINAPI VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protecti
return answer;
}
}
WIN_BOOL WINAPI VirtualFree(LPVOID address, DWORD t1, DWORD t2)//not sure
WIN_BOOL WINAPI VirtualFree(LPVOID address, DWORD t1, DWORD t2)//not sure
{
virt_alloc* str=vm;
int answer;
@ -518,14 +520,13 @@ WIN_BOOL WINAPI VirtualFree(LPVOID address, DWORD t1, DWORD t2)//not sure
return -1;
}
INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags,
LPCWSTR src, INT srclen,
LPSTR dest, INT destlen,
LPCSTR defch, WIN_BOOL*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)
return 0;
if ((srclen==-1)&&(dest==0)) return 0;
if(srclen==-1){srclen=0; while(src[srclen++]);}
// for(i=0; i<srclen; i++)
// printf("%c", src[i]);
@ -552,9 +553,8 @@ INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags,
}
return min(srclen, destlen);
}
INT WINAPI MultiByteToWideChar(UINT codepage, DWORD flags,
LPCSTR src, INT srclen,
LPWSTR dest, INT destlen)
INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,
LPWSTR dest, INT destlen)
{
return 0;
}
@ -570,7 +570,7 @@ HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
if(p->name==0)
continue;
if(strcmp(p->name, name)==0)
return p->handle;
return (HANDLE)p->handle;
}
return 0;
}

View File

@ -72,6 +72,8 @@ struct modify_ldt_ldt_s {
#endif
#define TEB_SEL LDT_SEL(TEB_SEL_IDX)
#include "ldt_keeper.h"
/**
*
* This should be performed before we create first thread. See remarks

View File

@ -12,14 +12,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#ifdef HAVE_LIBDL
#include <wine/elfdll.h>
#include <dlfcn.h>
#endif
/*
#ifdef __linux__
#include <asm/unistd.h>
@ -53,6 +47,10 @@ struct modify_ldt_ldt_s {
#include <wine/module.h>
#include <wine/pe_image.h>
#include <wine/debugtools.h>
#ifdef HAVE_LIBDL
#include <dlfcn.h>
#include <wine/elfdll.h>
#endif
#include "win32.h"
struct modref_list_t;
@ -61,13 +59,15 @@ typedef struct modref_list_t
{
WINE_MODREF* wm;
struct modref_list_t *next;
struct modref_list_t *prev;
struct modref_list_t *prev;
}
modref_list;
//WINE_MODREF *local_wm=NULL;
modref_list* local_wm=NULL;
//HANDLE SegptrHeap; // unused?
WINE_MODREF *MODULE_FindModule(LPCSTR m)
{
modref_list* list=local_wm;
@ -80,10 +80,10 @@ WINE_MODREF *MODULE_FindModule(LPCSTR m)
list=list->prev;
if(list==NULL)
return NULL;
}
}
TRACE("Resolved to %s\n", list->wm->filename);
return list->wm;
}
}
static void MODULE_RemoveFromList(WINE_MODREF *mod)
{
@ -113,8 +113,8 @@ static void MODULE_RemoveFromList(WINE_MODREF *mod)
return;
}
}
}
}
WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m)
{
modref_list* list=local_wm;
@ -128,10 +128,10 @@ WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m)
list=list->prev;
if(list==NULL)
return NULL;
}
TRACE("LookupHMODULE hit %X\n", list->wm);
}
TRACE("LookupHMODULE hit %p\n", list->wm);
return list->wm;
}
}
/*************************************************************************
* MODULE_InitDll
@ -140,7 +140,7 @@ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
{
WIN_BOOL retv = TRUE;
static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH",
static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH",
"THREAD_ATTACH", "THREAD_DETACH" };
assert( wm );
@ -181,14 +181,14 @@ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
/*************************************************************************
* MODULE_DllProcessAttach
*
*
* Send the process attach notification to all DLLs the given module
* depends on (recursively). This is somewhat complicated due to the fact that
*
* - we have to respect the module dependencies, i.e. modules implicitly
* referenced by another module have to be initialized before the module
* itself can be initialized
*
*
* - the initialization routine of a DLL can itself call LoadLibrary,
* thereby introducing a whole new set of dependencies (even involving
* the 'old' modules) at any time during the whole process
@ -199,7 +199,7 @@ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
*
* Furthermore, we need to rearrange the main WINE_MODREF list to allow
* the process *detach* notifications to be sent in the correct order.
* This must not only take into account module dependencies, but also
* This must not only take into account module dependencies, but also
* 'hidden' dependencies created by modules calling LoadLibrary in their
* attach notification routine.
*
@ -248,10 +248,10 @@ WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
local_wm=malloc(sizeof(modref_list));
local_wm->next=local_wm->prev=NULL;
local_wm->wm=wm;
}
}
/* Remove recursion flag */
wm->flags &= ~WINE_MODREF_MARKER;
if ( retv )
{
retv = MODULE_InitDll( wm, DLL_PROCESS_ATTACH, lpReserved );
@ -267,8 +267,8 @@ WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
/*************************************************************************
* MODULE_DllProcessDetach
*
* Send DLL process detach notifications. See the comment about calling
*
* Send DLL process detach notifications. See the comment about calling
* sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag
* is set, only DLLs with zero refcount are notified.
*/
@ -285,18 +285,59 @@ void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpR
*/
HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
{
WINE_MODREF *wm;
WINE_MODREF *wm = 0;
char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 };
extern char* def_path;
char path[512];
char checked[2000];
int i = -1;
checked[0] = 0;
if(!libname)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
printf("Loading DLL: '%s'\n", libname);
// if(fs_installed==0)
// install_fs();
wm = MODULE_LoadLibraryExA( libname, hfile, flags );
while (wm == 0 && listpath[++i])
{
if (i < 2)
{
if (i == 0)
/* check just original file name */
strncpy(path, libname, 511);
else
/* check default user path */
strncpy(path, def_path, 300);
}
else if (strcmp(def_path, listpath[i]))
/* path from the list */
strncpy(path, listpath[i], 300);
else
continue;
if (i > 0)
{
strcat(path, "/");
strncat(path, libname, 100);
}
path[511] = 0;
wm = MODULE_LoadLibraryExA( path, hfile, flags );
if (!wm)
{
if (checked[0])
strcat(checked, ", ");
strcat(checked, path);
checked[1500] = 0;
}
}
if ( wm )
{
if ( !MODULE_DllProcessAttach( wm, NULL ) )
@ -309,6 +350,10 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
}
}
if (!wm)
printf("Win32 LoadLibrary failed to load: %s\n", checked);
return wm ? wm->module : 0;
}
@ -331,7 +376,6 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
int i;
// module_loadorder_t *plo;
SetLastError( ERROR_FILE_NOT_FOUND );
TRACE("Trying native dll '%s'\n", libname);
pwm = PE_LoadLibraryExA(libname, flags);
@ -340,8 +384,8 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
{
TRACE("Trying ELF dll '%s'\n", libname);
pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags);
}
#endif
}
#endif
// printf("0x%08x\n", pwm);
// break;
if(pwm)
@ -356,7 +400,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
return pwm;
}
WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError());
return NULL;
}
@ -384,10 +428,10 @@ WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
{
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
}
else
retv = MODULE_FreeLibrary( wm );
MODULE_RemoveFromList(wm);
/* garbage... */
@ -459,13 +503,13 @@ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function )
/***********************************************************************
* MODULE_GetProcAddress (internal)
*/
FARPROC MODULE_GetProcAddress(
FARPROC MODULE_GetProcAddress(
HMODULE hModule, /* [in] current module handle */
LPCSTR function, /* [in] function to be looked up */
WIN_BOOL snoop )
{
WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
// WINE_MODREF *wm=local_wm;
// WINE_MODREF *wm=local_wm;
FARPROC retproc;
if (HIWORD(function))
@ -482,9 +526,9 @@ FARPROC MODULE_GetProcAddress(
retproc = PE_FindExportedFunction( wm, function, snoop );
if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
return retproc;
#ifdef HAVE_LIBDL
#ifdef HAVE_LIBDL
case MODULE32_ELF:
retproc = (FARPROC) dlsym( (void*)wm->module, function);
retproc = (FARPROC) dlsym( (void*) wm->module, function);
if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
return retproc;
#endif

View File

@ -33,7 +33,8 @@
* newer pe binaries produced by MSVC 5 and later, since they are also aligned
* to 4096 byte boundaries on disk.
*/
#include <config.h>
#include "config.h"
//#include <wine/config.h>
#include <errno.h>
#include <assert.h>
@ -44,9 +45,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
@ -57,8 +55,7 @@
#include <wine/pe_image.h>
#include <wine/module.h>
#include <wine/debugtools.h>
#include <ext.h>
#include "ext.h"
#include "win32.h"
#define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x)))
@ -179,7 +176,7 @@ FARPROC PE_FindExportedFunction(
ename = RVA(name[i]);
if (!strcmp( ename, funcName ))
{
ERR( "%s.%s required a linear search\n", wm->modname, funcName );
ERR( "%s.%s required a linear search\n", wm->modname, funcName );
ordinal = ordinals[i];
goto found;
}
@ -565,6 +562,7 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version )
}
}
load_addr = nt->OptionalHeader.ImageBase;
vma_size = calc_vma_size( hModule );
@ -884,6 +882,7 @@ void PE_UnloadLibrary(WINE_MODREF *wm)
* due to the PROCESS_Create stuff.
*/
/*
* This is a dirty hack.
* The win32 DLLs contain an alloca routine, that first probes the soon
@ -898,11 +897,12 @@ void PE_UnloadLibrary(WINE_MODREF *wm)
*/
static void extend_stack_for_dll_alloca(void)
{
#ifndef __FreeBSD__
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

View File

@ -1,24 +1,33 @@
#ifndef AVIFILE_REGISTRY_H
#define AVIFILE_REGISTRY_H
/********************************************************
*
* Declaration of registry access functions
* Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
*
********************************************************/
Declaration of registry access functions
Copyright 2000 Eugene Smith (divx@euro.ru)
*********************************************************/
#ifndef REGISTRY_H
#define REGISTRY_H
#ifdef __cplusplus
extern "C" {
#endif
long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey);
long RegOpenKeyExA(long key, const char* subkey, long reserved,
long access, int* newkey);
long RegCloseKey(long key);
long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count);
long RegQueryValueExA(long key, const char* value, int* reserved,
int* type, int* data, int* count);
long RegCreateKeyExA(long key, const char* name, long reserved,
void* classs, long options, long security,
void* sec_attr, int* newkey, int* status);
long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size);
void* classs, long options, long security,
void* sec_attr, int* newkey, int* status);
long RegSetValueExA(long key, const char* name, long v1, long v2,
const void* data, long size);
#ifdef __WINE_WINERROR_H
long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
#endif
#ifdef __cplusplus
};
#endif
#endif
#endif // AVIFILE_REGISTRY_H

View File

@ -351,6 +351,8 @@ ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
WINE_HIC *whic = (WINE_HIC*)hic;
char qw[200];
// printf("ICSendMessage.whic=%p\n",whic);
#if 0
__asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
#endif

View File

@ -11,14 +11,21 @@
************************************************************/
#include <config.h>
#include "config.h"
#include "wine/winbase.h"
#include "wine/winreg.h"
#include "wine/winnt.h"
#include "wine/winerror.h"
#include "wine/debugtools.h"
#include "wine/module.h"
#include "win32.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
@ -28,38 +35,29 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/timeb.h>
#if HAVE_LIBKSTAT
#ifdef HAVE_KSTAT
#include <kstat.h>
#endif
#include <wine/winbase.h>
#include <wine/winreg.h>
#include <wine/winnt.h>
#include <wine/winerror.h>
#include <wine/debugtools.h>
#include <wine/module.h>
#include <registry.h>
#include <loader.h>
#include <com.h>
long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
#include "registry.h"
#include "loader.h"
#include "com.h"
char* def_path=WIN32_PATH;
static void do_cpuid(unsigned int ax, unsigned int *regs)
{
__asm__ __volatile__(
"pushl %%ebx; pushl %%ecx; pushl %%edx; "
".byte 0x0f, 0xa2;"
"movl %%eax, (%2);"
"movl %%ebx, 4(%2);"
"movl %%ecx, 8(%2);"
"movl %%edx, 12(%2);"
"popl %%edx; popl %%ecx; popl %%ebx; "
: "=a" (ax)
: "0" (ax), "S" (regs));
__asm__ __volatile__(
"pushl %%ebx; pushl %%ecx; pushl %%edx;"
".byte 0x0f, 0xa2;"
"movl %%eax, (%2);"
"movl %%ebx, 4(%2);"
"movl %%ecx, 8(%2);"
"movl %%edx, 12(%2);"
"popl %%edx; popl %%ecx; popl %%ebx;"
: "=a" (ax)
: "0" (ax), "S" (regs)
);
}
static unsigned int c_localcount_tsc()
{
@ -102,9 +100,8 @@ static void c_longcount_notsc(long long* z)
result+=limit*tv.tv_usec;
*z=result;
}
static unsigned int localcount_stub(void);
static void longcount_stub(long long* z);
static void longcount_stub(long long*);
static unsigned int (*localcount)()=localcount_stub;
static void (*longcount)(long long*)=longcount_stub;
@ -141,7 +138,7 @@ static void longcount_stub(long long* z)
longcount(z);
}
int LOADER_DEBUG=1;
int LOADER_DEBUG=1; // active only if compiled with -DDETAILED_OUT
static inline void dbgprintf(char* fmt, ...)
{
#ifdef DETAILED_OUT
@ -171,7 +168,7 @@ char export_names[500][30]={
static unsigned char* heap=NULL;
static int heap_counter=0;
static void test_heap()
static void test_heap(void)
{
int offset=0;
if(heap==0)
@ -224,11 +221,11 @@ void* my_mreq(int size, int to_zero)
if(to_zero)
memset(heap+heap_counter, 0, size);
else
memset(heap+heap_counter, 0xcc, size);
memset(heap+heap_counter, 0xcc, size); // make crash reprocable
heap_counter+=size;
return heap+heap_counter-size;
}
int my_release(void* memory)
int my_release(char* memory)
{
// test_heap();
if(memory==NULL)
@ -299,7 +296,7 @@ int my_release(void* memory)
}
else {
for(;pp;pp=pp->prev) {
if (pp->addr == memory-4) {
if (pp->addr == (char*)memory-4) {
if (pp->prev)
pp->prev->next=pp->next;
if (pp->next)
@ -312,26 +309,48 @@ int my_release(void* memory)
}
}
if (pp == NULL) {
printf("Not Found %p %d\n",memory-4,alccnt);
printf("Not Found %p %d\n",(char*)memory-4,alccnt);
return 0;
}
}
}
#endif
free(memory-4);
free((char*)memory-4);
return 0;
}
#endif
int my_size(char* memory)
int my_size(void* memory)
{
return *(int*)(memory-4);
return *(int*)((char*)memory-4);
}
void* my_realloc(void* memory,int size)
{
void *ans;
#ifdef GARBAGE
alc_list* pp;
if(memory == NULL)return 0;
pp=alclist;
if(pp == NULL) return 0;
ans=NULL;
for(;pp;pp=pp->prev) {
if (pp->addr == (char*)memory-4) {
ans = realloc(memory-4,size+4);
if (ans == 0) return 0;
pp->size = size;
pp->addr = ans;
}
}
#else
ans = realloc(memory-4,size+4);
#endif
return ans;
}
extern int unk_exp1;
char extcode[20000];// place for 200 unresolved exports
int pos=0;
int WINAPI ext_unknown(void)
int WINAPI ext_unknown()
{
printf("Unknown func called\n");
return 0;
@ -408,21 +427,23 @@ int CDECL exp_initterm(int v1, int v2)
return 0;
}
void* WINAPI expGetDriverModuleHandle(DRVR* pdrv)
HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv)
{
void* result;
if (pdrv==NULL)
result=NULL;
HMODULE result;
if (pdrv==NULL)
result=0;
else
result=(void*) pdrv->hDriverModule;
dbgprintf("GetDriverModuleHandle(0x%x) => 0x%x\n", pdrv, result);
result=pdrv->hDriverModule;
dbgprintf("GetDriverModuleHandle(%p) => %p\n", pdrv, result);
return result;
}
void* WINAPI expGetModuleHandleA(const char* name)
#define MODULE_HANDLE_kernel32 ((HMODULE)0x120)
HMODULE WINAPI expGetModuleHandleA(const char* name)
{
WINE_MODREF* wm;
void* result;
HMODULE result;
if(!name)
result=0;
else
@ -430,12 +451,12 @@ void* WINAPI expGetModuleHandleA(const char* name)
wm=MODULE_FindModule(name);
if(wm==0)result=0;
else
result=(void*)(wm->module);
result=(HMODULE)(wm->module);
}
if(!result)
{
if(strcasecmp(name, "kernel32")==0)
result=(void *) 0x120;
result=MODULE_HANDLE_kernel32;
}
dbgprintf("GetModuleHandleA('%s') => 0x%x\n", name, result);
return result;
@ -515,7 +536,7 @@ void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset,
pSecAttr, bManualReset, bInitialState, name, name, pp->pm);
return pp->pm;
}
}while((pp=pp->prev));
}while((pp=pp->prev) != NULL);
}
pm=my_mreq(sizeof(pthread_mutex_t), 0);
pthread_mutex_init(pm, NULL);
@ -584,18 +605,20 @@ void* WINAPI expResetEvent(void* event)
void* WINAPI expWaitForSingleObject(void* object, int duration)
{
mutex_list *ml = (mutex_list *)object;
int ret=WAIT_FAILED; // fixed by Zdenek Kabelac
// FIXME FIXME FIXME - this value is sometime unititialize !!!
int ret = WAIT_FAILED;
mutex_list* pp=mlist;
// dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration);
dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration);
// loop below was slightly fixed - its used just for checking if
// this object really exists in our list
if (!ml)
return (void*) ret;
while (pp && (pp->pm != ml->pm))
pp = pp->prev;
pp = pp->prev;
if (!pp) {
//dbgprintf("WaitForSingleObject: NotFound\n");
return (void*)ret;
dbgprintf("WaitForSingleObject: NotFound\n");
return (void*)ret;
}
pthread_mutex_lock(ml->pm);
@ -679,8 +702,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
static int cache = 0;
static SYSTEM_INFO cachedsi;
unsigned int regs[4];
HKEY xhkey=0,hkey;
dbgprintf("GetSystemInfo(0x%d) =>\n");
dbgprintf("GetSystemInfo(%p) =>\n", si);
if (cache) {
memcpy(si,&cachedsi,sizeof(*si));
@ -735,7 +757,6 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
if (!f)
return;
xhkey = 0;
while (fgets(line,200,f)!=NULL) {
char *s,*value;
@ -771,7 +792,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
}
}
/* set the CPU type of the current processor */
snprintf(buf,20,"CPU %ld",cachedsi.dwProcessorType);
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
continue;
}
/* old 2.0 method */
@ -798,7 +819,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
}
}
/* set the CPU type of the current processor */
snprintf(buf,20,"CPU %ld",cachedsi.dwProcessorType);
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
continue;
}
if (!lstrncmpiA(line,"fdiv_bug",strlen("fdiv_bug"))) {
@ -824,7 +845,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
/* Create a new processor subkey on a multiprocessor
* system
*/
snprintf(buf,20,"%d",x);
sprintf(buf,"%d",x);
}
if (!lstrncmpiA(line,"stepping",strlen("stepping"))) {
int x;
@ -853,6 +874,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
cachedsi.dwNumberOfProcessors=1;
}
#endif /* __FreeBSD__ */
cache = 1;
memcpy(si,&cachedsi,sizeof(*si));
DumpSystemInfo(si);
}
@ -908,6 +930,19 @@ long WINAPI expHeapSize(int heap, int flags, void* pointer)
dbgprintf("HeapSize(heap 0x%x, flags 0x%x, pointer 0x%x) => %d\n", heap, flags, pointer, result);
return result;
}
void* WINAPI expHeapReAlloc(HANDLE heap,int flags,void *lpMem,int size)
{
long orgsize;
void *newp;
orgsize = my_size(lpMem);
dbgprintf("HeapReAlloc() Size %ld org %d\n",orgsize,size);
if (size < orgsize)
return lpMem;
newp=my_mreq(size, flags & 8);
memcpy(newp, lpMem, orgsize);
my_release(lpMem);
return newp;
}
long WINAPI expGetProcessHeap(void)
{
dbgprintf("GetProcessHeap() => 1\n");
@ -934,6 +969,7 @@ struct CRITSECT
pthread_mutex_t mutex;
int locked;
};
void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
{
struct CRITSECT cs;
@ -955,6 +991,12 @@ void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c)
{
struct CRITSECT* cs=*(struct CRITSECT**)c;
dbgprintf("EnterCriticalSection(0x%x)\n",c);
if (!cs)
{
expInitializeCriticalSection(c);
cs=*(struct CRITSECT**)c;
printf("Win32 Warning: Accessed uninitialized Critical Section (%p)!\n", c);
}
// cs.id=pthread_self();
if(cs->locked)
if(cs->id==pthread_self())
@ -969,6 +1011,11 @@ void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
struct CRITSECT* cs=*(struct CRITSECT**)c;
// struct CRITSECT* cs=(struct CRITSECT*)c;
dbgprintf("LeaveCriticalSection(0x%x)\n",c);
if (!cs)
{
printf("Win32 Warning: Leaving noninitialized Critical Section %p!!\n", c);
return;
}
cs->locked=0;
pthread_mutex_unlock(&(cs->mutex));
return;
@ -993,13 +1040,13 @@ int WINAPI expGetCurrentProcess()
return getpid();
}
struct tls_s
{
struct tls_s {
void* value;
int used;
struct tls_s* prev;
struct tls_s* next;
};
tls_t* g_tls=NULL;
void* WINAPI expTlsAlloc()
@ -1017,6 +1064,7 @@ void* WINAPI expTlsAlloc()
g_tls=g_tls->next;
}
dbgprintf("TlsAlloc() => 0x%x\n", g_tls);
g_tls->value=0; /* XXX For Divx.dll */
return g_tls;
}
@ -1072,6 +1120,30 @@ void* WINAPI expLocalAlloc(int flags, int size)
dbgprintf("LocalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z);
return z;
}
void* WINAPI expLocalReAlloc(int handle,int size, int flags)
{
void *newpointer;
int oldsize;
newpointer=NULL;
if (flags & LMEM_MODIFY) {
dbgprintf("LocalReAlloc MODIFY\n");
return (void *)handle;
}
oldsize = my_size((void *)handle);
if (size > oldsize) {
newpointer=my_realloc((void *)handle,size);
}
else {
newpointer=(void *)handle;
}
dbgprintf("LocalReAlloc(%x %d(old %d), flags 0x%x) => 0x%x\n", handle,size,oldsize, flags,newpointer);
return newpointer;
}
void* WINAPI expLocalLock(void* z)
{
dbgprintf("LocalLock(0x%x) => 0x%x\n", z, z);
@ -1130,12 +1202,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;
}
@ -1152,7 +1224,7 @@ long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char*
"dest 0x%x, dest size %d, defch 0x%x, used_defch 0x%x)", v1, v2, s1, siz1, s2, siz2, c3, siz3);
result=WideCharToMultiByte(v1, v2, s1, siz1, s2, siz2, c3, siz3);
dbgprintf("=> %d\n", result);
if(s1)wch_print(s1);
//if(s1)wch_print(s1);
if(s2)dbgprintf(" dest: %s\n", s2);
return result;
}
@ -1163,10 +1235,16 @@ long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
c->dwMajorVersion=4;
c->dwMinorVersion=0;
c->dwBuildNumber=0x4000457;
#if 0
// leave it here for testing win9x-only codecs
c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
strcpy(c->szCSDVersion, " B");
#else
c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers
strcpy(c->szCSDVersion, "Service Pack 3");
#endif
dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n"
" Platform Id: VER_PLATFORM_WIN32_WINDOWS\n Version string: ' B'\n");
" Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n");
return 1;
}
HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name)
@ -1185,7 +1263,7 @@ HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, cha
v1, init_count, max_count, name, name, mlist);
return (HANDLE)mlist;
}
}while((pp=pp->prev));
}while((pp=pp->prev) != NULL);
}
pm=my_mreq(sizeof(pthread_mutex_t), 0);
pthread_mutex_init(pm, NULL);
@ -1297,6 +1375,13 @@ long hKey,
return result;
}
DWORD WINAPI expRegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count)
{
return RegEnumValueA(hkey, index, value, val_count,
reserved, type, data, count);
}
long WINAPI expQueryPerformanceCounter(long long* z)
{
longcount(z);
@ -1641,17 +1726,18 @@ int WINAPI expSetUnhandledExceptionFilter(void* filter)
dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter);
return 1;//unsupported and probably won't ever be supported
}
extern char* def_path;
int WINAPI expLoadLibraryA(char* name)
{
char qq[256];
int result;
int result = 0;
char* lastbc;
int i;
if (!name)
return -1;
// we skip to the last backslash
// this is effectively eliminating weird characters in
// the text output windows
lastbc = strrchr(name, '\\');
if (lastbc)
{
@ -1664,52 +1750,43 @@ int WINAPI expLoadLibraryA(char* name)
break;
}
}
// printf("LoadLibrary wants: %s/%s\n", def_path, name);
if(strncmp(name, "c:\\windows\\", 11)==0)name+=11;
if(strncmp(name, "c:\\windows\\", 11)==0) name += 11;
if(strncmp(name, ".\\", 2)==0) name += 2;
if(name[0]!='/')
{
strcpy(qq, def_path);
strcat(qq, "/");
strcat(qq, name);
}
printf("Loading DLL: %s", qq);fflush(stdout);
// printf("Entering LoadLibraryA(%s)\n", name);
result=LoadLibraryA(qq);
if(!result) printf(" FAILED!\n"); else printf(" OK\n");
// printf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
dbgprintf("Entering LoadLibraryA(%s)\n", name);
result=LoadLibraryA(name);
dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
return result;
}
}
int WINAPI expFreeLibrary(int module)
{
int result=FreeLibrary(module);
dbgprintf("FreeLibrary(0x%x) => %d\n", module, result);
return result;
}
void* LookupExternalByName(const char* library, const char* name);
void* WINAPI expGetProcAddress(HMODULE mod, char* name)
{
void *result;
if(mod!=0x120)
void* result;
if(mod!=MODULE_HANDLE_kernel32)
result=GetProcAddress(mod, name);
else
result=LookupExternalByName("kernel32.dll", name);
dbgprintf("GetProcAddress(0x%x, '%s') => 0x%x\n", mod, name, result);
return result;
}
}
long WINAPI expCreateFileMappingA(int hFile, void* lpAttr,
long flProtect, long dwMaxHigh, long dwMaxLow, const char* name)
{
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;
}
@ -1741,7 +1818,9 @@ void* WINAPI expUnmapViewOfFile(void* view)
void* WINAPI expSleep(int time)
{
// extern int avm_usleep(int);
dbgprintf("Sleep(%d) => 0\n", time);
// avm_usleep(time);
usleep(time);
return 0;
}
@ -1986,10 +2065,12 @@ time_t exptime(time_t* t)
int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax)
{
int result=snprintf(str, cbMax, "%.8lx-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
guid->f1, guid->f2, guid->f3,
(unsigned char)guid->f4[0], (unsigned char)guid->f4[1], (unsigned char)guid->f4[2], (unsigned char)guid->f4[3],
(unsigned char)guid->f4[4], (unsigned char)guid->f4[5], (unsigned char)guid->f4[6], (unsigned char)guid->f4[7]);
int result=snprintf(str, cbMax, "%.8x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
guid->f1, guid->f2, guid->f3,
(unsigned char)guid->f4[0], (unsigned char)guid->f4[1],
(unsigned char)guid->f4[2], (unsigned char)guid->f4[3],
(unsigned char)guid->f4[4], (unsigned char)guid->f4[5],
(unsigned char)guid->f4[6], (unsigned char)guid->f4[7]);
dbgprintf("StringFromGUID2(0x%x, 0x%x='%s', %d) => %d\n", guid, str, str, cbMax, result);
return result;
}
@ -2009,16 +2090,6 @@ int WINAPI expIsBadStringPtrW(const short* string, int nchars)
if(string)wch_print(string);
return result;
}
int WINAPI expIsBadStringPtrA(const char* string, int nchars)
{
int result=0;
// if(string==0)result=1; else result=0;
// dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result);
// if(string)wch_print(string);
return result;
}
extern long WINAPI InterlockedExchangeAdd( long* dest, long incr )
{
long ret;
@ -2075,6 +2146,54 @@ int WINAPI expSetCursor(void *cursor)
dbgprintf("SetCursor(0x%x) => 0x%x\n", cursor, cursor);
return (int)cursor;
}
int WINAPI expGetCursorPos(void *cursor)
{
dbgprintf("GetCursorPos(0x%x) => 0x%x\n", cursor, cursor);
return 1;
}
int WINAPI expRegisterWindowMessageA(char *message)
{
dbgprintf("RegisterWindowMessageA(%s)\n", message);
return 1;
}
int WINAPI expGetProcessVersion(int pid)
{
dbgprintf("GetProcessVersion(%d)\n", pid);
return 1;
}
int WINAPI expGetCurrentThread(void)
{
dbgprintf("GetCurrentThread()\n");
return 1;
}
int WINAPI expGetOEMCP(void)
{
dbgprintf("GetOEMCP()\n");
return 1;
}
int WINAPI expGetCPInfo(int cp,void *info)
{
dbgprintf("GetCPInfo()\n");
return 0;
}
int WINAPI expGetSystemMetrics(int index)
{
dbgprintf("GetSystemMetrics(%d)\n", index);
return 1;
}
int WINAPI expGetSysColor(int index)
{
dbgprintf("GetSysColor(%d)\n", index);
return 1;
}
int WINAPI expGetSysColorBrush(int index)
{
dbgprintf("GetSysColorBrush(%d)\n", index);
return 1;
}
int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe)
{
dbgprintf("GetSystemPaletteEntries(0x%x, 0x%x, 0x%x, 0x%x) => 0\n",
@ -2166,6 +2285,7 @@ int WINAPI expGetSystemTime(SYSTEMTIME* systime)
" Milliseconds: %d\n",
systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay,
systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds);
return 0;
}
int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size)
@ -2205,14 +2325,51 @@ static struct COM_OBJECT_INFO* com_object_table=0;
static int com_object_size=0;
int RegisterComClass(GUID* clsid, GETCLASSOBJECT gcs)
{
if(!clsid)return -1;
if(!gcs)return -1;
if(!clsid || !gcs)
return -1;
com_object_table=realloc(com_object_table, sizeof(struct COM_OBJECT_INFO)*(++com_object_size));
com_object_table[com_object_size-1].clsid=*clsid;
com_object_table[com_object_size-1].GetClassObject=gcs;
return 0;
}
int UnregisterComClass(GUID* clsid, GETCLASSOBJECT gcs)
{
int found = 0;
int i = 0;
if(!clsid || !gcs)
return -1;
if (com_object_table == 0)
printf("Warning: UnregisterComClass() called without any registered class\n");
while (i < com_object_size)
{
if (found && i > 0)
{
memcpy(&com_object_table[i - 1].clsid,
&com_object_table[i].clsid, sizeof(GUID));
com_object_table[i - 1].GetClassObject =
com_object_table[i].GetClassObject;
}
else if (memcmp(&com_object_table[i].clsid, clsid, sizeof(GUID)) == 0
&& com_object_table[i].GetClassObject == gcs)
{
found++;
}
i++;
}
if (found)
{
if (--com_object_size == 0)
{
free(com_object_table);
com_object_table = 0;
}
}
return 0;
}
GUID IID_IUnknown={0x00000000, 0x0000, 0x0000,
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
GUID IID_IClassFactory={0x00000001, 0x0000, 0x0000,
@ -2442,31 +2599,6 @@ WIN_BOOL
return 1;
}
/******************************************************************************
* RegEnumValueA [ADVAPI32.@]
*/
DWORD WINAPI expRegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count )
{
// printf("RegEnumValueA(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
// hkey, index, value, val_count, reserved, type, data, count );
// return -1;
return RegEnumValueA(hkey, index, value, val_count,
reserved, type, data, count);
}
#if 0
INT WINAPI expMulDiv(int nNumber,int nNumerator,int nDenominator)
{
return ((long long)nNumber * (long long)nNumerator) / nDenominator;
}
#endif
int WINAPI expMulDiv(int nNumber, int nNumerator, int nDenominator)
{
static const long long max_int=0x7FFFFFFFLL;
@ -2499,6 +2631,23 @@ LONG WINAPI explstrcpyA(char* str1, const char* str2)
dbgprintf("strcpy(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result);
return result;
}
LONG WINAPI explstrcpynA(char* str1, const char* str2,int len)
{
int result;
if (strlen(str2)>len)
result = (int) strncpy(str1, str2,len);
else
result = (int) strcpy(str1,str2);
dbgprintf("strncpy(0x%x, 0x%x='%s' len %d strlen %d) => %x\n", str1, str2, str2,len, strlen(str2),result);
return result;
}
LONG WINAPI explstrcatA(char* str1, const char* str2)
{
int result= (int) strcat(str1, str2);
dbgprintf("strcat(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result);
return result;
}
LONG WINAPI expInterlockedExchange(long *dest, long l)
{
@ -2508,57 +2657,12 @@ LONG WINAPI expInterlockedExchange(long *dest, long l)
return retval;
}
int WINAPI expUnknownMFC42_1176() /* exact number of arguments unknown */
void WINAPI expInitCommonControls()
{
dbgprintf("MFC42:1176\n");
return 0;
printf("InitCommonControls called!\n");
return;
}
int WINAPI expUnknownMFC42_1243() /* exact number of arguments unknown */
{
dbgprintf("MFC42:1243\n");
return 0;
}
int UnregisterComClass(GUID* clsid, GETCLASSOBJECT gcs)
{
int found = 0;
int i = 0;
if(!clsid || !gcs)
return -1;
if (com_object_table == 0)
printf("Warning: UnregisterComClass() called without any registered class\n");
while (i < com_object_size)
{
if (found && i > 0)
{
memcpy(&com_object_table[i - 1].clsid,
&com_object_table[i].clsid, sizeof(GUID));
com_object_table[i - 1].GetClassObject =
com_object_table[i].GetClassObject;
}
else if (memcmp(&com_object_table[i].clsid, clsid, sizeof(GUID)) == 0
&& com_object_table[i].GetClassObject == gcs)
{
found++;
}
i++;
}
if (found)
{
if (--com_object_size == 0)
{
free(com_object_table);
com_object_table = 0;
}
}
return 0;
}
struct exports
{
char name[64];
@ -2579,7 +2683,6 @@ struct exports exp_kernel32[]={
FF(IsBadWritePtr, 357)
FF(IsBadReadPtr, 354)
FF(IsBadStringPtrW, -1)
FF(IsBadStringPtrA, -1)
FF(DisableThreadLibraryCalls, -1)
FF(CreateThread, -1)
FF(CreateEventA, -1)
@ -2593,6 +2696,7 @@ FF(HeapAlloc, -1)
FF(HeapDestroy, -1)
FF(HeapFree, -1)
FF(HeapSize, -1)
FF(HeapReAlloc,-1)
FF(GetProcessHeap, -1)
FF(VirtualAlloc, -1)
FF(VirtualFree, -1)
@ -2607,6 +2711,7 @@ FF(TlsSetValue, -1)
FF(GetCurrentThreadId, -1)
FF(GetCurrentProcess, -1)
FF(LocalAlloc, -1)
FF(LocalReAlloc,-1)
FF(LocalLock, -1)
FF(GlobalAlloc, -1)
FF(GlobalReAlloc, -1)
@ -2688,6 +2793,12 @@ FF(MulDiv, -1)
FF(lstrcmpiA, -1)
FF(lstrlenA, -1)
FF(lstrcpyA, -1)
FF(lstrcatA, -1)
FF(GetProcessVersion,-1)
FF(GetCurrentThread,-1)
FF(GetOEMCP,-1)
FF(GetCPInfo,-1)
FF(lstrcpynA,-1)
};
struct exports exp_msvcrt[]={
@ -2724,6 +2835,12 @@ FF(ReleaseDC, -1)
FF(IsRectEmpty, -1)
FF(LoadCursorA,-1)
FF(SetCursor,-1)
FF(GetCursorPos,-1)
FF(GetCursorPos,-1)
FF(RegisterWindowMessageA,-1)
FF(GetSystemMetrics,-1)
FF(GetSysColor,-1)
FF(GetSysColorBrush,-1)
};
struct exports exp_advapi32[]={
FF(RegOpenKeyA, -1)
@ -2732,7 +2849,7 @@ FF(RegCreateKeyExA, -1)
FF(RegQueryValueExA, -1)
FF(RegSetValueExA, -1)
FF(RegCloseKey, -1)
//FF(RegEnumValueA, -1)
FF(RegEnumValueA, -1)
};
struct exports exp_gdi32[]={
FF(CreateCompatibleDC, -1)
@ -2749,13 +2866,13 @@ FF(CoTaskMemFree, -1)
FF(CoCreateInstance, -1)
FF(StringFromGUID2, -1)
};
struct exports exp_mfc42[]={
FF(UnknownMFC42_1176, 1176)
FF(UnknownMFC42_1243, 1243)
};
struct exports exp_crtdll[]={
FF(memcpy, -1)
};
struct exports exp_comctl32[]={
FF(StringFromGUID2, -1)
FF(InitCommonControls, 17)
};
#define LL(X) \
{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
@ -2769,10 +2886,11 @@ LL(advapi32)
LL(gdi32)
LL(version)
LL(ole32)
LL(mfc42)
LL(crtdll)
LL(comctl32)
};
void* LookupExternal(const char* library, int ordinal)
{
char* answ;
@ -2793,7 +2911,7 @@ void* LookupExternal(const char* library, int ordinal)
{
if(ordinal!=libraries[i].exps[j].id)
continue;
printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
printf("Hit: 0x%p\n", libraries[i].exps[j].func);
return libraries[i].exps[j].func;
}
}
@ -2851,7 +2969,7 @@ void* LookupExternalByName(const char* library, const char* name)
// return (void*)ext_unknown;
}
int my_garbagecollection(void)
void my_garbagecollection(void)
{
#ifdef GARBAGE
alc_list* pp,*ppsv;
@ -2877,7 +2995,7 @@ int my_garbagecollection(void)
}
}
if (alclist==NULL) return 0;
if (alclist==NULL) return;
pp=alclist;
unfree=unfreecnt=0;

View File

@ -9,8 +9,9 @@
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);
extern int my_size(void* memory);
extern void* my_realloc(void *memory,int size);
extern void my_garbagecollection(void);
typedef struct {
@ -31,8 +32,8 @@ 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 HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv);
extern HMODULE 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,
@ -48,6 +49,7 @@ 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 void* WINAPI expHeapReAlloc(HANDLE heap,int flags,void* lpMem,int size);
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);
@ -63,6 +65,7 @@ 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 expLocalReAlloc(int handle,int size,int flags);
extern void* WINAPI expLocalLock(void* z);
extern void* WINAPI expGlobalAlloc(int flags, int size);
extern void* WINAPI expGlobalLock(void* z);
@ -147,6 +150,15 @@ 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 expGetCursorPos(void *cursor);
extern int WINAPI expRegisterWindowMessageA(char *message);
extern int WINAPI expGetProcessVersion(int pid);
extern int WINAPI expGetCurrentThread(void);
extern int WINAPI expGetOEMCP(void);
extern int WINAPI expGetCPInfo(int cp,void *info);
extern int WINAPI expGetSysColor(int pid);
extern int WINAPI expGetSysColorBrush(int pid);
extern int WINAPI expGetSystemMetrics(int index);
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);
@ -185,6 +197,8 @@ 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 explstrcpynA(char* str1, const char* str2,int len);
extern LONG WINAPI explstrcatA(char* str1, const char* str2);
extern LONG WINAPI expInterlockedExchange(long *dest, long l);
extern void* CDECL expmalloc(int size);
@ -206,5 +220,6 @@ 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

View File

@ -43,9 +43,9 @@ typedef struct _WINE_ACMDRIVERID
extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
PWINE_ACMDRIVERID MSACM_RegisterDriver(
LPSTR pszDriverAlias, LPSTR pszFileName,
HINSTANCE hinstModule);
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias,
LPSTR pszFileName,
HINSTANCE hinstModule);
void MSACM_RegisterAllDrivers(void);
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
void MSACM_UnregisterAllDrivers(void);