ホーム › System.Diagnostics.Debug › ContinueDebugEvent
ContinueDebugEvent
関数デバッグイベントを報告したスレッドの実行を再開させる。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL ContinueDebugEvent(
DWORD dwProcessId,
DWORD dwThreadId,
NTSTATUS dwContinueStatus
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| dwProcessId | DWORD | in | 継続するプロセスのプロセス識別子。 | ||||||||
| dwThreadId | DWORD | in | 継続するスレッドのスレッド識別子。プロセス識別子とスレッド識別子の組み合わせは、以前にデバッグイベントを報告したスレッドを識別する必要があります。 | ||||||||
| dwContinueStatus | NTSTATUS | in | デバッグイベントを報告したスレッドを継続する際のオプション。
|
戻り値の型: BOOL
公式ドキュメント
デバッガーが、以前にデバッグイベントを報告したスレッドの実行を継続できるようにします。
戻り値
関数が成功した場合、戻り値は 0 以外の値になります。
関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、 GetLastError を呼び出します。
解説(Remarks)
CreateProcess 関数で dwProcessId を作成したスレッドのみが、 ContinueDebugEvent を呼び出すことができます。
ContinueDebugEvent 関数が成功すると、指定されたスレッドの実行が継続されます。そのスレッドが以前に報告したデバッグイベントに応じて、異なる動作が発生します。継続されるスレッドが以前に EXIT_THREAD_DEBUG_EVENT デバッグイベントを報告していた場合、 ContinueDebugEvent はデバッガーがそのスレッドに対して保持しているハンドルを閉じます。継続されるスレッドが以前に EXIT_PROCESS_DEBUG_EVENT デバッグイベントを報告していた場合、 ContinueDebugEvent はデバッガーがそのプロセスおよびスレッドに対して保持しているハンドルを閉じます。
例
例については、 Writing the Debugger's Main Loop を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL ContinueDebugEvent(
DWORD dwProcessId,
DWORD dwThreadId,
NTSTATUS dwContinueStatus
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool ContinueDebugEvent(
uint dwProcessId, // DWORD
uint dwThreadId, // DWORD
int dwContinueStatus // NTSTATUS
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ContinueDebugEvent(
dwProcessId As UInteger, ' DWORD
dwThreadId As UInteger, ' DWORD
dwContinueStatus As Integer ' NTSTATUS
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' dwProcessId : DWORD
' dwThreadId : DWORD
' dwContinueStatus : NTSTATUS
Declare PtrSafe Function ContinueDebugEvent Lib "kernel32" ( _
ByVal dwProcessId As Long, _
ByVal dwThreadId As Long, _
ByVal dwContinueStatus As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ContinueDebugEvent = ctypes.windll.kernel32.ContinueDebugEvent
ContinueDebugEvent.restype = wintypes.BOOL
ContinueDebugEvent.argtypes = [
wintypes.DWORD, # dwProcessId : DWORD
wintypes.DWORD, # dwThreadId : DWORD
ctypes.c_int, # dwContinueStatus : NTSTATUS
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
ContinueDebugEvent = Fiddle::Function.new(
lib['ContinueDebugEvent'],
[
-Fiddle::TYPE_INT, # dwProcessId : DWORD
-Fiddle::TYPE_INT, # dwThreadId : DWORD
Fiddle::TYPE_INT, # dwContinueStatus : NTSTATUS
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn ContinueDebugEvent(
dwProcessId: u32, // DWORD
dwThreadId: u32, // DWORD
dwContinueStatus: i32 // NTSTATUS
) -> 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 ContinueDebugEvent(uint dwProcessId, uint dwThreadId, int dwContinueStatus);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ContinueDebugEvent' -Namespace Win32 -PassThru
# $api::ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)#uselib "KERNEL32.dll"
#func global ContinueDebugEvent "ContinueDebugEvent" sptr, sptr, sptr
; ContinueDebugEvent dwProcessId, dwThreadId, dwContinueStatus ; 戻り値は stat
; dwProcessId : DWORD -> "sptr"
; dwThreadId : DWORD -> "sptr"
; dwContinueStatus : NTSTATUS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global ContinueDebugEvent "ContinueDebugEvent" int, int, int
; res = ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
; dwProcessId : DWORD -> "int"
; dwThreadId : DWORD -> "int"
; dwContinueStatus : NTSTATUS -> "int"; BOOL ContinueDebugEvent(DWORD dwProcessId, DWORD dwThreadId, NTSTATUS dwContinueStatus)
#uselib "KERNEL32.dll"
#cfunc global ContinueDebugEvent "ContinueDebugEvent" int, int, int
; res = ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
; dwProcessId : DWORD -> "int"
; dwThreadId : DWORD -> "int"
; dwContinueStatus : NTSTATUS -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procContinueDebugEvent = kernel32.NewProc("ContinueDebugEvent")
)
// dwProcessId (DWORD), dwThreadId (DWORD), dwContinueStatus (NTSTATUS)
r1, _, err := procContinueDebugEvent.Call(
uintptr(dwProcessId),
uintptr(dwThreadId),
uintptr(dwContinueStatus),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ContinueDebugEvent(
dwProcessId: DWORD; // DWORD
dwThreadId: DWORD; // DWORD
dwContinueStatus: Integer // NTSTATUS
): BOOL; stdcall;
external 'KERNEL32.dll' name 'ContinueDebugEvent';result := DllCall("KERNEL32\ContinueDebugEvent"
, "UInt", dwProcessId ; DWORD
, "UInt", dwThreadId ; DWORD
, "Int", dwContinueStatus ; NTSTATUS
, "Int") ; return: BOOL●ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus) = DLL("KERNEL32.dll", "bool ContinueDebugEvent(dword, dword, int)")
# 呼び出し: ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
# dwProcessId : DWORD -> "dword"
# dwThreadId : DWORD -> "dword"
# dwContinueStatus : NTSTATUS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "kernel32" fn ContinueDebugEvent(
dwProcessId: u32, // DWORD
dwThreadId: u32, // DWORD
dwContinueStatus: i32 // NTSTATUS
) callconv(std.os.windows.WINAPI) i32;proc ContinueDebugEvent(
dwProcessId: uint32, # DWORD
dwThreadId: uint32, # DWORD
dwContinueStatus: int32 # NTSTATUS
): int32 {.importc: "ContinueDebugEvent", stdcall, dynlib: "KERNEL32.dll".}pragma(lib, "kernel32");
extern(Windows)
int ContinueDebugEvent(
uint dwProcessId, // DWORD
uint dwThreadId, // DWORD
int dwContinueStatus // NTSTATUS
);ccall((:ContinueDebugEvent, "KERNEL32.dll"), stdcall, Int32,
(UInt32, UInt32, Int32),
dwProcessId, dwThreadId, dwContinueStatus)
# dwProcessId : DWORD -> UInt32
# dwThreadId : DWORD -> UInt32
# dwContinueStatus : NTSTATUS -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ContinueDebugEvent(
uint32_t dwProcessId,
uint32_t dwThreadId,
int32_t dwContinueStatus);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
-- dwProcessId : DWORD
-- dwThreadId : DWORD
-- dwContinueStatus : NTSTATUS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const ContinueDebugEvent = lib.func('__stdcall', 'ContinueDebugEvent', 'int32_t', ['uint32_t', 'uint32_t', 'int32_t']);
// ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
// dwProcessId : DWORD -> 'uint32_t'
// dwThreadId : DWORD -> 'uint32_t'
// dwContinueStatus : NTSTATUS -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("KERNEL32.dll", {
ContinueDebugEvent: { parameters: ["u32", "u32", "i32"], result: "i32" },
});
// lib.symbols.ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
// dwProcessId : DWORD -> "u32"
// dwThreadId : DWORD -> "u32"
// dwContinueStatus : NTSTATUS -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ContinueDebugEvent(
uint32_t dwProcessId,
uint32_t dwThreadId,
int32_t dwContinueStatus);
C, "KERNEL32.dll");
// $ffi->ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus);
// dwProcessId : DWORD
// dwThreadId : DWORD
// dwContinueStatus : NTSTATUS
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Kernel32 extends StdCallLibrary {
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
boolean ContinueDebugEvent(
int dwProcessId, // DWORD
int dwThreadId, // DWORD
int dwContinueStatus // NTSTATUS
);
}@[Link("kernel32")]
lib LibKERNEL32
fun ContinueDebugEvent = ContinueDebugEvent(
dwProcessId : UInt32, # DWORD
dwThreadId : UInt32, # DWORD
dwContinueStatus : Int32 # NTSTATUS
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ContinueDebugEventNative = Int32 Function(Uint32, Uint32, Int32);
typedef ContinueDebugEventDart = int Function(int, int, int);
final ContinueDebugEvent = DynamicLibrary.open('KERNEL32.dll')
.lookupFunction<ContinueDebugEventNative, ContinueDebugEventDart>('ContinueDebugEvent');
// dwProcessId : DWORD -> Uint32
// dwThreadId : DWORD -> Uint32
// dwContinueStatus : NTSTATUS -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ContinueDebugEvent(
dwProcessId: DWORD; // DWORD
dwThreadId: DWORD; // DWORD
dwContinueStatus: Integer // NTSTATUS
): BOOL; stdcall;
external 'KERNEL32.dll' name 'ContinueDebugEvent';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ContinueDebugEvent"
c_ContinueDebugEvent :: Word32 -> Word32 -> Int32 -> IO CInt
-- dwProcessId : DWORD -> Word32
-- dwThreadId : DWORD -> Word32
-- dwContinueStatus : NTSTATUS -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let continuedebugevent =
foreign "ContinueDebugEvent"
(uint32_t @-> uint32_t @-> int32_t @-> returning int32_t)
(* dwProcessId : DWORD -> uint32_t *)
(* dwThreadId : DWORD -> uint32_t *)
(* dwContinueStatus : NTSTATUS -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)
(cffi:defcfun ("ContinueDebugEvent" continue-debug-event :convention :stdcall) :int32
(dw-process-id :uint32) ; DWORD
(dw-thread-id :uint32) ; DWORD
(dw-continue-status :int32)) ; NTSTATUS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ContinueDebugEvent = Win32::API::More->new('KERNEL32',
'BOOL ContinueDebugEvent(DWORD dwProcessId, DWORD dwThreadId, int dwContinueStatus)');
# my $ret = $ContinueDebugEvent->Call($dwProcessId, $dwThreadId, $dwContinueStatus);
# dwProcessId : DWORD -> DWORD
# dwThreadId : DWORD -> DWORD
# dwContinueStatus : NTSTATUS -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f CreateProcessW — 新しいプロセスとそのプライマリスレッドを作成する(Unicode版)。