2003-11-25 02:46:10 +01:00
|
|
|
/*
|
|
|
|
* Implementation of the OLEACC dll
|
|
|
|
*
|
|
|
|
* Copyright 2003 Mike McCormack for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-11-25 02:46:10 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
2008-10-14 20:18:08 +02:00
|
|
|
#include "wine/unicode.h"
|
2003-11-25 02:46:10 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
|
|
|
|
|
2008-10-14 20:18:08 +02:00
|
|
|
static HINSTANCE oleacc_handle = 0;
|
|
|
|
|
2003-11-25 02:46:10 +01:00
|
|
|
HRESULT WINAPI CreateStdAccessibleObject( HWND hwnd, LONG idObject,
|
|
|
|
REFIID riidInterface, void** ppvObject )
|
|
|
|
{
|
2006-10-03 23:40:23 +02:00
|
|
|
FIXME("%p %d %s %p\n", hwnd, idObject,
|
2003-11-25 02:46:10 +01:00
|
|
|
debugstr_guid( riidInterface ), ppvObject );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2004-03-30 01:04:46 +02:00
|
|
|
|
|
|
|
HRESULT WINAPI LresultFromObject( REFIID riid, WPARAM wParam, LPUNKNOWN pAcc )
|
|
|
|
{
|
2007-05-24 16:41:17 +02:00
|
|
|
FIXME("%s %ld %p\n", debugstr_guid(riid), wParam, pAcc );
|
2004-03-30 01:04:46 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID,
|
|
|
|
REFIID riid, void** ppvObject )
|
|
|
|
{
|
2006-10-03 23:40:23 +02:00
|
|
|
FIXME("%p %d %s %p\n", hwnd, dwObjectID,
|
2004-03-30 01:04:46 +02:00
|
|
|
debugstr_guid( riid ), ppvObject );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2004-08-27 21:12:27 +02:00
|
|
|
|
2008-10-14 20:18:08 +02:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
|
|
|
LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
TRACE("%p, %d, %p\n", hinstDLL, fdwReason, lpvReserved);
|
|
|
|
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
oleacc_handle = hinstDLL;
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
2004-08-27 21:12:27 +02:00
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
2004-08-27 21:12:27 +02:00
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
2008-03-10 07:21:11 +01:00
|
|
|
|
|
|
|
void WINAPI GetOleaccVersionInfo(DWORD* pVersion, DWORD* pBuild)
|
|
|
|
{
|
|
|
|
*pVersion = MAKELONG(2,4); /* Windows XP version of oleacc: 4.2.5406.0 */
|
|
|
|
*pBuild = MAKELONG(0,5406);
|
|
|
|
}
|
2008-10-14 20:18:08 +02:00
|
|
|
|
|
|
|
UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
|
|
|
|
{
|
|
|
|
INT ret;
|
|
|
|
WCHAR *resptr;
|
|
|
|
|
|
|
|
TRACE("%u %p %u\n", role, lpRole, rolemax);
|
|
|
|
|
|
|
|
/* return role text length */
|
|
|
|
if(!lpRole)
|
|
|
|
return LoadStringW(oleacc_handle, role, (LPWSTR)&resptr, 0);
|
|
|
|
|
|
|
|
ret = LoadStringW(oleacc_handle, role, lpRole, rolemax);
|
|
|
|
if(!(ret > 0)){
|
|
|
|
if(rolemax > 0) lpRole[0] = '\0';
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax)
|
|
|
|
{
|
|
|
|
UINT length;
|
|
|
|
WCHAR *roletextW;
|
|
|
|
|
|
|
|
TRACE("%u %p %u\n", role, lpRole, rolemax);
|
|
|
|
|
|
|
|
length = GetRoleTextW(role, NULL, 0);
|
|
|
|
if((length == 0) || (lpRole && !rolemax))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
roletextW = HeapAlloc(GetProcessHeap(), 0, (length + 1)*sizeof(WCHAR));
|
|
|
|
if(!roletextW)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
GetRoleTextW(role, roletextW, length + 1);
|
|
|
|
|
|
|
|
length = WideCharToMultiByte( CP_ACP, 0, roletextW, -1, NULL, 0, NULL, NULL );
|
|
|
|
|
|
|
|
if(!lpRole){
|
|
|
|
HeapFree(GetProcessHeap(), 0, roletextW);
|
|
|
|
return length - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, roletextW, -1, lpRole, rolemax, NULL, NULL );
|
|
|
|
|
|
|
|
if(rolemax < length){
|
|
|
|
lpRole[rolemax-1] = '\0';
|
|
|
|
length = rolemax;
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, roletextW);
|
|
|
|
|
|
|
|
return length - 1;
|
|
|
|
}
|