ReactOS  0.4.15-dev-1384-g878186b
errorinfo.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wine/test.h"
Include dependency graph for errorinfo.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 

Functions

static void test_error_info (void)
 
 START_TEST (errorinfo)
 

Variables

static const CLSID CLSID_WineTest
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file errorinfo.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file errorinfo.c.

◆ ok_ole_success

#define ok_ole_success (   hr,
  func 
)    ok(hr == S_OK, func " failed with error 0x%08x\n", hr)

Definition at line 32 of file errorinfo.c.

Function Documentation

◆ START_TEST()

START_TEST ( errorinfo  )

Definition at line 117 of file errorinfo.c.

118 {
119  test_error_info();
120 }
static void test_error_info(void)
Definition: errorinfo.c:42

◆ test_error_info()

static void test_error_info ( void  )
static

Definition at line 42 of file errorinfo.c.

43 {
44  HRESULT hr;
45  ICreateErrorInfo *pCreateErrorInfo;
46  IErrorInfo *pErrorInfo;
47  static WCHAR wszDescription[] = {'F','a','i','l','e','d',' ','S','p','r','o','c','k','e','t',0};
48  static WCHAR wszHelpFile[] = {'s','p','r','o','c','k','e','t','.','h','l','p',0};
49  static WCHAR wszSource[] = {'s','p','r','o','c','k','e','t',0};
50  IUnknown *unk;
51 
52  hr = CreateErrorInfo(&pCreateErrorInfo);
53  ok_ole_success(hr, "CreateErrorInfo");
54 
55  hr = ICreateErrorInfo_QueryInterface(pCreateErrorInfo, &IID_IUnknown, (void**)&unk);
56  ok_ole_success(hr, "QI");
57  IUnknown_Release(unk);
58 
59  hr = ICreateErrorInfo_SetDescription(pCreateErrorInfo, NULL);
60  ok_ole_success(hr, "ICreateErrorInfo_SetDescription");
61 
62  hr = ICreateErrorInfo_SetDescription(pCreateErrorInfo, wszDescription);
63  ok_ole_success(hr, "ICreateErrorInfo_SetDescription");
64 
65  hr = ICreateErrorInfo_SetGUID(pCreateErrorInfo, &CLSID_WineTest);
66  ok_ole_success(hr, "ICreateErrorInfo_SetGUID");
67 
68  hr = ICreateErrorInfo_SetHelpContext(pCreateErrorInfo, 0xdeadbeef);
69  ok_ole_success(hr, "ICreateErrorInfo_SetHelpContext");
70 
71  hr = ICreateErrorInfo_SetHelpFile(pCreateErrorInfo, NULL);
72  ok_ole_success(hr, "ICreateErrorInfo_SetHelpFile");
73 
74  hr = ICreateErrorInfo_SetHelpFile(pCreateErrorInfo, wszHelpFile);
75  ok_ole_success(hr, "ICreateErrorInfo_SetHelpFile");
76 
77  hr = ICreateErrorInfo_SetSource(pCreateErrorInfo, NULL);
78  ok_ole_success(hr, "ICreateErrorInfo_SetSource");
79 
80  hr = ICreateErrorInfo_SetSource(pCreateErrorInfo, wszSource);
81  ok_ole_success(hr, "ICreateErrorInfo_SetSource");
82 
83  hr = ICreateErrorInfo_QueryInterface(pCreateErrorInfo, &IID_IErrorInfo, (void **)&pErrorInfo);
84  ok_ole_success(hr, "ICreateErrorInfo_QueryInterface");
85 
86  hr = IErrorInfo_QueryInterface(pErrorInfo, &IID_IUnknown, (void**)&unk);
87  ok_ole_success(hr, "QI");
88  IUnknown_Release(unk);
89 
90  ICreateErrorInfo_Release(pCreateErrorInfo);
91 
92  hr = SetErrorInfo(0, pErrorInfo);
93  ok_ole_success(hr, "SetErrorInfo");
94 
95  IErrorInfo_Release(pErrorInfo);
96  pErrorInfo = NULL;
97 
98  hr = GetErrorInfo(0, &pErrorInfo);
99  ok_ole_success(hr, "GetErrorInfo");
100 
101  IErrorInfo_Release(pErrorInfo);
102 
103  hr = GetErrorInfo(0, &pErrorInfo);
104  ok(hr == S_FALSE, "GetErrorInfo should have returned S_FALSE instead of 0x%08x\n", hr);
105  ok(!pErrorInfo, "pErrorInfo should be set to NULL\n");
106 
107  hr = SetErrorInfo(0, NULL);
108  ok_ole_success(hr, "SetErrorInfo");
109 
110  hr = GetErrorInfo(0xdeadbeef, &pErrorInfo);
111  ok(hr == E_INVALIDARG, "GetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
112 
113  hr = SetErrorInfo(0xdeadbeef, NULL);
114  ok(hr == E_INVALIDARG, "SetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
115 }
static const CLSID CLSID_WineTest
Definition: errorinfo.c:34
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo)
Definition: errorinfo.c:455
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo)
Definition: errorinfo.c:417
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define ok_ole_success(hr, func)
Definition: errorinfo.c:32
HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo)
Definition: errorinfo.c:386
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by START_TEST().

Variable Documentation

◆ CLSID_WineTest

const CLSID CLSID_WineTest
static
Initial value:
=
{
0x9474ba1a,
0x258b,
0x490b,
{0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe0}
}

Definition at line 34 of file errorinfo.c.

Referenced by test_error_info().