1 /* Copyright (C) 1998 Transarc Corporation. All rights reserved.
12 #include <WINNT/afsreg.h>
13 #include <WINNT/afsevent.h>
15 int main(int argc, char **argv)
17 HKEY applogKey, afslogKey;
20 /* Determine if registry is (likely to be) configured */
22 status = RegOpenKeyAlt(AFSREG_NULL_KEY, AFSREG_APPLOG_KEY,
23 KEY_READ, 0, &applogKey, NULL);
25 if (status == ERROR_SUCCESS) {
26 status = RegOpenKeyAlt(applogKey, AFSREG_SVR_APPLOG_SUBKEY,
27 KEY_READ, 0, &afslogKey, NULL);
29 if (status == ERROR_SUCCESS) {
30 (void) RegCloseKey(afslogKey);
33 (void) RegCloseKey(applogKey);
36 if (status != ERROR_SUCCESS) {
37 printf("\n%s: expected event source %s not found in registry; "
38 "test not run.\n", argv[0], AFSREG_SVR_APPLOG_SUBKEY);
42 /* Log test message w/o any insertion strings */
44 printf("Logging server INFORMATION event (0 insert strings)\n");
45 if (ReportInformationEventAlt(AFSEVT_SVR_TEST_MSG_NOARGS, 0)) {
46 printf("\n%s: logging failed\n", argv[0]);
50 printf("Logging server WARNING event (0 insert strings, status 0)\n");
51 if (ReportWarningEventAlt(AFSEVT_SVR_TEST_MSG_NOARGS, 0, 0)) {
52 printf("\n%s: logging failed\n", argv[0]);
56 printf("Logging server ERROR event (0 insert strings, status 15)\n");
57 if (ReportErrorEventAlt(AFSEVT_SVR_TEST_MSG_NOARGS, 15, 0)) {
58 printf("\n%s: logging failed\n", argv[0]);
62 /* Log test message with two insertion strings */
64 printf("Logging server INFORMATION event (2 insert strings)\n");
65 if (ReportInformationEventAlt(AFSEVT_SVR_TEST_MSG_TWOARGS,
66 "Insert string 1", "Insert String 2", 0)) {
67 printf("\n%s: logging failed\n", argv[0]);
71 printf("Logging server WARNING event (2 insert strings, status 0)\n");
72 if (ReportWarningEventAlt(AFSEVT_SVR_TEST_MSG_TWOARGS, 0,
73 "Insert string 1", "Insert String 2", 0)) {
74 printf("\n%s: logging failed\n", argv[0]);
78 printf("Logging server ERROR event (2 insert strings, status 15)\n");
79 if (ReportErrorEventAlt(AFSEVT_SVR_TEST_MSG_TWOARGS, 15,
80 "Insert string 1", "Insert String 2", 0)) {
81 printf("\n%s: logging failed\n", argv[0]);