changeset 2139:e06cabbd1a9b

changes merged back from avifile cvs
author arpi
date Mon, 08 Oct 2001 22:26:14 +0000
parents b2c97c56c50e
children 885c9c802373
files loader/elfdll.c loader/ext.h loader/ldt_keeper.c loader/win32.c loader/win32.h
diffstat 5 files changed, 88 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/loader/elfdll.c	Mon Oct 08 19:03:55 2001 +0000
+++ b/loader/elfdll.c	Mon Oct 08 22:26:14 2001 +0000
@@ -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;
--- a/loader/ext.h	Mon Oct 08 19:03:55 2001 +0000
+++ b/loader/ext.h	Mon Oct 08 22:26:14 2001 +0000
@@ -1,4 +1,3 @@
-
 #ifndef loader_ext_h
 #define loader_ext_h
 
--- a/loader/ldt_keeper.c	Mon Oct 08 19:03:55 2001 +0000
+++ b/loader/ldt_keeper.c	Mon Oct 08 22:26:14 2001 +0000
@@ -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 @@
 }
 #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 @@
 #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 @@
  *
  */
 
-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 @@
 
 #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
 
--- a/loader/win32.c	Mon Oct 08 19:03:55 2001 +0000
+++ b/loader/win32.c	Mon Oct 08 22:26:14 2001 +0000
@@ -19,10 +19,16 @@
 #include "wine/winerror.h"
 #include "wine/debugtools.h"
 #include "wine/module.h"
+
+#include <stdio.h>
 #include "win32.h"
 
-#include <stdio.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 @@
     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 @@
     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 @@
     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(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)
--- a/loader/win32.h	Mon Oct 08 19:03:55 2001 +0000
+++ b/loader/win32.h	Mon Oct 08 22:26:14 2001 +0000
@@ -201,6 +201,7 @@
 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 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