static DWORD VmAfdCliGetCMLocation( PVM_AFD_CLI_CONTEXT pContext ) { DWORD dwError = 0; if (!pContext) { dwError = ERROR_INVALID_PARAMETER; BAIL_ON_VMAFD_ERROR(dwError); } dwError = VmAfdGetCMLocationA( pContext->pszServerName, &pContext->pszCMLocation); BAIL_ON_VMAFD_ERROR(dwError); printf("%s\n", pContext->pszCMLocation); cleanup: return dwError; error: goto cleanup; }
std::string client::GetCMLocation() { PSTR pszDomainName = NULL; DWORD dwError = 0; std::string result; dwError = VmAfdGetCMLocationA(ServerName.c_str(), &pszDomainName); BAIL_ON_ERROR(dwError); result.assign(pszDomainName); error: if (pszDomainName != NULL) { VmAfdFreeString(pszDomainName); } THROW_IF_NEEDED(dwError); return result; }