Commit 959f785c authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleacc: Add LresultFromObject implementation.

parent 5953fefa
MODULE = oleacc.dll MODULE = oleacc.dll
IMPORTLIB = oleacc IMPORTLIB = oleacc
IMPORTS = user32 IMPORTS = ole32 user32
C_SRCS = \ C_SRCS = \
main.c main.c
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -30,6 +32,8 @@ ...@@ -30,6 +32,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(oleacc); WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
static const WCHAR lresult_atom_prefix[] = {'w','i','n','e','_','o','l','e','a','c','c',':'};
static HINSTANCE oleacc_handle = 0; static HINSTANCE oleacc_handle = 0;
HRESULT WINAPI CreateStdAccessibleObject( HWND hwnd, LONG idObject, HRESULT WINAPI CreateStdAccessibleObject( HWND hwnd, LONG idObject,
...@@ -48,8 +52,96 @@ HRESULT WINAPI ObjectFromLresult( LRESULT result, REFIID riid, WPARAM wParam, vo ...@@ -48,8 +52,96 @@ HRESULT WINAPI ObjectFromLresult( LRESULT result, REFIID riid, WPARAM wParam, vo
LRESULT WINAPI LresultFromObject( REFIID riid, WPARAM wParam, LPUNKNOWN pAcc ) LRESULT WINAPI LresultFromObject( REFIID riid, WPARAM wParam, LPUNKNOWN pAcc )
{ {
FIXME("%s %ld %p\n", debugstr_guid(riid), wParam, pAcc ); static const WCHAR atom_fmt[] = {'%','0','8','x',':','%','0','8','x',':','%','0','8','x',0};
return E_NOTIMPL; static const LARGE_INTEGER seek_zero = {{0}};
WCHAR atom_str[sizeof(lresult_atom_prefix)/sizeof(WCHAR)+3*8+3];
IStream *stream;
HANDLE mapping;
STATSTG stat;
HRESULT hr;
ATOM atom;
void *view;
TRACE("%s %ld %p\n", debugstr_guid(riid), wParam, pAcc);
if(wParam)
FIXME("unsupported wParam = %lx\n", wParam);
if(!pAcc)
return E_INVALIDARG;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
if(FAILED(hr))
return hr;
hr = CoMarshalInterface(stream, riid, pAcc, MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
if(FAILED(hr)) {
IStream_Release(stream);
return hr;
}
hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
if(FAILED(hr)) {
IStream_Release(stream);
return hr;
}
hr = IStream_Stat(stream, &stat, STATFLAG_NONAME);
if(FAILED(hr)) {
CoReleaseMarshalData(stream);
IStream_Release(stream);
return hr;
}else if(stat.cbSize.u.HighPart) {
FIXME("stream size to big\n");
CoReleaseMarshalData(stream);
IStream_Release(stream);
return E_NOTIMPL;
}
mapping = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
stat.cbSize.u.HighPart, stat.cbSize.u.LowPart, NULL);
if(!mapping) {
CoReleaseMarshalData(stream);
IStream_Release(stream);
return hr;
}
view = MapViewOfFile(mapping, FILE_MAP_WRITE, 0, 0, 0);
if(!view) {
CloseHandle(mapping);
CoReleaseMarshalData(stream);
IStream_Release(stream);
return E_FAIL;
}
hr = IStream_Read(stream, view, stat.cbSize.u.LowPart, NULL);
UnmapViewOfFile(view);
if(FAILED(hr)) {
CloseHandle(mapping);
hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
if(SUCCEEDED(hr))
CoReleaseMarshalData(stream);
IStream_Release(stream);
return hr;
}
memcpy(atom_str, lresult_atom_prefix, sizeof(lresult_atom_prefix));
sprintfW(atom_str+sizeof(lresult_atom_prefix)/sizeof(WCHAR),
atom_fmt, GetCurrentProcessId(), HandleToUlong(mapping), stat.cbSize.u.LowPart);
atom = GlobalAddAtomW(atom_str);
if(!atom) {
CloseHandle(mapping);
hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
if(SUCCEEDED(hr))
CoReleaseMarshalData(stream);
IStream_Release(stream);
return E_FAIL;
}
IStream_Release(stream);
return atom;
} }
HRESULT WINAPI AccessibleObjectFromPoint( POINT ptScreen, IAccessible** ppacc, VARIANT* pvarChild ) HRESULT WINAPI AccessibleObjectFromPoint( POINT ptScreen, IAccessible** ppacc, VARIANT* pvarChild )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment