From: Erich Hoover ehoover@mines.edu
From: Erich Hoover ehoover@mines.edu Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/pdh/pdh_main.c | 3 +++ dlls/pdh/tests/pdh.c | 7 +++++++ 2 files changed, 10 insertions(+)
diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index 7ef91f1a7fb..ef69e45fca4 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -178,6 +178,8 @@ struct source static const WCHAR path_processor_time[] = {'\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')', '\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}; +static const WCHAR path_processor[] = + {'\','P','r','o','c','e','s','s','o','r',0}; static const WCHAR path_uptime[] = {'\','S','y','s','t','e','m', '\', 'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
@@ -204,6 +206,7 @@ static void CALLBACK collect_uptime( struct counter *counter ) static const struct source counter_sources[] = { { 6, path_processor_time, collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 }, + { 238, path_processor, NULL, 0, 0, 0 }, { 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 } };
diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c index 0a17906afbd..a9613e22b02 100644 --- a/dlls/pdh/tests/pdh.c +++ b/dlls/pdh/tests/pdh.c @@ -673,6 +673,13 @@ static void test_PdhLookupPerfNameByIndexA( void ) "PdhLookupPerfNameByIndexA failed, got %s expected '%% Processor Time'\n", buffer); ok(size == sizeof("% Processor Time"), "PdhLookupPerfNameByIndexA failed %d\n", size);
+ size = sizeof(buffer); + ret = PdhLookupPerfNameByIndexA( NULL, 238, buffer, &size ); + ok(ret == ERROR_SUCCESS, "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret); + ok(!lstrcmpA( buffer, "Processor" ), + "PdhLookupPerfNameByIndexA failed, got %s expected 'Processor'\n", buffer); + ok(size == sizeof("Processor"), "PdhLookupPerfNameByIndexA failed %d\n", size); + size = sizeof(buffer); ret = PdhLookupPerfNameByIndexA( NULL, 674, NULL, &size ); ok(ret == PDH_INVALID_ARGUMENT ||
Vijay Kiran Kamuju infyquest@gmail.com writes:
@@ -204,6 +206,7 @@ static void CALLBACK collect_uptime( struct counter *counter ) static const struct source counter_sources[] = { { 6, path_processor_time, collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 },
- { 238, path_processor, NULL, 0, 0, 0 },
So what happens if you use PdhAddCounter with this counter?
This is a trivial patch which is can fix https://bugs.winehq.org/show_bug.cgi?id=33018 This is related to silverlight which now obsolete. There are no other known applications which use this. --- Vijay
On Mon, May 13, 2019 at 1:21 PM Alexandre Julliard julliard@winehq.org wrote:
Vijay Kiran Kamuju infyquest@gmail.com writes:
@@ -204,6 +206,7 @@ static void CALLBACK collect_uptime( struct counter *counter ) static const struct source counter_sources[] = { { 6, path_processor_time, collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 },
- { 238, path_processor, NULL, 0, 0, 0 },
So what happens if you use PdhAddCounter with this counter?
-- Alexandre Julliard julliard@winehq.org
On Mon, May 13, 2019 at 2:29 PM Vijay Kiran Kamuju infyquest@gmail.com wrote:
This is a trivial patch which is can fix https://bugs.winehq.org/show_bug.cgi?id=33018 This is related to silverlight which now obsolete. There are no other known applications which use this. ...
What AJ is saying is that PdhAddCounter can also use these strings and in this case it probably needs to throw an error. From MSDN, I would guess that it likely spits out PDH_CSTATUS_BAD_COUNTERNAME.
Best, Erich