Last active
December 11, 2015 01:39
-
-
Save teramako/4524819 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EXPORTED_SYMBOLS = ["eject"]; | |
Components.utils.import("resource://gre/modules/ctypes.jsm"); | |
const UINT = ctypes.unsigned_int; | |
const DWORD = ctypes.uint32_t; | |
const LPCWSTR = ctypes.jschar.ptr; | |
if (ctypes.size_t.size == 8) { | |
var WinABI = ctypes.default_abi; | |
} else { | |
var WinABI = ctypes.winapi_abi; | |
} | |
var dll = "winmm.dll"; | |
function eject () { | |
var winmm = ctypes.open(dll); | |
var mciSendStringW = winmm.declare("mciSendStringW", WinABI, DWORD, LPCWSTR, DWORD, UINT, DWORD); | |
return mciSendStringW("set cdaudio door open", 0, 0, 0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment