ReactOS 0.4.16-dev-1059-gb1cf981
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 __thiscall ITextHostImpl_TxGetDC (ITextHost *iface)
 
static INT __thiscall ITextHostImpl_TxReleaseDC (ITextHost *iface, HDC hdc)
 
static BOOL __thiscall ITextHostImpl_TxShowScrollBar (ITextHost *iface, INT fnBar, BOOL fShow)
 
static BOOL __thiscall ITextHostImpl_TxEnableScrollBar (ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
 
static BOOL __thiscall ITextHostImpl_TxSetScrollRange (ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
 
static BOOL __thiscall ITextHostImpl_TxSetScrollPos (ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
 
static void __thiscall ITextHostImpl_TxInvalidateRect (ITextHost *iface, LPCRECT prc, BOOL fMode)
 
static void __thiscall ITextHostImpl_TxViewChange (ITextHost *iface, BOOL fUpdate)
 
static BOOL __thiscall ITextHostImpl_TxCreateCaret (ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
 
static BOOL __thiscall ITextHostImpl_TxShowCaret (ITextHost *iface, BOOL fShow)
 
static BOOL __thiscall ITextHostImpl_TxSetCaretPos (ITextHost *iface, INT x, INT y)
 
static BOOL __thiscall ITextHostImpl_TxSetTimer (ITextHost *iface, UINT idTimer, UINT uTimeout)
 
static void __thiscall ITextHostImpl_TxKillTimer (ITextHost *iface, UINT idTimer)
 
static void __thiscall ITextHostImpl_TxScrollWindowEx (ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, UINT fuScroll)
 
static void __thiscall ITextHostImpl_TxSetCapture (ITextHost *iface, BOOL fCapture)
 
static void __thiscall ITextHostImpl_TxSetFocus (ITextHost *iface)
 
static void __thiscall ITextHostImpl_TxSetCursor (ITextHost *iface, HCURSOR hcur, BOOL fText)
 
static BOOL __thiscall ITextHostImpl_TxScreenToClient (ITextHost *iface, LPPOINT lppt)
 
static BOOL __thiscall ITextHostImpl_TxClientToScreen (ITextHost *iface, LPPOINT lppt)
 
static HRESULT __thiscall ITextHostImpl_TxActivate (ITextHost *iface, LONG *plOldState)
 
static HRESULT __thiscall ITextHostImpl_TxDeactivate (ITextHost *iface, LONG lNewState)
 
static HRESULT __thiscall ITextHostImpl_TxGetClientRect (ITextHost *iface, LPRECT prc)
 
static HRESULT __thiscall ITextHostImpl_TxGetViewInset (ITextHost *iface, LPRECT prc)
 
static HRESULT __thiscall ITextHostImpl_TxGetCharFormat (ITextHost *iface, const CHARFORMATW **ppCF)
 
static HRESULT __thiscall ITextHostImpl_TxGetParaFormat (ITextHost *iface, const PARAFORMAT **ppPF)
 
static COLORREF __thiscall ITextHostImpl_TxGetSysColor (ITextHost *iface, int nIndex)
 
static HRESULT __thiscall ITextHostImpl_TxGetBackStyle (ITextHost *iface, TXTBACKSTYLE *pStyle)
 
static HRESULT __thiscall ITextHostImpl_TxGetMaxLength (ITextHost *iface, DWORD *pLength)
 
static HRESULT __thiscall ITextHostImpl_TxGetScrollBars (ITextHost *iface, DWORD *scrollbars)
 
static HRESULT __thiscall ITextHostImpl_TxGetPasswordChar (ITextHost *iface, WCHAR *pch)
 
static HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos (ITextHost *iface, LONG *pch)
 
static HRESULT __thiscall ITextHostImpl_TxGetExtent (ITextHost *iface, LPSIZEL lpExtent)
 
static HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange (ITextHost *iface, const CHARFORMATW *pcf)
 
static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange (ITextHost *iface, const PARAFORMAT *ppf)
 
static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits (ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
 
static HRESULT __thiscall ITextHostImpl_TxNotify (ITextHost *iface, DWORD code, void *data)
 
static HIMC __thiscall ITextHostImpl_TxImmGetContext (ITextHost *iface)
 
static void __thiscall ITextHostImpl_TxImmReleaseContext (ITextHost *iface, HIMC himc)
 
static HRESULT __thiscall 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 fill_reobject_struct (REOBJECT *reobj, LONG cp, LPOLEOBJECT poleobj, LPSTORAGE pstg, LPOLECLIENTSITE polesite, LONG sizel_cx, LONG sizel_cy, DWORD aspect, DWORD flags, DWORD user)
 
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)
 
static void test_notifications (void)
 
 START_TEST (txtsrv)
 

Variables

static HMODULE hmoduleRichEdit
 
static IIDpIID_ITextServices
 
static IIDpIID_ITextHost
 
static IIDpIID_ITextHost2
 
static PCreateTextServices pCreateTextServices
 
static const WCHAR lorem []
 
static int en_vscroll_sent
 
static int en_update_sent
 
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 749 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 751 of file txtsrv.c.

752{
754 LONG expected_width, expected_height;
755
757 expected_width = expected_rect.right - expected_rect.left;
758 expected_height = expected_rect.bottom - expected_rect.top;
759 ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
760 todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
761 "got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
762 ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
763 height, expected_height);
764}
#define ok_(x1, x2)
Definition: atltest.h:61
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint res
Definition: glext.h:9613
#define S_OK
Definition: intsafe.h:52
HDC hdc
Definition: main.c:9
#define todo_wine
Definition: custom.c:89
static RECT expected_rect
Definition: win.c:5821
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
long LONG
Definition: pedump.c:60
& rect
Definition: startmenu.cpp:1413
Definition: parser.c:49
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_LEFT
Definition: winuser.h:534
#define DT_WORDBREAK
Definition: winuser.h:544
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_EDITCONTROL
Definition: winuser.h:528

◆ DEFINE_GUID() [1/3]

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

◆ DEFINE_GUID() [2/3]

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

◆ DEFINE_GUID() [3/3]

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

◆ fill_reobject_struct()

static void fill_reobject_struct ( REOBJECT reobj,
LONG  cp,
LPOLEOBJECT  poleobj,
LPSTORAGE  pstg,
LPOLECLIENTSITE  polesite,
LONG  sizel_cx,
LONG  sizel_cy,
DWORD  aspect,
DWORD  flags,
DWORD  user 
)
static

Definition at line 653 of file txtsrv.c.

656{
657 reobj->cbStruct = sizeof(*reobj);
658 reobj->clsid = CLSID_NULL;
659 reobj->cp = cp;
660 reobj->poleobj = poleobj;
661 reobj->pstg = pstg;
662 reobj->polesite = polesite;
663 reobj->sizel.cx = sizel_cx;
664 reobj->sizel.cy = sizel_cy;
665 reobj->dvaspect = aspect;
666 reobj->dwFlags = flags;
667 reobj->dwUser = user;
668}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
GLbitfield flags
Definition: glext.h:7161
POINT cp
Definition: magnifier.c:59
#define CLSID_NULL
Definition: guiddef.h:99
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
DWORD dwUser
Definition: richole.idl:67
CLSID clsid
Definition: richole.idl:60
DWORD dwFlags
Definition: richole.idl:66
LPSTORAGE pstg
Definition: richole.idl:62
LPOLEOBJECT poleobj
Definition: richole.idl:61
DWORD dvaspect
Definition: richole.idl:65
LPOLECLIENTSITE polesite
Definition: richole.idl:63
DWORD cbStruct
Definition: richole.idl:58
LONG cp
Definition: richole.idl:59
SIZEL sizel
Definition: richole.idl:64

Referenced by test_TxGetText().

◆ get_refcount()

static ULONG get_refcount ( IUnknown iface)
static

Definition at line 945 of file txtsrv.c.

946{
947 IUnknown_AddRef(iface);
948 return IUnknown_Release(iface);
949}

Referenced by test_QueryInterface().

◆ hf_to_cf()

static void hf_to_cf ( HFONT  hf,
CHARFORMAT2W cf 
)
static

Definition at line 585 of file txtsrv.c.

586{
587 LOGFONTW lf;
588
589 GetObjectW(hf, sizeof(lf), &lf);
590 lstrcpyW(cf->szFaceName, lf.lfFaceName);
591 cf->yHeight = MulDiv(abs(lf.lfHeight), 1440, GetDeviceCaps(GetDC(NULL), LOGPIXELSY));
592 if (lf.lfWeight > FW_NORMAL) cf->dwEffects |= CFE_BOLD;
593 if (lf.lfItalic) cf->dwEffects |= CFE_ITALIC;
594 if (lf.lfUnderline) cf->dwEffects |= CFE_UNDERLINE;
595 if (lf.lfStrikeOut) cf->dwEffects |= CFE_SUBSCRIPT;
596 cf->bPitchAndFamily = lf.lfPitchAndFamily;
597 cf->bCharSet = lf.lfCharSet;
598}
#define NULL
Definition: types.h:112
#define lstrcpyW
Definition: compat.h:749
#define abs(i)
Definition: fconv.c:206
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define CFE_BOLD
Definition: richedit.h:406
#define CFE_ITALIC
Definition: richedit.h:407
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFE_SUBSCRIPT
Definition: richedit.h:412
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define FW_NORMAL
Definition: wingdi.h:373
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by init_texthost(), and test_TxGetNaturalSize().

◆ impl_from_ITextHost()

static ITextHostTestImpl * impl_from_ITextHost ( ITextHost *  iface)
inlinestatic

Definition at line 94 of file txtsrv.c.

95{
96 return CONTAINING_RECORD(iface, ITextHostTestImpl, ITextHost_iface);
97}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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(), ITextHostImpl_TxViewChange(), test_notifications(), test_TxDraw(), and test_TxGetScroll().

◆ impl_from_IUnknown()

static struct unk_impl * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 888 of file txtsrv.c.

889{
890 return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface);
891}
Definition: api.c:544

◆ init_texthost()

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

Definition at line 604 of file txtsrv.c.

605{
606 ITextHostTestImpl *dummyTextHost;
607 IUnknown *init;
609 HFONT hf;
610
611 dummyTextHost = CoTaskMemAlloc(sizeof(*dummyTextHost));
612 if (dummyTextHost == NULL) {
613 win_skip("Insufficient memory to create ITextHost interface\n");
614 return FALSE;
615 }
616 dummyTextHost->ITextHost_iface.lpVtbl = &itextHostVtbl;
617 dummyTextHost->refCount = 1;
618 dummyTextHost->window = NULL;
619 SetRectEmpty( &dummyTextHost->client_rect );
620 memset(&dummyTextHost->char_format, 0, sizeof(dummyTextHost->char_format));
621 dummyTextHost->char_format.cbSize = sizeof(dummyTextHost->char_format);
622 dummyTextHost->char_format.dwMask = CFM_ALL2;
623 dummyTextHost->scrollbars = 0;
624 dummyTextHost->props = 0;
626 hf_to_cf(hf, &dummyTextHost->char_format);
627
628 /* MSDN states that an IUnknown object is returned by
629 CreateTextServices which is then queried to obtain a
630 ITextServices object. */
631 result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
632 ok(result == S_OK, "Did not return S_OK when created (result = %x)\n", result);
633 ok(dummyTextHost->refCount == 1, "host ref %d\n", dummyTextHost->refCount);
634 if (result != S_OK) {
635 CoTaskMemFree(dummyTextHost);
636 win_skip("CreateTextServices failed.\n");
637 return FALSE;
638 }
639
640 result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
641 ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %x, txtserv = %p)\n", result, *txtserv);
642 IUnknown_Release(init);
643 if (!((result == S_OK) && (*txtserv != NULL))) {
644 CoTaskMemFree(dummyTextHost);
645 win_skip("Could not retrieve ITextServices interface\n");
646 return FALSE;
647 }
648
649 *ret = &dummyTextHost->ITextHost_iface;
650 return TRUE;
651}
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint64EXT * result
Definition: glext.h:11304
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static IID * pIID_ITextServices
Definition: txtsrv.c:42
static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
Definition: txtsrv.c:585
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:45
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:446
#define CFM_ALL2
Definition: richedit.h:393
#define win_skip
Definition: test.h:164
#define memset(x, y, z)
Definition: compat.h:39
DWORD scrollbars
Definition: txtsrv.c:91
CHARFORMAT2W char_format
Definition: txtsrv.c:90
ITextHost ITextHost_iface
Definition: txtsrv.c:86
RECT client_rect
Definition: txtsrv.c:89
DWORD dwMask
Definition: richedit.h:306
int ret
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
static int init
Definition: wintirpc.c:33
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Referenced by START_TEST(), test_default_format(), test_notifications(), 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 119 of file txtsrv.c.

120{
122 ULONG refCount = InterlockedIncrement(&This->refCount);
123 return refCount;
124}
#define InterlockedIncrement
Definition: armddk.h:53
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:94
uint32_t ULONG
Definition: typedefs.h:59

◆ ITextHostImpl_OnTxCharFormatChange()

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

Definition at line 376 of file txtsrv.c.

377{
379 TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf);
380 return E_NOTIMPL;
381}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:79

◆ ITextHostImpl_OnTxParaFormatChange()

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

Definition at line 383 of file txtsrv.c.

384{
386 TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf);
387 return E_NOTIMPL;
388}

◆ ITextHostImpl_QueryInterface()

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

Definition at line 104 of file txtsrv.c.

107{
109
111 *ppvObject = &This->ITextHost_iface;
112 ITextHost_AddRef((ITextHost *)*ppvObject);
113 return S_OK;
114 }
115
116 return E_NOINTERFACE;
117}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
static IID * pIID_ITextHost
Definition: txtsrv.c:43
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ITextHostImpl_Release()

static ULONG WINAPI ITextHostImpl_Release ( ITextHost *  iface)
static

Definition at line 126 of file txtsrv.c.

127{
129 ULONG refCount = InterlockedDecrement(&This->refCount);
130
131 if (!refCount)
132 {
134 return 0;
135 } else {
136 return refCount;
137 }
138}
#define InterlockedDecrement
Definition: armddk.h:52

◆ ITextHostImpl_TxActivate()

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

Definition at line 282 of file txtsrv.c.

283{
285 TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState);
286 return E_NOTIMPL;
287}

◆ ITextHostImpl_TxClientToScreen()

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

Definition at line 275 of file txtsrv.c.

276{
278 TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt);
279 return FALSE;
280}

