feat: add vt

This commit is contained in:
Kingtous
2023-04-08 18:17:13 +08:00
parent 0c049c585e
commit 4e7e9406f5
4 changed files with 64 additions and 8 deletions

View File

@@ -2,9 +2,11 @@ use std::{ffi::CStr, os::raw::c_char};
use crate::plugins::PLUGIN_REGISTRAR;
// API provided by RustDesk.
pub type LoadPluginFunc = fn(*const i8) -> i32;
pub type UnloadPluginFunc = fn(*const i8) -> i32;
#[repr(C)]
pub struct RustDeskApiTable {
pub register_plugin: LoadPluginFunc,
pub unload_plugin: UnloadPluginFunc,
@@ -20,9 +22,13 @@ fn unload_plugin(path: *const i8) -> i32 {
PLUGIN_REGISTRAR.unload_plugin(path)
}
#[no_mangle]
fn get_api_table() -> RustDeskApiTable {
RustDeskApiTable::default()
}
impl Default for RustDeskApiTable {
fn default() -> Self {
let f = load_plugin;
Self {
register_plugin: load_plugin,
unload_plugin: unload_plugin,