https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c9de708a9bd8a58158c911fbc7e334611a8b26df

commit c9de708a9bd8a58158c911fbc7e334611a8b26df
Author:     Amine Khaldi <[email protected]>
AuthorDate: Sat Feb 2 13:26:39 2019 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Sat Feb 2 13:26:39 2019 +0100

    [PDH] Sync with Wine Staging 4.0. CORE-15682
---
 dll/win32/pdh/pdh.spec   |  2 +-
 dll/win32/pdh/pdh_main.c | 24 ++++++++++++++++++------
 media/doc/README.WINE    |  2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/dll/win32/pdh/pdh.spec b/dll/win32/pdh/pdh.spec
index 72e6fa39f0..5f61a8a42c 100644
--- a/dll/win32/pdh/pdh.spec
+++ b/dll/win32/pdh/pdh.spec
@@ -141,7 +141,7 @@
 @ stdcall PdhValidatePathExA(ptr str)
 @ stdcall PdhValidatePathExW(ptr wstr)
 @ stdcall PdhValidatePathW(wstr)
-@ stub PdhVbAddCounter
+@ stdcall PdhVbAddCounter(ptr str ptr)
 @ stub PdhVbCreateCounterPathList
 @ stub PdhVbGetCounterPathElements
 @ stub PdhVbGetCounterPathFromList
diff --git a/dll/win32/pdh/pdh_main.c b/dll/win32/pdh/pdh_main.c
index fb131bd354..bc3674a28a 100644
--- a/dll/win32/pdh/pdh_main.c
+++ b/dll/win32/pdh/pdh_main.c
@@ -210,7 +210,7 @@ static const struct source counter_sources[] =
 static BOOL is_local_machine( const WCHAR *name, DWORD len )
 {
     WCHAR buf[MAX_COMPUTERNAME_LENGTH + 1];
-    DWORD buflen = sizeof(buf) / sizeof(buf[0]);
+    DWORD buflen = ARRAY_SIZE(buf);
 
     if (!GetComputerNameW( buf, &buflen )) return FALSE;
     return len == buflen && !memicmpW( name, buf, buflen );
@@ -274,7 +274,7 @@ PDH_STATUS WINAPI PdhAddCounterW( PDH_HQUERY hquery, 
LPCWSTR path,
     }
 
     *hcounter = NULL;
-    for (i = 0; i < sizeof(counter_sources) / sizeof(counter_sources[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
     {
         if (pdh_match_path( counter_sources[i].path, path ))
         {
@@ -867,7 +867,7 @@ PDH_STATUS WINAPI PdhLookupPerfIndexByNameW( LPCWSTR 
machine, LPCWSTR name, LPDW
         FIXME("remote machine not supported\n");
         return PDH_CSTATUS_NO_MACHINE;
     }
-    for (i = 0; i < sizeof(counter_sources) / sizeof(counter_sources[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
     {
         if (pdh_match_path( counter_sources[i].path, name ))
         {
@@ -886,7 +886,7 @@ PDH_STATUS WINAPI PdhLookupPerfNameByIndexA( LPCSTR 
machine, DWORD index, LPSTR
     PDH_STATUS ret;
     WCHAR *machineW = NULL;
     WCHAR bufferW[PDH_MAX_COUNTER_NAME];
-    DWORD sizeW = sizeof(bufferW) / sizeof(WCHAR);
+    DWORD sizeW = ARRAY_SIZE(bufferW);
 
     TRACE("%s %d %p %p\n", debugstr_a(machine), index, buffer, size);
 
@@ -925,7 +925,7 @@ PDH_STATUS WINAPI PdhLookupPerfNameByIndexW( LPCWSTR 
machine, DWORD index, LPWST
     if (!buffer || !size) return PDH_INVALID_ARGUMENT;
     if (!index) return ERROR_SUCCESS;
 
-    for (i = 0; i < sizeof(counter_sources) / sizeof(counter_sources[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
     {
         if (counter_sources[i].index == index)
         {
@@ -1077,12 +1077,24 @@ PDH_STATUS WINAPI PdhValidatePathW( LPCWSTR path )
 
     if ((ret = validate_path( path ))) return ret;
 
-    for (i = 0; i < sizeof(counter_sources) / sizeof(counter_sources[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
         if (pdh_match_path( counter_sources[i].path, path )) return 
ERROR_SUCCESS;
 
     return PDH_CSTATUS_NO_COUNTER;
 }
 
+/***********************************************************************
+ *              PdhVbAddCounter   (PDH.@)
+ */
+PDH_STATUS WINAPI PdhVbAddCounter( PDH_HQUERY query, LPCSTR path, PDH_HCOUNTER 
*counter )
+{
+    FIXME("%p, %s, %p: stub!\n", query, debugstr_a(path), counter);
+
+    if (!path) return PDH_INVALID_ARGUMENT;
+
+    return PDH_NOT_IMPLEMENTED;
+}
+
 /***********************************************************************
  *              PdhValidatePathExA   (PDH.@)
  */
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 6807b80ceb..d82d26ee10 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -147,7 +147,7 @@ reactos/dll/win32/oledlg              # Synced to 
WineStaging-4.0
 reactos/dll/win32/olepro32            # Synced to WineStaging-3.3
 reactos/dll/win32/olesvr32            # Synced to WineStaging-3.3
 reactos/dll/win32/olethk32            # Synced to WineStaging-3.3
-reactos/dll/win32/pdh                 # Synced to WineStaging-3.3
+reactos/dll/win32/pdh                 # Synced to WineStaging-4.0
 reactos/dll/win32/pidgen              # Synced to WineStaging-3.9
 reactos/dll/win32/powrprof            # Forked at Wine-1.0rc5
 reactos/dll/win32/printui             # Synced to WineStaging-3.3

Reply via email to