◆ ITextHostImpl_TxCreateCaret()

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

Definition at line 203 of file txtsrv.c.

204{
206 TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n",
207 This, hbmp, xWidth, yHeight);
208 return FALSE;
209}
HBITMAP hbmp

◆ ITextHostImpl_TxDeactivate()

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

Definition at line 289 of file txtsrv.c.

290{
292 TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState);
293 return E_NOTIMPL;
294}

◆ ITextHostImpl_TxEnableScrollBar()

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

Definition at line 164 of file txtsrv.c.

165{
167 TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n",
168 This, fuSBFlags, fuArrowflags);
169 return FALSE;
170}

◆ ITextHostImpl_TxGetAcceleratorPos()

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

Definition at line 362 of file txtsrv.c.

363{
365 TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch);
366 return E_NOTIMPL;
367}
#define pch(ap)
Definition: match.c:418

◆ ITextHostImpl_TxGetBackStyle()

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

Definition at line 333 of file txtsrv.c.

334{
336 TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle);
337 return E_NOTIMPL;
338}

◆ ITextHostImpl_TxGetCharFormat()

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

Definition at line 311 of file txtsrv.c.

312{
314 TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF);
315 *ppCF = (CHARFORMATW *)&This->char_format;
316 return S_OK;
317}

Referenced by test_default_format().

◆ ITextHostImpl_TxGetClientRect()

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

Definition at line 296 of file txtsrv.c.

297{
299 TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc);
300 *prc = This->client_rect;
301 return S_OK;
302}
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxGetDC()

static HDC __thiscall ITextHostImpl_TxGetDC ( ITextHost *  iface)
static

Definition at line 140 of file txtsrv.c.

141{
143 TRACECALL("Call to TxGetDC(%p)\n", This);
144 if (This->window) return GetDC( This->window );
145 return NULL;
146}

◆ ITextHostImpl_TxGetExtent()

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

Definition at line 369 of file txtsrv.c.

370{
372 TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent);
373 return E_NOTIMPL;
374}

◆ ITextHostImpl_TxGetMaxLength()

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

Definition at line 340 of file txtsrv.c.

341{
343 TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength);
344 return E_NOTIMPL;
345}

◆ ITextHostImpl_TxGetParaFormat()

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

Definition at line 319 of file txtsrv.c.

320{
322 TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF);
323 return E_NOTIMPL;
324}

◆ ITextHostImpl_TxGetPasswordChar()

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

Definition at line 355 of file txtsrv.c.

356{
358 TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch);
359 return E_NOTIMPL;
360}

◆ ITextHostImpl_TxGetPropertyBits()

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

Definition at line 392 of file txtsrv.c.

393{
395 TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n",
396 This, dwMask, pdwBits);
397 *pdwBits = This->props & dwMask;
398 return S_OK;
399}

◆ ITextHostImpl_TxGetScrollBars()

static HRESULT __thiscall ITextHostImpl_TxGetScrollBars ( ITextHost *  iface,
DWORD scrollbars 
)
static

Definition at line 347 of file txtsrv.c.

348{
350 TRACECALL("Call to TxGetScrollBars(%p, scrollbars=%p)\n", This, scrollbars);
351 *scrollbars = This->scrollbars;
352 return S_OK;
353}

◆ ITextHostImpl_TxGetSelectionBarWidth()

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

Definition at line 437 of file txtsrv.c.

438{
440 TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n",
441 This, lSelBarWidth);
442 *lSelBarWidth = 0;
443 return E_NOTIMPL;
444}

◆ ITextHostImpl_TxGetSysColor()

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

Definition at line 326 of file txtsrv.c.

327{
329 TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex);
330 return E_NOTIMPL;
331}

◆ ITextHostImpl_TxGetViewInset()

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

Definition at line 304 of file txtsrv.c.

305{
307 TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc);
308 return E_NOTIMPL;
309}

◆ ITextHostImpl_TxImmGetContext()

static HIMC __thiscall ITextHostImpl_TxImmGetContext ( ITextHost *  iface)
static

Definition at line 421 of file txtsrv.c.

422{
424 TRACECALL("Call to TxImmGetContext(%p)\n", This);
425 return 0;
426}

◆ ITextHostImpl_TxImmReleaseContext()

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

Definition at line 428 of file txtsrv.c.

429{
431 TRACECALL("Call to TxImmReleaseContext(%p, himc=%p)\n", This, himc);
432}

◆ ITextHostImpl_TxInvalidateRect()

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

Definition at line 189 of file txtsrv.c.

190{
192 TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n",
193 This, prc, fMode);
194}

