pdh: Remove unnecessary test done in PdhLookupPerfNameByIndexW.
This commit is contained in:
parent
33c386f7fe
commit
75adca5385
|
@ -832,21 +832,17 @@ PDH_STATUS WINAPI PdhLookupPerfIndexByNameW( LPCWSTR machine, LPCWSTR name, LPDW
|
|||
PDH_STATUS WINAPI PdhLookupPerfNameByIndexA( LPCSTR machine, DWORD index, LPSTR buffer, LPDWORD size )
|
||||
{
|
||||
PDH_STATUS ret;
|
||||
WCHAR *machineW = NULL;
|
||||
WCHAR bufferW[PDH_MAX_COUNTER_NAME];
|
||||
DWORD sizeW = sizeof(bufferW) / sizeof(WCHAR);
|
||||
|
||||
TRACE("%s %d %p %p\n", debugstr_a(machine), index, buffer, size);
|
||||
|
||||
if (machine)
|
||||
{
|
||||
FIXME("remote machine not supported\n");
|
||||
return PDH_CSTATUS_NO_MACHINE;
|
||||
}
|
||||
|
||||
if (!buffer || !size) return PDH_INVALID_ARGUMENT;
|
||||
if (!index) return ERROR_SUCCESS;
|
||||
|
||||
if (!(ret = PdhLookupPerfNameByIndexW( NULL, index, bufferW, &sizeW )))
|
||||
if (machine && !(machineW = pdh_strdup_aw( machine ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
||||
|
||||
if (!(ret = PdhLookupPerfNameByIndexW( machineW, index, bufferW, &sizeW )))
|
||||
{
|
||||
int required = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
||||
|
||||
|
@ -854,6 +850,7 @@ PDH_STATUS WINAPI PdhLookupPerfNameByIndexA( LPCSTR machine, DWORD index, LPSTR
|
|||
else WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, required, NULL, NULL );
|
||||
if (size) *size = required;
|
||||
}
|
||||
heap_free( machineW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue