2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Supplemental tests for Winetests' Event Logging functions
5 * PROGRAMMER: Hermes Belusca-Maito
10 #define WIN32_NO_STATUS
20 /* Output for Windows <= 2k3 | Windows Vista+ (or "old" ReactOS) */
29 * Tests for the different RPC boundaries on Windows.
30 * See also the "ReportEvent" API on MSDN, section "Return value", at:
31 * https://msdn.microsoft.com/en-us/library/windows/desktop/aa363679(v=vs.85).aspx
34 { 0xF000, { {TRUE
, ERROR_SUCCESS
}, {TRUE
, ERROR_SUCCESS
} } },
35 { 0xF001, { {TRUE
, ERROR_SUCCESS
}, {FALSE
, RPC_S_INVALID_BOUND
} } },
37 { 0x3FF66, { {TRUE
, ERROR_SUCCESS
}, {FALSE
, RPC_S_INVALID_BOUND
} } },
38 { 0x3FF67, { {TRUE
, ERROR_SUCCESS
}, {FALSE
, RPC_S_INVALID_BOUND
} } },
39 { 0x3FF68, { {TRUE
, ERROR_SUCCESS
}, {FALSE
, RPC_S_INVALID_BOUND
} } },
41 /* Show that the maximum data size for an event can be as big as 0x3FFFF */
42 { 0x3FFFE, { {TRUE
, ERROR_SUCCESS
/* or FALSE, ERROR_INVALID_PARAMETER on Win2k3 */}, {FALSE
, RPC_S_INVALID_BOUND
} } },
43 { 0x3FFFF, { {TRUE
, ERROR_SUCCESS
/* or FALSE, ERROR_INVALID_PARAMETER on Win2k3 */}, {FALSE
, RPC_S_INVALID_BOUND
} } },
44 { 0x40000, { {FALSE
, RPC_X_BAD_STUB_DATA
}, {FALSE
, RPC_S_INVALID_BOUND
} } },
53 /* We use the "Application" log for the different tests! */
54 hEventLog
= OpenEventLogW(NULL
, L
"Application");
55 ok(hEventLog
!= NULL
, "OpenEventLogW(NULL, L\"Application\") failed with error %lu\n", GetLastError());
59 for (i
= 0; i
< ARRAYSIZE(Tests
); ++i
)
61 Data
= HeapAlloc(GetProcessHeap(), 0, Tests
[i
].MaxDataSize
);
62 ok(Data
!= NULL
, "Failed to allocate memory for data of size %lu\n", Tests
[i
].MaxDataSize
);
65 RtlFillMemory(Data
, Tests
[i
].MaxDataSize
, 0xCA);
67 ClearEventLog(hEventLog
, NULL
);
69 SetLastError(ERROR_SUCCESS
);
70 Success
= ReportEventW(hEventLog
, EVENTLOG_INFORMATION_TYPE
, 1, 1, NULL
, 0, Tests
[i
].MaxDataSize
, NULL
, Data
);
71 LastError
= GetLastError();
72 /* Small adjustment */
73 if (LastError
== ERROR_ENVVAR_NOT_FOUND
)
74 LastError
= ERROR_SUCCESS
;
76 ok( ( (Success
== Tests
[i
].Result
[0].Success
) && (LastError
== Tests
[i
].Result
[0].LastError
) ) ||
77 broken( (Success
== FALSE
) && (LastError
== ERROR_INVALID_PARAMETER
) /* For Win2k3, see above */) // ||
78 // broken( (Success == Tests[i].Result[1].Success) && (LastError == Tests[i].Result[1].LastError) /* For Vista+ */)
80 "ReportEventW(%u) returned 0x%x with last error %lu, expected %s with last error %lu\n",
81 i
, Success
, LastError
, (Tests
[i
].Result
[0].Success
? "TRUE" : "FALSE"), Tests
[i
].Result
[0].LastError
);
83 HeapFree(GetProcessHeap(), 0, Data
);
87 ClearEventLog(hEventLog
, NULL
);
89 CloseEventLog(hEventLog
);