ReactOS  0.4.15-dev-1177-g6cb3b62
txtsrv.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <richedit.h>
#include <tom.h>
#include <richole.h>
#include <initguid.h>
#include <imm.h>
#include <textserv.h>
#include <wine/test.h>
#include <oleauto.h>
#include <limits.h>
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for txtsrv.c:

Go to the source code of this file.

Classes

struct  ITextHostTestImpl
 
struct  THISCALL_TO_STDCALL_THUNK
 
struct  STDCALL_TO_THISCALL_THUNK
 
struct  unk_impl
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define TXTSERV_VTABLE(This)   (This)->lpVtbl
 
#define ITextServices_TxSendMessage(This, a, b, c, d)   TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)
 
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)   TXTSERV_VTABLE(This)->TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l)
 
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)
 
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)
 
#define ITextServices_OnTxSetCursor(This, a, b, c, d, e, f, g, h, i)   TXTSERV_VTABLE(This)->OnTxSetCursor(This,a,b,c,d,e,f,g,h,i)
 
#define ITextServices_TxQueryHitPoint(This, a, b, c, d, e, f, g, h, i, j)   TXTSERV_VTABLE(This)->TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j)
 
#define ITextServices_OnTxInplaceActivate(This, a)   TXTSERV_VTABLE(This)->OnTxInplaceActivate(This,a)
 
#define ITextServices_OnTxInplaceDeactivate(This)   TXTSERV_VTABLE(This)->OnTxInplaceDeactivate(This)
 
#define ITextServices_OnTxUIActivate(This)   TXTSERV_VTABLE(This)->OnTxUIActivate(This)
 
#define ITextServices_OnTxUIDeactivate(This)   TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)
 
#define ITextServices_TxGetText(This, a)   TXTSERV_VTABLE(This)->TxGetText(This,a)
 
#define ITextServices_TxSetText(This, a)   TXTSERV_VTABLE(This)->TxSetText(This,a)
 
#define ITextServices_TxGetCurTargetX(This, a)   TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)
 
#define ITextServices_TxGetBaseLinePos(This, a)   TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)
 
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)   TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h)
 
#define ITextServices_TxGetDropTarget(This, a)   TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)
 
#define ITextServices_OnTxPropertyBitsChange(This, a, b)   TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)
 
#define ITextServices_TxGetCachedSize(This, a, b)   TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)
 
#define TRACECALL   if(winetest_debug > 1) trace
 
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)   _check_txgetnaturalsize(res, width, height, hdc, rect, string, __LINE__)
 

Typedefs

typedef struct ITextHostTestImpl ITextHostTestImpl
 

Functions

static ITextHostTestImplimpl_from_ITextHost (ITextHost *iface)
 
static HRESULT WINAPI ITextHostImpl_QueryInterface (ITextHost *iface, REFIID riid, LPVOID *ppvObject)
 
static ULONG WINAPI ITextHostImpl_AddRef (ITextHost *iface)
 
static ULONG WINAPI ITextHostImpl_Release (ITextHost *iface)
 
static HDC WINAPI ITextHostImpl_TxGetDC (ITextHost *iface)
 
static INT WINAPI ITextHostImpl_TxReleaseDC (ITextHost *iface, HDC hdc)
 
static BOOL WINAPI ITextHostImpl_TxShowScrollBar (ITextHost *iface, INT fnBar, BOOL fShow)
 
