[PATCH] avicap32: Partially implement capCreateCaptureWindowW.
Gijs Vermeulen
gijsvrm at gmail.com
Tue Aug 31 08:59:14 CDT 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38011
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
dlls/avicap32/Makefile.in | 1 +
dlls/avicap32/avicap32_main.c | 72 ++++++++++++++++++++++++++---------
2 files changed, 56 insertions(+), 17 deletions(-)
diff --git a/dlls/avicap32/Makefile.in b/dlls/avicap32/Makefile.in
index 8f5a1089d5c..f320a58f04b 100644
--- a/dlls/avicap32/Makefile.in
+++ b/dlls/avicap32/Makefile.in
@@ -1,4 +1,5 @@
MODULE = avicap32.dll
IMPORTLIB = avicap32
+IMPORTS = user32
C_SRCS = avicap32_main.c
diff --git a/dlls/avicap32/avicap32_main.c b/dlls/avicap32/avicap32_main.c
index 9e2a99d4c7c..6ed8db1d552 100644
--- a/dlls/avicap32/avicap32_main.c
+++ b/dlls/avicap32/avicap32_main.c
@@ -56,36 +56,74 @@
WINE_DEFAULT_DEBUG_CHANNEL(avicap);
+static ATOM registered_class = 0;
+static WCHAR class_nameW[] = {'W','i','n','e','A','v','i','C','a','p','C','l','a','s','s',0};
+
+static LRESULT CALLBACK avicap_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch(msg)
+ {
+ /* FIXME: handle WM_CAP_* messages */
+ default:
+ return DefWindowProcW(hwnd, msg, wparam, lparam);
+ }
+}
+
+static ATOM register_class(void)
+{
+ WNDCLASSEXW class;
+
+ class.cbSize = sizeof(WNDCLASSEXW);
+ class.style = 0;
+ class.lpfnWndProc = avicap_wndproc;
+ class.cbClsExtra = 0;
+ class.cbWndExtra = 0;
+ class.hInstance = GetModuleHandleW(NULL);
+ class.hIcon = NULL;
+ class.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
+ class.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+ class.lpszMenuName = NULL;
+ class.lpszClassName = class_nameW;
+ class.hIconSm = NULL;
+
+ return RegisterClassExW(&class);
+}
/***********************************************************************
* capCreateCaptureWindowW (AVICAP32.@)
*/
-HWND VFWAPI capCreateCaptureWindowW(LPCWSTR lpszWindowName, DWORD dwStyle, INT x,
- INT y, INT nWidth, INT nHeight, HWND hWnd,
- INT nID)
+HWND VFWAPI capCreateCaptureWindowW(const WCHAR *window_name, DWORD style, INT x,
+ INT y, INT width, INT height, HWND hWnd, INT id)
{
- FIXME("(%s, %08x, %08x, %08x, %08x, %08x, %p, %08x): stub\n",
- debugstr_w(lpszWindowName), dwStyle, x, y, nWidth, nHeight, hWnd, nID);
- return 0;
+ FIXME("(%s, %08x, %08x, %08x, %08x, %08x, %p, %08x): semi-stub\n",
+ debugstr_w(window_name), style, x, y, width, height, hWnd, id);
+
+ if (!registered_class && !(registered_class = register_class()))
+ {
+ ERR("Failed to register class!\n");
+ return NULL;
+ }
+
+ return CreateWindowExW(style, class_nameW, window_name, style, x, y, width, height,
+ hWnd, NULL, GetModuleHandleW(NULL), NULL);
}
/***********************************************************************
* capCreateCaptureWindowA (AVICAP32.@)
*/
-HWND VFWAPI capCreateCaptureWindowA(LPCSTR lpszWindowName, DWORD dwStyle, INT x,
- INT y, INT nWidth, INT nHeight, HWND hWnd,
- INT nID)
-{ UNICODE_STRING nameW;
- HWND retW;
+HWND VFWAPI capCreateCaptureWindowA(const char *window_name, DWORD style, INT x,
+ INT y, INT width, INT height, HWND hWnd, INT id)
+{ UNICODE_STRING window_nameW;
+ HWND ret;
- if (lpszWindowName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszWindowName);
- else nameW.Buffer = NULL;
+ if (window_name) RtlCreateUnicodeStringFromAsciiz(&window_nameW, window_name);
+ else window_nameW.Buffer = NULL;
- retW = capCreateCaptureWindowW(nameW.Buffer, dwStyle, x, y, nWidth, nHeight,
- hWnd, nID);
- RtlFreeUnicodeString(&nameW);
+ ret = capCreateCaptureWindowW(window_nameW.Buffer, style, x, y, width, height,
+ hWnd, id);
+ RtlFreeUnicodeString(&window_nameW);
- return retW;
+ return ret;
}
#ifdef HAVE_LINUX_VIDEODEV2_H
--
2.33.0
More information about the wine-devel
mailing list