ReactOS  0.4.13-dev-257-gfabbd7c
main.c File Reference
#include "wine/test.h"
#include <stdio.h>
#include "initguid.h"
#include "oledlg.h"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

static const WCHARstrstrW (const WCHAR *str, const WCHAR *sub)
 
static HRESULT WINAPI enumverbs_QueryInterface (IEnumOLEVERB *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI enumverbs_AddRef (IEnumOLEVERB *iface)
 
static ULONG WINAPI enumverbs_Release (IEnumOLEVERB *iface)
 
static HRESULT WINAPI enumverbs_Next (IEnumOLEVERB *iface, ULONG count, OLEVERB *verbs, ULONG *fetched)
 
static HRESULT WINAPI enumverbs_Skip (IEnumOLEVERB *iface, ULONG count)
 
static HRESULT WINAPI enumverbs_Reset (IEnumOLEVERB *iface)
 
static HRESULT WINAPI enumverbs_Clone (IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
 
static HRESULT WINAPI oleobject_QueryInterface (IOleObject *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI oleobject_AddRef (IOleObject *iface)
 
static ULONG WINAPI oleobject_Release (IOleObject *iface)
 
static HRESULT WINAPI oleobject_SetClientSite (IOleObject *iface, IOleClientSite *site)
 
static HRESULT WINAPI oleobject_GetClientSite (IOleObject *iface, IOleClientSite **site)
 
static HRESULT WINAPI oleobject_SetHostNames (IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerObj)
 
static HRESULT WINAPI oleobject_Close (IOleObject *iface, DWORD saveopt)
 
static HRESULT WINAPI oleobject_SetMoniker (IOleObject *iface, DWORD whichmoniker, IMoniker *mk)
 
static HRESULT WINAPI oleobject_GetMoniker (IOleObject *iface, DWORD assign, DWORD whichmoniker, IMoniker **mk)
 
static HRESULT WINAPI oleobject_InitFromData (IOleObject *iface, IDataObject *dataobject, BOOL creation, DWORD reserved)
 
static HRESULT WINAPI oleobject_GetClipboardData (IOleObject *iface, DWORD reserved, IDataObject **dataobject)
 
static HRESULT WINAPI oleobject_DoVerb (IOleObject *iface, LONG verb, MSG *msg, IOleClientSite *activesite, LONG index, HWND hwndParent, LPCRECT rect)
 
static HRESULT WINAPI oleobject_EnumVerbs (IOleObject *iface, IEnumOLEVERB **enumverb)
 
static HRESULT WINAPI oleobject_Update (IOleObject *iface)
 
static HRESULT WINAPI oleobject_IsUpToDate (IOleObject *iface)
 
static HRESULT WINAPI oleobject_GetUserClassID (IOleObject *iface, CLSID *clsid)
 
static HRESULT WINAPI oleobject_GetUserType (IOleObject *iface, DWORD formoftype, LPOLESTR *usertype)
 
static HRESULT WINAPI oleobject_SetExtent (IOleObject *iface, DWORD aspect, SIZEL *size)
 
static HRESULT WINAPI oleobject_GetExtent (IOleObject *iface, DWORD aspect, SIZEL *size)
 
static HRESULT WINAPI oleobject_Advise (IOleObject *iface, IAdviseSink *sink, DWORD *connection)
 
static HRESULT WINAPI oleobject_Unadvise (IOleObject *iface, DWORD connection)
 
static HRESULT WINAPI oleobject_EnumAdvise (IOleObject *iface, IEnumSTATDATA **enumadvise)
 
static HRESULT WINAPI oleobject_GetMiscStatus (IOleObject *iface, DWORD aspect, DWORD *status)
 
static HRESULT WINAPI oleobject_SetColorScheme (IOleObject *iface, LOGPALETTE *pal)
 
static void test_OleUIAddVerbMenu (void)
 
 START_TEST (main)
 

Variables

static int g_enumpos
 
static const WCHAR verbW [] = {'v','e','r','b',0}
 
static IEnumOLEVERBVtbl enumverbsvtbl
 
static IEnumOLEVERB enumverbs = { &enumverbsvtbl }
 
static BOOL g_enumverbsfail
 
static const WCHAR testW [] = {'t','e','s','t',0}
 
static IOleObjectVtbl oleobjectvtbl
 
static IOleObject oleobject = { &oleobjectvtbl }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file main.c.

Function Documentation

◆ enumverbs_AddRef()

static ULONG WINAPI enumverbs_AddRef ( IEnumOLEVERB iface)
static

Definition at line 53 of file main.c.

54 {
55  return 2;
56 }

◆ enumverbs_Clone()

static HRESULT WINAPI enumverbs_Clone ( IEnumOLEVERB iface,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 96 of file main.c.

97 {
98  ok(0, "unexpected call\n");
99  return E_NOTIMPL;
100 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ enumverbs_Next()

static HRESULT WINAPI enumverbs_Next ( IEnumOLEVERB iface,
ULONG  count,
OLEVERB *  verbs,
ULONG fetched 
)
static

Definition at line 65 of file main.c.

66 {
67  ok(count == 1, "got %u\n", count);
68  ok(fetched == NULL, "got %p\n", fetched);
69  ok(g_enumpos == 0 || g_enumpos == 1, "got pos %d\n", g_enumpos);
70 
71  if (g_enumpos++ == 0) {
72  verbs->lVerb = 123;
73  verbs->lpszVerbName = CoTaskMemAlloc(sizeof(verbW));
74  lstrcpyW(verbs->lpszVerbName, verbW);
75  verbs->fuFlags = MF_ENABLED;
76  verbs->grfAttribs = OLEVERBATTRIB_ONCONTAINERMENU;
77  if (fetched) *fetched = 1;
78  return S_OK;
79  }
80 
81  return S_FALSE;
82 }
static const WCHAR verbW[]
Definition: main.c:64
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int g_enumpos
Definition: main.c:63
#define ok(value,...)
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define MF_ENABLED
Definition: winuser.h:128
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ enumverbs_QueryInterface()

static HRESULT WINAPI enumverbs_QueryInterface ( IEnumOLEVERB iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 41 of file main.c.

42 {
44  *ppv = iface;
45  IEnumOLEVERB_AddRef(iface);
46  return S_OK;
47  }
48 
49  *ppv = NULL;
50  return E_NOINTERFACE;
51 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IEnumOLEVERB
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

◆ enumverbs_Release()

static ULONG WINAPI enumverbs_Release ( IEnumOLEVERB iface)
static

Definition at line 58 of file main.c.

59 {
60  return 1;
61 }

◆ enumverbs_Reset()

static HRESULT WINAPI enumverbs_Reset ( IEnumOLEVERB iface)
static

Definition at line 90 of file main.c.

91 {
92  ok(0, "unexpected call\n");
93  return E_NOTIMPL;
94 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ enumverbs_Skip()

static HRESULT WINAPI enumverbs_Skip ( IEnumOLEVERB iface,
ULONG  count 
)
static

Definition at line 84 of file main.c.

85 {
86  ok(0, "unexpected call\n");
87  return E_NOTIMPL;
88 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_AddRef()

static ULONG WINAPI oleobject_AddRef ( IOleObject iface)
static

Definition at line 126 of file main.c.

127 {
128  return 2;
129 }

◆ oleobject_Advise()

static HRESULT WINAPI oleobject_Advise ( IOleObject iface,
IAdviseSink sink,
DWORD connection 
)
static

Definition at line 245 of file main.c.

246 {
247  ok(0, "unexpected call\n");
248  return E_NOTIMPL;
249 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_Close()

static HRESULT WINAPI oleobject_Close ( IOleObject iface,
DWORD  saveopt 
)
static

Definition at line 155 of file main.c.

156 {
157  ok(0, "unexpected call\n");
158  return E_NOTIMPL;
159 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_DoVerb()

static HRESULT WINAPI oleobject_DoVerb ( IOleObject iface,
LONG  verb,
MSG msg,
IOleClientSite activesite,
LONG  index,
HWND  hwndParent,
LPCRECT  rect 
)
static

Definition at line 187 of file main.c.

189 {
190  ok(0, "unexpected call\n");
191  return E_NOTIMPL;
192 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_EnumAdvise()

static HRESULT WINAPI oleobject_EnumAdvise ( IOleObject iface,
IEnumSTATDATA **  enumadvise 
)
static

Definition at line 257 of file main.c.

258 {
259  ok(0, "unexpected call\n");
260  return E_NOTIMPL;
261 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_EnumVerbs()

static HRESULT WINAPI oleobject_EnumVerbs ( IOleObject iface,
IEnumOLEVERB **  enumverb 
)
static

Definition at line 195 of file main.c.

196 {
197  if (g_enumverbsfail) {
198  *enumverb = NULL;
199  return E_FAIL;
200  }
201  *enumverb = &enumverbs;
202  return S_OK;
203 }
static BOOL g_enumverbsfail
Definition: main.c:194
#define E_FAIL
Definition: ddrawi.h:102
static IEnumOLEVERB enumverbs
Definition: main.c:112
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

◆ oleobject_GetClientSite()

static HRESULT WINAPI oleobject_GetClientSite ( IOleObject iface,
IOleClientSite **  site 
)
static

Definition at line 142 of file main.c.

143 {
144  ok(0, "unexpected call\n");
145  return E_NOTIMPL;
146 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetClipboardData()

static HRESULT WINAPI oleobject_GetClipboardData ( IOleObject iface,
DWORD  reserved,
IDataObject **  dataobject 
)
static

Definition at line 181 of file main.c.

182 {
183  ok(0, "unexpected call\n");
184  return E_NOTIMPL;
185 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetExtent()

static HRESULT WINAPI oleobject_GetExtent ( IOleObject iface,
DWORD  aspect,
SIZEL size 
)
static

Definition at line 239 of file main.c.

240 {
241  ok(0, "unexpected call\n");
242  return E_NOTIMPL;
243 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetMiscStatus()

static HRESULT WINAPI oleobject_GetMiscStatus ( IOleObject iface,
DWORD  aspect,
DWORD status 
)
static

Definition at line 263 of file main.c.

264 {
265  ok(0, "unexpected call\n");
266  return E_NOTIMPL;
267 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetMoniker()

static HRESULT WINAPI oleobject_GetMoniker ( IOleObject iface,
DWORD  assign,
DWORD  whichmoniker,
IMoniker **  mk 
)
static

Definition at line 167 of file main.c.

169 {
170  ok(0, "unexpected call\n");
171  return E_NOTIMPL;
172 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetUserClassID()

static HRESULT WINAPI oleobject_GetUserClassID ( IOleObject iface,
CLSID clsid 
)
static

Definition at line 217 of file main.c.

218 {
219  ok(0, "unexpected call\n");
220  return E_NOTIMPL;
221 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_GetUserType()

static HRESULT WINAPI oleobject_GetUserType ( IOleObject iface,
DWORD  formoftype,
LPOLESTR usertype 
)
static

Definition at line 224 of file main.c.

226 {
227  ok(formoftype == USERCLASSTYPE_SHORT, "got %d\n", formoftype);
228  *usertype = CoTaskMemAlloc(sizeof(testW));
229  lstrcpyW(*usertype, testW);
230  return S_OK;
231 }
#define ok(value,...)
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static const WCHAR testW[]
Definition: main.c:223
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ oleobject_InitFromData()

static HRESULT WINAPI oleobject_InitFromData ( IOleObject iface,
IDataObject dataobject,
BOOL  creation,
DWORD  reserved 
)
static

Definition at line 174 of file main.c.

176 {
177  ok(0, "unexpected call\n");
178  return E_NOTIMPL;
179 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_IsUpToDate()

static HRESULT WINAPI oleobject_IsUpToDate ( IOleObject iface)
static

Definition at line 211 of file main.c.

212 {
213  ok(0, "unexpected call\n");
214  return E_NOTIMPL;
215 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_QueryInterface()

static HRESULT WINAPI oleobject_QueryInterface ( IOleObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 114 of file main.c.

115 {
117  *ppv = iface;
118  IOleObject_AddRef(iface);
119  return S_OK;
120  }
121 
122  *ppv = NULL;
123  return E_NOINTERFACE;
124 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IOleObject
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

◆ oleobject_Release()

static ULONG WINAPI oleobject_Release ( IOleObject iface)
static

Definition at line 131 of file main.c.

132 {
133  return 1;
134 }

◆ oleobject_SetClientSite()

static HRESULT WINAPI oleobject_SetClientSite ( IOleObject iface,
IOleClientSite site 
)
static

Definition at line 136 of file main.c.

137 {
138  ok(0, "unexpected call\n");
139  return E_NOTIMPL;
140 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_SetColorScheme()

static HRESULT WINAPI oleobject_SetColorScheme ( IOleObject iface,
LOGPALETTE pal 
)
static

Definition at line 269 of file main.c.

270 {
271  ok(0, "unexpected call\n");
272  return E_NOTIMPL;
273 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_SetExtent()

static HRESULT WINAPI oleobject_SetExtent ( IOleObject iface,
DWORD  aspect,
SIZEL size 
)
static

Definition at line 233 of file main.c.

234 {
235  ok(0, "unexpected call\n");
236  return E_NOTIMPL;
237 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_SetHostNames()

static HRESULT WINAPI oleobject_SetHostNames ( IOleObject iface,
LPCOLESTR  containerapp,
LPCOLESTR  containerObj 
)
static

Definition at line 148 of file main.c.

150 {
151  ok(0, "unexpected call\n");
152  return E_NOTIMPL;
153 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_SetMoniker()

static HRESULT WINAPI oleobject_SetMoniker ( IOleObject iface,
DWORD  whichmoniker,
IMoniker mk 
)
static

Definition at line 161 of file main.c.

162 {
163  ok(0, "unexpected call\n");
164  return E_NOTIMPL;
165 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_Unadvise()

static HRESULT WINAPI oleobject_Unadvise ( IOleObject iface,
DWORD  connection 
)
static

Definition at line 251 of file main.c.

252 {
253  ok(0, "unexpected call\n");
254  return E_NOTIMPL;
255 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ oleobject_Update()

static HRESULT WINAPI oleobject_Update ( IOleObject iface)
static

Definition at line 205 of file main.c.

206 {
207  ok(0, "unexpected call\n");
208  return E_NOTIMPL;
209 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ START_TEST()

START_TEST ( main  )

Definition at line 490 of file main.c.

491 {
493 }
static void test_OleUIAddVerbMenu(void)
Definition: main.c:304

◆ strstrW()

static const WCHAR* strstrW ( const WCHAR str,
const WCHAR sub 
)
static

Definition at line 29 of file main.c.

30 {
31  while (*str)
32  {
33  const WCHAR *p1 = str, *p2 = sub;
34  while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
35  if (!*p2) return str;
36  str++;
37  }
38  return NULL;
39 }
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by check_native_ie(), and test_OleUIAddVerbMenu().

◆ test_OleUIAddVerbMenu()

static void test_OleUIAddVerbMenu ( void  )
static

Definition at line 304 of file main.c.

305 {
306  static const WCHAR cadabraW[] = {'c','a','d','a','b','r','a',0};
307  HMENU hMenu, verbmenu;
309  WCHAR buffW[50];
310  int count;
311  BOOL ret;
312 
313  ret = OleUIAddVerbMenuW(NULL, NULL, NULL, 0, 0, 0, FALSE, 0, NULL);
314  ok(!ret, "got %d\n", ret);
315 
316  verbmenu = (HMENU)0xdeadbeef;
317  ret = OleUIAddVerbMenuW(NULL, NULL, NULL, 0, 0, 0, FALSE, 0, &verbmenu);
318  ok(!ret, "got %d\n", ret);
319  ok(verbmenu == NULL, "got %p\n", verbmenu);
320 
321  g_enumpos = 0;
322  ret = OleUIAddVerbMenuW(&oleobject, NULL, NULL, 0, 0, 0, FALSE, 0, NULL);
323  ok(!ret, "got %d\n", ret);
324 
325  hMenu = CreatePopupMenu();
326 
327  memset(&info, 0, sizeof(info));
328  info.cbSize = sizeof(info);
329  ret = InsertMenuItemW(hMenu, 0, TRUE, &info);
330  ok(ret, "got %d\n", ret);
331 
332  count = GetMenuItemCount(hMenu);
333  ok(count == 1, "got %d\n", count);
334 
335  g_enumpos = 0;
336  ret = OleUIAddVerbMenuW(&oleobject, NULL, hMenu, 0, 0, 0, FALSE, 0, NULL);
337  ok(!ret, "got %d\n", ret);
338 
339  count = GetMenuItemCount(hMenu);
340  ok(count == 1, "got %d\n", count);
341 
342  ret = InsertMenuItemW(hMenu, 0, TRUE, &info);
343  ok(ret, "got %d\n", ret);
344 
345  count = GetMenuItemCount(hMenu);
346  ok(count == 2, "got %d\n", count);
347 
348  verbmenu = (HMENU)0xdeadbeef;
349  g_enumpos = 0;
350  ret = OleUIAddVerbMenuW(&oleobject, NULL, hMenu, 1, 0, 0, FALSE, 0, &verbmenu);
351  ok(ret, "got %d\n", ret);
352  ok(verbmenu == NULL, "got %p\n", verbmenu);
353 
354  count = GetMenuItemCount(hMenu);
355  ok(count == 2, "got %d\n", count);
356 
357  /* object doesn't support EnumVerbs() */
359  g_enumpos = 0;
360  verbmenu = (HMENU)0xdeadbeef;
361  ret = OleUIAddVerbMenuW(&oleobject, NULL, hMenu, 2, 0, 0, FALSE, 0, &verbmenu);
362  ok(!ret, "got %d\n", ret);
363  ok(verbmenu == NULL, "got %p\n", verbmenu);
365 
366  /* added disabled item */
367  memset(&info, 0, sizeof(info));
368  info.cbSize = sizeof(info);
369  info.fMask = MIIM_STATE|MIIM_SUBMENU;
370  ret = GetMenuItemInfoW(hMenu, 2, TRUE, &info);
371  ok(ret, "got %d\n", ret);
372  ok(info.fState & MFS_DISABLED, "got state 0x%08x\n", info.fState);
373  ok(info.hSubMenu == NULL, "got submenu %p\n", info.hSubMenu);
374 
375  count = GetMenuItemCount(hMenu);
376  ok(count == 3, "got %d\n", count);
377 
378  /* now without object */
379  verbmenu = (HMENU)0xdeadbeef;
380  ret = OleUIAddVerbMenuW(NULL, testW, hMenu, 3, 42, 0, FALSE, 0, &verbmenu);
381  ok(!ret, "got %d\n", ret);
382  ok(verbmenu == NULL, "got %p\n", verbmenu);
383 
384  memset(&info, 0, sizeof(info));
385  info.cbSize = sizeof(info);
387  info.dwTypeData = buffW;
388  info.cch = ARRAY_SIZE(buffW);
389  ret = GetMenuItemInfoW(hMenu, 3, TRUE, &info);
390  ok(ret, "got %d\n", ret);
391  ok(info.fState == MF_GRAYED, "got state 0x%08x\n", info.fState);
392  ok(info.wID == 42, "got id %d\n", info.wID);
393  ok(info.hSubMenu == NULL, "got submenu %p\n", info.hSubMenu);
394 
395  count = GetMenuItemCount(hMenu);
396  ok(count == 4, "got %d\n", count);
397 
398  verbmenu = (HMENU)0xdeadbeef;
399  g_enumpos = 0;
400  ret = OleUIAddVerbMenuW(&oleobject, NULL, hMenu, 4, 0, 0, FALSE, 0, &verbmenu);
401  ok(ret, "got %d\n", ret);
402  ok(verbmenu == NULL, "got %p\n", verbmenu);
403 
404  /* check newly added item */
405  memset(&info, 0, sizeof(info));
406  info.cbSize = sizeof(info);
408  info.dwTypeData = buffW;
409  info.cch = ARRAY_SIZE(buffW);
410  ret = GetMenuItemInfoW(hMenu, 4, TRUE, &info);
411  ok(ret, "got %d\n", ret);
412  /* Item string contains verb, usertype and localized string for 'Object' word,
413  exact format depends on localization. */
414  ok(strstrW(buffW, verbW) != NULL, "str %s\n", wine_dbgstr_w(buffW));
415  ok(info.fState == 0, "got state 0x%08x\n", info.fState);
416  ok(info.hSubMenu == NULL, "got submenu %p\n", info.hSubMenu);
417 
418  count = GetMenuItemCount(hMenu);
419  ok(count == 5, "got %d\n", count);
420 
421  DestroyMenu(hMenu);
422 
423  /* try to add verb menu repeatedly, with same id */
424  hMenu = CreatePopupMenu();
425 
426  count = GetMenuItemCount(hMenu);
427  ok(count == 0, "got %d\n", count);
428 
429  verbmenu = NULL;
430  ret = OleUIAddVerbMenuW(NULL, NULL, hMenu, 0, 5, 10, TRUE, 3, &verbmenu);
431  ok(!ret, "got %d\n", ret);
432  ok(verbmenu == NULL, "got %p\n", verbmenu);
433 
434  count = GetMenuItemCount(hMenu);
435  ok(count == 1, "got %d\n", count);
436 
437  verbmenu = NULL;
438  ret = OleUIAddVerbMenuW(NULL, NULL, hMenu, 0, 5, 10, TRUE, 3, &verbmenu);
439  ok(!ret, "got %d\n", ret);
440  ok(verbmenu == NULL, "got %p\n", verbmenu);
441 
442  count = GetMenuItemCount(hMenu);
443  ok(count == 1, "got %d\n", count);
444 
445  /* same position, different id */
446  verbmenu = NULL;
447  ret = OleUIAddVerbMenuW(NULL, NULL, hMenu, 0, 6, 10, TRUE, 3, &verbmenu);
448  ok(!ret, "got %d\n", ret);
449  ok(verbmenu == NULL, "got %p\n", verbmenu);
450 
451  count = GetMenuItemCount(hMenu);
452  ok(count == 1, "got %d\n", count);
453 
454  /* change added item string and state */
455  memset(&info, 0, sizeof(info));
456  info.cbSize = sizeof(info);
457  info.fMask = MIIM_STRING|MIIM_STATE;
458  info.fState = MFS_ENABLED;
459  info.dwTypeData = buffW;
460  lstrcpyW(buffW, cadabraW);
461  ret = SetMenuItemInfoW(hMenu, 0, TRUE, &info);
462  ok(ret, "got %d\n", ret);
463 
464  buffW[0] = 0;
465  GetMenuStringW(hMenu, 0, buffW, ARRAY_SIZE(buffW), MF_BYPOSITION);
466  ok(!lstrcmpW(buffW, cadabraW), "got %s\n", wine_dbgstr_w(buffW));
467 
468  verbmenu = NULL;
469  ret = OleUIAddVerbMenuW(NULL, NULL, hMenu, 0, 5, 10, TRUE, 3, &verbmenu);
470  ok(!ret, "got %d\n", ret);
471  ok(verbmenu == NULL, "got %p\n", verbmenu);
472 
473  memset(&info, 0, sizeof(info));
474  info.cbSize = sizeof(info);
475  info.fMask = MIIM_STRING|MIIM_STATE;
476  buffW[0] = 0;
477  info.dwTypeData = buffW;
478  info.cch = ARRAY_SIZE(buffW);
479  ret = GetMenuItemInfoW(hMenu, 0, TRUE, &info);
480  ok(ret, "got %d\n", ret);
481  ok(lstrcmpW(buffW, cadabraW), "got %s\n", wine_dbgstr_w(buffW));
482  ok(info.fState == MF_GRAYED, "got state 0x%08x\n", info.fState);
483 
484  count = GetMenuItemCount(hMenu);
485  ok(count == 1, "got %d\n", count);
486 
487  DestroyMenu(hMenu);
488 }
static const WCHAR verbW[]
Definition: main.c:64
#define TRUE
Definition: types.h:120
static BOOL g_enumverbsfail
Definition: main.c:194
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int g_enumpos
Definition: main.c:63
#define wine_dbgstr_w
Definition: kernel32.h:34
#define MFS_DISABLED
Definition: winuser.h:744
static const WCHAR * strstrW(const WCHAR *str, const WCHAR *sub)
Definition: main.c:29
struct _test_info info[]
Definition: SetCursorPos.c:19
#define MIIM_SUBMENU
Definition: winuser.h:718
int WINAPI GetMenuStringW(_In_ HMENU hMenu, _In_ UINT uIDItem, _Out_writes_opt_(cchMax) LPWSTR lpString, _In_ int cchMax, _In_ UINT flags)
#define MFS_ENABLED
Definition: winuser.h:745
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MF_BYPOSITION
Definition: winuser.h:203
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define ok(value,...)
BOOL WINAPI SetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
smooth NULL
Definition: ftsmooth.c:416
#define MIIM_ID
Definition: winuser.h:717
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static IOleObject oleobject
Definition: main.c:302
int ret
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MIIM_STRING
Definition: winuser.h:722
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define MF_GRAYED
Definition: winuser.h:129
static const WCHAR testW[]
Definition: main.c:223
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL WINAPI OleUIAddVerbMenuW(IOleObject *object, LPCWSTR shorttype, HMENU hMenu, UINT uPos, UINT idmin, UINT idmax, BOOL addConvert, UINT idConvert, HMENU *ret_submenu)
Definition: oledlg_main.c:158

Referenced by START_TEST().

Variable Documentation

◆ enumverbs

IEnumOLEVERB enumverbs = { &enumverbsvtbl }
static

Definition at line 112 of file main.c.

Referenced by get_next_insertable_verb(), oleobject_EnumVerbs(), and OleUIAddVerbMenuW().

◆ enumverbsvtbl

IEnumOLEVERBVtbl enumverbsvtbl
static
Initial value:
= {
}
static ULONG WINAPI enumverbs_Release(IEnumOLEVERB *iface)
Definition: main.c:58
static HRESULT WINAPI enumverbs_Skip(IEnumOLEVERB *iface, ULONG count)
Definition: main.c:84
static ULONG WINAPI enumverbs_AddRef(IEnumOLEVERB *iface)
Definition: main.c:53
static HRESULT WINAPI enumverbs_Next(IEnumOLEVERB *iface, ULONG count, OLEVERB *verbs, ULONG *fetched)
Definition: main.c:65
static HRESULT WINAPI enumverbs_Reset(IEnumOLEVERB *iface)
Definition: main.c:90
static HRESULT WINAPI enumverbs_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: main.c:41
static HRESULT WINAPI enumverbs_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: main.c:96

Definition at line 102 of file main.c.

◆ g_enumpos

int g_enumpos
static

Definition at line 63 of file main.c.

Referenced by enumverbs_Next(), and test_OleUIAddVerbMenu().

◆ g_enumverbsfail

BOOL g_enumverbsfail
static

Definition at line 194 of file main.c.

Referenced by oleobject_EnumVerbs(), and test_OleUIAddVerbMenu().

◆ oleobject

IOleObject oleobject = { &oleobjectvtbl }
static

Definition at line 302 of file main.c.

Referenced by test_OleUIAddVerbMenu().

◆ oleobjectvtbl

IOleObjectVtbl oleobjectvtbl
static
Initial value:
= {
}
static ULONG WINAPI oleobject_Release(IOleObject *iface)
Definition: main.c:131
static HRESULT WINAPI oleobject_SetHostNames(IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerObj)
Definition: main.c:148
static HRESULT WINAPI oleobject_SetExtent(IOleObject *iface, DWORD aspect, SIZEL *size)
Definition: main.c:233
static HRESULT WINAPI oleobject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection)
Definition: main.c:245
static HRESULT WINAPI oleobject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
Definition: main.c:114
static HRESULT WINAPI oleobject_SetMoniker(IOleObject *iface, DWORD whichmoniker, IMoniker *mk)
Definition: main.c:161
static HRESULT WINAPI oleobject_DoVerb(IOleObject *iface, LONG verb, MSG *msg, IOleClientSite *activesite, LONG index, HWND hwndParent, LPCRECT rect)
Definition: main.c:187
static HRESULT WINAPI oleobject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **enumverb)
Definition: main.c:195
static HRESULT WINAPI oleobject_GetClipboardData(IOleObject *iface, DWORD reserved, IDataObject **dataobject)
Definition: main.c:181
static HRESULT WINAPI oleobject_SetClientSite(IOleObject *iface, IOleClientSite *site)
Definition: main.c:136
static HRESULT WINAPI oleobject_IsUpToDate(IOleObject *iface)
Definition: main.c:211
static HRESULT WINAPI oleobject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL *size)
Definition: main.c:239
static HRESULT WINAPI oleobject_GetMiscStatus(IOleObject *iface, DWORD aspect, DWORD *status)
Definition: main.c:263
static HRESULT WINAPI oleobject_InitFromData(IOleObject *iface, IDataObject *dataobject, BOOL creation, DWORD reserved)
Definition: main.c:174
static ULONG WINAPI oleobject_AddRef(IOleObject *iface)
Definition: main.c:126
static HRESULT WINAPI oleobject_GetUserClassID(IOleObject *iface, CLSID *clsid)
Definition: main.c:217
static HRESULT WINAPI oleobject_Unadvise(IOleObject *iface, DWORD connection)
Definition: main.c:251
static HRESULT WINAPI oleobject_GetMoniker(IOleObject *iface, DWORD assign, DWORD whichmoniker, IMoniker **mk)
Definition: main.c:167
static HRESULT WINAPI oleobject_GetUserType(IOleObject *iface, DWORD formoftype, LPOLESTR *usertype)
Definition: main.c:224
static HRESULT WINAPI oleobject_Update(IOleObject *iface)
Definition: main.c:205
static HRESULT WINAPI oleobject_Close(IOleObject *iface, DWORD saveopt)
Definition: main.c:155
static HRESULT WINAPI oleobject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **enumadvise)
Definition: main.c:257
static HRESULT WINAPI oleobject_SetColorScheme(IOleObject *iface, LOGPALETTE *pal)
Definition: main.c:269
static HRESULT WINAPI oleobject_GetClientSite(IOleObject *iface, IOleClientSite **site)
Definition: main.c:142

Definition at line 275 of file main.c.

◆ testW

const WCHAR testW[] = {'t','e','s','t',0}
static

◆ verbW

const WCHAR verbW[] = {'v','e','r','b',0}
static