Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2021
- 75 participants
- 800 discussions
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/tests/editor.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 8ef88bd1b21..3a6a072f1f8 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -33,6 +33,8 @@
#include <ole2.h>
#include <richedit.h>
#include <richole.h>
+#include <imm.h>
+#include <textserv.h>
#include <commdlg.h>
#include <time.h>
#include <wine/test.h>
@@ -51,12 +53,38 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH], string3[MAX_PATH];
static HMODULE hmoduleRichEdit;
static BOOL is_lang_japanese;
+#if defined(__i386__) && !defined(__MINGW32__) && (!defined(_MSC_VER) || !defined(__clang__))
+static void disable_beep( HWND hwnd )
+{
+ /* don't attempt to disable beep if we don't have thiscall compiler support */
+}
+#else
+#define ITextServices_OnTxPropertyBitsChange(This,a,b) (This)->lpVtbl->OnTxPropertyBitsChange(This,a,b)
+static void disable_beep( HWND hwnd )
+{
+ IRichEditOle *richole;
+ ITextServices *services;
+ IID *pIID_ITextServices = (IID *)GetProcAddress( hmoduleRichEdit, "IID_ITextServices" );
+
+ if (SendMessageW( hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&richole ))
+ {
+ if (SUCCEEDED( IRichEditOle_QueryInterface( richole, pIID_ITextServices, (void **)&services ) ))
+ {
+ ITextServices_OnTxPropertyBitsChange( services, TXTBIT_ALLOWBEEP, 0 );
+ ITextServices_Release( services );
+ }
+ IRichEditOle_Release( richole );
+ }
+}
+#endif
+
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent) {
HWND hwnd;
hwnd = CreateWindowA(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL
|WS_VISIBLE, 0, 0, 200, 60, parent, NULL,
hmoduleRichEdit, NULL);
ok(hwnd != NULL, "class: %s, error: %d\n", lpClassName, (int) GetLastError());
+ disable_beep( hwnd );
return hwnd;
}
@@ -66,6 +94,7 @@ static HWND new_windowW(LPCWSTR lpClassName, DWORD dwStyle, HWND parent) {
|WS_VISIBLE, 0, 0, 200, 60, parent, NULL,
hmoduleRichEdit, NULL);
ok(hwnd != NULL, "class: %s, error: %d\n", wine_dbgstr_w(lpClassName), (int) GetLastError());
+ disable_beep( hwnd );
return hwnd;
}
@@ -1862,6 +1891,7 @@ static void test_EM_SETOPTIONS(void)
hmoduleRichEdit, NULL);
ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
RICHEDIT_CLASS20A, (int) GetLastError());
+ disable_beep( hwndRichEdit );
options = SendMessageA(hwndRichEdit, EM_GETOPTIONS, 0, 0);
/* WS_[VH]SCROLL cause the ECO_AUTO[VH]SCROLL options to be set */
ok(options == (ECO_AUTOVSCROLL|ECO_AUTOHSCROLL),
@@ -6337,6 +6367,7 @@ static void test_WM_CHAR(void)
hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+ disable_beep( hwnd );
p = char_list;
while (*p != '\0') {
@@ -6940,6 +6971,7 @@ static void test_undo_coalescing(void)
hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+ disable_beep( hwnd );
result = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
ok (result == FALSE, "Can undo after window creation.\n");
--
2.23.0
1
0
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/tests/richole.c | 9 +++++++++
dlls/riched20/tests/txtsrv.c | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 3cea9902620..e6329c5b1b6 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -149,6 +149,7 @@ static void test_Interfaces(void)
LRESULT res;
HWND w;
ULONG refcount;
+ IUnknown *unk, *unk2;
w = new_richedit(NULL);
if (!w) {
@@ -180,6 +181,14 @@ static void test_Interfaces(void)
hres = ITextDocument_GetSelection(txtDoc, &txtSel);
ok(hres == S_OK, "got 0x%08x\n", hres);
+ hres = ITextDocument_QueryInterface(txtDoc, &IID_IUnknown, (void **)&unk);
+ ok(hres == S_OK, "got 0x%08x\n", hres);
+ hres = ITextSelection_QueryInterface(txtSel, &IID_IUnknown, (void **)&unk2);
+ ok(hres == S_OK, "got 0x%08x\n", hres);
+ ok(unk != unk2, "unknowns are the same\n");
+ IUnknown_Release(unk2);
+ IUnknown_Release(unk);
+
EXPECT_REF(txtDoc, 4);
EXPECT_REF(txtSel, 2);
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index 6834e38b7f5..fe27be26edb 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -917,6 +917,7 @@ static void test_QueryInterface(void)
IRichEditOle *reole, *txtsrv_reole;
ITextDocument *txtdoc, *txtsrv_txtdoc;
ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
+ IUnknown *unk, *unk2;
ULONG refcount;
if(!init_texthost(&txtserv, &host))
@@ -933,6 +934,14 @@ static void test_QueryInterface(void)
refcount = get_refcount((IUnknown *)txtsrv_reole);
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
+ ok( hres == S_OK, "got 0x%08x\n", hres );
+ hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
+ ok( hres == S_OK, "got 0x%08x\n", hres );
+ ok( unk == unk2, "unknowns differ\n" );
+ IUnknown_Release( unk2 );
+ IUnknown_Release( unk );
+
hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
refcount = get_refcount((IUnknown *)txtserv);
--
2.23.0
1
0
[PATCH 2/4] riched20: Merge the richole object with the text services object.
by Huw Davies 31 Mar '21
by Huw Davies 31 Mar '21
31 Mar '21
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.c | 31 +-
dlls/riched20/editor.h | 4 +-
dlls/riched20/editstr.h | 26 +-
dlls/riched20/richole.c | 897 ++++++++++++++++++----------------------
dlls/riched20/txtsrv.c | 29 +-
5 files changed, 444 insertions(+), 543 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index deb0a93c8dc..d4aadc325f9 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1121,7 +1121,6 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
LPOLECLIENTSITE lpClientSite = NULL;
LPDATAOBJECT lpDataObject = NULL;
LPOLECACHE lpOleCache = NULL;
- LPRICHEDITOLE lpReOle = NULL;
STGMEDIUM stgm;
FORMATETC fm;
CLSID clsid;
@@ -1149,15 +1148,8 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
fm.lindex = -1;
fm.tymed = stgm.tymed;
- if (!editor->reOle)
- {
- if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
- return hr;
- }
-
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, (void**)&lpObject) == S_OK &&
- IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (void**)&lpReOle) == S_OK &&
- IRichEditOle_GetClientSite(lpReOle, &lpClientSite) == S_OK &&
+ IRichEditOle_GetClientSite(editor->richole, &lpClientSite) == S_OK &&
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
IOleObject_GetUserClassID(lpObject, &clsid) == S_OK &&
IOleObject_QueryInterface(lpObject, &IID_IOleCache, (void**)&lpOleCache) == S_OK &&
@@ -1189,7 +1181,6 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
if (lpStorage) IStorage_Release(lpStorage);
if (lpDataObject) IDataObject_Release(lpDataObject);
if (lpOleCache) IOleCache_Release(lpOleCache);
- if (lpReOle) IRichEditOle_Release(lpReOle);
return hr;
}
@@ -2950,7 +2941,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->have_texthost2 = FALSE;
}
- ed->reOle = NULL;
ed->bEmulateVersion10 = bEmulateVersion10;
ed->in_place_active = FALSE;
ed->total_rows = 0;
@@ -2993,6 +2983,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->last_sel_start_para = ed->last_sel_end_para = ed->pCursors[0].para;
ed->bHideSelection = FALSE;
ed->pfnWordBreak = NULL;
+ ed->richole = NULL;
ed->lpOleCallback = NULL;
ed->mode = TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
@@ -3094,11 +3085,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
}
if(editor->lpOleCallback)
IRichEditOleCallback_Release(editor->lpOleCallback);
- if (editor->reOle)
- {
- IUnknown_Release(editor->reOle);
- editor->reOle = NULL;
- }
+
OleUninitialize();
heap_free(editor->pBuffer);
@@ -4159,14 +4146,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
return 0;
}
case EM_GETOLEINTERFACE:
- {
- if (!editor->reOle)
- if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
- return 0;
- if (IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (LPVOID *)lParam) == S_OK)
- return 1;
- return 0;
- }
+ IRichEditOle_AddRef( editor->richole );
+ *(IRichEditOle **)lParam = editor->richole;
+ return 1;
+
case EM_SETOLECALLBACK:
if(editor->lpOleCallback)
IRichEditOleCallback_Release(editor->lpOleCallback);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index d0274de409d..141e9034a6a 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -263,11 +263,13 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN;
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
/* richole.c */
-LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN;
void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN;
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
+void richole_release_children( struct text_services *services ) DECLSPEC_HIDDEN;
+extern const IRichEditOleVtbl re_ole_vtbl DECLSPEC_HIDDEN;
+extern const ITextDocument2OldVtbl text_doc2old_vtbl DECLSPEC_HIDDEN;
/* editor.c */
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index 86b3f0196c7..22cfd74722c 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -41,6 +41,7 @@
#include <richole.h>
#include "imm.h"
#include <textserv.h>
+#include <tom.h>
#include "usp10.h"
#include "wine/asm.h"
@@ -378,7 +379,6 @@ typedef struct tagME_InStream ME_InStream;
typedef struct tagME_TextEditor
{
ITextHost2 *texthost;
- IUnknown *reOle;
unsigned int bEmulateVersion10 : 1;
unsigned int in_place_active : 1;
unsigned int have_texthost2 : 1;
@@ -409,6 +409,7 @@ typedef struct tagME_TextEditor
BOOL bWordWrap;
int nTextLimit;
EDITWORDBREAKPROCW pfnWordBreak;
+ IRichEditOle *richole;
LPRICHEDITOLECALLBACK lpOleCallback;
/*TEXTMODE variable; contains only one of each of the following options:
*TM_RICHTEXT or TM_PLAINTEXT
@@ -456,4 +457,27 @@ typedef struct tagME_Context
ME_TextEditor *editor;
} ME_Context;
+struct text_selection
+{
+ ITextSelection ITextSelection_iface;
+ LONG ref;
+
+ struct text_services *services;
+};
+
+struct text_services
+{
+ IUnknown IUnknown_inner;
+ ITextServices ITextServices_iface;
+ IRichEditOle IRichEditOle_iface;
+ ITextDocument2Old ITextDocument2Old_iface;
+ IUnknown *outer_unk;
+ LONG ref;
+ ME_TextEditor *editor;
+ struct text_selection *text_selection;
+ struct list rangelist;
+ struct list clientsites;
+ char spare[256]; /* for bug #12179 */
+};
+
#endif
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 2bb15bb4504..72840a4cafa 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -136,7 +136,6 @@ static HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
/* private IID used to get back IRichEditOleImpl pointer */
DEFINE_GUID(IID_Igetrichole, 0xe3ce5c7a, 0x8247, 0x4622, 0x81, 0xad, 0x11, 0x81, 0x02, 0xaa, 0x01, 0x30);
-typedef struct ITextSelectionImpl ITextSelectionImpl;
typedef struct IOleClientSiteImpl IOleClientSiteImpl;
typedef struct ITextRangeImpl ITextRangeImpl;
@@ -206,23 +205,9 @@ enum range_update_op {
RANGE_UPDATE_DELETE
};
-typedef struct IRichEditOleImpl {
- IUnknown IUnknown_inner;
- IRichEditOle IRichEditOle_iface;
- ITextDocument2Old ITextDocument2Old_iface;
- IUnknown *outer_unk;
- LONG ref;
-
- ME_TextEditor *editor;
- ITextSelectionImpl *txtSel;
-
- struct list rangelist;
- struct list clientsites;
-} IRichEditOleImpl;
-
struct reole_child {
struct list entry;
- IRichEditOleImpl *reole;
+ struct text_services *reole;
};
struct ITextRangeImpl {
@@ -232,13 +217,6 @@ struct ITextRangeImpl {
LONG start, end;
};
-struct ITextSelectionImpl {
- ITextSelection ITextSelection_iface;
- LONG ref;
-
- IRichEditOleImpl *reOle;
-};
-
typedef struct ITextFontImpl {
ITextFont ITextFont_iface;
LONG ref;
@@ -263,19 +241,14 @@ struct IOleClientSiteImpl {
LONG ref;
};
-static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
-{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
-}
-
-static inline IRichEditOleImpl *impl_from_ITextDocument2Old(ITextDocument2Old *iface)
+static inline struct text_services *impl_from_IRichEditOle( IRichEditOle *iface )
{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument2Old_iface);
+ return CONTAINING_RECORD( iface, struct text_services, IRichEditOle_iface );
}
-static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface)
+static inline struct text_services *impl_from_ITextDocument2Old( ITextDocument2Old *iface )
{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, IUnknown_inner);
+ return CONTAINING_RECORD( iface, struct text_services, ITextDocument2Old_iface );
}
static inline IOleClientSiteImpl *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface)
@@ -288,9 +261,9 @@ static inline ITextRangeImpl *impl_from_ITextRange(ITextRange *iface)
return CONTAINING_RECORD(iface, ITextRangeImpl, ITextRange_iface);
}
-static inline ITextSelectionImpl *impl_from_ITextSelection(ITextSelection *iface)
+static inline struct text_selection *impl_from_ITextSelection(ITextSelection *iface)
{
- return CONTAINING_RECORD(iface, ITextSelectionImpl, ITextSelection_iface);
+ return CONTAINING_RECORD(iface, struct text_selection, ITextSelection_iface);
}
static inline ITextFontImpl *impl_from_ITextFont(ITextFont *iface)
@@ -305,7 +278,7 @@ static inline ITextParaImpl *impl_from_ITextPara(ITextPara *iface)
static HRESULT create_textfont(ITextRange*, const ITextFontImpl*, ITextFont**);
static HRESULT create_textpara(ITextRange*, ITextPara**);
-static ITextSelectionImpl *CreateTextSelection(IRichEditOleImpl*);
+static struct text_selection *text_selection_create( struct text_services * );
static HRESULT textrange_get_storylength(ME_TextEditor *editor, LONG *length)
{
@@ -316,11 +289,11 @@ static HRESULT textrange_get_storylength(ME_TextEditor *editor, LONG *length)
return S_OK;
}
-static void textranges_update_ranges(IRichEditOleImpl *reole, LONG start, LONG end, enum range_update_op op)
+static void textranges_update_ranges(struct text_services *services, LONG start, LONG end, enum range_update_op op)
{
ITextRangeImpl *range;
- LIST_FOR_EACH_ENTRY(range, &reole->rangelist, ITextRangeImpl, child.entry) {
+ LIST_FOR_EACH_ENTRY(range, &services->rangelist, ITextRangeImpl, child.entry) {
switch (op)
{
case RANGE_UPDATE_DELETE:
@@ -434,7 +407,7 @@ static inline FLOAT points_to_twips(FLOAT value)
return value * 1440 / 72.0;
}
-static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos, enum textfont_prop_id propid,
+static HRESULT get_textfont_prop_for_pos(const struct text_services *services, int pos, enum textfont_prop_id propid,
textfont_prop_val *value)
{
ME_Cursor from, to;
@@ -444,10 +417,10 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
fmt.cbSize = sizeof(fmt);
fmt.dwMask = textfont_prop_masks[propid][0];
- cursor_from_char_ofs( reole->editor, pos, &from );
+ cursor_from_char_ofs( services->editor, pos, &from );
to = from;
- ME_MoveCursorChars(reole->editor, &to, 1, FALSE);
- ME_GetCharFormat(reole->editor, &from, &to, &fmt);
+ ME_MoveCursorChars( services->editor, &to, 1, FALSE );
+ ME_GetCharFormat( services->editor, &from, &to, &fmt );
switch (propid)
{
@@ -508,11 +481,11 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
return S_OK;
}
-static inline const IRichEditOleImpl *get_range_reole(ITextRange *range)
+static inline const struct text_services *get_range_reole(ITextRange *range)
{
- IRichEditOleImpl *reole = NULL;
- ITextRange_QueryInterface(range, &IID_Igetrichole, (void**)&reole);
- return reole;
+ struct text_services *services = NULL;
+ ITextRange_QueryInterface(range, &IID_Igetrichole, (void**)&services);
+ return services;
}
static void textrange_set_font(ITextRange *range, ITextFont *font)
@@ -664,22 +637,22 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
if (fmt.dwMask)
{
- const IRichEditOleImpl *reole = get_range_reole(range);
+ const struct text_services *services = get_range_reole(range);
ME_Cursor from, to;
LONG start, end;
ITextRange_GetStart(range, &start);
ITextRange_GetEnd(range, &end);
- cursor_from_char_ofs( reole->editor, start, &from );
- cursor_from_char_ofs( reole->editor, end, &to );
- ME_SetCharFormat(reole->editor, &from, &to, &fmt);
+ cursor_from_char_ofs( services->editor, start, &from );
+ cursor_from_char_ofs( services->editor, end, &to );
+ ME_SetCharFormat( services->editor, &from, &to, &fmt );
}
}
static HRESULT get_textfont_prop(const ITextFontImpl *font, enum textfont_prop_id propid, textfont_prop_val *value)
{
- const IRichEditOleImpl *reole;
+ const struct text_services *services;
textfont_prop_val v;
LONG start, end, i;
HRESULT hr;
@@ -690,7 +663,7 @@ static HRESULT get_textfont_prop(const ITextFontImpl *font, enum textfont_prop_i
return S_OK;
}
- if (!(reole = get_range_reole(font->range)))
+ if (!(services = get_range_reole(font->range)))
return CO_E_RELEASED;
init_textfont_prop_value(propid, value);
@@ -699,14 +672,14 @@ static HRESULT get_textfont_prop(const ITextFontImpl *font, enum textfont_prop_i
ITextRange_GetEnd(font->range, &end);
/* iterate trough a range to see if property value is consistent */
- hr = get_textfont_prop_for_pos(reole, start, propid, &v);
+ hr = get_textfont_prop_for_pos( services, start, propid, &v );
if (FAILED(hr))
return hr;
for (i = start + 1; i < end; i++) {
textfont_prop_val cur;
- hr = get_textfont_prop_for_pos(reole, i, propid, &cur);
+ hr = get_textfont_prop_for_pos( services, i, propid, &cur );
if (FAILED(hr))
return hr;
@@ -747,7 +720,7 @@ static HRESULT get_textfont_propl(const ITextFontImpl *font, enum textfont_prop_
/* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id propid, const textfont_prop_val *value)
{
- const IRichEditOleImpl *reole;
+ const struct text_services *services;
ME_Cursor from, to;
CHARFORMAT2W fmt;
LONG start, end;
@@ -763,7 +736,7 @@ static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id prop
return S_OK;
}
- if (!(reole = get_range_reole(font->range)))
+ if (!(services = get_range_reole(font->range)))
return CO_E_RELEASED;
memset(&fmt, 0, sizeof(fmt));
@@ -829,9 +802,9 @@ static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id prop
ITextRange_GetStart(font->range, &start);
ITextRange_GetEnd(font->range, &end);
- cursor_from_char_ofs( reole->editor, start, &from );
- cursor_from_char_ofs( reole->editor, end, &to );
- ME_SetCharFormat(reole->editor, &from, &to, &fmt);
+ cursor_from_char_ofs( services->editor, start, &from );
+ cursor_from_char_ofs( services->editor, end, &to );
+ ME_SetCharFormat( services->editor, &from, &to, &fmt );
return S_OK;
}
@@ -880,16 +853,16 @@ static HRESULT set_textfont_propd(ITextFontImpl *font, enum textfont_prop_id pro
static HRESULT textfont_getname_from_range(ITextRange *range, BSTR *ret)
{
- const IRichEditOleImpl *reole;
+ const struct text_services *services;
textfont_prop_val v;
HRESULT hr;
LONG start;
- if (!(reole = get_range_reole(range)))
+ if (!(services = get_range_reole( range )))
return CO_E_RELEASED;
ITextRange_GetStart(range, &start);
- hr = get_textfont_prop_for_pos(reole, start, FONT_NAME, &v);
+ hr = get_textfont_prop_for_pos( services, start, FONT_NAME, &v );
*ret = v.str;
return hr;
}
@@ -934,118 +907,48 @@ static HRESULT textrange_expand(ITextRange *range, LONG unit, LONG *delta)
return S_OK;
}
-static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
-{
- IRichEditOleImpl *This = impl_from_IUnknown(iface);
-
- TRACE("%p %s\n", This, debugstr_guid(riid));
-
- *ppvObj = NULL;
- if (IsEqualGUID(riid, &IID_IUnknown))
- *ppvObj = &This->IUnknown_inner;
- else if (IsEqualGUID(riid, &IID_IRichEditOle))
- *ppvObj = &This->IRichEditOle_iface;
- else if (IsEqualGUID(riid, &IID_ITextDocument) || IsEqualGUID(riid, &IID_ITextDocument2Old))
- *ppvObj = &This->ITextDocument2Old_iface;
- if (*ppvObj)
- {
- IUnknown_AddRef((IUnknown *)*ppvObj);
- return S_OK;
- }
- FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid));
-
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI IRichEditOleImpl_inner_fnAddRef(IUnknown *iface)
-{
- IRichEditOleImpl *This = impl_from_IUnknown(iface);
- ULONG ref = InterlockedIncrement(&This->ref);
-
- TRACE("%p ref = %u\n", This, ref);
-
- return ref;
-}
-
-static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface)
-{
- IRichEditOleImpl *This = impl_from_IUnknown(iface);
- ULONG ref = InterlockedDecrement(&This->ref);
-
- TRACE ("%p ref=%u\n", This, ref);
-
- if (!ref)
- {
- IOleClientSiteImpl *clientsite;
- ITextRangeImpl *txtRge;
-
- This->editor->reOle = NULL;
- if (This->txtSel) {
- This->txtSel->reOle = NULL;
- ITextSelection_Release(&This->txtSel->ITextSelection_iface);
- }
-
- LIST_FOR_EACH_ENTRY(txtRge, &This->rangelist, ITextRangeImpl, child.entry)
- txtRge->child.reole = NULL;
-
- LIST_FOR_EACH_ENTRY(clientsite, &This->clientsites, IOleClientSiteImpl, child.entry)
- clientsite->child.reole = NULL;
-
- heap_free(This);
- }
- return ref;
-}
-
-static const IUnknownVtbl reo_unk_vtbl =
-{
- IRichEditOleImpl_inner_fnQueryInterface,
- IRichEditOleImpl_inner_fnAddRef,
- IRichEditOleImpl_inner_fnRelease
-};
-
static HRESULT WINAPI
-IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
+IRichEditOle_fnQueryInterface(IRichEditOle *iface, REFIID riid, LPVOID *ppvObj)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ return IUnknown_QueryInterface( services->outer_unk, riid, ppvObj );
}
static ULONG WINAPI
-IRichEditOle_fnAddRef(IRichEditOle *me)
+IRichEditOle_fnAddRef(IRichEditOle *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- return IUnknown_AddRef(This->outer_unk);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ return IUnknown_AddRef( services->outer_unk );
}
static ULONG WINAPI
-IRichEditOle_fnRelease(IRichEditOle *me)
+IRichEditOle_fnRelease(IRichEditOle *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- return IUnknown_Release(This->outer_unk);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ return IUnknown_Release( services->outer_unk );
}
static HRESULT WINAPI
-IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
+IRichEditOle_fnActivateAs(IRichEditOle *iface, REFCLSID rclsid, REFCLSID rclsidAs)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME( "stub %p\n", services );
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
+IRichEditOle_fnContextSensitiveHelp(IRichEditOle *iface, BOOL fEnterMode)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME( "stub %p\n", services );
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
- REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
+IRichEditOle_fnConvertObject( IRichEditOle *iface, LONG iob, REFCLSID class, LPCSTR user_type )
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME( "stub %p\n", services );
return E_NOTIMPL;
}
@@ -1308,7 +1211,7 @@ static const IOleInPlaceSiteVtbl olestvt =
IOleInPlaceSite_fnOnPosRectChange
};
-static HRESULT CreateOleClientSite(IRichEditOleImpl *reOle, IOleClientSite **ret)
+static HRESULT CreateOleClientSite( struct text_services *services, IOleClientSite **ret )
{
IOleClientSiteImpl *clientSite = heap_alloc(sizeof *clientSite);
@@ -1318,67 +1221,67 @@ static HRESULT CreateOleClientSite(IRichEditOleImpl *reOle, IOleClientSite **ret
clientSite->IOleClientSite_iface.lpVtbl = &ocst;
clientSite->IOleInPlaceSite_iface.lpVtbl = &olestvt;
clientSite->ref = 1;
- clientSite->child.reole = reOle;
- list_add_head(&reOle->clientsites, &clientSite->child.entry);
+ clientSite->child.reole = services;
+ list_add_head( &services->clientsites, &clientSite->child.entry );
*ret = &clientSite->IOleClientSite_iface;
return S_OK;
}
static HRESULT WINAPI
-IRichEditOle_fnGetClientSite(IRichEditOle *me, IOleClientSite **clientsite)
+IRichEditOle_fnGetClientSite( IRichEditOle *iface, IOleClientSite **clientsite )
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ struct text_services *services = impl_from_IRichEditOle( iface );
- TRACE("(%p)->(%p)\n", This, clientsite);
+ TRACE("(%p)->(%p)\n", services, clientsite);
if (!clientsite)
return E_INVALIDARG;
- return CreateOleClientSite(This, clientsite);
+ return CreateOleClientSite( services, clientsite );
}
static HRESULT WINAPI
-IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
+IRichEditOle_fnGetClipboardData(IRichEditOle *iface, CHARRANGE *lpchrg,
DWORD reco, LPDATAOBJECT *lplpdataobj)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ struct text_services *services = impl_from_IRichEditOle( iface );
ME_Cursor start;
int nChars;
- TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
+ TRACE("(%p,%p,%d)\n", services, lpchrg, reco);
if(!lplpdataobj)
return E_INVALIDARG;
if(!lpchrg)
{
- int nFrom, nTo, nStartCur = ME_GetSelectionOfs(This->editor, &nFrom, &nTo);
- start = This->editor->pCursors[nStartCur];
+ int nFrom, nTo, nStartCur = ME_GetSelectionOfs( services->editor, &nFrom, &nTo );
+ start = services->editor->pCursors[nStartCur];
nChars = nTo - nFrom;
}
else
{
- cursor_from_char_ofs( This->editor, lpchrg->cpMin, &start );
+ cursor_from_char_ofs( services->editor, lpchrg->cpMin, &start );
nChars = lpchrg->cpMax - lpchrg->cpMin;
}
- return ME_GetDataObject(This->editor, &start, nChars, lplpdataobj);
+ return ME_GetDataObject( services->editor, &start, nChars, lplpdataobj );
}
-static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
+static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
+IRichEditOle_fnGetObject(IRichEditOle *iface, LONG iob,
REOBJECT *lpreobject, DWORD dwFlags)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ struct text_services *services = impl_from_IRichEditOle( iface );
struct re_object *reobj = NULL;
LONG count = 0;
- TRACE("(%p)->(%x, %p, %x)\n", This, iob, lpreobject, dwFlags);
+ TRACE("(%p)->(%x, %p, %x)\n", services, iob, lpreobject, dwFlags);
if (!lpreobject || !lpreobject->cbStruct)
return E_INVALIDARG;
@@ -1388,7 +1291,7 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
ME_Cursor cursor;
TRACE("character offset: %d\n", lpreobject->cp);
- cursor_from_char_ofs( This->editor, lpreobject->cp, &cursor );
+ cursor_from_char_ofs( services->editor, lpreobject->cp, &cursor );
if (!cursor.run->reobj)
return E_INVALIDARG;
else
@@ -1398,7 +1301,7 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
{
ME_Cursor *from, *to;
- ME_GetSelection(This->editor, &from, &to);
+ ME_GetSelection(services->editor, &from, &to);
if (!from->run->reobj)
return E_INVALIDARG;
else
@@ -1406,9 +1309,9 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
}
else
{
- if (iob < 0 || iob >= IRichEditOle_GetObjectCount(me))
+ if (iob < 0 || iob >= IRichEditOle_GetObjectCount( iface ))
return E_INVALIDARG;
- LIST_FOR_EACH_ENTRY(reobj, &This->editor->reobj_list, struct re_object, entry)
+ LIST_FOR_EACH_ENTRY(reobj, &services->editor->reobj_list, struct re_object, entry)
{
if (count == iob)
break;
@@ -1420,89 +1323,90 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
}
static LONG WINAPI
-IRichEditOle_fnGetObjectCount(IRichEditOle *me)
+IRichEditOle_fnGetObjectCount( IRichEditOle *iface )
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- TRACE("(%p)\n",This);
- return list_count(&This->editor->reobj_list);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ TRACE("(%p)\n", services);
+ return list_count( &services->editor->reobj_list );
}
static HRESULT WINAPI
-IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
+IRichEditOle_fnHandsOffStorage(IRichEditOle *iface, LONG iob)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
+IRichEditOle_fnImportDataObject(IRichEditOle *iface, LPDATAOBJECT lpdataobj,
CLIPFORMAT cf, HGLOBAL hMetaPict)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
+IRichEditOle_fnInPlaceDeactivate(IRichEditOle *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
+IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ struct text_services *services = impl_from_IRichEditOle( iface );
- TRACE("(%p,%p)\n", This, reo);
+ TRACE("(%p,%p)\n", services, reo);
if (!reo)
return E_INVALIDARG;
if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
- ME_InsertOLEFromCursor(This->editor, reo, 0);
- ME_CommitUndo(This->editor);
- ME_UpdateRepaint(This->editor, FALSE);
+ ME_InsertOLEFromCursor(services->editor, reo, 0);
+ ME_CommitUndo(services->editor);
+ ME_UpdateRepaint(services->editor, FALSE);
return S_OK;
}
-static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
+static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *iface, LONG iob,
LPSTORAGE lpstg)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
+IRichEditOle_fnSetDvaspect(IRichEditOle *iface, LONG iob, DWORD dvaspect)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
-static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
+static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *iface,
LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p %s %s\n", services, lpstrContainerApp, lpstrContainerObj);
return E_NOTIMPL;
}
static HRESULT WINAPI
-IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
+IRichEditOle_fnSetLinkAvailable(IRichEditOle *iface, LONG iob, BOOL fAvailable)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_IRichEditOle( iface );
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
-static const IRichEditOleVtbl revt = {
+const IRichEditOleVtbl re_ole_vtbl =
+{
IRichEditOle_fnQueryInterface,
IRichEditOle_fnAddRef,
IRichEditOle_fnRelease,
@@ -1750,7 +1654,7 @@ static HRESULT WINAPI ITextRange_fnSetChar(ITextRange *me, LONG ch)
return E_NOTIMPL;
}
-static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, ITextRange** ppRange);
+static HRESULT CreateITextRange(struct text_services *services, LONG start, LONG end, ITextRange** ppRange);
static HRESULT WINAPI ITextRange_fnGetDuplicate(ITextRange *me, ITextRange **ppRange)
{
@@ -1807,7 +1711,7 @@ static HRESULT WINAPI ITextRange_fnGetStart(ITextRange *me, LONG *start)
return S_OK;
}
-static HRESULT textrange_setstart(const IRichEditOleImpl *reole, LONG value, LONG *start, LONG *end)
+static HRESULT textrange_setstart(const struct text_services *services, LONG value, LONG *start, LONG *end)
{
int len;
@@ -1822,7 +1726,7 @@ static HRESULT textrange_setstart(const IRichEditOleImpl *reole, LONG value, LON
return S_OK;
}
- len = ME_GetTextLength(reole->editor);
+ len = ME_GetTextLength(services->editor);
*start = *end = value > len ? len : value;
return S_OK;
}
@@ -1855,7 +1759,7 @@ static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *end)
return S_OK;
}
-static HRESULT textrange_setend(const IRichEditOleImpl *reole, LONG value, LONG *start, LONG *end)
+static HRESULT textrange_setend(const struct text_services *services, LONG value, LONG *start, LONG *end)
{
int len;
@@ -1867,7 +1771,7 @@ static HRESULT textrange_setend(const IRichEditOleImpl *reole, LONG value, LONG
return S_OK;
}
- len = ME_GetTextLength(reole->editor);
+ len = ME_GetTextLength( services->editor );
*end = value > len ? len + 1 : value;
return S_OK;
}
@@ -4126,27 +4030,27 @@ static HRESULT create_textpara(ITextRange *range, ITextPara **ret)
static HRESULT WINAPI ITextDocument2Old_fnQueryInterface(ITextDocument2Old* iface, REFIID riid,
void **ppvObject)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ return IUnknown_QueryInterface( services->outer_unk, riid, ppvObject );
}
static ULONG WINAPI ITextDocument2Old_fnAddRef(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- return IRichEditOle_AddRef(&This->IRichEditOle_iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ return IUnknown_AddRef( services->outer_unk );
}
static ULONG WINAPI ITextDocument2Old_fnRelease(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- return IRichEditOle_Release(&This->IRichEditOle_iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ return IUnknown_Release( services->outer_unk );
}
static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old *iface,
UINT *pctinfo)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- TRACE("(%p)->(%p)\n", This, pctinfo);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ TRACE("(%p)->(%p)\n", services, pctinfo);
*pctinfo = 1;
return S_OK;
}
@@ -4154,10 +4058,10 @@ static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old *if
static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfo(ITextDocument2Old *iface, UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
HRESULT hr;
- TRACE("(%p)->(%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
+ TRACE("(%p)->(%u,%d,%p)\n", services, iTInfo, lcid, ppTInfo);
hr = get_typeinfo(ITextDocument_tid, ppTInfo);
if (SUCCEEDED(hr))
@@ -4169,11 +4073,11 @@ static HRESULT WINAPI ITextDocument2Old_fnGetIDsOfNames(ITextDocument2Old *iface
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
ITypeInfo *ti;
HRESULT hr;
- TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This, debugstr_guid(riid),
+ TRACE("(%p)->(%s, %p, %u, %d, %p)\n", services, debugstr_guid(riid),
rgszNames, cNames, lcid, rgDispId);
hr = get_typeinfo(ITextDocument_tid, &ti);
@@ -4187,11 +4091,11 @@ static HRESULT WINAPI ITextDocument2Old_fnInvoke(ITextDocument2Old *iface, DISPI
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
ITypeInfo *ti;
HRESULT hr;
- TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This, dispIdMember,
+ TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", services, dispIdMember,
debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult,
pExcepInfo, puArgErr);
@@ -4203,142 +4107,144 @@ static HRESULT WINAPI ITextDocument2Old_fnInvoke(ITextDocument2Old *iface, DISPI
static HRESULT WINAPI ITextDocument2Old_fnGetName(ITextDocument2Old *iface, BSTR *pName)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetSelection(ITextDocument2Old *iface, ITextSelection **selection)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
TRACE("(%p)->(%p)\n", iface, selection);
if (!selection)
return E_INVALIDARG;
- if (!This->txtSel) {
- This->txtSel = CreateTextSelection(This);
- if (!This->txtSel) {
- *selection = NULL;
- return E_OUTOFMEMORY;
- }
+ if (!services->text_selection)
+ {
+ services->text_selection = text_selection_create( services );
+ if (!services->text_selection)
+ {
+ *selection = NULL;
+ return E_OUTOFMEMORY;
+ }
}
- *selection = &This->txtSel->ITextSelection_iface;
+ *selection = &services->text_selection->ITextSelection_iface;
ITextSelection_AddRef(*selection);
return S_OK;
}
static HRESULT WINAPI ITextDocument2Old_fnGetStoryCount(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetStoryRanges(ITextDocument2Old *iface,
ITextStoryRanges **ppStories)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetSaved(ITextDocument2Old *iface, LONG *pValue)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSetSaved(ITextDocument2Old *iface, LONG Value)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetDefaultTabStop(ITextDocument2Old *iface, float *pValue)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSetDefaultTabStop(ITextDocument2Old *iface, float Value)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnNew(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnOpen(ITextDocument2Old *iface, VARIANT *pVar,
LONG Flags, LONG CodePage)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSave(ITextDocument2Old *iface, VARIANT *pVar,
LONG Flags, LONG CodePage)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnFreeze(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnUnfreeze(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnEndEditCollection(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnUndo(ITextDocument2Old *iface, LONG Count, LONG *prop)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnRedo(ITextDocument2Old *iface, LONG Count, LONG *prop)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
-static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, ITextRange** ppRange)
+static HRESULT CreateITextRange(struct text_services *services, LONG start, LONG end, ITextRange** ppRange)
{
ITextRangeImpl *txtRge = heap_alloc(sizeof(ITextRangeImpl));
@@ -4346,10 +4252,10 @@ static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, I
return E_OUTOFMEMORY;
txtRge->ITextRange_iface.lpVtbl = &trvt;
txtRge->ref = 1;
- txtRge->child.reole = reOle;
+ txtRge->child.reole = services;
txtRge->start = start;
txtRge->end = end;
- list_add_head(&reOle->rangelist, &txtRge->child.entry);
+ list_add_head( &services->rangelist, &txtRge->child.entry );
*ppRange = &txtRge->ITextRange_iface;
return S_OK;
}
@@ -4357,84 +4263,84 @@ static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, I
static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG cp1, LONG cp2,
ITextRange **ppRange)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
+ TRACE("%p %p %d %d\n", services, ppRange, cp1, cp2);
if (!ppRange)
return E_INVALIDARG;
- cp2range(This->editor, &cp1, &cp2);
- return CreateITextRange(This, cp1, cp2, ppRange);
+ cp2range(services->editor, &cp1, &cp2);
+ return CreateITextRange(services, cp1, cp2, ppRange);
}
static HRESULT WINAPI ITextDocument2Old_fnRangeFromPoint(ITextDocument2Old *iface, LONG x, LONG y,
ITextRange **ppRange)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- FIXME("stub %p\n",This);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
+ FIXME("stub %p\n", services);
return E_NOTIMPL;
}
/* ITextDocument2Old methods */
static HRESULT WINAPI ITextDocument2Old_fnAttachMsgFilter(ITextDocument2Old *iface, IUnknown *filter)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, filter);
+ FIXME("(%p)->(%p): stub\n", services, filter);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF cr)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d, 0x%x): stub\n", This, index, cr);
+ FIXME("(%p)->(%d, 0x%x): stub\n", services, index, cr);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF *cr)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d, %p): stub\n", This, index, cr);
+ FIXME("(%p)->(%d, %p): stub\n", services, index, cr);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetCaretType(ITextDocument2Old *iface, LONG *type)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, type);
+ FIXME("(%p)->(%p): stub\n", services, type);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSetCaretType(ITextDocument2Old *iface, LONG type)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d): stub\n", This, type);
+ FIXME("(%p)->(%d): stub\n", services, type);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetImmContext(ITextDocument2Old *iface, LONG *context)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, context);
+ FIXME("(%p)->(%p): stub\n", services, context);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnReleaseImmContext(ITextDocument2Old *iface, LONG context)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d): stub\n", This, context);
+ FIXME("(%p)->(%d): stub\n", services, context);
return E_NOTIMPL;
}
@@ -4443,9 +4349,9 @@ static HRESULT WINAPI ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old *if
LONG options, LONG current_charrep, LONG current_fontsize,
BSTR *bstr, LONG *pitch_family, LONG *new_fontsize)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", This, cp, charrep, options, current_charrep,
+ FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", services, cp, charrep, options, current_charrep,
current_fontsize, bstr, pitch_family, new_fontsize);
return E_NOTIMPL;
@@ -4453,18 +4359,18 @@ static HRESULT WINAPI ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old *if
static HRESULT WINAPI ITextDocument2Old_fnGetNotificationMode(ITextDocument2Old *iface, LONG *mode)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, mode);
+ FIXME("(%p)->(%p): stub\n", services, mode);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old *iface, LONG mode)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(0x%x): stub\n", This, mode);
+ FIXME("(%p)->(0x%x): stub\n", services, mode);
return E_NOTIMPL;
}
@@ -4472,95 +4378,96 @@ static HRESULT WINAPI ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old
static HRESULT WINAPI ITextDocument2Old_fnGetClientRect(ITextDocument2Old *iface, LONG type, LONG *left, LONG *top,
LONG *right, LONG *bottom)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", This, type, left, top, right, bottom);
+ FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", services, type, left, top, right, bottom);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetSelectionEx(ITextDocument2Old *iface, ITextSelection **selection)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, selection);
+ FIXME("(%p)->(%p): stub\n", services, selection);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetWindow(ITextDocument2Old *iface, LONG *hwnd)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, hwnd);
+ FIXME("(%p)->(%p): stub\n", services, hwnd);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnGetFEFlags(ITextDocument2Old *iface, LONG *flags)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%p): stub\n", This, flags);
+ FIXME("(%p)->(%p): stub\n", services, flags);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnUpdateWindow(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p): stub\n", This);
+ FIXME("(%p): stub\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnCheckTextLimit(ITextDocument2Old *iface, LONG cch, LONG *exceed)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d, %p): stub\n", This, cch, exceed);
+ FIXME("(%p)->(%d, %p): stub\n", services, cch, exceed);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnIMEInProgress(ITextDocument2Old *iface, LONG mode)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(0x%x): stub\n", This, mode);
+ FIXME("(%p)->(0x%x): stub\n", services, mode);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnSysBeep(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p): stub\n", This);
+ FIXME("(%p): stub\n", services);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnUpdate(ITextDocument2Old *iface, LONG mode)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(0x%x): stub\n", This, mode);
+ FIXME("(%p)->(0x%x): stub\n", services, mode);
return E_NOTIMPL;
}
static HRESULT WINAPI ITextDocument2Old_fnNotify(ITextDocument2Old *iface, LONG notify)
{
- IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+ struct text_services *services = impl_from_ITextDocument2Old(iface);
- FIXME("(%p)->(%d): stub\n", This, notify);
+ FIXME("(%p)->(%d): stub\n", services, notify);
return E_NOTIMPL;
}
-static const ITextDocument2OldVtbl tdvt = {
+const ITextDocument2OldVtbl text_doc2old_vtbl =
+{
ITextDocument2Old_fnQueryInterface,
ITextDocument2Old_fnAddRef,
ITextDocument2Old_fnRelease,
@@ -4616,7 +4523,7 @@ static HRESULT WINAPI ITextSelection_fnQueryInterface(
REFIID riid,
void **ppvObj)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
*ppvObj = NULL;
if (IsEqualGUID(riid, &IID_IUnknown)
@@ -4630,7 +4537,7 @@ static HRESULT WINAPI ITextSelection_fnQueryInterface(
}
else if (IsEqualGUID(riid, &IID_Igetrichole))
{
- *ppvObj = This->reOle;
+ *ppvObj = This->services;
return S_OK;
}
@@ -4639,13 +4546,13 @@ static HRESULT WINAPI ITextSelection_fnQueryInterface(
static ULONG WINAPI ITextSelection_fnAddRef(ITextSelection *me)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
heap_free(This);
@@ -4654,7 +4561,7 @@ static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(ITextSelection *me, UINT *pctinfo)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
@@ -4663,7 +4570,7 @@ static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(ITextSelection *me, UINT
static HRESULT WINAPI ITextSelection_fnGetTypeInfo(ITextSelection *me, UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
HRESULT hr;
TRACE("(%p)->(%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
@@ -4677,7 +4584,7 @@ static HRESULT WINAPI ITextSelection_fnGetTypeInfo(ITextSelection *me, UINT iTIn
static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(ITextSelection *me, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITypeInfo *ti;
HRESULT hr;
@@ -4701,7 +4608,7 @@ static HRESULT WINAPI ITextSelection_fnInvoke(
EXCEPINFO *pExcepInfo,
UINT *puArgErr)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITypeInfo *ti;
HRESULT hr;
@@ -4717,20 +4624,20 @@ static HRESULT WINAPI ITextSelection_fnInvoke(
/*** ITextRange methods ***/
static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ME_Cursor *start = NULL, *end = NULL;
int nChars, endOfs;
BOOL bEOP;
TRACE("(%p)->(%p)\n", This, pbstr);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!pbstr)
return E_INVALIDARG;
- ME_GetSelection(This->reOle->editor, &start, &end);
+ ME_GetSelection(This->services->editor, &start, &end);
endOfs = ME_GetCursorOfs(end);
nChars = endOfs - ME_GetCursorOfs(start);
if (!nChars)
@@ -4743,8 +4650,8 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
if (!*pbstr)
return E_OUTOFMEMORY;
- bEOP = (!para_next( para_next( end->para ) ) && endOfs > ME_GetTextLength(This->reOle->editor));
- ME_GetTextW(This->reOle->editor, *pbstr, nChars, start, nChars, FALSE, bEOP);
+ bEOP = (!para_next( para_next( end->para ) ) && endOfs > ME_GetTextLength(This->services->editor));
+ ME_GetTextW(This->services->editor, *pbstr, nChars, start, nChars, FALSE, bEOP);
TRACE("%s\n", wine_dbgstr_w(*pbstr));
return S_OK;
@@ -4752,50 +4659,50 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR str)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ME_TextEditor *editor;
int len, to, from;
TRACE("(%p)->(%s)\n", This, debugstr_w(str));
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
- editor = This->reOle->editor;
+ editor = This->services->editor;
len = lstrlenW(str);
ME_GetSelectionOfs(editor, &from, &to);
ME_ReplaceSel(editor, FALSE, str, len);
if (len < to - from)
- textranges_update_ranges(This->reOle, from, len, RANGE_UPDATE_DELETE);
+ textranges_update_ranges(This->services, from, len, RANGE_UPDATE_DELETE);
return S_OK;
}
static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ME_Cursor *start = NULL, *end = NULL;
TRACE("(%p)->(%p)\n", This, pch);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!pch)
return E_INVALIDARG;
- ME_GetSelection(This->reOle->editor, &start, &end);
- return range_GetChar(This->reOle->editor, start, pch);
+ ME_GetSelection(This->services->editor, &start, &end);
+ return range_GetChar(This->services->editor, start, pch);
}
static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%x): stub\n", This, ch);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -4803,12 +4710,12 @@ static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **range)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG start, end;
TRACE("(%p)->(%p)\n", This, range);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!range)
@@ -4816,16 +4723,16 @@ static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRan
ITextSelection_GetStart(me, &start);
ITextSelection_GetEnd(me, &end);
- return CreateITextRange(This->reOle, start, end, range);
+ return CreateITextRange(This->services, start, end, range);
}
static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **range)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, range);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -4833,11 +4740,11 @@ static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITex
static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITextRange *range)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, range);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
FIXME("not implemented\n");
@@ -4846,83 +4753,83 @@ static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITex
static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFirst)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG lim;
TRACE("(%p)->(%p)\n", This, pcpFirst);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!pcpFirst)
return E_INVALIDARG;
- ME_GetSelectionOfs(This->reOle->editor, pcpFirst, &lim);
+ ME_GetSelectionOfs(This->services->editor, pcpFirst, &lim);
return S_OK;
}
static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG value)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG start, end;
HRESULT hr;
TRACE("(%p)->(%d)\n", This, value);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
- ME_GetSelectionOfs(This->reOle->editor, &start, &end);
- hr = textrange_setstart(This->reOle, value, &start, &end);
+ ME_GetSelectionOfs(This->services->editor, &start, &end);
+ hr = textrange_setstart(This->services, value, &start, &end);
if (hr == S_OK)
- set_selection(This->reOle->editor, start, end);
+ set_selection(This->services->editor, start, end);
return hr;
}
static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG first;
TRACE("(%p)->(%p)\n", This, pcpLim);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!pcpLim)
return E_INVALIDARG;
- ME_GetSelectionOfs(This->reOle->editor, &first, pcpLim);
+ ME_GetSelectionOfs(This->services->editor, &first, pcpLim);
return S_OK;
}
static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG value)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG start, end;
HRESULT hr;
TRACE("(%p)->(%d)\n", This, value);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
- ME_GetSelectionOfs(This->reOle->editor, &start, &end);
- hr = textrange_setend(This->reOle, value, &start, &end);
+ ME_GetSelectionOfs(This->services->editor, &start, &end);
+ hr = textrange_setend(This->services, value, &start, &end);
if (hr == S_OK)
- set_selection(This->reOle->editor, start, end);
+ set_selection(This->services->editor, start, end);
return hr;
}
static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **font)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, font);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!font)
@@ -4936,7 +4843,7 @@ static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **f
static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *font)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
TRACE("(%p)->(%p)\n", This, font);
@@ -4944,7 +4851,7 @@ static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *fo
if (!font)
return E_INVALIDARG;
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
@@ -4955,13 +4862,13 @@ static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *fo
static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **para)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, para);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!para)
@@ -4975,11 +4882,11 @@ static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **p
static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *para)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, para);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
FIXME("not implemented\n");
@@ -4988,23 +4895,23 @@ static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *pa
static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *length)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
TRACE("(%p)->(%p)\n", This, length);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
- return textrange_get_storylength(This->reOle->editor, length);
+ return textrange_get_storylength(This->services->editor, length);
}
static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *value)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
TRACE("(%p)->(%p)\n", This, value);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!value)
@@ -5016,31 +4923,31 @@ static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *va
static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
LONG start, end;
HRESULT hres;
TRACE("(%p)->(%d)\n", This, bStart);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
- ME_GetSelectionOfs(This->reOle->editor, &start, &end);
+ ME_GetSelectionOfs(This->services->editor, &start, &end);
hres = range_Collapse(bStart, &start, &end);
if (SUCCEEDED(hres))
- set_selection(This->reOle->editor, start, end);
+ set_selection(This->services->editor, start, end);
return hres;
}
static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG unit, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %p)\n", This, unit, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
@@ -5051,11 +4958,11 @@ static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG unit, LON
static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG unit, LONG *index)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %p): stub\n", This, unit, index);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5064,11 +4971,11 @@ static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG unit, L
static HRESULT WINAPI ITextSelection_fnSetIndex(ITextSelection *me, LONG unit, LONG index,
LONG extend)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d): stub\n", This, unit, index, extend);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5076,11 +4983,11 @@ static HRESULT WINAPI ITextSelection_fnSetIndex(ITextSelection *me, LONG unit, L
static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG anchor, LONG active)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d): stub\n", This, anchor, active);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5088,7 +4995,7 @@ static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG anchor,
static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *range, LONG *ret)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextSelection *selection = NULL;
LONG start, end;
@@ -5097,7 +5004,7 @@ static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *r
if (ret)
*ret = tomFalse;
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!range)
@@ -5115,11 +5022,11 @@ static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *r
static HRESULT WINAPI ITextSelection_fnInStory(ITextSelection *me, ITextRange *range, LONG *ret)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p %p): stub\n", This, range, ret);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5127,7 +5034,7 @@ static HRESULT WINAPI ITextSelection_fnInStory(ITextSelection *me, ITextRange *r
static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *range, LONG *ret)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextSelection *selection = NULL;
LONG start, end;
@@ -5136,7 +5043,7 @@ static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *r
if (ret)
*ret = tomFalse;
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
if (!range)
@@ -5154,11 +5061,11 @@ static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *r
static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
TRACE("(%p)\n", This);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
/* nothing to do */
@@ -5168,13 +5075,13 @@ static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me)
static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG unit, LONG extend,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
@@ -5186,34 +5093,34 @@ static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG unit, LO
static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG unit, LONG extend,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_endof(range, This->reOle->editor, unit, extend, delta);
+ hr = textrange_endof(range, This->services->editor, unit, extend, delta);
ITextRange_Release(range);
return hr;
}
static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG unit, LONG count, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_movestart(range, This->reOle->editor, unit, count, delta);
+ hr = textrange_movestart(range, This->services->editor, unit, count, delta);
ITextRange_Release(range);
return hr;
}
@@ -5221,17 +5128,17 @@ static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG unit, LONG
static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG unit, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_movestart(range, This->reOle->editor, unit, count, delta);
+ hr = textrange_movestart(range, This->services->editor, unit, count, delta);
ITextRange_Release(range);
return hr;
}
@@ -5239,17 +5146,17 @@ static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG unit,
static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG unit, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_moveend(range, This->reOle->editor, unit, count, delta);
+ hr = textrange_moveend(range, This->services->editor, unit, count, delta);
ITextRange_Release(range);
return hr;
}
@@ -5257,11 +5164,11 @@ static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG unit, LO
static HRESULT WINAPI ITextSelection_fnMoveWhile(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5270,11 +5177,11 @@ static HRESULT WINAPI ITextSelection_fnMoveWhile(ITextSelection *me, VARIANT *ch
static HRESULT WINAPI ITextSelection_fnMoveStartWhile(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5283,11 +5190,11 @@ static HRESULT WINAPI ITextSelection_fnMoveStartWhile(ITextSelection *me, VARIAN
static HRESULT WINAPI ITextSelection_fnMoveEndWhile(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5296,11 +5203,11 @@ static HRESULT WINAPI ITextSelection_fnMoveEndWhile(ITextSelection *me, VARIANT
static HRESULT WINAPI ITextSelection_fnMoveUntil(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5309,11 +5216,11 @@ static HRESULT WINAPI ITextSelection_fnMoveUntil(ITextSelection *me, VARIANT *ch
static HRESULT WINAPI ITextSelection_fnMoveStartUntil(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5322,11 +5229,11 @@ static HRESULT WINAPI ITextSelection_fnMoveStartUntil(ITextSelection *me, VARIAN
static HRESULT WINAPI ITextSelection_fnMoveEndUntil(ITextSelection *me, VARIANT *charset, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %p): stub\n", This, debugstr_variant(charset), count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5335,11 +5242,11 @@ static HRESULT WINAPI ITextSelection_fnMoveEndUntil(ITextSelection *me, VARIANT
static HRESULT WINAPI ITextSelection_fnFindText(ITextSelection *me, BSTR text, LONG count, LONG flags,
LONG *length)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %x %p): stub\n", This, debugstr_w(text), count, flags, length);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
FIXME("not implemented\n");
@@ -5349,11 +5256,11 @@ static HRESULT WINAPI ITextSelection_fnFindText(ITextSelection *me, BSTR text, L
static HRESULT WINAPI ITextSelection_fnFindTextStart(ITextSelection *me, BSTR text, LONG count,
LONG flags, LONG *length)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %x %p): stub\n", This, debugstr_w(text), count, flags, length);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5362,11 +5269,11 @@ static HRESULT WINAPI ITextSelection_fnFindTextStart(ITextSelection *me, BSTR te
static HRESULT WINAPI ITextSelection_fnFindTextEnd(ITextSelection *me, BSTR text, LONG count,
LONG flags, LONG *length)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %d %x %p): stub\n", This, debugstr_w(text), count, flags, length);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5375,11 +5282,11 @@ static HRESULT WINAPI ITextSelection_fnFindTextEnd(ITextSelection *me, BSTR text
static HRESULT WINAPI ITextSelection_fnDelete(ITextSelection *me, LONG unit, LONG count,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %p): stub\n", This, unit, count, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5387,45 +5294,45 @@ static HRESULT WINAPI ITextSelection_fnDelete(ITextSelection *me, LONG unit, LON
static HRESULT WINAPI ITextSelection_fnCut(ITextSelection *me, VARIANT *v)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%p): stub\n", This, v);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_copy_or_cut(range, This->reOle->editor, TRUE, v);
+ hr = textrange_copy_or_cut(range, This->services->editor, TRUE, v);
ITextRange_Release(range);
return hr;
}
static HRESULT WINAPI ITextSelection_fnCopy(ITextSelection *me, VARIANT *v)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
ITextRange *range = NULL;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, v);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range);
- hr = textrange_copy_or_cut(range, This->reOle->editor, FALSE, v);
+ hr = textrange_copy_or_cut(range, This->services->editor, FALSE, v);
ITextRange_Release(range);
return hr;
}
static HRESULT WINAPI ITextSelection_fnPaste(ITextSelection *me, VARIANT *v, LONG format)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %x): stub\n", This, debugstr_variant(v), format);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5434,11 +5341,11 @@ static HRESULT WINAPI ITextSelection_fnPaste(ITextSelection *me, VARIANT *v, LON
static HRESULT WINAPI ITextSelection_fnCanPaste(ITextSelection *me, VARIANT *v, LONG format,
LONG *ret)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s %x %p): stub\n", This, debugstr_variant(v), format, ret);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5446,11 +5353,11 @@ static HRESULT WINAPI ITextSelection_fnCanPaste(ITextSelection *me, VARIANT *v,
static HRESULT WINAPI ITextSelection_fnCanEdit(ITextSelection *me, LONG *ret)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, ret);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5458,11 +5365,11 @@ static HRESULT WINAPI ITextSelection_fnCanEdit(ITextSelection *me, LONG *ret)
static HRESULT WINAPI ITextSelection_fnChangeCase(ITextSelection *me, LONG type)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d): stub\n", This, type);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5470,11 +5377,11 @@ static HRESULT WINAPI ITextSelection_fnChangeCase(ITextSelection *me, LONG type)
static HRESULT WINAPI ITextSelection_fnGetPoint(ITextSelection *me, LONG type, LONG *cx, LONG *cy)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %p %p): stub\n", This, type, cx, cy);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5483,11 +5390,11 @@ static HRESULT WINAPI ITextSelection_fnGetPoint(ITextSelection *me, LONG type, L
static HRESULT WINAPI ITextSelection_fnSetPoint(ITextSelection *me, LONG x, LONG y, LONG type,
LONG extend)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d %d): stub\n", This, x, y, type, extend);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5495,11 +5402,11 @@ static HRESULT WINAPI ITextSelection_fnSetPoint(ITextSelection *me, LONG x, LONG
static HRESULT WINAPI ITextSelection_fnScrollIntoView(ITextSelection *me, LONG value)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d): stub\n", This, value);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5507,11 +5414,11 @@ static HRESULT WINAPI ITextSelection_fnScrollIntoView(ITextSelection *me, LONG v
static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(ITextSelection *me, IUnknown **ppv)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, ppv);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5520,11 +5427,11 @@ static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(ITextSelection *me, IUn
/*** ITextSelection methods ***/
static HRESULT WINAPI ITextSelection_fnGetFlags(ITextSelection *me, LONG *flags)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, flags);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5532,11 +5439,11 @@ static HRESULT WINAPI ITextSelection_fnGetFlags(ITextSelection *me, LONG *flags)
static HRESULT WINAPI ITextSelection_fnSetFlags(ITextSelection *me, LONG flags)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%x): stub\n", This, flags);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5544,11 +5451,11 @@ static HRESULT WINAPI ITextSelection_fnSetFlags(ITextSelection *me, LONG flags)
static HRESULT WINAPI ITextSelection_fnGetType(ITextSelection *me, LONG *type)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%p): stub\n", This, type);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5557,11 +5464,11 @@ static HRESULT WINAPI ITextSelection_fnGetType(ITextSelection *me, LONG *type)
static HRESULT WINAPI ITextSelection_fnMoveLeft(ITextSelection *me, LONG unit, LONG count,
LONG extend, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d %p): stub\n", This, unit, count, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5570,11 +5477,11 @@ static HRESULT WINAPI ITextSelection_fnMoveLeft(ITextSelection *me, LONG unit, L
static HRESULT WINAPI ITextSelection_fnMoveRight(ITextSelection *me, LONG unit, LONG count,
LONG extend, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d %p): stub\n", This, unit, count, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5583,11 +5490,11 @@ static HRESULT WINAPI ITextSelection_fnMoveRight(ITextSelection *me, LONG unit,
static HRESULT WINAPI ITextSelection_fnMoveUp(ITextSelection *me, LONG unit, LONG count,
LONG extend, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d %p): stub\n", This, unit, count, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5596,11 +5503,11 @@ static HRESULT WINAPI ITextSelection_fnMoveUp(ITextSelection *me, LONG unit, LON
static HRESULT WINAPI ITextSelection_fnMoveDown(ITextSelection *me, LONG unit, LONG count,
LONG extend, LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %d %p): stub\n", This, unit, count, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5609,11 +5516,11 @@ static HRESULT WINAPI ITextSelection_fnMoveDown(ITextSelection *me, LONG unit, L
static HRESULT WINAPI ITextSelection_fnHomeKey(ITextSelection *me, LONG unit, LONG extend,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5622,11 +5529,11 @@ static HRESULT WINAPI ITextSelection_fnHomeKey(ITextSelection *me, LONG unit, LO
static HRESULT WINAPI ITextSelection_fnEndKey(ITextSelection *me, LONG unit, LONG extend,
LONG *delta)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta);
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5634,11 +5541,11 @@ static HRESULT WINAPI ITextSelection_fnEndKey(ITextSelection *me, LONG unit, LON
static HRESULT WINAPI ITextSelection_fnTypeText(ITextSelection *me, BSTR text)
{
- ITextSelectionImpl *This = impl_from_ITextSelection(me);
+ struct text_selection *This = impl_from_ITextSelection(me);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(text));
- if (!This->reOle)
+ if (!This->services)
return CO_E_RELEASED;
return E_NOTIMPL;
@@ -5715,46 +5622,18 @@ static const ITextSelectionVtbl tsvt = {
ITextSelection_fnTypeText
};
-static ITextSelectionImpl *
-CreateTextSelection(IRichEditOleImpl *reOle)
+static struct text_selection *text_selection_create(struct text_services *services)
{
- ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
+ struct text_selection *txtSel = heap_alloc(sizeof *txtSel);
if (!txtSel)
return NULL;
txtSel->ITextSelection_iface.lpVtbl = &tsvt;
txtSel->ref = 1;
- txtSel->reOle = reOle;
+ txtSel->services = services;
return txtSel;
}
-LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj)
-{
- IRichEditOleImpl *reo;
-
- reo = heap_alloc(sizeof(IRichEditOleImpl));
- if (!reo)
- return 0;
-
- reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl;
- reo->IRichEditOle_iface.lpVtbl = &revt;
- reo->ITextDocument2Old_iface.lpVtbl = &tdvt;
- reo->ref = 1;
- reo->editor = editor;
- reo->txtSel = NULL;
-
- TRACE("Created %p\n",reo);
- list_init(&reo->rangelist);
- list_init(&reo->clientsites);
- if (outer_unk)
- reo->outer_unk = outer_unk;
- else
- reo->outer_unk = &reo->IUnknown_inner;
- *ppvObj = &reo->IUnknown_inner;
-
- return 1;
-}
-
static void convert_sizel(const ME_Context *c, const SIZEL* szl, SIZE* sz)
{
/* sizel is in .01 millimeters, sz in pixels */
@@ -5970,3 +5849,21 @@ void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags)
IOleClientSite_AddRef(dst->polesite);
}
}
+
+void richole_release_children( struct text_services *services )
+{
+ ITextRangeImpl *range;
+ IOleClientSiteImpl *site;
+
+ if (services->text_selection)
+ {
+ services->text_selection->services = NULL;
+ ITextSelection_Release( &services->text_selection->ITextSelection_iface );
+ }
+
+ LIST_FOR_EACH_ENTRY( range, &services->rangelist, ITextRangeImpl, child.entry )
+ range->child.reole = NULL;
+
+ LIST_FOR_EACH_ENTRY( site, &services->clientsites, IOleClientSiteImpl, child.entry )
+ site->child.reole = NULL;
+}
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 80e4682880f..73b8d3ea7e9 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -32,16 +32,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
-struct text_services
-{
- IUnknown IUnknown_inner;
- ITextServices ITextServices_iface;
- IUnknown *outer_unk;
- LONG ref;
- ME_TextEditor *editor;
- char spare[256]; /* for bug #12179 */
-};
-
static inline struct text_services *impl_from_IUnknown( IUnknown *iface )
{
return CONTAINING_RECORD( iface, struct text_services, IUnknown_inner );
@@ -55,13 +45,10 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface( IUnknown *iface, REFIID
if (IsEqualIID( iid, &IID_IUnknown )) *obj = &services->IUnknown_inner;
else if (IsEqualIID( iid, &IID_ITextServices )) *obj = &services->ITextServices_iface;
- else if (IsEqualIID( iid, &IID_IRichEditOle ) || IsEqualIID( iid, &IID_ITextDocument ) ||
- IsEqualIID( iid, &IID_ITextDocument2Old ))
- {
- if (!services->editor->reOle && !CreateIRichEditOle( services->outer_unk, services->editor, (void **)&services->editor->reOle ))
- return E_OUTOFMEMORY;
- return IUnknown_QueryInterface( services->editor->reOle, iid, obj );
- }
+ else if (IsEqualIID( iid, &IID_IRichEditOle )) *obj= &services->IRichEditOle_iface;
+ else if (IsEqualIID( iid, &IID_IDispatch ) ||
+ IsEqualIID( iid, &IID_ITextDocument ) ||
+ IsEqualIID( iid, &IID_ITextDocument2Old )) *obj = &services->ITextDocument2Old_iface;
else
{
*obj = NULL;
@@ -92,6 +79,7 @@ static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
if (!ref)
{
+ richole_release_children( services );
ME_DestroyEditor( services->editor );
CoTaskMemFree( services );
}
@@ -597,11 +585,18 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
services->ref = 1;
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
services->ITextServices_iface.lpVtbl = &textservices_vtbl;
+ services->IRichEditOle_iface.lpVtbl = &re_ole_vtbl;
+ services->ITextDocument2Old_iface.lpVtbl = &text_doc2old_vtbl;
services->editor = ME_MakeEditor( text_host, emulate_10 );
+ services->editor->richole = &services->IRichEditOle_iface;
if (outer) services->outer_unk = outer;
else services->outer_unk = &services->IUnknown_inner;
+ services->text_selection = NULL;
+ list_init( &services->rangelist );
+ list_init( &services->clientsites );
+
*unk = &services->IUnknown_inner;
return S_OK;
}
--
2.23.0
1
0
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index fe05d1e7444..deb0a93c8dc 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -279,6 +279,11 @@ ME_Paragraph *editor_end_para( ME_TextEditor *editor )
return &editor->pBuffer->pLast->member.para;
}
+static BOOL editor_beep( ME_TextEditor *editor, UINT type )
+{
+ return editor->props & TXTBIT_ALLOWBEEP && MessageBeep( type );
+}
+
static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStream *stream, ME_Style *style)
{
WCHAR *pText;
@@ -2281,7 +2286,7 @@ static BOOL paste_special(ME_TextEditor *editor, UINT cf, REPASTESPECIAL *ps, BO
/* Protect read-only edit control from modification */
if (editor->props & TXTBIT_READONLY)
{
- if (!check_only) MessageBeep(MB_ICONERROR);
+ if (!check_only) editor_beep( editor, MB_ICONERROR );
return FALSE;
}
@@ -2379,7 +2384,7 @@ static BOOL copy_or_cut( ME_TextEditor *editor, BOOL cut )
count -= offs;
hr = editor_copy_or_cut( editor, cut, sel_start, count, NULL );
- if (FAILED( hr )) MessageBeep( MB_ICONERROR );
+ if (FAILED( hr )) editor_beep( editor, MB_ICONERROR );
return SUCCEEDED( hr );
}
@@ -2422,7 +2427,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
if (editor->props & TXTBIT_READONLY)
{
- MessageBeep(MB_ICONERROR);
+ editor_beep( editor, MB_ICONERROR );
return TRUE;
}
@@ -2683,7 +2688,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
if (editor->props & TXTBIT_READONLY)
{
- MessageBeep(MB_ICONERROR);
+ editor_beep( editor, MB_ICONERROR );
return 0; /* FIXME really 0 ? */
}
@@ -2737,7 +2742,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
if (para_in_table( para ) && cursor.run->nFlags & MERF_ENDPARA && from == to)
{
/* Text should not be inserted at the end of the table. */
- MessageBeep(-1);
+ editor_beep( editor, -1 );
return 0;
}
}
@@ -2951,7 +2956,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->total_rows = 0;
ITextHost_TxGetPropertyBits( ed->texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY |
TXTBIT_USEPASSWORD | TXTBIT_HIDESELECTION | TXTBIT_SAVESELECTION |
- TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_DISABLEDRAG,
+ TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_ALLOWBEEP |
+ TXTBIT_DISABLEDRAG,
&ed->props );
ITextHost_TxGetScrollBars( ed->texthost, &ed->scrollbars );
ed->pBuffer = ME_MakeText();
--
2.23.0
1
0
31 Mar '21
This moves running and waiting for the test executable out of main().
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/src/TestLauncher/TestLauncher.c | 162 +++++++++++++-----------
1 file changed, 85 insertions(+), 77 deletions(-)
diff --git a/testbot/src/TestLauncher/TestLauncher.c b/testbot/src/TestLauncher/TestLauncher.c
index b024714ac..022f25c98 100644
--- a/testbot/src/TestLauncher/TestLauncher.c
+++ b/testbot/src/TestLauncher/TestLauncher.c
@@ -208,6 +208,86 @@ BOOL CALLBACK DetectCriticalErrorDialog(HWND TopWnd, LPARAM lParam)
return TRUE;
}
+DWORD Start;
+
+DWORD RunTest(char *TestExeFileName, char* CommandLine, DWORD TimeOut, DWORD *Pid)
+{
+ STARTUPINFOA StartupInfo;
+ PROCESS_INFORMATION ProcessInformation;
+ DWORD ExitCode, WaitTimeOut;
+
+ StartupInfo.cb = sizeof(STARTUPINFOA);
+ GetStartupInfoA(&StartupInfo);
+ StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
+ StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
+ StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+ StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+
+ /* Unlike WineTest we do not have the luxury of first running the test with
+ * a --list argument. This means we cannot use SetErrorMode() to check
+ * whether there are missing dependencies as it could modify the test
+ * results...
+ */
+ if (! CreateProcessA(NULL, CommandLine, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartupInfo, &ProcessInformation))
+ {
+ Error("CreateProcess failed (error %lu)\n", GetLastError());
+ ExitProcess(1);
+ }
+ CloseHandle(ProcessInformation.hThread);
+ *Pid = ProcessInformation.dwProcessId;
+
+ WaitTimeOut = 100;
+ ExitCode = WAIT_TIMEOUT;
+ while (ExitCode == WAIT_TIMEOUT)
+ {
+ DWORD Elapsed, Remaining;
+
+ ExitCode = WaitForSingleObject(ProcessInformation.hProcess, WaitTimeOut);
+ Elapsed = GetTickCount() - Start;
+ if (ExitCode != WAIT_TIMEOUT || Elapsed > TimeOut)
+ break;
+
+ /* ...instead detect the critical error dialog that pops up */
+ EnumWindows(DetectCriticalErrorDialog, (LPARAM)TestExeFileName);
+ if (Skips)
+ {
+ ExitCode = WAIT_OBJECT_0;
+ break;
+ }
+
+ Remaining = TimeOut == INFINITE ? TimeOut : TimeOut - Elapsed;
+ WaitTimeOut = (Elapsed > 3000) ? Remaining :
+ (2 * WaitTimeOut < Remaining) ? 2 * WaitTimeOut :
+ Remaining;
+ }
+
+ if (ExitCode != WAIT_OBJECT_0)
+ {
+ switch (ExitCode)
+ {
+ case WAIT_FAILED:
+ Error("Wait for child failed (error %lu)\n", GetLastError());
+ break;
+
+ case WAIT_TIMEOUT:
+ /* The 'exit code' on the done line identifies timeouts */
+ break;
+
+ default:
+ Error("Unexpected return value %lu from wait for child\n", ExitCode);
+ break;
+ }
+ if (!TerminateProcess(ProcessInformation.hProcess, 257))
+ Error("TerminateProcess failed (error %lu)\n", GetLastError());
+ }
+ else if (!Skips && !GetExitCodeProcess(ProcessInformation.hProcess, &ExitCode))
+ {
+ Error("Could not get the child exit code (error %lu)\n", GetLastError());
+ ExitCode = 259;
+ }
+ CloseHandle(ProcessInformation.hProcess);
+ return ExitCode;
+}
/*
* Command line parsing and test running.
@@ -216,7 +296,7 @@ BOOL CALLBACK DetectCriticalErrorDialog(HWND TopWnd, LPARAM lParam)
int main(int argc, char *argv[])
{
int Arg;
- DWORD Start, TimeOut, WaitTimeOut;
+ DWORD TimeOut;
BOOL UsageError;
char TestExeFullName[MAX_PATH];
char *TestExeFileName;
@@ -225,9 +305,7 @@ int main(int argc, char *argv[])
int TestArg;
char *CommandLine, *p;
int CommandLen;
- STARTUPINFOA StartupInfo;
- PROCESS_INFORMATION ProcessInformation;
- DWORD ExitCode;
+ DWORD Pid, ExitCode;
Name0 = p = argv[0];
while (*p != '\0')
@@ -340,82 +418,12 @@ int main(int argc, char *argv[])
printf("%s:%s start -\n", TestName, Subtest);
fflush(stdout);
- StartupInfo.cb = sizeof(STARTUPINFOA);
- GetStartupInfoA(&StartupInfo);
- StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
- StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
-
- /* Unlike WineTest we do not have the luxury of first running the test with
- * a --list argument. This means we cannot use SetErrorMode() to check
- * whether there are missing dependencies as it could modify the test
- * results...
- */
- if (! CreateProcessA(NULL, CommandLine, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartupInfo, &ProcessInformation))
- {
- Error("CreateProcess failed (error %lu)\n", GetLastError());
- return 1;
- }
- CloseHandle(ProcessInformation.hThread);
-
- WaitTimeOut = 100;
- ExitCode = WAIT_TIMEOUT;
- while (ExitCode == WAIT_TIMEOUT)
- {
- DWORD Elapsed, Remaining;
-
- ExitCode = WaitForSingleObject(ProcessInformation.hProcess, WaitTimeOut);
- Elapsed = GetTickCount() - Start;
- if (ExitCode != WAIT_TIMEOUT || Elapsed > TimeOut)
- break;
-
- /* ...instead detect the critical error dialog that pops up */
- EnumWindows(DetectCriticalErrorDialog, (LPARAM)TestExeFileName);
- if (Skips)
- {
- ExitCode = WAIT_OBJECT_0;
- break;
- }
-
- Remaining = TimeOut == INFINITE ? TimeOut : TimeOut - Elapsed;
- WaitTimeOut = (Elapsed > 3000) ? Remaining :
- (2 * WaitTimeOut < Remaining) ? 2 * WaitTimeOut :
- Remaining;
- }
-
- if (ExitCode != WAIT_OBJECT_0)
- {
- switch (ExitCode)
- {
- case WAIT_FAILED:
- Error("Wait for child failed (error %lu)\n", GetLastError());
- break;
-
- case WAIT_TIMEOUT:
- /* The 'exit code' on the done line identifies timeouts */
- break;
-
- default:
- Error("Unexpected return value %lu from wait for child\n", ExitCode);
- break;
- }
- if (!TerminateProcess(ProcessInformation.hProcess, 257))
- Error("TerminateProcess failed (error %lu)\n", GetLastError());
- }
- else if (!Skips && !GetExitCodeProcess(ProcessInformation.hProcess, &ExitCode))
- {
- Error("Could not get the child exit code (error %lu)\n", GetLastError());
- ExitCode = 259;
- }
- CloseHandle(ProcessInformation.hProcess);
-
+ ExitCode = RunTest(TestExeFileName, CommandLine, TimeOut, &Pid);
if (Skips)
- printf("%04lx:%s: 0 tests executed (0 marked as todo, 0 failures), %u skipped.\n", ProcessInformation.dwProcessId, Subtest, Skips);
+ printf("%04lx:%s: 0 tests executed (0 marked as todo, 0 failures), %u skipped.\n", Pid, Subtest, Skips);
printf("%s:%s:%04lx done (%ld) in %lds\n", TestName, Subtest,
- ProcessInformation.dwProcessId, ExitCode,
- (GetTickCount() - Start) / 1000);
+ Pid, ExitCode, (GetTickCount() - Start) / 1000);
return 0;
}
--
2.20.1
1
2
31 Mar '21
Exercise handling of the messages dealing with missing dlls, dll loading
errors, and dll version detection errors.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/src/reporttest/report.template | 20 ++++++++++----------
testbot/src/reporttest/report.testwtbs | 6 +++++-
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/testbot/src/reporttest/report.template b/testbot/src/reporttest/report.template
index 9624c9065..f1dbfd618 100644
--- a/testbot/src/reporttest/report.template
+++ b/testbot/src/reporttest/report.template
@@ -198,16 +198,16 @@ Dll info:
wldap32=5.1.2600.5512
wmiutils=5.1.2600.5512
wmp=11.0.5721.5280
- wpc=dll is missing
- ws2_32=5.1.2600.5512
- wscript.exe=5.7.0.18066
- wshom.ocx=5.7.0.18066
- wsnmp32=5.1.2600.5512
- wtsapi32=5.1.2600.5512
- xaudio2_7=dll is missing
- xcopy.exe=5.1.2600.5512
- xinput1_3=dll is missing
- xmllite=1.0.1018.0
+ wpc=dll is native
+ ws2_32=dll is a stub
+ wscript.exe=dll is missing
+ wshom.ocx=dll is missing an ordinal (1.0)
+ wsnmp32=dll is missing an entrypoint (version not found)
+ wtsapi32=dll is missing the requested side-by-side version
+ xaudio2_7=load error 5
+ xcopy.exe=version not found
+ xinput1_3=version error 5
+ xmllite=version not present 2
Test output:
stub advapi32:cred
----- WTBS Simple test patch
diff --git a/testbot/src/reporttest/report.testwtbs b/testbot/src/reporttest/report.testwtbs
index 104c8ea60..7b56e1310 100644
--- a/testbot/src/reporttest/report.testwtbs
+++ b/testbot/src/reporttest/report.testwtbs
@@ -13,12 +13,16 @@ with:
----- TestWTBS -----
-p tests.TestFailures 68
+p tests.TestFailures 70
p build.HasTask 0
a wine.log.GrepV ^Applying patch
a wine.log.GrepV ^Rebuilding the
+g 0 tests.report.
+n 0 wpc=dll is native
+n 0 xaudio2_7=load error 5
+
g 0 tests.report.advapi32
n 0 crypt.c:1: Test failed: Something wrong
n 0 crypt_lmhash.c:10: Test failed: Something wrong
--
2.20.1
1
0
[tools] testbot/PatchUtils: There is no need to migrate the make_* flags.
by Francois Gouget 31 Mar '21
by Francois Gouget 31 Mar '21
31 Mar '21
They impact the build, and only the build, no matter which patchset part
they appear in.
This is confirmed by the old code which moved them from $Impacts to
$PastImpacts and then back to $Impacts.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/PatchUtils.pm | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index 796457a21..87e4508ba 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -423,10 +423,7 @@ sub GetPatchImpacts($)
$Impacts->{BuildModules} = {};
# Also backup the build-related fields.
- foreach my $Field ("Autoconf", "MakeErrors", "MakeFir", "MakeMakefiles",
- "MakeOpenGL", "MakeRequests", "MakeUnicode",
- "MakeVulkan",
- "PatchedRoot", "PatchedModules", "PatchedTests")
+ foreach my $Field ("PatchedRoot", "PatchedModules", "PatchedTests")
{
$PastImpacts->{$Field} = $Impacts->{$Field};
$Impacts->{$Field} = undef;
@@ -518,12 +515,6 @@ sub GetPatchImpacts($)
# ... even if the patch was in previous parts
if ($PastImpacts)
{
- foreach my $Field ("Autoconf", "MakeErrors", "MakeFir", "MakeMakefiles",
- "MakeOpenGL", "MakeRequests", "MakeUnicode",
- "MakeVulkan")
- {
- $Impacts->{$Field} ||= $PastImpacts->{$Field};
- }
$Impacts->{RebuildRoot} ||= $PastImpacts->{PatchedRoot};
$Impacts->{RebuildModules} ||= $PastImpacts->{PatchedModules};
map { $Impacts->{BuildModules}->{$_} = 1 } keys %{$PastImpacts->{BuildModules}};
--
2.20.1
1
0
[tools] testbot/WineTest: Always return the mission base name in SetupTest().
by Francois Gouget 31 Mar '21
by Francois Gouget 31 Mar '21
31 Mar '21
WineTest runs the tests even if the wineprefix creation failed so
developers have as much information as possible. So it needs to know the
mission base name either way.
The tests will be considered to be failed anyway since the wineprefix
creation failure could be caused by the patch.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/build/WineTest.pl | 1 -
1 file changed, 1 deletion(-)
diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl
index c4a1216b0..ffd665faa 100755
--- a/testbot/bin/build/WineTest.pl
+++ b/testbot/bin/build/WineTest.pl
@@ -71,7 +71,6 @@ sub SetupTest($$)
if (defined $ErrMessage)
{
LogMsg "Could not create the $BaseName wineprefix: $ErrMessage\n";
- return 0;
}
}
--
2.20.1
1
0
[PATCH v2 1/2] ntdll/tests: Add committed / reserved thread stack sizes tests.
by Rémi Bernon 31 Mar '21
by Rémi Bernon 31 Mar '21
31 Mar '21
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
v2: Clear around 1MB of stack instead of a few pages, and keep setting
the stack pointer while doing it.
dlls/ntdll/tests/virtual.c | 264 +++++++++++++++++++++++++++++++++++++
1 file changed, 264 insertions(+)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
index 546a7d83bbd..112be80c01e 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.c
@@ -237,14 +237,266 @@ static void test_NtAllocateVirtualMemory(void)
ok(status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemoryEx returned %08x\n", status);
}
+struct test_stack_size_thread_args
+{
+ DWORD expect_committed;
+ DWORD expect_reserved;
+};
+
+static void force_stack_grow(void)
+{
+ volatile int buffer[0x2000];
+ buffer[0] = 0xdeadbeef;
+ (void)buffer[0];
+}
+
+#ifdef _WIN64
+static void force_stack_grow_small(void)
+{
+ volatile int buffer[0x400];
+ buffer[0] = 0xdeadbeef;
+ (void)buffer[0];
+}
+#endif
+
+static DWORD WINAPI test_stack_size_thread(void *ptr)
+{
+ struct test_stack_size_thread_args *args = ptr;
+ MEMORY_BASIC_INFORMATION mbi;
+ NTSTATUS status;
+ SIZE_T size, guard_size;
+ DWORD committed, reserved;
+ void *addr;
+#ifdef _WIN64
+ DWORD prot;
+ void *tmp;
+#endif
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ reserved = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->DeallocationStack;
+ todo_wine ok( committed == args->expect_committed || broken(committed == 0x1000), "unexpected stack committed size %x, expected %x\n", committed, args->expect_committed );
+ ok( reserved == args->expect_reserved, "unexpected stack reserved size %x, expected %x\n", reserved, args->expect_reserved );
+
+ addr = (char *)NtCurrentTeb()->DeallocationStack;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
+ todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#x, expected %#x\n", mbi.State, MEM_RESERVE );
+ todo_wine ok( mbi.Protect == 0, "unexpected Protect %#x, expected %#x\n", mbi.Protect, 0 );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+
+
+ force_stack_grow();
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ reserved = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->DeallocationStack;
+ todo_wine ok( committed == 0x9000, "unexpected stack committed size %x, expected 9000\n", committed );
+ ok( reserved == args->expect_reserved, "unexpected stack reserved size %x, expected %x\n", reserved, args->expect_reserved );
+
+
+ /* reserved area shrinks whenever stack grows */
+
+ addr = (char *)NtCurrentTeb()->DeallocationStack;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
+ todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#x, expected %#x\n", mbi.State, MEM_RESERVE );
+ todo_wine ok( mbi.Protect == 0, "unexpected Protect %#x, expected %#x\n", mbi.Protect, 0 );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+
+ guard_size = reserved - committed - mbi.RegionSize;
+ ok( guard_size == 0x1000 || guard_size == 0x2000 || guard_size == 0x3000, "unexpected guard_size %I64x, expected 1000, 2000 or 3000\n", (UINT64)guard_size );
+
+ /* the commit area is initially preceded by guard pages */
+
+ addr = (char *)NtCurrentTeb()->DeallocationStack + mbi.RegionSize;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
+ ok( mbi.RegionSize == guard_size, "unexpected RegionSize %I64x, expected 3000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE|PAGE_GUARD );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
+ ok( mbi.RegionSize == committed, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)committed );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+
+
+#ifdef _WIN64
+ /* setting a guard page shrinks stack automatically */
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
+ size = 0x1000;
+ status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
+ ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)addr - 0x2000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.RegionSize == 0x2000, "unexpected RegionSize %I64x, expected 2000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ todo_wine ok( mbi.RegionSize == 0x6000, "unexpected RegionSize %I64x, expected 6000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+
+ /* guard pages are restored as the stack grows back */
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x4000;
+ tmp = (char *)addr - guard_size - 0x1000;
+ size = 0x1000;
+ status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
+ ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x1000, "unexpected stack committed size %x, expected 1000\n", committed );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), tmp, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ todo_wine ok( mbi.RegionSize == guard_size + 0x1000, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)(guard_size + 0x1000) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+ force_stack_grow_small();
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x2000, "unexpected stack committed size %x, expected 2000\n", committed );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), tmp, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)tmp + 0x1000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.RegionSize == guard_size, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)guard_size );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+
+
+ /* forcing stack limit over guard pages still shrinks the stack on page fault */
+
+ addr = (char *)tmp + guard_size + 0x1000;
+ size = 0x1000;
+ status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
+ ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+
+ NtCurrentTeb()->Tib.StackLimit = (char *)tmp;
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)tmp + 0x1000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ todo_wine ok( mbi.RegionSize == guard_size + 0x1000, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)(guard_size + 0x1000) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+
+ force_stack_grow_small();
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x2000, "unexpected stack committed size %x, expected 2000\n", committed );
+
+
+ /* it works with NtProtectVirtualMemory as well */
+
+ force_stack_grow();
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
+ size = 0x1000;
+ status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE | PAGE_GUARD, &prot );
+ ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
+ todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#x, expected %#x\n", prot, PAGE_READWRITE );
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)addr - 0x2000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ todo_wine ok( mbi.RegionSize == 0x2000, "unexpected RegionSize %I64x, expected 2000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit;
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
+ ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ todo_wine ok( mbi.RegionSize == 0x6000, "unexpected RegionSize %I64x, expected 6000\n", (UINT64)mbi.RegionSize );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+
+
+ /* clearing the guard pages doesn't change StackLimit back */
+
+ force_stack_grow();
+
+ addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
+ size = 0x1000;
+ status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE | PAGE_GUARD, &prot );
+ ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
+ todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#x, expected %#x\n", prot, PAGE_READWRITE );
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+
+ status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE, &prot );
+ ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
+ ok( prot == (PAGE_READWRITE | PAGE_GUARD), "unexpected prot %#x, expected %#x\n", prot, (PAGE_READWRITE | PAGE_GUARD) );
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+
+ /* and as we messed with it and it now doesn't fault, it doesn't grow back either */
+
+ force_stack_grow();
+
+ committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+#endif
+
+ return 0;
+}
+
static void test_RtlCreateUserStack(void)
{
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
+ struct test_stack_size_thread_args args;
SIZE_T default_commit = nt->OptionalHeader.SizeOfStackCommit;
SIZE_T default_reserve = nt->OptionalHeader.SizeOfStackReserve;
INITIAL_TEB stack = {0};
unsigned int i;
NTSTATUS ret;
+ HANDLE thread;
struct
{
@@ -298,6 +550,18 @@ static void test_RtlCreateUserStack(void)
ret = pRtlCreateUserStack(0x11000, 0x110000, 0, 0, 1, &stack);
ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
+
+ args.expect_committed = 0x4000;
+ args.expect_reserved = default_reserve;
+ thread = CreateThread(NULL, 0x3f00, test_stack_size_thread, &args, 0, NULL);
+ WaitForSingleObject(thread, INFINITE);
+ CloseHandle(thread);
+
+ args.expect_committed = default_commit < 0x2000 ? 0x2000 : default_commit;
+ args.expect_reserved = 0x400000;
+ thread = CreateThread(NULL, 0x3ff000, test_stack_size_thread, &args, STACK_SIZE_PARAM_IS_A_RESERVATION, NULL);
+ WaitForSingleObject(thread, INFINITE);
+ CloseHandle(thread);
}
static void test_NtMapViewOfSection(void)
--
2.30.2
1
1
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
configure | 2 ++
configure.ac | 1 +
dlls/api-ms-win-shcore-stream-winrt-l1-1-0/Makefile.in | 1 +
.../api-ms-win-shcore-stream-winrt-l1-1-0.spec | 1 +
tools/make_specfiles | 1 +
5 files changed, 6 insertions(+)
create mode 100644 dlls/api-ms-win-shcore-stream-winrt-l1-1-0/Makefile.in
create mode 100644 dlls/api-ms-win-shcore-stream-winrt-l1-1-0/api-ms-win-shcore-stream-winrt-l1-1-0.spec
diff --git a/configure b/configure
index 5d430365ea4..a19bb0b9581 100755
--- a/configure
+++ b/configure
@@ -1143,6 +1143,7 @@ enable_api_ms_win_service_winsvc_l1_2_0
enable_api_ms_win_shcore_obsolete_l1_1_0
enable_api_ms_win_shcore_scaling_l1_1_1
enable_api_ms_win_shcore_stream_l1_1_0
+enable_api_ms_win_shcore_stream_winrt_l1_1_0
enable_api_ms_win_shcore_thread_l1_1_0
enable_api_ms_win_shell_shellcom_l1_1_0
enable_api_ms_win_shell_shellfolders_l1_1_0
@@ -20349,6 +20350,7 @@ wine_fn_config_makefile dlls/api-ms-win-service-winsvc-l1-2-0 enable_api_ms_win_
wine_fn_config_makefile dlls/api-ms-win-shcore-obsolete-l1-1-0 enable_api_ms_win_shcore_obsolete_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-shcore-scaling-l1-1-1 enable_api_ms_win_shcore_scaling_l1_1_1
wine_fn_config_makefile dlls/api-ms-win-shcore-stream-l1-1-0 enable_api_ms_win_shcore_stream_l1_1_0
+wine_fn_config_makefile dlls/api-ms-win-shcore-stream-winrt-l1-1-0 enable_api_ms_win_shcore_stream_winrt_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-shcore-thread-l1-1-0 enable_api_ms_win_shcore_thread_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-shell-shellcom-l1-1-0 enable_api_ms_win_shell_shellcom_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-shell-shellfolders-l1-1-0 enable_api_ms_win_shell_shellfolders_l1_1_0
diff --git a/configure.ac b/configure.ac
index afd46b353ea..eb08e8b0f17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3025,6 +3025,7 @@ WINE_CONFIG_MAKEFILE(dlls/api-ms-win-service-winsvc-l1-2-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shcore-obsolete-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shcore-scaling-l1-1-1)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shcore-stream-l1-1-0)
+WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shcore-stream-winrt-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shcore-thread-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shell-shellcom-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-shell-shellfolders-l1-1-0)
diff --git a/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/Makefile.in b/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/Makefile.in
new file mode 100644
index 00000000000..7af35b2eed6
--- /dev/null
+++ b/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/Makefile.in
@@ -0,0 +1 @@
+MODULE = api-ms-win-shcore-stream-winrt-l1-1-0.dll
diff --git a/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/api-ms-win-shcore-stream-winrt-l1-1-0.spec b/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/api-ms-win-shcore-stream-winrt-l1-1-0.spec
new file mode 100644
index 00000000000..e30eb81184d
--- /dev/null
+++ b/dlls/api-ms-win-shcore-stream-winrt-l1-1-0/api-ms-win-shcore-stream-winrt-l1-1-0.spec
@@ -0,0 +1 @@
+@ stub CreateRandomAccessStreamOverStream
diff --git a/tools/make_specfiles b/tools/make_specfiles
index 3689a856b9f..9ff4974641a 100755
--- a/tools/make_specfiles
+++ b/tools/make_specfiles
@@ -356,6 +356,7 @@ my @dll_groups =
"api-ms-win-shcore-obsolete-l1-1-0",
"api-ms-win-shcore-thread-l1-1-0",
"api-ms-win-shcore-stream-l1-1-0",
+ "api-ms-win-shcore-stream-winrt-l1-1-0",
],
[
"shell32",
--
2.30.2
1
0