2 * Copyright 2021 Dmitry Timoshkov
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define NONAMELESSUNION
26 #include "wine/test.h"
28 static void test_EvtGetChannelConfigProperty(void)
39 ret
= RegCreateKeyW(HKEY_LOCAL_MACHINE
, L
"System\\CurrentControlSet\\Services\\EventLog\\Winetest", &key
);
40 if (ret
== ERROR_ACCESS_DENIED
)
42 skip("Not enough privileges to modify HKLM\n");
45 ok(ret
== ERROR_SUCCESS
, "RegCreateKey error %u\n", ret
);
47 config
= EvtOpenChannelConfig(NULL
, L
"Winetest", 0);
48 ok(config
!= NULL
, "EvtOpenChannelConfig error %u\n", GetLastError());
50 ret
= EvtGetChannelConfigProperty(config
, EvtChannelLoggingConfigLogFilePath
, 0, 0, NULL
, &size
);
51 ok(!ret
, "EvtGetChannelConfigProperty should fail\n");
52 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "got %u\n", GetLastError());
53 ok(size
< sizeof(path
), "got %u\n", size
);
55 memset(&path
, 0, sizeof(path
));
56 path
.var
.Count
= 0xdeadbeef;
57 path
.var
.Type
= 0xdeadbeef;
58 ret
= EvtGetChannelConfigProperty(config
, EvtChannelLoggingConfigLogFilePath
, 0, size
, (EVT_VARIANT
*)&path
, &size
);
59 ok(ret
, "EvtGetChannelConfigProperty error %u\n", GetLastError());
60 ok(path
.var
.Count
== 0xdeadbeef, "got %u\n", path
.var
.Count
);
61 ok(path
.var
.Type
== EvtVarTypeString
, "got %u\n", path
.var
.Type
);
62 ok(size
== sizeof(EVT_VARIANT
) + (wcslen(path
.var
.u
.StringVal
) + 1) * sizeof(WCHAR
), "got %u\n", size
);
63 ok(path
.var
.u
.StringVal
== path
.buf
, "path.var.u.StringVal = %p, path.buf = %p\n", path
.var
.u
.StringVal
, path
.buf
);
67 RegDeleteKeyW(key
, L
"");
73 test_EvtGetChannelConfigProperty();