◆ ITextHostImpl_TxKillTimer()

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

Definition at line 234 of file txtsrv.c.

235{
237 TRACECALL("Call to TxKillTimer(%p, idTimer=%u)\n", This, idTimer);
238}

◆ ITextHostImpl_TxNotify()

static HRESULT __thiscall ITextHostImpl_TxNotify ( ITextHost *  iface,
DWORD  code,
void data 
)
static

Definition at line 403 of file txtsrv.c.

404{
406 TRACECALL( "Call to TxNotify(%p, code = %#x, data = %p)\n", This, code, data );
407 switch (code)
408 {
409 case EN_VSCROLL:
411 ok( !data, "got %p\n", data );
412 break;
413 case EN_UPDATE:
415 ok( !data, "got %p\n", data );
416 break;
417 }
418 return S_OK;
419}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static int en_update_sent
Definition: txtsrv.c:402
static int en_vscroll_sent
Definition: txtsrv.c:401
Definition: inflate.c:139
#define EN_UPDATE
Definition: winuser.h:2039
#define EN_VSCROLL
Definition: winuser.h:2040

◆ ITextHostImpl_TxReleaseDC()

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

Definition at line 148 of file txtsrv.c.

149{
151 TRACECALL("Call to TxReleaseDC(%p)\n", This);
152 if (This->window) return ReleaseDC( This->window, hdc );
153 return 0;
154}
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

◆ ITextHostImpl_TxScreenToClient()

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

Definition at line 268 of file txtsrv.c.

269{
271 TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt);
272 return FALSE;
273}

◆ ITextHostImpl_TxScrollWindowEx()

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

Definition at line 240 of file txtsrv.c.

243{
245 TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n",
246 This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll);
247}
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

◆ ITextHostImpl_TxSetCapture()

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

Definition at line 249 of file txtsrv.c.

250{
252 TRACECALL("Call to TxSetCapture(%p, fCapture=%d)\n", This, fCapture);
253}

◆ ITextHostImpl_TxSetCaretPos()

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

Definition at line 219 of file txtsrv.c.

220{
222 TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y);
223 return FALSE;
224}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ITextHostImpl_TxSetCursor()

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

Definition at line 261 of file txtsrv.c.

262{
264 TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n",
265 This, hcur, fText);
266}

◆ ITextHostImpl_TxSetFocus()

static void __thiscall ITextHostImpl_TxSetFocus ( ITextHost *  iface)
static

Definition at line 255 of file txtsrv.c.

256{
258 TRACECALL("Call to TxSetFocus(%p)\n", This);
259}

◆ ITextHostImpl_TxSetScrollPos()

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

Definition at line 181 of file txtsrv.c.

182{
184 TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n",
185 This, fnBar, nPos, fRedraw);
186 return FALSE;
187}

◆ ITextHostImpl_TxSetScrollRange()

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

Definition at line 172 of file txtsrv.c.

174{
176 TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n",
177 This, fnBar, nMinPos, nMaxPos, fRedraw);
178 return FALSE;
179}

◆ ITextHostImpl_TxSetTimer()

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

Definition at line 226 of file txtsrv.c.

227{
229 TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n",
230 This, idTimer, uTimeout);
231 return FALSE;
232}

◆ ITextHostImpl_TxShowCaret()

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

Definition at line 211 of file txtsrv.c.

212{
214 TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n",
215 This, fShow);
216 return FALSE;
217}

◆ ITextHostImpl_TxShowScrollBar()

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

Definition at line 156 of file txtsrv.c.

157{
159 TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n",
160 This, fnBar, fShow);
161 return FALSE;
162}

◆ ITextHostImpl_TxViewChange()

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

Definition at line 196 of file txtsrv.c.

197{
199 TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n",
200 This, fUpdate);
201}

◆ setup_thiscall_wrappers()

static void setup_thiscall_wrappers ( void  )
static

Definition at line 517 of file txtsrv.c.

518{
519#if defined(__i386__) && !defined(__MINGW32__) && (!defined(_MSC_VER) || !defined(__clang__))
520 void** pVtable;
521 void** pVtableEnd;
524
526 (sizeof(ITextHostVtbl)/sizeof(void*) - 3)
528 +(sizeof(ITextServicesVtbl)/sizeof(void*) - 3)
532
533 /* Wrap all ITextHostImpl methods with code to perform a thiscall to
534 * stdcall conversion. The thiscall calling convention places the This
535 * pointer in ecx on the x86 platform, and the stdcall calling convention
536 * pushes the This pointer on the stack as the first argument.
537 *
538 * The byte code does the conversion then jumps to the real function.
539 *
540 * Each wrapper needs to be modified so that the function to jump to is
541 * modified in the byte code. */
542
543 /* Skip QueryInterface, AddRef, and Release native actually
544 * defined them with the stdcall calling convention. */
545 pVtable = (void**)&itextHostVtbl + 3;
546 pVtableEnd = (void**)(&itextHostVtbl + 1);
547 while (pVtable != pVtableEnd) {
548 /* write byte code to executable memory */
549 thunk->pop_eax = 0x58; /* popl %eax */
550 thunk->push_ecx = 0x51; /* pushl %ecx */
551 thunk->push_eax = 0x50; /* pushl %eax */
552 thunk->jmp_func = 0xe9; /* jmp $func */
553 /* The address needs to be relative to the end of the jump instructions. */
554 thunk->func = (char*)*pVtable - (char*)(&thunk->func + 1);
555 *pVtable = thunk;
556 pVtable++;
557 thunk++;
558 }
559
560 /* Setup an ITextServices standard call vtable that will call the
561 * native thiscall vtable when the methods are called. */
562
563 /* QueryInterface, AddRef, and Release should be called directly on the
564 * real vtable since they use the stdcall calling convention. */
566 pVtable = (void**)&itextServicesStdcallVtbl + 3;
567 pVtableEnd = (void**)(&itextServicesStdcallVtbl + 1);
568 while (pVtable != pVtableEnd) {
569 /* write byte code to executable memory */
570 thunk2->pop_eax = 0x58; /* popl %eax */
571 thunk2->pop_ecx = 0x59; /* popl %ecx */
572 thunk2->push_eax = 0x50; /* pushl %eax */
573 thunk2->mov_vtable_eax[0] = 0x8b; /* movl (%ecx), %eax */
574 thunk2->mov_vtable_eax[1] = 0x01;
575 thunk2->jmp_eax[0] = 0xff; /* jmp *$vtablefunc_offset(%eax) */
576 thunk2->jmp_eax[1] = 0xa0;
577 thunk2->vtablefunc_offset = (char*)pVtable - (char*)&itextServicesStdcallVtbl;
578 *pVtable = thunk2;
579 pVtable++;
580 thunk2++;
581 }
582#endif /* __i386__ */
583}
static void * wrapperCodeMem
Definition: txtsrv.c:491
#define MEM_COMMIT
Definition: nt_native.h:1313
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
Definition: cproxy.c:248
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( txtsrv  )

