From: He Yang <1160386...@qq.com>

Signed-off-by: He Yang <1160386...@qq.com>
---
 libavdevice/gdigrab.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index 9b2c55fe90..ff4055c925 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -230,9 +230,10 @@ gdigrab_read_header(AVFormatContext *s1)
     HBITMAP hbmp   = NULL;
     void *buffer   = NULL;
 
-    const char *filename = s1->url;
-    const char *name     = NULL;
-    AVStream   *st       = NULL;
+    const char *filename  = s1->url;
+    const char *name      = NULL;
+    const wchar_t *name_w = NULL;
+    AVStream   *st        = NULL;
 
     int bpp;
     int horzres;
@@ -246,7 +247,17 @@ gdigrab_read_header(AVFormatContext *s1)
 
     if (!strncmp(filename, "title=", 6)) {
         name = filename + 6;
-        hwnd = FindWindow(NULL, name);
+        if(utf8towchar(name, &name_w)) {
+            ret = AVERROR(ENOMEM);
+            goto error;
+        }
+        if(!name_w) {
+            ret = AVERROR(EINVAL);
+            goto error;
+        }
+        hwnd = FindWindowW(NULL, name_w);
+        av_free(name_w);
+        name_w = NULL;
         if (!hwnd) {
             av_log(s1, AV_LOG_ERROR,
                    "Can't find window '%s', aborting.\n", name);
-- 
2.30.0.windows.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to