2 * Unit tests for Event Logging functions
4 * Copyright (c) 2009 Paul Vriens
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/test.h"
30 static void test_open_close(void)
35 SetLastError(0xdeadbeef);
36 ret
= CloseEventLog(NULL
);
39 ok(!ret
, "Expected failure\n");
40 ok(GetLastError() == ERROR_INVALID_HANDLE
||
41 GetLastError() == ERROR_NOACCESS
, /* W2K */
42 "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
45 SetLastError(0xdeadbeef);
46 handle
= OpenEventLogA(NULL
, NULL
);
49 ok(handle
== NULL
, "Didn't expect a handle\n");
50 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
53 SetLastError(0xdeadbeef);
54 handle
= OpenEventLogA("IDontExist", NULL
);
57 ok(handle
== NULL
, "Didn't expect a handle\n");
58 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
61 SetLastError(0xdeadbeef);
62 handle
= OpenEventLogA("IDontExist", "deadbeef");
65 ok(handle
== NULL
, "Didn't expect a handle\n");
66 ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE
||
67 GetLastError() == RPC_S_INVALID_NET_ADDR
, /* Some Vista and Win7 */
68 "Expected RPC_S_SERVER_UNAVAILABLE, got %d\n", GetLastError());
71 /* This one opens the Application log */
72 handle
= OpenEventLogA(NULL
, "deadbeef");
73 ok(handle
!= NULL
, "Expected a handle\n");
74 ret
= CloseEventLog(handle
);
75 ok(ret
, "Expected success\n");
76 /* Close a second time */
77 SetLastError(0xdeadbeef);
78 ret
= CloseEventLog(handle
);
81 ok(!ret
, "Expected failure\n");
82 ok(GetLastError() == ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
85 handle
= OpenEventLogA(NULL
, "Application");
86 ok(handle
!= NULL
, "Expected a handle\n");
87 CloseEventLog(handle
);
92 SetLastError(0xdeadbeef);
94 if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
96 win_skip("Event log functions are not implemented\n");
100 /* Parameters only */