43{
44 char findbuffer[64];
45 char replacebuffer[64];
48
53
54#define CHECK_FIND_OR_REPLACE(FUNC, FAIL, ERR_CODE) \
55 do { \
56 HWND hwnd = FUNC(pFr); \
57 BOOL is_ok = !!hwnd == !FAIL; \
58 ok(is_ok, "%s should%s fail\n", #FUNC, FAIL ? "" : "n't"); \
59 if (FAIL && is_ok) { \
60 DWORD ext_err = CommDlgExtendedError(); \
61 ok(ext_err == ERR_CODE, "expected err %x got %x\n", \
62 ERR_CODE, ext_err); \
63 } else { \
64 DestroyWindow(hwnd); \
65 } \
66 } while (0)
67
68#define CHECK_FIND_FAIL(ERR_CODE) \
69 CHECK_FIND_OR_REPLACE(FindTextA, TRUE, ERR_CODE)
70
71#define CHECK_FIND_SUCCEED() \
72 CHECK_FIND_OR_REPLACE(FindTextA, FALSE, 0)
73
74#define CHECK_REPLACE_FAIL(ERR_CODE) \
75 CHECK_FIND_OR_REPLACE(ReplaceTextA, TRUE, ERR_CODE)
76
77#define CHECK_REPLACE_SUCCEED() \
78 CHECK_FIND_OR_REPLACE(ReplaceTextA, FALSE, 0)
79
80#define CHECK_FINDREPLACE_FAIL(ERR_CODE) \
81 do { \
82 CHECK_FIND_FAIL(ERR_CODE); \
83 CHECK_REPLACE_FAIL(ERR_CODE); \
84 } while (0)
85
88 pFr = &fr;
89
91
94
95
99
100
103
104
107 strcpy(findbuffer,
"abc");
108
109
113 strcpy(replacebuffer,
"def");
114
115
119
120
123
124
125
131
132
136
139
141}
#define CDERR_NOHINSTANCE
#define CDERR_INITIALIZATION
#define CDERR_FINDRESFAILURE
#define FRERR_BUFFERLENGTHZERO
#define CDERR_DIALOGFAILURE
#define FR_ENABLETEMPLATEHANDLE
#define FR_ENABLETEMPLATE
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
#define CHECK_REPLACE_FAIL(ERR_CODE)
#define CHECK_FINDREPLACE_FAIL(ERR_CODE)
#define CHECK_REPLACE_SUCCEED()
static LRESULT CALLBACK OwnerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define CHECK_FIND_SUCCEED()
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
BOOL WINAPI DestroyWindow(_In_ HWND)