Skip to content

Commit

Permalink
added delayhook to fix delay-load issues (#100)
Browse files Browse the repository at this point in the history
* added delayhook to fix delay-load issues

* added FARPROC to dict.txt

* removed nodejs support for beaglebone

* switched macos-latest to pv-ios for nodejs

* removed c support for beaglebone in workflows

* switched mac architecture to mac-arm64 for c demo

* reverting changes

* added support for beaglebone back

* changed Beaglebone to BeagleBone in README
  • Loading branch information
matt200-ok authored Jun 26, 2024
1 parent 1132d7c commit 98b2015
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- os: windows-latest
pv_recorder_platform: windows
- os: macos-latest
pv_recorder_platform: mac-x86_64
pv_recorder_platform: mac-arm64

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
node-version: [16.x, 18.x, 20.x]

steps:
Expand All @@ -52,7 +52,7 @@ jobs:

strategy:
matrix:
machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone, pv-windows]
machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone, pv-windows, pv-ios]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
node-version: [16.x, 18.x, 20.x]

steps:
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:

strategy:
matrix:
machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone, pv-windows]
machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone, pv-windows, pv-ios]

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions project/node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_dependencies(pv_recorder_napi node_headers)

if (${PV_RECORDER_PLATFORM} STREQUAL "windows")
add_dependencies(pv_recorder_napi node_win_lib)
target_sources(pv_recorder_napi PRIVATE delayhook.c)
endif()

target_include_directories(pv_recorder_napi PUBLIC ${PROJECT_SOURCE_DIR}/../include)
Expand Down
21 changes: 21 additions & 0 deletions project/node/delayhook.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif

#include <windows.h>
#include <delayimp.h>
#include <string.h>

static FARPROC WINAPI delayHook(unsigned int dliNotify, DelayLoadInfo* dli) {
HMODULE m;
if (dliNotify != dliNotePreLoadLibrary)
return NULL;

if (_stricmp(dli->szDll, "node.exe") != 0)
return NULL;

m = GetModuleHandle(NULL);
return (FARPROC) m;
}

PfnDliHook __pfnDliNotifyHook2 = delayHook;
1 change: 1 addition & 0 deletions resources/.lint/spell-check/dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dlsym
DOUTPUT
dylib
ERRORLEVEL
FARPROC
fprintf
fvisibility
gendef
Expand Down

0 comments on commit 98b2015

Please sign in to comment.