koffi 2.6.8 → 2.6.9

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,13 +4,17 @@
4
4
 
5
5
  ### Koffi 2.6
6
6
 
7
- #### Koffi 2.6.8 (2023-11-24)
7
+ #### Koffi 2.6.9 (2023-11-25)
8
8
 
9
9
  - Search in DLL directory for additional dependencies on Windows
10
10
  - Ignore prototype properties when making structs or unions
11
11
  - Show detected version of Node when not adequate
12
12
  - Minor documentation fixes
13
13
 
14
+ ```{warning}
15
+ Loading Win32 system libraries can fail in Koffi 2.6.8, skip this version.
16
+ ```
17
+
14
18
  #### Koffi 2.6.6 (2023-10-28)
15
19
 
16
20
  - Better handle errors while making struct or union types
@@ -280,7 +284,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
280
284
  - Avoid CNoke dependency
281
285
  - Clear out development dependencies from package.json
282
286
 
283
- #### Koffi 2.3.1 (2023-01-3O)
287
+ #### Koffi 2.3.1 (2023-01-30)
284
288
 
285
289
  - Error out when trying to use ambiguous `void *` arguments (input and/or output)
286
290
  - Adjust TypeScript definitions ([@insraq](https://github.com/insraq))
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/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.6.8",
382
- stable: "2.6.8",
381
+ version: "2.6.9",
382
+ stable: "2.6.9",
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.6.8",
382
- stable: "2.6.8",
381
+ version: "2.6.9",
382
+ stable: "2.6.9",
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.6.8",
4
- "stable": "2.6.8",
3
+ "version": "2.6.9",
4
+ "stable": "2.6.9",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -1640,19 +1640,28 @@ static Napi::Value UnloadLibrary(const Napi::CallbackInfo &info)
1640
1640
  }
1641
1641
 
1642
1642
  #ifdef _WIN32
1643
- static HANDLE LoadWindowsLibrary(Napi::Env env, const char *path)
1643
+ static HANDLE LoadWindowsLibrary(Napi::Env env, Span<const char> path)
1644
1644
  {
1645
1645
  BlockAllocator temp_alloc;
1646
1646
 
1647
- DWORD flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
1647
+ Span<wchar_t> filename_w = AllocateSpan<wchar_t>(&temp_alloc, path.len + 1);
1648
1648
 
1649
- Span<const char> filename = NormalizePath(path, GetWorkingDirectory(), &temp_alloc);
1650
- Span<wchar_t> filename_w = AllocateSpan<wchar_t>(&temp_alloc, filename.len + 1);
1651
-
1652
- if (ConvertUtf8ToWin32Wide(filename, filename_w) < 0)
1649
+ if (ConvertUtf8ToWin32Wide(path, filename_w) < 0)
1653
1650
  return nullptr;
1654
1651
 
1655
- HMODULE module = LoadLibraryExW(filename_w.ptr, nullptr, flags);
1652
+ HMODULE module = LoadLibraryW(filename_w.ptr);
1653
+
1654
+ if (!module) {
1655
+ DWORD flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
1656
+
1657
+ Span<const char> filename = NormalizePath(path, GetWorkingDirectory(), &temp_alloc);
1658
+ Span<wchar_t> filename_w = AllocateSpan<wchar_t>(&temp_alloc, filename.len + 1);
1659
+
1660
+ if (ConvertUtf8ToWin32Wide(filename, filename_w) < 0)
1661
+ return nullptr;
1662
+
1663
+ module = LoadLibraryExW(filename_w.ptr, nullptr, flags);
1664
+ }
1656
1665
 
1657
1666
  if (!module) {
1658
1667
  if (GetLastError() == ERROR_BAD_EXE_FORMAT) {