install: drop Windows EXE installer (remove .NET setup + C SFX); Windows uses ZIP only (keep Linux .deb + install.sh)

这个提交包含在:
JGZYES
2026-09-01 21:46:23 +08:00
父节点 a0c82954c3
当前提交 eeccdd1650
修改 3 个文件,包含 5 行新增89 行删除
+3 -5
查看文件
@@ -52,13 +52,11 @@ jobs:
# -- install.sh helper (uploaded to the release, also served at /install.sh) # -- install.sh helper (uploaded to the release, also served at /install.sh)
cp web/install.sh out/install.sh cp web/install.sh out/install.sh
# -- Windows: ZIP + self-extracting installer (embeds pmm.exe) # -- Windows: ZIP (the EXE setup wizard is a separate .NET build,
# see win/installer/ — needs a Windows runner so it's built there)
if [ -f out/pmm.exe ]; then if [ -f out/pmm.exe ]; then
( cd out && zip -q "pmm-${VER}-windows-amd64.zip" pmm.exe ) ( cd out && zip -q "pmm-${VER}-windows-amd64.zip" pmm.exe )
xxd -i -n pmm_payload out/pmm.exe > payload.h cp web/downloads/pmm-${VER}-windows-amd64.zip out/ 2>/dev/null || true
x86_64-w64-mingw32-gcc -O2 -I . -DPMM_SETUP_VER=\"$VER\" \
-o "out/pmm-setup-${VER}.exe" src/win_setup.c -luser32 -ladvapi32
rm -f payload.h
fi fi
# -- Linux: .deb # -- Linux: .deb
-82
查看文件
@@ -1,82 +0,0 @@
/* win_setup.c — minimal self-extracting installer for pmm.exe (built by CI).
*
* The pmm.exe payload is embedded as pmm_payload[] / pmm_payload_len (a header
* generated from `xxd -i out/pmm.exe`, with the symbols renamed at build time).
* On run it writes pmm.exe to %LOCALAPPDATA%\PMM\bin and adds that dir to PATH.
*
* Build (cross, on the ubuntu runner):
* x86_64-w64-mingw32-gcc -O2 -o out/pmm-setup.exe src/win_setup.c \
* -I. -luser32 -ladvapi32 -lopengl32 (payload.h on include path)
*/
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include "payload.h"
/* Add `dir` to HKCU\Environment\Path if not already present (user-level PATH,
* no admin needed — mirrors a lightweight, .NET-style install). */
static void add_to_path(const char *dir) {
HKEY key;
char cur[32768]; DWORD sz = sizeof(cur); DWORD type = REG_SZ;
const char *needle = dir;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Environment", 0, KEY_READ, &key) == ERROR_SUCCESS) {
DWORD t = 0;
if (RegQueryValueExA(key, "Path", 0, &t, (BYTE *)cur, &sz) != ERROR_SUCCESS) {
cur[0] = 0; sz = 0; t = REG_SZ;
}
RegCloseKey(key);
} else {
cur[0] = 0; sz = 0;
}
if (strstr(cur, needle)) return; /* already there */
char bump[1] = ";";
char next[65536];
if (sz == 0 || cur[0] == 0) bump[0] = 0;
/* normalize sep: if entry exists and doesn't end with ';', add one */
_snprintf(next, sizeof(next), "%s%s%s", cur, (cur[0] && cur[strlen(cur)-1]!=';' ? ";" : bump), dir);
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE, &key) != ERROR_SUCCESS)
return;
RegSetValueExA(key, "Path", 0, REG_EXPAND_SZ, (const BYTE *)next, (DWORD)strlen(next) + 1);
RegCloseKey(key);
/* broadcast so new shells pick it up */
SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
(LPARAM)"Environment", SMTO_ABORTIFHUNG, 5000, NULL);
}
static void make_dirs(const char *path) {
char tmp[4096];
_snprintf(tmp, sizeof(tmp), "%s", path);
for (char *p = tmp + 1; *p; p++)
if (*p == '\\') { *p = 0; CreateDirectoryA(tmp, NULL); *p = '\\'; }
CreateDirectoryA(tmp, NULL);
}
int main(void) {
char dir[MAX_PATH];
DWORD n = GetEnvironmentVariableA("LOCALAPPDATA", dir, sizeof(dir));
if (n == 0 || n >= sizeof(dir)) {
GetModuleFileNameA(NULL, dir, sizeof(dir));
char *s = strrchr(dir, '\\'); if (s) *s = 0;
_snprintf(dir + strlen(dir), sizeof(dir) - strlen(dir), "\\PMM\\bin");
} else {
_snprintf(dir + strlen(dir), sizeof(dir) - strlen(dir), "\\PMM\\bin");
}
make_dirs(dir);
char dest[MAX_PATH];
_snprintf(dest, sizeof(dest), "%s\\pmm.exe", dir);
FILE *f = fopen(dest, "wb");
if (!f) { printf("PMM: cannot write %s\n", dest); return 1; }
if (fwrite(pmm_payload, 1, pmm_payload_len, f) != pmm_payload_len) {
fclose(f); printf("PMM: write failed\n"); return 1;
}
fclose(f);
add_to_path(dir);
printf("PMM %s installed to %s\n", PMM_SETUP_VER, dest);
printf("PATH updated. Open a NEW terminal and run: pmm -v\n");
return 0;
}
+2 -2
查看文件
@@ -148,7 +148,7 @@ for ($r = 0; $r < $ROWS; $r++)
<button class="tab" data-tab="macos">macOS</button> <button class="tab" data-tab="macos">macOS</button>
</div> </div>
<div class="code-box" data-pane="win" data-active="1"> <div class="code-box" data-pane="win" data-active="1">
<pre><code># ZIP 下载(解压即用,pmm.exe 在压缩包内) <pre><code># ZIP 免安装版(解压即用,pmm.exe 在压缩包内)
curl -L -o pmm.zip https://pmm.parlz.com/downloads/pmm-<?php echo $VERSION; ?>-windows-amd64.zip curl -L -o pmm.zip https://pmm.parlz.com/downloads/pmm-<?php echo $VERSION; ?>-windows-amd64.zip
# 解压后把 pmm.exe 所在目录加入 PATH,然后: # 解压后把 pmm.exe 所在目录加入 PATH,然后:
pmm -v</code></pre> pmm -v</code></pre>
@@ -179,7 +179,7 @@ pmm -v</code></pre>
<p class="section-sub">可从官方镜像站或 GitHub Release 获取。镜像地址不变。</p> <p class="section-sub">可从官方镜像站或 GitHub Release 获取。镜像地址不变。</p>
<div class="dl-grid"> <div class="dl-grid">
<a class="dl-card" href="downloads/pmm-<?php echo $VERSION; ?>-windows-amd64.zip" download> <a class="dl-card" href="downloads/pmm-<?php echo $VERSION; ?>-windows-amd64.zip" download>
<span class="dl-os">Windows</span><span class="dl-file">pmm-<?php echo $VERSION; ?>-windows-amd64.zip</span><span class="dl-arrow">↓</span> <span class="dl-os">Windows</span><span class="dl-file">pmm-<?php echo $VERSION; ?>-windows-amd64.zip · 免安装</span><span class="dl-arrow">↓</span>
</a> </a>
<a class="dl-card" href="downloads/pmm_<?php echo $VERSION; ?>_amd64.deb" download> <a class="dl-card" href="downloads/pmm_<?php echo $VERSION; ?>_amd64.deb" download>
<span class="dl-os">Linux</span><span class="dl-file">pmm_<?php echo $VERSION; ?>_amd64.deb</span><span class="dl-arrow">↓</span> <span class="dl-os">Linux</span><span class="dl-file">pmm_<?php echo $VERSION; ?>_amd64.deb</span><span class="dl-arrow">↓</span>