Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug › DebugActiveProcessStop

DebugActiveProcessStop

関数
デバッグ中のプロセスからデバッガをデタッチする。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

BOOL DebugActiveProcessStop(
    DWORD dwProcessId
);

パラメーター

名前方向
dwProcessIdDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

BOOL DebugActiveProcessStop(
    DWORD dwProcessId
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool DebugActiveProcessStop(
    uint dwProcessId   // DWORD
);
<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DebugActiveProcessStop(
    dwProcessId As UInteger   ' DWORD
) As Boolean
End Function
' dwProcessId : DWORD
Declare PtrSafe Function DebugActiveProcessStop Lib "kernel32" ( _
    ByVal dwProcessId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DebugActiveProcessStop = ctypes.windll.kernel32.DebugActiveProcessStop
DebugActiveProcessStop.restype = wintypes.BOOL
DebugActiveProcessStop.argtypes = [
    wintypes.DWORD,  # dwProcessId : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
DebugActiveProcessStop = Fiddle::Function.new(
  lib['DebugActiveProcessStop'],
  [
    -Fiddle::TYPE_INT,  # dwProcessId : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn DebugActiveProcessStop(
        dwProcessId: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool DebugActiveProcessStop(uint dwProcessId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_DebugActiveProcessStop' -Namespace Win32 -PassThru
# $api::DebugActiveProcessStop(dwProcessId)
#uselib "KERNEL32.dll"
#func global DebugActiveProcessStop "DebugActiveProcessStop" sptr
; DebugActiveProcessStop dwProcessId   ; 戻り値は stat
; dwProcessId : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global DebugActiveProcessStop "DebugActiveProcessStop" int
; res = DebugActiveProcessStop(dwProcessId)
; dwProcessId : DWORD -> "int"
; BOOL DebugActiveProcessStop(DWORD dwProcessId)
#uselib "KERNEL32.dll"
#cfunc global DebugActiveProcessStop "DebugActiveProcessStop" int
; res = DebugActiveProcessStop(dwProcessId)
; dwProcessId : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procDebugActiveProcessStop = kernel32.NewProc("DebugActiveProcessStop")
)

// dwProcessId (DWORD)
r1, _, err := procDebugActiveProcessStop.Call(
	uintptr(dwProcessId),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DebugActiveProcessStop(
  dwProcessId: DWORD   // DWORD
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'DebugActiveProcessStop';
result := DllCall("KERNEL32\DebugActiveProcessStop"
    , "UInt", dwProcessId   ; DWORD
    , "Int")   ; return: BOOL
●DebugActiveProcessStop(dwProcessId) = DLL("KERNEL32.dll", "bool DebugActiveProcessStop(dword)")
# 呼び出し: DebugActiveProcessStop(dwProcessId)
# dwProcessId : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。