[MPlayer-cvslog] r33949 - trunk/loader/win32.c

reimar subversion at mplayerhq.hu
Sat Jul 30 22:26:29 CEST 2011


Author: reimar
Date: Sat Jul 30 22:26:29 2011
New Revision: 33949

Log:
Add some additional function/hacks needed for newer CFDecode2.ax versions.

Modified:
   trunk/loader/win32.c

Modified: trunk/loader/win32.c
==============================================================================
--- trunk/loader/win32.c	Sat Jul 30 20:40:20 2011	(r33948)
+++ trunk/loader/win32.c	Sat Jul 30 22:26:29 2011	(r33949)
@@ -69,6 +69,9 @@ for DLL to know too much about its envir
 #ifdef	HAVE_KSTAT
 #include <kstat.h>
 #endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
 
 #if HAVE_SYS_MMAN_H
 #include <sys/mman.h>
@@ -345,7 +348,7 @@ void* mreq_private(int size, int to_zero
 void* mreq_private(int size, int to_zero, int type)
 {
     int nsize = size + sizeof(alloc_header);
-    alloc_header* header = malloc(nsize);
+    alloc_header* header = memalign(16, nsize);
     if (!header)
         return 0;
     if (to_zero)
@@ -3962,6 +3965,13 @@ static LONG WINAPI explstrlenA(const cha
     return result;
 }
 
+static LONG WINAPI explstrlenW(const uint16_t* s)
+{
+    int result = 0;
+    while (s && s[result]) result++;
+    return result;
+}
+
 static LONG WINAPI explstrcpyA(char* str1, const char* str2)
 {
     int result= (int) strcpy(str1, str2);
@@ -4310,6 +4320,8 @@ static int expsscanf(const char* str, co
 static void* expfopen(const char* path, const char* mode)
 {
     printf("fopen: \"%s\"  mode:%s\n", path, mode);
+    if (strcmp(mode, "r") == 0 || strcmp(mode, "rb") == 0)
+        return NULL;
     //return fopen(path, mode);
     return fdopen(0, mode); // everything on screen
 }
@@ -4576,12 +4588,39 @@ static double expfrexp(double x, int* ex
 }
 
 
+static void exp_splitpath(const char *path, char *drive, char *dir, char *name, char *ext)
+{
+    const char *ext_start = strrchr(path, '.');
+    int name_len = ext_start ? ext_start - path : strlen(path);
+    if (drive)
+        strcpy(drive, "");
+    if (dir)
+        strcpy(dir, "");
+    if (name) {
+        strncpy(name, path, name_len);
+        name[name_len] = 0;
+    }
+    if (ext)
+        strcpy(ext, ext_start ? ext_start : "");
+}
+
+static char *exp_mbsupr(char *str)
+{
+    int i;
+    for (i = 0; str[i]; i++) str[i] = toupper(str[i]);
+    return str;
+}
 
 static int exp_stricmp(const char* s1, const char* s2)
 {
     return strcasecmp(s1, s2);
 }
 
+static uint64_t exp_time64(void)
+{
+    return 0;
+}
+
 /* from declaration taken from Wine sources - this fountion seems to be
  * undocumented in any M$ doc */
 static int exp_setjmp3(void* jmpbuf, int x)
@@ -5284,6 +5323,7 @@ static const struct exports exp_kernel32
     FF(MulDiv, -1)
     FF(lstrcmpiA, -1)
     FF(lstrlenA, -1)
+    FF(lstrlenW, -1)
     FF(lstrcpyA, -1)
     FF(lstrcatA, -1)
     FF(lstrcpynA,-1)
@@ -5570,10 +5610,25 @@ static const struct exports exp_msvcr80[
     FF(_CIsin,-1)
     FF(_CIcos,-1)
     FF(_CIsqrt,-1)
+    FF(memcpy,-1)
     FF(memset,-1)
+    FF(sprintf,-1)
+    FF(strncpy,-1)
+    FF(fopen,-1)
+    FF(malloc,-1)
+    FF(free,-1)
     FF(_initterm_e, -1)
     FF(_initterm, -1)
     FF(_decode_pointer, -1)
+
+// For CFDecode2.ax
+    {"_aligned_free",-1,(void*)expfree},
+    {"_aligned_malloc",-1,(void*)expmalloc},
+    FF(_splitpath,-1)
+    FF(_mbsupr,-1)
+    {"_mbscmp", -1, (void*)strcmp},
+    {"clock",-1,(void*)&clock},
+    FF(_time64,-1)
 /* needed by KGV1-VFW.dll */
     {"??2 at YAPAXI@Z", -1, expnew},
     {"??3 at YAXPAX@Z", -1, expdelete}


More information about the MPlayer-cvslog mailing list