dpnet: Check if DirectPlay is installed (try 2)
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Sun Mar 2 16:57:42 CST 2014
Hi,
Changelog:
dpnet: Check if DirectPlay is installed
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From d89a3948698d7ec79a9257abb72e4544086c3fcc Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 3 Mar 2014 09:58:51 +1100
Subject: [PATCH] Check if DirectPlay is installed
To: wine-patches <wine-patches at winehq.org>
---
dlls/dpnet/tests/Makefile.in | 2 +-
dlls/dpnet/tests/peer.c | 7 +++++++
dlls/dpnet/tests/server.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/dlls/dpnet/tests/Makefile.in b/dlls/dpnet/tests/Makefile.in
index 9220121..64d7808 100644
--- a/dlls/dpnet/tests/Makefile.in
+++ b/dlls/dpnet/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = dpnet.dll
-IMPORTS = dpnet ole32
+IMPORTS = dpnet ole32 version
C_SRCS = \
peer.c \
diff --git a/dlls/dpnet/tests/peer.c b/dlls/dpnet/tests/peer.c
index aea67c9..e583430 100644
--- a/dlls/dpnet/tests/peer.c
+++ b/dlls/dpnet/tests/peer.c
@@ -23,6 +23,7 @@
#include <dplay8.h>
#include "wine/test.h"
+extern BOOL IsStubDLL(const char *filename) DECLSPEC_HIDDEN;
static IDirectPlay8Peer* peer = NULL;
@@ -200,6 +201,12 @@ static void test_cleanup_dp(void)
START_TEST(peer)
{
+ if(IsStubDLL("dpnet.dll"))
+ {
+ win_skip("dpnet not installed.\n");
+ return;
+ }
+
test_init_dp();
test_enum_service_providers();
test_enum_hosts();
diff --git a/dlls/dpnet/tests/server.c b/dlls/dpnet/tests/server.c
index c4de81e..79c163d 100644
--- a/dlls/dpnet/tests/server.c
+++ b/dlls/dpnet/tests/server.c
@@ -96,10 +96,59 @@ static void create_server(void)
}
}
+/*
+ * We cannot just load a stub dll without triggering the "Feature not Installed"
+ * dialog. However we can check if the OrigialName matches a known stub name.
+ */
+BOOL IsStubDLL(const char *filename)
+{
+ DWORD size, ver;
+ BOOL isstub = FALSE;
+
+ size = GetFileVersionInfoSizeA(filename, &ver);
+ ok(size != 0, "failed %d,%d\n", size, GetLastError());
+ if(size != 0)
+ {
+ LPSTR data = HeapAlloc(GetProcessHeap(), 0, size);
+ char *p;
+ UINT translation;
+ char buf[MAX_PATH];
+
+ if (GetFileVersionInfoA(filename, ver, size, data))
+ {
+ VerQueryValueA(data, "\\VarFileInfo\\Translation", (LPVOID*)&p, &size);
+
+ translation = *(UINT *)p;
+ translation = MAKELONG(HIWORD(translation), LOWORD(translation));
+
+ sprintf(buf, "\\StringFileInfo\\%08x\\OriginalFilename", translation);
+ trace("translation: %s\n", buf);
+ if (VerQueryValueA(data, buf, (LPVOID*)&p, &size))
+ {
+ trace("orig: '%s'\n", p);
+ if(lstrcmpiA("wcodstub.dll", p) == 0)
+ {
+ isstub = TRUE;
+ }
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, data);
+ }
+
+ return isstub;
+}
+
START_TEST(server)
{
HRESULT hr;
+ if(IsStubDLL("dpnet.dll"))
+ {
+ win_skip("dpnet not installed.\n");
+ return;
+ }
+
hr = CoInitialize(0);
ok( hr == S_OK, "failed to init com\n");
if (hr != S_OK)
--
1.8.3.2
More information about the wine-patches
mailing list