koffi 2.12.1 → 2.12.3
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 +21 -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 +228 -145
- package/index.js +25 -25
- package/indirect.js +25 -5
- 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} +3174 -1640
- package/src/core/{libcc/libcc.hh → base/base.hh} +3066 -2427
- package/src/core/{libcc → base}/mimetypes.inc +42 -4
- package/src/core/{libcc → base}/mimetypes_gen.py +3 -3
- package/src/core/base/unicode.inc +426 -0
- package/src/core/base/unicode_gen.py +189 -0
- package/src/koffi/CMakeLists.txt +7 -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 +44 -39
- package/src/koffi/src/ffi.hh +6 -6
- package/src/koffi/src/init.js +1 -1
- package/src/koffi/src/parser.cc +5 -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,21 @@
|
|
|
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 "ffi.hh"
|
|
24
24
|
#include "call.hh"
|
|
25
25
|
#include "parser.hh"
|
|
26
26
|
#include "util.hh"
|
|
27
|
-
#
|
|
27
|
+
#if defined(_WIN32)
|
|
28
28
|
#include "win32.hh"
|
|
29
29
|
#endif
|
|
30
30
|
#include "errno.inc"
|
|
31
31
|
|
|
32
|
-
#
|
|
33
|
-
#
|
|
32
|
+
#if defined(_WIN32)
|
|
33
|
+
#if !defined(NOMINMAX)
|
|
34
34
|
#define NOMINMAX
|
|
35
35
|
#endif
|
|
36
|
-
#
|
|
36
|
+
#if !defined(WIN32_LEAN_AND_MEAN)
|
|
37
37
|
#define WIN32_LEAN_AND_MEAN
|
|
38
38
|
#endif
|
|
39
39
|
#include <windows.h>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
#include <dlfcn.h>
|
|
43
43
|
#include <unistd.h>
|
|
44
44
|
#include <sys/mman.h>
|
|
45
|
-
#
|
|
45
|
+
#if !defined(MAP_STACK)
|
|
46
46
|
#define MAP_STACK 0
|
|
47
47
|
#endif
|
|
48
48
|
#endif
|
|
@@ -54,7 +54,7 @@ namespace RG {
|
|
|
54
54
|
|
|
55
55
|
SharedData shared;
|
|
56
56
|
|
|
57
|
-
static
|
|
57
|
+
static thread_local CallData *exec_call;
|
|
58
58
|
|
|
59
59
|
static bool ChangeSize(const char *name, Napi::Value value, Size min_size, Size max_size, Size *out_size)
|
|
60
60
|
{
|
|
@@ -201,14 +201,13 @@ static inline bool CheckAlignment(int64_t align)
|
|
|
201
201
|
return valid;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// Prevent simple mistakes but don't be too strict, the world is bigger than the US!
|
|
205
204
|
static bool IsNameValid(const char *name)
|
|
206
205
|
{
|
|
207
|
-
if (!
|
|
206
|
+
if (!IsXidStart(name[0]))
|
|
208
207
|
return false;
|
|
209
208
|
|
|
210
209
|
for (Size i = 1; name[i]; i++) {
|
|
211
|
-
if (
|
|
210
|
+
if (!IsXidContinue(name[i])) [[unlikely]]
|
|
212
211
|
return false;
|
|
213
212
|
}
|
|
214
213
|
|
|
@@ -259,10 +258,10 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
259
258
|
Napi::Object obj = info[named].As<Napi::Object>();
|
|
260
259
|
Napi::Array keys = GetOwnPropertyNames(obj);
|
|
261
260
|
|
|
262
|
-
RG_DEFER_NC(err_guard,
|
|
263
|
-
Size start =
|
|
261
|
+
RG_DEFER_NC(err_guard, count = instance->types.count) {
|
|
262
|
+
Size start = count + !named;
|
|
264
263
|
|
|
265
|
-
for (Size i = start; i < instance->types.
|
|
264
|
+
for (Size i = start; i < instance->types.count; i++) {
|
|
266
265
|
const TypeInfo *it = &instance->types[i];
|
|
267
266
|
const TypeInfo **ptr = instance->types_map.Find(it->name);
|
|
268
267
|
|
|
@@ -271,7 +270,7 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
271
270
|
}
|
|
272
271
|
}
|
|
273
272
|
|
|
274
|
-
instance->types.RemoveFrom(
|
|
273
|
+
instance->types.RemoveFrom(count);
|
|
275
274
|
};
|
|
276
275
|
|
|
277
276
|
TypeInfo *type = instance->types.AppendDefault();
|
|
@@ -294,7 +293,7 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
294
293
|
if (!MapType(env, instance, type, type->name))
|
|
295
294
|
return env.Null();
|
|
296
295
|
} else {
|
|
297
|
-
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
296
|
+
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
type->primitive = PrimitiveKind::Record;
|
|
@@ -353,6 +352,9 @@ static Napi::Value CreateStructType(const Napi::CallbackInfo &info, bool pad)
|
|
|
353
352
|
return env.Null();
|
|
354
353
|
}
|
|
355
354
|
|
|
355
|
+
if (TestStr(member.name, "_"))
|
|
356
|
+
continue;
|
|
357
|
+
|
|
356
358
|
if (!IsNameValid(member.name)) {
|
|
357
359
|
ThrowError<Napi::Error>(env, "Invalid member name '%1'", member.name);
|
|
358
360
|
return env.Null();
|
|
@@ -423,10 +425,10 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
423
425
|
Napi::Object obj = info[named].As<Napi::Object>();
|
|
424
426
|
Napi::Array keys = GetOwnPropertyNames(obj);
|
|
425
427
|
|
|
426
|
-
RG_DEFER_NC(err_guard,
|
|
427
|
-
Size start =
|
|
428
|
+
RG_DEFER_NC(err_guard, count = instance->types.count) {
|
|
429
|
+
Size start = count + !named;
|
|
428
430
|
|
|
429
|
-
for (Size i = start; i < instance->types.
|
|
431
|
+
for (Size i = start; i < instance->types.count; i++) {
|
|
430
432
|
const TypeInfo *it = &instance->types[i];
|
|
431
433
|
const TypeInfo **ptr = instance->types_map.Find(it->name);
|
|
432
434
|
|
|
@@ -435,7 +437,7 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
435
437
|
}
|
|
436
438
|
}
|
|
437
439
|
|
|
438
|
-
instance->types.RemoveFrom(
|
|
440
|
+
instance->types.RemoveFrom(count);
|
|
439
441
|
};
|
|
440
442
|
|
|
441
443
|
TypeInfo *type = instance->types.AppendDefault();
|
|
@@ -458,7 +460,7 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
458
460
|
if (!MapType(env, instance, type, type->name))
|
|
459
461
|
return env.Null();
|
|
460
462
|
} else {
|
|
461
|
-
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
463
|
+
type->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
type->primitive = PrimitiveKind::Union;
|
|
@@ -508,6 +510,9 @@ static Napi::Value CreateUnionType(const Napi::CallbackInfo &info)
|
|
|
508
510
|
size = std::max(size, member.type->size);
|
|
509
511
|
type->align = std::max(type->align, align);
|
|
510
512
|
|
|
513
|
+
if (TestStr(member.name, "_"))
|
|
514
|
+
continue;
|
|
515
|
+
|
|
511
516
|
if (!IsNameValid(member.name)) {
|
|
512
517
|
ThrowError<Napi::Error>(env, "Invalid member name '%1'", member.name);
|
|
513
518
|
return env.Null();
|
|
@@ -592,7 +597,7 @@ static Napi::Value CreateOpaqueType(const Napi::CallbackInfo &info)
|
|
|
592
597
|
RG_DEFER_N(err_guard) { instance->types.RemoveLast(1); };
|
|
593
598
|
|
|
594
599
|
type->name = named ? DuplicateString(name.Utf8Value().c_str(), &instance->str_alloc).ptr
|
|
595
|
-
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
600
|
+
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
596
601
|
|
|
597
602
|
type->primitive = PrimitiveKind::Void;
|
|
598
603
|
type->size = 0;
|
|
@@ -788,7 +793,7 @@ static Napi::Value CreateDisposableType(const Napi::CallbackInfo &info)
|
|
|
788
793
|
type->members.allocator = GetNullAllocator();
|
|
789
794
|
|
|
790
795
|
type->name = named ? DuplicateString(name.Utf8Value().c_str(), &instance->str_alloc).ptr
|
|
791
|
-
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.
|
|
796
|
+
: Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
|
|
792
797
|
|
|
793
798
|
type->dispose = dispose;
|
|
794
799
|
type->dispose_ref = Napi::Persistent(dispose_func);
|
|
@@ -1005,7 +1010,7 @@ static bool ParseClassicFunction(const Napi::CallbackInfo &info, FunctionInfo *o
|
|
|
1005
1010
|
parameters = info[3u].As<Napi::Array>();
|
|
1006
1011
|
}
|
|
1007
1012
|
|
|
1008
|
-
#
|
|
1013
|
+
#if defined(_WIN32)
|
|
1009
1014
|
if (name.IsNumber()) {
|
|
1010
1015
|
out_func->ordinal_name = name.As<Napi::Number>().Int32Value();
|
|
1011
1016
|
name = name.ToString();
|
|
@@ -1356,7 +1361,7 @@ static InstanceMemory *AllocateMemory(InstanceData *instance, Size stack_size, S
|
|
|
1356
1361
|
RG_CRITICAL(mem->stack.ptr, "Failed to allocate %1 of memory", mem->stack.len);
|
|
1357
1362
|
#endif
|
|
1358
1363
|
|
|
1359
|
-
#
|
|
1364
|
+
#if defined(__OpenBSD__)
|
|
1360
1365
|
// Make sure the SP points inside the MAP_STACK area, or (void) functions may crash on OpenBSD i386
|
|
1361
1366
|
mem->stack.len -= 16;
|
|
1362
1367
|
#endif
|
|
@@ -1365,7 +1370,7 @@ static InstanceMemory *AllocateMemory(InstanceData *instance, Size stack_size, S
|
|
|
1365
1370
|
mem->stack0 = mem->stack;
|
|
1366
1371
|
|
|
1367
1372
|
mem->heap.len = heap_size;
|
|
1368
|
-
#
|
|
1373
|
+
#if defined(_WIN32)
|
|
1369
1374
|
mem->heap.ptr = (uint8_t *)VirtualAlloc(nullptr, mem->heap.len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
|
1370
1375
|
#else
|
|
1371
1376
|
mem->heap.ptr = (uint8_t *)mmap(nullptr, mem->heap.len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
|
@@ -1673,7 +1678,7 @@ static Napi::Value FindLibraryFunction(const Napi::CallbackInfo &info)
|
|
|
1673
1678
|
func->parameters.Grow(32);
|
|
1674
1679
|
}
|
|
1675
1680
|
|
|
1676
|
-
#
|
|
1681
|
+
#if defined(_WIN32)
|
|
1677
1682
|
if (func->ordinal_name < 0) {
|
|
1678
1683
|
if (func->decorated_name) {
|
|
1679
1684
|
func->native = (void *)GetProcAddress((HMODULE)lib->module, func->decorated_name);
|
|
@@ -1725,7 +1730,7 @@ static Napi::Value FindSymbol(const Napi::CallbackInfo &info)
|
|
|
1725
1730
|
if (!type)
|
|
1726
1731
|
return env.Null();
|
|
1727
1732
|
|
|
1728
|
-
#
|
|
1733
|
+
#if defined(_WIN32)
|
|
1729
1734
|
void *ptr = (void *)GetProcAddress((HMODULE)lib->module, name.c_str());
|
|
1730
1735
|
#else
|
|
1731
1736
|
void *ptr = (void *)dlsym(lib->module, name.c_str());
|
|
@@ -1769,7 +1774,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1769
1774
|
return env.Null();
|
|
1770
1775
|
}
|
|
1771
1776
|
|
|
1772
|
-
#
|
|
1777
|
+
#if !defined(_WIN32)
|
|
1773
1778
|
int flags = 0;
|
|
1774
1779
|
|
|
1775
1780
|
if (info.Length() >= 2) {
|
|
@@ -1777,7 +1782,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1777
1782
|
|
|
1778
1783
|
flags |= options.Get("lazy").ToBoolean() ? RTLD_LAZY : RTLD_NOW;
|
|
1779
1784
|
flags |= options.Get("global").ToBoolean() ? RTLD_GLOBAL : RTLD_LOCAL;
|
|
1780
|
-
#
|
|
1785
|
+
#if defined(RTLD_DEEPBIND)
|
|
1781
1786
|
flags |= options.Get("deep").ToBoolean() ? RTLD_DEEPBIND : 0;
|
|
1782
1787
|
#endif
|
|
1783
1788
|
} else {
|
|
@@ -1792,7 +1797,7 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1792
1797
|
|
|
1793
1798
|
// Load shared library
|
|
1794
1799
|
void *module = nullptr;
|
|
1795
|
-
#
|
|
1800
|
+
#if defined(_WIN32)
|
|
1796
1801
|
if (info[0].IsString()) {
|
|
1797
1802
|
std::string filename = info[0].As<Napi::String>();
|
|
1798
1803
|
module = LoadWindowsLibrary(env, filename.c_str());
|
|
@@ -2155,7 +2160,7 @@ static Napi::Value ResetKoffi(const Napi::CallbackInfo &info)
|
|
|
2155
2160
|
instance->broker = nullptr;
|
|
2156
2161
|
}
|
|
2157
2162
|
|
|
2158
|
-
instance->types.RemoveFrom(instance->
|
|
2163
|
+
instance->types.RemoveFrom(instance->base_types_count);
|
|
2159
2164
|
|
|
2160
2165
|
{
|
|
2161
2166
|
HashSet<const void *> base_types;
|
|
@@ -2181,7 +2186,7 @@ static Napi::Value ResetKoffi(const Napi::CallbackInfo &info)
|
|
|
2181
2186
|
|
|
2182
2187
|
void LibraryHolder::Unload()
|
|
2183
2188
|
{
|
|
2184
|
-
#
|
|
2189
|
+
#if defined(_WIN32)
|
|
2185
2190
|
if (module && module != GetModuleHandle(nullptr)) {
|
|
2186
2191
|
FreeLibrary((HMODULE)module);
|
|
2187
2192
|
}
|
|
@@ -2229,7 +2234,7 @@ void FunctionInfo::Unref() const
|
|
|
2229
2234
|
|
|
2230
2235
|
InstanceMemory::~InstanceMemory()
|
|
2231
2236
|
{
|
|
2232
|
-
#
|
|
2237
|
+
#if defined(_WIN32)
|
|
2233
2238
|
if (stack.ptr) {
|
|
2234
2239
|
VirtualFree(stack.ptr, 0, MEM_RELEASE);
|
|
2235
2240
|
}
|
|
@@ -2322,7 +2327,7 @@ static inline PrimitiveKind GetSignPrimitive(Size len, bool sign)
|
|
|
2322
2327
|
|
|
2323
2328
|
static inline PrimitiveKind GetLittleEndianPrimitive(PrimitiveKind kind)
|
|
2324
2329
|
{
|
|
2325
|
-
#
|
|
2330
|
+
#if defined(RG_BIG_ENDIAN)
|
|
2326
2331
|
return (PrimitiveKind)((int)kind + 1);
|
|
2327
2332
|
#else
|
|
2328
2333
|
return kind;
|
|
@@ -2331,7 +2336,7 @@ static inline PrimitiveKind GetLittleEndianPrimitive(PrimitiveKind kind)
|
|
|
2331
2336
|
|
|
2332
2337
|
static inline PrimitiveKind GetBigEndianPrimitive(PrimitiveKind kind)
|
|
2333
2338
|
{
|
|
2334
|
-
#
|
|
2339
|
+
#if defined(RG_BIG_ENDIAN)
|
|
2335
2340
|
return kind;
|
|
2336
2341
|
#else
|
|
2337
2342
|
return (PrimitiveKind)((int)kind + 1);
|
|
@@ -2347,7 +2352,7 @@ static InstanceData *CreateInstance()
|
|
|
2347
2352
|
|
|
2348
2353
|
instance->debug = GetDebugFlag("DUMP_CALLS");
|
|
2349
2354
|
|
|
2350
|
-
#
|
|
2355
|
+
#if defined(_WIN32)
|
|
2351
2356
|
TEB *teb = GetTEB();
|
|
2352
2357
|
|
|
2353
2358
|
instance->main_stack_max = teb->StackBase;
|
|
@@ -2498,7 +2503,7 @@ static Napi::Object InitModule(Napi::Env env, Napi::Object exports)
|
|
|
2498
2503
|
|
|
2499
2504
|
instance->active_symbol = Napi::Symbol::New(env, "active");
|
|
2500
2505
|
|
|
2501
|
-
instance->
|
|
2506
|
+
instance->base_types_count = instance->types.count;
|
|
2502
2507
|
}
|
|
2503
2508
|
|
|
2504
2509
|
// 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,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 "ffi.hh"
|
|
24
24
|
#include "parser.hh"
|
|
25
25
|
|
|
@@ -98,9 +98,9 @@ void PrototypeParser::Tokenize(const char *str)
|
|
|
98
98
|
|
|
99
99
|
if (IsAsciiWhite(c)) {
|
|
100
100
|
continue;
|
|
101
|
-
} else if (
|
|
101
|
+
} else if (IsXidStart(c)) {
|
|
102
102
|
Size j = i;
|
|
103
|
-
while (str[++j] && (
|
|
103
|
+
while (str[++j] && IsXidContinue(str[j]));
|
|
104
104
|
|
|
105
105
|
Span<const char> tok = MakeSpan(str + i, j - i);
|
|
106
106
|
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
|
|