summaryrefslogtreecommitdiffstats
path: root/loader/win32.c
diff options
context:
space:
mode:
authorsesse <sesse@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-15 12:54:54 +0000
committersesse <sesse@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-15 12:54:54 +0000
commit22ede70e586599ab5810494c8321ea76c8821184 (patch)
tree97277827e4d6302a0ade10518dad32129968aa0c /loader/win32.c
parent45fd2e045749d2459eb2174030513b29dcb47ff6 (diff)
downloadmpv-22ede70e586599ab5810494c8321ea76c8821184.tar.bz2
mpv-22ede70e586599ab5810494c8321ea76c8821184.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30900 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader/win32.c')
-rw-r--r--loader/win32.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/loader/win32.c b/loader/win32.c
index 96106da154..ad5ecf21e8 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -792,6 +792,18 @@ static void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset,
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 expWideCharToMultiByte(long v1, long v2, short* s1, long siz1
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(OSVERSIONINFOA* c)
" 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(char* v1, long init_count,
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(void *pSecAttr,
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)