mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:21:14 +00:00
atl: Improved content type handling of AtlAxCreateControlEx.
This commit is contained in:
parent
189ffc2e73
commit
ec52a1f557
7 changed files with 65 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
MODULE = atl.dll
|
||||
IMPORTLIB = atl
|
||||
IMPORTS = uuid oleaut32 ole32 user32 gdi32 advapi32
|
||||
IMPORTS = uuid oleaut32 ole32 user32 gdi32 advapi32 shlwapi
|
||||
EXTRADEFS = -D_ATL_VER=_ATL_VER_30
|
||||
|
||||
C_SRCS = \
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "atlbase.h"
|
||||
#include "atliface.h"
|
||||
#include "atlwin.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
|
@ -991,6 +992,48 @@ HRESULT WINAPI AtlAxCreateControl(LPCOLESTR lpszName, HWND hWnd,
|
|||
NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
enum content
|
||||
{
|
||||
IsEmpty = 0,
|
||||
IsGUID = 1,
|
||||
IsHTML = 2,
|
||||
IsURL = 3,
|
||||
IsUnknown = 4
|
||||
};
|
||||
|
||||
static enum content get_content_type(LPCOLESTR name, CLSID *control_id)
|
||||
{
|
||||
WCHAR new_urlW[MAX_PATH];
|
||||
DWORD size = MAX_PATH;
|
||||
WCHAR mshtml_prefixW[] = {'m','s','h','t','m','l',':','\0'};
|
||||
|
||||
if (!name || !name[0])
|
||||
{
|
||||
WARN("name %s\n", wine_dbgstr_w(name));
|
||||
return IsEmpty;
|
||||
}
|
||||
|
||||
if (CLSIDFromString(name, control_id) == S_OK ||
|
||||
CLSIDFromProgID(name, control_id) == S_OK)
|
||||
return IsGUID;
|
||||
|
||||
if (PathIsURLW (name) ||
|
||||
UrlApplySchemeW(name, new_urlW, &size, URL_APPLY_GUESSSCHEME|URL_APPLY_GUESSFILE) == S_OK)
|
||||
{
|
||||
*control_id = CLSID_WebBrowser;
|
||||
return IsURL;
|
||||
}
|
||||
|
||||
if (!strncmpiW(name, mshtml_prefixW, 7))
|
||||
{
|
||||
FIXME("mshtml prefix not implemented\n");
|
||||
*control_id = CLSID_WebBrowser;
|
||||
return IsHTML;
|
||||
}
|
||||
|
||||
return IsUnknown;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AtlAxCreateControlEx [atl100.@]
|
||||
*
|
||||
|
@ -1005,24 +1048,24 @@ HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR lpszName, HWND hWnd,
|
|||
CLSID controlId;
|
||||
HRESULT hRes;
|
||||
IOleObject *pControl;
|
||||
IUnknown *pUnkControl;
|
||||
IUnknown *pUnkControl = NULL;
|
||||
IPersistStreamInit *pPSInit;
|
||||
IUnknown *pContainer;
|
||||
enum {IsGUID=0,IsHTML=1,IsURL=2} content;
|
||||
IUnknown *pContainer = NULL;
|
||||
enum content content;
|
||||
|
||||
TRACE("(%s %p %p %p %p %p %p)\n", debugstr_w(lpszName), hWnd, pStream,
|
||||
ppUnkContainer, ppUnkControl, iidSink, punkSink);
|
||||
|
||||
hRes = CLSIDFromString( lpszName, &controlId );
|
||||
if ( FAILED(hRes) )
|
||||
hRes = CLSIDFromProgID( lpszName, &controlId );
|
||||
if ( SUCCEEDED( hRes ) )
|
||||
content = IsGUID;
|
||||
else {
|
||||
/* FIXME - check for MSHTML: prefix! */
|
||||
content = IsURL;
|
||||
controlId = CLSID_WebBrowser;
|
||||
}
|
||||
if (ppUnkContainer) *ppUnkContainer = NULL;
|
||||
if (ppUnkControl) *ppUnkControl = NULL;
|
||||
|
||||
content = get_content_type(lpszName, &controlId);
|
||||
|
||||
if (content == IsEmpty)
|
||||
return S_OK;
|
||||
|
||||
if (content == IsUnknown)
|
||||
return CO_E_CLASSSTRING;
|
||||
|
||||
hRes = CoCreateInstance( &controlId, 0, CLSCTX_ALL, &IID_IOleObject,
|
||||
(void**) &pControl );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MODULE = atl100.dll
|
||||
IMPORTLIB = atl100
|
||||
IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32
|
||||
IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32 shlwapi
|
||||
EXTRADEFS = -D_ATL_VER=_ATL_VER_100
|
||||
PARENTSRC = ../atl
|
||||
|
||||
|
|
|
@ -643,8 +643,8 @@ static void test_ax_win(void)
|
|||
ok(hwnd != NULL, "CreateWindow failed!\n");
|
||||
control = (IUnknown *)0xdeadbeef;
|
||||
res = AtlAxGetControl(hwnd, &control);
|
||||
todo_wine ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
|
||||
todo_wine ok(!control, "returned %p\n", control);
|
||||
ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
|
||||
ok(!control, "returned %p\n", control);
|
||||
if (control) IUnknown_Release(control);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
|
@ -652,8 +652,8 @@ static void test_ax_win(void)
|
|||
ok(hwnd != NULL, "CreateWindow failed!\n");
|
||||
control = (IUnknown *)0xdeadbeef;
|
||||
res = AtlAxGetControl(hwnd, &control);
|
||||
todo_wine ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
|
||||
todo_wine ok(!control, "returned %p\n", control);
|
||||
ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
|
||||
ok(!control, "returned %p\n", control);
|
||||
if (control) IUnknown_Release(control);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
MODULE = atl110.dll
|
||||
IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 uuid
|
||||
IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 uuid shlwapi
|
||||
EXTRADEFS = -D_ATL_VER=_ATL_VER_110
|
||||
PARENTSRC = ../atl
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MODULE = atl80.dll
|
||||
IMPORTLIB = atl80
|
||||
IMPORTS = oleaut32 user32 ole32 gdi32 advapi32 uuid
|
||||
IMPORTS = oleaut32 user32 ole32 gdi32 advapi32 uuid shlwapi
|
||||
EXTRADEFS = -D_ATL_VER=_ATL_VER_80
|
||||
PARENTSRC = ../atl
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
MODULE = atl90.dll
|
||||
IMPORTS = oleaut32 user32 ole32 gdi32 advapi32 uuid
|
||||
IMPORTS = oleaut32 user32 ole32 gdi32 advapi32 uuid shlwapi
|
||||
EXTRADEFS = -D_ATL_VER=_ATL_VER_90
|
||||
PARENTSRC = ../atl
|
||||
|
||||
|
|
Loading…
Reference in a new issue