ReactOS  0.4.15-dev-1070-ge1a01de
main.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "commctrl.h"
#include "rpcproxy.h"
#include "initguid.h"
#include "oleacc_private.h"
#include "resource.h"
#include "wine/debug.h"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Typedefs

typedef HRESULT(WINAPIaccessible_create) (HWND, const IID *, void **)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (oleacc)
 
HRESULT WINAPI OLEACC_DllGetClassObject (REFCLSID, REFIID, void **)
 
int convert_child_id (VARIANT *v)
 
static accessible_create get_builtin_accessible_obj (HWND hwnd, LONG objid)
 
HRESULT WINAPI CreateStdAccessibleObject (HWND hwnd, LONG idObject, REFIID riidInterface, void **ppvObject)
 
HRESULT WINAPI ObjectFromLresult (LRESULT result, REFIID riid, WPARAM wParam, void **ppObject)
 
LRESULT WINAPI LresultFromObject (REFIID riid, WPARAM wParam, LPUNKNOWN pAcc)
 
HRESULT WINAPI AccessibleObjectFromPoint (POINT ptScreen, IAccessible **ppacc, VARIANT *pvarChild)
 
HRESULT WINAPI AccessibleObjectFromWindow (HWND hwnd, DWORD dwObjectID, REFIID riid, void **ppvObject)
 
HRESULT WINAPI WindowFromAccessibleObject (IAccessible *acc, HWND *phwnd)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID iid, void **ppv)
 
void WINAPI GetOleaccVersionInfo (DWORD *pVersion, DWORD *pBuild)
 
HANDLE WINAPI GetProcessHandleFromHwnd (HWND hwnd)
 
UINT WINAPI GetRoleTextW (DWORD role, LPWSTR lpRole, UINT rolemax)
 
UINT WINAPI GetRoleTextA (DWORD role, LPSTR lpRole, UINT rolemax)
 
UINT WINAPI GetStateTextW (DWORD state_bit, WCHAR *state_str, UINT state_str_len)
 
UINT WINAPI GetStateTextA (DWORD state_bit, CHAR *state_str, UINT state_str_len)
 
HRESULT WINAPI AccessibleChildren (IAccessible *container, LONG start, LONG count, VARIANT *children, LONG *children_cnt)
 

Variables

static const WCHAR lresult_atom_prefix [] = {'w','i','n','e','_','o','l','e','a','c','c',':'}
 
static const WCHAR menuW [] = {'#','3','2','7','6','8',0}
 
static const WCHAR desktopW [] = {'#','3','2','7','6','9',0}
 
static const WCHAR dialogW [] = {'#','3','2','7','7','0',0}
 
static const WCHAR winswitchW [] = {'#','3','2','7','7','1',0}
 
static const WCHAR mdi_clientW [] = {'M','D','I','C','l','i','e','n','t',0}
 
static const WCHAR richeditW [] = {'R','I','C','H','E','D','I','T',0}
 
static const WCHAR richedit20aW [] = {'R','i','c','h','E','d','i','t','2','0','A',0}
 
static const WCHAR richedit20wW [] = {'R','i','c','h','E','d','i','t','2','0','W',0}
 
 builtin_classes []
 
static HINSTANCE oleacc_handle = 0
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file main.c.

Typedef Documentation

◆ accessible_create

typedef HRESULT(WINAPI * accessible_create) (HWND, const IID *, void **)

Definition at line 54 of file main.c.

Function Documentation

◆ AccessibleChildren()

HRESULT WINAPI AccessibleChildren ( IAccessible container,
LONG  start,
LONG  count,
VARIANT children,
LONG children_cnt 
)

Definition at line 601 of file main.c.

