changeset 30858:62c00b7dd846

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.
author sesse
date Mon, 15 Mar 2010 12:54:54 +0000
parents 77ce62f13d42
children ee4e8dbc4d8a
files loader/win32.c
diffstat 1 files changed, 67 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/loader/win32.c	Mon Mar 15 12:05:56 2010 +0000
+++ b/loader/win32.c	Mon Mar 15 12:54:54 2010 +0000
@@ -792,6 +792,18 @@
     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 @@
     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 @@
 	      "  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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     FF(LoadResource, -1)
     FF(ReleaseSemaphore, -1)
     FF(CreateMutexA, -1)
+    FF(CreateMutexW, -1)
     FF(ReleaseMutex, -1)
     FF(SignalObjectAndWait, -1)
     FF(FindResourceA, -1)