static BOOL WINAPI ITextHostImpl_TxEnableScrollBar (ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
 
static BOOL WINAPI ITextHostImpl_TxSetScrollRange (ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
 
static BOOL WINAPI ITextHostImpl_TxSetScrollPos (ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
 
static void WINAPI ITextHostImpl_TxInvalidateRect (ITextHost *iface, LPCRECT prc, BOOL fMode)
 
static void WINAPI ITextHostImpl_TxViewChange (ITextHost *iface, BOOL fUpdate)
 
static BOOL WINAPI ITextHostImpl_TxCreateCaret (ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
 
static BOOL WINAPI ITextHostImpl_TxShowCaret (ITextHost *iface, BOOL fShow)
 
static BOOL WINAPI ITextHostImpl_TxSetCaretPos (ITextHost *iface, INT x, INT y)
 
static BOOL WINAPI ITextHostImpl_TxSetTimer (ITextHost *iface, UINT idTimer, UINT uTimeout)
 
static void WINAPI ITextHostImpl_TxKillTimer (ITextHost *iface, UINT idTimer)
 
static void WINAPI ITextHostImpl_TxScrollWindowEx (ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, UINT fuScroll)
 
static void WINAPI ITextHostImpl_TxSetCapture (ITextHost *iface, BOOL fCapture)
 
static void WINAPI ITextHostImpl_TxSetFocus (ITextHost *iface)
 
static void WINAPI ITextHostImpl_TxSetCursor (ITextHost *iface, HCURSOR hcur, BOOL fText)
 
static BOOL WINAPI ITextHostImpl_TxScreenToClient (ITextHost *iface, LPPOINT lppt)
 
static BOOL WINAPI ITextHostImpl_TxClientToScreen (ITextHost *iface, LPPOINT lppt)
 
static HRESULT WINAPI ITextHostImpl_TxActivate (ITextHost *iface, LONG *plOldState)
 
static HRESULT WINAPI ITextHostImpl_TxDeactivate (ITextHost *iface, LONG lNewState)
 
static HRESULT WINAPI ITextHostImpl_TxGetClientRect (ITextHost *iface, LPRECT prc)
 
static HRESULT WINAPI ITextHostImpl_TxGetViewInset (ITextHost *iface, LPRECT prc)
 
static HRESULT WINAPI ITextHostImpl_TxGetCharFormat (ITextHost *iface, const CHARFORMATW **ppCF)
 
static HRESULT WINAPI ITextHostImpl_TxGetParaFormat (ITextHost *iface, const PARAFORMAT **ppPF)
 
static COLORREF WINAPI ITextHostImpl_TxGetSysColor (ITextHost *iface, int nIndex)
 
static HRESULT WINAPI ITextHostImpl_TxGetBackStyle (ITextHost *iface, TXTBACKSTYLE *pStyle)
 
static HRESULT WINAPI ITextHostImpl_TxGetMaxLength (ITextHost *iface, DWORD *pLength)
 
static HRESULT WINAPI ITextHostImpl_TxGetScrollBars (ITextHost *iface, DWORD *pdwScrollBar)
 
static HRESULT WINAPI ITextHostImpl_TxGetPasswordChar (ITextHost *iface, WCHAR *pch)
 
static HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos (ITextHost *iface, LONG *pch)
 
static HRESULT WINAPI ITextHostImpl_TxGetExtent (ITextHost *iface, LPSIZEL lpExtent)
 
static HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange (ITextHost *iface, const CHARFORMATW *pcf)
 
static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange (ITextHost *iface, const PARAFORMAT *ppf)
 
static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits (ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
 
static HRESULT WINAPI ITextHostImpl_TxNotify (ITextHost *iface, DWORD iNotify, void *pv)
 
static HIMC WINAPI ITextHostImpl_TxImmGetContext (ITextHost *iface)
 
static void WINAPI ITextHostImpl_TxImmReleaseContext (ITextHost *iface, HIMC himc)
 
static HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth (ITextHost *iface, LONG *lSelBarWidth)
 
static void setup_thiscall_wrappers (void)
 
static void hf_to_cf (HFONT hf, CHARFORMAT2W *cf)
 
static BOOL init_texthost (ITextServices **txtserv, ITextHost **ret)
 
static void test_TxGetText (void)
 
static void test_TxSetText (void)
 
static void _check_txgetnaturalsize (HRESULT res, LONG width, LONG height, HDC hdc, RECT rect, LPCWSTR string, int line)
 
static void test_TxGetNaturalSize (void)
 
static void test_TxDraw (void)
 
 DEFINE_GUID (expected_iid_itextservices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
 
 DEFINE_GUID (expected_iid_itexthost, 0x13e670f4, 0x1a5a, 0x11cf, 0xab, 0xeb, 0x00, 0xaa, 0x00, 0xb6, 0x5e, 0xa1)
 
 DEFINE_GUID (expected_iid_itexthost2, 0x13e670f5, 0x1a5a, 0x11cf, 0xab, 0xeb, 0x00, 0xaa, 0x00, 0xb6, 0x5e, 0xa1)
 
static void test_IIDs (void)
 
static struct unk_implimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI unk_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI unk_AddRef (IUnknown *iface)
 
static ULONG WINAPI unk_Release (IUnknown *iface)
 
static void test_COM (void)
 
static ULONG get_refcount (IUnknown *iface)
 
static void test_QueryInterface (void)
 
static void test_default_format (void)
 
static void test_TxGetScroll (void)
 
 START_TEST (txtsrv)
 

Variables

static HMODULE hmoduleRichEdit
 
static IIDpIID_ITextServices
 
static IIDpIID_ITextHost
 
static IIDpIID_ITextHost2
 
static PCreateTextServices pCreateTextServices
 
static ITextHostVtbl itextHostVtbl
 
static voidwrapperCodeMem = NULL
 
static const IUnknownVtbl unk_vtbl
 

Macro Definition Documentation

◆ CHECK_TXGETNATURALSIZE

#define CHECK_TXGETNATURALSIZE (   res,
  width,
  height,
  hdc,
  rect,
  string 
)    _check_txgetnaturalsize(res, width, height, hdc, rect, string, __LINE__)

Definition at line 724 of file txtsrv.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file txtsrv.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 24 of file txtsrv.c.

◆ ITextServices_OnTxInplaceActivate

#define ITextServices_OnTxInplaceActivate (   This,
  a 
)    TXTSERV_VTABLE(This)->OnTxInplaceActivate(This,a)

Definition at line 64 of file txtsrv.c.

◆ ITextServices_OnTxInplaceDeactivate

#define ITextServices_OnTxInplaceDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxInplaceDeactivate(This)

Definition at line 65 of file txtsrv.c.

◆ ITextServices_OnTxPropertyBitsChange

#define ITextServices_OnTxPropertyBitsChange (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)

Definition at line 74 of file txtsrv.c.

◆ ITextServices_OnTxSetCursor

#define ITextServices_OnTxSetCursor (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    TXTSERV_VTABLE(This)->OnTxSetCursor(This,a,b,c,d,e,f,g,h,i)

Definition at line 62 of file txtsrv.c.

◆ ITextServices_OnTxUIActivate

#define ITextServices_OnTxUIActivate (   This)    TXTSERV_VTABLE(This)->OnTxUIActivate(This)

Definition at line 66 of file txtsrv.c.

◆ ITextServices_OnTxUIDeactivate

#define ITextServices_OnTxUIDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)

Definition at line 67 of file txtsrv.c.

◆ ITextServices_TxDraw

#define ITextServices_TxDraw (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l 
)    TXTSERV_VTABLE(This)->TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l)

Definition at line 59 of file txtsrv.c.

◆ ITextServices_TxGetBaseLinePos

#define ITextServices_TxGetBaseLinePos (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)

Definition at line 71 of file txtsrv.c.

◆ ITextServices_TxGetCachedSize

#define ITextServices_TxGetCachedSize (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)

Definition at line 75 of file txtsrv.c.

◆ ITextServices_TxGetCurTargetX

#define ITextServices_TxGetCurTargetX (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)

Definition at line 70 of file txtsrv.c.

◆ ITextServices_TxGetDropTarget

#define ITextServices_TxGetDropTarget (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)

Definition at line 73 of file txtsrv.c.

◆ ITextServices_TxGetHScroll

#define ITextServices_TxGetHScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)

Definition at line 60 of file txtsrv.c.

◆ ITextServices_TxGetNaturalSize

#define ITextServices_TxGetNaturalSize (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h)

Definition at line 72 of file txtsrv.c.

◆ ITextServices_TxGetText

#define ITextServices_TxGetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetText(This,a)

Definition at line 68 of file txtsrv.c.

◆ ITextServices_TxGetVScroll

#define ITextServices_TxGetVScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)

Definition at line 61 of file txtsrv.c.

◆ ITextServices_TxQueryHitPoint

#define ITextServices_TxQueryHitPoint (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j 
)    TXTSERV_VTABLE(This)->TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j)

Definition at line 63 of file txtsrv.c.

◆ ITextServices_TxSendMessage

#define ITextServices_TxSendMessage (   This,
  a,
  b,
  c,
  d 
)    TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)

Definition at line 58 of file txtsrv.c.

◆ ITextServices_TxSetText

#define ITextServices_TxSetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxSetText(This,a)

Definition at line 69 of file txtsrv.c.

◆ TRACECALL

#define TRACECALL   if(winetest_debug > 1) trace

Definition at line 79 of file txtsrv.c.

◆ TXTSERV_VTABLE

#define TXTSERV_VTABLE (   This)    (This)->lpVtbl

Definition at line 55 of file txtsrv.c.

Typedef Documentation

◆ ITextHostTestImpl

Function Documentation

◆ _check_txgetnaturalsize()

static void _check_txgetnaturalsize ( HRESULT  res,
LONG  width,
LONG  height,
HDC  hdc,
RECT  rect,
LPCWSTR  string,
int  line 
)
static

Definition at line 726 of file txtsrv.c.

727 {
729  LONG expected_width, expected_height;
730 
732  expected_width = expected_rect.right - expected_rect.left;
733  expected_height = expected_rect.bottom - expected_rect.top;
734  ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
735  ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
736  "got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
737  ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
738  height, expected_height);
739 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define DT_WORDBREAK
Definition: winuser.h:544
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
& rect
Definition: startmenu.cpp:1413
#define DT_LEFT
Definition: winuser.h:534
#define DT_CALCRECT
Definition: winuser.h:526
long LONG
Definition: pedump.c:60
Definition: parser.c:48
static RECT expected_rect
Definition: win.c:5822
HDC hdc
Definition: main.c:9
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define DT_NOCLIP
Definition: winuser.h:536
#define S_OK
Definition: intsafe.h:51
GLuint res
Definition: glext.h:9613
LONG bottom
Definition: windef.h:309
#define DT_EDITCONTROL
Definition: winuser.h:528
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define ok_(x1, x2)
Definition: atltest.h:61

◆ DEFINE_GUID() [1/3]

DEFINE_GUID ( expected_iid_itextservices  ,
0x8d33f740  ,
0xcf58  ,
0x11ce  ,
0xa8  ,
0x9d  ,
0x00  ,
0xaa  ,
0x00  ,
0x6c  ,
0xad  ,
0xc5   
)

◆ DEFINE_GUID() [2/3]

DEFINE_GUID ( expected_iid_itexthost  ,
0x13e670f4  ,
0x1a5a  ,
0x11cf  ,
0xab  ,
0xeb  ,
0x00  ,
0xaa  ,
0x00  ,
0xb6  ,
0x5e  ,
0xa1   
)

◆ DEFINE_GUID() [3/3]

DEFINE_GUID ( expected_iid_itexthost2  ,
0x13e670f5  ,
0x1a5a  ,
0x11cf  ,
0xab  ,
0xeb  ,
0x00  ,
0xaa  ,
0x00  ,
0xb6  ,
0x5e  ,
0xa1   
)

◆ get_refcount()

static ULONG get_refcount ( IUnknown iface)
static

Definition at line 895 of file txtsrv.c.

896 {
897  IUnknown_AddRef(iface);
898  return IUnknown_Release(iface);
899 }

Referenced by test_QueryInterface().

◆ hf_to_cf()

static void hf_to_cf ( HFONT  hf,
CHARFORMAT2W cf 
)
static

Definition at line 604 of file txtsrv.c.

605 {
606  LOGFONTW lf;
607 
608  GetObjectW(hf, sizeof(lf), &lf);
609  lstrcpyW(cf->szFaceName, lf.lfFaceName);
610  cf->yHeight = MulDiv(abs(lf.lfHeight), 1440, GetDeviceCaps(GetDC(NULL), LOGPIXELSY));
611  if (lf.lfWeight > FW_NORMAL) cf->dwEffects |= CFE_BOLD;
612  if (lf.lfItalic) cf->dwEffects |= CFE_ITALIC;
613  if (lf.lfUnderline) cf->dwEffects |= CFE_UNDERLINE;
614  if (lf.lfStrikeOut) cf->dwEffects |= CFE_SUBSCRIPT;
615  cf->bPitchAndFamily = lf.lfPitchAndFamily;
616  cf->bCharSet = lf.lfCharSet;
617 }
#define abs(i)
Definition: fconv.c:206
BYTE lfPitchAndFamily
Definition: dimm.idl:71
#define CFE_UNDERLINE
Definition: richedit.h:408
HDC WINAPI GetDC(_In_opt_ HWND)
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
#define CFE_SUBSCRIPT
Definition: richedit.h:412
#define CFE_BOLD
Definition: richedit.h:406
smooth NULL
Definition: ftsmooth.c:416
#define CFE_ITALIC
Definition: richedit.h:407
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define lstrcpyW
Definition: compat.h:497
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
#define FW_NORMAL
Definition: wingdi.h:372
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define LOGPIXELSY
Definition: wingdi.h:718
LONG lfWeight
Definition: dimm.idl:63
BYTE lfUnderline
Definition: dimm.idl:65
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

Referenced by init_texthost(), and test_TxGetNaturalSize().

◆ impl_from_ITextHost()

static ITextHostTestImpl* impl_from_ITextHost ( ITextHost *  iface)
inlinestatic

Definition at line 91 of file txtsrv.c.

92 {
93  return CONTAINING_RECORD(iface, ITextHostTestImpl, ITextHost_iface);
94 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by ITextHostImpl_AddRef(), ITextHostImpl_OnTxCharFormatChange(), ITextHostImpl_OnTxParaFormatChange(), ITextHostImpl_QueryInterface(), ITextHostImpl_Release(), ITextHostImpl_TxActivate(), ITextHostImpl_TxClientToScreen(), ITextHostImpl_TxCreateCaret(), ITextHostImpl_TxDeactivate(), ITextHostImpl_TxEnableScrollBar(), ITextHostImpl_TxGetAcceleratorPos(), ITextHostImpl_TxGetBackStyle(), ITextHostImpl_TxGetCharFormat(), ITextHostImpl_TxGetClientRect(), ITextHostImpl_TxGetDC(), ITextHostImpl_TxGetExtent(), ITextHostImpl_TxGetMaxLength(), ITextHostImpl_TxGetParaFormat(), ITextHostImpl_TxGetPasswordChar(), ITextHostImpl_TxGetPropertyBits(), ITextHostImpl_TxGetScrollBars(), ITextHostImpl_TxGetSelectionBarWidth(), ITextHostImpl_TxGetSysColor(), ITextHostImpl_TxGetViewInset(), ITextHostImpl_TxImmGetContext(), ITextHostImpl_TxImmReleaseContext(), ITextHostImpl_TxInvalidateRect(), ITextHostImpl_TxKillTimer(), ITextHostImpl_TxNotify(), ITextHostImpl_TxReleaseDC(), ITextHostImpl_TxScreenToClient(), ITextHostImpl_TxScrollWindowEx(), ITextHostImpl_TxSetCapture(), ITextHostImpl_TxSetCaretPos(), ITextHostImpl_TxSetCursor(), ITextHostImpl_TxSetFocus(), ITextHostImpl_TxSetScrollPos(), ITextHostImpl_TxSetScrollRange(), ITextHostImpl_TxSetTimer(), ITextHostImpl_TxShowCaret(), ITextHostImpl_TxShowScrollBar(), and ITextHostImpl_TxViewChange().

◆ impl_from_IUnknown()

static struct unk_impl* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 838 of file txtsrv.c.

839 {
840  return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface);
841 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: api.c:544

Referenced by unk_AddRef(), unk_QueryInterface(), and unk_Release().

◆ init_texthost()

static BOOL init_texthost ( ITextServices **  txtserv,
ITextHost **  ret 
)
static

Definition at line 623 of file txtsrv.c.

624 {
625  ITextHostTestImpl *dummyTextHost;
626  IUnknown *init;
627  HRESULT result;
628  HFONT hf;
629 
630  dummyTextHost = CoTaskMemAlloc(sizeof(*dummyTextHost));
631  if (dummyTextHost == NULL) {
632  win_skip("Insufficient memory to create ITextHost interface\n");
633  return FALSE;
634  }
635  dummyTextHost->ITextHost_iface.lpVtbl = &itextHostVtbl;
636  dummyTextHost->refCount = 1;
637  memset(&dummyTextHost->char_format, 0, sizeof(dummyTextHost->char_format));
638  dummyTextHost->char_format.cbSize = sizeof(dummyTextHost->char_format);
639  dummyTextHost->char_format.dwMask = CFM_ALL2;
641  hf_to_cf(hf, &dummyTextHost->char_format);
642 
643  /* MSDN states that an IUnknown object is returned by
644  CreateTextServices which is then queried to obtain a
645  ITextServices object. */
646  result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
647  ok(result == S_OK, "Did not return S_OK when created (result = %x)\n", result);
648  if (result != S_OK) {
649  CoTaskMemFree(dummyTextHost);
650  win_skip("CreateTextServices failed.\n");
651  return FALSE;
652  }
653 
654  result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
655  ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %x, txtserv = %p)\n", result, *txtserv);
656  IUnknown_Release(init);
657  if (!((result == S_OK) && (*txtserv != NULL))) {
658  CoTaskMemFree(dummyTextHost);
659  win_skip("Could not retrieve ITextServices interface\n");
660  return FALSE;
661  }
662 
663  *ret = &dummyTextHost->ITextHost_iface;
664  return TRUE;
665 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
Definition: txtsrv.c:604
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define TRUE
Definition: types.h:120
CHARFORMAT2W char_format
Definition: txtsrv.c:88
static int init
Definition: wintirpc.c:33
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:45
LONG HRESULT
Definition: typedefs.h:79
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:465
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
int ret
static IID * pIID_ITextServices
Definition: txtsrv.c:42
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
DWORD dwMask
Definition: richedit.h:306
ITextHost ITextHost_iface
Definition: txtsrv.c:86
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
#define CFM_ALL2
Definition: richedit.h:393
#define win_skip
Definition: test.h:149
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by START_TEST(), test_default_format(), test_QueryInterface(), test_TxDraw(), test_TxGetNaturalSize(), test_TxGetScroll(), test_TxGetText(), and test_TxSetText().

◆ ITextHostImpl_AddRef()

static ULONG WINAPI ITextHostImpl_AddRef ( ITextHost *  iface)
static

Definition at line 111 of file txtsrv.c.

112 {
114  ULONG refCount = InterlockedIncrement(&This->refCount);
115  return refCount;
116 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ ITextHostImpl_OnTxCharFormatChange()

static HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange ( ITextHost *  iface,
const CHARFORMATW pcf 
)
static

Definition at line 402 of file txtsrv.c.

404 {
406  TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf);
407  return E_NOTIMPL;
408 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_OnTxParaFormatChange()

static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange ( ITextHost *  iface,
const PARAFORMAT ppf 
)
static

Definition at line 410 of file txtsrv.c.

412 {
414  TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf);
415  return E_NOTIMPL;
416 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_QueryInterface()

static HRESULT WINAPI ITextHostImpl_QueryInterface ( ITextHost *  iface,
REFIID  riid,
LPVOID ppvObject 
)
static

Definition at line 96 of file txtsrv.c.

99 {
101 
103  *ppvObject = &This->ITextHost_iface;
104  ITextHost_AddRef((ITextHost *)*ppvObject);
105  return S_OK;
106  }
107 
108  return E_NOINTERFACE;
109 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
static IID * pIID_ITextHost
Definition: txtsrv.c:43
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:51
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ ITextHostImpl_Release()

static ULONG WINAPI ITextHostImpl_Release ( ITextHost *  iface)
static

Definition at line 118 of file txtsrv.c.

119 {
121  ULONG refCount = InterlockedDecrement(&This->refCount);
122 
123  if (!refCount)
124  {
126  return 0;
127  } else {
128  return refCount;
129  }
130 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ ITextHostImpl_TxActivate()

static HRESULT WINAPI ITextHostImpl_TxActivate ( ITextHost *  iface,
LONG plOldState 
)
static

Definition at line 297 of file txtsrv.c.

299 {
301  TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState);
302  return E_NOTIMPL;
303 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxClientToScreen()

static BOOL WINAPI ITextHostImpl_TxClientToScreen ( ITextHost *  iface,
LPPOINT  lppt 
)
static

Definition at line 289 of file txtsrv.c.

291 {
293  TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt);
294  return FALSE;
295 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxCreateCaret()

static BOOL WINAPI ITextHostImpl_TxCreateCaret ( ITextHost *  iface,
HBITMAP  hbmp,
INT  xWidth,
INT  yHeight 
)
static

Definition at line 206 of file txtsrv.c.

209 {
211  TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n",
212  This, hbmp, xWidth, yHeight);
213  return FALSE;
214 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
HBITMAP hbmp
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxDeactivate()

static HRESULT WINAPI ITextHostImpl_TxDeactivate ( ITextHost *  iface,
LONG  lNewState 
)
static

Definition at line 305 of file txtsrv.c.

307 {
309  TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState);
310  return E_NOTIMPL;
311 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxEnableScrollBar()

static BOOL WINAPI ITextHostImpl_TxEnableScrollBar ( ITextHost *  iface,
INT  fuSBFlags,
INT  fuArrowflags 
)
static

Definition at line 157 of file txtsrv.c.

160 {
162  TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n",
163  This, fuSBFlags, fuArrowflags);
164  return FALSE;
165 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetAcceleratorPos()

static HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos ( ITextHost *  iface,
LONG pch 
)
static

Definition at line 386 of file txtsrv.c.

388 {
390  TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch);
391  return E_NOTIMPL;
392 }
#define pch(ap)
Definition: match.c:418
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetBackStyle()

static HRESULT WINAPI ITextHostImpl_TxGetBackStyle ( ITextHost *  iface,
TXTBACKSTYLE pStyle 
)
static

Definition at line 353 of file txtsrv.c.

355 {
357  TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle);
358  return E_NOTIMPL;
359 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetCharFormat()

static HRESULT WINAPI ITextHostImpl_TxGetCharFormat ( ITextHost *  iface,
const CHARFORMATW **  ppCF 
)
static

Definition at line 329 of file txtsrv.c.

331 {
333  TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF);
334  return E_NOTIMPL;
335 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

Referenced by test_default_format().

◆ ITextHostImpl_TxGetClientRect()

static HRESULT WINAPI ITextHostImpl_TxGetClientRect ( ITextHost *  iface,
LPRECT  prc 
)
static

Definition at line 313 of file txtsrv.c.

315 {
317  TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc);
318  return E_NOTIMPL;
319 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxGetDC()

static HDC WINAPI ITextHostImpl_TxGetDC ( ITextHost *  iface)
static

Definition at line 132 of file txtsrv.c.

133 {
135  TRACECALL("Call to TxGetDC(%p)\n", This);
136  return NULL;
137 }
smooth NULL
Definition: ftsmooth.c:416
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetExtent()

static HRESULT WINAPI ITextHostImpl_TxGetExtent ( ITextHost *  iface,
LPSIZEL  lpExtent 
)
static

Definition at line 394 of file txtsrv.c.

396 {
398  TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent);
399  return E_NOTIMPL;
400 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetMaxLength()

static HRESULT WINAPI ITextHostImpl_TxGetMaxLength ( ITextHost *  iface,
DWORD pLength 
)
static

Definition at line 361 of file txtsrv.c.

363 {
365  TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength);
366  return E_NOTIMPL;
367 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetParaFormat()

static HRESULT WINAPI ITextHostImpl_TxGetParaFormat ( ITextHost *  iface,
const PARAFORMAT **  ppPF 
)
static

Definition at line 337 of file txtsrv.c.

339 {
341  TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF);
342  return E_NOTIMPL;
343 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetPasswordChar()

static HRESULT WINAPI ITextHostImpl_TxGetPasswordChar ( ITextHost *  iface,
WCHAR pch 
)
static

Definition at line 378 of file txtsrv.c.

380 {
382  TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch);
383  return E_NOTIMPL;
384 }
#define pch(ap)
Definition: match.c:418
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetPropertyBits()

static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits ( ITextHost *  iface,
DWORD  dwMask,
DWORD pdwBits 
)
static

Definition at line 420 of file txtsrv.c.

423 {
425  TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n",
426  This, dwMask, pdwBits);
427  *pdwBits = 0;
428  return S_OK;
429 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define S_OK
Definition: intsafe.h:51
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetScrollBars()

static HRESULT WINAPI ITextHostImpl_TxGetScrollBars ( ITextHost *  iface,
DWORD pdwScrollBar 
)
static

Definition at line 369 of file txtsrv.c.

371 {
373  TRACECALL("Call to TxGetScrollBars(%p, pdwScrollBar=%p)\n",
374  This, pdwScrollBar);
375  return E_NOTIMPL;
376 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetSelectionBarWidth()

static HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth ( ITextHost *  iface,
LONG lSelBarWidth 
)
static

Definition at line 455 of file txtsrv.c.

457 {
459  TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n",
460  This, lSelBarWidth);
461  *lSelBarWidth = 0;
462  return E_NOTIMPL;
463 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetSysColor()

static COLORREF WINAPI ITextHostImpl_TxGetSysColor ( ITextHost *  iface,
int  nIndex 
)
static

Definition at line 345 of file txtsrv.c.

347 {
349  TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex);
350  return E_NOTIMPL;
351 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxGetViewInset()

static HRESULT WINAPI ITextHostImpl_TxGetViewInset ( ITextHost *  iface,
LPRECT  prc 
)
static

Definition at line 321 of file txtsrv.c.

323 {
325  TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc);
326  return E_NOTIMPL;
327 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxImmGetContext()

static HIMC WINAPI ITextHostImpl_TxImmGetContext ( ITextHost *  iface)
static

Definition at line 439 of file txtsrv.c.

440 {
442  TRACECALL("Call to TxImmGetContext(%p)\n", This);
443  return 0;
444 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxImmReleaseContext()

static void WINAPI ITextHostImpl_TxImmReleaseContext ( ITextHost *  iface,
HIMC  himc 
)
static

Definition at line 446 of file txtsrv.c.

447 {
449  TRACECALL("Call to TxImmReleaseContext(%p, himc=%p)\n", This, himc);
450 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxInvalidateRect()

static void WINAPI ITextHostImpl_TxInvalidateRect ( ITextHost *  iface,
LPCRECT  prc,
BOOL  fMode 
)
static

Definition at line 190 of file txtsrv.c.

193 {
195  TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n",
196  This, prc, fMode);
197 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxKillTimer()

static void WINAPI ITextHostImpl_TxKillTimer ( ITextHost *  iface,
UINT  idTimer 
)
static

Definition at line 241 of file txtsrv.c.

242 {
244  TRACECALL("Call to TxKillTimer(%p, idTimer=%u)\n", This, idTimer);
245 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxNotify()

static HRESULT WINAPI ITextHostImpl_TxNotify ( ITextHost *  iface,
DWORD  iNotify,
void pv 
)
static

Definition at line 431 of file txtsrv.c.

433 {
435  TRACECALL("Call to TxNotify(%p, iNotify=%d, pv=%p)\n", This, iNotify, pv);
436  return E_NOTIMPL;
437 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxReleaseDC()

static INT WINAPI ITextHostImpl_TxReleaseDC ( ITextHost *  iface,
HDC  hdc 
)
static

Definition at line 139 of file txtsrv.c.

141 {
143  TRACECALL("Call to TxReleaseDC(%p)\n", This);
144  return 0;
145 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxScreenToClient()

static BOOL WINAPI ITextHostImpl_TxScreenToClient ( ITextHost *  iface,
LPPOINT  lppt 
)
static

Definition at line 281 of file txtsrv.c.

283 {
285  TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt);
286  return FALSE;
287 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxScrollWindowEx()

static void WINAPI ITextHostImpl_TxScrollWindowEx ( ITextHost *  iface,
INT  dx,
INT  dy,
LPCRECT  lprcScroll,
LPCRECT  lprcClip,
HRGN  hRgnUpdate,
LPRECT  lprcUpdate,
UINT  fuScroll 
)
static

Definition at line 247 of file txtsrv.c.

254 {
256  TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n",
257  This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll);
258 }
GLint dy
Definition: linetemp.h:97
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
GLint dx
Definition: linetemp.h:97
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetCapture()

static void WINAPI ITextHostImpl_TxSetCapture ( ITextHost *  iface,
BOOL  fCapture 
)
static

Definition at line 260 of file txtsrv.c.

261 {
263  TRACECALL("Call to TxSetCapture(%p, fCapture=%d)\n", This, fCapture);
264 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetCaretPos()

static BOOL WINAPI ITextHostImpl_TxSetCaretPos ( ITextHost *  iface,
INT  x,
INT  y 
)
static

Definition at line 224 of file txtsrv.c.

226 {
228  TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y);
229  return FALSE;
230 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetCursor()

static void WINAPI ITextHostImpl_TxSetCursor ( ITextHost *  iface,
HCURSOR  hcur,
BOOL  fText 
)
static

Definition at line 272 of file txtsrv.c.

275 {
277  TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n",
278  This, hcur, fText);
279 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetFocus()

static void WINAPI ITextHostImpl_TxSetFocus ( ITextHost *  iface)
static

Definition at line 266 of file txtsrv.c.

267 {
269  TRACECALL("Call to TxSetFocus(%p)\n", This);
270 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetScrollPos()

static BOOL WINAPI ITextHostImpl_TxSetScrollPos ( ITextHost *  iface,
INT  fnBar,
INT  nPos,
BOOL  fRedraw 
)
static

Definition at line 179 of file txtsrv.c.

183 {
185  TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n",
186  This, fnBar, nPos, fRedraw);
187  return FALSE;
188 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetScrollRange()

static BOOL WINAPI ITextHostImpl_TxSetScrollRange ( ITextHost *  iface,
INT  fnBar,
LONG  nMinPos,
INT  nMaxPos,
BOOL  fRedraw 
)
static

Definition at line 167 of file txtsrv.c.

172 {
174  TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n",
175  This, fnBar, nMinPos, nMaxPos, fRedraw);
176  return FALSE;
177 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxSetTimer()

static BOOL WINAPI ITextHostImpl_TxSetTimer ( ITextHost *  iface,
UINT  idTimer,
UINT  uTimeout 
)
static

Definition at line 232 of file txtsrv.c.

234 {
236  TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n",
237  This, idTimer, uTimeout);
238  return FALSE;
239 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxShowCaret()

static BOOL WINAPI ITextHostImpl_TxShowCaret ( ITextHost *  iface,
BOOL  fShow 
)
static

Definition at line 216 of file txtsrv.c.

217 {
219  TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n",
220  This, fShow);
221  return FALSE;
222 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxShowScrollBar()

static BOOL WINAPI ITextHostImpl_TxShowScrollBar ( ITextHost *  iface,
INT  fnBar,
BOOL  fShow 
)
static

Definition at line 147 of file txtsrv.c.

150 {
152  TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n",
153  This, fnBar, fShow);
154  return FALSE;
155 }
#define FALSE
Definition: types.h:117
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_TxViewChange()

static void WINAPI ITextHostImpl_TxViewChange ( ITextHost *  iface,
BOOL  fUpdate 
)
static

Definition at line 199 of file txtsrv.c.

200 {
202  TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n",
203  This, fUpdate);
204 }
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:91
#define TRACECALL
Definition: txtsrv.c:79

◆ setup_thiscall_wrappers()

static void setup_thiscall_wrappers ( void  )
static

Definition at line 536 of file txtsrv.c.

537 {
538 #if defined(__i386__) && !defined(__MINGW32__)
539  void** pVtable;
540  void** pVtableEnd;
543 
545  (sizeof(ITextHostVtbl)/sizeof(void*) - 3)
546  * sizeof(THISCALL_TO_STDCALL_THUNK)
547  +(sizeof(ITextServicesVtbl)/sizeof(void*) - 3)
548  * sizeof(STDCALL_TO_THISCALL_THUNK),
551 
552  /* Wrap all ITextHostImpl methods with code to perform a thiscall to
553  * stdcall conversion. The thiscall calling convention places the This
554  * pointer in ecx on the x86 platform, and the stdcall calling convention
555  * pushes the This pointer on the stack as the first argument.
556  *
557  * The byte code does the conversion then jumps to the real function.
558  *
559  * Each wrapper needs to be modified so that the function to jump to is
560  * modified in the byte code. */
561 
562  /* Skip QueryInterface, AddRef, and Release native actually
563  * defined them with the stdcall calling convention. */
564  pVtable = (void**)&itextHostVtbl + 3;
565  pVtableEnd = (void**)(&itextHostVtbl + 1);
566  while (pVtable != pVtableEnd) {
567  /* write byte code to executable memory */
568  thunk->pop_eax = 0x58; /* popl %eax */
569  thunk->push_ecx = 0x51; /* pushl %ecx */
570  thunk->push_eax = 0x50; /* pushl %eax */
571  thunk->jmp_func = 0xe9; /* jmp $func */
572  /* The address needs to be relative to the end of the jump instructions. */
573  thunk->func = (char*)*pVtable - (char*)(&thunk->func + 1);
574  *pVtable = thunk;
575  pVtable++;
576  thunk++;
577  }
578 
579  /* Setup an ITextServices standard call vtable that will call the
580  * native thiscall vtable when the methods are called. */
581 
582  /* QueryInterface, AddRef, and Release should be called directly on the
583  * real vtable since they use the stdcall calling convention. */
584  thunk2 = (STDCALL_TO_THISCALL_THUNK *)thunk;
585  pVtable = (void**)&itextServicesStdcallVtbl + 3;
586  pVtableEnd = (void**)(&itextServicesStdcallVtbl + 1);
587  while (pVtable != pVtableEnd) {
588  /* write byte code to executable memory */
589  thunk2->pop_eax = 0x58; /* popl %eax */
590  thunk2->pop_ecx = 0x59; /* popl %ecx */
591  thunk2->push_eax = 0x50; /* pushl %eax */
592  thunk2->mov_vtable_eax[0] = 0x8b; /* movl (%ecx), %eax */
593  thunk2->mov_vtable_eax[1] = 0x01;
594  thunk2->jmp_eax[0] = 0xff; /* jmp *$vtablefunc_offset(%eax) */
595  thunk2->jmp_eax[1] = 0xa0;
596  thunk2->vtablefunc_offset = (char*)pVtable - (char*)&itextServicesStdcallVtbl;
597  *pVtable = thunk2;
598  pVtable++;
599  thunk2++;
600  }
601 #endif /* __i386__ */
602 }
Definition: cproxy.c:247
#define MEM_COMMIT
Definition: nt_native.h:1313
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
smooth NULL
Definition: ftsmooth.c:416
static void * wrapperCodeMem
Definition: txtsrv.c:510
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:465
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( txtsrv  )

Definition at line 1047 of file txtsrv.c.

1048 {
1049  ITextServices *txtserv;
1050  ITextHost *host;
1051 
1053 
1054  /* Must explicitly LoadLibrary(). The test has no references to functions in
1055  * RICHED20.DLL, so the linker doesn't actually link to it. */
1056  hmoduleRichEdit = LoadLibraryA("riched20.dll");
1057  ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
1058 
1059  pIID_ITextServices = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextServices");
1060  pIID_ITextHost = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost");
1061  pIID_ITextHost2 = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost2");
1062  pCreateTextServices = (void*)GetProcAddress(hmoduleRichEdit, "CreateTextServices");
1063 
1064  test_IIDs();
1065  test_COM();
1066 
1067  if (init_texthost(&txtserv, &host))
1068  {
1069  ITextServices_Release(txtserv);
1070  ITextHost_Release(host);
1071 
1072  test_TxGetText();
1073  test_TxSetText();
1075  test_TxDraw();
1078  test_TxGetScroll();
1079  }
1081 }
static void test_TxGetText(void)
Definition: txtsrv.c:667
static void test_TxGetScroll(void)
Definition: txtsrv.c:1028
static void test_COM(void)
Definition: txtsrv.c:871
static void test_TxGetNaturalSize(void)
Definition: txtsrv.c:741
char * host
Definition: whois.c:55
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
static IID * pIID_ITextHost2
Definition: txtsrv.c:44
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE hmoduleRichEdit
Definition: txtsrv.c:41
static void test_TxDraw(void)
Definition: txtsrv.c:790
smooth NULL
Definition: ftsmooth.c:416
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:45
static void test_default_format(void)
Definition: txtsrv.c:998
static IID * pIID_ITextHost
Definition: txtsrv.c:43
static void test_QueryInterface(void)
Definition: txtsrv.c:901
static void * wrapperCodeMem
Definition: txtsrv.c:510
static IID * pIID_ITextServices
Definition: txtsrv.c:42
static void test_TxSetText(void)
Definition: txtsrv.c:685
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
static void setup_thiscall_wrappers(void)
Definition: txtsrv.c:536
#define MEM_RELEASE
Definition: nt_native.h:1316
#define GetProcAddress(x, y)
Definition: compat.h:501
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
static void test_IIDs(void)
Definition: txtsrv.c:821

◆ test_COM()

static void test_COM ( void  )
static

Definition at line 871 of file txtsrv.c.

872 {
873  struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL};
874  struct ITextHostTestImpl texthost = {{&itextHostVtbl}, 1};
875  ITextServices *textsrv;
876  ULONG refcount;
877  HRESULT hr;
878 
879  /* COM aggregation */
881  &unk_obj.inner_unk);
882  ok(hr == S_OK, "CreateTextServices failed: %08x\n", hr);
883  hr = IUnknown_QueryInterface(unk_obj.inner_unk, pIID_ITextServices, (void**)&textsrv);
884  ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08x\n", hr);
885  refcount = ITextServices_AddRef(textsrv);
886  ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
887  refcount = ITextServices_Release(textsrv);
888  ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
889  refcount = ITextServices_Release(textsrv);
890  ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
891 
892  IUnknown_Release(unk_obj.inner_unk);
893 }
HRESULT hr
Definition: shlfolder.c:183
IUnknown IUnknown_iface
Definition: api.c:545
LONG ref
Definition: api.c:546
smooth NULL
Definition: ftsmooth.c:416
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:45
LONG HRESULT
Definition: typedefs.h:79
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:465
Definition: api.c:544
static IID * pIID_ITextServices
Definition: txtsrv.c:42
static const IUnknownVtbl unk_vtbl
Definition: txtsrv.c:864
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
ITextHost ITextHost_iface
Definition: txtsrv.c:86
unsigned int ULONG
Definition: retypes.h:1
IUnknown * inner_unk
Definition: api.c:547

Referenced by START_TEST().

◆ test_default_format()

static void test_default_format ( void  )
static

Definition at line 998 of file txtsrv.c.

999 {
1000  ITextServices *txtserv;
1001  ITextHost *host;
1002  HRESULT result;
1003  LRESULT lresult;
1004  CHARFORMAT2W cf2;
1005  const CHARFORMATW *host_cf;
1006  DWORD expected_effects;
1007 
1008  if (!init_texthost(&txtserv, &host))
1009  return;
1010 
1011  cf2.cbSize = sizeof(CHARFORMAT2W);
1013  ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
1014 
1016  ok(!lstrcmpW(host_cf->szFaceName, cf2.szFaceName), "got wrong font name: %s.\n", wine_dbgstr_w(cf2.szFaceName));
1017  ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %d, expected %d.\n", cf2.yHeight, host_cf->yHeight);
1018  expected_effects = (cf2.dwEffects & ~(CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR));
1019  ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %x, expected %x.\n", cf2.dwEffects, expected_effects);
1020  ok(cf2.bPitchAndFamily == host_cf->bPitchAndFamily, "got wrong bPitchAndFamily: %x, expected %x.\n",
1021  cf2.bPitchAndFamily, host_cf->bPitchAndFamily);
1022  ok(cf2.bCharSet == host_cf->bCharSet, "got wrong bCharSet: %x, expected %x.\n", cf2.bCharSet, host_cf->bCharSet);
1023 
1024  ITextServices_Release(txtserv);
1025  ITextHost_Release(host);
1026 }
#define CFE_AUTOCOLOR
Definition: richedit.h:414
DWORD dwEffects
Definition: richedit.h:270
LONG yHeight
Definition: richedit.h:271
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:276
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
char * host
Definition: whois.c:55
DWORD dwEffects
Definition: richedit.h:307
LONG_PTR LPARAM
Definition: windef.h:208
BYTE bCharSet
Definition: richedit.h:274
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
BYTE bPitchAndFamily
Definition: richedit.h:275
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:313
static HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
Definition: txtsrv.c:329
#define ITextServices_TxSendMessage(This, a, b, c, d)
Definition: txtsrv.c:58
#define S_OK
Definition: intsafe.h:51
#define EM_GETCHARFORMAT
Definition: richedit.h:91
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
BYTE bCharSet
Definition: richedit.h:311
#define SCF_DEFAULT
Definition: richedit.h:234
struct _charformat2w CHARFORMAT2W
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
LONG yHeight
Definition: richedit.h:308
BYTE bPitchAndFamily
Definition: richedit.h:312

Referenced by START_TEST().

◆ test_IIDs()

static void test_IIDs ( void  )
static

Definition at line 821 of file txtsrv.c.

822 {
823  ok(IsEqualIID(pIID_ITextServices, &expected_iid_itextservices),
824  "unexpected value for IID_ITextServices: %s\n", wine_dbgstr_guid(pIID_ITextServices));
825  ok(IsEqualIID(pIID_ITextHost, &expected_iid_itexthost),
826  "unexpected value for IID_ITextHost: %s\n", wine_dbgstr_guid(pIID_ITextHost));
827  ok(IsEqualIID(pIID_ITextHost2, &expected_iid_itexthost2),
828  "unexpected value for IID_ITextHost2: %s\n", wine_dbgstr_guid(pIID_ITextHost2));
829 }
const char * wine_dbgstr_guid(const GUID *guid)
static IID * pIID_ITextHost2
Definition: txtsrv.c:44
static IID * pIID_ITextHost
Definition: txtsrv.c:43
static IID * pIID_ITextServices
Definition: txtsrv.c:42
#define ok(value,...)
Definition: atltest.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by START_TEST().

◆ test_QueryInterface()

static void test_QueryInterface ( void  )
static

Definition at line 901 of file txtsrv.c.

902 {
903  ITextServices *txtserv;
904  ITextHost *host;
905  HRESULT hres;
906  IRichEditOle *reole, *txtsrv_reole;
907  ITextDocument *txtdoc, *txtsrv_txtdoc;
908  ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
909  ULONG refcount;
910 
911  if(!init_texthost(&txtserv, &host))
912  return;
913 
914  refcount = get_refcount((IUnknown *)txtserv);
915  ok(refcount == 1, "got wrong ref count: %d\n", refcount);
916 
917  /* IID_IRichEditOle */
918  hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
919  ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
920  refcount = get_refcount((IUnknown *)txtserv);
921  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
922  refcount = get_refcount((IUnknown *)txtsrv_reole);
923  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
924 
925  hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
926  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
927  refcount = get_refcount((IUnknown *)txtserv);
928  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
929  refcount = get_refcount((IUnknown *)txtsrv_reole);
930  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
931 
932  ITextDocument_Release(txtdoc);
933  refcount = get_refcount((IUnknown *)txtserv);
934  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
935 
936  hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
937  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
938  refcount = get_refcount((IUnknown *)txtserv);
939  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
940  refcount = get_refcount((IUnknown *)txtsrv_reole);
941  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
942 
943  ITextDocument2Old_Release(txtdoc2old);
944  refcount = get_refcount((IUnknown *)txtserv);
945  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
946  IRichEditOle_Release(txtsrv_reole);
947  refcount = get_refcount((IUnknown *)txtserv);
948  ok(refcount == 1, "got wrong ref count: %d\n", refcount);
949 
950  /* IID_ITextDocument */
951  hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
952  ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
953  refcount = get_refcount((IUnknown *)txtserv);
954  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
955  refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
956  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
957 
958  hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
959  ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08x\n", hres);
960  refcount = get_refcount((IUnknown *)txtserv);
961  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
962  refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
963  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
964 
965  IRichEditOle_Release(reole);
966  refcount = get_refcount((IUnknown *)txtserv);
967  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
968  ITextDocument_Release(txtsrv_txtdoc);
969  refcount = get_refcount((IUnknown *)txtserv);
970  ok(refcount == 1, "got wrong ref count: %d\n", refcount);
971 
972  /* ITextDocument2Old */
973  hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
974  ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
975  refcount = get_refcount((IUnknown *)txtserv);
976  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
977  refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
978  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
979 
980  hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
981  ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08x\n", hres);
982  refcount = get_refcount((IUnknown *)txtserv);
983  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
984  refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
985  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
986 
987  IRichEditOle_Release(reole);
988  refcount = get_refcount((IUnknown *)txtserv);
989  ok(refcount == 2, "got wrong ref count: %d\n", refcount);
990  ITextDocument2Old_Release(txtsrv_txtdoc2old);
991  refcount = get_refcount((IUnknown *)txtserv);
992  ok(refcount == 1, "got wrong ref count: %d\n", refcount);
993 
994  ITextServices_Release(txtserv);
995  ITextHost_Release(host);
996 }
char * host
Definition: whois.c:55
static ULONG get_refcount(IUnknown *iface)
Definition: txtsrv.c:895
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ test_TxDraw()

static void test_TxDraw ( void  )
static

Definition at line 790 of file txtsrv.c.

791 {
792  ITextServices *txtserv;
793  ITextHost *host;
794  HDC tmphdc = GetDC(NULL);
795  DWORD dwAspect = DVASPECT_CONTENT;
796  HDC hicTargetDev = NULL; /* Means "default" device */
797  DVTARGETDEVICE *ptd = NULL;
798  void *pvAspect = NULL;
799  HRESULT result;
800  RECTL client = {0,0,100,100};
801 
802 
803  if (!init_texthost(&txtserv, &host))
804  return;
805 
806  todo_wine {
807  result = ITextServices_TxDraw(txtserv, dwAspect, 0, pvAspect, ptd,
808  tmphdc, hicTargetDev, &client, NULL,
809  NULL, NULL, 0, 0);
810  ok(result == S_OK, "TxDraw failed (result = %x)\n", result);
811  }
812 
813  ITextServices_Release(txtserv);
814  ITextHost_Release(host);
815 }
HDC WINAPI GetDC(_In_opt_ HWND)
char * host
Definition: whois.c:55
static HDC
Definition: imagelist.c:92
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:79
static FILE * client
Definition: client.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define todo_wine
Definition: test.h:162
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)
Definition: txtsrv.c:59
#define S_OK
Definition: intsafe.h:51
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
GLuint64EXT * result
Definition: glext.h:11304

Referenced by START_TEST().

◆ test_TxGetNaturalSize()

static void test_TxGetNaturalSize ( void  )
static

Definition at line 741 of file txtsrv.c.

742 {
743  ITextServices *txtserv;
744  ITextHost *host;
745  HRESULT result;
746  SIZEL extent;
747  static const WCHAR test_text[] = {'T','e','s','t','S','o','m','e','T','e','x','t',0};
748  LONG width, height;
749  HDC hdcDraw;
750  HWND hwnd;
751  RECT rect;
753  LRESULT lresult;
754  HFONT hf;
755 
756  if (!init_texthost(&txtserv, &host))
757  return;
758 
759  hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
760  0, 0, 100, 100, 0, 0, 0, NULL);
761  hdcDraw = GetDC(hwnd);
762  SetMapMode(hdcDraw,MM_TEXT);
764 
765  memset(&cf, 0, sizeof(cf));
766  cf.cbSize = sizeof(cf);
767  cf.dwMask = CFM_ALL2;
769  hf_to_cf(hf, &cf);
771  ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
772  SelectObject(hdcDraw, hf);
773 
774  result = ITextServices_TxSetText(txtserv, test_text);
775  ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08x.\n", result);
776 
777  extent.cx = -1; extent.cy = -1;
778  width = rect.right - rect.left;
779  height = 0;
780  result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL,
782  todo_wine CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
783 
784  ReleaseDC(hwnd, hdcDraw);
786  ITextServices_Release(txtserv);
787  ITextHost_Release(host);
788 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
static IClassFactory * cf
static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
Definition: txtsrv.c:604
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
HDC WINAPI GetDC(_In_opt_ HWND)
char * host
Definition: whois.c:55
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DestroyWindow(_In_ HWND)
& rect
Definition: startmenu.cpp:1413
long LONG
Definition: pedump.c:60
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define EM_SETCHARFORMAT
Definition: richedit.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)
Definition: txtsrv.c:724
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
#define todo_wine
Definition: test.h:162
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)
Definition: txtsrv.c:72
#define ITextServices_TxSendMessage(This, a, b, c, d)
Definition: txtsrv.c:58
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:51
#define ITextServices_TxSetText(This, a)
Definition: txtsrv.c:69
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define SCF_DEFAULT
Definition: richedit.h:234
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define MM_TEXT
Definition: wingdi.h:872
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
#define CFM_ALL2
Definition: richedit.h:393

Referenced by START_TEST().

◆ test_TxGetScroll()

static void test_TxGetScroll ( void  )
static

Definition at line 1028 of file txtsrv.c.

1029 {
1030  ITextServices *txtserv;
1031  ITextHost *host;
1032  HRESULT ret;
1033 
1034  if (!init_texthost(&txtserv, &host))
1035  return;
1036 
1038  ok(ret == S_OK, "ITextSerHices_GetVScroll failed: 0x%08x.\n", ret);
1039 
1041  ok(ret == S_OK, "ITextServices_GetVScroll failed: 0x%08x.\n", ret);
1042 
1043  ITextServices_Release(txtserv);
1044  ITextHost_Release(host);
1045 }
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)
Definition: txtsrv.c:60
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)
Definition: txtsrv.c:61
char * host
Definition: whois.c:55
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:79
int ret
#define S_OK
Definition: intsafe.h:51
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_TxGetText()

