Firefox ctypes.js cannot open a dll with dependencies

ε祈祈猫儿з 提交于 2019-12-11 10:56:21

问题


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\exten‌​sions\@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\exten‌​sions\@extension\data\operations.dll: error 126

When I load a dll that does not have any dependant dlls ctypes.open() works

来源:https://stackoverflow.com/questions/37065027/firefox-ctypes-js-cannot-open-a-dll-with-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!