Commit dcfd2c71 authored by Rafaël Carré's avatar Rafaël Carré

Revert previous commit for loader as it is external to vlc

parent 6ee1e193
This diff is collapsed.
......@@ -78,7 +78,7 @@ struct IClassFactory
};
long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
long dwClsContext, const GUID* riid, void** ppv);
long dwClsContext, const GUID* riid, void** ppv);
#ifdef __cplusplus
};
......
......@@ -97,9 +97,9 @@ void SetCodecPath(const char* path)
if(needs_free)free(def_path);
if(path==0)
{
def_path=WIN32_PATH;
needs_free=0;
return;
def_path=WIN32_PATH;
needs_free=0;
return;
}
def_path = (char*) malloc(strlen(path)+1);
strcpy(def_path, path);
......@@ -109,7 +109,7 @@ void SetCodecPath(const char* path)
static DWORD dwDrvID = 0;
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
LPARAM lParam1, LPARAM lParam2)
LPARAM lParam1, LPARAM lParam2)
{
DRVR* module=(DRVR*)hDriver;
int result;
......@@ -146,21 +146,21 @@ void DrvClose(HDRVR hDriver)
{
if (hDriver)
{
DRVR* d = (DRVR*)hDriver;
if (d->hDriverModule)
{
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);
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();
......@@ -184,7 +184,7 @@ HDRVR DrvOpen(LPARAM lParam2)
hDriver = (NPDRVR) malloc(sizeof(DRVR));
if (!hDriver)
return ((HDRVR) 0);
return ((HDRVR) 0);
memset((void*)hDriver, 0, sizeof(DRVR));
#ifdef WIN32_LOADER
......@@ -195,18 +195,18 @@ HDRVR DrvOpen(LPARAM lParam2)
hDriver->hDriverModule = LoadLibraryA(filename);
if (!hDriver->hDriverModule)
{
printf("Can't open library %s\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
printf("Can't open library %s\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
}
hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule,
"DriverProc");
"DriverProc");
if (!hDriver->DriverProc)
{
printf("Library %s is not a valid VfW/ACM codec\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
printf("Library %s is not a valid VfW/ACM codec\n", filename);
DrvClose((HDRVR)hDriver);
return ((HDRVR) 0);
}
TRACE("DriverProc == %X\n", hDriver->DriverProc);
......
......@@ -5,7 +5,7 @@
*/
#ifndef loader_driver_h
#define loader_driver_h
#define loader_driver_h
#ifdef __cplusplus
extern "C" {
......
This diff is collapsed.
......@@ -10,9 +10,9 @@
#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 );
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, ... );
......
......@@ -23,5 +23,5 @@
int dbg_printf(const char *format, ...)
{
return 0;
return 0;
}
......@@ -146,8 +146,8 @@ 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"
"movl %0,%%eax; movw %%ax, %%fs" : : "r" (ldt_desc)
:"eax"
);
}
......@@ -157,28 +157,28 @@ void Setup_FS_Segment(void)
/* 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 )
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" );
"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");
: "=a" (res)
: "0" (__NR_modify_ldt),
"b" (func),
"c" (ptr),
"d"(16)
:"esi");
#endif /* __PIC__ */
if (res >= 0) return res;
errno = -res;
......@@ -191,15 +191,15 @@ static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr,
static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
{
*buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
(content->limit & 0x0ffff);
(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;
((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
......@@ -212,22 +212,22 @@ ldt_fs_t* Setup_LDT_Keeper(void)
ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t));
if (!ldt_fs)
return NULL;
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;
return NULL;
}
fs_seg=
ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE,
ldt_fs->fd, 0);
ldt_fs->fd, 0);
if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
perror("ERROR: Couldn't allocate memory for fs segment");
close(ldt_fs->fd);
free(ldt_fs);
return NULL;
return NULL;
}
*(void**)((char*)ldt_fs->fs_seg+0x18) = ldt_fs->fs_seg;
memset(&array, 0, sizeof(array));
......@@ -244,8 +244,8 @@ ldt_fs_t* Setup_LDT_Keeper(void)
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");
perror("install_fs");
printf("Couldn't install fs segment, expect segfault\n");
}
#endif /*linux*/
......@@ -264,7 +264,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
if (ret < 0)
{
perror("install_fs");
printf("Couldn't install fs segment, expect segfault\n");
printf("Couldn't install fs segment, expect segfault\n");
printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
}
}
......@@ -272,18 +272,18 @@ ldt_fs_t* Setup_LDT_Keeper(void)
#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");
}
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
......@@ -298,9 +298,9 @@ ldt_fs_t* Setup_LDT_Keeper(void)
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
{
if (ldt_fs == NULL || ldt_fs->fs_seg == 0)
return;
return;
if (ldt_fs->prev_struct)
free(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);
......
......@@ -42,9 +42,9 @@ extern "C" {
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);
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);
const char* string, const char* filename);
INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
LPSTR buffer, INT buflen );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -21,23 +21,23 @@ extern "C" {
void free_registry(void);
long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved,
long access, int* newkey);
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);
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);
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);
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);
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);
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
#endif
#ifdef __cplusplus
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,19 +9,19 @@
#define MMSYSERR_BASE 0
#define MMSYSERR_NOERROR 0 /* no error */
#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
#define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
#define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
#define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
#define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
#define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
#define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
#define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */
#define MMSYSERR_LASTERROR (MMSYSERR_BASE + 11) /* last error in range */
#define MMSYSERR_NOERROR 0 /* no error */
#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
#define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
#define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
#define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
#define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
#define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
#define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
#define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */
#define MMSYSERR_LASTERROR (MMSYSERR_BASE + 11) /* last error in range */
#define DRV_LOAD 0x0001
#define DRV_ENABLE 0x0002
......@@ -42,29 +42,29 @@
#define DRVCNF_CANCEL 0x0000
#define DRVCNF_OK 0x0001
#define DRVCNF_RESTART 0x0002
#define DRVCNF_RESTART 0x0002
#define DRVEA_NORMALEXIT 0x0001
#define DRVEA_ABNORMALEXIT 0x0002
#define DRVEA_NORMALEXIT 0x0001
#define DRVEA_ABNORMALEXIT 0x0002
#define DRV_SUCCESS 0x0001
#define DRV_FAILURE 0x0000
#define DRV_SUCCESS 0x0001
#define DRV_FAILURE 0x0000
#define GND_FIRSTINSTANCEONLY 0x00000001
#define GND_FIRSTINSTANCEONLY 0x00000001
#define GND_FORWARD 0x00000000
#define GND_REVERSE 0x00000002
#define GND_FORWARD 0x00000000
#define GND_REVERSE 0x00000002
typedef struct {
DWORD dwDCISize;
LPCSTR lpszDCISectionName;
LPCSTR lpszDCIAliasName;
DWORD dwDCISize;
LPCSTR lpszDCISectionName;
LPCSTR lpszDCIAliasName;
} DRVCONFIGINFO16, *LPDRVCONFIGINFO16;
typedef struct {
DWORD dwDCISize;
LPCWSTR lpszDCISectionName;
LPCWSTR lpszDCIAliasName;
DWORD dwDCISize;
LPCWSTR lpszDCISectionName;
LPCWSTR lpszDCIAliasName;
} DRVCONFIGINFO, *LPDRVCONFIGINFO;
......@@ -74,13 +74,13 @@ typedef struct {
*/
typedef struct
{
UINT16 length;
HDRVR16 hDriver;
HINSTANCE16 hModule;
CHAR szAliasName[128];
UINT16 length;
HDRVR16 hDriver;
HINSTANCE16 hModule;
CHAR szAliasName[128];
} DRIVERINFOSTRUCT16, *LPDRIVERINFOSTRUCT16;
LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
LPARAM dwParam1, LPARAM dwParam2);
LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr,
UINT Msg, LPARAM lParam1, LPARAM lParam2);
......@@ -105,8 +105,8 @@ DWORD WINAPI GetDriverFlags( HDRVR hDriver );
/* this call (GetDriverFlags) is not documented, nor the flags returned.
* here are Wine only definitions
*/
#define WINE_GDF_EXIST 0x80000000
#define WINE_GDF_16BIT 0x10000000
#define WINE_GDF_EXIST 0x80000000
#define WINE_GDF_16BIT 0x10000000
#endif
#endif /* __WINE_DRIVER_H */
......@@ -31,7 +31,7 @@ extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR 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 */
/* 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);
}
......
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