summaryrefslogtreecommitdiffstats
path: root/loader/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'loader/win32.c')
-rw-r--r--loader/win32.c95
1 files changed, 33 insertions, 62 deletions
diff --git a/loader/win32.c b/loader/win32.c
index d0cbddca66..0b1999a043 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -49,6 +49,7 @@ for DLL to know too much about its environment.
#include "loader.h"
#include "com.h"
#include "ext.h"
+#include "path.h"
#include <stdlib.h>
#include <assert.h>
@@ -77,8 +78,6 @@ for DLL to know too much about its environment.
#include "osdep/mmap_anon.h"
#include "libavutil/avstring.h"
-char* def_path = BINARY_CODECS_PATH;
-
static void do_cpuid(unsigned int ax, unsigned int *regs)
{
__asm__ volatile
@@ -146,7 +145,7 @@ static void longcount_stub(long long*);
static unsigned int (*localcount)()=localcount_stub;
static void (*longcount)(long long*)=longcount_stub;
-static pthread_mutex_t memmut;
+static pthread_mutex_t memmut = PTHREAD_MUTEX_INITIALIZER;
static unsigned int localcount_stub(void)
{
@@ -366,14 +365,9 @@ void* mreq_private(int size, int to_zero, int type)
if (to_zero)
memset(header, 0, nsize);
#ifdef GARBAGE
- if (!last_alloc)
- {
- pthread_mutex_init(&memmut, NULL);
- pthread_mutex_lock(&memmut);
- }
- else
+ pthread_mutex_lock(&memmut);
+ if (last_alloc)
{
- pthread_mutex_lock(&memmut);
last_alloc->next = header; /* set next */
}
@@ -442,10 +436,7 @@ static int my_release(void* memory)
alccnt--;
- if (last_alloc)
- pthread_mutex_unlock(&memmut);
- else
- pthread_mutex_destroy(&memmut);
+ pthread_mutex_unlock(&memmut);
//if (alccnt < 40000) printf("MY_RELEASE: %p\t%ld (%d)\n", header, header->size, alccnt);
#else
@@ -1182,13 +1173,6 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
}
}
fclose (f);
- /*
- * ad hoc fix for smp machines.
- * some problems on WaitForSingleObject,CreateEvent,SetEvent
- * CreateThread ...etc..
- *
- */
- cachedsi.dwNumberOfProcessors=1;
}
#endif /* __linux__ */
cache = 1;
@@ -1814,47 +1798,31 @@ static long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1
static long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
{
- dbgprintf("GetVersionExA(0x%x) => 1\n");
+ dbgprintf("GetVersionExA(0x%x) => 1\n", c);
c->dwOSVersionInfoSize=sizeof(*c);
- c->dwMajorVersion=4;
- c->dwMinorVersion=0;
- c->dwBuildNumber=0x4000457;
-#if 1
- // leave it here for testing win9x-only codecs
- c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
- strcpy(c->szCSDVersion, " B");
-#else
- c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers
- strcpy(c->szCSDVersion, "Service Pack 3");
-#endif
- dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n"
- " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n");
+ c->dwMajorVersion=5;
+ c->dwMinorVersion=1;
+ c->dwBuildNumber=0x5010a28;
+ c->dwPlatformId=VER_PLATFORM_WIN32_NT;
+ strcpy(c->szCSDVersion, "Service Pack 2");
+ dbgprintf(" Major version: 5\n Minor version: 1\n Build number: 0x5010a28\n"
+ " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 2'\n");
return 1;
}
static long WINAPI expGetVersionExW(OSVERSIONINFOW* c)
{
char CSDVersion[128];
- dbgprintf("GetVersionExW(0x%x) => 1\n");
+ dbgprintf("GetVersionExW(0x%x) => 1\n", c);
c->dwOSVersionInfoSize=sizeof(*c);
c->dwMajorVersion=5;
- c->dwMinorVersion=0;
- c->dwBuildNumber=0x5000457;
-#if 1
- // leave it here for testing win9x-only codecs
- c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
- strcpy(CSDVersion, " B");
-#else
- c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers
- strcpy(CSDVersion, "Service Pack 3");
-#endif
+ c->dwMinorVersion=1;
+ c->dwBuildNumber=0x5010a28;
+ c->dwPlatformId=VER_PLATFORM_WIN32_NT;
+ strcpy(CSDVersion, "Service Pack 2");
MultiByteToWideChar(65001, 0x0, CSDVersion, -1, c->szCSDVersion, 128);
- dbgprintf(" Major version: %d\n Minor version: %d\n Build number: 0x%08x\n"
- " Platform Id: %s\n Version string: '%s'\n",
- c->dwMajorVersion, c->dwMinorVersion, c->dwBuildNumber,
- (c->dwPlatformId==VER_PLATFORM_WIN32_WINDOWS ? "VER_PLATFORM_WIN32_WINDOWS" :
- (c->dwPlatformId==VER_PLATFORM_WIN32_NT ? "VER_PLATFORM_WIN32_NT" : "Unknown")),
- CSDVersion);
+ dbgprintf(" Major version: 5\n Minor version: 1\n Build number: 0x5010a28\n"
+ " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 2'\n");
return 1;
}
@@ -2604,7 +2572,8 @@ static int WINAPI expLoadLibraryA(char* name)
return MODULE_HANDLE_psapi;
result=LoadLibraryA(name);
- dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
+ dbgprintf("Returned LoadLibraryA(0x%x='%s'), codec_path=%s => 0x%x\n",
+ name, name, codec_path, result);
return result;
}
@@ -3618,13 +3587,15 @@ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd)
#ifdef CONFIG_QTX_CODECS
if(strstr(s, "quicktime\\*.QTX")){
dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTX\n", s, s, lpfd);
- dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",def_path);
- qtx_dir=opendir(def_path);
+ dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",
+ codec_path);
+ qtx_dir = opendir(codec_path);
if(!qtx_dir) return (HANDLE)-1;
memset(lpfd,0,sizeof(*lpfd));
if(expFindNextFileA(FILE_HANDLE_quicktimeqtx,lpfd))
return FILE_HANDLE_quicktimeqtx;
- printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",def_path);
+ printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",
+ codec_path);
return (HANDLE)-1;
}
#if 0
@@ -3761,8 +3732,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strstr(cs1, "QuickTime.qts"))
{
int result;
- char* tmp=malloc(strlen(def_path)+50);
- strcpy(tmp, def_path);
+ char* tmp = malloc(strlen(codec_path) + 50);
+ strcpy(tmp, codec_path);
strcat(tmp, "/");
strcat(tmp, "QuickTime.qts");
result=open(tmp, O_RDONLY);
@@ -3772,9 +3743,9 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strstr(cs1, ".qtx"))
{
int result;
- char* tmp=malloc(strlen(def_path)+250);
+ char* tmp = malloc(strlen(codec_path) + 250);
char* x=strrchr(cs1,'\\');
- sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
+ sprintf(tmp, "%s/%s", codec_path, x ? (x + 1) : cs1);
// printf("### Open: %s -> %s\n",cs1,tmp);
result=open(tmp, O_RDONLY);
free(tmp);
@@ -3785,8 +3756,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strncmp(cs1, "AP", 2) == 0)
{
int result;
- char* tmp=malloc(strlen(def_path)+50);
- strcpy(tmp, def_path);
+ char* tmp = malloc(strlen(codec_path) + 50);
+ strcpy(tmp, codec_path);
strcat(tmp, "/");
strcat(tmp, "APmpg4v1.apl");
result=open(tmp, O_RDONLY);