[PATCH] pdh/tests: Add test for PdhOpenLog

Nipun Garg nipung271 at gmail.com
Thu Apr 29 09:41:29 CDT 2021


Signed-off-by: Nipun Garg <nipung271 at gmail.com>
---
 dlls/pdh/tests/pdh.c | 21 +++++++++++++++++++++
 include/pdh.h        | 19 +++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c
index 71603f8c6ba..74fc0a20d80 100644
--- a/dlls/pdh/tests/pdh.c
+++ b/dlls/pdh/tests/pdh.c
@@ -126,6 +126,27 @@ static void test_PdhOpenQueryW( void )
     ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
 }
 
+static void test_PdhOpenLogA( void )
+{
+    PDH_STATUS ret;
+    PDH_HLOG log;
+
+    ret = PdhOpenLogA( NULL, PDH_LOG_READ_ACCESS, PDH_LOG_TYPE_CSV, NULL, 0, NULL, NULL );
+    ok(ret == PDH_INVALID_HANDLE, "PdhOpenLogA failed 0x%08x\n", ret);
+
+    ret = PdhOpenLogA( NULL, PDH_LOG_READ_ACCESS, PDH_LOG_TYPE_CSV, NULL, 0, NULL, log );
+    ok(ret == ERROR_SUCCESS, "PdhOpenLogA failed 0x%08x\n", ret);
+
+    ret = PdhCloseLog( NULL, 0 );
+    ok(ret == PDH_INVALID_HANDLE, "PdhCloseLog failed 0x%08x\n", ret);
+
+    ret = PdhCloseLog( log, 0 );
+    ok(ret == ERROR_SUCCESS, "PdhCloseLog failed 0x%08x\n", ret);
+
+    ret = PdhCloseLog( log, 0 );
+    ok(ret == PDH_INVALID_HANDLE, "PdhCloseLog failed 0x%08x\n", ret);
+}
+
 static void test_PdhAddCounterA( void )
 {
     PDH_STATUS ret;
diff --git a/include/pdh.h b/include/pdh.h
index 3d688bd8ded..f3ea6ec7c1b 100644
--- a/include/pdh.h
+++ b/include/pdh.h
@@ -57,6 +57,25 @@ typedef PDH_HLOG     HLOG;
 #define DATA_SOURCE_LOGFILE     0x00000002
 #define DATA_SOURCE_WBEM        0x00000004
 
+#define PDH_LOG_READ_ACCESS      0x00010000
+#define PDH_LOG_WRITE_ACCESS     0x00020000
+#define PDH_LOG_UPDATE_ACCESS    0x00040000
+
+#define PDH_LOG_CREATE_NEW         0x00000001
+#define PDH_LOG_CREATE_ALWAYS      0x00000002
+#define PDH_LOG_OPEN_ALWAYS        0x00000003
+#define PDH_LOG_OPEN_EXISTING      0x00000004
+#define PDH_LOG_OPT_USER_STRING    0x01000000
+#define PDH_LOG_OPT_CIRCULAR       0x02000000
+
+#define PDH_LOG_TYPE_UNDEFINED    0x00000000
+#define PDH_LOG_TYPE_CSV          0x00000001
+#define PDH_LOG_TYPE_TSV          0x00000002
+#define PDH_LOG_TYPE_SQL          0x00000007
+#define PDH_LOG_TYPE_BINARY       0x00000008
+
+#define PDH_FLAG_CLOSE_QUERY    0x00000001
+
 #ifdef WINE_NO_UNICODE_MACROS
 # define DECL_PDH_TYPE_AW(name)  /* nothing */
 #else  /* WINE_NO_UNICODE_MACROS */
-- 
2.30.0




More information about the wine-devel mailing list