11
Sep
2012
JS加载本地库
太让人震惊了,JS可以加载本地库文件。
在Firefox下面
Components.utils.import("resource://gre/modules/ctypes.jsm");
var lib = ctypes.open("C:\\WINDOWS\\system32\\user32.dll");
/* Declare the signature of the function we are going to call */
var msgBox = lib.declare("MessageBoxW",
ctypes.winapi_abi,
ctypes.int32_t,
ctypes.int32_t,
ctypes.jschar.ptr,
ctypes.jschar.ptr,
ctypes.int32_t);
var MB_OK = 0;
var ret = msgBox(0, "Hello world", "title", MB_OK);
lib.close();
详细见:JS-ctypes
上一篇: 内核实现理论篇之软盘存储
下一篇: Linux内核的原子操作