I have uploaded a project to Github to show the issue: https://github.com/EamonnLaffey/ctypes-test
I am using ctypes.open()
to load a dll that simply calls a function of a dependent dll which prints a message.
Within the data folder of the extension are the two dlls. There is also an executable, test.exe calls the same function that the extension is trying to call to verify that it is working.
To get the path of the dll I set "unpack": true
in extension's package.json and call the following in index.js:
var dllPath = Services.io.newURI(data.url('operations.dll'), null, null).QueryInterface(Ci.nsIFileURL).file.path;`
That will return a path such as
C:\Users\Eamonn\AppData\Local\Temp\1\f6ff0a5f-64b9-4953-a7a4-cb5b0a16c29c\extensions\@extension\data\operations.dll
When I manually go to the path I can see operations.dll, supporting.dll and test.exe as expected. Running test.exe will successfully load operations.dll which then loads supporting.dll.
However, when calling ctypes.open()
on the path the following error is returned:
console.error: ctypes-test-ext:
Message: Error: couldn't open library C:\Users\Eamonn\AppData\Local\Temp\1\f6ff0a5f-64b9-4953-a7a4-cb5b0a16c29c\extensions\@extension\data\operations.dll: error 126
When I load a dll that does not have any dependant dlls ctypes.open()
works