static jboolean JNICALL jni_freerdp_disconnect(JNIEnv* env, jclass cls, jint instance) { freerdp* inst = (freerdp*)instance; androidContext* ctx; ANDROID_EVENT* event; if (!inst || !inst->context || !cls || !env) { WLog_FATAL(TAG, "%s(env=%p, cls=%p, instance=%d", __FUNCTION__, env, cls, instance); return JNI_FALSE; } ctx = (androidContext*)inst->context; event = (ANDROID_EVENT*)android_event_disconnect_new(); if (!event) return JNI_FALSE; if (!android_push_event(inst, event)) { android_event_free((ANDROID_EVENT*)event); return JNI_FALSE; } if (!freerdp_abort_connect(inst)) return JNI_FALSE; return JNI_TRUE; }
static BOOL xf_floatbar_button_onclick_close(xfFloatbar* floatbar) { if (!floatbar) return FALSE; return freerdp_abort_connect(floatbar->xfc->context.instance); }
static int testAbort(int port) { DWORD status; DWORD start, end, diff; HANDLE thread; struct testThreadArgs args; freerdp* instance = NULL; s_sync = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s_sync) return -1; args.port = port; args.arg = &instance; start = GetTickCount(); thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testThread, &args, 0, NULL); if (!thread) { CloseHandle(s_sync); s_sync = NULL; return -1; } WaitForSingleObject(s_sync, INFINITE); freerdp_abort_connect(instance); status = WaitForSingleObject(instance->context->abortEvent, 0); if (status != WAIT_OBJECT_0) { CloseHandle(s_sync); CloseHandle(thread); s_sync = NULL; return -1; } status = WaitForSingleObject(thread, 20000); end = GetTickCount(); CloseHandle(s_sync); CloseHandle(thread); s_sync = NULL; diff = end - start; if (diff > 1000) return -1; if (WAIT_OBJECT_0 != status) return -1; printf("%s: Success!\n", __FUNCTION__); return 0; }
/** * Function description * * @return 0 on success, otherwise a Win32 error code */ static UINT xf_rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult) { xfContext* xfc = (xfContext*) context->custom; if (execResult->execResult != RAIL_EXEC_S_OK) { WLog_ERR(TAG, "RAIL exec error: execResult=%s NtError=0x%X\n", error_code_names[execResult->execResult], execResult->rawResult); freerdp_abort_connect(xfc->context.instance); } else { xf_rail_enable_remoteapp_mode(xfc); } return CHANNEL_RC_OK; }