quickwin 2.0.0 → 2.1.1
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 +21 -26
- package/README.md +3 -6
- package/examples/exec_server.js +139 -31
- package/examples/exec_server.tsx +7 -8
- package/examples/exec_server_worker.js +1 -1
- package/examples/exec_server_worker.ts +2 -2
- package/examples/pdf_preview2.js +1 -1
- package/examples/pdf_preview2.ts +1 -1
- package/examples/pdf_viewer.js +132 -28
- package/examples/pdf_viewer.tsx +1 -1
- package/examples/test_gallery.js +131 -27
- package/examples/test_react_lazy.js +131 -27
- package/examples/test_react_listbox.js +131 -27
- package/examples/test_root_window.js +131 -27
- package/examples/test_tab.js +131 -27
- package/lib/certs.js +13 -8
- package/lib/certs.ts +13 -8
- package/lib/fetch.js +51 -3
- package/lib/fetch.ts +38 -3
- package/lib/ffi/bind.js +94 -5
- package/lib/ffi/bind.ts +107 -10
- package/lib/ffi/ctype.js +33 -7
- package/lib/ffi/ctype.ts +48 -10
- package/lib/ffi/struct.js +92 -14
- package/lib/ffi/struct.ts +108 -19
- package/lib/react-qw/components/ListView.js +1 -0
- package/lib/react-qw/components/PathPicker.js +2 -2
- package/lib/react-qw/index.js +1 -1
- package/lib/react-qw/index.ts +4 -1
- package/lib/text-measure.js +3 -1
- package/lib/text-measure.ts +4 -3
- package/lib/websocket.js +32 -2
- package/lib/websocket.ts +25 -2
- package/lib/windows/advapi32.js +53 -0
- package/lib/windows/advapi32.ts +64 -0
- package/lib/windows/comctl32.js +15 -15
- package/lib/windows/comctl32.ts +15 -16
- package/lib/windows/comdlg32.js +3 -2
- package/lib/windows/comdlg32.ts +3 -2
- package/lib/windows/gdi32.js +328 -26
- package/lib/windows/gdi32.ts +349 -26
- package/lib/windows/kernel32.js +206 -10
- package/lib/windows/kernel32.ts +225 -10
- package/lib/windows/msimg32.js +38 -0
- package/lib/windows/msimg32.ts +45 -0
- package/lib/windows/ntdll.js +3 -2
- package/lib/windows/ntdll.ts +3 -2
- package/lib/windows/ole32.js +1 -1
- package/lib/windows/ole32.ts +1 -1
- package/lib/windows/psapi.js +32 -0
- package/lib/windows/psapi.ts +37 -0
- package/lib/windows/shell32.js +5 -3
- package/lib/windows/shell32.ts +5 -3
- package/lib/windows/structs.js +135 -0
- package/lib/windows/structs.ts +144 -0
- package/lib/windows/user32.js +202 -99
- package/lib/windows/user32.ts +204 -99
- package/lib/windows/version.js +29 -0
- package/lib/windows/version.ts +35 -0
- package/lib/windows/winspool.js +71 -0
- package/lib/windows/winspool.ts +80 -0
- package/package.json +1 -1
- package/quickwin.d.ts +11 -5
- package/quickwin_const.d.ts +136 -0
- 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/run.js +7 -0
- package/test/run.ts +7 -0
- package/test/test_basic_fetch.js +21 -0
- package/test/test_basic_fetch.ts +17 -0
- package/test/test_ffi.js +6 -6
- package/test/test_ffi.ts +6 -6
- package/test/test_ffi_abi.js +55 -0
- package/test/test_ffi_abi.ts +56 -0
- package/test/test_ffi_array.js +116 -0
- package/test/test_ffi_array.ts +141 -0
- package/test/test_ffi_bind.js +82 -0
- package/test/test_ffi_bind.ts +71 -0
- package/test/test_files.js +102 -0
- package/test/test_files.ts +121 -0
- package/test/test_gdi_draw.js +681 -0
- package/test/test_gdi_draw.ts +725 -0
- package/test/test_net_fetch.js +4 -3
- package/test/test_net_fetch.ts +4 -3
- package/test/test_printer.js +137 -0
- package/test/test_printer.ts +148 -0
- package/test/test_proc.js +141 -0
- package/test/test_proc.ts +163 -0
- package/test/test_react_complex.js +131 -27
- package/test/test_react_counter.js +131 -27
- package/test/test_react_flex.js +131 -27
- package/test/test_react_hidden.js +131 -27
- package/test/test_react_listview_link.js +131 -27
- package/test/test_react_notify.js +131 -27
- package/test/test_react_render.js +131 -27
- package/test/test_registry.js +74 -0
- package/test/test_registry.ts +95 -0
- package/test/test_sysinfo.js +122 -0
- package/test/test_sysinfo.ts +141 -0
- package/test/test_wolfssl_read.js +45 -44
- package/test/test_wolfssl_read.ts +42 -42
package/examples/exec_server.tsx
CHANGED
|
@@ -25,22 +25,21 @@ interface Cfg {
|
|
|
25
25
|
token: string | null
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// 参数经 scriptArgs 透传:C 层只消费 -e/-o/-d,遇到未知选项即停止
|
|
29
|
+
// 解析并把剩余全部交给脚本(见 main.c 参数解析段)。因此空格分隔
|
|
30
|
+
// ("--gui 0") 与等号 ("--gui=0") 两种形式都由本函数自行解析。
|
|
31
31
|
function parseArgs(): Cfg {
|
|
32
32
|
let gui = true
|
|
33
33
|
let token: string | null = null
|
|
34
34
|
const args = typeof scriptArgs === 'undefined' ? [] : scriptArgs
|
|
35
|
+
const normToken = (v: string) => (v === '' ? null : v) // 空串=未配置(放行)
|
|
35
36
|
for (let i = 0; i < args.length; i++) {
|
|
36
37
|
const a = args[i] ?? ''
|
|
37
38
|
if (a === '--nogui') { gui = false }
|
|
39
|
+
else if (a === '--gui') { gui = (args[++i] ?? '') !== '0' }
|
|
38
40
|
else if (a.startsWith('--gui=')) { gui = a.slice(6) !== '0' }
|
|
39
|
-
else if (a
|
|
40
|
-
|
|
41
|
-
const v = a.slice(8)
|
|
42
|
-
token = v === '' ? null : v
|
|
43
|
-
}
|
|
41
|
+
else if (a === '--token') { token = normToken(args[++i] ?? '') }
|
|
42
|
+
else if (a.startsWith('--token=')) { token = normToken(a.slice(8)) }
|
|
44
43
|
}
|
|
45
44
|
return { gui, token }
|
|
46
45
|
}
|
|
@@ -50,7 +50,7 @@ catch (ex) {
|
|
|
50
50
|
let IS_WIN11 = false;
|
|
51
51
|
try {
|
|
52
52
|
const vi = OSVERSIONINFO_148.encode({ dwOSVersionInfoSize: OSVERSIONINFO_148.size });
|
|
53
|
-
if (RtlGetVersion(vi) === 0) {
|
|
53
|
+
if (RtlGetVersion(vi.ptr) === 0) {
|
|
54
54
|
IS_WIN11 = OSVERSIONINFO_148.decode(vi).dwMajorVersion >= 10;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -60,7 +60,7 @@ try {
|
|
|
60
60
|
let IS_WIN11 = false
|
|
61
61
|
try {
|
|
62
62
|
const vi = OSVERSIONINFO_148.encode({ dwOSVersionInfoSize: OSVERSIONINFO_148.size })
|
|
63
|
-
if (RtlGetVersion(vi) === 0) {
|
|
63
|
+
if (RtlGetVersion(vi.ptr) === 0) {
|
|
64
64
|
IS_WIN11 = OSVERSIONINFO_148.decode(vi).dwMajorVersion >= 10
|
|
65
65
|
}
|
|
66
66
|
} catch (ex) {
|
|
@@ -165,7 +165,7 @@ function bmpHeader(size: number, w: number, h: number): Uint8Array {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// 取 hdc 当前选中位图的全部像素,按 BMP 分块发出。返回 GetDIBits 是否全量成功。
|
|
168
|
-
function emitDib(id: number, hdc: Ptr<'HDC'>, hbm:
|
|
168
|
+
function emitDib(id: number, hdc: Ptr<'HDC'>, hbm: Ptr<'HGDIOBJ'>, w: number, h: number): boolean {
|
|
169
169
|
const pxB = new PtrArrayBuffer(w * h * 4)
|
|
170
170
|
const px = new Uint8Array(pxB)
|
|
171
171
|
const bmi = BITMAPINFOHEADER.encode({
|
package/examples/pdf_preview2.js
CHANGED
|
@@ -144,7 +144,7 @@ function openPdfFileDialog() {
|
|
|
144
144
|
Flags: 0x1000 | 0x0800 | 0x0004,
|
|
145
145
|
});
|
|
146
146
|
ofn.__keep = [fileBuf, filterWide];
|
|
147
|
-
const ret = GetOpenFileName(ofn);
|
|
147
|
+
const ret = GetOpenFileName(ofn.ptr);
|
|
148
148
|
return ret ? WCHAR.decode(fileBuf) : null;
|
|
149
149
|
}
|
|
150
150
|
function updateScrollRange() {
|
package/examples/pdf_preview2.ts
CHANGED
|
@@ -105,7 +105,7 @@ function openPdfFileDialog(): string | null {
|
|
|
105
105
|
Flags: 0x1000 | 0x0800 | 0x0004,
|
|
106
106
|
})
|
|
107
107
|
ofn.__keep = [fileBuf, filterWide]
|
|
108
|
-
const ret = GetOpenFileName(ofn)
|
|
108
|
+
const ret = GetOpenFileName(ofn.ptr)
|
|
109
109
|
return ret ? WCHAR.decode(fileBuf) : null
|
|
110
110
|
}
|
|
111
111
|
|
package/examples/pdf_viewer.js
CHANGED
|
@@ -15373,10 +15373,18 @@ var C_BASIC_TYPE = [
|
|
|
15373
15373
|
"f64",
|
|
15374
15374
|
"ptr"
|
|
15375
15375
|
];
|
|
15376
|
-
var PTR_TOKEN_RE = /^<([
|
|
15376
|
+
var PTR_TOKEN_RE = /^<([A-Za-z_]\w*|)>ptr(!|@[A-Za-z_]\w*)?$/;
|
|
15377
15377
|
function isCPtrToken(t) {
|
|
15378
15378
|
return PTR_TOKEN_RE.test(t);
|
|
15379
15379
|
}
|
|
15380
|
+
var VAL_TOKEN_RE = /^<([A-Za-z_]\w*)>$/;
|
|
15381
|
+
function isCValToken(t) {
|
|
15382
|
+
return VAL_TOKEN_RE.test(t);
|
|
15383
|
+
}
|
|
15384
|
+
function valName(t) {
|
|
15385
|
+
const m = VAL_TOKEN_RE.exec(t);
|
|
15386
|
+
return m?.[1] || "";
|
|
15387
|
+
}
|
|
15380
15388
|
function ptrName(t) {
|
|
15381
15389
|
const m = PTR_TOKEN_RE.exec(t);
|
|
15382
15390
|
return m?.[1] || "";
|
|
@@ -15384,8 +15392,9 @@ function ptrName(t) {
|
|
|
15384
15392
|
var cTokenToType = (t) => {
|
|
15385
15393
|
if (isCPtrToken(t))
|
|
15386
15394
|
return "ptr";
|
|
15387
|
-
|
|
15388
|
-
|
|
15395
|
+
if (isCValToken(t))
|
|
15396
|
+
throw new Error(`ffi: cTokenToType: by-value token "${t}" has no scalar slot type`);
|
|
15397
|
+
return t;
|
|
15389
15398
|
};
|
|
15390
15399
|
var PTR_SIZE = os.arch === "x64" ? 8 : 4;
|
|
15391
15400
|
var SizeAlign = {
|
|
@@ -15404,8 +15413,12 @@ var NULL = 0;
|
|
|
15404
15413
|
function normToken(t) {
|
|
15405
15414
|
if (isCPtrToken(t)) {
|
|
15406
15415
|
const m = PTR_TOKEN_RE.exec(t);
|
|
15407
|
-
|
|
15416
|
+
const name = m?.[1] || "";
|
|
15417
|
+
const mod = m?.[2];
|
|
15418
|
+
return mod?.startsWith("@") ? `<${name}>ptr` : t;
|
|
15408
15419
|
}
|
|
15420
|
+
if (isCValToken(t))
|
|
15421
|
+
return t;
|
|
15409
15422
|
const at = t.indexOf("@");
|
|
15410
15423
|
const base = at >= 0 ? t.slice(0, at) : t;
|
|
15411
15424
|
const suffixOk = at < 0 || /^[A-Za-z_]\w*$/.test(t.slice(at + 1));
|
|
@@ -15732,6 +15745,9 @@ if (typeof globalThis.TextEncoder === "undefined") {
|
|
|
15732
15745
|
}
|
|
15733
15746
|
|
|
15734
15747
|
// _build/lib/ffi/bind.js
|
|
15748
|
+
function valCodec(name, encoders) {
|
|
15749
|
+
return encoders[name];
|
|
15750
|
+
}
|
|
15735
15751
|
var _dllCache = /* @__PURE__ */ new Map();
|
|
15736
15752
|
function loadDll(dll) {
|
|
15737
15753
|
const cached = _dllCache.get(dll);
|
|
@@ -15757,14 +15773,27 @@ function parseSig(sig) {
|
|
|
15757
15773
|
}
|
|
15758
15774
|
argTokens.push(tok);
|
|
15759
15775
|
}
|
|
15776
|
+
const retToken = normToken(parts[1]);
|
|
15777
|
+
if (isCValToken(retToken))
|
|
15778
|
+
throw new Error(`ffi-bind: "${sig}": by-value struct at the return position (<${valName(retToken)}>) is not supported \u2014 argument positions only; pass a struct out through an out-param slot instead (<N>ptr + caller buffer)`);
|
|
15760
15779
|
return {
|
|
15761
15780
|
argTokens,
|
|
15762
|
-
retToken
|
|
15781
|
+
retToken,
|
|
15763
15782
|
sig
|
|
15764
15783
|
};
|
|
15765
15784
|
}
|
|
15766
15785
|
function makeFn(proc, sig, encoders, decoders) {
|
|
15767
15786
|
const ps = parseSig(sig);
|
|
15787
|
+
for (const t of ps.argTokens) {
|
|
15788
|
+
if (!isCValToken(t))
|
|
15789
|
+
continue;
|
|
15790
|
+
const name = valName(t);
|
|
15791
|
+
const codec = valCodec(name, encoders);
|
|
15792
|
+
if (!codec || typeof codec.encode !== "function")
|
|
15793
|
+
throw new Error(`ffi-bind: ${sig}: by-value position <${name}> has no registered layout (available: ${Object.keys(encoders).join(", ") || "none"})`);
|
|
15794
|
+
if (typeof codec.size !== "number" || codec.size < 1)
|
|
15795
|
+
throw new Error(`ffi-bind: ${sig}: by-value position <${name}> requires a struct layout with size >= 1 (got ${codec.size}; non-struct codecs expose no size)`);
|
|
15796
|
+
}
|
|
15768
15797
|
return (...a) => callPacked(proc, ps, a, encoders, decoders);
|
|
15769
15798
|
}
|
|
15770
15799
|
var IA32_ARG_SIZE = {
|
|
@@ -15784,15 +15813,29 @@ var X64_MIN_SLOTS = 4;
|
|
|
15784
15813
|
function callPacked(proc, { argTokens, retToken, sig }, args, encoders, decoders) {
|
|
15785
15814
|
const is64 = os2.arch === "x64";
|
|
15786
15815
|
const getWidth = (t, is642) => {
|
|
15816
|
+
if (isCValToken(t))
|
|
15817
|
+
throw new Error(`ffi-bind: getWidth: by-value token "${t}" (dispatched by widthOf)`);
|
|
15787
15818
|
if (is642)
|
|
15788
15819
|
return 8;
|
|
15789
15820
|
if (isCPtrToken(t))
|
|
15790
15821
|
return PTR_SIZE;
|
|
15791
15822
|
return IA32_ARG_SIZE[t];
|
|
15792
15823
|
};
|
|
15824
|
+
const widthOf = (t) => {
|
|
15825
|
+
if (isCValToken(t)) {
|
|
15826
|
+
if (is64)
|
|
15827
|
+
return 8;
|
|
15828
|
+
const layout = valCodec(valName(t), encoders);
|
|
15829
|
+
if (!layout)
|
|
15830
|
+
throw new Error(`ffi-bind: <${valName(t)}> by-value position has no registered layout`);
|
|
15831
|
+
const size = layout.size;
|
|
15832
|
+
return size % 4 === 0 ? size : size + 4 - size % 4;
|
|
15833
|
+
}
|
|
15834
|
+
return getWidth(t, is64);
|
|
15835
|
+
};
|
|
15793
15836
|
let total = 0;
|
|
15794
15837
|
for (const t of argTokens)
|
|
15795
|
-
total +=
|
|
15838
|
+
total += widthOf(t);
|
|
15796
15839
|
if (is64 && argTokens.length < X64_MIN_SLOTS)
|
|
15797
15840
|
total = X64_MIN_SLOTS * 8;
|
|
15798
15841
|
const argFrame = new ArrayBuffer(total);
|
|
@@ -15829,10 +15872,28 @@ function callPacked(proc, { argTokens, retToken, sig }, args, encoders, decoders
|
|
|
15829
15872
|
throw new Error(`ffi-bind: ${sig}: arg#${i + 1} <${name}>ptr! encode produced 0 (null pointer forbidden here)`);
|
|
15830
15873
|
writeSlot(dv, off, { k: "ptr", v: p });
|
|
15831
15874
|
}
|
|
15875
|
+
} else if (isCValToken(argToken)) {
|
|
15876
|
+
const name = valName(argToken);
|
|
15877
|
+
const codec = valCodec(name, encoders);
|
|
15878
|
+
if (!codec)
|
|
15879
|
+
throw new Error(`ffi-bind: ${sig}: arg#${i + 1} <${name}> by-value position has no registered layout`);
|
|
15880
|
+
if (arg === null || arg === void 0)
|
|
15881
|
+
throw new Error(`ffi-bind: <${name}> value position got ${String(arg)}; pass a struct object (use <${name}>ptr to pass a pointer)`);
|
|
15882
|
+
const size = codec.size;
|
|
15883
|
+
if (!is64 || size <= 8 && (size & size - 1) === 0) {
|
|
15884
|
+
codec.encode(arg, argFrame, off);
|
|
15885
|
+
} else {
|
|
15886
|
+
const buf = new ArrayBuffer(size + 15);
|
|
15887
|
+
const base = ffi.bufferPtr(buf);
|
|
15888
|
+
const pad = (16 - base % 16) % 16;
|
|
15889
|
+
codec.encode(arg, buf, pad);
|
|
15890
|
+
held.push(buf);
|
|
15891
|
+
writeSlot(dv, off, { k: "ptr", v: base + pad });
|
|
15892
|
+
}
|
|
15832
15893
|
} else {
|
|
15833
15894
|
writeSlot(dv, off, { k: argToken, v: arg });
|
|
15834
15895
|
}
|
|
15835
|
-
off +=
|
|
15896
|
+
off += widthOf(argToken);
|
|
15836
15897
|
}
|
|
15837
15898
|
const retBuf = new ArrayBuffer(8);
|
|
15838
15899
|
const retIsFp = retToken === "f32" || retToken === "f64";
|
|
@@ -16223,21 +16284,20 @@ function createStruct(t) {
|
|
|
16223
16284
|
size,
|
|
16224
16285
|
structAlign: maxEffectiveAlign,
|
|
16225
16286
|
decode: (p) => {
|
|
16226
|
-
if (typeof p === "number")
|
|
16227
|
-
|
|
16228
|
-
const u8 = new Uint8Array(buf);
|
|
16229
|
-
for (let i = 0; i < size; i++)
|
|
16230
|
-
u8[i] = ffi2.readByte(p + i);
|
|
16231
|
-
return doDecode(new DataView(buf), 0, fields);
|
|
16232
|
-
}
|
|
16287
|
+
if (typeof p === "number")
|
|
16288
|
+
return doDecode(new DataView(ffi2.readBytes(p, size)), 0, fields);
|
|
16233
16289
|
return doDecode(new DataView(p), 0, fields);
|
|
16234
16290
|
},
|
|
16235
|
-
alloc: (() =>
|
|
16236
|
-
|
|
16291
|
+
alloc: ((n) => {
|
|
16292
|
+
if (n !== void 0 && (!Number.isInteger(n) || n < 1))
|
|
16293
|
+
throw new Error(`ffi-struct: alloc(n) requires an integer n >= 1 (PAB(0) never escapes \u2014 pass NULL for an empty pointer position)`);
|
|
16294
|
+
return new PtrArrayBuffer(size * (n ?? 1));
|
|
16295
|
+
}),
|
|
16296
|
+
encode: ((v, buf, offset) => {
|
|
16237
16297
|
if (v === void 0 || v === null)
|
|
16238
16298
|
throw new Error(`ffi-struct: encode(v) requires an argument; use alloc() for a zeroed out-param slot`);
|
|
16239
16299
|
const out = buf ?? new PtrArrayBuffer(size);
|
|
16240
|
-
doEncode(new DataView(out), 0, fields, v);
|
|
16300
|
+
doEncode(new DataView(out), offset ?? 0, fields, v);
|
|
16241
16301
|
return out;
|
|
16242
16302
|
}),
|
|
16243
16303
|
offsetOf: (name) => {
|
|
@@ -16257,6 +16317,49 @@ function buildDecl(kind, member, pack) {
|
|
|
16257
16317
|
decl[k] = v;
|
|
16258
16318
|
return decl;
|
|
16259
16319
|
}
|
|
16320
|
+
function structArray(def) {
|
|
16321
|
+
const { fields, size } = computeStructLayout(def.__struct);
|
|
16322
|
+
const readN = (dv, n) => {
|
|
16323
|
+
const out = [];
|
|
16324
|
+
for (let i = 0; i < n; i++)
|
|
16325
|
+
out.push(doDecode(dv, i * size, fields));
|
|
16326
|
+
return out;
|
|
16327
|
+
};
|
|
16328
|
+
return {
|
|
16329
|
+
encode: (els) => {
|
|
16330
|
+
if (!Array.isArray(els) || els.length === 0)
|
|
16331
|
+
throw new Error(`ffi-struct: structArray(def).encode(els) requires a non-empty element array (pass NULL for an empty pointer position)`);
|
|
16332
|
+
const out = def.alloc(els.length);
|
|
16333
|
+
for (let i = 0; i < els.length; i++)
|
|
16334
|
+
def.encode(els[i], out, i * def.size);
|
|
16335
|
+
return out;
|
|
16336
|
+
},
|
|
16337
|
+
decode: ((p, count) => {
|
|
16338
|
+
if (count !== void 0 && (!Number.isInteger(count) || count < 0))
|
|
16339
|
+
throw new Error(`ffi-struct: structArray.decode(p, count) requires a non-negative integer count, got ${count}`);
|
|
16340
|
+
if (typeof p === "number") {
|
|
16341
|
+
if (count === void 0)
|
|
16342
|
+
throw new Error(`ffi-struct: structArray.decode(address, count) requires an explicit count (a bare address carries no length)`);
|
|
16343
|
+
if (count === 0)
|
|
16344
|
+
return [];
|
|
16345
|
+
return readN(new DataView(ffi2.readBytes(p, count * size)), count);
|
|
16346
|
+
}
|
|
16347
|
+
let n;
|
|
16348
|
+
if (count !== void 0) {
|
|
16349
|
+
n = count;
|
|
16350
|
+
if (n * size > p.byteLength)
|
|
16351
|
+
throw new Error(`ffi-struct: structArray.decode: count ${n} \xD7 size ${size} = ${n * size} exceeds buffer byteLength ${p.byteLength}`);
|
|
16352
|
+
} else {
|
|
16353
|
+
if (p.byteLength % size !== 0)
|
|
16354
|
+
throw new Error(`ffi-struct: structArray.decode: byteLength ${p.byteLength} is not a multiple of size ${size} (mixed buffer? pass count explicitly)`);
|
|
16355
|
+
n = p.byteLength / size;
|
|
16356
|
+
}
|
|
16357
|
+
if (n === 0)
|
|
16358
|
+
return [];
|
|
16359
|
+
return readN(new DataView(p), n);
|
|
16360
|
+
})
|
|
16361
|
+
};
|
|
16362
|
+
}
|
|
16260
16363
|
function struct(a, b6, c) {
|
|
16261
16364
|
const isNamed = typeof a === "string";
|
|
16262
16365
|
const raw = isNamed ? b6 : a;
|
|
@@ -16519,11 +16622,12 @@ import * as os4 from "os";
|
|
|
16519
16622
|
|
|
16520
16623
|
// _build/lib/windows/gdi32.js
|
|
16521
16624
|
var b2 = (name, sig, encoders) => bind("gdi32.dll", name, sig, encoders);
|
|
16522
|
-
var
|
|
16625
|
+
var POINTArr = structArray(POINT);
|
|
16626
|
+
var DeleteObject = /* @__PURE__ */ b2("DeleteObject", "<HGDIOBJ>ptr -> i32");
|
|
16523
16627
|
var GetDeviceCaps = /* @__PURE__ */ b2("GetDeviceCaps", "<HDC>ptr! i32@DeviceCap -> i32");
|
|
16524
|
-
var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr ->
|
|
16525
|
-
var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr!
|
|
16526
|
-
var GetObject = /* @__PURE__ */ b2("GetObjectW", "
|
|
16628
|
+
var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr -> <HGDIOBJ>ptr", { LOGFONTW });
|
|
16629
|
+
var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr! <HGDIOBJ>ptr -> <HGDIOBJ>ptr");
|
|
16630
|
+
var GetObject = /* @__PURE__ */ b2("GetObjectW", "<HGDIOBJ>ptr i32 <BYTE>ptr -> i32");
|
|
16527
16631
|
var SetDIBitsToDevice = /* @__PURE__ */ b2("SetDIBitsToDevice", "<HDC>ptr! i32 i32 u32 u32 i32 i32 u32 u32 <BYTE>ptr <BYTE>ptr u32 -> i32");
|
|
16528
16632
|
|
|
16529
16633
|
// _build/lib/react-qw/props.js
|
|
@@ -16671,7 +16775,7 @@ function measureTextForHwnd(hwnd, text) {
|
|
|
16671
16775
|
if (!hdc)
|
|
16672
16776
|
return { width: 0, height: 0 };
|
|
16673
16777
|
const hFont = gui2.SendMessage(hwnd, 49, 0, 0);
|
|
16674
|
-
const oldFont = hFont ? SelectObject(hdc, hFont) :
|
|
16778
|
+
const oldFont = hFont ? SelectObject(hdc, hFont) : NULL;
|
|
16675
16779
|
const result = measureText(hdc, text, 0);
|
|
16676
16780
|
if (hFont)
|
|
16677
16781
|
SelectObject(hdc, oldFont);
|
|
@@ -18056,11 +18160,11 @@ var import_react17 = __toESM(require_react(), 1);
|
|
|
18056
18160
|
|
|
18057
18161
|
// _build/lib/windows/comdlg32.js
|
|
18058
18162
|
var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
|
|
18059
|
-
var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<
|
|
18163
|
+
var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
|
|
18060
18164
|
|
|
18061
18165
|
// _build/lib/windows/shell32.js
|
|
18062
18166
|
var b4 = (name, sig) => bind("shell32.dll", name, sig);
|
|
18063
|
-
var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<
|
|
18167
|
+
var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
|
|
18064
18168
|
var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
|
|
18065
18169
|
|
|
18066
18170
|
// _build/lib/windows/ole32.js
|
|
@@ -18085,7 +18189,7 @@ function openFileDialog(owner, filter, title, multiple) {
|
|
|
18085
18189
|
lpstrTitle: titleWide?.ptr ?? 0,
|
|
18086
18190
|
Flags: flags
|
|
18087
18191
|
});
|
|
18088
|
-
const ret = GetOpenFileName(ofn);
|
|
18192
|
+
const ret = GetOpenFileName(ofn.ptr);
|
|
18089
18193
|
if (!ret)
|
|
18090
18194
|
return null;
|
|
18091
18195
|
if (!multiple) {
|
|
@@ -18103,7 +18207,7 @@ function openFolderDialog(owner, title) {
|
|
|
18103
18207
|
lpszTitle: titleWide?.ptr ?? 0,
|
|
18104
18208
|
ulFlags: 65
|
|
18105
18209
|
});
|
|
18106
|
-
const pidl = SHBrowseForFolder(bi);
|
|
18210
|
+
const pidl = SHBrowseForFolder(bi.ptr);
|
|
18107
18211
|
if (!pidl)
|
|
18108
18212
|
return null;
|
|
18109
18213
|
const pathBuf = WCHAR.alloc(260);
|
|
@@ -18198,7 +18302,7 @@ function createRoot(container) {
|
|
|
18198
18302
|
} else {
|
|
18199
18303
|
hwnd = container;
|
|
18200
18304
|
}
|
|
18201
|
-
const root = reconciler_default.createContainer(hwnd, 0, null, false, null, "",
|
|
18305
|
+
const root = reconciler_default.createContainer(hwnd, 0, null, false, null, "", (error, info) => console.log("[React uncaught]", error, error.stack, info.componentStack), (error, info) => console.log("[React caught]", error, error.stack, info.componentStack), (error, info) => console.log("[React recoverable]", error, error.stack, info.componentStack), noop);
|
|
18202
18306
|
const rootInst = { hwnd, type: "_root", props: { type: "_root", style: { flexDirection: "column", alignItems: "stretch" } }, children: [] };
|
|
18203
18307
|
instancesByHwnd.set(hwnd, rootInst);
|
|
18204
18308
|
if (typeof container === "object")
|
|
@@ -18270,7 +18374,7 @@ function openPdfFileDialog(owner) {
|
|
|
18270
18374
|
Flags: 4096 | 2048 | 4
|
|
18271
18375
|
});
|
|
18272
18376
|
ofn.__keep = [fileBuf, filterWide];
|
|
18273
|
-
const ret = GetOpenFileName(ofn);
|
|
18377
|
+
const ret = GetOpenFileName(ofn.ptr);
|
|
18274
18378
|
if (!ret)
|
|
18275
18379
|
return null;
|
|
18276
18380
|
const path = WCHAR.decode(fileBuf);
|
package/examples/pdf_viewer.tsx
CHANGED