koffi 2.8.6 → 2.8.7

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 CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ### Koffi 2.8
6
6
 
7
+ #### Koffi 2.8.7 (2024-04-23)
8
+
9
+ - Improve compatibility with SEHOP on Windows ([@longhun12346](https://github.com/longhun12346))
10
+
7
11
  #### Koffi 2.8.6 (2024-04-12)
8
12
 
9
13
  - Support [loading library](functions.md#loading-options) with RTLD_DEEPBIND where supported
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/doc/contribute.md CHANGED
@@ -60,15 +60,7 @@ Once Koffi is built, you can build the tests and run them with the following com
60
60
  cd src/koffi/test
61
61
  node ../../cnoke/cnoke.js
62
62
 
63
- node sync.js # Run synchronous unit tests
64
- node async.js # Run asynchronous unit tests
65
- node callbacks.js # Run callback unit tests
66
- node union.js # Run union unit tests
67
- node posix.js # Run POSIX-specific unit tests (not for Windows)
68
- node win32.js # Run Windows-specific unit tests (only on Windows)
69
-
70
- node sqlite.js # Run SQLite integration tests
71
- node raylib.js # Run Raylib integration tests
63
+ node test.js
72
64
  ```
73
65
 
74
66
  ### On virtual machines
@@ -153,3 +145,5 @@ Some platforms are emulated so this can take a few minutes until the pre-built b
153
145
  Koffi is programmed in a mix of C++ and assembly code (architecture-specific code). It uses [node-addon-api](https://github.com/nodejs/node-addon-api) (C++ N-API wrapper) to interact with Node.js.
154
146
 
155
147
  My personal preference goes to a rather C-like C++ style, with careful use of templates (mainly for containers) and little object-oriented programming. I strongly prefer tagged unions and code locality over inheritance and virtual methods. Exceptions are disabled.
148
+
149
+ Find more information about code style in the [monorepository README](https://github.com/Koromix/rygel/?tab=readme-ov-file#c-flavor) file.
package/index.js CHANGED
@@ -378,8 +378,8 @@ var require_package = __commonJS({
378
378
  "build/dist/src/koffi/package.json"(exports2, module2) {
379
379
  module2.exports = {
380
380
  name: "koffi",
381
- version: "2.8.6",
382
- stable: "2.8.6",
381
+ version: "2.8.7",
382
+ stable: "2.8.7",
383
383
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
384
384
  keywords: [
385
385
  "foreign",
package/indirect.js CHANGED
@@ -378,8 +378,8 @@ var require_package = __commonJS({
378
378
  "build/dist/src/koffi/package.json"(exports2, module2) {
379
379
  module2.exports = {
380
380
  name: "koffi",
381
- version: "2.8.6",
382
- stable: "2.8.6",
381
+ version: "2.8.7",
382
+ stable: "2.8.7",
383
383
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
384
384
  keywords: [
385
385
  "foreign",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.8.6",
4
- "stable": "2.8.6",
3
+ "version": "2.8.7",
4
+ "stable": "2.8.7",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -233,12 +233,14 @@ void CallData::Execute(const FunctionInfo *func, void *native)
233
233
  base = teb->StackBase,
234
234
  limit = teb->StackLimit,
235
235
  dealloc = teb->DeallocationStack,
236
- guaranteed = teb->GuaranteedStackBytes) {
236
+ guaranteed = teb->GuaranteedStackBytes,
237
+ stfs = teb->SameTebFlags) {
237
238
  teb->ExceptionList = exception_list;
238
239
  teb->StackBase = base;
239
240
  teb->StackLimit = limit;
240
241
  teb->DeallocationStack = dealloc;
241
242
  teb->GuaranteedStackBytes = guaranteed;
243
+ teb->SameTebFlags = stfs;
242
244
 
243
245
  instance->last_error = teb->LastErrorValue;
244
246
  };
@@ -249,6 +251,7 @@ void CallData::Execute(const FunctionInfo *func, void *native)
249
251
  teb->StackLimit = mem->stack0.ptr;
250
252
  teb->DeallocationStack = mem->stack0.ptr;
251
253
  teb->GuaranteedStackBytes = 0;
254
+ teb->SameTebFlags &= ~0x200;
252
255
 
253
256
  teb->LastErrorValue = instance->last_error;
254
257
 
@@ -330,12 +330,14 @@ void CallData::Execute(const FunctionInfo *func, void *native)
330
330
  base = teb->StackBase,
331
331
  limit = teb->StackLimit,
332
332
  dealloc = teb->DeallocationStack,
333
- guaranteed = teb->GuaranteedStackBytes) {
333
+ guaranteed = teb->GuaranteedStackBytes,
334
+ stfs = teb->SameTebFlags) {
334
335
  teb->ExceptionList = exception_list;
335
336
  teb->StackBase = base;
336
337
  teb->StackLimit = limit;
337
338
  teb->DeallocationStack = dealloc;
338
339
  teb->GuaranteedStackBytes = guaranteed;
340
+ teb->SameTebFlags = stfs;
339
341
 
340
342
  instance->last_error = teb->LastErrorValue;
341
343
  };
@@ -346,6 +348,7 @@ void CallData::Execute(const FunctionInfo *func, void *native)
346
348
  teb->StackLimit = mem->stack0.ptr;
347
349
  teb->DeallocationStack = mem->stack0.ptr;
348
350
  teb->GuaranteedStackBytes = 0;
351
+ teb->SameTebFlags &= ~0x200;
349
352
 
350
353
  teb->LastErrorValue = instance->last_error;
351
354
  #endif
@@ -79,9 +79,12 @@ struct TEB {
79
79
  void *DeallocationStack;
80
80
  char _pad3[712];
81
81
  uint32_t GuaranteedStackBytes;
82
+ char _pad4[162];
83
+ uint16_t SameTebFlags;
82
84
  };
83
85
  static_assert(RG_OFFSET_OF(TEB, DeallocationStack) == 0x1478);
84
86
  static_assert(RG_OFFSET_OF(TEB, GuaranteedStackBytes) == 0x1748);
87
+ static_assert(RG_OFFSET_OF(TEB, SameTebFlags) == 0x17EE);
85
88
 
86
89
  #else
87
90
 
@@ -95,9 +98,12 @@ struct TEB {
95
98
  void *DeallocationStack;
96
99
  char _pad3[360];
97
100
  uint32_t GuaranteedStackBytes;
101
+ char _pad4[78];
102
+ uint16_t SameTebFlags;
98
103
  };
99
104
  static_assert(RG_OFFSET_OF(TEB, DeallocationStack) == 0xE0C);
100
105
  static_assert(RG_OFFSET_OF(TEB, GuaranteedStackBytes) == 0x0F78);
106
+ static_assert(RG_OFFSET_OF(TEB, SameTebFlags) == 0xFCA);
101
107
 
102
108
  #endif
103
109