aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-08 22:26:14 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-08 22:26:14 +0000
commit031c6bf512614d3097ecd17c30eb9c2022804a9a (patch)
tree3d29a9dd51356ebefb788c74f7b9fd5eea94d26c /loader
parentfeb1135edaf1bea9b3708d17f4772baa451d6212 (diff)
changes merged back from avifile cvs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2140 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/elfdll.c11
-rw-r--r--loader/ext.h1
-rw-r--r--loader/ldt_keeper.c37
-rw-r--r--loader/win32.c62
-rw-r--r--loader/win32.h10
5 files changed, 88 insertions, 33 deletions
diff --git a/loader/elfdll.c b/loader/elfdll.c
index 8b8c7656c8..b54dbce6e3 100644
--- a/loader/elfdll.c
+++ b/loader/elfdll.c
@@ -7,14 +7,7 @@
#ifdef HAVE_LIBDL
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
#include <wine/windef.h>
-//#include <wine/global.h>
-//#include <wine/process.h>
#include <wine/module.h>
#include <wine/heap.h>
#include <wine/elfdll.h>
@@ -23,6 +16,10 @@
//DEFAULT_DEBUG_CHANNEL(elfdll)
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
#include <dlfcn.h>
struct modref_list_t;
diff --git a/loader/ext.h b/loader/ext.h
index f6b121e9b7..fa4f52d43e 100644
--- a/loader/ext.h
+++ b/loader/ext.h
@@ -1,4 +1,3 @@
-
#ifndef loader_ext_h
#define loader_ext_h
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 4cd4d78d20..18ddb22ce3 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -6,6 +6,8 @@
* and initializes it at the start of player!
*/
+#include "ldt_keeper.h"
+
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@@ -14,7 +16,6 @@
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
-
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
@@ -36,8 +37,8 @@ extern int sysi86(int, void*);
}
#endif
-#ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */
-#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
+#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
@@ -72,8 +73,6 @@ 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
@@ -81,8 +80,8 @@ struct modify_ldt_ldt_s {
*
*/
-static void* fs_seg=NULL;
-static char* prev_struct=NULL;
+static void* fs_seg = NULL;
+static char* prev_struct = NULL;
/**
* here is a small logical problem with Restore for multithreaded programs -
* in C++ we use static class for this...
@@ -200,18 +199,18 @@ void Setup_LDT_Keeper(void)
#if defined(__svr4__)
{
- struct ssd ssd;
- ssd.sel = TEB_SEL;
- 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 = TEB_SEL;
+ 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
diff --git a/loader/win32.c b/loader/win32.c
index 97ac40acf5..bb26233efe 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -19,10 +19,16 @@
#include "wine/winerror.h"
#include "wine/debugtools.h"
#include "wine/module.h"
-#include "win32.h"
#include <stdio.h>
+#include "win32.h"
+
+#include "registry.h"
+#include "loader.h"
+#include "com.h"
+
#include <stdlib.h>
+#include <stdarg.h>
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
@@ -39,9 +45,6 @@
#include <kstat.h>
#endif
-#include "registry.h"
-#include "loader.h"
-#include "com.h"
char* def_path=WIN32_PATH;
@@ -221,7 +224,7 @@ void* my_mreq(int size, int to_zero)
if(to_zero)
memset(heap+heap_counter, 0, size);
else
- memset(heap+heap_counter, 0xcc, size); // make crash reprocable
+ memset(heap+heap_counter, 0xcc, size); // make crash reproducable
heap_counter+=size;
return heap+heap_counter-size;
}
@@ -1945,7 +1948,33 @@ int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keynam
dbgprintf(" => 0\n");
return 0;
}
-
+int expsprintf(char* str, const char* format, ...)
+{
+ va_list args;
+ int r;
+ dbgprintf("sprintf(%s, %s)\n", str, format);
+ va_start(args, format);
+ r = vsprintf(str, format, args);
+ va_end(args);
+ return r;
+}
+int expsscanf(const char* str, const char* format, ...)
+{
+ va_list args;
+ int r;
+ dbgprintf("sscanf(%s, %s)\n", str, format);
+ va_start(args, format);
+ r = vsscanf(str, format, args);
+ va_end(args);
+ return r;
+}
+void* expfopen(const char* path, const char* mode)
+{
+ //fails
+ printf("fopen: \"%s\" mode:%s\n", path, mode);
+ //return fopen(path, mode);
+ return 0;
+}
unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename)
{
return expGetPrivateProfileIntA(appname, keyname, default_value, filename);
@@ -2063,6 +2092,21 @@ time_t exptime(time_t* t)
return result;
}
+int exprand()
+{
+ return rand();
+}
+
+void expsrand(int seed)
+{
+ srand(seed);
+}
+
+int exp_ftol(float f)
+{
+ return (int)(f+.5);
+}
+
int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax)
{
int result=snprintf(str, cbMax, "%.8x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
@@ -2818,6 +2862,12 @@ FF(isalnum, -1)
FF(memmove, -1)
FF(memcmp, -1)
FF(time, -1)
+FF(_ftol,-1)
+FF(rand, -1)
+FF(srand, -1)
+FF(sprintf,-1)
+FF(sscanf,-1)
+FF(fopen,-1)
};
struct exports exp_winmm[]={
FF(GetDriverModuleHandle, -1)
diff --git a/loader/win32.h b/loader/win32.h
index 8293ab25be..47fb5fa744 100644
--- a/loader/win32.h
+++ b/loader/win32.h
@@ -201,6 +201,7 @@ 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);
extern void CDECL expfree(void* mem);
extern void* CDECL expnew(int size);
@@ -219,7 +220,16 @@ 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 int expsprintf(char* str, const char* format, ...);
+extern int expsscanf(const char* str, const char* format, ...);
+extern void* expfopen(const char* path, const char* mode);
+
+
extern void* LookupExternal(const char* library, int ordinal);
extern void* LookupExternalByName(const char* library, const char* name);
+extern int exprand();
+extern int exp_ftol(float f);
+extern void WINAPI expInitCommonControls();
+
#endif