SWTでレジストリの値を取得

    void testRegistory() {
        String entry = "SOFTWARE\\Microsoft\\DirectX";
        int hKey = new int[1];
        try {
            int rc = OS.RegOpenKeyEx(OS.HKEY_LOCAL_MACHINE, 
                    new TCHAR(OS.CP_INSTALLED, entry, true), 
                    0, 0xF003F/*KEY_ALL_ACCESS*/, hKey);
            TCHAR buf = new TCHAR(OS.CP_INSTALLED, 256);
            int len = new int[] { 256 };
            rc = OS.RegQueryValueEx(hKey[0], 
                    new TCHAR(OS.CP_INSTALLED, "Version", true), 0, null, buf, len);
            System.out.println("value=["+buf.toString(0, len[0]/TCHAR.sizeof)+"]");
        } finally {
            if (hKey[0] != 0) OS.RegCloseKey(hKey[0]);
        }
    }