Definition at line 1220 of file txtsrv.c.

1221{
1222 ITextServices *txtserv;
1223 ITextHost *host;
1224
1226
1227 /* Must explicitly LoadLibrary(). The test has no references to functions in
1228 * RICHED20.DLL, so the linker doesn't actually link to it. */
1229 hmoduleRichEdit = LoadLibraryA("riched20.dll");
1230 ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
1231
1232 pIID_ITextServices = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextServices");
1233 pIID_ITextHost = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost");
1234 pIID_ITextHost2 = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost2");
1235 pCreateTextServices = (void*)GetProcAddress(hmoduleRichEdit, "CreateTextServices");
1236
1237 test_IIDs();
1238 test_COM();
1239
1240 if (init_texthost(&txtserv, &host))
1241 {
1242 ITextServices_Release(txtserv);
1243 ITextHost_Release(host);
1244
1248 test_TxDraw();
1253 }
1255}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void test_TxGetNaturalSize(void)
Definition: txtsrv.c:766
static void test_notifications(void)
Definition: txtsrv.c:1164
static HMODULE hmoduleRichEdit
Definition: txtsrv.c:41
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:604
static void test_TxSetText(void)
Definition: txtsrv.c:710
static void setup_thiscall_wrappers(void)
Definition: txtsrv.c:517
static void test_QueryInterface(void)
Definition: txtsrv.c:951
static void test_TxGetText(void)
Definition: txtsrv.c:670
static void test_TxDraw(void)
Definition: txtsrv.c:815
static void test_TxGetScroll(void)
Definition: txtsrv.c:1087
static void test_default_format(void)
Definition: txtsrv.c:1057
static IID * pIID_ITextHost2
Definition: txtsrv.c:44
static void test_IIDs(void)
Definition: txtsrv.c:871
static void test_COM(void)
Definition: txtsrv.c:921
#define MEM_RELEASE
Definition: nt_native.h:1316
Definition: txthost.c:37
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ test_COM()

static void test_COM ( void  )
static

Definition at line 921 of file txtsrv.c.

922{
923 struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL};
924 struct ITextHostTestImpl texthost = {{&itextHostVtbl}, 1};
925 ITextServices *textsrv;
926 ULONG refcount;
927 HRESULT hr;
928
929 /* COM aggregation */
931 &unk_obj.inner_unk);
932 ok(hr == S_OK, "CreateTextServices failed: %08x\n", hr);
933 hr = IUnknown_QueryInterface(unk_obj.inner_unk, pIID_ITextServices, (void**)&textsrv);
934 ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08x\n", hr);
935 refcount = ITextServices_AddRef(textsrv);
936 ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
937 refcount = ITextServices_Release(textsrv);
938 ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
939 refcount = ITextServices_Release(textsrv);
940 ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
941
942 IUnknown_Release(unk_obj.inner_unk);
943}
static const IUnknownVtbl unk_vtbl
Definition: txtsrv.c:914
HRESULT hr
Definition: shlfolder.c:183
IUnknown IUnknown_iface
Definition: api.c:545
IUnknown * inner_unk
Definition: api.c:547
LONG ref
Definition: api.c:546

Referenced by START_TEST().

◆ test_default_format()

static void test_default_format ( void  )
static

Definition at line 1057 of file txtsrv.c.

1058{
1059 ITextServices *txtserv;
1060 ITextHost *host;
1062 LRESULT lresult;
1063 CHARFORMAT2W cf2;
1064 const CHARFORMATW *host_cf;
1065 DWORD expected_effects;
1066
1067 if (!init_texthost(&txtserv, &host))
1068 return;
1069
1070 cf2.cbSize = sizeof(CHARFORMAT2W);
1072 ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
1073
1075 ok(!lstrcmpW(host_cf->szFaceName, cf2.szFaceName), "got wrong font name: %s.\n", wine_dbgstr_w(cf2.szFaceName));
1076 ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %d, expected %d.\n", cf2.yHeight, host_cf->yHeight);
1077 expected_effects = (cf2.dwEffects & ~(CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR));
1078 ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %x, expected %x.\n", cf2.dwEffects, expected_effects);
1079 ok(cf2.bPitchAndFamily == host_cf->bPitchAndFamily, "got wrong bPitchAndFamily: %x, expected %x.\n",
1080 cf2.bPitchAndFamily, host_cf->bPitchAndFamily);
1081 ok(cf2.bCharSet == host_cf->bCharSet, "got wrong bCharSet: %x, expected %x.\n", cf2.bCharSet, host_cf->bCharSet);
1082
1083 ITextServices_Release(txtserv);
1084 ITextHost_Release(host);
1085}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wine_dbgstr_w
Definition: kernel32.h:34
#define ITextServices_TxSendMessage(This, a, b, c, d)
Definition: txtsrv.c:58
static HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
Definition: txtsrv.c:311
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define SCF_DEFAULT
Definition: richedit.h:234
#define EM_GETCHARFORMAT
Definition: richedit.h:91
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
struct _charformat2w CHARFORMAT2W
BYTE bCharSet
Definition: richedit.h:311
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:313
DWORD dwEffects
Definition: richedit.h:307
LONG yHeight
Definition: richedit.h:308
BYTE bPitchAndFamily
Definition: richedit.h:312
LONG yHeight
Definition: richedit.h:271
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:276
DWORD dwEffects
Definition: richedit.h:270
BYTE bCharSet
Definition: richedit.h:274
BYTE bPitchAndFamily
Definition: richedit.h:275
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by START_TEST().

◆ test_IIDs()

static void test_IIDs ( void  )
static

Definition at line 871 of file txtsrv.c.