603 {
604  IEnumVARIANT *ev;
605  LONG i, child_no;
606  HRESULT hr;
607 
608  TRACE("%p %d %d %p %p\n", container, start, count, children, children_cnt);
609 
610  if(!container || !children || !children_cnt)
611  return E_INVALIDARG;
612 
613  for(i=0; i<count; i++)
614  VariantInit(children+i);
615 
616  hr = IAccessible_QueryInterface(container, &IID_IEnumVARIANT, (void**)&ev);
617  if(SUCCEEDED(hr)) {
618  hr = IEnumVARIANT_Reset(ev);
619  if(SUCCEEDED(hr))
620  hr = IEnumVARIANT_Skip(ev, start);
621  if(SUCCEEDED(hr))
622  hr = IEnumVARIANT_Next(ev, count, children, (ULONG*)children_cnt);
623  IEnumVARIANT_Release(ev);
624  return hr;
625  }
626 
627  hr = IAccessible_get_accChildCount(container, &child_no);
628  if(FAILED(hr))
629  return hr;
630 
631  for(i=0; i<count && start+i+1<=child_no; i++) {
632  IDispatch *disp;
633 
634  V_VT(children+i) = VT_I4;
635  V_I4(children+i) = start+i+1;
636 
637  hr = IAccessible_get_accChild(container, children[i], &disp);
638  if(SUCCEEDED(hr) && disp) {
639  V_VT(children+i) = VT_DISPATCH;
640  V_DISPATCH(children+i) = disp;
641  }
642  }
643 
644  *children_cnt = i;
645  return i==count ? S_OK : S_FALSE;
646 }
disp
Definition: i386-dis.c:3181
Definition: compat.h:2046
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define V_I4(A)
Definition: oleauto.h:247
#define V_DISPATCH(A)
Definition: oleauto.h:239
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:51
GLuint start
Definition: gl.h:1545
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by test_AccessibleChildren().

◆ AccessibleObjectFromPoint()

HRESULT WINAPI AccessibleObjectFromPoint ( POINT  ptScreen,
IAccessible **  ppacc,
VARIANT pvarChild 
)

Definition at line 343 of file main.c.

