🐛 修复msi版本dll调用异常,捕获dll异常

This commit is contained in:
BTMuli
2026-01-22 01:21:51 +08:00
parent 3cb0c423a5
commit 68c2d1cfcb
3 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
//! Yae 相关处理
//! @since Beta v0.9.2
//! @since Beta v0.9.4
#![cfg(target_os = "windows")]
pub mod inject;
@@ -75,11 +75,19 @@ pub fn call_yae_dll(
ticket: Option<String>,
is_msix: bool,
) -> Result<(), String> {
let mut dll_path = app_handle.path().app_config_dir().unwrap().join("YaeAchievementLib.dll");
let mut dll_path =
app_handle.path().resource_dir().unwrap().join("resources\\YaeAchievementLib.dll");
if is_msix {
dll_path = app_handle.path().document_dir().unwrap().join("TeyvatGuide\\YaeAchievementLib.dll");
}
dbg!(&dll_path);
log::info!("Resolved DLL path: {}", dll_path.display());
// 检测 dll 存在
if !dll_path.exists() {
let msg = format!("未检测到 DLL路径: {}", dll_path.display());
return Err(msg);
}
// 0. 创建 YaeAchievementPipe 的 命名管道,获取句柄
dbg!("开始启动 YaeAchievementPipe 命名管道");
let _pipe_handle = create_named_pipe("YaeAchievementPipe");