1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * PROJECT:         ReactOS kernel-mode tests
3*c2c66affSColin Finck  * LICENSE:         GPLv2+ - See COPYING in the top level directory
4*c2c66affSColin Finck  * PURPOSE:         Kernel-Mode Test Suite Hard error message test
5*c2c66affSColin Finck  * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
6*c2c66affSColin Finck  */
7*c2c66affSColin Finck 
8*c2c66affSColin Finck #include <kmt_test.h>
9*c2c66affSColin Finck 
10*c2c66affSColin Finck /* TODO: don't require user interaction, test Io* routines,
11*c2c66affSColin Finck  *       test NTSTATUS values with special handling */
12*c2c66affSColin Finck 
13*c2c66affSColin Finck static
14*c2c66affSColin Finck VOID
SetParameters(OUT PULONG_PTR Parameters,IN INT Count,...)15*c2c66affSColin Finck SetParameters(
16*c2c66affSColin Finck     OUT PULONG_PTR Parameters,
17*c2c66affSColin Finck     IN INT Count,
18*c2c66affSColin Finck     ...)
19*c2c66affSColin Finck {
20*c2c66affSColin Finck     INT i;
21*c2c66affSColin Finck     va_list Arguments;
22*c2c66affSColin Finck     va_start(Arguments, Count);
23*c2c66affSColin Finck     for (i = 0; i < Count; ++i)
24*c2c66affSColin Finck         Parameters[i] = va_arg(Arguments, ULONG_PTR);
25*c2c66affSColin Finck     va_end(Arguments);
26*c2c66affSColin Finck }
27*c2c66affSColin Finck 
28*c2c66affSColin Finck #define NoResponse 27
29*c2c66affSColin Finck 
30*c2c66affSColin Finck #define CheckHardError(ErrStatus, UnicodeStringMask, ResponseOption,    \
31*c2c66affSColin Finck                         ExpectedStatus, ExpectedResponse,               \
32*c2c66affSColin Finck                         NumberOfParameters, ...) do                     \
33*c2c66affSColin Finck {                                                                       \
34*c2c66affSColin Finck     SetParameters(HardErrorParameters, NumberOfParameters, __VA_ARGS__);\
35*c2c66affSColin Finck     Response = NoResponse;                                              \
36*c2c66affSColin Finck     _SEH2_TRY {                                                         \
37*c2c66affSColin Finck         Status = ExRaiseHardError(ErrStatus,                            \
38*c2c66affSColin Finck                                   NumberOfParameters,                   \
39*c2c66affSColin Finck                                   UnicodeStringMask,                    \
40*c2c66affSColin Finck                                   HardErrorParameters,                  \
41*c2c66affSColin Finck                                   ResponseOption,                       \
42*c2c66affSColin Finck                                   &Response);                           \
43*c2c66affSColin Finck     } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {                         \
44*c2c66affSColin Finck         Status = _SEH2_GetExceptionCode();                              \
45*c2c66affSColin Finck     } _SEH2_END;                                                        \
46*c2c66affSColin Finck     ok_eq_hex(Status, ExpectedStatus);                                  \
47*c2c66affSColin Finck     ok_eq_ulong(Response, (ULONG)ExpectedResponse);                     \
48*c2c66affSColin Finck } while (0)
49*c2c66affSColin Finck 
50*c2c66affSColin Finck #define CheckInformationalHardError(ErrStatus, String, Thread,          \
51*c2c66affSColin Finck                                         ExpectedStatus, ExpectedRet) do \
52*c2c66affSColin Finck {                                                                       \
53*c2c66affSColin Finck     Status = STATUS_SUCCESS;                                            \
54*c2c66affSColin Finck     Ret = !ExpectedRet;                                                 \
55*c2c66affSColin Finck     _SEH2_TRY {                                                         \
56*c2c66affSColin Finck         Ret = IoRaiseInformationalHardError(ErrStatus,                  \
57*c2c66affSColin Finck                                             String,                     \
58*c2c66affSColin Finck                                             Thread);                    \
59*c2c66affSColin Finck     } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {                         \
60*c2c66affSColin Finck         Status = _SEH2_GetExceptionCode();                              \
61*c2c66affSColin Finck     } _SEH2_END;                                                        \
62*c2c66affSColin Finck     ok_eq_hex(Status, ExpectedStatus);                                  \
63*c2c66affSColin Finck     ok_eq_bool(Ret, ExpectedRet);                                       \
64*c2c66affSColin Finck } while (0)
65*c2c66affSColin Finck 
66*c2c66affSColin Finck static
67*c2c66affSColin Finck VOID
TestHardError(BOOLEAN InteractivePart1,BOOLEAN InteractivePart2,BOOLEAN InteractivePart3,BOOLEAN InteractivePart4)68*c2c66affSColin Finck TestHardError(
69*c2c66affSColin Finck     BOOLEAN InteractivePart1,
70*c2c66affSColin Finck     BOOLEAN InteractivePart2,
71*c2c66affSColin Finck     BOOLEAN InteractivePart3,
72*c2c66affSColin Finck     BOOLEAN InteractivePart4)
73*c2c66affSColin Finck {
74*c2c66affSColin Finck     NTSTATUS Status;
75*c2c66affSColin Finck     ULONG Response;
76*c2c66affSColin Finck     WCHAR StringBuffer1[] = L"Parameter1+Garbage";
77*c2c66affSColin Finck     CHAR StringBuffer1Ansi[] = "Parameter1+Garbage";
78*c2c66affSColin Finck     WCHAR StringBuffer2[] = L"Parameter2+Garbage";
79*c2c66affSColin Finck     UNICODE_STRING String1 = RTL_CONSTANT_STRING(StringBuffer1);
80*c2c66affSColin Finck     ANSI_STRING String1Ansi = RTL_CONSTANT_STRING(StringBuffer1Ansi);
81*c2c66affSColin Finck     UNICODE_STRING String2 = RTL_CONSTANT_STRING(StringBuffer2);
82*c2c66affSColin Finck     ULONG_PTR HardErrorParameters[6];
83*c2c66affSColin Finck     BOOLEAN Ret;
84*c2c66affSColin Finck 
85*c2c66affSColin Finck     String1.Length = sizeof L"Parameter1" - sizeof UNICODE_NULL;
86*c2c66affSColin Finck     String1Ansi.Length = sizeof "Parameter1" - sizeof ANSI_NULL;
87*c2c66affSColin Finck     String2.Length = sizeof L"Parameter2" - sizeof UNICODE_NULL;
88*c2c66affSColin Finck 
89*c2c66affSColin Finck     if (InteractivePart1)
90*c2c66affSColin Finck     {
91*c2c66affSColin Finck     CheckHardError(0x40000000,                  0, OptionOk,                STATUS_SUCCESS,            ResponseOk,             0, 0);                          // outputs a box :|
92*c2c66affSColin Finck     CheckHardError(0x40000001,                  0, OptionOk,                STATUS_SUCCESS,            ResponseOk,             4, 1, 2, 3, 4);                 // outputs a box :|
93*c2c66affSColin Finck     CheckHardError(0x40000002,                  0, OptionOk,                STATUS_SUCCESS,            ResponseOk,             5, 1, 2, 3, 4, 5);              // outputs a box :|
94*c2c66affSColin Finck     CheckHardError(0x40000003,                  0, OptionOk,                STATUS_SUCCESS,            ResponseNotHandled,     6, 1, 2, 3, 4, 5, 6);           // TODO: interactive on ROS
95*c2c66affSColin Finck     }
96*c2c66affSColin Finck 
97*c2c66affSColin Finck     CheckHardError(0x40000004,                  0, OptionShutdownSystem,    STATUS_PRIVILEGE_NOT_HELD, ResponseNotHandled,     0, 0);
98*c2c66affSColin Finck     if (InteractivePart1)
99*c2c66affSColin Finck     {
100*c2c66affSColin Finck     // TODO: these 2 are interactive on ROS
101*c2c66affSColin Finck     CheckHardError(0x40000005,                  0, OptionOkNoWait,          STATUS_SUCCESS,            ResponseOk,             0, 0);                          // outputs a balloon notification
102*c2c66affSColin Finck     CheckHardError(0x4000000f,                  0, OptionOkNoWait,          STATUS_SUCCESS,            ResponseOk,             0, 0);                          // outputs a balloon notification
103*c2c66affSColin Finck     CheckHardError(0x40000006,                  0, OptionAbortRetryIgnore,  STATUS_SUCCESS,            ResponseAbort,          0, 0);                          // outputs a box :|
104*c2c66affSColin Finck     CheckHardError(0x40000006,                  0, OptionAbortRetryIgnore,  STATUS_SUCCESS,            ResponseRetry,          0, 0);                          // outputs a box :|
105*c2c66affSColin Finck     CheckHardError(0x40000006,                  0, OptionAbortRetryIgnore,  STATUS_SUCCESS,            ResponseIgnore,         0, 0);                          // outputs a box :|
106*c2c66affSColin Finck     CheckHardError(0x40000008,                  0, OptionCancelTryContinue, STATUS_SUCCESS,            ResponseCancel,         0, 0);                          // outputs a box :|
107*c2c66affSColin Finck     CheckHardError(0x40000008,                  0, OptionCancelTryContinue, STATUS_SUCCESS,            ResponseTryAgain,       0, 0);                          // outputs a box :|
108*c2c66affSColin Finck     CheckHardError(0x40000008,                  0, OptionCancelTryContinue, STATUS_SUCCESS,            ResponseContinue,       0, 0);                          // outputs a box :|
109*c2c66affSColin Finck     CheckHardError(0x40000010,                  0, OptionOkCancel,          STATUS_SUCCESS,            ResponseOk,             0, 0);                          // outputs a box :|
110*c2c66affSColin Finck     CheckHardError(0x40000010,                  0, OptionOkCancel,          STATUS_SUCCESS,            ResponseCancel,         0, 0);                          // outputs a box :|
111*c2c66affSColin Finck     CheckHardError(0x40000011,                  0, OptionRetryCancel,       STATUS_SUCCESS,            ResponseRetry,          0, 0);                          // outputs a box :|
112*c2c66affSColin Finck     CheckHardError(0x40000011,                  0, OptionRetryCancel,       STATUS_SUCCESS,            ResponseCancel,         0, 0);                          // outputs a box :|
113*c2c66affSColin Finck     CheckHardError(0x40000012,                  0, OptionYesNo,             STATUS_SUCCESS,            ResponseYes,            0, 0);                          // outputs a box :|
114*c2c66affSColin Finck     CheckHardError(0x40000012,                  0, OptionYesNo,             STATUS_SUCCESS,            ResponseNo,             0, 0);                          // outputs a box :|
115*c2c66affSColin Finck     CheckHardError(0x40000013,                  0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            0, 0);                          // outputs a box :|
116*c2c66affSColin Finck     CheckHardError(0x40000013,                  0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             0, 0);                          // outputs a box :|
117*c2c66affSColin Finck     CheckHardError(0x40000013,                  0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         0, 0);                          // outputs a box :|
118*c2c66affSColin Finck     }
119*c2c66affSColin Finck     CheckHardError(0x40000009,                  0, 9,                       STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
120*c2c66affSColin Finck     CheckHardError(0x4000000a,                  0, 10,                      STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
121*c2c66affSColin Finck     CheckHardError(0x4000000b,                  0, 11,                      STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
122*c2c66affSColin Finck     CheckHardError(0x4000000c,                  0, 12,                      STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
123*c2c66affSColin Finck     CheckHardError(0x4000000d,                  0, MAXULONG / 2 + 1,        STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
124*c2c66affSColin Finck     CheckHardError(0x4000000d,                  0, MAXULONG,                STATUS_SUCCESS,            ResponseNotHandled,     0, 0);
125*c2c66affSColin Finck 
126*c2c66affSColin Finck     if (InteractivePart2)
127*c2c66affSColin Finck     {
128*c2c66affSColin Finck     /* try a message with one parameter */
129*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            1, &String1);                   // outputs a box :|
130*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, &String1);                   // outputs a box :|
131*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         0, &String1);                   // outputs a box :|
132*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         0, &String1);                   // outputs a box :|
133*c2c66affSColin Finck     /* give too many parameters */
134*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            2, &String1, &String2);         // outputs a box :|
135*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        2, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         2, &String1, &String2);         // outputs a box :|
136*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            2, &String1, &String2);         // outputs a box :|
137*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            4, &String1, &String2, 0, 0);   // outputs a box :|
138*c2c66affSColin Finck     /* try with stuff that's not a UNICODE_STRING */
139*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, &String1Ansi);               // outputs a box :|
140*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, L"Parameter1");              // outputs a box :|
141*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, "Parameter1");               // outputs a box :|
142*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, 1234);                       // outputs a box :|
143*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, NULL);                       // outputs a box :|
144*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, &String1Ansi);               // outputs a box :|
145*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, L"Parameter1");              // outputs a box :|
146*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, "Parameter1");               // outputs a box :|
147*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, 1234);                       // outputs a box :|
148*c2c66affSColin Finck     CheckHardError(STATUS_DLL_NOT_FOUND,        0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, NULL);                       // outputs a box :|
149*c2c66affSColin Finck     }
150*c2c66affSColin Finck     if (InteractivePart3)
151*c2c66affSColin Finck     {
152*c2c66affSColin Finck     /* try a message with one parameter */
153*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, &String1);                   // outputs a box :|
154*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, &String1);                   // outputs a box :|
155*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     0, &String1);                   // outputs a box :|
156*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     0, &String1);                   // outputs a box :|
157*c2c66affSColin Finck     /* give too many parameters */
158*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     2, &String1, &String2);         // outputs a box :|
159*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 2, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     2, &String1, &String2);         // outputs a box :|
160*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     2, &String1, &String2);         // outputs a box :|
161*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseOk,             3, &String1, &String2, 0);      // outputs a box :|
162*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseOk,             4, &String1, &String2, 0, 0);   // outputs a box :|
163*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionOkNoWait,          STATUS_SUCCESS,            ResponseOk,             4, &String1, &String2, 0, 0);   // outputs a balloon notification
164*c2c66affSColin Finck     /* try with stuff that's not a UNICODE_STRING */
165*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, &String1Ansi);               // outputs a box :|
166*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, L"Parameter1");              // outputs a box :|
167*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, "Parameter1");               // outputs a box :|
168*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, 1234);                       // outputs a box :|
169*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, NULL);                       // outputs a box :|
170*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, &String1Ansi);               // outputs a box :|
171*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, L"Parameter1");              // outputs a box :|
172*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, "Parameter1");               // outputs a box :|
173*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, 1234);                       // outputs a box :|
174*c2c66affSColin Finck     CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNotHandled,     1, NULL);                       // outputs a box :|
175*c2c66affSColin Finck     }
176*c2c66affSColin Finck     if (InteractivePart4)
177*c2c66affSColin Finck     {
178*c2c66affSColin Finck     /* try a message with one parameter */
179*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            1, &String1);                   // outputs a box :|
180*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, &String1);                   // outputs a box :|
181*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         0, &String1);                   // outputs a box :|
182*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         0, &String1);                   // outputs a box :|
183*c2c66affSColin Finck     /* give too many parameters */
184*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            2, &String1, &String2);         // outputs a box :|
185*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       2, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         2, &String1, &String2);         // outputs a box :|
186*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            2, &String1, &String2);         // outputs a box :|
187*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       3, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseYes,            4, &String1, &String2, 0, 0);   // outputs a box :|
188*c2c66affSColin Finck     /* try with stuff that's not a UNICODE_STRING */
189*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, &String1Ansi);               // outputs a box :|
190*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, L"Parameter1");              // outputs a box :|
191*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseNo,             1, "Parameter1");               // outputs a box :|
192*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, 1234);                       // outputs a box :|
193*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, NULL);                       // outputs a box :|
194*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, &String1Ansi);               // outputs a box :|
195*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, L"Parameter1");              // outputs a box :|
196*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, "Parameter1");               // outputs a box :|
197*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, 1234);                       // outputs a box :|
198*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseCancel,         1, NULL);                       // outputs a box :|
199*c2c66affSColin Finck 
200*c2c66affSColin Finck     // TODO: these 3 are interactive on ROS
201*c2c66affSColin Finck     CheckInformationalHardError(STATUS_WAIT_0,               NULL,     NULL, STATUS_SUCCESS, TRUE);                                                            // outputs a balloon notification
202*c2c66affSColin Finck     CheckInformationalHardError(STATUS_DLL_NOT_FOUND,        &String1, NULL, STATUS_SUCCESS, TRUE);                                                            // outputs a balloon notification
203*c2c66affSColin Finck     CheckInformationalHardError(STATUS_DLL_NOT_FOUND,        NULL,     NULL, STATUS_SUCCESS, TRUE);                                                            // outputs a balloon notification
204*c2c66affSColin Finck     }
205*c2c66affSColin Finck     CheckInformationalHardError(STATUS_SERVICE_NOTIFICATION, &String1, NULL, STATUS_SUCCESS, FALSE);
206*c2c66affSColin Finck 
207*c2c66affSColin Finck     ok_bool_true(IoSetThreadHardErrorMode(TRUE), "IoSetThreadHardErrorMode returned");
208*c2c66affSColin Finck     ok_bool_true(IoSetThreadHardErrorMode(FALSE), "IoSetThreadHardErrorMode returned");
209*c2c66affSColin Finck     ok_bool_false(IoSetThreadHardErrorMode(FALSE), "IoSetThreadHardErrorMode returned");
210*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       0, OptionYesNoCancel,       STATUS_SUCCESS,            ResponseReturnToCaller, 0, 0);
211*c2c66affSColin Finck     CheckHardError(STATUS_FATAL_APP_EXIT,       1, OptionYesNoCancel,       STATUS_ACCESS_VIOLATION,   NoResponse,             1, NULL);
212*c2c66affSColin Finck     CheckInformationalHardError(STATUS_WAIT_0,               NULL,     NULL, STATUS_SUCCESS, FALSE);
213*c2c66affSColin Finck     CheckInformationalHardError(STATUS_DLL_NOT_FOUND,        &String1, NULL, STATUS_SUCCESS, FALSE);
214*c2c66affSColin Finck     CheckInformationalHardError(STATUS_DLL_NOT_FOUND,        NULL,     NULL, STATUS_SUCCESS, FALSE);
215*c2c66affSColin Finck     CheckInformationalHardError(STATUS_SERVICE_NOTIFICATION, &String1, NULL, STATUS_SUCCESS, FALSE);
216*c2c66affSColin Finck     ok_bool_false(IoSetThreadHardErrorMode(TRUE), "IoSetThreadHardErrorMode returned");
217*c2c66affSColin Finck }
218*c2c66affSColin Finck 
START_TEST(ExHardError)219*c2c66affSColin Finck START_TEST(ExHardError)
220*c2c66affSColin Finck {
221*c2c66affSColin Finck     TestHardError(FALSE, FALSE, FALSE, FALSE);
222*c2c66affSColin Finck }
223*c2c66affSColin Finck 
224*c2c66affSColin Finck /* Here's how to do the interactive test:
225*c2c66affSColin Finck  * - First there will be a few messages random messages. If there's
226*c2c66affSColin Finck  *   multiple options available, the same box will appear multiple times --
227*c2c66affSColin Finck  *   click the buttons in order from left to right
228*c2c66affSColin Finck  * - After that, you must verify the error parameters. You should always
229*c2c66affSColin Finck  *   see Parameter1 or Parameter2 for strings, and 0x12345678 for numbers.
230*c2c66affSColin Finck  *   if there's a message saying an exception occured during processing,
231*c2c66affSColin Finck  *   click cancel. If there's a bad parameter (Parameter1+, Parameter1+Garbage
232*c2c66affSColin Finck  *   or an empty string for example), click no. Otherwise click yes. */
START_TEST(ExHardErrorInteractive)233*c2c66affSColin Finck START_TEST(ExHardErrorInteractive)
234*c2c66affSColin Finck {
235*c2c66affSColin Finck     TestHardError(TRUE, TRUE, TRUE, TRUE);
236*c2c66affSColin Finck }
237