mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[PDH_WINETEST]
* Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60361
This commit is contained in:
parent
9b96b235a8
commit
0387152a97
|
@ -1,10 +1,5 @@
|
|||
|
||||
add_definitions(
|
||||
-D__ROS_LONG64__
|
||||
-D_DLL -D__USE_CRTIMP)
|
||||
|
||||
add_executable(pdh_winetest pdh.c testlist.c)
|
||||
target_link_libraries(pdh_winetest wine)
|
||||
set_module_type(pdh_winetest win32cui)
|
||||
add_importlibs(pdh_winetest pdh msvcrt kernel32 ntdll)
|
||||
add_cd_file(TARGET pdh_winetest DESTINATION reactos/bin FOR all)
|
||||
|
|
|
@ -37,6 +37,30 @@ static PDH_STATUS (WINAPI *pPdhValidatePathExW)(PDH_HLOG, LPCWSTR);
|
|||
|
||||
#define GETFUNCPTR(func) p##func = (void *)GetProcAddress( pdh, #func );
|
||||
|
||||
|
||||
/* Returns true if the user interface is in English. Note that this does not
|
||||
* presume of the formatting of dates, numbers, etc.
|
||||
*/
|
||||
static BOOL is_lang_english(void)
|
||||
{
|
||||
static HMODULE hkernel32 = NULL;
|
||||
static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
|
||||
static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
|
||||
|
||||
if (!hkernel32)
|
||||
{
|
||||
hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
|
||||
pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
|
||||
}
|
||||
if (pGetThreadUILanguage)
|
||||
return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
|
||||
if (pGetUserDefaultUILanguage)
|
||||
return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
|
||||
|
||||
return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
|
||||
}
|
||||
|
||||
static void init_function_ptrs( void )
|
||||
{
|
||||
pdh = GetModuleHandle( "pdh" );
|
||||
|
@ -54,7 +78,7 @@ static const WCHAR uptime[] =
|
|||
|
||||
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 system_downtime[] = /* does not exist */
|
||||
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',')',
|
||||
|
@ -129,8 +153,10 @@ static void test_PdhAddCounterA( void )
|
|||
ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, NULL );
|
||||
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhAddCounterA( query, "\\System\\System Down Time", 0, &counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddCounterA failed 0x%08x\n", ret);
|
||||
ret = PdhAddCounterA( query, "\\System\\Nonexistent Counter", 0, &counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER ||
|
||||
broken(ret == PDH_INVALID_PATH), /* Win2K */
|
||||
"PdhAddCounterA failed 0x%08x\n", ret);
|
||||
ok(!counter, "PdhAddCounterA failed %p\n", counter);
|
||||
|
||||
ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
|
||||
|
@ -176,8 +202,10 @@ static void test_PdhAddCounterW( void )
|
|||
ret = PdhAddCounterW( query, percentage_processor_time, 0, NULL );
|
||||
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterW failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhAddCounterW( query, system_downtime, 0, &counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddCounterW failed 0x%08x\n", ret);
|
||||
ret = PdhAddCounterW( query, nonexistent_counter, 0, &counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER ||
|
||||
broken(ret == PDH_INVALID_PATH), /* Win2K */
|
||||
"PdhAddCounterW failed 0x%08x\n", ret);
|
||||
ok(!counter, "PdhAddCounterW failed %p\n", counter);
|
||||
|
||||
ret = PdhAddCounterW( query, percentage_processor_time, 0, &counter );
|
||||
|
@ -267,7 +295,7 @@ static void test_PdhAddEnglishCounterW( void )
|
|||
ret = pPdhAddEnglishCounterW( query, system_uptime, 0, NULL );
|
||||
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
|
||||
|
||||
ret = pPdhAddEnglishCounterW( query, system_downtime, 0, &counter );
|
||||
ret = pPdhAddEnglishCounterW( query, nonexistent_counter, 0, &counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
|
||||
ok(!counter, "PdhAddEnglishCounterA failed %p\n", counter);
|
||||
|
||||
|
@ -705,7 +733,7 @@ static void test_PdhValidatePathA( void )
|
|||
ret = PdhValidatePathA( "System Up Time" );
|
||||
ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathA failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhValidatePathA( "\\System\\System Down Time" );
|
||||
ret = PdhValidatePathA( "\\System\\Nonexistent Counter" );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathA failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhValidatePathA( "\\System\\System Up Time" );
|
||||
|
@ -731,7 +759,7 @@ static void test_PdhValidatePathW( void )
|
|||
ret = PdhValidatePathW( uptime );
|
||||
ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathW failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhValidatePathW( system_downtime );
|
||||
ret = PdhValidatePathW( nonexistent_counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathW failed 0x%08x\n", ret);
|
||||
|
||||
ret = PdhValidatePathW( system_uptime );
|
||||
|
@ -780,7 +808,7 @@ static void test_PdhValidatePathExW( void )
|
|||
ret = pPdhValidatePathExW( NULL, uptime );
|
||||
ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExW failed 0x%08x\n", ret);
|
||||
|
||||
ret = pPdhValidatePathExW( NULL, system_downtime );
|
||||
ret = pPdhValidatePathExW( NULL, nonexistent_counter );
|
||||
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathExW failed 0x%08x\n", ret);
|
||||
|
||||
ret = pPdhValidatePathExW( NULL, system_uptime );
|
||||
|
@ -958,9 +986,9 @@ static void test_PdhGetDllVersion(void)
|
|||
|
||||
START_TEST(pdh)
|
||||
{
|
||||
if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
|
||||
if (!is_lang_english())
|
||||
{
|
||||
skip("non-english locale\n");
|
||||
skip("An English UI is needed for the pdh tests\n");
|
||||
return;
|
||||
}
|
||||
init_function_ptrs();
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
#include <wine/test.h>
|
||||
|
||||
extern void func_pdh(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue