Commit 6d6ec75c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

DLL loader stolen from MPlayer CVS.

Disabled by default, enable with --enable-loader
There's no sanity checks in configure so don't do it if your platform is not compatible.

zorglub and Anil report it works for WMV3 with the dmo decoder plugin.
It seems to crash with Quicktime (after displaying a few frame ?).
There's no RealVideo decoder so, won't do that, but it probably could as well.

Legal considerations
=====================

Section 2 of the GPL puts no restriction on what you link with so long as
you have obtained the program from source (and compiled it yourself), so
this is OK.

It is not clear to me whether it is ok to provide binaries with this
feature enabled. Maybe it would infringe on the GPL and, hence, on VLC's
past contributors intellectual rights. So if in doubt don't put this in
binary package you make.
parent 83282a78
......@@ -11,7 +11,8 @@ NULL =
# - modules should come before . because vlc needs the builtins
# - . should come before mozilla because the plugin needs libvlc_pic.a
# - po should come before . because VLC.app needs the pofiles
SUBDIRS = intl modules po . mozilla activex share m4 doc
# - loader should come before modules because some plugins need it
SUBDIRS = intl loader modules po . mozilla activex share m4 doc
DIST_SUBDIRS = $(SUBDIRS) src debian ipkg lib
EXTRA_DIST = \
......
......@@ -34,6 +34,7 @@ if test "${CXX}" != ""; then
fi
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AM_PROG_AS
dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
dnl now otherwise it might be set in an obscure if statement.
......@@ -4077,6 +4078,21 @@ then
AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
fi
dnl
dnl DLL loader copied from MPlayer copied from somewhere else (WINE ?)
dnl
loader=false
AC_ARG_ENABLE(loader,
[ --enable-loader build DLL loader for ELF i386 platforms (default disabled)])
AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
AS_IF([test "${enable_loader}" = "yes"],
[ VLC_ADD_PLUGINS([dmo quicktime])
VLC_ADD_CPPFLAGS([dmo],[-I../../../@top_srcdir@/loader])
VLC_ADD_LDFLAGS([dmo],[../../../loader/libloader.a])
VLC_ADD_CPPFLAGS([quicktime],[-I../../@top_srcdir@/loader])
VLC_ADD_LDFLAGS([quicktime],[../../loader/libloader.a])
])
dnl
dnl Microsoft ActiveX support
dnl
......@@ -4347,6 +4363,7 @@ AC_CONFIG_FILES([
intl/Makefile
ipkg/Makefile
lib/Makefile
loader/Makefile
modules/Makefile
mozilla/Makefile
m4/Makefile
......
# Makefile to build MPlayer's DLL loader
# from VLC trunk
#
# by Rémi Denis-Courmont <rem # videolan.org>
# $Id$
#
# All other files in this directory (and subdirectories) are copyrighted
# by their respective owner(s).
#
if LOADER
noinst_LIBRARIES = libloader.a
endif
# TODO: real check for vsscanf() and <sys/mmap.h>
AM_CPPFLAGS = -D__WINE__ -DHAVE_SYS_MMAN_H=1 -DHAVE_VSSCANF=1 \
-DWIN32_PATH=\"\" -DTRACE\(...\)=\(void\)0
AM_CFLAGS = -fno-PIC `$(top_builddir)/vlc-config --cflags` -U_FILE_OFFSET_BITS \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
noinst_HEADERS = com.h driver.h ext.h ldt_keeper.h loader.h registry.h \
win32.h wineacm.h wrapper.h qtx/qtxsdk/components.h \
wine/avifmt.h wine/basetsd.h wine/debugtools.h wine/driver.h \
wine/heap.h wine/mmreg.h wine/module.h wine/msacmdrv.h wine/msacm.h \
wine/pe_image.h wine/poppack.h wine/pshpack1.h wine/pshpack2.h \
wine/vfw.h wine/winbase.h wine/windef.h wine/winerror.h \
wine/winestring.h wine/winnt.h wine/winreg.h wine/winuser.h
libloader_a_SOURCES = ldt_keeper.c pe_image.c module.c ext.c win32.c \
driver.c pe_resource.c resource.c registry.c afl.c vfl.c \
wrapper.S stubs.s kludge.c
This diff is collapsed.
This diff is collapsed.
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifndef AVIFILE_COM_H
#define AVIFILE_COM_H
#include "config.h"
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#include <inttypes.h>
#endif
/**
* Internal functions and structures for COM emulation code.
*/
#if !defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
#ifdef __cplusplus
extern "C" {
#endif
void* CoTaskMemAlloc(unsigned long cb);
void CoTaskMemFree(void* cb);
#ifndef GUID_TYPE
#define GUID_TYPE
typedef struct
{
uint32_t f1;
uint16_t f2;
uint16_t f3;
uint8_t f4[8];
} GUID;
#endif
extern const GUID IID_IUnknown;
extern const GUID IID_IClassFactory;
typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv);
int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
#ifndef STDCALL
#define STDCALL __attribute__((__stdcall__))
#endif
struct IUnknown;
struct IClassFactory;
struct IUnknown_vt
{
long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv);
long STDCALL (*AddRef)(struct IUnknown* _this) ;
long STDCALL (*Release)(struct IUnknown* _this) ;
} ;
typedef struct IUnknown
{
struct IUnknown_vt* vt;
} IUnknown;
struct IClassFactory_vt
{
long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv);
long STDCALL (*AddRef)(struct IUnknown* _this) ;
long STDCALL (*Release)(struct IUnknown* _this) ;
long STDCALL (*CreateInstance)(struct IClassFactory* _this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject);
};
struct IClassFactory
{
struct IClassFactory_vt* vt;
};
long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
long dwClsContext, const GUID* riid, void** ppv);
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /* WIN32 */
#endif /* AVIFILE_COM_H */
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
#ifdef __FreeBSD__
#include <sys/time.h>
#endif
#include "win32.h"
#include "wine/driver.h"
#include "wine/pe_image.h"
#include "wine/winreg.h"
#include "wine/vfw.h"
#include "registry.h"
#ifdef WIN32_LOADER
#include "ldt_keeper.h"
#endif
#include "driver.h"
#ifndef __MINGW32__
#include "ext.h"
#endif
#ifndef WIN32_LOADER
char* def_path=WIN32_PATH;
#else
extern char* def_path;
#endif
#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
// this asm code is no longer needed
#define STORE_ALL \
__asm__ __volatile__ ( \
"push %%ebx\n\t" \
"push %%ecx\n\t" \
"push %%edx\n\t" \
"push %%esi\n\t" \
"push %%edi\n\t"::)
#define REST_ALL \
__asm__ __volatile__ ( \
"pop %%edi\n\t" \
"pop %%esi\n\t" \
"pop %%edx\n\t" \
"pop %%ecx\n\t" \
"pop %%ebx\n\t"::)
#endif
static int needs_free=0;
void SetCodecPath(const char* path)
{
if(needs_free)free(def_path);
if(path==0)
{
def_path=WIN32_PATH;
needs_free=0;
return;
}
def_path = (char*) malloc(strlen(path)+1);
strcpy(def_path, path);
needs_free=1;
}
static DWORD dwDrvID = 0;
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
LPARAM lParam1, LPARAM lParam2)
{
DRVR* module=(DRVR*)hDriver;
int result;
#ifndef __svr4__
char qw[300];
#endif
#ifdef DETAILED_OUT
printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2);
#endif
if (!module || !module->hDriverModule || !module->DriverProc) return -1;
#ifndef __svr4__
__asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
#endif
#ifdef WIN32_LOADER
Setup_FS_Segment();
#endif
STORE_ALL;
result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2);
REST_ALL;
#ifndef __svr4__
__asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));
#endif
#ifdef DETAILED_OUT
printf("\t\tResult: %X\n", result);
#endif
return result;
}
void DrvClose(HDRVR hDriver)
{
if (hDriver)
{
DRVR* d = (DRVR*)hDriver;
if (d->hDriverModule)
{
#ifdef WIN32_LOADER
Setup_FS_Segment();
#endif
if (d->DriverProc)
{
SendDriverMessage(hDriver, DRV_CLOSE, 0, 0);
d->dwDriverID = 0;
SendDriverMessage(hDriver, DRV_FREE, 0, 0);
}
FreeLibrary(d->hDriverModule);
}
free(d);
}
#ifdef WIN32_LOADER
CodecRelease();
#endif
}
//DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2)
HDRVR DrvOpen(LPARAM lParam2)
{
NPDRVR hDriver;
int i;
char unknown[0x124];
const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved;
#ifdef MPLAYER
#ifdef WIN32_LOADER
Setup_LDT_Keeper();
#endif
printf("Loading codec DLL: '%s'\n",filename);
#endif
hDriver = (NPDRVR) malloc(sizeof(DRVR));
if (!hDriver)
return ((HDRVR) 0);
memset((void*)hDriver, 0, sizeof(DRVR));
#ifdef WIN32_LOADER
CodecAlloc();
Setup_FS_Segment();
#endif
hDriver->hDriverModule = LoadLibraryA(filename);
if (!hDriver->hDriverModule)
{
printf("Can't open library %s\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
}
hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule,
"DriverProc");
if (!hDriver->DriverProc)
{
printf("Library %s is not a valid VfW/ACM codec\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
}
TRACE("DriverProc == %X\n", hDriver->DriverProc);
SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0);
TRACE("DRV_LOAD Ok!\n");
SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0);
TRACE("DRV_ENABLE Ok!\n");
hDriver->dwDriverID = ++dwDrvID; // generate new id
// open driver and remmeber proper DriverID
hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2);
TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID);
printf("Loaded DLL driver %s at %x\n", filename, hDriver->hDriverModule);
return (HDRVR)hDriver;
}
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifndef loader_driver_h
#define loader_driver_h
#ifdef __cplusplus
extern "C" {
#endif
#include "wine/windef.h"
#include "wine/driver.h"
void SetCodecPath(const char* path);
void CodecAlloc(void);
void CodecRelease(void);
HDRVR DrvOpen(LPARAM lParam2);
void DrvClose(HDRVR hdrvr);
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifndef loader_ext_h
#define loader_ext_h
#include "wine/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
int dbg_printf(const char *format, ...)
{
return 0;
}
/**
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file MUST be in main library because LDT must
* be modified before program creates first thread
* - avifile includes this file from C++ code
* and initializes it at the start of player!
* it might sound like a hack and it really is - but
* as aviplay is deconding video with more than just one
* thread currently it's necessary to do it this way
* this might change in the future
*/
/* applied some modification to make make our xine friend more happy */
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#include "ldt_keeper.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
// 2.5.xx+ calls this user_desc:
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)
#define modify_ldt_ldt_s user_desc
#endif
/* prototype it here, so we won't depend on kernel headers */
#ifdef __cplusplus
extern "C" {
#endif
/// declare modify_ldt with the _syscall3 macro for older glibcs
#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0))
_syscall3( int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount );
#else
int modify_ldt(int func, void *ptr, unsigned long bytecount);
#endif
#ifdef __cplusplus
}
#endif
#else
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <machine/segments.h>
#include <machine/sysarch.h>
#endif
#ifdef __svr4__
#include <sys/segment.h>
#include <sys/sysi86.h>
/* solaris x86: add missing prototype for sysi86() */
#ifdef __cplusplus
extern "C" {
#endif
int sysi86(int, void*);
#ifdef __cplusplus
}
#endif
#ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */
#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
#endif
#define TEB_SEL_IDX NUMSYSLDTS
#endif
#define LDT_ENTRIES 8192
#define LDT_ENTRY_SIZE 8
#pragma pack(4)
struct modify_ldt_ldt_s {
unsigned int entry_number;
unsigned long base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
};
#define MODIFY_LDT_CONTENTS_DATA 0
#define MODIFY_LDT_CONTENTS_STACK 1
#define MODIFY_LDT_CONTENTS_CODE 2
#endif
/* user level (privilege level: 3) ldt (1<<2) segment selector */
#define LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3)
/* i got this value from wine sources, it's the first free LDT entry */
#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
#define TEB_SEL_IDX LDT_AUTO_ALLOC
#endif
#ifndef TEB_SEL_IDX
#define TEB_SEL_IDX 17
#endif
static unsigned int fs_ldt = TEB_SEL_IDX;
/**
* here is a small logical problem with Restore for multithreaded programs -
* in C++ we use static class for this...
*/
#ifdef __cplusplus
extern "C"
#endif
void Setup_FS_Segment(void)
{
unsigned int ldt_desc = LDT_SEL(fs_ldt);
__asm__ __volatile__(
"movl %0,%%eax; movw %%ax, %%fs" : : "r" (ldt_desc)
:"eax"
);
}
/* we don't need this - use modify_ldt instead */
#if 0
#ifdef __linux__
/* XXX: why is this routine from libc redefined here? */
/* NOTE: the redefined version ignores the count param, count is hardcoded as 16 */
static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr,
unsigned long count )
{
int res;
#ifdef __PIC__
__asm__ __volatile__( "pushl %%ebx\n\t"
"movl %2,%%ebx\n\t"
"int $0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "0" (__NR_modify_ldt),
"r" (func),
"c" (ptr),
"d"(16)//sizeof(*ptr) from kernel point of view
:"esi" );
#else
__asm__ __volatile__("int $0x80"
: "=a" (res)
: "0" (__NR_modify_ldt),
"b" (func),
"c" (ptr),
"d"(16)
:"esi");
#endif /* __PIC__ */
if (res >= 0) return res;
errno = -res;
return -1;
}
#endif
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
{
*buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
(content->limit & 0x0ffff);
*buffer = (content->base_addr & 0xff000000) |
((content->base_addr & 0x00ff0000)>>16) |
(content->limit & 0xf0000) |
(content->contents << 10) |
((content->read_exec_only == 0) << 9) |
((content->seg_32bit != 0) << 22) |
((content->limit_in_pages != 0) << 23) |
0xf000;
}
#endif
void* fs_seg=0;
ldt_fs_t* Setup_LDT_Keeper(void)
{
struct modify_ldt_ldt_s array;
int ret;
ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t));
if (!ldt_fs)
return NULL;
ldt_fs->fd = open("/dev/zero", O_RDWR);
if(ldt_fs->fd<0){
perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: ");
return NULL;
}
fs_seg=
ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE,
ldt_fs->fd, 0);
if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
close(ldt_fs->fd);
free(ldt_fs);
return NULL;
}
*(void**)((char*)ldt_fs->fs_seg+0x18) = ldt_fs->fs_seg;
memset(&array, 0, sizeof(array));
array.base_addr=(int)ldt_fs->fs_seg;
array.entry_number=TEB_SEL_IDX;
array.limit=array.base_addr+getpagesize()-1;
array.seg_32bit=1;
array.read_exec_only=0;
array.seg_not_present=0;
array.contents=MODIFY_LDT_CONTENTS_DATA;
array.limit_in_pages=0;
#ifdef __linux__
//ret=LDT_Modify(0x1, &array, sizeof(struct modify_ldt_ldt_s));
ret=modify_ldt(0x1, &array, sizeof(struct modify_ldt_ldt_s));
if(ret<0)
{
perror("install_fs");
printf("Couldn't install fs segment, expect segfault\n");
}
#endif /*linux*/
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
{
unsigned long d[2];
LDT_EntryToBytes( d, &array );
#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1);
array.entry_number = ret;
fs_ldt = ret;
#else
ret = i386_set_ldt(array.entry_number, (union descriptor *)d, 1);
#endif
if (ret < 0)
{
perror("install_fs");
printf("Couldn't install fs segment, expect segfault\n");
printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
}
}
#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */
#if defined(__svr4__)
{
struct ssd ssd;
ssd.sel = LDT_SEL(TEB_SEL_IDX);
ssd.bo = array.base_addr;
ssd.ls = array.limit - array.base_addr;
ssd.acc1 = ((array.read_exec_only == 0) << 1) |
(array.contents << 2) |
0xf0; /* P(resent) | DPL3 | S */
ssd.acc2 = 0x4; /* byte limit, 32-bit segment */
if (sysi86(SI86DSCR, &ssd) < 0) {
perror("sysi86(SI86DSCR)");
printf("Couldn't install fs segment, expect segfault\n");
}
}
#endif
Setup_FS_Segment();
ldt_fs->prev_struct = (char*)malloc(sizeof(char) * 8);
*(void**)array.base_addr = ldt_fs->prev_struct;
return ldt_fs;
}
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
{
if (ldt_fs == NULL || ldt_fs->fs_seg == 0)
return;
if (ldt_fs->prev_struct)
free(ldt_fs->prev_struct);
munmap((char*)ldt_fs->fs_seg, getpagesize());
ldt_fs->fs_seg = 0;
close(ldt_fs->fd);
free(ldt_fs);
}
#ifndef LDT_KEEPER_H
#define LDT_KEEPER_H
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct {
void* fs_seg;
char* prev_struct;
int fd;
} ldt_fs_t;
void Setup_FS_Segment(void);
ldt_fs_t* Setup_LDT_Keeper(void);
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs);
#ifdef __cplusplus
}
#endif
#endif /* LDT_KEEPER_H */
/********************************************************
Win32 binary loader interface
Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
Shamelessly stolen from Wine project
*********************************************************/
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifndef _LOADER_H
#define _LOADER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "wine/windef.h"
#include "wine/driver.h"
#include "wine/mmreg.h"
#include "wine/vfw.h"
#include "wine/msacm.h"
unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename);
int _GetPrivateProfileStringA(const char* appname, const char* keyname,
const char* def_val, char* dest, unsigned int len, const char* filename);
int _WritePrivateProfileStringA(const char* appname, const char* keyname,
const char* string, const char* filename);
INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
LPSTR buffer, INT buflen );
#ifdef __cplusplus
}
#endif
#endif /* __LOADER_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef AVIFILE_REGISTRY_H
#define AVIFILE_REGISTRY_H
/********************************************************
*
* Declaration of registry access functions
* Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
*
********************************************************/
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifdef __cplusplus
extern "C" {
#endif
void free_registry(void);
long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved,
long access, int* newkey);
long __stdcall RegCloseKey(long key);
long __stdcall RegQueryValueExA(long key, const char* value, int* reserved,
int* type, int* data, int* count);
long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
void* classs, long options, long security,
void* sec_attr, int* newkey, int* status);
long __stdcall RegSetValueExA(long key, const char* name, long v1, long v2,
const void* data, long size);
#ifdef __WINE_WINERROR_H
long __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName,
LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass,
LPFILETIME lpftLastWriteTime);
long __stdcall RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
#endif
#ifdef __cplusplus
};
#endif
#endif // AVIFILE_REGISTRY_H
This diff is collapsed.
.data
.LC0: .string "Called unk_%s\n"
.balign 4
.globl unk_exp1
unk_exp1:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
movl $1,-4(%ebp)
movl -4(%ebp),%eax
movl %eax,%ecx
movl %ecx,%edx
sall $4,%edx
subl %eax,%edx
leal 0(,%edx,2),%eax
movl %eax,%edx
addl $export_names,%edx
pushl %edx
pushl $.LC0
call printf
addl $8,%esp
xorl %eax,%eax
leave
ret
.globl exp_EH_prolog
exp_EH_prolog:
pushl $0xff
pushl %eax
pushl %fs:0
movl %esp, %fs:0
movl 12(%esp), %eax
movl %ebp, 12(%esp)
leal 12(%esp), %ebp
pushl %eax
ret
This diff is collapsed.
This diff is collapsed.
/*
* Modified for use with MPlayer, detailed CVS changelog at
* http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*/
#ifndef loader_win32_h
#define loader_win32_h
#include <time.h>
#include "wine/windef.h"
#include "wine/winbase.h"
#include "com.h"
#ifdef AVIFILE
#ifdef __GNUC__
#include "avm_output.h"
#ifndef __cplusplus
#define printf(a, ...) avm_printf("Win32 plugin", a, ## __VA_ARGS__)
#endif
#endif
#endif
extern void 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 void* LookupExternal(const char* library, int ordinal);
extern void* LookupExternalByName(const char* library, const char* name);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Win32 heap definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_HEAP_H
#define __WINE_HEAP_H
#include "config.h"
#include "winbase.h"
extern HANDLE SystemHeap;
extern HANDLE SegptrHeap;
extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
/* SEGPTR helper macros */
#define SEGPTR_ALLOC(size) \
(HeapAlloc( SegptrHeap, 0, (size) ))
#define SEGPTR_NEW(type) \
((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
#define SEGPTR_STRDUP(str) \
(HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
#define SEGPTR_STRDUP_WtoA(str) \
(HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
/* define an inline function, a macro won't do */
static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr);
}
#define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
#define SEGPTR_FREE(ptr) \
(HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
/* system heap private data */
/* you must lock the system heap before using this structure */
typedef struct
{
void *gdi; /* GDI heap */
void *user; /* USER handle table */
void *cursor; /* cursor information */
void *queue; /* message queues descriptor */
void *win; /* windows descriptor */
void *root; /* X11 root window */
} SYSTEM_HEAP_DESCR;
extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
#endif /* __WINE_HEAP_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment