DWORD VmDnsSrvRecordToString( PVMDNS_RECORD pRecord, PSTR* ppStr ) { DWORD dwError = ERROR_SUCCESS; PSTR pStr = NULL; PCSTR pszType = NULL; dwError = VmDnsRecordTypeToString(pRecord->dwType, &pszType); BAIL_ON_VMDNS_ERROR(dwError); dwError = VmDnsAllocateStringPrintfA( &pStr, "Type: %s, " "Name: %s, " "Target: %s, " "Port: %hu, " "Priority: %hu, " "Weight: %hu", pszType, pRecord->pszName, pRecord->Data.SRV.pNameTarget, pRecord->Data.SRV.wPort, pRecord->Data.SRV.wPriority, pRecord->Data.SRV.wWeight ); *ppStr = pStr; BAIL_ON_VMDNS_ERROR(dwError); cleanup: return dwError; error: VMDNS_SAFE_FREE_STRINGA(pStr); goto cleanup; }
DWORD VmDnsPtrRecordToString( PVMDNS_RECORD pRecord, PSTR* ppStr ) { DWORD dwError = ERROR_SUCCESS; PSTR pStr = NULL; PCSTR pszType = NULL; dwError = VmDnsRecordTypeToString(pRecord->dwType, &pszType); BAIL_ON_VMDNS_ERROR(dwError); dwError = VmDnsAllocateStringPrintfA( &pStr, "Type: %s\n" "Name: %s\n" "Class: %hu\n" "TTL: %u\n" "Server: %s\n", pszType, pRecord->pszName, pRecord->iClass, pRecord->dwTtl, pRecord->Data.PTR.pNameHost ); BAIL_ON_VMDNS_ERROR(dwError); *ppStr = pStr; cleanup: return dwError; error: VMDNS_SAFE_FREE_STRINGA(pStr); goto cleanup; }