Skip to content

Commit

Permalink
Fix cs_close() pointer to handle not handle (capstone-engine#810)
Browse files Browse the repository at this point in the history
* Binding.README

* Binding.README

* Binding.README

* Binding.README.Ps1

* Binding.PowerShell-Script

Added script to generate compressed DLL output & update for README

* PowerShell.Binding-Rework

A rework of the pull request based on feedback for the same pull
request in Keystone

* +Get-CapstoneDisassembly

Reworked according to the module in Keystone

* Revert constant generation + Quality of service change

* Fix: cs_close -> [ref]Ptr not Ptr
  • Loading branch information
FuzzySecurity authored and aquynh committed Nov 13, 2016
1 parent d909de0 commit 8b7bac2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bindings/powershell/Capstone/Capstone.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function Get-CapstoneDisassembly {
[DllImport("$DllPath")]
public static extern cs_err cs_close(
IntPtr handle);
ref IntPtr handle);
[DllImport("$DllPath")]
public static extern cs_err cs_option(
Expand Down Expand Up @@ -340,7 +340,7 @@ function Get-CapstoneDisassembly {
if ($CallResult -ne "CS_ERR_OK") {
echo "`n[!] cs_option error: $CallResult"
echo "[>] Quitting..`n"
$CallResult = [Capstone]::cs_close($DisAsmHandle)
$CallResult = [Capstone]::cs_close([ref]$DisAsmHandle)
Return
}

Expand All @@ -359,7 +359,7 @@ function Get-CapstoneDisassembly {
if ($CallResult -ne "CS_ERR_OK") {
echo "`n[!] cs_option error: $CallResult"
echo "[>] Quitting..`n"
$CallResult = [Capstone]::cs_close($DisAsmHandle)
$CallResult = [Capstone]::cs_close([ref]$DisAsmHandle)
Return
}

Expand Down Expand Up @@ -428,9 +428,9 @@ function Get-CapstoneDisassembly {
$BuffOffset = $BuffOffset + $cs_insn_size
}
} else {
echo "[!] Disassembly Failed"
echo "[>] Quitting.."
$CallResult = [Capstone]::cs_close($DisAsmHandle)
echo "`n[!] Disassembly Failed"
echo "[>] Quitting..`n"
$CallResult = [Capstone]::cs_close([ref]$DisAsmHandle)
Return
}

Expand Down

0 comments on commit 8b7bac2

Please sign in to comment.