872{
873 ok(IsEqualIID(pIID_ITextServices, &expected_iid_itextservices),
874 "unexpected value for IID_ITextServices: %s\n", wine_dbgstr_guid(pIID_ITextServices));
875 ok(IsEqualIID(pIID_ITextHost, &expected_iid_itexthost),
876 "unexpected value for IID_ITextHost: %s\n", wine_dbgstr_guid(pIID_ITextHost));
877 ok(IsEqualIID(pIID_ITextHost2, &expected_iid_itexthost2),
878 "unexpected value for IID_ITextHost2: %s\n", wine_dbgstr_guid(pIID_ITextHost2));
879}
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197

Referenced by START_TEST().

◆ test_notifications()

static void test_notifications ( void  )
static

Definition at line 1164 of file txtsrv.c.

1165{
1166 ITextServices *txtserv;
1167 ITextHost *host;
1168 LRESULT res;
1169 HRESULT hr;
1170 RECT client = { 0, 0, 100, 100 };
1171 ITextHostTestImpl *host_impl;
1172
1173 init_texthost( &txtserv, &host );
1174 host_impl = impl_from_ITextHost( host );
1175
1176 host_impl->scrollbars = WS_VSCROLL;
1179
1180 ITextServices_TxSetText( txtserv, lorem );
1181
1182 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
1183 0, 0, 400, 400, 0, 0, 0, NULL );
1184 host_impl->client_rect = client;
1186 ok( hr == S_OK, "got 0x%08x.\n", hr );
1187
1189 ok( hr == S_OK, "got %08x\n", hr );
1190
1191 /* check EN_VSCROLL notification is sent */
1192 en_vscroll_sent = 0;
1194 ok( hr == S_OK, "got %08x\n", hr );
1195 ok( en_vscroll_sent == 1, "got %d\n", en_vscroll_sent );
1196
1198 ok( hr == S_OK, "got %08x\n", hr );
1199 ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
1200
1201 /* but not when the thumb is moved */
1203 ok( hr == S_OK, "got %08x\n", hr );
1205 ok( hr == S_OK, "got %08x\n", hr );
1206 ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
1207
1208 /* EN_UPDATE is sent by TxDraw() */
1209 en_update_sent = 0;
1210 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
1211 NULL, NULL, 0, TXTVIEW_ACTIVE );
1212 ok( hr == S_OK, "got %08x\n", hr );
1213 ok( en_update_sent == 1, "got %d\n", en_update_sent );
1214
1215 DestroyWindow( host_impl->window );
1216 ITextServices_Release( txtserv );
1217 ITextHost_Release( host );
1218}
#define ITextServices_TxSetText(This, a)
Definition: txtsrv.c:69
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)
Definition: txtsrv.c:59
static const WCHAR lorem[]
Definition: txtsrv.c:99
#define ITextServices_OnTxInPlaceActivate(This, a)
Definition: txtsrv.c:64
#define ITextServices_OnTxPropertyBitsChange(This, a, b)
Definition: txtsrv.c:74
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define ENM_SCROLL
Definition: richedit.h:470
#define EM_SETEVENTMASK
Definition: richedit.h:102
static FILE * client
Definition: client.c:41
#define TXTBIT_WORDWRAP
Definition: textserv.h:195
#define TXTBIT_MULTILINE
Definition: textserv.h:186
#define TXTBIT_SCROLLBARCHANGE
Definition: textserv.h:201
#define TXTBIT_RICHTEXT
Definition: textserv.h:185
@ TXTVIEW_ACTIVE
Definition: textserv.h:181
#define MAKEWPARAM(l, h)
Definition: winuser.h:4020
#define SB_THUMBTRACK
Definition: winuser.h:573
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)
#define WM_VSCROLL
Definition: winuser.h:1755
#define SB_BOTTOM
Definition: winuser.h:577
#define SB_LINEDOWN
Definition: winuser.h:565
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by START_TEST().

◆ test_QueryInterface()

static void test_QueryInterface ( void  )
static

Definition at line 951 of file txtsrv.c.

952{
953 ITextServices *txtserv;
954 ITextHost *host;
956 IRichEditOle *reole, *txtsrv_reole;
957 ITextDocument *txtdoc, *txtsrv_txtdoc;
958 ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
959 IUnknown *unk, *unk2;
960 ULONG refcount;
961
962 if(!init_texthost(&txtserv, &host))
963 return;
964
965 refcount = get_refcount((IUnknown *)txtserv);
966 ok(refcount == 1, "got wrong ref count: %d\n", refcount);
967
968 /* IID_IRichEditOle */
969 hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
970 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
971 refcount = get_refcount((IUnknown *)txtserv);
972 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
973 refcount = get_refcount((IUnknown *)txtsrv_reole);
974 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
975
976 hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
977 ok( hres == S_OK, "got 0x%08x\n", hres );
978 hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
979 ok( hres == S_OK, "got 0x%08x\n", hres );
980 ok( unk == unk2, "unknowns differ\n" );
981 IUnknown_Release( unk2 );
982 IUnknown_Release( unk );
983
984 hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
985 ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
986 refcount = get_refcount((IUnknown *)txtserv);
987 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
988 refcount = get_refcount((IUnknown *)txtsrv_reole);
989 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
990
991 ITextDocument_Release(txtdoc);
992 refcount = get_refcount((IUnknown *)txtserv);
993 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
994
995 hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
996 ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
997 refcount = get_refcount((IUnknown *)txtserv);
998 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
999 refcount = get_refcount((IUnknown *)txtsrv_reole);
1000 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
1001
1002 ITextDocument2Old_Release(txtdoc2old);
1003 refcount = get_refcount((IUnknown *)txtserv);
1004 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1005 IRichEditOle_Release(txtsrv_reole);
1006 refcount = get_refcount((IUnknown *)txtserv);
1007 ok(refcount == 1, "got wrong ref count: %d\n", refcount);
1008
1009 /* IID_ITextDocument */
1010 hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
1011 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
1012 refcount = get_refcount((IUnknown *)txtserv);
1013 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1014 refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
1015 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1016
1017 hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
1018 ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08x\n", hres);
1019 refcount = get_refcount((IUnknown *)txtserv);
1020 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
1021 refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
1022 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
1023
1024 IRichEditOle_Release(reole);
1025 refcount = get_refcount((IUnknown *)txtserv);
1026 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1027 ITextDocument_Release(txtsrv_txtdoc);
1028 refcount = get_refcount((IUnknown *)txtserv);
1029 ok(refcount == 1, "got wrong ref count: %d\n", refcount);
1030
1031 /* ITextDocument2Old */
1032 hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
1033 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
1034 refcount = get_refcount((IUnknown *)txtserv);
1035 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1036 refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
1037 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1038
1039 hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
1040 ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08x\n", hres);
1041 refcount = get_refcount((IUnknown *)txtserv);
1042 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
1043 refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
1044 ok(refcount == 3, "got wrong ref count: %d\n", refcount);
1045
1046 IRichEditOle_Release(reole);
1047 refcount = get_refcount((IUnknown *)txtserv);
1048 ok(refcount == 2, "got wrong ref count: %d\n", refcount);
1049 ITextDocument2Old_Release(txtsrv_txtdoc2old);
1050 refcount = get_refcount((IUnknown *)txtserv);
1051 ok(refcount == 1, "got wrong ref count: %d\n", refcount);
1052
1053 ITextServices_Release(txtserv);
1054 ITextHost_Release(host);
1055}
HRESULT hres
Definition: protocol.c:465
static ULONG get_refcount(IUnknown *iface)
Definition: txtsrv.c:945

