quickwin 2.2.0 → 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 +7 -7
- package/README.md +7 -7
- 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/{execd.js → execd/main.js} +563 -122
- package/examples/execd/tray.js +192 -0
- package/examples/{execd_worker.js → execd/worker.js} +7 -7
- package/examples/pdf_preview2.js +46 -46
- package/examples/pdf_preview2.ts +55 -54
- package/examples/pdf_viewer.js +34 -19
- package/examples/pdf_viewer.tsx +6 -5
- package/examples/test_gallery.js +35 -20
- package/examples/test_gallery.tsx +9 -8
- package/examples/test_react_lazy.js +34 -19
- package/examples/test_react_lazy.tsx +7 -6
- package/examples/test_react_listbox.js +34 -19
- package/examples/test_react_listbox.tsx +8 -7
- package/examples/test_root_window.js +34 -19
- package/examples/test_root_window.tsx +5 -5
- package/examples/test_tab.js +34 -19
- 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/http-server.js +4 -4
- package/lib/http-server.ts +5 -4
- 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 +16 -16
- package/lib/windows/gdi32.ts +16 -16
- 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 +54 -0
- package/lib/windows/structs.ts +63 -1
- 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 +7 -7
- package/test/test_ffi_bind.ts +8 -8
- package/test/test_ffi_struct.js +2 -2
- package/test/test_ffi_struct.ts +3 -3
- 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 +36 -21
- package/test/test_react_counter.js +34 -19
- package/test/test_react_flex.js +36 -21
- package/test/test_react_hidden.js +34 -19
- package/test/test_react_listview_link.js +35 -20
- package/test/test_react_notify.js +52 -37
- package/test/test_react_render.js +34 -19
- 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/execd.tsx +0 -798
- package/examples/execd_worker.ts +0 -127
- package/quickwin_const.d.ts +0 -1063
package/lib/windows/advapi32.ts
CHANGED
|
@@ -6,13 +6,13 @@ const b = <const S extends string>(name: string, sig: S) => bind('advapi32.dll',
|
|
|
6
6
|
|
|
7
7
|
/** 创建/打开子键(子键不存在则创建,含中间层级)
|
|
8
8
|
* @returns 0 = ERROR_SUCCESS
|
|
9
|
-
* @param args_0 hKey 父键:
|
|
9
|
+
* @param args_0 hKey 父键:HKey.CURRENT_USER / LOCAL_MACHINE 预定义键,或本族
|
|
10
10
|
* Open/Create 返回的真实句柄(此位双来源,不标 @HKey——裸位收两种)
|
|
11
11
|
* @param args_1 lpSubKey 子键路径('Software\\X\\Y',可 NULL = 打开 hKey 自身副本)
|
|
12
12
|
* @param args_2 Reserved 保留,恒 0
|
|
13
13
|
* @param args_3 lpClass 键类名(一般 NULL)
|
|
14
14
|
* @param args_4 dwOptions 保留属性(恒 0)
|
|
15
|
-
* @param args_5 samDesired 访问掩码
|
|
15
|
+
* @param args_5 samDesired 访问掩码 RegAccess.READ / SET_VALUE(标准组合常量按成员收录)
|
|
16
16
|
* @param args_6 lpSecurityAttributes 安全描述符(一般 NULL)
|
|
17
17
|
* @param args_7 phkResult 出参:键句柄(PtrArrayBuffer(8),readPtr 按架构读回)
|
|
18
18
|
* @param args_8 lpdwDisposition 出参:新建/已存在标记(可 NULL) */
|
|
@@ -24,7 +24,7 @@ export const RegCreateKeyEx = /*@__PURE__*/ b('RegCreateKeyExW',
|
|
|
24
24
|
* @param args_0 hKey 父键(同 RegCreateKeyEx 的双来源语义)
|
|
25
25
|
* @param args_1 lpSubKey 子键路径(NULL = 打开 hKey 自身副本)
|
|
26
26
|
* @param args_2 ulOptions 保留,恒 0
|
|
27
|
-
* @param args_3 samDesired 访问掩码
|
|
27
|
+
* @param args_3 samDesired 访问掩码 RegAccess.READ / SET_VALUE
|
|
28
28
|
* @param args_4 phkResult 出参:键句柄 */
|
|
29
29
|
export const RegOpenKeyEx = /*@__PURE__*/ b('RegOpenKeyExW',
|
|
30
30
|
'<>ptr <WCHAR>ptr u32 u32@RegAccess <BYTE>ptr -> i32')
|
|
@@ -36,10 +36,10 @@ export const RegCloseKey = /*@__PURE__*/ b('RegCloseKey', '<>ptr -> i32')
|
|
|
36
36
|
|
|
37
37
|
/** 写键值
|
|
38
38
|
* @returns 0 = ERROR_SUCCESS
|
|
39
|
-
* @param args_0 hKey 键句柄(须 KEY_SET_VALUE 权限,含于
|
|
39
|
+
* @param args_0 hKey 键句柄(须 KEY_SET_VALUE 权限,含于 RegAccess.SET_VALUE)
|
|
40
40
|
* @param args_1 lpValueName 值名(NULL = 键的默认值)
|
|
41
41
|
* @param args_2 Reserved 保留,恒 0
|
|
42
|
-
* @param args_3 dwType 值类型
|
|
42
|
+
* @param args_3 dwType 值类型 RegType.SZ(UTF-16 字符串)
|
|
43
43
|
* @param args_4 lpData 数据缓冲(REG_SZ:UTF-16LE 含结尾 NUL)
|
|
44
44
|
* @param args_5 cbData 数据字节数(REG_SZ = (字符数+1)*2) */
|
|
45
45
|
export const RegSetValueEx = /*@__PURE__*/ b('RegSetValueExW',
|
|
@@ -47,7 +47,7 @@ export const RegSetValueEx = /*@__PURE__*/ b('RegSetValueExW',
|
|
|
47
47
|
|
|
48
48
|
/** 读键值(两跳模式:第一跳 lpData=NULL 取尺寸/类型,第二跳按尺寸带缓冲读数据)
|
|
49
49
|
* @returns 0 = ERROR_SUCCESS;2 = ERROR_FILE_NOT_FOUND(值不存在)
|
|
50
|
-
* @param args_0 hKey 键句柄(须 KEY_QUERY_VALUE 权限,含于
|
|
50
|
+
* @param args_0 hKey 键句柄(须 KEY_QUERY_VALUE 权限,含于 RegAccess.READ)
|
|
51
51
|
* @param args_1 lpValueName 值名(NULL = 键的默认值)
|
|
52
52
|
* @param args_2 lpReserved 保留,恒 NULL
|
|
53
53
|
* @param args_3 lpType 出参:值类型(可 NULL)
|
|
@@ -57,7 +57,7 @@ export const RegQueryValueEx = /*@__PURE__*/ b('RegQueryValueExW',
|
|
|
57
57
|
'<>ptr <WCHAR>ptr <>ptr <BYTE>ptr <BYTE>ptr <BYTE>ptr -> i32')
|
|
58
58
|
|
|
59
59
|
/** 删除子键(连值一起删);须父键 KEY_CREATE_SUB_KEY 权限——自己的 HKCU 直接传
|
|
60
|
-
*
|
|
60
|
+
* HKey.CURRENT_USER 即可
|
|
61
61
|
* @returns 0 = ERROR_SUCCESS;2 = 子键不存在
|
|
62
62
|
* @param args_0 hKey 父键
|
|
63
63
|
* @param args_1 lpSubKey 要删的子键路径(不可 NULL) */
|
package/lib/windows/gdi32.js
CHANGED
|
@@ -68,7 +68,7 @@ export const SelectObject = /*@__PURE__*/ b('SelectObject', '<HDC>ptr! <HGDIOBJ>
|
|
|
68
68
|
* @param args_5 hdcSrc 源 DC
|
|
69
69
|
* @param args_6 x1 源起始 x
|
|
70
70
|
* @param args_7 y1 源起始 y
|
|
71
|
-
* @param args_8 dwRop
|
|
71
|
+
* @param args_8 dwRop RasterOp.SRCCOPY 等互斥单选光栅操作码(标 @ 枚举拦手误值) */
|
|
72
72
|
// hdcDest 非空(!);hdcSrc 在 PATCOPY 等特定 rop 下 C 允许 NULL,保持可空档。
|
|
73
73
|
export const BitBlt = /*@__PURE__*/ b('BitBlt', '<HDC>ptr! i32 i32 i32 i32 <HDC>ptr i32 i32 u32@RasterOp -> i32');
|
|
74
74
|
/** 取位图像素到 lpvBits(lpbmi 为 BITMAPINFO,32bpp BI_RGB 无颜色表时头部即全部:
|
|
@@ -99,7 +99,7 @@ export const DeleteDC = /*@__PURE__*/ b('DeleteDC', '<HDC>ptr! -> i32');
|
|
|
99
99
|
* @param args_2 y 左上角 y
|
|
100
100
|
* @param args_3 w 宽度
|
|
101
101
|
* @param args_4 h 高度
|
|
102
|
-
* @param args_5 rop
|
|
102
|
+
* @param args_5 rop RasterOp.PATCOPY / WHITENESS 等互斥单选光栅操作码 */
|
|
103
103
|
export const PatBlt = /*@__PURE__*/ b('PatBlt', '<HDC>ptr! i32 i32 i32 i32 u32@RasterOp -> i32');
|
|
104
104
|
/** 拉伸位图传送(源区 wSrc×hSrc 放/缩到目标 wDest×hDest)
|
|
105
105
|
* @returns 成功 → 非 0
|
|
@@ -113,15 +113,15 @@ export const PatBlt = /*@__PURE__*/ b('PatBlt', '<HDC>ptr! i32 i32 i32 i32 u32@R
|
|
|
113
113
|
* @param args_7 ySrc 源区左上 y
|
|
114
114
|
* @param args_8 wSrc 源区宽
|
|
115
115
|
* @param args_9 hSrc 源区高
|
|
116
|
-
* @param args_10 dwRop
|
|
116
|
+
* @param args_10 dwRop RasterOp.SRCCOPY 等互斥单选光栅操作码 */
|
|
117
117
|
export const StretchBlt = /*@__PURE__*/ b('StretchBlt', '<HDC>ptr! i32 i32 i32 i32 <HDC>ptr i32 i32 i32 i32 u32@RasterOp -> i32');
|
|
118
118
|
/** 设置拉伸取色模式;放大时各模式像素同为源色,缩小时降采样策略不同
|
|
119
119
|
* (DELETESCANS 丢行 / HALFTONE 平均取色最保真)
|
|
120
120
|
* @returns 旧值
|
|
121
121
|
* @param args_0 hdc 目标 DC
|
|
122
|
-
* @param args_1 iMode
|
|
122
|
+
* @param args_1 iMode StretchBltMode.ANDSCANS(1) / ORSCANS(2) / DELETESCANS(3) / HALFTONE(4) */
|
|
123
123
|
export const SetStretchBltMode = /*@__PURE__*/ b('SetStretchBltMode', '<HDC>ptr! i32@StretchBltMode -> i32');
|
|
124
|
-
/** 读拉伸取色模式(值域 =
|
|
124
|
+
/** 读拉伸取色模式(值域 = StretchBltMode 成员);回传
|
|
125
125
|
* SetStretchBltMode 前需按成员值使用(裸 number 进不了枚举位)
|
|
126
126
|
* @returns number */
|
|
127
127
|
export const GetStretchBltMode = /*@__PURE__*/ b('GetStretchBltMode', '<HDC>ptr! -> i32');
|
|
@@ -187,18 +187,18 @@ export const SetDIBitsToDevice = /*@__PURE__*/ b('SetDIBitsToDevice', '<HDC>ptr!
|
|
|
187
187
|
* @param args_9 lpvBits 像素缓冲(ArrayBuffer)
|
|
188
188
|
* @param args_10 lpbmi BITMAPINFO 缓冲(BITMAPINFOHEADER.encode({...}).ptr)
|
|
189
189
|
* @param args_11 iUsage DIB_RGB_COLORS(0)
|
|
190
|
-
* @param args_12 rop
|
|
190
|
+
* @param args_12 rop RasterOp.SRCCOPY 等互斥单选光栅操作码 */
|
|
191
191
|
export const StretchDIBits = /*@__PURE__*/ b('StretchDIBits', '<HDC>ptr! i32 i32 i32 i32 i32 i32 i32 i32 <BYTE>ptr <BYTE>ptr u32 u32@RasterOp -> i32');
|
|
192
192
|
// ============ 画图原语(笔 / 线 / 形状 / 文字) ============
|
|
193
193
|
/** 取系统共享对象(笔/刷/字体/调色板);共享句柄不要 DeleteObject——
|
|
194
194
|
* SelectObject 选入 hdc 生效(如 NULL_BRUSH 让形状只描边不填充)
|
|
195
195
|
* @returns 失败 → 0
|
|
196
|
-
* @param args_0 iObject
|
|
196
|
+
* @param args_0 iObject StockObject.NULL_BRUSH / BLACK_PEN / DEFAULT_GUI_FONT 等 */
|
|
197
197
|
export const GetStockObject = /*@__PURE__*/ b('GetStockObject', 'i32@StockObject -> <HGDIOBJ>ptr');
|
|
198
198
|
/** 创建网格纹理画刷(线色 = crColor,间隙 = 背景:SetBkMode=TRANSPARENT 透底、OPAQUE
|
|
199
199
|
* 用 SetBkColor);配对 DeleteObject
|
|
200
200
|
* @returns 失败 → 0
|
|
201
|
-
* @param args_0 iHatch
|
|
201
|
+
* @param args_0 iHatch HatchStyle.HORIZONTAL(横线)/ VERTICAL / FDIAGONAL /
|
|
202
202
|
* BDIAGONAL / CROSS / DIAGCROSS
|
|
203
203
|
* @param args_1 crColor 纹理线颜色 0x00BBGGRR */
|
|
204
204
|
export const CreateHatchBrush = /*@__PURE__*/ b('CreateHatchBrush', 'i32@HatchStyle u32 -> <HGDIOBJ>ptr');
|
|
@@ -209,14 +209,14 @@ export const CreateHatchBrush = /*@__PURE__*/ b('CreateHatchBrush', 'i32@HatchSt
|
|
|
209
209
|
export const CreatePatternBrush = /*@__PURE__*/ b('CreatePatternBrush', '<HGDIOBJ>ptr -> <HGDIOBJ>ptr');
|
|
210
210
|
/** 创建画笔(选入 hdc 生效,SelectObject 选回旧对象后 DeleteObject 配对)
|
|
211
211
|
* @returns 失败 → 0
|
|
212
|
-
* @param args_0 iStyle 笔型(
|
|
212
|
+
* @param args_0 iStyle 笔型(PenStyle.SOLID / DASH / NULL 等)
|
|
213
213
|
* @param args_1 cWidth 笔宽(像素;>1 的几何宽设备相关,虚线样式可能被拉伸)
|
|
214
214
|
* @param args_2 crColor 笔色 0x00BBGGRR */
|
|
215
215
|
export const CreatePen = /*@__PURE__*/ b('CreatePen', 'i32@PenStyle i32 u32 -> <HGDIOBJ>ptr');
|
|
216
216
|
/** 设置文字/阴影背景填充模式
|
|
217
217
|
* @returns 旧模式(新建 DC 默认 OPAQUE)
|
|
218
218
|
* @param args_0 hdc 目标 DC
|
|
219
|
-
* @param args_1 iBkMode
|
|
219
|
+
* @param args_1 iBkMode BackgroundMode.OPAQUE(衬底填充)/ TRANSPARENT(透明) */
|
|
220
220
|
export const SetBkMode = /*@__PURE__*/ b('SetBkMode', '<HDC>ptr! i32@BackgroundMode -> i32');
|
|
221
221
|
/** 设置文字颜色
|
|
222
222
|
* @returns 旧 COLORREF(0x00BBGGRR)
|
|
@@ -241,19 +241,19 @@ export const RestoreDC = /*@__PURE__*/ b('RestoreDC', '<HDC>ptr! i32 -> i32');
|
|
|
241
241
|
/** 设置多边形填充规则
|
|
242
242
|
* @returns 旧值(新建 DC 默认 ALTERNATE = 奇偶规则)
|
|
243
243
|
* @param args_0 hdc 目标 DC
|
|
244
|
-
* @param args_1 iMode
|
|
244
|
+
* @param args_1 iMode PolyFillMode.ALTERNATE(自相交区域交替镂空)/
|
|
245
245
|
* WINDING(非零环绕,自相交区域整体实心) */
|
|
246
246
|
export const SetPolyFillMode = /*@__PURE__*/ b('SetPolyFillMode', '<HDC>ptr! i32@PolyFillMode -> i32');
|
|
247
247
|
/** 设置前景画笔与目的像素的混合方式(二元光栅模式);
|
|
248
248
|
* R2_XORPEN 可逆(同路径画两次抵消原样),适合橡皮筋交互
|
|
249
249
|
* @returns 旧值(默认 R2_COPYPEN = 直接画)
|
|
250
250
|
* @param args_0 hdc 目标 DC
|
|
251
|
-
* @param args_1 iMode
|
|
251
|
+
* @param args_1 iMode RasterMode.R2_COPYPEN / R2_XORPEN / R2_NOT 等(单选,标 @ 枚举) */
|
|
252
252
|
export const SetROP2 = /*@__PURE__*/ b('SetROP2', '<HDC>ptr! i32@RasterMode -> i32');
|
|
253
253
|
/** 设置弧/弦/扇形的扫过方向
|
|
254
254
|
* @returns 旧值(新 DC 默认逆时针)
|
|
255
255
|
* @param args_0 hdc 目标 DC
|
|
256
|
-
* @param args_1 iDir
|
|
256
|
+
* @param args_1 iDir ArcDirection.COUNTERCLOCKWISE(默认)/ CLOCKWISE */
|
|
257
257
|
export const SetArcDirection = /*@__PURE__*/ b('SetArcDirection', '<HDC>ptr! i32@ArcDirection -> i32');
|
|
258
258
|
/** 读弧扫过方向
|
|
259
259
|
* @returns AD_COUNTERCLOCKWISE=1 / AD_CLOCKWISE=2;失败 → 0 */
|
|
@@ -358,10 +358,10 @@ export const Pie = /*@__PURE__*/ b('Pie', '<HDC>ptr! i32 i32 i32 i32 i32 i32 i32
|
|
|
358
358
|
* @param args_4 c 字符数(= str.length;C 要字符数不是字节数,不含 NUL) */
|
|
359
359
|
export const TextOut = /*@__PURE__*/ b('TextOutW', '<HDC>ptr! i32 i32 <WCHAR>ptr i32 -> i32');
|
|
360
360
|
/** 设置 TextOut/ExtTextOut 的对齐与当前位置更新方式;TA_* 按位组合
|
|
361
|
-
* (如
|
|
361
|
+
* (如 TextAlign.TA_CENTER | TextAlign.TA_UPDATECP),故签名保持 u32 不标枚举
|
|
362
362
|
* @returns 旧 flags(新 DC 默认 TA_LEFT|TA_TOP|TA_NOUPDATECP = 0)
|
|
363
363
|
* @param args_0 hdc 目标 DC
|
|
364
|
-
* @param args_1 fMode
|
|
364
|
+
* @param args_1 fMode TextAlign 成员按位或 */
|
|
365
365
|
export const SetTextAlign = /*@__PURE__*/ b('SetTextAlign', '<HDC>ptr! u32 -> u32');
|
|
366
366
|
/** 按当前字体量字符串宽高(不含衬底与额外间距)
|
|
367
367
|
* @returns 成功 → 非 0
|
|
@@ -382,7 +382,7 @@ export const GetTextMetrics = /*@__PURE__*/ b('GetTextMetricsW', '<HDC>ptr! <TEX
|
|
|
382
382
|
* @param args_0 hdc 目标 DC
|
|
383
383
|
* @param args_1 x 起点 x
|
|
384
384
|
* @param args_2 y 起点 y
|
|
385
|
-
* @param args_3 fOptions
|
|
385
|
+
* @param args_3 fOptions TextOutOptions.ETO_OPAQUE(矩形填衬底)|
|
|
386
386
|
* ETO_CLIPPED(矩形裁剪字形)按位或(可 0 = 都不用)
|
|
387
387
|
* @param args_4 lprc ETO_OPAQUE/ETO_CLIPPED 的作用矩形:DeepPartial 对象直传 /
|
|
388
388
|
* RECT.alloc().ptr / NULL = 整个当前可裁剪区(有 encoder 的纯入参位三形态)
|
package/lib/windows/gdi32.ts
CHANGED
|
@@ -77,7 +77,7 @@ export const SelectObject = /*@__PURE__*/ b('SelectObject', '<HDC>ptr! <HGDIOBJ>
|
|
|
77
77
|
* @param args_5 hdcSrc 源 DC
|
|
78
78
|
* @param args_6 x1 源起始 x
|
|
79
79
|
* @param args_7 y1 源起始 y
|
|
80
|
-
* @param args_8 dwRop
|
|
80
|
+
* @param args_8 dwRop RasterOp.SRCCOPY 等互斥单选光栅操作码(标 @ 枚举拦手误值) */
|
|
81
81
|
// hdcDest 非空(!);hdcSrc 在 PATCOPY 等特定 rop 下 C 允许 NULL,保持可空档。
|
|
82
82
|
export const BitBlt = /*@__PURE__*/ b('BitBlt', '<HDC>ptr! i32 i32 i32 i32 <HDC>ptr i32 i32 u32@RasterOp -> i32')
|
|
83
83
|
/** 取位图像素到 lpvBits(lpbmi 为 BITMAPINFO,32bpp BI_RGB 无颜色表时头部即全部:
|
|
@@ -109,7 +109,7 @@ export const DeleteDC = /*@__PURE__*/ b('DeleteDC', '<HDC>ptr! -> i32')
|
|
|
109
109
|
* @param args_2 y 左上角 y
|
|
110
110
|
* @param args_3 w 宽度
|
|
111
111
|
* @param args_4 h 高度
|
|
112
|
-
* @param args_5 rop
|
|
112
|
+
* @param args_5 rop RasterOp.PATCOPY / WHITENESS 等互斥单选光栅操作码 */
|
|
113
113
|
export const PatBlt = /*@__PURE__*/ b('PatBlt', '<HDC>ptr! i32 i32 i32 i32 u32@RasterOp -> i32')
|
|
114
114
|
/** 拉伸位图传送(源区 wSrc×hSrc 放/缩到目标 wDest×hDest)
|
|
115
115
|
* @returns 成功 → 非 0
|
|
@@ -123,16 +123,16 @@ export const PatBlt = /*@__PURE__*/ b('PatBlt', '<HDC>ptr! i32 i32 i32 i32 u32@R
|
|
|
123
123
|
* @param args_7 ySrc 源区左上 y
|
|
124
124
|
* @param args_8 wSrc 源区宽
|
|
125
125
|
* @param args_9 hSrc 源区高
|
|
126
|
-
* @param args_10 dwRop
|
|
126
|
+
* @param args_10 dwRop RasterOp.SRCCOPY 等互斥单选光栅操作码 */
|
|
127
127
|
export const StretchBlt = /*@__PURE__*/ b('StretchBlt',
|
|
128
128
|
'<HDC>ptr! i32 i32 i32 i32 <HDC>ptr i32 i32 i32 i32 u32@RasterOp -> i32')
|
|
129
129
|
/** 设置拉伸取色模式;放大时各模式像素同为源色,缩小时降采样策略不同
|
|
130
130
|
* (DELETESCANS 丢行 / HALFTONE 平均取色最保真)
|
|
131
131
|
* @returns 旧值
|
|
132
132
|
* @param args_0 hdc 目标 DC
|
|
133
|
-
* @param args_1 iMode
|
|
133
|
+
* @param args_1 iMode StretchBltMode.ANDSCANS(1) / ORSCANS(2) / DELETESCANS(3) / HALFTONE(4) */
|
|
134
134
|
export const SetStretchBltMode = /*@__PURE__*/ b('SetStretchBltMode', '<HDC>ptr! i32@StretchBltMode -> i32')
|
|
135
|
-
/** 读拉伸取色模式(值域 =
|
|
135
|
+
/** 读拉伸取色模式(值域 = StretchBltMode 成员);回传
|
|
136
136
|
* SetStretchBltMode 前需按成员值使用(裸 number 进不了枚举位)
|
|
137
137
|
* @returns number */
|
|
138
138
|
export const GetStretchBltMode = /*@__PURE__*/ b('GetStretchBltMode', '<HDC>ptr! -> i32')
|
|
@@ -202,7 +202,7 @@ export const SetDIBitsToDevice = /*@__PURE__*/ b('SetDIBitsToDevice',
|
|
|
202
202
|
* @param args_9 lpvBits 像素缓冲(ArrayBuffer)
|
|
203
203
|
* @param args_10 lpbmi BITMAPINFO 缓冲(BITMAPINFOHEADER.encode({...}).ptr)
|
|
204
204
|
* @param args_11 iUsage DIB_RGB_COLORS(0)
|
|
205
|
-
* @param args_12 rop
|
|
205
|
+
* @param args_12 rop RasterOp.SRCCOPY 等互斥单选光栅操作码 */
|
|
206
206
|
export const StretchDIBits = /*@__PURE__*/ b('StretchDIBits',
|
|
207
207
|
'<HDC>ptr! i32 i32 i32 i32 i32 i32 i32 i32 <BYTE>ptr <BYTE>ptr u32 u32@RasterOp -> i32')
|
|
208
208
|
|
|
@@ -211,13 +211,13 @@ export const StretchDIBits = /*@__PURE__*/ b('StretchDIBits',
|
|
|
211
211
|
/** 取系统共享对象(笔/刷/字体/调色板);共享句柄不要 DeleteObject——
|
|
212
212
|
* SelectObject 选入 hdc 生效(如 NULL_BRUSH 让形状只描边不填充)
|
|
213
213
|
* @returns 失败 → 0
|
|
214
|
-
* @param args_0 iObject
|
|
214
|
+
* @param args_0 iObject StockObject.NULL_BRUSH / BLACK_PEN / DEFAULT_GUI_FONT 等 */
|
|
215
215
|
export const GetStockObject = /*@__PURE__*/ b('GetStockObject', 'i32@StockObject -> <HGDIOBJ>ptr')
|
|
216
216
|
|
|
217
217
|
/** 创建网格纹理画刷(线色 = crColor,间隙 = 背景:SetBkMode=TRANSPARENT 透底、OPAQUE
|
|
218
218
|
* 用 SetBkColor);配对 DeleteObject
|
|
219
219
|
* @returns 失败 → 0
|
|
220
|
-
* @param args_0 iHatch
|
|
220
|
+
* @param args_0 iHatch HatchStyle.HORIZONTAL(横线)/ VERTICAL / FDIAGONAL /
|
|
221
221
|
* BDIAGONAL / CROSS / DIAGCROSS
|
|
222
222
|
* @param args_1 crColor 纹理线颜色 0x00BBGGRR */
|
|
223
223
|
export const CreateHatchBrush = /*@__PURE__*/ b('CreateHatchBrush', 'i32@HatchStyle u32 -> <HGDIOBJ>ptr')
|
|
@@ -230,14 +230,14 @@ export const CreatePatternBrush = /*@__PURE__*/ b('CreatePatternBrush', '<HGDIOB
|
|
|
230
230
|
|
|
231
231
|
/** 创建画笔(选入 hdc 生效,SelectObject 选回旧对象后 DeleteObject 配对)
|
|
232
232
|
* @returns 失败 → 0
|
|
233
|
-
* @param args_0 iStyle 笔型(
|
|
233
|
+
* @param args_0 iStyle 笔型(PenStyle.SOLID / DASH / NULL 等)
|
|
234
234
|
* @param args_1 cWidth 笔宽(像素;>1 的几何宽设备相关,虚线样式可能被拉伸)
|
|
235
235
|
* @param args_2 crColor 笔色 0x00BBGGRR */
|
|
236
236
|
export const CreatePen = /*@__PURE__*/ b('CreatePen', 'i32@PenStyle i32 u32 -> <HGDIOBJ>ptr')
|
|
237
237
|
/** 设置文字/阴影背景填充模式
|
|
238
238
|
* @returns 旧模式(新建 DC 默认 OPAQUE)
|
|
239
239
|
* @param args_0 hdc 目标 DC
|
|
240
|
-
* @param args_1 iBkMode
|
|
240
|
+
* @param args_1 iBkMode BackgroundMode.OPAQUE(衬底填充)/ TRANSPARENT(透明) */
|
|
241
241
|
export const SetBkMode = /*@__PURE__*/ b('SetBkMode', '<HDC>ptr! i32@BackgroundMode -> i32')
|
|
242
242
|
/** 设置文字颜色
|
|
243
243
|
* @returns 旧 COLORREF(0x00BBGGRR)
|
|
@@ -262,19 +262,19 @@ export const RestoreDC = /*@__PURE__*/ b('RestoreDC', '<HDC>ptr! i32 -> i32')
|
|
|
262
262
|
/** 设置多边形填充规则
|
|
263
263
|
* @returns 旧值(新建 DC 默认 ALTERNATE = 奇偶规则)
|
|
264
264
|
* @param args_0 hdc 目标 DC
|
|
265
|
-
* @param args_1 iMode
|
|
265
|
+
* @param args_1 iMode PolyFillMode.ALTERNATE(自相交区域交替镂空)/
|
|
266
266
|
* WINDING(非零环绕,自相交区域整体实心) */
|
|
267
267
|
export const SetPolyFillMode = /*@__PURE__*/ b('SetPolyFillMode', '<HDC>ptr! i32@PolyFillMode -> i32')
|
|
268
268
|
/** 设置前景画笔与目的像素的混合方式(二元光栅模式);
|
|
269
269
|
* R2_XORPEN 可逆(同路径画两次抵消原样),适合橡皮筋交互
|
|
270
270
|
* @returns 旧值(默认 R2_COPYPEN = 直接画)
|
|
271
271
|
* @param args_0 hdc 目标 DC
|
|
272
|
-
* @param args_1 iMode
|
|
272
|
+
* @param args_1 iMode RasterMode.R2_COPYPEN / R2_XORPEN / R2_NOT 等(单选,标 @ 枚举) */
|
|
273
273
|
export const SetROP2 = /*@__PURE__*/ b('SetROP2', '<HDC>ptr! i32@RasterMode -> i32')
|
|
274
274
|
/** 设置弧/弦/扇形的扫过方向
|
|
275
275
|
* @returns 旧值(新 DC 默认逆时针)
|
|
276
276
|
* @param args_0 hdc 目标 DC
|
|
277
|
-
* @param args_1 iDir
|
|
277
|
+
* @param args_1 iDir ArcDirection.COUNTERCLOCKWISE(默认)/ CLOCKWISE */
|
|
278
278
|
export const SetArcDirection = /*@__PURE__*/ b('SetArcDirection', '<HDC>ptr! i32@ArcDirection -> i32')
|
|
279
279
|
/** 读弧扫过方向
|
|
280
280
|
* @returns AD_COUNTERCLOCKWISE=1 / AD_CLOCKWISE=2;失败 → 0 */
|
|
@@ -383,10 +383,10 @@ export const Pie = /*@__PURE__*/ b('Pie', '<HDC>ptr! i32 i32 i32 i32 i32 i32 i32
|
|
|
383
383
|
* @param args_4 c 字符数(= str.length;C 要字符数不是字节数,不含 NUL) */
|
|
384
384
|
export const TextOut = /*@__PURE__*/ b('TextOutW', '<HDC>ptr! i32 i32 <WCHAR>ptr i32 -> i32')
|
|
385
385
|
/** 设置 TextOut/ExtTextOut 的对齐与当前位置更新方式;TA_* 按位组合
|
|
386
|
-
* (如
|
|
386
|
+
* (如 TextAlign.TA_CENTER | TextAlign.TA_UPDATECP),故签名保持 u32 不标枚举
|
|
387
387
|
* @returns 旧 flags(新 DC 默认 TA_LEFT|TA_TOP|TA_NOUPDATECP = 0)
|
|
388
388
|
* @param args_0 hdc 目标 DC
|
|
389
|
-
* @param args_1 fMode
|
|
389
|
+
* @param args_1 fMode TextAlign 成员按位或 */
|
|
390
390
|
export const SetTextAlign = /*@__PURE__*/ b('SetTextAlign', '<HDC>ptr! u32 -> u32')
|
|
391
391
|
/** 按当前字体量字符串宽高(不含衬底与额外间距)
|
|
392
392
|
* @returns 成功 → 非 0
|
|
@@ -409,7 +409,7 @@ export const GetTextMetrics = /*@__PURE__*/ b('GetTextMetricsW',
|
|
|
409
409
|
* @param args_0 hdc 目标 DC
|
|
410
410
|
* @param args_1 x 起点 x
|
|
411
411
|
* @param args_2 y 起点 y
|
|
412
|
-
* @param args_3 fOptions
|
|
412
|
+
* @param args_3 fOptions TextOutOptions.ETO_OPAQUE(矩形填衬底)|
|
|
413
413
|
* ETO_CLIPPED(矩形裁剪字形)按位或(可 0 = 都不用)
|
|
414
414
|
* @param args_4 lprc ETO_OPAQUE/ETO_CLIPPED 的作用矩形:DeepPartial 对象直传 /
|
|
415
415
|
* RECT.alloc().ptr / NULL = 整个当前可裁剪区(有 encoder 的纯入参位三形态)
|
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
|
+
})()
|
package/lib/windows/structs.js
CHANGED
|
@@ -601,3 +601,57 @@ export const PROCESS_MEMORY_COUNTERS_DECL = {
|
|
|
601
601
|
PeakPagefileUsage: '<>ptr',
|
|
602
602
|
};
|
|
603
603
|
export const PROCESS_MEMORY_COUNTERS = /* @__PURE__ */ struct('PROCESS_MEMORY_COUNTERS', PROCESS_MEMORY_COUNTERS_DECL);
|
|
604
|
+
/** MOUSEINPUT(SendInput 鼠标事件体;x86 24B / x64 32B——dwExtraInfo 是 ULONG_PTR,
|
|
605
|
+
* 随位宽)。dx/dy 相对位移,或 dwFlags 带 MOUSEEVENTF_ABSOLUTE 时为 0-65535 归一化
|
|
606
|
+
* 物理像素(本引擎 SetProcessDPIAware,见 src/main.c,全坐标 API 同空间);
|
|
607
|
+
* mouseData 滚轮增量(±120)或 X 系按钮编号(XBUTTON1/2) */
|
|
608
|
+
export const MOUSEINPUT_DECL = {
|
|
609
|
+
'#': 'struct',
|
|
610
|
+
dx: 'i32',
|
|
611
|
+
dy: 'i32',
|
|
612
|
+
mouseData: 'u32',
|
|
613
|
+
dwFlags: 'u32',
|
|
614
|
+
time: 'u32',
|
|
615
|
+
dwExtraInfo: '<>ptr',
|
|
616
|
+
};
|
|
617
|
+
export const MOUSEINPUT = /* @__PURE__ */ struct('MOUSEINPUT', MOUSEINPUT_DECL);
|
|
618
|
+
/** KEYBDINPUT(SendInput 键盘事件体;x86 16B / x64 24B):wVk 虚拟键码,
|
|
619
|
+
* dwFlags 带 KEYEVENTF_UNICODE 时 wScan = 字符码 */
|
|
620
|
+
export const KEYBDINPUT_DECL = {
|
|
621
|
+
'#': 'struct',
|
|
622
|
+
wVk: 'u16',
|
|
623
|
+
wScan: 'u16',
|
|
624
|
+
dwFlags: 'u32',
|
|
625
|
+
time: 'u32',
|
|
626
|
+
dwExtraInfo: '<>ptr',
|
|
627
|
+
};
|
|
628
|
+
export const KEYBDINPUT = /* @__PURE__ */ struct('KEYBDINPUT', KEYBDINPUT_DECL);
|
|
629
|
+
/** INPUT(SendInput 元素;x86 28B / x64 40B):type(INPUT_MOUSE=0 / INPUT_KEYBOARD=1)
|
|
630
|
+
* + 三选一 union——C 的 DUMMYUNIONNAME 匿名成员在此命名嵌套(encode 形
|
|
631
|
+
* {type, data:{mi|ki:{...}}})。union 随 MOUSEINPUT 的 ULONG_PTR 位宽,x64 下 type 后
|
|
632
|
+
* 自动补 4B padding 使 union 8 对齐(MSVC 布局)。HARDWAREINPUT 不注入,省略不改
|
|
633
|
+
* 尺寸(union 尺寸 = max 成员 = MOUSEINPUT)。dwExtraInfo 是 ULONG_PTR 信息位(非句柄)
|
|
634
|
+
* → <>ptr 裸档(uintptr 双态先例:WPARAM/LPARAM/void*),恒传 0 */
|
|
635
|
+
export const INPUT_DECL = {
|
|
636
|
+
'#': 'struct',
|
|
637
|
+
type: 'u32',
|
|
638
|
+
data: {
|
|
639
|
+
'#': 'union',
|
|
640
|
+
mi: MOUSEINPUT_DECL,
|
|
641
|
+
ki: KEYBDINPUT_DECL,
|
|
642
|
+
},
|
|
643
|
+
};
|
|
644
|
+
export const INPUT = /* @__PURE__ */ struct('INPUT', INPUT_DECL);
|
|
645
|
+
/** NOTIFYICONIDENTIFIER(Shell_NotifyIconGetRect 定位托盘通知图标;x86 28B / x64 40B——
|
|
646
|
+
* hWnd 是 HWND 随位宽,guidItem = GUID 固定 16B 不随)。定位二法取一:guidItem 非全 0
|
|
647
|
+
* 时忽略 hWnd/uID,否则走 hWnd+uID(deskmon 等自注册图标即此形,与 Shell_NotifyIcon
|
|
648
|
+
* 的 {hwnd,uID} 同源);guidItem 缺省 = GUID_NULL 走 hWnd+uID。cbSize 调用前填
|
|
649
|
+
* NOTIFYICONIDENTIFIER.size(cb 结构惯例,见 PROCESS_MEMORY_COUNTERS 同) */
|
|
650
|
+
export const NOTIFYICONIDENTIFIER_DECL = {
|
|
651
|
+
'#': 'struct',
|
|
652
|
+
cbSize: 'u32',
|
|
653
|
+
hWnd: '<HWND>ptr',
|
|
654
|
+
uID: 'u32',
|
|
655
|
+
guidItem: 'u32[4]',
|
|
656
|
+
};
|
|
657
|
+
export const NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct('NOTIFYICONIDENTIFIER', NOTIFYICONIDENTIFIER_DECL);
|