344 {
345  FIXME("{%d,%d} %p %p: stub\n", ptScreen.x, ptScreen.y, ppacc, pvarChild );
346  return E_NOTIMPL;
347 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ AccessibleObjectFromWindow()

HRESULT WINAPI AccessibleObjectFromWindow ( HWND  hwnd,
DWORD  dwObjectID,
REFIID  riid,
void **  ppvObject 
)

Definition at line 349 of file main.c.

351 {
352  TRACE("%p %d %s %p\n", hwnd, dwObjectID,
354 
355  if(!ppvObject)
356  return E_INVALIDARG;
357  *ppvObject = NULL;
358 
359  if(IsWindow(hwnd)) {
360  LRESULT lres;
361 
362  lres = SendMessageW(hwnd, WM_GETOBJECT, 0xffffffff, dwObjectID);
363  if(FAILED(lres))
364  return lres;
365  else if(lres)
366  return ObjectFromLresult(lres, riid, 0, ppvObject);
367  }
368 
369  return CreateStdAccessibleObject(hwnd, dwObjectID, riid, ppvObject);
370 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI IsWindow(_In_opt_ HWND)
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI CreateStdAccessibleObject(HWND hwnd, LONG idObject, REFIID riidInterface, void **ppvObject)
Definition: main.c:154
HRESULT WINAPI ObjectFromLresult(LRESULT result, REFIID riid, WPARAM wParam, void **ppObject)
Definition: main.c:177
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
REFIID LPVOID * ppvObject
Definition: precomp.h:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by Client_accHitTest(), Client_EnumVARIANT_Next(), Client_get_accParent(), and test_AccessibleObjectFromWindow().

◆ convert_child_id()

int convert_child_id ( VARIANT v)

Definition at line 100 of file main.c.

101 {
102  switch(V_VT(v)) {
103  case VT_I4:
104  return V_I4(v);
105  default:
106  FIXME("unhandled child ID variant type: %d\n", V_VT(v));
107  return -1;
108  }
109 }
Definition: compat.h:2046
#define V_I4(A)
Definition: oleauto.h:247
#define FIXME(fmt,...)
Definition: debug.h:111
#define V_VT(A)
Definition: oleauto.h:211
const GLdouble * v
Definition: gl.h:2040

Referenced by Client_accLocation(), Client_get_accDefaultAction(), Client_get_accDescription(), Client_get_accHelp(), Client_get_accKeyboardShortcut(), Client_get_accName(), Client_get_accRole(), Client_get_accState(), and Client_get_accValue().

◆ CreateStdAccessibleObject()

HRESULT WINAPI CreateStdAccessibleObject ( HWND  hwnd,
LONG  idObject,
REFIID  riidInterface,
void **  ppvObject 
)

Definition at line 154 of file main.c.

156 {
158 
159  TRACE("%p %d %s %p\n", hwnd, idObject,
160  debugstr_guid( riidInterface ), ppvObject );
161 
162  switch(idObject) {
163  case OBJID_CLIENT:
165  if(create) return create(hwnd, riidInterface, ppvObject);
166  return create_client_object(hwnd, riidInterface, ppvObject);
167  case OBJID_WINDOW:
169  if(create) return create(hwnd, riidInterface, ppvObject);
170  return create_window_object(hwnd, riidInterface, ppvObject);
171  default:
172  FIXME("unhandled object id: %d\n", idObject);
173  return E_NOTIMPL;
174  }
175 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT(WINAPI * accessible_create)(HWND, const IID *, void **)
Definition: main.c:54
#define OBJID_WINDOW
Definition: winable.h:15
static accessible_create get_builtin_accessible_obj(HWND hwnd, LONG objid)
Definition: main.c:111
HRESULT create_window_object(HWND, const IID *, void **) DECLSPEC_HIDDEN
Definition: window.c:414
HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj)
Definition: client.c:625
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define OBJID_CLIENT
Definition: winable.h:19
#define TRACE(s)
Definition: solgame.cpp:4
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define E_NOTIMPL
Definition: ddrawi.h:99
static const struct access_res create[16]
Definition: package.c:7720

Referenced by AccessibleObjectFromWindow(), and test_default_client_accessible_object().

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
void **  ppv 
)

Definition at line 432 of file main.c.

433 {
434  if(IsEqualGUID(&CLSID_CAccPropServices, rclsid)) {
435  TRACE("(CLSID_CAccPropServices %s %p)\n", debugstr_guid(iid), ppv);
436  return get_accpropservices_factory(iid, ppv);
437  }
438 
439  if(IsEqualGUID(&CLSID_PSFactoryBuffer, rclsid)) {
440  TRACE("(CLSID_PSFactoryBuffer %s %p)\n", debugstr_guid(iid), ppv);
441  return OLEACC_DllGetClassObject(rclsid, iid, ppv);
442  }
443 
444  FIXME("%s %s %p: stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
445  return E_NOTIMPL;
446 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT get_accpropservices_factory(REFIID, void **) DECLSPEC_HIDDEN
Definition: propservice.c:247
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI OLEACC_DllGetClassObject(REFCLSID, REFIID, void **)
Definition: main.c:56
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 406 of file main.c.

408 {
409  TRACE("%p, %d, %p\n", hinstDLL, fdwReason, lpvReserved);
410 
411  switch (fdwReason)
412  {
413  case DLL_PROCESS_ATTACH:
414  oleacc_handle = hinstDLL;
415  DisableThreadLibraryCalls(hinstDLL);
416  break;
417  }
418 
419  return OLEACC_DllMain(hinstDLL, fdwReason, lpvReserved);
420 }
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
static IN DWORD IN LPVOID lpvReserved
#define TRACE(s)
Definition: solgame.cpp:4
static HINSTANCE oleacc_handle
Definition: main.c:98

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 422 of file main.c.

423 {
424  return OLEACC_DllRegisterServer();
425 }

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 427 of file main.c.

428 {
429  return OLEACC_DllUnregisterServer();
430 }

◆ get_builtin_accessible_obj()

static accessible_create get_builtin_accessible_obj ( HWND  hwnd,
LONG  objid 
)
static

Definition at line 111 of file main.c.

112 {
113  WCHAR class_name[64];
114  int i, idx;
115 
116  if(!RealGetWindowClassW(hwnd, class_name, ARRAY_SIZE(class_name)))
117  return NULL;
118  TRACE("got window class: %s\n", debugstr_w(class_name));
119 
120  for(i=0; i<ARRAY_SIZE(builtin_classes); i++) {
121  if(!wcsicmp(class_name, builtin_classes[i].name)) {
123 
124  ret = (objid==OBJID_CLIENT ?
125  builtin_classes[i].create_client :
126  builtin_classes[i].create_window);
127  if(!ret)
128  FIXME("unhandled window class: %s\n", debugstr_w(class_name));
129  return ret;
130  }
131  }
132 
133  idx = SendMessageW(hwnd, WM_GETOBJECT, 0, OBJID_QUERYCLASSNAMEIDX);
134  if(idx) {
135  for(i=0; i<ARRAY_SIZE(builtin_classes); i++) {
136  if(idx == builtin_classes[i].idx) {
138 
139  ret = (objid==OBJID_CLIENT ?
140  builtin_classes[i].create_client :
141  builtin_classes[i].create_window);
142  if(!ret)
143  FIXME("unhandled class name idx: %x\n", idx);
144  return ret;
145  }
146  }
147 
148  WARN("unhandled class name idx: %x\n", idx);
149  }
150 
151  return NULL;
152 }
builtin_classes[]
Definition: main.c:66
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT(WINAPI * accessible_create)(HWND, const IID *, void **)
Definition: main.c:54
UINT WINAPI RealGetWindowClassW(_In_ HWND hwnd, _Out_writes_to_(cchClassNameMax, return) LPWSTR ptszClassName, _In_ UINT cchClassNameMax)
#define WARN(fmt,...)
Definition: debug.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define OBJID_CLIENT
Definition: winable.h:19
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define wcsicmp
Definition: compat.h:15
int ret
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: name.c:38

Referenced by CreateStdAccessibleObject().

◆ GetOleaccVersionInfo()

void WINAPI GetOleaccVersionInfo ( DWORD pVersion,
DWORD pBuild 
)

Definition at line 448 of file main.c.

449 {
450 #ifdef __REACTOS__
451  *pVersion = MAKELONG(2,4); /* Windows XP version of oleacc: 4.2.5406.0 */
452  *pBuild = MAKELONG(0,5406);
453 #else
454  *pVersion = MAKELONG(0,7); /* Windows 7 version of oleacc: 7.0.0.0 */
455  *pBuild = MAKELONG(0,0);
456 #endif
457 }
#define MAKELONG(a, b)
Definition: typedefs.h:249

◆ GetProcessHandleFromHwnd()

HANDLE WINAPI GetProcessHandleFromHwnd ( HWND  hwnd)

Definition at line 459 of file main.c.

460 {
461  DWORD proc_id;
462 
463  TRACE("%p\n", hwnd);
464 
465  if(!GetWindowThreadProcessId(hwnd, &proc_id))
466  return NULL;
469 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define PROCESS_DUP_HANDLE
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define PROCESS_VM_WRITE
Definition: pstypes.h:154
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SYNCHRONIZE
Definition: nt_native.h:61
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define PROCESS_VM_READ
Definition: pstypes.h:153
#define PROCESS_VM_OPERATION
Definition: pstypes.h:152

◆ GetRoleTextA()

UINT WINAPI GetRoleTextA ( DWORD  role,
LPSTR  lpRole,
UINT  rolemax 
)

Definition at line 491 of file main.c.

492 {
493  UINT length;
494  WCHAR *roletextW;
495 
496  TRACE("%u %p %u\n", role, lpRole, rolemax);
497 
498  if(lpRole && !rolemax)
499  return 0;
500 
501  length = GetRoleTextW(role, NULL, 0);
502  if(!length) {
503  if(lpRole && rolemax)
504  lpRole[0] = 0;
505  return 0;
506  }
507 
508  roletextW = HeapAlloc(GetProcessHeap(), 0, (length + 1)*sizeof(WCHAR));
509  if(!roletextW)
510  return 0;
511 
512  GetRoleTextW(role, roletextW, length + 1);
513 
514  length = WideCharToMultiByte( CP_ACP, 0, roletextW, -1, NULL, 0, NULL, NULL );
515 
516  if(!lpRole){
517  HeapFree(GetProcessHeap(), 0, roletextW);
518  return length - 1;
519  }
520 
521  if(rolemax < length) {
522  HeapFree(GetProcessHeap(), 0, roletextW);
523  lpRole[0] = 0;
524  return 0;
525  }
526 
527  WideCharToMultiByte( CP_ACP, 0, roletextW, -1, lpRole, rolemax, NULL, NULL );
528 
529  if(rolemax < length){
530  lpRole[rolemax-1] = '\0';
531  length = rolemax;
532  }
533 
534  HeapFree(GetProcessHeap(), 0, roletextW);
535 
536  return length - 1;
537 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
Definition: main.c:471
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by test_getroletext().

◆ GetRoleTextW()

UINT WINAPI GetRoleTextW ( DWORD  role,
LPWSTR  lpRole,
UINT  rolemax 
)

Definition at line 471 of file main.c.

472 {
473  INT ret;
474  WCHAR *resptr;
475 
476  TRACE("%u %p %u\n", role, lpRole, rolemax);
477 
478  /* return role text length */
479  if(!lpRole)
480  return LoadStringW(oleacc_handle, role, (LPWSTR)&resptr, 0);
481 
482  ret = LoadStringW(oleacc_handle, role, lpRole, rolemax);
483  if(!(ret > 0)){
484  if(rolemax > 0) lpRole[0] = '\0';
485  return 0;
486  }
487 
488  return ret;
489 }
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static HINSTANCE oleacc_handle
Definition: main.c:98
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GetRoleTextA(), and test_getroletext().

◆ GetStateTextA()

UINT WINAPI GetStateTextA ( DWORD  state_bit,
CHAR state_str,
UINT  state_str_len 
)

Definition at line 569 of file main.c.

570 {
571  DWORD state_id;
572 
573  TRACE("%x %p %u\n", state_bit, state_str, state_str_len);
574 
575  if(state_str && !state_str_len)
576  return 0;
577 
578  if(state_bit & ~(STATE_SYSTEM_VALID | STATE_SYSTEM_HASPOPUP)) {
579  if(state_str && state_str_len)
580  state_str[0] = 0;
581  return 0;
582  }
583 
584  state_id = IDS_STATE_NORMAL;
585  while(state_bit) {
586  state_id++;
587  state_bit /= 2;
588  }
589 
590  if(state_str) {
591  UINT ret = LoadStringA(oleacc_handle, state_id, state_str, state_str_len);
592  if(!ret && state_str_len)
593  state_str[0] = 0;
594  return ret;
595  }else {
596  CHAR tmp[256];
597  return LoadStringA(oleacc_handle, state_id, tmp, sizeof(tmp));
598  }
599 }
char CHAR
Definition: xmlstorage.h:175
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define IDS_STATE_NORMAL
Definition: resource.h:19
unsigned int UINT
Definition: ndis.h:50
static HINSTANCE oleacc_handle
Definition: main.c:98
#define STATE_SYSTEM_VALID
Definition: winuser.h:2866

Referenced by test_GetStateText().

◆ GetStateTextW()

UINT WINAPI GetStateTextW ( DWORD  state_bit,
WCHAR state_str,
UINT  state_str_len 
)

Definition at line 539 of file main.c.

540 {
541  DWORD state_id;
542 
543  TRACE("%x %p %u\n", state_bit, state_str, state_str_len);
544 
545  if(state_bit & ~(STATE_SYSTEM_VALID | STATE_SYSTEM_HASPOPUP)) {
546  if(state_str && state_str_len)
547  state_str[0] = 0;
548  return 0;
549  }
550 
551  state_id = IDS_STATE_NORMAL;
552  while(state_bit) {
553  state_id++;
554  state_bit /= 2;
555  }
556 
557  if(state_str) {
558  UINT ret = LoadStringW(oleacc_handle, state_id, state_str, state_str_len);
559  if(!ret && state_str_len)
560  state_str[0] = 0;
561  return ret;
562  }else {
563  WCHAR *tmp;
564  return LoadStringW(oleacc_handle, state_id, (WCHAR*)&tmp, 0);
565  }
566 
567 }
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define IDS_STATE_NORMAL
Definition: resource.h:19
unsigned int UINT
Definition: ndis.h:50
static HINSTANCE oleacc_handle
Definition: main.c:98
#define STATE_SYSTEM_VALID
Definition: winuser.h:2866

Referenced by test_GetStateText().

◆ LresultFromObject()

LRESULT WINAPI LresultFromObject ( REFIID  riid,
WPARAM  wParam,
LPUNKNOWN  pAcc 
)

Definition at line 249 of file main.c.

250 {
251  static const WCHAR atom_fmt[] = {'%','0','8','x',':','%','0','8','x',':','%','0','8','x',0};
252  static const LARGE_INTEGER seek_zero = {{0}};
253 
254  WCHAR atom_str[ARRAY_SIZE(lresult_atom_prefix)+3*8+3];
255  IStream *stream;
256  HANDLE mapping;
257  STATSTG stat;
258  HRESULT hr;
259  ATOM atom;
260  void *view;
261 
262  TRACE("%s %ld %p\n", debugstr_guid(riid), wParam, pAcc);
263 
264  if(wParam)
265  FIXME("unsupported wParam = %lx\n", wParam);
266 
267  if(!pAcc)
268  return E_INVALIDARG;
269 
271  if(FAILED(hr))
272  return hr;
273 
274  hr = CoMarshalInterface(stream, riid, pAcc, MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
275  if(FAILED(hr)) {
276  IStream_Release(stream);
277  return hr;
278  }
279 
280  hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
281  if(FAILED(hr)) {
282  IStream_Release(stream);
283  return hr;
284  }
285 
286  hr = IStream_Stat(stream, &stat, STATFLAG_NONAME);
287  if(FAILED(hr)) {
289  IStream_Release(stream);
290  return hr;
291  }else if(stat.cbSize.u.HighPart) {
292  FIXME("stream size to big\n");
294  IStream_Release(stream);
295  return E_NOTIMPL;
296  }
297 
299  stat.cbSize.u.HighPart, stat.cbSize.u.LowPart, NULL);
300  if(!mapping) {
302  IStream_Release(stream);
303  return hr;
304  }
305 
307  if(!view) {
310  IStream_Release(stream);
311  return E_FAIL;
312  }
313 
314  hr = IStream_Read(stream, view, stat.cbSize.u.LowPart, NULL);
316  if(FAILED(hr)) {
318  hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
319  if(SUCCEEDED(hr))
321  IStream_Release(stream);
322  return hr;
323 
324  }
325 
326  memcpy(atom_str, lresult_atom_prefix, sizeof(lresult_atom_prefix));
328  HandleToUlong(mapping), stat.cbSize.u.LowPart);
329  atom = GlobalAddAtomW(atom_str);
330  if(!atom) {
332  hr = IStream_Seek(stream, seek_zero, STREAM_SEEK_SET, NULL);
333  if(SUCCEEDED(hr))
335  IStream_Release(stream);
336  return E_FAIL;
337  }
338 
339  IStream_Release(stream);
340  return atom;
341 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2055
#define CloseHandle
Definition: compat.h:487
#define MapViewOfFile
Definition: compat.h:493
HRESULT hr
Definition: shlfolder.c:183
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
#define HandleToUlong(h)
Definition: basetsd.h:79
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define E_FAIL
Definition: ddrawi.h:102
WPARAM wParam
Definition: combotst.c:138
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:492
#define FILE_MAP_WRITE
Definition: winbase.h:154
#define swprintf(buf, format,...)
Definition: sprintf.c:56
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
Definition: stat.h:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_NOTIMPL
Definition: ddrawi.h:99
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
static IOleDocumentView * view
Definition: activex.c:1749
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1876
#define UnmapViewOfFile
Definition: compat.h:494
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
#define SUCCEEDED(hr)
Definition: intsafe.h:49
#define PAGE_READWRITE
Definition: nt_native.h:1304
static const WCHAR lresult_atom_prefix[]
Definition: main.c:43

Referenced by test_LresultFromObject(), and test_window_proc().

◆ ObjectFromLresult()

HRESULT WINAPI ObjectFromLresult ( LRESULT  result,
REFIID  riid,
WPARAM  wParam,
void **  ppObject 
)

Definition at line 177 of file main.c.

178 {
179  WCHAR atom_str[ARRAY_SIZE(lresult_atom_prefix)+3*8+3];
180  HANDLE server_proc, server_mapping, mapping;
181  DWORD proc_id, size;
182  IStream *stream;
183  HGLOBAL data;
184  void *view;
185  HRESULT hr;
186  WCHAR *p;
187 
188  TRACE("%ld %s %ld %p\n", result, debugstr_guid(riid), wParam, ppObject );
189 
190  if(wParam)
191  FIXME("unsupported wParam = %lx\n", wParam);
192 
193  if(!ppObject)
194  return E_INVALIDARG;
195  *ppObject = NULL;
196 
197  if(result != (ATOM)result)
198  return E_FAIL;
199 
200  if(!GlobalGetAtomNameW(result, atom_str, ARRAY_SIZE(atom_str)))
201  return E_FAIL;
202  if(memcmp(atom_str, lresult_atom_prefix, sizeof(lresult_atom_prefix)))
203  return E_FAIL;
204  p = atom_str + ARRAY_SIZE(lresult_atom_prefix);
205  proc_id = wcstoul(p, &p, 16);
206  if(*p != ':')
207  return E_FAIL;
208  server_mapping = ULongToHandle( wcstoul(p+1, &p, 16) );
209  if(*p != ':')
210  return E_FAIL;
211  size = wcstoul(p+1, &p, 16);
212  if(*p != 0)
213  return E_FAIL;
214 
215  server_proc = OpenProcess(PROCESS_DUP_HANDLE, FALSE, proc_id);
216  if(!server_proc)
217  return E_FAIL;
218 
219  if(!DuplicateHandle(server_proc, server_mapping, GetCurrentProcess(), &mapping,
221  return E_FAIL;
222  CloseHandle(server_proc);
224 
227  if(!view)
228  return E_FAIL;
229 
231  if(!data) {
233  return E_OUTOFMEMORY;
234  }
235  memcpy(data, view, size);
237 
239  if(FAILED(hr)) {
240  GlobalFree(data);
241  return hr;
242  }
243 
244  hr = CoUnmarshalInterface(stream, riid, ppObject);
245  IStream_Release(stream);
246  return hr;
247 }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
#define DUPLICATE_CLOSE_SOURCE
#define ULongToHandle(h)
Definition: basetsd.h:81
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define CloseHandle
Definition: compat.h:487
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define MapViewOfFile
Definition: compat.h:493
HRESULT hr
Definition: shlfolder.c:183
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define E_FAIL
Definition: ddrawi.h:102
WPARAM wParam
Definition: combotst.c:138
#define DUPLICATE_SAME_ACCESS
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define PROCESS_DUP_HANDLE
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define FILE_MAP_READ
Definition: compat.h:524
#define debugstr_guid
Definition: kernel32.h:35
UINT WINAPI GlobalGetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:496
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: parse.h:22
#define GMEM_FIXED
Definition: winbase.h:290
GLuint GLuint stream
Definition: glext.h:7522
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GetCurrentProcess()
Definition: compat.h:507
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define ARRAY_SIZE(a)
Definition: main.h:24
static IOleDocumentView * view
Definition: activex.c:1749
GLfloat GLfloat p
Definition: glext.h:8902
#define UnmapViewOfFile
Definition: compat.h:494
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
static const WCHAR lresult_atom_prefix[]
Definition: main.c:43

Referenced by AccessibleObjectFromWindow(), START_TEST(), and test_LresultFromObject().

◆ OLEACC_DllGetClassObject()

HRESULT WINAPI OLEACC_DllGetClassObject ( REFCLSID  ,
REFIID  ,
void **   
)

Definition at line 56 of file main.c.

61  {
62  const WCHAR *name;
63  DWORD idx;
64  accessible_create create_client;
66 } builtin_classes[] = {
builtin_classes[]
Definition: main.c:66
HRESULT(WINAPI * accessible_create)(HWND, const IID *, void **)
Definition: main.c:54
const char * name
Definition: main.c:224
unsigned int idx
Definition: utils.c:41
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static HWND create_window(void)
Definition: imagelist.c:163

Referenced by DllGetClassObject().

◆ WindowFromAccessibleObject()

HRESULT WINAPI WindowFromAccessibleObject ( IAccessible acc,
HWND phwnd 
)

Definition at line 372 of file main.c.

373 {
374  IDispatch *parent;
375  IOleWindow *ow;
376  HRESULT hres;
377 
378  TRACE("%p %p\n", acc, phwnd);
379 
380  IAccessible_AddRef(acc);
381  while(1) {
382  hres = IAccessible_QueryInterface(acc, &IID_IOleWindow, (void**)&ow);
383  if(SUCCEEDED(hres)) {
384  hres = IOleWindow_GetWindow(ow, phwnd);
385  IOleWindow_Release(ow);
386  IAccessible_Release(acc);
387  return hres;
388  }
389 
390  hres = IAccessible_get_accParent(acc, &parent);
391  IAccessible_Release(acc);
392  if(FAILED(hres))
393  return hres;
394  if(hres!=S_OK || !parent) {
395  *phwnd = NULL;
396  return hres;
397  }
398 
399  hres = IDispatch_QueryInterface(parent, &IID_IAccessible, (void**)&acc);
400  IDispatch_Release(parent);
401  if(FAILED(hres))
402  return hres;
403  }
404 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
r parent
Definition: btrfs.c:2944
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
const GUID IID_IOleWindow
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by test_default_client_accessible_object().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( oleacc  )

Variable Documentation

◆ builtin_classes

builtin_classes[]

Definition at line 66 of file main.c.

Referenced by get_builtin_accessible_obj().

◆ desktopW

const WCHAR desktopW[] = {'#','3','2','7','6','9',0}
static

Definition at line 46 of file main.c.

Referenced by test_wshshell(), and WshCollection_Item().

◆ dialogW

const WCHAR dialogW[] = {'#','3','2','7','7','0',0}
static

Definition at line 47 of file main.c.

◆ lresult_atom_prefix

const WCHAR lresult_atom_prefix[] = {'w','i','n','e','_','o','l','e','a','c','c',':'}
static

Definition at line 43 of file main.c.

Referenced by LresultFromObject(), and ObjectFromLresult().

◆ mdi_clientW

const WCHAR mdi_clientW[] = {'M','D','I','C','l','i','e','n','t',0}
static

Definition at line 49 of file main.c.

◆ menuW

const WCHAR menuW[] = {'#','3','2','7','6','8',0}
static

Definition at line 45 of file main.c.

Referenced by MCIWND_Create().

◆ oleacc_handle

HINSTANCE oleacc_handle = 0
static

Definition at line 98 of file main.c.

Referenced by DllMain(), GetRoleTextW(), GetStateTextA(), and GetStateTextW().

◆ richedit20aW

const WCHAR richedit20aW[] = {'R','i','c','h','E','d','i','t','2','0','A',0}
static

Definition at line 51 of file main.c.

◆ richedit20wW

const WCHAR richedit20wW[] = {'R','i','c','h','E','d','i','t','2','0','W',0}
static

Definition at line 52 of file main.c.

◆ richeditW

const WCHAR richeditW[] = {'R','I','C','H','E','D','I','T',0}
static

Definition at line 50 of file main.c.

◆ winswitchW

const WCHAR winswitchW[] = {'#','3','2','7','7','1',0}
static

Definition at line 48 of file main.c.