Andrew Nguyen : dinput: Implement IDirectInput::RunControlPanel.
Alexandre Julliard
julliard at winehq.org
Wed Jul 6 13:31:04 CDT 2011
Module: wine
Branch: master
Commit: 90e9e3103af0f383a6d321dd6f4c288e387dfdc9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=90e9e3103af0f383a6d321dd6f4c288e387dfdc9
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Tue Jul 5 07:18:40 2011 -0500
dinput: Implement IDirectInput::RunControlPanel.
---
dlls/dinput/dinput_main.c | 15 ++++++++-
dlls/dinput/tests/Makefile.in | 1 +
dlls/dinput/tests/dinput.c | 69 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 1 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 1329ec6..3493bdd 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -510,9 +510,22 @@ static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface,
HWND hwndOwner,
DWORD dwFlags)
{
+ WCHAR control_exeW[] = {'c','o','n','t','r','o','l','.','e','x','e',0};
+ STARTUPINFOW si = {0};
+ PROCESS_INFORMATION pi;
+
IDirectInputImpl *This = impl_from_IDirectInput7A( iface );
- FIXME( "(%p)->(%p,%08x): stub\n", This, hwndOwner, dwFlags );
+ TRACE( "(%p)->(%p, %08x)\n", This, hwndOwner, dwFlags );
+
+ if (hwndOwner && !IsWindow(hwndOwner))
+ return E_HANDLE;
+
+ if (dwFlags)
+ return DIERR_INVALIDPARAM;
+
+ if (!CreateProcessW(NULL, control_exeW, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
+ return HRESULT_FROM_WIN32(GetLastError());
return DI_OK;
}
diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in
index 6fb3180..9b04eb1 100644
--- a/dlls/dinput/tests/Makefile.in
+++ b/dlls/dinput/tests/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS = dinput ole32 version user32
C_SRCS = \
device.c \
+ dinput.c \
joystick.c \
keyboard.c \
mouse.c
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c
new file mode 100644
index 0000000..71ed4f6
--- /dev/null
+++ b/dlls/dinput/tests/dinput.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Andrew Nguyen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define DIRECTINPUT_VERSION 0x0700
+
+#define COBJMACROS
+#include <windows.h>
+#include <dinput.h>
+
+#include "wine/test.h"
+
+HINSTANCE hInstance;
+
+static void test_RunControlPanel(void)
+{
+ IDirectInputA *pDI;
+ HRESULT hr;
+
+ hr = DirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &pDI, NULL);
+ if (FAILED(hr))
+ {
+ win_skip("Failed to instantiate a IDirectInputA instance: 0x%08x\n", hr);
+ return;
+ }
+
+ if (winetest_interactive)
+ {
+ hr = IDirectInput_RunControlPanel(pDI, NULL, 0);
+ ok(hr == S_OK, "IDirectInput_RunControlPanel returned 0x%08x\n", hr);
+
+ hr = IDirectInput_RunControlPanel(pDI, GetDesktopWindow(), 0);
+ ok(hr == S_OK, "IDirectInput_RunControlPanel returned 0x%08x\n", hr);
+ }
+
+ hr = IDirectInput_RunControlPanel(pDI, NULL, ~0u);
+ ok(hr == DIERR_INVALIDPARAM, "IDirectInput_RunControlPanel returned 0x%08x\n", hr);
+
+ hr = IDirectInput_RunControlPanel(pDI, (HWND)0xdeadbeef, 0);
+ ok(hr == E_HANDLE, "IDirectInput_RunControlPanel returned 0x%08x\n", hr);
+
+ hr = IDirectInput_RunControlPanel(pDI, (HWND)0xdeadbeef, ~0u);
+ ok(hr == E_HANDLE, "IDirectInput_RunControlPanel returned 0x%08x\n", hr);
+
+ IDirectInput_Release(pDI);
+}
+
+START_TEST(dinput)
+{
+ hInstance = GetModuleHandleA(NULL);
+
+ CoInitialize(NULL);
+ test_RunControlPanel();
+ CoUninitialize();
+}
More information about the wine-cvs
mailing list