quickwin 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +9 -9
- package/README.md +9 -9
- package/constants.ts +1063 -0
- package/enum_map.d.ts +129 -0
- package/examples/PdfCanvas.js +2 -2
- package/examples/PdfCanvas.tsx +3 -2
- package/examples/{exec_server.js → execd/main.js} +1114 -287
- package/examples/execd/tray.js +192 -0
- package/examples/execd/worker.js +122 -0
- package/examples/pdf_preview2.js +46 -46
- package/examples/pdf_preview2.ts +55 -54
- package/examples/pdf_viewer.js +134 -130
- package/examples/pdf_viewer.tsx +6 -5
- package/examples/test_gallery.js +135 -131
- package/examples/test_gallery.tsx +9 -8
- package/examples/test_react_lazy.js +130 -128
- package/examples/test_react_lazy.tsx +7 -6
- package/examples/test_react_listbox.js +130 -128
- package/examples/test_react_listbox.tsx +8 -7
- package/examples/test_root_window.js +130 -128
- package/examples/test_root_window.tsx +5 -5
- package/examples/test_tab.js +130 -128
- package/examples/test_tab.tsx +7 -6
- package/examples/tray_demo.js +8 -8
- package/examples/tray_demo.tsx +9 -8
- package/lib/dumpRects.js +2 -2
- package/lib/dumpRects.ts +3 -2
- package/lib/fetch.js +15 -15
- package/lib/fetch.ts +16 -15
- package/lib/ffi/bind.js +3 -3
- package/lib/ffi/bind.ts +3 -3
- package/lib/ffi/ctype.ts +3 -1
- package/lib/ffi/struct.js +23 -7
- package/lib/ffi/struct.ts +50 -23
- package/lib/http-server.js +5 -5
- package/lib/http-server.ts +6 -5
- package/lib/react-qw/components/Button.js +2 -2
- package/lib/react-qw/components/CheckBox.js +4 -4
- package/lib/react-qw/components/ComboBox.js +10 -10
- package/lib/react-qw/components/DateTimePicker.js +12 -12
- package/lib/react-qw/components/Input.js +7 -7
- package/lib/react-qw/components/Link.js +4 -4
- package/lib/react-qw/components/ListBox.js +12 -12
- package/lib/react-qw/components/ListView.js +35 -35
- package/lib/react-qw/components/PathPicker.js +3 -3
- package/lib/react-qw/components/ProgressBar.js +4 -4
- package/lib/react-qw/components/RadioButton.js +4 -4
- package/lib/react-qw/components/ScrollView.js +28 -28
- package/lib/react-qw/components/Slider.js +11 -11
- package/lib/react-qw/components/Tab.js +10 -10
- package/lib/react-qw/components/Tooltip.js +8 -8
- package/lib/react-qw/components/TreeView.js +20 -20
- package/lib/react-qw/index.js +5 -5
- package/lib/react-qw/index.ts +6 -5
- package/lib/react-qw/props.js +4 -4
- package/lib/react-qw/props.ts +5 -4
- package/lib/react-qw/reconciler.js +10 -10
- package/lib/react-qw/reconciler.ts +11 -10
- package/lib/text-measure.js +3 -3
- package/lib/text-measure.ts +4 -3
- package/lib/websocket.js +17 -17
- package/lib/websocket.ts +18 -17
- package/lib/windows/advapi32.js +7 -7
- package/lib/windows/advapi32.ts +7 -7
- package/lib/windows/gdi32.js +17 -17
- package/lib/windows/gdi32.ts +17 -17
- package/lib/windows/kernel32.js +41 -2
- package/lib/windows/kernel32.ts +45 -2
- package/lib/windows/shell32.js +24 -3
- package/lib/windows/shell32.ts +27 -4
- package/lib/windows/structs.js +230 -92
- package/lib/windows/structs.ts +278 -92
- package/lib/windows/user32.js +18 -6
- package/lib/windows/user32.ts +18 -6
- package/lib/windows/winspool.js +3 -3
- package/lib/windows/winspool.ts +3 -3
- package/package.json +4 -3
- package/quickwin.d.ts +32 -10
- package/qwin-nowasm-x86.exe +0 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin-x86.exe +0 -0
- package/qwin.exe +0 -0
- package/test/test_ffi_bind.js +12 -10
- package/test/test_ffi_bind.ts +14 -12
- package/test/test_ffi_struct.js +60 -26
- package/test/test_ffi_struct.ts +58 -28
- package/test/test_ffi_windows.js +1 -1
- package/test/test_ffi_windows.ts +1 -1
- package/test/test_files.js +7 -7
- package/test/test_files.ts +8 -8
- package/test/test_gdi_draw.js +51 -51
- package/test/test_gdi_draw.ts +57 -57
- package/test/test_http_server.js +3 -3
- package/test/test_http_server.ts +4 -3
- package/test/test_ipv6.js +3 -3
- package/test/test_ipv6.ts +4 -3
- package/test/test_net_event.js +3 -3
- package/test/test_net_event.ts +4 -3
- package/test/test_printer.js +4 -4
- package/test/test_printer.ts +5 -5
- package/test/test_react_complex.js +132 -130
- package/test/test_react_counter.js +130 -128
- package/test/test_react_flex.js +132 -130
- package/test/test_react_hidden.js +130 -128
- package/test/test_react_listview_link.js +131 -129
- package/test/test_react_notify.js +148 -146
- package/test/test_react_render.js +130 -128
- package/test/test_registry.js +6 -6
- package/test/test_registry.ts +8 -8
- package/test/test_wolfssl_read.js +8 -8
- package/test/test_wolfssl_read.ts +9 -8
- package/examples/exec_server.tsx +0 -488
- package/examples/exec_server_worker.js +0 -395
- package/examples/exec_server_worker.ts +0 -417
- package/examples/setres.js +0 -79
- package/examples/setres.ts +0 -86
- package/quickwin_const.d.ts +0 -1037
package/lib/windows/kernel32.js
CHANGED
|
@@ -101,6 +101,38 @@ export const TerminateProcess = /*@__PURE__*/ b('TerminateProcess', '<HPROCESS>p
|
|
|
101
101
|
/** 取当前进程 PID(互证锚点)
|
|
102
102
|
* @returns 当前进程 PID */
|
|
103
103
|
export const GetCurrentProcessId = /*@__PURE__*/ b('GetCurrentProcessId', ' -> u32');
|
|
104
|
+
/** 当前进程伪句柄(-1,不需 CloseHandle——OpenProcess 真句柄的零成本替代,纯本进程
|
|
105
|
+
* 场景如 IsWow64Process 探位宽用) */
|
|
106
|
+
export const GetCurrentProcess = /*@__PURE__*/ b('GetCurrentProcess', ' -> <HPROCESS>ptr');
|
|
107
|
+
// ============ 远程内存(跨进程 SendMessage 的输出缓冲)============
|
|
108
|
+
// 普通跨进程 SendMessage **不 marshal 指针**:出参 buffer 写在接收方线程执行,指针值
|
|
109
|
+
// 原样透传——落在本进程地址空间会被 explorer 直接写穿。正解 = VirtualAllocEx 在目标
|
|
110
|
+
// 进程分配 → 发消息 → ReadProcessMemory 读回(见 examples/execd/tray.ts /tray_list 用例)。
|
|
111
|
+
/** 在目标进程地址空间分配内存;配对 VirtualFreeEx
|
|
112
|
+
* @returns 成功 → 远程基址,失败 → 0(0 保真)
|
|
113
|
+
* @param args_0 hProcess OpenProcess 句柄(本场景须 PROCESS_VM_OPERATION(0x8) |
|
|
114
|
+
* PROCESS_VM_READ(0x10) | PROCESS_VM_WRITE(0x20) = 0x38)
|
|
115
|
+
* @param args_1 lpAddress NULL = 系统选起点
|
|
116
|
+
* @param args_2 dwSize 字节数(SIZE_T 随位宽 = <>ptr 的 ptr 宽,非指针语义)
|
|
117
|
+
* @param args_3 flAllocationType MEM_COMMIT|MEM_RESERVE(0x1000|0x2000 = 0x3000)
|
|
118
|
+
* @param args_4 flProtect PAGE_READWRITE(0x04) */
|
|
119
|
+
export const VirtualAllocEx = /*@__PURE__*/ b('VirtualAllocEx', '<HPROCESS>ptr <>ptr <>ptr u32 u32 -> <>ptr');
|
|
120
|
+
/** 释放 VirtualAllocEx 内存(须同一进程句柄)
|
|
121
|
+
* @returns 成功 → 非 0
|
|
122
|
+
* @param args_0 hProcess 同 VirtualAllocEx
|
|
123
|
+
* @param args_1 lpAddress VirtualAllocEx 返回的远程基址
|
|
124
|
+
* @param args_2 dwSize 0(MEM_RELEASE 时必须 0)
|
|
125
|
+
* @param args_3 dwFreeType MEM_RELEASE(0x8000) */
|
|
126
|
+
export const VirtualFreeEx = /*@__PURE__*/ b('VirtualFreeEx', '<HPROCESS>ptr <>ptr <>ptr u32 -> i32');
|
|
127
|
+
/** 读目标进程内存(远程 SendMessage 写完 → 本调用读回本地;远程指针字段如托盘
|
|
128
|
+
* dwData 内容的二次解引用同样走这里)
|
|
129
|
+
* @returns 成功 → 非 0(目标地址不可读/句柄无 PROCESS_VM_READ)
|
|
130
|
+
* @param args_0 hProcess OpenProcess 句柄(须 PROCESS_VM_READ(0x10))
|
|
131
|
+
* @param args_1 lpBaseAddress 远程地址(VirtualAllocEx 返回值等)
|
|
132
|
+
* @param args_2 lpBuffer 本地接收缓冲,传 BYTE.alloc(n)(DataView/TypedArray 原地读回)
|
|
133
|
+
* @param args_3 nSize 字节数(SIZE_T → <>ptr ptr 宽)
|
|
134
|
+
* @param args_4 lpNumberOfBytesRead 实读字节数出参槽 PtrArrayBuffer(8) 可选,或 NULL */
|
|
135
|
+
export const ReadProcessMemory = /*@__PURE__*/ b('ReadProcessMemory', '<HPROCESS>ptr <>ptr <BYTE>ptr <>ptr <>ptr -> i32');
|
|
104
136
|
// ============ 文件 I/O ============
|
|
105
137
|
/** 同步读文件 / 管道
|
|
106
138
|
* @returns 成功 → 非 0,管道写端全部关闭后读返回 0(EOF)
|
|
@@ -118,7 +150,7 @@ export const ReadFile = /*@__PURE__*/ b('ReadFile', '<HFILE>ptr! <BYTE>ptr u32 <
|
|
|
118
150
|
* 组合(flags 位不标枚举)
|
|
119
151
|
* @param args_2 dwShareMode 共享掩码:FILE_SHARE_READ(0x1)|FILE_SHARE_WRITE(0x2),独占传 0
|
|
120
152
|
* @param args_3 lpSecurityAttributes 安全属性,传 NULL
|
|
121
|
-
* @param args_4 dwCreationDisposition 创建处置
|
|
153
|
+
* @param args_4 dwCreationDisposition 创建处置 FileCreation.*(互斥单选)
|
|
122
154
|
* @param args_5 dwFlagsAndAttributes 属性:FILE_ATTRIBUTE_NORMAL(0x80) 等(可组合不标)
|
|
123
155
|
* @param args_6 hTemplateFile 模板文件句柄,传 NULL */
|
|
124
156
|
export const CreateFile = /*@__PURE__*/ b('CreateFileW', '<WCHAR>ptr! u32 u32 <>ptr u32@FileCreation u32 <>ptr -> <HFILE>ptr!');
|
|
@@ -157,7 +189,7 @@ export const MoveFileEx = /*@__PURE__*/ b('MoveFileExW', '<WCHAR>ptr! <WCHAR>ptr
|
|
|
157
189
|
* 与合法的 0xFFFFFFFF 偏移)
|
|
158
190
|
* @param args_1 lDistanceToMove 偏移(LONG,可负)
|
|
159
191
|
* @param args_2 lpDistanceToMoveHigh 64 位偏移高半(出参双向),32 位够用传 NULL
|
|
160
|
-
* @param args_3 dwMoveMethod 起点
|
|
192
|
+
* @param args_3 dwMoveMethod 起点 FileSeekFrom.BEGIN / CURRENT / END */
|
|
161
193
|
export const SetFilePointer = /*@__PURE__*/ b('SetFilePointer', '<HFILE>ptr! i32 <BYTE>ptr u32@FileSeekFrom -> u32');
|
|
162
194
|
/** 读文件大小
|
|
163
195
|
* @returns 文件大小(低 32 位);0xFFFFFFFF = 失败(INVALID_FILE_SIZE,须 GetLastError 区分)
|
|
@@ -238,6 +270,13 @@ export const GetModuleFileName = /*@__PURE__*/ b('GetModuleFileNameW', '<HMODULE
|
|
|
238
270
|
* @returns 命令行整串(返回位 `<WCHAR>ptr!`:内建 WCHAR codec 自动解码为 string,
|
|
239
271
|
* `!` 担保非 NULL 由返回位 0 检查兜底,无需接收缓冲) */
|
|
240
272
|
export const GetCommandLineW = /*@__PURE__*/ b('GetCommandLineW', ' -> <WCHAR>ptr!');
|
|
273
|
+
/** 本进程是否跑在 WOW64(32 位进程 on 64 位 OS)——判**远程进程/系统位宽**的廉价
|
|
274
|
+
* 探针:x64 进程恒 0(本就是 64 位 OS);x86 进程 1 = OS 64 位(远程序构按 64 位解析,
|
|
275
|
+
* 如 x86 qwin 读 explorer 的 TBBUTTON)。32 位 OS 上恒写 0
|
|
276
|
+
* @returns 成功 → 非 0
|
|
277
|
+
* @param args_0 hProcess GetCurrentProcess() 伪句柄或真句柄
|
|
278
|
+
* @param args_1 lpWow64Process 出参 BOOL 槽,PtrArrayBuffer(4),Uint32Array 读回 */
|
|
279
|
+
export const IsWow64Process = /*@__PURE__*/ b('IsWow64Process', '<HPROCESS>ptr <BYTE>ptr -> i32');
|
|
241
280
|
// ============ 全局内存(剪贴板数据载体)============
|
|
242
281
|
/** 分配全局内存块
|
|
243
282
|
* @returns 成功 → 句柄(0 失败)
|
package/lib/windows/kernel32.ts
CHANGED
|
@@ -117,6 +117,42 @@ export const TerminateProcess = /*@__PURE__*/ b('TerminateProcess', '<HPROCESS>p
|
|
|
117
117
|
/** 取当前进程 PID(互证锚点)
|
|
118
118
|
* @returns 当前进程 PID */
|
|
119
119
|
export const GetCurrentProcessId = /*@__PURE__*/ b('GetCurrentProcessId', ' -> u32')
|
|
120
|
+
/** 当前进程伪句柄(-1,不需 CloseHandle——OpenProcess 真句柄的零成本替代,纯本进程
|
|
121
|
+
* 场景如 IsWow64Process 探位宽用) */
|
|
122
|
+
export const GetCurrentProcess = /*@__PURE__*/ b('GetCurrentProcess', ' -> <HPROCESS>ptr')
|
|
123
|
+
|
|
124
|
+
// ============ 远程内存(跨进程 SendMessage 的输出缓冲)============
|
|
125
|
+
// 普通跨进程 SendMessage **不 marshal 指针**:出参 buffer 写在接收方线程执行,指针值
|
|
126
|
+
// 原样透传——落在本进程地址空间会被 explorer 直接写穿。正解 = VirtualAllocEx 在目标
|
|
127
|
+
// 进程分配 → 发消息 → ReadProcessMemory 读回(见 examples/execd/tray.ts /tray_list 用例)。
|
|
128
|
+
|
|
129
|
+
/** 在目标进程地址空间分配内存;配对 VirtualFreeEx
|
|
130
|
+
* @returns 成功 → 远程基址,失败 → 0(0 保真)
|
|
131
|
+
* @param args_0 hProcess OpenProcess 句柄(本场景须 PROCESS_VM_OPERATION(0x8) |
|
|
132
|
+
* PROCESS_VM_READ(0x10) | PROCESS_VM_WRITE(0x20) = 0x38)
|
|
133
|
+
* @param args_1 lpAddress NULL = 系统选起点
|
|
134
|
+
* @param args_2 dwSize 字节数(SIZE_T 随位宽 = <>ptr 的 ptr 宽,非指针语义)
|
|
135
|
+
* @param args_3 flAllocationType MEM_COMMIT|MEM_RESERVE(0x1000|0x2000 = 0x3000)
|
|
136
|
+
* @param args_4 flProtect PAGE_READWRITE(0x04) */
|
|
137
|
+
export const VirtualAllocEx = /*@__PURE__*/ b('VirtualAllocEx',
|
|
138
|
+
'<HPROCESS>ptr <>ptr <>ptr u32 u32 -> <>ptr')
|
|
139
|
+
/** 释放 VirtualAllocEx 内存(须同一进程句柄)
|
|
140
|
+
* @returns 成功 → 非 0
|
|
141
|
+
* @param args_0 hProcess 同 VirtualAllocEx
|
|
142
|
+
* @param args_1 lpAddress VirtualAllocEx 返回的远程基址
|
|
143
|
+
* @param args_2 dwSize 0(MEM_RELEASE 时必须 0)
|
|
144
|
+
* @param args_3 dwFreeType MEM_RELEASE(0x8000) */
|
|
145
|
+
export const VirtualFreeEx = /*@__PURE__*/ b('VirtualFreeEx', '<HPROCESS>ptr <>ptr <>ptr u32 -> i32')
|
|
146
|
+
/** 读目标进程内存(远程 SendMessage 写完 → 本调用读回本地;远程指针字段如托盘
|
|
147
|
+
* dwData 内容的二次解引用同样走这里)
|
|
148
|
+
* @returns 成功 → 非 0(目标地址不可读/句柄无 PROCESS_VM_READ)
|
|
149
|
+
* @param args_0 hProcess OpenProcess 句柄(须 PROCESS_VM_READ(0x10))
|
|
150
|
+
* @param args_1 lpBaseAddress 远程地址(VirtualAllocEx 返回值等)
|
|
151
|
+
* @param args_2 lpBuffer 本地接收缓冲,传 BYTE.alloc(n)(DataView/TypedArray 原地读回)
|
|
152
|
+
* @param args_3 nSize 字节数(SIZE_T → <>ptr ptr 宽)
|
|
153
|
+
* @param args_4 lpNumberOfBytesRead 实读字节数出参槽 PtrArrayBuffer(8) 可选,或 NULL */
|
|
154
|
+
export const ReadProcessMemory = /*@__PURE__*/ b('ReadProcessMemory',
|
|
155
|
+
'<HPROCESS>ptr <>ptr <BYTE>ptr <>ptr <>ptr -> i32')
|
|
120
156
|
|
|
121
157
|
// ============ 文件 I/O ============
|
|
122
158
|
|
|
@@ -137,7 +173,7 @@ export const ReadFile = /*@__PURE__*/ b('ReadFile', '<HFILE>ptr! <BYTE>ptr u32 <
|
|
|
137
173
|
* 组合(flags 位不标枚举)
|
|
138
174
|
* @param args_2 dwShareMode 共享掩码:FILE_SHARE_READ(0x1)|FILE_SHARE_WRITE(0x2),独占传 0
|
|
139
175
|
* @param args_3 lpSecurityAttributes 安全属性,传 NULL
|
|
140
|
-
* @param args_4 dwCreationDisposition 创建处置
|
|
176
|
+
* @param args_4 dwCreationDisposition 创建处置 FileCreation.*(互斥单选)
|
|
141
177
|
* @param args_5 dwFlagsAndAttributes 属性:FILE_ATTRIBUTE_NORMAL(0x80) 等(可组合不标)
|
|
142
178
|
* @param args_6 hTemplateFile 模板文件句柄,传 NULL */
|
|
143
179
|
export const CreateFile = /*@__PURE__*/ b('CreateFileW',
|
|
@@ -177,7 +213,7 @@ export const MoveFileEx = /*@__PURE__*/ b('MoveFileExW', '<WCHAR>ptr! <WCHAR>ptr
|
|
|
177
213
|
* 与合法的 0xFFFFFFFF 偏移)
|
|
178
214
|
* @param args_1 lDistanceToMove 偏移(LONG,可负)
|
|
179
215
|
* @param args_2 lpDistanceToMoveHigh 64 位偏移高半(出参双向),32 位够用传 NULL
|
|
180
|
-
* @param args_3 dwMoveMethod 起点
|
|
216
|
+
* @param args_3 dwMoveMethod 起点 FileSeekFrom.BEGIN / CURRENT / END */
|
|
181
217
|
export const SetFilePointer = /*@__PURE__*/ b('SetFilePointer', '<HFILE>ptr! i32 <BYTE>ptr u32@FileSeekFrom -> u32')
|
|
182
218
|
/** 读文件大小
|
|
183
219
|
* @returns 文件大小(低 32 位);0xFFFFFFFF = 失败(INVALID_FILE_SIZE,须 GetLastError 区分)
|
|
@@ -265,6 +301,13 @@ export const GetModuleFileName = /*@__PURE__*/ b('GetModuleFileNameW', '<HMODULE
|
|
|
265
301
|
* @returns 命令行整串(返回位 `<WCHAR>ptr!`:内建 WCHAR codec 自动解码为 string,
|
|
266
302
|
* `!` 担保非 NULL 由返回位 0 检查兜底,无需接收缓冲) */
|
|
267
303
|
export const GetCommandLineW = /*@__PURE__*/ b('GetCommandLineW', ' -> <WCHAR>ptr!')
|
|
304
|
+
/** 本进程是否跑在 WOW64(32 位进程 on 64 位 OS)——判**远程进程/系统位宽**的廉价
|
|
305
|
+
* 探针:x64 进程恒 0(本就是 64 位 OS);x86 进程 1 = OS 64 位(远程序构按 64 位解析,
|
|
306
|
+
* 如 x86 qwin 读 explorer 的 TBBUTTON)。32 位 OS 上恒写 0
|
|
307
|
+
* @returns 成功 → 非 0
|
|
308
|
+
* @param args_0 hProcess GetCurrentProcess() 伪句柄或真句柄
|
|
309
|
+
* @param args_1 lpWow64Process 出参 BOOL 槽,PtrArrayBuffer(4),Uint32Array 读回 */
|
|
310
|
+
export const IsWow64Process = /*@__PURE__*/ b('IsWow64Process', '<HPROCESS>ptr <BYTE>ptr -> i32')
|
|
268
311
|
|
|
269
312
|
// ============ 全局内存(剪贴板数据载体)============
|
|
270
313
|
|
package/lib/windows/shell32.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
// shell32 绑定(shell 对话框 / PIDL
|
|
1
|
+
// shell32 绑定(shell 对话框 / PIDL→路径 / 托盘图标定位)
|
|
2
2
|
import { bind } from '../ffi/bind.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { NOTIFYICONIDENTIFIER } from './structs.js';
|
|
4
|
+
// dll 名部分应用(工厂转调保泛型 infer,见 lib/windows/user32.ts 头注释);第三参透传
|
|
5
|
+
// encoders(结构入参位注册,方向约定见 lib/windows/user32.ts 头注释)
|
|
6
|
+
const b = (name, sig, encoders) => bind('shell32.dll', name, sig, encoders);
|
|
5
7
|
/** 文件夹浏览对话框;PIDL 用 ole32.CoTaskMemFree 释放
|
|
6
8
|
* @returns PIDL,取消 → 0
|
|
7
9
|
* @param args_0 pbi BROWSEINFOW.encode(...).ptr(见 structs.ts) */
|
|
@@ -11,3 +13,22 @@ export const SHBrowseForFolder = /*@__PURE__*/ b('SHBrowseForFolderW', '<BROWSEI
|
|
|
11
13
|
* @param args_0 pidl SHBrowseForFolder 等返回的 PIDL
|
|
12
14
|
* @param args_1 pszPath 出参缓冲,WCHAR.alloc(260)(MAX_PATH=260)、WCHAR.decode 读回 */
|
|
13
15
|
export const SHGetPathFromIDList = /*@__PURE__*/ b('SHGetPathFromIDListW', '<>ptr <BYTE>ptr -> u32');
|
|
16
|
+
/** 取托盘通知图标的屏幕矩形(Shell_NotifyIconGetRect;**Win7+**——XP 无此导出,
|
|
17
|
+
* 故为**可选绑定**:老系统上本常量为 null(bind() 是模块顶层立即解析,缺符号 throw
|
|
18
|
+
* 会拖垮整个脚本启动),调用方必须判空)
|
|
19
|
+
* @returns HRESULT,实测语义:0 = 图标在通知区内,iconLocation = 其容器(可见区 /
|
|
20
|
+
* 溢出面板)内位置——**溢出面板未展开时该 rect 不是屏幕可点位**;1 = 按文档为
|
|
21
|
+
* 不可见态(隐藏/溢出;本机未复现——实测 Win7 溢出图标亦返 0);0x80004005 E_FAIL
|
|
22
|
+
* = 图标不存在,或该图标未按 {hWnd,uID} 注册(系统 GUID 图标实测 not_found)
|
|
23
|
+
* @param args_0 identifier NOTIFYICONIDENTIFIER 对象直传(encoder 已注册;cbSize 填
|
|
24
|
+
* NOTIFYICONIDENTIFIER.size,guidItem 缺省 = GUID_NULL 走 hWnd+uID)
|
|
25
|
+
* @param args_1 iconLocation 出参槽,RECT.alloc().ptr(出参位不注册,方向约定同
|
|
26
|
+
* user32),RECT.decode 读回 */
|
|
27
|
+
export const Shell_NotifyIconGetRect = (() => {
|
|
28
|
+
try {
|
|
29
|
+
return b('Shell_NotifyIconGetRect', '<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32', { NOTIFYICONIDENTIFIER });
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null; // XP 等老系统无此导出(可选 API);探测走 examples/execd/tray.ts
|
|
33
|
+
}
|
|
34
|
+
})();
|
package/lib/windows/shell32.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// shell32 绑定(shell 对话框 / PIDL
|
|
2
|
-
import { bind } from '../ffi/bind.js'
|
|
1
|
+
// shell32 绑定(shell 对话框 / PIDL→路径 / 托盘图标定位)
|
|
2
|
+
import { bind, type CodecMap } from '../ffi/bind.js'
|
|
3
|
+
import { NOTIFYICONIDENTIFIER } from './structs.js'
|
|
3
4
|
|
|
4
|
-
// dll 名部分应用(工厂转调保泛型 infer,见 lib/windows/user32.ts
|
|
5
|
-
|
|
5
|
+
// dll 名部分应用(工厂转调保泛型 infer,见 lib/windows/user32.ts 头注释);第三参透传
|
|
6
|
+
// encoders(结构入参位注册,方向约定见 lib/windows/user32.ts 头注释)
|
|
7
|
+
const b = <const S extends string, const LE extends CodecMap = {}>(name: string, sig: S, encoders?: LE) =>
|
|
8
|
+
bind('shell32.dll', name, sig, encoders)
|
|
6
9
|
|
|
7
10
|
/** 文件夹浏览对话框;PIDL 用 ole32.CoTaskMemFree 释放
|
|
8
11
|
* @returns PIDL,取消 → 0
|
|
@@ -14,3 +17,23 @@ export const SHBrowseForFolder = /*@__PURE__*/ b('SHBrowseForFolderW', '<BROWSEI
|
|
|
14
17
|
* @param args_0 pidl SHBrowseForFolder 等返回的 PIDL
|
|
15
18
|
* @param args_1 pszPath 出参缓冲,WCHAR.alloc(260)(MAX_PATH=260)、WCHAR.decode 读回 */
|
|
16
19
|
export const SHGetPathFromIDList = /*@__PURE__*/ b('SHGetPathFromIDListW', '<>ptr <BYTE>ptr -> u32')
|
|
20
|
+
|
|
21
|
+
/** 取托盘通知图标的屏幕矩形(Shell_NotifyIconGetRect;**Win7+**——XP 无此导出,
|
|
22
|
+
* 故为**可选绑定**:老系统上本常量为 null(bind() 是模块顶层立即解析,缺符号 throw
|
|
23
|
+
* 会拖垮整个脚本启动),调用方必须判空)
|
|
24
|
+
* @returns HRESULT,实测语义:0 = 图标在通知区内,iconLocation = 其容器(可见区 /
|
|
25
|
+
* 溢出面板)内位置——**溢出面板未展开时该 rect 不是屏幕可点位**;1 = 按文档为
|
|
26
|
+
* 不可见态(隐藏/溢出;本机未复现——实测 Win7 溢出图标亦返 0);0x80004005 E_FAIL
|
|
27
|
+
* = 图标不存在,或该图标未按 {hWnd,uID} 注册(系统 GUID 图标实测 not_found)
|
|
28
|
+
* @param args_0 identifier NOTIFYICONIDENTIFIER 对象直传(encoder 已注册;cbSize 填
|
|
29
|
+
* NOTIFYICONIDENTIFIER.size,guidItem 缺省 = GUID_NULL 走 hWnd+uID)
|
|
30
|
+
* @param args_1 iconLocation 出参槽,RECT.alloc().ptr(出参位不注册,方向约定同
|
|
31
|
+
* user32),RECT.decode 读回 */
|
|
32
|
+
export const Shell_NotifyIconGetRect = (() => {
|
|
33
|
+
try {
|
|
34
|
+
return b('Shell_NotifyIconGetRect',
|
|
35
|
+
'<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32', { NOTIFYICONIDENTIFIER })
|
|
36
|
+
} catch {
|
|
37
|
+
return null // XP 等老系统无此导出(可选 API);探测走 examples/execd/tray.ts
|
|
38
|
+
}
|
|
39
|
+
})()
|