From 2ac0ff68b95b4eace03c984d60ed3f966cbd382f Mon Sep 17 00:00:00 2001 From: Ana Maria Martinez Gomez Date: Tue, 26 Sep 2023 18:24:05 +0200 Subject: [PATCH] Add "Open with IDA" to right click menu 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. --- packages/idafree.vm/idafree.vm.nuspec | 4 ++-- packages/idafree.vm/tools/chocolateyinstall.ps1 | 11 +++++++++++ packages/idafree.vm/tools/chocolateyuninstall.ps1 | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/idafree.vm/idafree.vm.nuspec b/packages/idafree.vm/idafree.vm.nuspec index 20a4fa94b..2fe2045cb 100644 --- a/packages/idafree.vm/idafree.vm.nuspec +++ b/packages/idafree.vm/idafree.vm.nuspec @@ -2,11 +2,11 @@ idafree.vm - 7.6.20230418 + 7.6.20230926 hex-rays Free version of IDA, a powerful Interactive DisAssembler and debugger - + diff --git a/packages/idafree.vm/tools/chocolateyinstall.ps1 b/packages/idafree.vm/tools/chocolateyinstall.ps1 index 562a20db3..6fdddc67f 100644 --- a/packages/idafree.vm/tools/chocolateyinstall.ps1 +++ b/packages/idafree.vm/tools/chocolateyinstall.ps1 @@ -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 $_ } diff --git a/packages/idafree.vm/tools/chocolateyuninstall.ps1 b/packages/idafree.vm/tools/chocolateyuninstall.ps1 index 34663e3b8..0604d7fa7 100644 --- a/packages/idafree.vm/tools/chocolateyuninstall.ps1 +++ b/packages/idafree.vm/tools/chocolateyuninstall.ps1 @@ -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" \ No newline at end of file +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