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

sesse subversion at mplayerhq.hu
Mon Mar 15 13:54:54 CET 2010


Author: sesse
Date: Mon Mar 15 13:54:54 2010
New Revision: 30900

Log:
Implement GetVersionExW with the same data as GetVersionExA but taking in a
different structure, and CreateMutexW, CreateEventW and CreateSemaphoreW as
simple wrappers around the A versions.

Modified:
   trunk/loader/win32.c

Modified: trunk/loader/win32.c
==============================================================================
--- trunk/loader/win32.c	Mon Mar 15 13:05:56 2010	(r30899)
+++ trunk/loader/win32.c	Mon Mar 15 13:54:54 2010	(r30900)
@@ -792,6 +792,18 @@ static void* WINAPI expCreateEventA(void
     return ret;
 }
 
+static void* WINAPI expCreateEventW(void* pSecAttr, char bManualReset,
+                                    char bInitialState, const WCHAR* name)
+{
+    char ascii_name[256];
+    char *aname = NULL;
+    if (name) {
+        WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL);
+        aname = ascii_name;
+    }
+    return expCreateEventA(pSecAttr, bManualReset, bInitialState, aname);
+}
+
 static void* WINAPI expSetEvent(void* event)
 {
     mutex_list *ml = (mutex_list *)event;
@@ -1798,6 +1810,7 @@ static long WINAPI expWideCharToMultiByt
     if(s2)dbgprintf("  dest: %s\n", s2);
     return result;
 }
+
 static long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
 {
     dbgprintf("GetVersionExA(0x%x) => 1\n");
@@ -1817,6 +1830,33 @@ static long WINAPI expGetVersionExA(OSVE
 	      "  Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n");
     return 1;
 }
+
+static long WINAPI expGetVersionExW(OSVERSIONINFOW* c)
+{
+    char CSDVersion[128];
+    dbgprintf("GetVersionExW(0x%x) => 1\n");
+    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
+    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);
+    return 1;
+}
+
 static HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count,
 					 long max_count, char* name)
 {
@@ -1891,6 +1931,18 @@ static HANDLE WINAPI expCreateSemaphoreA
     return ret;
 }
 
+static HANDLE WINAPI expCreateSemaphoreW(char* v1, long init_count,
+                                         long max_count, const WCHAR* name)
+{
+    char ascii_name[256];
+    char *aname = NULL;
+    if (name) {
+        WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL);
+        aname = ascii_name;
+    }
+    return expCreateSemaphoreA(v1, init_count, max_count, aname);
+}
+
 static long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count)
 {
     // The state of a semaphore object is signaled when its count
@@ -1977,6 +2029,17 @@ static HANDLE WINAPI expCreateMutexA(voi
     return ret;
 }
 
+static HANDLE WINAPI expCreateMutexW(void *pSecAttr, char bInitialOwner, const WCHAR *name)
+{
+    char ascii_name[256];
+    char *aname = NULL;
+    if (name) {
+        WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL);
+        aname = ascii_name;
+    }
+    return expCreateMutexA(pSecAttr, bInitialOwner, aname);
+}
+
 static int WINAPI expReleaseMutex(HANDLE hMutex)
 {
     mutex_list *ml = (mutex_list *)hMutex;
@@ -5130,6 +5193,7 @@ struct exports exp_kernel32[]=
     FF(CreateThread, -1)
     FF(ResumeThread, -1)
     FF(CreateEventA, -1)
+    FF(CreateEventW, -1)
     FF(SetEvent, -1)
     FF(ResetEvent, -1)
     FF(WaitForSingleObject, -1)
@@ -5169,7 +5233,9 @@ struct exports exp_kernel32[]=
     FF(MultiByteToWideChar, 427)
     FF(WideCharToMultiByte, -1)
     FF(GetVersionExA, -1)
+    FF(GetVersionExW, -1)
     FF(CreateSemaphoreA, -1)
+    FF(CreateSemaphoreW, -1)
     FF(QueryPerformanceCounter, -1)
     FF(QueryPerformanceFrequency, -1)
     FF(LocalHandle, -1)
@@ -5181,6 +5247,7 @@ struct exports exp_kernel32[]=
     FF(LoadResource, -1)
     FF(ReleaseSemaphore, -1)
     FF(CreateMutexA, -1)
+    FF(CreateMutexW, -1)
     FF(ReleaseMutex, -1)
     FF(SignalObjectAndWait, -1)
     FF(FindResourceA, -1)


More information about the MPlayer-cvslog mailing list