pdh: Remove unnecessary test done in PdhLookupPerfNameByIndexW.

This commit is contained in:
Jeff Latimer 2008-02-18 20:32:04 +11:00 committed by Alexandre Julliard
parent 33c386f7fe
commit 75adca5385
1 changed files with 5 additions and 8 deletions

View File

@ -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;
}