koffi 2.12.1 → 2.12.2
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/CHANGELOG.md +11 -0
- package/LICENSE.txt +2 -2
- package/README.md +8 -8
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_armhf/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_loong64/koffi.node +0 -0
- package/build/koffi/linux_riscv64d/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/musl_arm64/koffi.node +0 -0
- package/build/koffi/musl_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.exp +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.exp +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.exp +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/doc/assets.ini +3 -3
- package/doc/develop.sh +4 -3
- package/doc/pages/platforms.md +1 -1
- package/doc/static/highlight.js +1 -1
- package/doc/static/koffi.css +3 -2
- package/doc/static/print.css +1 -1
- package/doc/templates/code.html +5 -5
- package/doc/templates/page.html +4 -4
- package/index.d.ts +2 -2
- package/index.js +32 -32
- package/indirect.js +32 -12
- package/package.json +2 -2
- package/src/cnoke/LICENSE.txt +2 -2
- package/src/cnoke/README.md +2 -0
- package/src/cnoke/assets/FindCNoke.cmake +12 -2
- package/src/cnoke/assets/win_delay_hook.c +4 -4
- package/src/cnoke/cnoke.js +4 -2
- package/src/cnoke/package.json +1 -1
- package/src/cnoke/src/builder.js +11 -14
- package/src/cnoke/src/index.js +2 -2
- package/src/cnoke/src/tools.js +34 -2
- package/src/core/{libcc/libcc.cc → base/base.cc} +3092 -1674
- package/src/core/{libcc/libcc.hh → base/base.hh} +3059 -2432
- package/src/core/{libcc → base}/mimetypes.inc +42 -4
- package/src/core/{libcc → base}/mimetypes_gen.py +3 -3
- package/src/core/unicode/generate.py +124 -0
- package/src/core/unicode/xid.cc +52 -0
- package/src/core/unicode/xid.hh +29 -0
- package/src/core/unicode/xid.inc +465 -0
- package/src/koffi/CMakeLists.txt +8 -5
- package/src/koffi/cmake/raylib.cmake +6 -2
- package/src/koffi/cmake/{sqlite.cmake → sqlite3.cmake} +3 -3
- package/src/koffi/examples/electron-forge/forge.config.js +23 -3
- package/src/koffi/examples/electron-forge/package.json +18 -16
- package/src/koffi/src/abi_arm32.cc +7 -7
- package/src/koffi/src/abi_arm32_asm.S +2 -2
- package/src/koffi/src/abi_arm64.cc +45 -45
- package/src/koffi/src/abi_arm64_asm.S +4 -4
- package/src/koffi/src/abi_arm64_asm.asm +2 -2
- package/src/koffi/src/abi_loong64_asm.S +2 -2
- package/src/koffi/src/abi_riscv64.cc +5 -5
- package/src/koffi/src/abi_riscv64_asm.S +2 -2
- package/src/koffi/src/abi_x64_sysv.cc +3 -3
- package/src/koffi/src/abi_x64_sysv_asm.S +5 -5
- package/src/koffi/src/abi_x64_win.cc +3 -3
- package/src/koffi/src/abi_x64_win_asm.asm +2 -2
- package/src/koffi/src/abi_x86.cc +8 -8
- package/src/koffi/src/abi_x86_asm.S +2 -2
- package/src/koffi/src/abi_x86_asm.asm +2 -2
- package/src/koffi/src/call.cc +12 -12
- package/src/koffi/src/call.hh +8 -8
- package/src/koffi/src/errno.inc +152 -152
- package/src/koffi/src/ffi.cc +45 -39
- package/src/koffi/src/ffi.hh +6 -6
- package/src/koffi/src/init.js +1 -1
- package/src/koffi/src/parser.cc +6 -5
- package/src/koffi/src/parser.hh +3 -3
- package/src/koffi/src/trampolines/armasm.inc +2 -2
- package/src/koffi/src/trampolines/gnu.inc +2 -2
- package/src/koffi/src/trampolines/masm32.inc +2 -2
- package/src/koffi/src/trampolines/masm64.inc +2 -2
- package/src/koffi/src/trampolines/prototypes.inc +2 -2
- package/src/koffi/src/util.cc +9 -9
- package/src/koffi/src/util.hh +3 -3
- package/src/koffi/src/win32.cc +5 -5
- package/src/koffi/src/win32.hh +9 -9
- package/vendor/node-addon-api/CHANGELOG.md +97 -2
- package/vendor/node-addon-api/CONTRIBUTING.md +117 -7
- package/vendor/node-addon-api/README.md +25 -249
- package/vendor/node-addon-api/common.gypi +1 -0
- package/vendor/node-addon-api/doc/README.md +145 -0
- package/vendor/node-addon-api/doc/array_buffer.md +15 -15
- package/vendor/node-addon-api/doc/basic_env.md +200 -0
- package/vendor/node-addon-api/doc/buffer.md +24 -26
- package/vendor/node-addon-api/doc/cmake-js.md +19 -0
- package/vendor/node-addon-api/doc/{creating_a_release.md → contributing/creating_a_release.md} +16 -4
- package/vendor/node-addon-api/doc/env.md +11 -131
- package/vendor/node-addon-api/doc/error_handling.md +12 -0
- package/vendor/node-addon-api/doc/external.md +13 -4
- package/vendor/node-addon-api/doc/finalization.md +153 -0
- package/vendor/node-addon-api/doc/memory_management.md +1 -1
- package/vendor/node-addon-api/doc/object_wrap.md +19 -3
- package/vendor/node-addon-api/doc/promises.md +51 -0
- package/vendor/node-addon-api/doc/setup.md +29 -6
- package/vendor/node-addon-api/doc/value.md +13 -0
- package/vendor/node-addon-api/doc/version_management.md +2 -2
- package/vendor/node-addon-api/eslint.config.js +5 -0
- package/vendor/node-addon-api/index.js +2 -0
- package/vendor/node-addon-api/napi-inl.h +592 -166
- package/vendor/node-addon-api/napi.h +167 -59
- package/vendor/node-addon-api/node_addon_api.gyp +10 -0
- package/vendor/node-addon-api/noexcept.gypi +1 -1
- package/vendor/node-addon-api/package.json +10 -13
- package/vendor/node-addon-api/release-please-config.json +15 -0
- package/vendor/node-addon-api/test/addon_build/tpl/binding.gyp +2 -1
- package/vendor/node-addon-api/test/array_buffer.js +1 -1
- package/vendor/node-addon-api/test/async_context.js +2 -2
- package/vendor/node-addon-api/test/async_progress_queue_worker.js +3 -3
- package/vendor/node-addon-api/test/async_progress_worker.js +3 -3
- package/vendor/node-addon-api/test/async_worker.cc +15 -13
- package/vendor/node-addon-api/test/async_worker.js +5 -5
- package/vendor/node-addon-api/test/basic_types/value.cc +6 -0
- package/vendor/node-addon-api/test/basic_types/value.js +17 -0
- package/vendor/node-addon-api/test/binding.cc +8 -0
- package/vendor/node-addon-api/test/binding.gyp +23 -1
- package/vendor/node-addon-api/test/buffer.js +1 -2
- package/vendor/node-addon-api/test/common/index.js +1 -1
- package/vendor/node-addon-api/test/except_all.cc +22 -0
- package/vendor/node-addon-api/test/except_all.js +14 -0
- package/vendor/node-addon-api/test/exports.js +19 -0
- package/vendor/node-addon-api/test/finalizer_order.cc +152 -0
- package/vendor/node-addon-api/test/finalizer_order.js +98 -0
- package/vendor/node-addon-api/test/function.js +2 -2
- package/vendor/node-addon-api/test/function_reference.js +2 -2
- package/vendor/node-addon-api/test/globalObject/global_object_delete_property.cc +4 -4
- package/vendor/node-addon-api/test/globalObject/global_object_get_property.cc +4 -4
- package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.cc +3 -3
- package/vendor/node-addon-api/test/globalObject/global_object_set_property.cc +5 -5
- package/vendor/node-addon-api/test/name.cc +10 -8
- package/vendor/node-addon-api/test/object/delete_property.cc +5 -5
- package/vendor/node-addon-api/test/object/get_property.cc +5 -5
- package/vendor/node-addon-api/test/object/has_own_property.cc +4 -4
- package/vendor/node-addon-api/test/object/has_property.cc +5 -5
- package/vendor/node-addon-api/test/object/object.cc +1 -1
- package/vendor/node-addon-api/test/object/set_property.cc +5 -5
- package/vendor/node-addon-api/test/object/subscript_operator.cc +3 -3
- package/vendor/node-addon-api/test/object_reference.cc +18 -18
- package/vendor/node-addon-api/test/promise.cc +75 -0
- package/vendor/node-addon-api/test/promise.js +23 -0
- package/vendor/node-addon-api/test/require_basic_finalizers/index.js +38 -0
- package/vendor/node-addon-api/test/require_basic_finalizers/tpl/addon.cc +12 -0
- package/vendor/node-addon-api/test/require_basic_finalizers/tpl/binding.gyp +48 -0
- package/vendor/node-addon-api/test/require_basic_finalizers/tpl/index.js +3 -0
- package/vendor/node-addon-api/test/require_basic_finalizers/tpl/package.json +11 -0
- package/vendor/node-addon-api/test/run_script.cc +1 -1
- package/vendor/node-addon-api/test/type_taggable.cc +1 -1
- package/vendor/node-addon-api/test/type_taggable.js +3 -4
- package/vendor/node-addon-api/test/typedarray.cc +28 -24
- package/vendor/node-addon-api/tools/conversion.js +1 -1
- package/vendor/node-api-headers/CHANGELOG.md +29 -0
- package/vendor/node-api-headers/CREATING_A_RELEASE.md +12 -2
- package/vendor/node-api-headers/def/js_native_api.def +6 -1
- package/vendor/node-api-headers/def/node_api.def +7 -1
- package/vendor/node-api-headers/include/js_native_api.h +56 -24
- package/vendor/node-api-headers/include/js_native_api_types.h +27 -0
- package/vendor/node-api-headers/include/node_api.h +38 -29
- package/vendor/node-api-headers/lib/parse-utils.js +92 -0
- package/vendor/node-api-headers/package.json +7 -7
- package/vendor/node-api-headers/release-please-config.json +12 -0
- package/vendor/node-api-headers/scripts/update-headers.js +63 -12
- package/vendor/node-api-headers/scripts/write-symbols.js +1 -1
- package/vendor/node-api-headers/symbols.js +17 -1
- package/vendor/node-api-headers/test/parse-utils.js +21 -0
- package/doc/flat/flat.css +0 -27
- package/doc/flat/normal.css +0 -429
- package/doc/flat/print.css +0 -29
- package/doc/flat/reset.css +0 -41
- package/doc/flat/small.css +0 -104
- package/doc/flat/static.js +0 -161
- package/src/core/libcc/brotli.cc +0 -186
- package/src/core/libcc/lz4.cc +0 -197
- package/src/core/libcc/miniz.cc +0 -353
- package/vendor/node-addon-api/tools/eslint-format.js +0 -79
- /package/vendor/node-api-headers/{scripts → lib}/clang-utils.js +0 -0
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -19,21 +19,22 @@
|
|
|
19
19
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
20
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
21
21
|
|
|
22
|
-
#include "src/core/
|
|
22
|
+
#include "src/core/base/base.hh"
|
|
23
|
+
#include "src/core/unicode/xid.hh"
|
|
23
24
|
#include "ffi.hh"
|
|
24
25
|
#include "call.hh"
|
|
25
26
|
#include "parser.hh"
|
|
26
27
|
#include "util.hh"
|
|
27
|
-
#
|
|
28
|
+
#if defined(_WIN32)
|
|
28
29
|
#include "win32.hh"
|
|
29
30
|
#endif
|
|
30
31
|
#include "errno.inc"
|
|
31
32
|
|
|
32
|
-
#
|
|
33
|
-
#
|
|
33
|
+
#if defined(_WIN32)
|
|
34
|
+
#if !defined(NOMINMAX)
|
|
34
35
|
#define NOMINMAX
|
|
35
36
|
#endif
|
|
36
|
-
#
|
|
37
|
+
#if !defined(WIN32_LEAN_AND_MEAN)
|
|
37
38
|
#define WIN32_LEAN_AND_MEAN
|
|
38
39
|
#endif
|
|
39
40
|
#include <windows.h>
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
#include <dlfcn.h>
|
|
43
44
|
#include <unistd.h>
|
|
44
45
|
#include <sys/mman.h>
|
|
45
|
-
#
|
|
46
|
+
#if !defined(MAP_STACK)
|
|
46
47
|
#define MAP_STACK 0
|
|
47
48
|
#endif
|
|
48
49
|
#endif
|
|
@@ -54,7 +55,7 @@ namespace RG {
|
|
|
54
55
|
|
|
55
56
|
SharedData shared;
|
|
56
57
|
|
|
57
|
-
static
|
|
58
|
+
static thread_local CallData *exec_call;
|
|
58
59
|
|
|
59
60
|
static bool ChangeSize(const char *name, Napi::Value value, Size min_size, Size max_size, Size *out_size)
|
|
60
61
|
{
|
|
@@ -201,14 +202,13 @@ static inline bool CheckAlignment(int64_t align)
|
|
|
201
202
|
return valid;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
// Prevent simple mistakes but don't be too strict, the world is bigger than the US!
|
|
205
205
|
static bool IsNameValid(const char *name)
|
|
206
206
|
{
|
|
207
|
-
if (!
|
|
207
|
+
if (!IsXidStart(name[0]))
|
|
208
208
|
return false;
|
|
209
209
|
|
|
210
210
|
for (Size i = 1; name[i]; i++) {
|
|
211
|
-
if (
|
|
211
|
+
if (!IsXidContinue(name[i])) [[unlikely]]
|
|
212
212
|
return false;
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -259,10 +259,10 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
259
259
|
Napi::Object obj = info[named].As<Napi::Object>();
|
|
260
260
|
Napi::Array keys = GetOwnPropertyNames(obj);
|
|
261
261
|
|
|
262
|
-
RG_DEFER_NC(err_guard,
|
|
263
|
-
Size start =
|
|
262
|
+
RG_DEFER_NC(err_guard, count = instance->types.count) {
|
|
263
|
+
Size start = count + !named;
|
|
264
264
|
|
|
265
|
-
for (Size i = start; i < instance->types.
|
|
265
|
+
for (Size i = start; i < instance->types.count; i++) {
|
|
266
266
|
const TypeInfo *it = &instance->types[i];
|
|
267
267
|
const TypeInfo **ptr = instance->types_map.Find(it->name);
|
|
268
268
|
|
|
@@ -271,7 +271,7 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
instance->types.RemoveFrom(
|
|
274
|
+
instance->types.RemoveFrom(count);
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
TypeInfo *type = instance->types.AppendDefault();
|
|
@@ -294,7 +294,7 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
294
294
|
if (!MapType(env, instance, type, type->name))
|
|
295
295
|
return env.Null();
|
|
296
296
|
} else {
|
|
297
|
-
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
297
|
+
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
type->primitive = PrimitiveKind::Record;
|
|
@@ -353,6 +353,9 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
353
353
|
return env.Null();
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
if (TestStr(member.name, "_"))
|
|
357
|
+
continue;
|
|
358
|
+
|
|
356
359
|
if (!IsNameValid(member.name)) {
|
|
357
360
|
ThrowError<Napi::Error>(env, "Invalid member name '%1'", member.name);
|
|
358
361
|
return env.Null();
|
|
@@ -423,10 +426,10 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
423
426
|
Napi::Object obj = info[named].As<Napi::Object>();
|
|
424
427
|
Napi::Array keys = GetOwnPropertyNames(obj);
|
|
425
428
|
|
|
426
|
-
RG_DEFER_NC(err_guard,
|
|
427
|
-
Size start =
|
|
429
|
+
RG_DEFER_NC(err_guard, count = instance->types.count) {
|
|
430
|
+
Size start = count + !named;
|
|
428
431
|
|
|
429
|
-
for (Size i = start; i < instance->types.
|
|
432
|
+
for (Size i = start; i < instance->types.count; i++) {
|
|
430
433
|
const TypeInfo *it = &instance->types[i];
|
|
431
434
|
const TypeInfo **ptr = instance->types_map.Find(it->name);
|
|
432
435
|
|
|
@@ -435,7 +438,7 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
435
438
|
}
|
|
436
439
|
}
|
|
437
440
|
|
|
438
|
-
instance->types.RemoveFrom(
|
|
441
|
+
instance->types.RemoveFrom(count);
|
|
439
442
|
};
|
|
440
443
|
|
|
441
444
|
TypeInfo *type = instance->types.AppendDefault();
|
|
@@ -458,7 +461,7 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
458
461
|
if (!MapType(env, instance, type, type->name))
|
|
459
462
|
return env.Null();
|
|
460
463
|
} else {
|
|
461
|
-
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
464
|
+
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
462
465
|
}
|
|
463
466
|
|
|
464
467
|
type->primitive = PrimitiveKind::Union;
|
|
@@ -508,6 +511,9 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
508
511
|
size = std::max(size, member.type->size);
|
|
509
512
|
type->align = std::max(type->align, align);
|
|
510
513
|
|
|
514
|
+
if (TestStr(member.name, "_"))
|
|
515
|
+
continue;
|
|
516
|
+
|
|
511
517
|
if (!IsNameValid(member.name)) {
|
|
512
518
|
ThrowError<Napi::Error>(env, "Invalid member name '%1'", member.name);
|
|
513
519
|
return env.Null();
|
|
@@ -592,7 +598,7 @@ static Napi::Value CreateOpaqueType(const Napi::CallbackInfo &info)
|
|
|
592
598
|
RG_DEFER_N(err_guard) { instance->types.RemoveLast(1); };
|
|
593
599
|
|
|
594
600
|
type->name = named ? DuplicateString(name.Utf8Value().c_str(), &instance->str_alloc).ptr
|
|
595
|
-
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
601
|
+
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
596
602
|
|
|
597
603
|
type->primitive = PrimitiveKind::Void;
|
|
598
604
|
type->size = 0;
|
|
@@ -788,7 +794,7 @@ static Napi::Value CreateDisposableType(const Napi::CallbackInfo &info)
|
|
|
788
794
|
type->members.allocator = GetNullAllocator();
|
|
789
795
|
|
|
790
796
|
type->name = named ? DuplicateString(name.Utf8Value().c_str(), &instance->str_alloc).ptr
|
|
791
|
-
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
797
|
+
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
792
798
|
|
|
793
799
|
type->dispose = dispose;
|
|
794
800
|
type->dispose_ref = Napi::Persistent(dispose_func);
|
|
@@ -1005,7 +1011,7 @@ static bool ParseClassicFunction(const Napi::CallbackInfo &info, FunctionInfo *o
|
|
|
1005
1011
|
parameters = info[3u].As<Napi::Array>();
|
|
1006
1012
|
}
|
|
1007
1013
|
|
|
1008
|
-
#
|
|
1014
|
+
#if defined(_WIN32)
|
|
1009
1015
|
if (name.IsNumber()) {
|
|
1010
1016
|
out_func->ordinal_name = name.As<Napi::Number>().Int32Value();
|
|
1011
1017
|
name = name.ToString();
|
|
@@ -1356,7 +1362,7 @@ static InstanceMemory *AllocateMemory(InstanceData *instance, Size stack_size, S
|
|
|
1356
1362
|
RG_CRITICAL(mem->stack.ptr, "Failed to allocate %1 of memory", mem->stack.len);
|
|
1357
1363
|
#endif
|
|
1358
1364
|
|
|
1359
|
-
#
|
|
1365
|
+
#if defined(__OpenBSD__)
|
|
1360
1366
|
// Make sure the SP points inside the MAP_STACK area, or (void) functions may crash on OpenBSD i386
|
|
1361
1367
|
mem->stack.len -= 16;
|
|
1362
1368
|
#endif
|
|
@@ -1365,7 +1371,7 @@ static InstanceMemory *AllocateMemory(InstanceData *instance, Size stack_size, S
|
|
|
1365
1371
|
mem->stack0 = mem->stack;
|
|
1366
1372
|
|
|
1367
1373
|
mem->heap.len = heap_size;
|
|
1368
|
-
#
|
|
1374
|
+
#if defined(_WIN32)
|
|
1369
1375
|
mem->heap.ptr = (uint8_t *)VirtualAlloc(nullptr, mem->heap.len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
|
1370
1376
|
#else
|
|
1371
1377
|
mem->heap.ptr = (uint8_t *)mmap(nullptr, mem->heap.len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
|
@@ -1673,7 +1679,7 @@ static Napi::Value FindLibraryFunction(const Napi::CallbackInfo &info)
|
|
|
1673
1679
|
func->parameters.Grow(32);
|
|
1674
1680
|
}
|
|
1675
1681
|
|
|
1676
|
-
#
|
|
1682
|
+
#if defined(_WIN32)
|
|
1677
1683
|
if (func->ordinal_name < 0) {
|
|
1678
1684
|
if (func->decorated_name) {
|
|
1679
1685
|
func->native = (void *)GetProcAddress((HMODULE)lib->module, func->decorated_name);
|
|
@@ -1725,7 +1731,7 @@ static Napi::Value FindSymbol(const Napi::CallbackInfo &info)
|
|
|
1725
1731
|
if (!type)
|
|
1726
1732
|
return env.Null();
|
|
1727
1733
|
|
|
1728
|
-
#
|
|
1734
|
+
#if defined(_WIN32)
|
|
1729
1735
|
void *ptr = (void *)GetProcAddress((HMODULE)lib->module, name.c_str());
|
|
1730
1736
|
#else
|
|
1731
1737
|
void *ptr = (void *)dlsym(lib->module, name.c_str());
|
|
@@ -1769,7 +1775,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1769
1775
|
return env.Null();
|
|
1770
1776
|
}
|
|
1771
1777
|
|
|
1772
|
-
#
|
|
1778
|
+
#if !defined(_WIN32)
|
|
1773
1779
|
int flags = 0;
|
|
1774
1780
|
|
|
1775
1781
|
if (info.Length() >= 2) {
|
|
@@ -1777,7 +1783,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1777
1783
|
|
|
1778
1784
|
flags |= options.Get("lazy").ToBoolean() ? RTLD_LAZY : RTLD_NOW;
|
|
1779
1785
|
flags |= options.Get("global").ToBoolean() ? RTLD_GLOBAL : RTLD_LOCAL;
|
|
1780
|
-
#
|
|
1786
|
+
#if defined(RTLD_DEEPBIND)
|
|
1781
1787
|
flags |= options.Get("deep").ToBoolean() ? RTLD_DEEPBIND : 0;
|
|
1782
1788
|
#endif
|
|
1783
1789
|
} else {
|
|
@@ -1792,7 +1798,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1792
1798
|
|
|
1793
1799
|
// Load shared library
|
|
1794
1800
|
void *module = nullptr;
|
|
1795
|
-
#
|
|
1801
|
+
#if defined(_WIN32)
|
|
1796
1802
|
if (info[0].IsString()) {
|
|
1797
1803
|
std::string filename = info[0].As<Napi::String>();
|
|
1798
1804
|
module = LoadWindowsLibrary(env, filename.c_str());
|
|
@@ -2155,7 +2161,7 @@ static Napi::Value ResetKoffi(const Napi::CallbackInfo &info)
|
|
|
2155
2161
|
instance->broker = nullptr;
|
|
2156
2162
|
}
|
|
2157
2163
|
|
|
2158
|
-
instance->types.RemoveFrom(instance->
|
|
2164
|
+
instance->types.RemoveFrom(instance->base_types_count);
|
|
2159
2165
|
|
|
2160
2166
|
{
|
|
2161
2167
|
HashSet<const void *> base_types;
|
|
@@ -2181,7 +2187,7 @@ static Napi::Value ResetKoffi(const Napi::CallbackInfo &info)
|
|
|
2181
2187
|
|
|
2182
2188
|
void LibraryHolder::Unload()
|
|
2183
2189
|
{
|
|
2184
|
-
#
|
|
2190
|
+
#if defined(_WIN32)
|
|
2185
2191
|
if (module && module != GetModuleHandle(nullptr)) {
|
|
2186
2192
|
FreeLibrary((HMODULE)module);
|
|
2187
2193
|
}
|
|
@@ -2229,7 +2235,7 @@ void FunctionInfo::Unref() const
|
|
|
2229
2235
|
|
|
2230
2236
|
InstanceMemory::~InstanceMemory()
|
|
2231
2237
|
{
|
|
2232
|
-
#
|
|
2238
|
+
#if defined(_WIN32)
|
|
2233
2239
|
if (stack.ptr) {
|
|
2234
2240
|
VirtualFree(stack.ptr, 0, MEM_RELEASE);
|
|
2235
2241
|
}
|
|
@@ -2322,7 +2328,7 @@ static inline PrimitiveKind GetSignPrimitive(Size len, bool sign)
|
|
|
2322
2328
|
|
|
2323
2329
|
static inline PrimitiveKind GetLittleEndianPrimitive(PrimitiveKind kind)
|
|
2324
2330
|
{
|
|
2325
|
-
#
|
|
2331
|
+
#if defined(RG_BIG_ENDIAN)
|
|
2326
2332
|
return (PrimitiveKind)((int)kind + 1);
|
|
2327
2333
|
#else
|
|
2328
2334
|
return kind;
|
|
@@ -2331,7 +2337,7 @@ static inline PrimitiveKind GetLittleEndianPrimitive(PrimitiveKind kind)
|
|
|
2331
2337
|
|
|
2332
2338
|
static inline PrimitiveKind GetBigEndianPrimitive(PrimitiveKind kind)
|
|
2333
2339
|
{
|
|
2334
|
-
#
|
|
2340
|
+
#if defined(RG_BIG_ENDIAN)
|
|
2335
2341
|
return kind;
|
|
2336
2342
|
#else
|
|
2337
2343
|
return (PrimitiveKind)((int)kind + 1);
|
|
@@ -2347,7 +2353,7 @@ static InstanceData *CreateInstance()
|
|
|
2347
2353
|
|
|
2348
2354
|
instance->debug = GetDebugFlag("DUMP_CALLS");
|
|
2349
2355
|
|
|
2350
|
-
#
|
|
2356
|
+
#if defined(_WIN32)
|
|
2351
2357
|
TEB *teb = GetTEB();
|
|
2352
2358
|
|
|
2353
2359
|
instance->main_stack_max = teb->StackBase;
|
|
@@ -2498,7 +2504,7 @@ static Napi::Object InitModule(Napi::Env env, Napi::Object exports)
|
|
|
2498
2504
|
|
|
2499
2505
|
instance->active_symbol = Napi::Symbol::New(env, "active");
|
|
2500
2506
|
|
|
2501
|
-
instance->
|
|
2507
|
+
instance->base_types_count = instance->types.count;
|
|
2502
2508
|
}
|
|
2503
2509
|
|
|
2504
2510
|
// Expose internal Node stuff
|
package/src/koffi/src/ffi.hh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
#pragma once
|
|
23
23
|
|
|
24
|
-
#include "src/core/
|
|
24
|
+
#include "src/core/base/base.hh"
|
|
25
25
|
|
|
26
26
|
#include <napi.h>
|
|
27
27
|
|
|
@@ -229,7 +229,7 @@ struct FunctionInfo {
|
|
|
229
229
|
|
|
230
230
|
const char *name;
|
|
231
231
|
const char *decorated_name; // Only set for some platforms/calling conventions
|
|
232
|
-
#
|
|
232
|
+
#if defined(_WIN32)
|
|
233
233
|
int ordinal_name = -1;
|
|
234
234
|
#endif
|
|
235
235
|
const LibraryHolder *lib = nullptr;
|
|
@@ -278,7 +278,7 @@ struct InstanceData {
|
|
|
278
278
|
BucketArray<TypeInfo> types;
|
|
279
279
|
HashMap<const char *, const TypeInfo *> types_map;
|
|
280
280
|
BucketArray<FunctionInfo> callbacks;
|
|
281
|
-
Size
|
|
281
|
+
Size base_types_count;
|
|
282
282
|
|
|
283
283
|
bool debug;
|
|
284
284
|
|
|
@@ -299,7 +299,7 @@ struct InstanceData {
|
|
|
299
299
|
std::thread::id main_thread_id;
|
|
300
300
|
napi_threadsafe_function broker = nullptr;
|
|
301
301
|
|
|
302
|
-
#
|
|
302
|
+
#if defined(_WIN32)
|
|
303
303
|
void *main_stack_max;
|
|
304
304
|
void *main_stack_min;
|
|
305
305
|
|
package/src/koffi/src/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
4
|
// this software and associated documentation files (the “Software”), to deal in
|
package/src/koffi/src/parser.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
20
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
21
21
|
|
|
22
|
-
#include "src/core/
|
|
22
|
+
#include "src/core/base/base.hh"
|
|
23
|
+
#include "src/core/unicode/xid.hh"
|
|
23
24
|
#include "ffi.hh"
|
|
24
25
|
#include "parser.hh"
|
|
25
26
|
|
|
@@ -98,9 +99,9 @@ void PrototypeParser::Tokenize(const char *str)
|
|
|
98
99
|
|
|
99
100
|
if (IsAsciiWhite(c)) {
|
|
100
101
|
continue;
|
|
101
|
-
} else if (
|
|
102
|
+
} else if (IsXidStart(c)) {
|
|
102
103
|
Size j = i;
|
|
103
|
-
while (str[++j] && (
|
|
104
|
+
while (str[++j] && IsXidContinue(str[j]));
|
|
104
105
|
|
|
105
106
|
Span<const char> tok = MakeSpan(str + i, j - i);
|
|
106
107
|
tokens.Append(tok);
|
package/src/koffi/src/parser.hh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
#pragma once
|
|
23
23
|
|
|
24
|
-
#include "src/core/
|
|
24
|
+
#include "src/core/base/base.hh"
|
|
25
25
|
#include "util.hh"
|
|
26
26
|
|
|
27
27
|
#include <napi.h>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
; Copyright
|
|
1
|
+
; Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
;
|
|
3
3
|
; Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
; this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
; this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
; the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
; copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
; Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
# this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
# this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
# the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
# Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
; Copyright
|
|
1
|
+
; Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
;
|
|
3
3
|
; Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
; this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
; this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
; the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
; copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
; Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
; Copyright
|
|
1
|
+
; Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
;
|
|
3
3
|
; Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
; this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
; this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
; the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
; copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
; Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
package/src/koffi/src/util.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
20
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
21
21
|
|
|
22
|
-
#include "src/core/
|
|
22
|
+
#include "src/core/base/base.hh"
|
|
23
23
|
#include "call.hh"
|
|
24
24
|
#include "ffi.hh"
|
|
25
25
|
#include "util.hh"
|
|
@@ -337,7 +337,7 @@ const TypeInfo *ResolveType(Napi::Env env, Span<const char> str, int *out_direct
|
|
|
337
337
|
TypeInfo *copy = instance->types.AppendDefault();
|
|
338
338
|
|
|
339
339
|
memcpy((void *)copy, (const void *)type, RG_SIZE(*type));
|
|
340
|
-
copy->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
340
|
+
copy->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
341
341
|
copy->members.allocator = GetNullAllocator();
|
|
342
342
|
|
|
343
343
|
copy->dispose = [](Napi::Env env, const TypeInfo *, const void *ptr) {
|
|
@@ -1170,7 +1170,7 @@ void DecodeNormalArray(Napi::Array array, const uint8_t *origin, const TypeInfo
|
|
|
1170
1170
|
void DecodeBuffer(Span<uint8_t> buffer, const uint8_t *origin, const TypeInfo *ref)
|
|
1171
1171
|
{
|
|
1172
1172
|
// Go fast brrrrr!
|
|
1173
|
-
|
|
1173
|
+
MemCpy(buffer.ptr, origin, (size_t)buffer.len);
|
|
1174
1174
|
|
|
1175
1175
|
#define SWAP(CType) \
|
|
1176
1176
|
do { \
|
|
@@ -1694,16 +1694,16 @@ int AnalyseFlat(const TypeInfo *type, FunctionRef<void(const TypeInfo *type, int
|
|
|
1694
1694
|
void DumpMemory(const char *type, Span<const uint8_t> bytes)
|
|
1695
1695
|
{
|
|
1696
1696
|
if (bytes.len) {
|
|
1697
|
-
PrintLn(
|
|
1697
|
+
PrintLn(StdErr, "%1 at 0x%2 (%3):", type, bytes.ptr, FmtMemSize(bytes.len));
|
|
1698
1698
|
|
|
1699
1699
|
for (const uint8_t *ptr = bytes.begin(); ptr < bytes.end();) {
|
|
1700
|
-
Print(
|
|
1700
|
+
Print(StdErr, " [0x%1 %2 %3] ", FmtArg(ptr).Pad0(-16),
|
|
1701
1701
|
FmtArg((ptr - bytes.begin()) / sizeof(void *)).Pad(-4),
|
|
1702
1702
|
FmtArg(ptr - bytes.begin()).Pad(-4));
|
|
1703
1703
|
for (int i = 0; ptr < bytes.end() && i < (int)sizeof(void *); i++, ptr++) {
|
|
1704
|
-
Print(
|
|
1704
|
+
Print(StdErr, " %1", FmtHex(*ptr).Pad0(-2));
|
|
1705
1705
|
}
|
|
1706
|
-
PrintLn(
|
|
1706
|
+
PrintLn(StdErr);
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
package/src/koffi/src/util.hh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
#pragma once
|
|
23
23
|
|
|
24
|
-
#include "src/core/
|
|
24
|
+
#include "src/core/base/base.hh"
|
|
25
25
|
#include "ffi.hh"
|
|
26
26
|
|
|
27
27
|
#include <napi.h>
|
package/src/koffi/src/win32.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
20
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
#if defined(_WIN32)
|
|
23
23
|
|
|
24
24
|
#include "util.hh"
|
|
25
25
|
#include "win32.hh"
|
|
26
26
|
|
|
27
|
-
#
|
|
27
|
+
#if !defined(NOMINMAX)
|
|
28
28
|
#define NOMINMAX
|
|
29
29
|
#endif
|
|
30
|
-
#
|
|
30
|
+
#if !defined(WIN32_LEAN_AND_MEAN)
|
|
31
31
|
#define WIN32_LEAN_AND_MEAN
|
|
32
32
|
#endif
|
|
33
33
|
#include <windows.h>
|
package/src/koffi/src/win32.hh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
2
|
//
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
4
|
+
// this software and associated documentation files (the “Software”), to deal in
|
|
5
5
|
// the Software without restriction, including without limitation the rights to use,
|
|
6
6
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
7
|
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
#pragma once
|
|
23
23
|
|
|
24
|
-
#include "src/core/
|
|
24
|
+
#include "src/core/base/base.hh"
|
|
25
25
|
|
|
26
26
|
#include <intrin.h>
|
|
27
27
|
#include <napi.h>
|
|
@@ -82,9 +82,9 @@ struct TEB {
|
|
|
82
82
|
char _pad4[162];
|
|
83
83
|
uint16_t SameTebFlags;
|
|
84
84
|
};
|
|
85
|
-
static_assert(
|
|
86
|
-
static_assert(
|
|
87
|
-
static_assert(
|
|
85
|
+
static_assert(offsetof(TEB, DeallocationStack) == 0x1478);
|
|
86
|
+
static_assert(offsetof(TEB, GuaranteedStackBytes) == 0x1748);
|
|
87
|
+
static_assert(offsetof(TEB, SameTebFlags) == 0x17EE);
|
|
88
88
|
|
|
89
89
|
#else
|
|
90
90
|
|
|
@@ -101,9 +101,9 @@ struct TEB {
|
|
|
101
101
|
char _pad4[78];
|
|
102
102
|
uint16_t SameTebFlags;
|
|
103
103
|
};
|
|
104
|
-
static_assert(
|
|
105
|
-
static_assert(
|
|
106
|
-
static_assert(
|
|
104
|
+
static_assert(offsetof(TEB, DeallocationStack) == 0xE0C);
|
|
105
|
+
static_assert(offsetof(TEB, GuaranteedStackBytes) == 0x0F78);
|
|
106
|
+
static_assert(offsetof(TEB, SameTebFlags) == 0xFCA);
|
|
107
107
|
|
|
108
108
|
#endif
|
|
109
109
|
|