javascript - 解开包装在 voidptr_t 中的 UInt64

标签 javascript firefox-addon jsctypes

在 js-ctypes 中,我收到了一个 Windows 句柄 (voidptr_t)。在某些情况下,句柄为空,因此它返回给我为

var ret = ctypes.voidptr_t(ctypes.UInt64('0x0'))

我想解开 voidptr_t,然后执行 ctypes.UInt64.compare(ret, ctypes.UInt64('0x0'))

现在我正在做这件时髦的事情:

if (local_hwnd.toString().indexOf('UInt64("0x0")') > -1) {
    console.log('has no handle it is 0 local_hwnd.toString() = ', local_hwnd.toString());
}

最佳答案

对于简单的空比较:

ptr.isNull()

对于实际展开的内容(到 UInt64):

ctypes.cast(ptr, ctypes.uintptr_t).value

关于javascript - 解开包装在 voidptr_t 中的 UInt64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24362169/

相关文章:

javascript - 在 Angular.js 中更改 View 时处理 $scope 状态和值的正确方法是什么

javascript - jQuery 隐藏和显示元素并记住使用 cookie

cross-browser - browser.tabs.executescript() 在 Firefox 中不起作用

css - 告诉你使用的 css 样式的 Firefox 插件

javascript - Firefox 插件仅在调试状态下执行

javascript - 从 Node.js 定期(每天两次)调用 API 来获取数据的最佳方式

javascript - 循环遍历 JSON 对象的条目和 react 状态,得到 'state undefined'

firefox-addon - 如何使用 Firefox 扩展在本地文件系统中创建 .txt

javascript - TB_GETBUTTON 的结构是否正确? (WinXP) (同时检测进程是64位还是32位)