Referenced by START_TEST().

◆ test_TxDraw()

static void test_TxDraw ( void  )
static

Definition at line 815 of file txtsrv.c.

816{
817 ITextServices *txtserv;
818 ITextHost *host;
819 HRESULT hr;
820 RECT client = {0, 0, 100, 100};
821 ITextHostTestImpl *host_impl;
822 HDC hdc;
823
824 if (!init_texthost(&txtserv, &host))
825 return;
826
827 host_impl = impl_from_ITextHost( host );
828 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
829 0, 0, 400, 400, 0, 0, 0, NULL );
830 host_impl->client_rect = client;
833 host_impl->props );
834 hdc = GetDC( host_impl->window );
835
836 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
838 ok( hr == E_INVALIDARG, "got %08x\n", hr );
839 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
841 ok( hr == E_INVALIDARG, "got %08x\n", hr );
842 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, (RECTL *)&client, NULL,
844 ok( hr == E_FAIL, "got %08x\n", hr );
845 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
847 ok( hr == S_OK, "got %08x\n", hr );
848 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
849 NULL, NULL, 0, TXTVIEW_ACTIVE );
850 ok( hr == S_OK, "got %08x\n", hr );
851
853 ok( hr == S_OK, "got %08x\n", hr );
854
855 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
857 ok( hr == S_OK, "got %08x\n", hr );
858
860
861 ReleaseDC( host_impl->window, hdc );
862 ITextServices_Release(txtserv);
863 DestroyWindow( host_impl->window );
864 ITextHost_Release(host);
865}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
static HDC
Definition: imagelist.c:88
#define ITextServices_OnTxInPlaceDeactivate(This)
Definition: txtsrv.c:65
#define TXTBIT_CLIENTRECTCHANGE
Definition: textserv.h:205
@ TXTVIEW_INACTIVE
Definition: textserv.h:182

Referenced by START_TEST().

◆ test_TxGetNaturalSize()

static void test_TxGetNaturalSize ( void  )
static

Definition at line 766 of file txtsrv.c.

767{
768 ITextServices *txtserv;
769 ITextHost *host;
772 static const WCHAR test_text[] = L"TestSomeText";
774 HDC hdcDraw;
775 HWND hwnd;
776 RECT rect;
778 LRESULT lresult;
779 HFONT hf;
780
781 if (!init_texthost(&txtserv, &host))
782 return;
783
784 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
785 0, 0, 100, 100, 0, 0, 0, NULL);
786 hdcDraw = GetDC(hwnd);
787 SetMapMode(hdcDraw,MM_TEXT);
789
790 memset(&cf, 0, sizeof(cf));
791 cf.cbSize = sizeof(cf);
792 cf.dwMask = CFM_ALL2;
794 hf_to_cf(hf, &cf);
796 ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
797 SelectObject(hdcDraw, hf);
798
799 result = ITextServices_TxSetText(txtserv, test_text);
800 ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08x.\n", result);
801
802 extent.cx = -1; extent.cy = -1;
803 width = rect.right - rect.left;
804 height = 0;
805 result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL,
807 CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
808
809 ReleaseDC(hwnd, hdcDraw);
811 ITextServices_Release(txtserv);
812 ITextHost_Release(host);
813}
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)
Definition: txtsrv.c:749
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)
Definition: txtsrv.c:72
#define L(x)
Definition: ntvdm.h:50
#define EM_SETCHARFORMAT
Definition: richedit.h:101
@ TXTNS_FITTOCONTENT
Definition: textserv.h:176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI SetMapMode(_In_ HDC, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define MM_TEXT
Definition: wingdi.h:873
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_TxGetScroll()

static void test_TxGetScroll ( void  )
static

Definition at line 1087 of file txtsrv.c.

1088{
1089 ITextServices *txtserv;
1090 ITextHost *host;
1091 HRESULT ret;
1092 LONG min_pos, max_pos, pos, page;
1093 BOOL enabled;
1094 ITextHostTestImpl *host_impl;
1095 RECT client = {0, 0, 100, 100};
1096
1097 if (!init_texthost(&txtserv, &host))
1098 return;
1099
1100 host_impl = impl_from_ITextHost( host );
1101
1103 ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret);
1104
1106 ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08x.\n", ret);
1107
1108 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1109 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
1110 ok( min_pos == 0, "got %d\n", min_pos );
1111 ok( max_pos == 0, "got %d\n", max_pos );
1112 ok( pos == 0, "got %d\n", pos );
1113 ok( page == 0, "got %d\n", page );
1114 ok( !enabled, "got %d\n", enabled );
1115
1116 host_impl->scrollbars = WS_VSCROLL;
1119
1120 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
1121 0, 0, 400, 400, 0, 0, 0, NULL );
1122 host_impl->client_rect = client;
1124 ok( ret == S_OK, "got 0x%08x.\n", ret );
1125
1126 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1127 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
1128 ok( min_pos == 0, "got %d\n", min_pos );
1130 ok( max_pos == 0, "got %d\n", max_pos );
1131 ok( pos == 0, "got %d\n", pos );
1132 ok( page == client.bottom, "got %d\n", page );
1133 ok( !enabled, "got %d\n", enabled );
1134
1135 ret = ITextServices_TxSetText( txtserv, lorem );
1136 ok( ret == S_OK, "got 0x%08x.\n", ret );
1137
1138 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1139 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
1140 ok( min_pos == 0, "got %d\n", min_pos );
1141 ok( max_pos > client.bottom, "got %d\n", max_pos );
1142 ok( pos == 0, "got %d\n", pos );
1143 ok( page == client.bottom, "got %d\n", page );
1144 ok( enabled, "got %d\n", enabled );
1145
1148 ITextServices_TxSetText( txtserv, L"short" );
1149
1150 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1151 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
1152 ok( min_pos == 0, "got %d\n", min_pos );
1154 ok( max_pos == 0, "got %d\n", max_pos );
1155 ok( pos == 0, "got %d\n", pos );
1156 ok( page == client.bottom, "got %d\n", page );
1157 ok( !enabled, "got %d\n", enabled );
1158
1159 DestroyWindow( host_impl->window );
1160 ITextServices_Release(txtserv);
1161 ITextHost_Release(host);
1162}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#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
#define ES_DISABLENOSCROLL
Definition: richedit.h:224
Definition: module.h:576

