Skip to content

Commit d4643f9

Browse files
committed
Remove PROCESS_NAME_NATIVE dwFlag in process query output
The `process_path` rule of sing-box is inherited from Clash, the original code uses the local system's path format (e.g. `\Device\HarddiskVolume1\folder\program.exe`), but when the device has multiple disks, the HarddiskVolume serial number is not stable. This change make QueryFullProcessImageNameW output a Win32 path (such as `C:\folder\program.exe`), which will disrupt the existing `process_path` use cases in Windows.
1 parent 5c6e24b commit d4643f9

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

common/process/searcher_windows.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func getExecPathFromPID(pid uint32) (string, error) {
223223
r1, _, err := syscall.SyscallN(
224224
procQueryFullProcessImageNameW.Addr(),
225225
uintptr(h),
226-
uintptr(1),
226+
uintptr(0),
227227
uintptr(unsafe.Pointer(&buf[0])),
228228
uintptr(unsafe.Pointer(&size)),
229229
)

docs/migration.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
icon: material/arrange-bring-forward
33
---
44

5+
## 1.9.0
6+
7+
!!! warning "Unstable"
8+
9+
This version is still under development, and the following migration guide may be changed in the future.
10+
11+
### `process_path` format update on Windows
12+
13+
The `process_path` rule of sing-box is inherited from Clash,
14+
the original code uses the local system's path format (e.g. `\Device\HarddiskVolume1\folder\program.exe`),
15+
but when the device has multiple disks, the HarddiskVolume serial number is not stable.
16+
17+
sing-box 1.9.0 make QueryFullProcessImageNameW output a Win32 path (such as `C:\folder\program.exe`),
18+
which will disrupt the existing `process_path` use cases in Windows.
19+
520
## 1.8.0
621

722
### :material-close-box: Migrate cache file from Clash API to independent options

docs/migration.zh.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
icon: material/arrange-bring-forward
33
---
44

5+
## 1.9.0
6+
7+
!!! warning "不稳定的"
8+
9+
该版本仍在开发中,迁移指南可能将在未来更改。
10+
11+
### 对 Windows 上 `process_path` 格式的更新
12+
13+
sing-box 的 `process_path` 规则继承自Clash,
14+
原始代码使用本地系统的路径格式(例如 `\Device\HarddiskVolume1\folder\program.exe`),
15+
但是当设备有多个硬盘时,该 HarddiskVolume 系列号并不稳定。
16+
17+
sing-box 1.9.0 使 QueryFullProcessImageNameW 输出 Win32 路径(如 `C:\folder\program.exe`),
18+
这将会破坏现有的 Windows `process_path` 用例。
19+
520
## 1.8.0
621

722
### :material-close-box: 将缓存文件从 Clash API 迁移到独立选项

0 commit comments

Comments
 (0)