Commit 7fb6c7a0 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

pdh: Use wide-char string literals.

parent b793799d
......@@ -174,12 +174,6 @@ struct source
LONGLONG base; /* samples per second */
};
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_uptime[] =
{'\\','S','y','s','t','e','m', '\\', 'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
static void CALLBACK collect_processor_time( struct counter *counter )
{
counter->two.largevalue = 500000; /* FIXME */
......@@ -202,8 +196,8 @@ static void CALLBACK collect_uptime( struct counter *counter )
/* counter source registry */
static const struct source counter_sources[] =
{
{ 6, path_processor_time, collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 },
{ 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 }
{ 6, L"\\Processor(_Total)\\% Processor Time", collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 },
{ 674, L"\\System\\System Up Time", collect_uptime, TYPE_UPTIME, -3, 1000 }
};
static BOOL is_local_machine( const WCHAR *name, DWORD len )
......@@ -1181,12 +1175,6 @@ done:
PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR buffer,
LPDWORD buflen, DWORD flags )
{
static const WCHAR bslash[] = {'\\',0};
static const WCHAR fslash[] = {'/',0};
static const WCHAR lparen[] = {'(',0};
static const WCHAR rparen[] = {')',0};
static const WCHAR fmt[] = {'#','%','u',0};
WCHAR path[PDH_MAX_COUNTER_NAME], instance[12];
PDH_STATUS ret = ERROR_SUCCESS;
DWORD len;
......@@ -1201,26 +1189,25 @@ PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR bu
path[0] = 0;
if (e->szMachineName)
{
lstrcatW(path, bslash);
lstrcatW(path, bslash);
lstrcatW(path, L"\\\\");
lstrcatW(path, e->szMachineName);
}
lstrcatW(path, bslash);
lstrcatW(path, L"\\");
lstrcatW(path, e->szObjectName);
if (e->szInstanceName)
{
lstrcatW(path, lparen);
lstrcatW(path, L"(");
if (e->szParentInstance)
{
lstrcatW(path, e->szParentInstance);
lstrcatW(path, fslash);
lstrcatW(path, L"/");
}
lstrcatW(path, e->szInstanceName);
swprintf(instance, ARRAY_SIZE(instance), fmt, e->dwInstanceIndex);
swprintf(instance, ARRAY_SIZE(instance), L"#%u", e->dwInstanceIndex);
lstrcatW(path, instance);
lstrcatW(path, rparen);
lstrcatW(path, L")");
}
lstrcatW(path, bslash);
lstrcatW(path, L"\\");
lstrcatW(path, e->szCounterName);
len = lstrlenW(path) + 1;
......
......@@ -71,18 +71,12 @@ static void init_function_ptrs( void )
GETFUNCPTR( PdhValidatePathExW )
}
static const WCHAR processor_time[] =
{'%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0};
static const WCHAR uptime[] =
{'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
static const WCHAR system_uptime[] =
{'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
static const WCHAR nonexistent_counter[] =
{'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','D','o','w','n',' ','T','i','m','e',0};
static const WCHAR percentage_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 processor_time[] = L"% Processor Time";
static const WCHAR uptime[] = L"System Up Time";
static const WCHAR system_uptime[] = L"\\System\\System Up Time";
static const WCHAR nonexistent_counter[] = L"\\System\\System Down Time";
static const WCHAR percentage_processor_time[] = L"\\Processor(_Total)\\% Processor Time";
static void test_PdhOpenQueryA( void )
{
......@@ -630,15 +624,13 @@ static void test_PdhLookupPerfIndexByNameW( void )
PDH_STATUS ret;
DWORD index;
static const WCHAR no_counter[] = {'N','o',' ','C','o','u','n','t','e','r',0};
ret = PdhLookupPerfIndexByNameW( NULL, NULL, NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
ret = PdhLookupPerfIndexByNameW( NULL, NULL, &index );
ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
ret = PdhLookupPerfIndexByNameW( NULL, no_counter, &index );
ret = PdhLookupPerfIndexByNameW( NULL, L"No Counter", &index );
ok(ret == PDH_STRING_NOT_FOUND, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
ret = PdhLookupPerfIndexByNameW( NULL, processor_time, NULL );
......@@ -744,16 +736,13 @@ static void test_PdhValidatePathW( void )
{
PDH_STATUS ret;
static const WCHAR empty[] = {0};
static const WCHAR system[] = {'\\','S','y','s','t','e','m',0};
ret = PdhValidatePathW( NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret);
ret = PdhValidatePathW( empty );
ret = PdhValidatePathW( L"" );
ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret);
ret = PdhValidatePathW( system );
ret = PdhValidatePathW( L"\\System" );
ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathW failed 0x%08x\n", ret);
ret = PdhValidatePathW( uptime );
......@@ -793,16 +782,13 @@ static void test_PdhValidatePathExW( void )
{
PDH_STATUS ret;
static const WCHAR empty[] = {0};
static const WCHAR system[] = {'\\','S','y','s','t','e','m',0};
ret = pPdhValidatePathExW( NULL, NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret);
ret = pPdhValidatePathExW( NULL, empty );
ret = pPdhValidatePathExW( NULL, L"" );
ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret);
ret = pPdhValidatePathExW( NULL, system );
ret = pPdhValidatePathExW( NULL, L"\\System" );
ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExW failed 0x%08x\n", ret);
ret = pPdhValidatePathExW( NULL, uptime );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment