Skip to content

Commit

Permalink
Add "Open with IDA" to right click menu
Browse files Browse the repository at this point in the history
Add "Open with IDA" and "Open with IDA (x64)" to the right click menu.
The command executes a Powershell script that looks for the latest IDA
Pro version and uses it to open the file. If no IDA Pro version is
found, it opens the file with IDA free.
  • Loading branch information
Ana06 committed Sep 26, 2023
1 parent d3dd71a commit 2ac0ff6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/idafree.vm/idafree.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>idafree.vm</id>
<version>7.6.20230418</version>
<version>7.6.20230926</version>
<authors>hex-rays</authors>
<description>Free version of IDA, a powerful Interactive DisAssembler and debugger</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
</dependencies>
</metadata>
</package>
11 changes: 11 additions & 0 deletions packages/idafree.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ try {
if (Test-Path $desktopShortcut) {
Remove-Item $desktopShortcut -Force -ea 0
}

$menuIcon = Join-Path $toolDir "ida.ico" -Resolve
# Run a Powershell script to open with last IDA Pro version which is likely installed after the IDA free package.
# It takes slightly longer than using an static path but it works after installing IDA Pro and every time you update it.
# The "-WindowStyle hidden" still shows the Powershell Window briefly: https://github.com/PowerShell/PowerShell/issues/3028
# We could use the run-hidden wrapper, which won't display the Window but is likely slightly slower.
$script = "`$idaExecutable = Get-Item '$Env:programfiles\IDA Pro *\ida.exe' | Select-Object -Last 1; if (!`$idaExecutable) { `$idaExecutable = '$executablePath' }; & `$idaExecutable '%1'"
VM-Add-To-Right-Click-Menu $toolName 'Open with IDA' "powershell.exe -WindowStyle hidden `"$script`"" "$menuIcon"
# Repeat for x64
$script = "`$idaExecutable = Get-Item '$Env:programfiles\IDA Pro *\ida64.exe' | Select-Object -Last 1; if (!`$idaExecutable) { `$idaExecutable = '$executablePath' }; & `$idaExecutable '%1'"
VM-Add-To-Right-Click-Menu $toolName-64 'Open with IDA (x64)' "powershell.exe -WindowStyle hidden `"$script`"" "$executablePath"
} catch {
VM-Write-Log-Exception $_
}
5 changes: 4 additions & 1 deletion packages/idafree.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ VM-Remove-Tool-Shortcut $toolName $category
Uninstall-BinFile -Name $toolName

# Manually silently uninstall
VM-Uninstall-With-Uninstaller "IDA Freeware*?7.6" "EXE" "--mode unattended"
VM-Uninstall-With-Uninstaller "IDA Freeware*?7.6" "EXE" "--mode unattended"

VM-Remove-From-Right-Click-Menu $toolName
VM-Remove-From-Right-Click-Menu $toolName-64

0 comments on commit 2ac0ff6

Please sign in to comment.