wine-staging/patches/atl-AtlAxDialogBox/0001-atl-Implement-AtlAxDialogBox-A-W.patch

101 lines
3.2 KiB
Diff
Raw Normal View History

2018-11-18 15:22:39 -08:00
From 452c42b4855e2f6338fa9b8746377ff9fe9ee706 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Wed, 23 Apr 2014 04:16:53 +0800
Subject: [PATCH] atl: Implement AtlAxDialogBox[A,W]
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=32749
---
dlls/atl/atl_ax.c | 60 +++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 50 insertions(+), 10 deletions(-)
diff --git a/dlls/atl/atl_ax.c b/dlls/atl/atl_ax.c
index 8121278..92fcb84 100644
--- a/dlls/atl/atl_ax.c
+++ b/dlls/atl/atl_ax.c
@@ -28,6 +28,7 @@
#include "winerror.h"
#include "winuser.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "objbase.h"
#include "objidl.h"
#include "ole2.h"
@@ -1407,25 +1408,64 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
}
/***********************************************************************
- * AtlAxDialogBoxW [atl100.35]
+ * AtlAxDialogBoxA [atl100.@]
*
*/
-INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc,
- LPARAM dwInitParam)
+INT_PTR WINAPI AtlAxDialogBoxA(HINSTANCE hInst, LPCSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
{
- FIXME("(%p %s %p %p %lx)\n", hInstance, debugstr_w(lpTemplateName), hWndParent, lpDialogProc, dwInitParam);
- return 0;
+ INT_PTR res = 0;
+ int length;
+ WCHAR *nameW;
+
+ if (IS_INTRESOURCE(name))
+ return AtlAxDialogBoxW( hInst, (LPCWSTR) name, owner, dlgProc, param );
+
+ length = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
+ nameW = heap_alloc( length * sizeof(WCHAR) );
+ if (nameW)
+ {
+ MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, length );
+ res = AtlAxDialogBoxW( hInst, nameW, owner, dlgProc, param );
+ heap_free( nameW );
+ }
+ return res;
}
/***********************************************************************
- * AtlAxDialogBoxA [atl100.36]
+ * AtlAxDialogBoxW [atl100.@]
*
*/
-INT_PTR WINAPI AtlAxDialogBoxA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc,
- LPARAM dwInitParam)
+INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
{
- FIXME("(%p %s %p %p %lx)\n", hInstance, debugstr_a(lpTemplateName), hWndParent, lpDialogProc, dwInitParam);
- return 0;
+ HRSRC hrsrc;
+ HGLOBAL hgl;
+ LPCDLGTEMPLATEW ptr;
+ LPDLGTEMPLATEW newptr;
+ INT_PTR res;
+
+ TRACE("(%p %s %p %p %lx)\n", hInst, debugstr_w(name), owner, dlgProc, param);
+
+ hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG );
+ if ( !hrsrc )
+ return 0;
+ hgl = LoadResource (hInst, hrsrc);
+ if ( !hgl )
+ return 0;
+ ptr = LockResource ( hgl );
+ if (!ptr)
+ {
+ FreeResource( hgl );
+ return 0;
+ }
+ newptr = AX_ConvertDialogTemplate( ptr );
+ if ( newptr )
+ {
+ res = DialogBoxIndirectParamW( hInst, newptr, owner, dlgProc, param );
+ heap_free( newptr );
+ } else
+ res = 0;
+ FreeResource ( hrsrc );
+ return res;
}
/***********************************************************************
--
1.9.1