static void test_TxGetText ( void  )
static

Definition at line 667 of file txtsrv.c.

668 {
669  ITextServices *txtserv;
670  ITextHost *host;
671  HRESULT hres;
672  BSTR rettext;
673 
674  if (!init_texthost(&txtserv, &host))
675  return;
676 
677  hres = ITextServices_TxGetText(txtserv, &rettext);
678  ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
679  SysFreeString(rettext);
680 
681  ITextServices_Release(txtserv);
682  ITextHost_Release(host);
683 }
char * host
Definition: whois.c:55
OLECHAR * BSTR
Definition: compat.h:2041
#define ITextServices_TxGetText(This, a)
Definition: txtsrv.c:68
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by START_TEST().

◆ test_TxSetText()

static void test_TxSetText ( void  )
static

Definition at line 685 of file txtsrv.c.

686 {
687  ITextServices *txtserv;
688  ITextHost *host;
689  HRESULT hres;
690  BSTR rettext;
691  WCHAR settext[] = {'T','e','s','t',0};
692 
693  if (!init_texthost(&txtserv, &host))
694  return;
695 
696  hres = ITextServices_TxSetText(txtserv, settext);
697  ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
698 
699  hres = ITextServices_TxGetText(txtserv, &rettext);
700  ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
701 
702  ok(SysStringLen(rettext) == 4,
703  "String returned of wrong length (expected 4, got %d)\n", SysStringLen(rettext));
704  ok(memcmp(rettext,settext,SysStringByteLen(rettext)) == 0,
705  "String returned differs\n");
706 
707  SysFreeString(rettext);
708 
709  /* Null-pointer should behave the same as empty-string */
710 
711  hres = ITextServices_TxSetText(txtserv, 0);
712  ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
713 
714  hres = ITextServices_TxGetText(txtserv, &rettext);
715  ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
716  ok(SysStringLen(rettext) == 0,
717  "String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
718 
719  SysFreeString(rettext);
720  ITextServices_Release(txtserv);
721  ITextHost_Release(host);
722 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
char * host
Definition: whois.c:55
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
OLECHAR * BSTR
Definition: compat.h:2041
#define ITextServices_TxGetText(This, a)
Definition: txtsrv.c:68
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define S_OK
Definition: intsafe.h:51
#define ITextServices_TxSetText(This, a)
Definition: txtsrv.c:69
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:623
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by START_TEST().

◆ unk_AddRef()

static ULONG WINAPI unk_AddRef ( IUnknown iface)
static

Definition at line 850 of file txtsrv.c.

851 {
852  struct unk_impl *This = impl_from_IUnknown(iface);
853 
854  return InterlockedIncrement(&This->ref);
855 }
static struct unk_impl * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:838
Definition: api.c:544
#define InterlockedIncrement
Definition: armddk.h:53

◆ unk_QueryInterface()

static HRESULT WINAPI unk_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 843 of file txtsrv.c.

844 {
845  struct unk_impl *This = impl_from_IUnknown(iface);
846 
847  return IUnknown_QueryInterface(This->inner_unk, riid, ppv);
848 }
REFIID riid
Definition: precomp.h:44
static struct unk_impl * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:838
REFIID LPVOID * ppv
Definition: atlbase.h:39
Definition: api.c:544

◆ unk_Release()

static ULONG WINAPI unk_Release ( IUnknown iface)
static

Definition at line 857 of file txtsrv.c.

858 {
859  struct unk_impl *This = impl_from_IUnknown(iface);
860 
861  return InterlockedDecrement(&This->ref);
862 }
static struct unk_impl * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:838
Definition: api.c:544
#define InterlockedDecrement
Definition: armddk.h:52

Variable Documentation

◆ hmoduleRichEdit

HMODULE hmoduleRichEdit
static

Definition at line 41 of file txtsrv.c.

Referenced by START_TEST().

◆ itextHostVtbl

ITextHostVtbl itextHostVtbl
static

Definition at line 465 of file txtsrv.c.

Referenced by init_texthost(), setup_thiscall_wrappers(), and test_COM().

◆ pCreateTextServices

PCreateTextServices pCreateTextServices
static

Definition at line 45 of file txtsrv.c.

Referenced by init_texthost(), START_TEST(), and test_COM().

◆ pIID_ITextHost

IID* pIID_ITextHost
static

Definition at line 43 of file txtsrv.c.

Referenced by ITextHostImpl_QueryInterface(), START_TEST(), and test_IIDs().

◆ pIID_ITextHost2

IID* pIID_ITextHost2
static

Definition at line 44 of file txtsrv.c.

Referenced by START_TEST(), and test_IIDs().

◆ pIID_ITextServices

IID* pIID_ITextServices
static

Definition at line 42 of file txtsrv.c.

Referenced by init_texthost(), START_TEST(), test_COM(), and test_IIDs().

◆ unk_vtbl

const IUnknownVtbl unk_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI unk_AddRef(IUnknown *iface)
Definition: txtsrv.c:850
static ULONG WINAPI unk_Release(IUnknown *iface)
Definition: txtsrv.c:857
static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: txtsrv.c:843

Definition at line 864 of file txtsrv.c.

Referenced by test_COM().

◆ wrapperCodeMem

void* wrapperCodeMem = NULL
static

Definition at line 510 of file txtsrv.c.

Referenced by setup_thiscall_wrappers(), and START_TEST().