Fix: cs_close -> [ref]Ptr not Ptr

This commit is contained in:
FuzzySecurity 2016-11-12 16:01:33 +01:00
parent 4088ce508e
commit b526229ee4

View File

@ -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(
@ -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
}
@ -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
}
@ -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
}