mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
pdh: Implement PdhValidatePath{, Ex}{A, W}.
This commit is contained in:
parent
9ad3807c15
commit
504e7c2ff7
@ -137,10 +137,10 @@
|
||||
@ stub PdhUpdateLogA
|
||||
@ stub PdhUpdateLogFileCatalog
|
||||
@ stub PdhUpdateLogW
|
||||
@ stub PdhValidatePathA
|
||||
@ stub PdhValidatePathExA
|
||||
@ stub PdhValidatePathExW
|
||||
@ stub PdhValidatePathW
|
||||
@ stdcall PdhValidatePathA(str)
|
||||
@ stdcall PdhValidatePathExA(ptr str)
|
||||
@ stdcall PdhValidatePathExW(ptr wstr)
|
||||
@ stdcall PdhValidatePathW(wstr)
|
||||
@ stub PdhVbAddCounter
|
||||
@ stub PdhVbCreateCounterPathList
|
||||
@ stub PdhVbGetCounterPathElements
|
||||
|
@ -700,3 +700,77 @@ PDH_STATUS WINAPI PdhSetCounterScaleFactor( PDH_HCOUNTER handle, LONG factor )
|
||||
counter->scale = factor;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PdhValidatePathA (PDH.@)
|
||||
*/
|
||||
PDH_STATUS WINAPI PdhValidatePathA( LPCSTR path )
|
||||
{
|
||||
PDH_STATUS ret;
|
||||
WCHAR *pathW;
|
||||
|
||||
TRACE("%s\n", debugstr_a(path));
|
||||
|
||||
if (!path) return PDH_INVALID_ARGUMENT;
|
||||
if (!(pathW = pdh_strdup_aw( path ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
||||
|
||||
ret = PdhValidatePathW( pathW );
|
||||
|
||||
pdh_free( pathW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PDH_STATUS validate_path( LPCWSTR path )
|
||||
{
|
||||
if (!path || !*path) return PDH_INVALID_ARGUMENT;
|
||||
if (*path++ != '\\' || !strchrW( path, '\\' )) return PDH_CSTATUS_BAD_COUNTERNAME;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PdhValidatePathW (PDH.@)
|
||||
*/
|
||||
PDH_STATUS WINAPI PdhValidatePathW( LPCWSTR path )
|
||||
{
|
||||
PDH_STATUS ret;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("%s\n", debugstr_w(path));
|
||||
|
||||
if ((ret = validate_path( path ))) return ret;
|
||||
|
||||
for (i = 0; i < sizeof(counter_sources) / sizeof(counter_sources[0]); i++)
|
||||
if (pdh_match_path( counter_sources[i].path, path )) return ERROR_SUCCESS;
|
||||
|
||||
return PDH_CSTATUS_NO_COUNTER;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PdhValidatePathExA (PDH.@)
|
||||
*/
|
||||
PDH_STATUS WINAPI PdhValidatePathExA( PDH_HLOG source, LPCSTR path )
|
||||
{
|
||||
TRACE("%p %s\n", source, debugstr_a(path));
|
||||
|
||||
if (source)
|
||||
{
|
||||
FIXME("log file data source not supported\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
return PdhValidatePathA( path );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PdhValidatePathExW (PDH.@)
|
||||
*/
|
||||
PDH_STATUS WINAPI PdhValidatePathExW( PDH_HLOG source, LPCWSTR path )
|
||||
{
|
||||
TRACE("%p %s\n", source, debugstr_w(path));
|
||||
|
||||
if (source)
|
||||
{
|
||||
FIXME("log file data source not supported\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
return PdhValidatePathW( path );
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ extern "C" {
|
||||
typedef LONG PDH_STATUS;
|
||||
typedef HANDLE PDH_HQUERY;
|
||||
typedef HANDLE PDH_HCOUNTER;
|
||||
typedef HANDLE PDH_HLOG;
|
||||
|
||||
#define PDH_MAX_SCALE 7
|
||||
#define PDH_MIN_SCALE (-7)
|
||||
@ -190,6 +191,12 @@ PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
|
||||
#define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
|
||||
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
|
||||
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
|
||||
PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
|
||||
PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
|
||||
#define PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
|
||||
PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
|
||||
PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
|
||||
#define PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define PDH_MEMORY_ALLOCATION_FAILURE 0xc0000bbb
|
||||
#define PDH_INVALID_HANDLE 0xc0000bbc
|
||||
#define PDH_INVALID_ARGUMENT 0xc0000bbd
|
||||
#define PDH_CSTATUS_BAD_COUNTERNAME 0xc0000bc0
|
||||
#define PDH_INSUFFICIENT_BUFFER 0xc0000bc2
|
||||
#define PDH_INVALID_DATA 0xc0000bc6
|
||||
#define PDH_STRING_NOT_FOUND 0xc0000bd4
|
||||
|
Loading…
Reference in New Issue
Block a user