int InmGetAnyProfile(inm_connection_h *profile)
{
- inm_connection_h hProfile;
- inm_connection_iterator_h hProfileIter;
-
- int nRet = inm_get_connection_iterator(g_hInm, &hProfileIter);
- if (g_bFeatureAllNotSupported) {
- PRINT_RESULT_CHECK(nRet, INM_ERROR_NOT_SUPPORTED, "inm_get_connection_iterator", InmGetError(nRet));
- return FEATURE_NOT_SUPPORTED;
- }
- PRINT_RESULT(nRet, INM_ERROR_NONE, "inm_get_connection_iterator", InmGetError(nRet));
- CHECK_HANDLE(hProfileIter, "inm_get_connection_iterator");
-
- nRet = inm_connection_iterator_next(hProfileIter, &hProfile);
- PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_iterator_next", InmGetError(nRet), inm_destroy_connection_iterator(hProfileIter));
- CHECK_HANDLE_CLEANUP(hProfile, "inm_connection_iterator_next", inm_destroy_connection_iterator(hProfileIter));
-
- nRet = inm_connection_clone(profile, hProfile);
- PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_clone", InmGetError(nRet), inm_destroy_connection_iterator(hProfileIter); inm_connection_destroy(&hProfile));
-
- nRet = inm_destroy_connection_iterator(hProfileIter);
- PRINT_RESULT_NORETURN(nRet, INM_ERROR_NONE, "inm_destroy_connection_iterator", InmGetError(nRet));
+ int nRet = inm_get_current_connection(g_hInm, profile);
+ PRINT_RESULT_NORETURN(nRet, INM_ERROR_NONE, "inm_get_current_connection", InmGetError(nRet));
return 0;
}