Last active
December 24, 2022 06:09
-
-
Save vient/db5af9a8cea7f6924af85c652e7953cf to your computer and use it in GitHub Desktop.
Add IDA to context menu. Download as ZIP, unpack to safe place (don't delete after!) and run setup.bat. You will get "Open with IDA" in context menu. Requires WSL installed with `file` installed inside.
This file contains 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
@echo off | |
setlocal | |
reg query HKCR\IDApro.Database32\shell\open\command > NUL | |
if errorlevel 1 goto idb_handler_not_found | |
for /f tokens^=2^ delims^=^" %%a in ('reg query "HKCR\IDApro.Database32\shell\open\command" ^| findstr /ri "REG_SZ"') do set IDA_DIR=%%~dpa | |
echo IDA folder %IDA_DIR% | |
set arg1_full_path=%~f1 | |
for /f "delims=" %%i in ('wsl -- file "`wslpath -a '%arg1_full_path:\=\\%'`"') do set file_type=%%i | |
echo %file_type% | |
rem https://stackoverflow.com/a/7006016/6430628 | |
if not "%file_type:PE32 executable=%"=="%file_type%" goto ida32 | |
if not "%file_type:ELF 32-bit=%"=="%file_type%" goto ida32 | |
start "" "%IDA_DIR%\ida64.exe" "%arg1_full_path%" | |
goto wait | |
:ida32 | |
start "" "%IDA_DIR%\ida.exe" "%arg1_full_path%" | |
goto wait | |
:idb_handler_not_found | |
echo IDB handler not found in registry, can not find IDA folder! | |
goto wait | |
:wait | |
rem Give 5 seconds to read `file` output | |
ping 127.1 -n 6 >NUL | |
endlocal |
This file contains 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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\*\shell\Open with IDA] | |
[HKEY_CLASSES_ROOT\*\shell\Open with IDA\command] | |
@= |
This file contains 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
rem @echo off | |
rem I may add redundant slash in path, it does not matter. | |
setlocal | |
set script_dir=%~dp0 | |
echo "cmd /c start \"\" cmd /c \"\"%script_dir:\=\\%\\ida_launcher.bat\" \"%%1\"\"" >> "%script_dir%\ida_launcher.reg" | |
"%script_dir%\ida_launcher.reg" | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment