koffi 2.5.12 → 2.5.13

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,11 @@
4
4
 
5
5
  ### Koffi 2.5
6
6
 
7
+ #### Koffi 2.5.13 (2023-08-23)
8
+
9
+ - Fix DLL error when using Koffi from NW.js on Windows
10
+ - Simplify NW.js Koffi example
11
+
7
12
  #### Koffi 2.5.12 (2023-08-21)
8
13
 
9
14
  - Fix native module bundling for FreeBSD ARM64 and Linux RISC-V 64
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.5.12",
4
- "stable": "2.5.12",
3
+ "version": "2.5.13",
4
+ "stable": "2.5.13",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -31,9 +31,19 @@
31
31
 
32
32
  static FARPROC WINAPI self_exe_hook(unsigned int event, DelayLoadInfo *info)
33
33
  {
34
+ static const wchar_t *const NodeLibraries[] = {
35
+ L"node.dll",
36
+ NULL
37
+ };
38
+
34
39
  if (event == dliNotePreLoadLibrary && !stricmp(info->szDll, "node.exe")) {
35
- HMODULE h = GetModuleHandle(NULL);
36
- return (FARPROC)h;
40
+ for (int i = 0; i < sizeof(NodeLibraries) / sizeof(*NodeLibraries); i++) {
41
+ const wchar_t *name = NodeLibraries[i];
42
+ HMODULE h = GetModuleHandleW(name);
43
+
44
+ if (h)
45
+ return (FARPROC)h;
46
+ }
37
47
  }
38
48
 
39
49
  return NULL;