- Implement capCreateCaptureWindowA and capGetDriverDescriptionA (based on Wine code)
authorDmitry Chapyshev <dmitry@reactos.org>
Sat, 25 Jul 2009 09:41:17 +0000 (09:41 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Sat, 25 Jul 2009 09:41:17 +0000 (09:41 +0000)
svn path=/trunk/; revision=42198

reactos/dll/win32/avicap32/avicap32.c

index 7b212e8..816a46d 100644 (file)
@@ -6,18 +6,22 @@
  */
 
 #include <windows.h>
+#include <winternl.h>
 #include <vfw.h>
 
 #include "wine/debug.h"
 
+#define CAP_DESC_MAX 32
+
 WINE_DEFAULT_DEBUG_CHANNEL(avicap32);
 
+
 /*
  * unimplemented
  */
 HWND
 VFWAPI
-capCreateCaptureWindowA(LPCSTR lpszWindowName,
+capCreateCaptureWindowW(LPCWSTR lpszWindowName,
                         DWORD dwStyle,
                         INT x,
                         INT y,
@@ -30,13 +34,12 @@ capCreateCaptureWindowA(LPCSTR lpszWindowName,
     return NULL;
 }
 
-
 /*
- * unimplemented
+ * implemented
  */
 HWND
 VFWAPI
-capCreateCaptureWindowW(LPCWSTR lpszWindowName,
+capCreateCaptureWindowA(LPCSTR lpszWindowName,
                         DWORD dwStyle,
                         INT x,
                         INT y,
@@ -45,8 +48,24 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName,
                         HWND hWnd,
                         INT nID)
 {
-    UNIMPLEMENTED;
-    return NULL;
+    UNICODE_STRING Name;
+    HWND Wnd;
+
+    if (lpszWindowName)
+        RtlCreateUnicodeStringFromAsciiz(&Name, lpszWindowName);
+    else
+        Name.Buffer = NULL;
+
+    Wnd = capCreateCaptureWindowW(Name.Buffer,
+                                  dwStyle,
+                                  x, y,
+                                  nWidth,
+                                  nHeight,
+                                  hWnd,
+                                  nID);
+
+    RtlFreeUnicodeString(&Name);
+    return Wnd;
 }
 
 
@@ -55,10 +74,10 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName,
  */
 BOOL
 VFWAPI
-capGetDriverDescriptionA(WORD wDriverIndex,
-                         LPSTR lpszName,
+capGetDriverDescriptionW(WORD wDriverIndex,
+                         LPWSTR lpszName,
                          INT cbName,
-                         LPSTR lpszVer,
+                         LPWSTR lpszVer,
                          INT cbVer)
 {
     UNIMPLEMENTED;
@@ -67,18 +86,27 @@ capGetDriverDescriptionA(WORD wDriverIndex,
 
 
 /*
- * unimplemented
+ * implemented
  */
 BOOL
 VFWAPI
-capGetDriverDescriptionW(WORD wDriverIndex,
-                         LPWSTR lpszName,
+capGetDriverDescriptionA(WORD wDriverIndex,
+                         LPSTR lpszName,
                          INT cbName,
-                         LPWSTR lpszVer,
+                         LPSTR lpszVer,
                          INT cbVer)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    WCHAR DevName[CAP_DESC_MAX], DevVer[CAP_DESC_MAX];
+    BOOL Result;
+
+    Result = capGetDriverDescriptionW(wDriverIndex, DevName, CAP_DESC_MAX, DevVer, CAP_DESC_MAX);
+    if (Result)
+    {
+        WideCharToMultiByte(CP_ACP, 0, DevName, -1, lpszName, cbName, NULL, NULL);
+        WideCharToMultiByte(CP_ACP, 0, DevVer, -1, lpszVer, cbVer, NULL, NULL);
+    }
+
+    return Result;
 }