From: "Jiajin Cui" Subject: [PATCH] twain_32: Fix crash by call TWAIN_UserSelect twice. Message-Id: <202106012122393190051@uniontech.com> Date: Tue, 1 Jun 2021 21:22:43 +0800 From 4bab7a3348a4ce192ca60a649eca066310b6fb95 Mon Sep 17 00:00:00 2001 From: Jiajin Cui Date: Tue, 1 Jun 2021 21:13:54 +0800 Subject: [PATCH] twain_32: Fix crash by call TWAIN_UserSelect twice. The DG_CONTROL\DAT_PARENT\MSG_OPENDSM operation may be the window handle or the address of the window handle. Signed-off-by: Jiajin Cui --- dlls/twain_32/dsm_ctrl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/twain_32/dsm_ctrl.c b/dlls/twain_32/dsm_ctrl.c index 45f227e180b..d4216c8850a 100644 --- a/dlls/twain_32/dsm_ctrl.c +++ b/dlls/twain_32/dsm_ctrl.c @@ -435,6 +435,9 @@ TW_UINT16 TWAIN_UserSelect (pTW_IDENTITY pOrigin, TW_MEMREF pData) twain_autodetect(); + if (!IsWindow(parent)) + parent = *(HWND*)DSM_parent; + if (!IsWindow(parent)) parent = NULL; -- 2.20.1