Referenced by START_TEST().

◆ test_TxGetText()

static void test_TxGetText ( void  )
static

Definition at line 670 of file txtsrv.c.

671{
672 const WCHAR *expected_string;
673 IOleClientSite *clientsite;
674 ITextServices *txtserv;
675 IRichEditOle *reole;
676 REOBJECT reobject;
677 ITextHost *host;
679 BSTR rettext;
680
681 if (!init_texthost(&txtserv, &host))
682 return;
683
684 hres = ITextServices_TxGetText(txtserv, &rettext);
685 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
686 SysFreeString(rettext);
687
688 hres = ITextServices_TxSetText(txtserv, L"abcdefg");
689 ok(hres == S_OK, "Got hres: %#x.\n", hres);
690 hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&reole);
691 ok(hres == S_OK, "Got hres: %#x.\n", hres);
692 hres = IRichEditOle_GetClientSite(reole, &clientsite);
693 ok(hres == S_OK, "Got hres: %#x.\n", hres);
694 expected_string = L"abc\xfffc""defg";
695 fill_reobject_struct(&reobject, 3, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 1);
696 hres = IRichEditOle_InsertObject(reole, &reobject);
697 ok(hres == S_OK, "Got hres: %#x.\n", hres);
698 hres = ITextServices_TxGetText(txtserv, &rettext);
699 ok(hres == S_OK, "Got hres: %#x.\n", hres);
700 ok(lstrlenW(rettext) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(rettext));
701 todo_wine ok(!lstrcmpW(rettext, expected_string), "Got wrong content: %s.\n", debugstr_w(rettext));
702 SysFreeString(rettext);
703 IOleClientSite_Release(clientsite);
704 IRichEditOle_Release(reole);
705
706 ITextServices_Release(txtserv);
707 ITextHost_Release(host);
708}
OLECHAR * BSTR
Definition: compat.h:2293
#define lstrlenW
Definition: compat.h:750
#define debugstr_w
Definition: kernel32.h:32
static void fill_reobject_struct(REOBJECT *reobj, LONG cp, LPOLEOBJECT poleobj, LPSTORAGE pstg, LPOLECLIENTSITE polesite, LONG sizel_cx, LONG sizel_cy, DWORD aspect, DWORD flags, DWORD user)
Definition: txtsrv.c:653
#define ITextServices_TxGetText(This, a)
Definition: txtsrv.c:68
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 710 of file txtsrv.c.

711{
712 ITextServices *txtserv;
713 ITextHost *host;
715 BSTR rettext;
716 WCHAR settext[] = {'T','e','s','t',0};
717
718 if (!init_texthost(&txtserv, &host))
719 return;
720
721 hres = ITextServices_TxSetText(txtserv, settext);
722 ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
723
724 hres = ITextServices_TxGetText(txtserv, &rettext);
725 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
726
727 ok(SysStringLen(rettext) == 4,
728 "String returned of wrong length (expected 4, got %d)\n", SysStringLen(rettext));
729 ok(memcmp(rettext,settext,SysStringByteLen(rettext)) == 0,
730 "String returned differs\n");
731
732 SysFreeString(rettext);
733
734 /* Null-pointer should behave the same as empty-string */
735
736 hres = ITextServices_TxSetText(txtserv, 0);
737 ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
738
739 hres = ITextServices_TxGetText(txtserv, &rettext);
740 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
741 ok(SysStringLen(rettext) == 0,
742 "String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
743
744 SysFreeString(rettext);
745 ITextServices_Release(txtserv);
746 ITextHost_Release(host);
747}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196

Referenced by START_TEST().

◆ unk_AddRef()

static ULONG WINAPI unk_AddRef ( IUnknown iface)
static

Definition at line 900 of file txtsrv.c.

901{
902 struct unk_impl *This = impl_from_IUnknown(iface);
903
904 return InterlockedIncrement(&This->ref);
905}
static struct text_services * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:36

◆ unk_QueryInterface()

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

Definition at line 893 of file txtsrv.c.

894{
895 struct unk_impl *This = impl_from_IUnknown(iface);
896
897 return IUnknown_QueryInterface(This->inner_unk, riid, ppv);
898}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ unk_Release()

static ULONG WINAPI unk_Release ( IUnknown iface)
static

Definition at line 907 of file txtsrv.c.

908{
909 struct unk_impl *This = impl_from_IUnknown(iface);
910
911 return InterlockedDecrement(&This->ref);
912}

Variable Documentation

◆ en_update_sent

int en_update_sent
static

Definition at line 402 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_notifications().

◆ en_vscroll_sent

int en_vscroll_sent
static

Definition at line 401 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_notifications().

◆ hmoduleRichEdit

HMODULE hmoduleRichEdit
static

Definition at line 41 of file txtsrv.c.

Referenced by START_TEST().

◆ itextHostVtbl

ITextHostVtbl itextHostVtbl
static

Definition at line 446 of file txtsrv.c.

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

◆ lorem

const WCHAR lorem[]
static
Initial value:
= L"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

Definition at line 99 of file txtsrv.c.

Referenced by test_notifications(), and test_TxGetScroll().

◆ 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 disable_beep(), init_texthost(), START_TEST(), test_COM(), and test_IIDs().

◆ unk_vtbl

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

Definition at line 914 of file txtsrv.c.

Referenced by test_COM().

◆ wrapperCodeMem

void* wrapperCodeMem = NULL
static

Definition at line 491 of file txtsrv.c.

Referenced by setup_thiscall_wrappers(), and START_TEST().