Win32 API 日本語リファレンス
ホームSystem.ApplicationInstallationAndServicing › ZombifyActCtx

ZombifyActCtx

関数
アクティベーションコンテキストを無効化し新規使用を防ぐ。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL ZombifyActCtx(
    HANDLE hActCtx
);

パラメーター

名前方向
hActCtxHANDLEinout

戻り値の型: BOOL

各言語での呼び出し定義

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

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

ZombifyActCtx = ctypes.windll.kernel32.ZombifyActCtx
ZombifyActCtx.restype = wintypes.BOOL
ZombifyActCtx.argtypes = [
    wintypes.HANDLE,  # hActCtx : HANDLE in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
ZombifyActCtx = Fiddle::Function.new(
  lib['ZombifyActCtx'],
  [
    Fiddle::TYPE_VOIDP,  # hActCtx : HANDLE in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn ZombifyActCtx(
        hActCtx: *mut core::ffi::c_void  // HANDLE in/out
    ) -> 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 ZombifyActCtx(IntPtr hActCtx);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ZombifyActCtx' -Namespace Win32 -PassThru
# $api::ZombifyActCtx(hActCtx)
#uselib "KERNEL32.dll"
#func global ZombifyActCtx "ZombifyActCtx" sptr
; ZombifyActCtx hActCtx   ; 戻り値は stat
; hActCtx : HANDLE in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global ZombifyActCtx "ZombifyActCtx" sptr
; res = ZombifyActCtx(hActCtx)
; hActCtx : HANDLE in/out -> "sptr"
; BOOL ZombifyActCtx(HANDLE hActCtx)
#uselib "KERNEL32.dll"
#cfunc global ZombifyActCtx "ZombifyActCtx" intptr
; res = ZombifyActCtx(hActCtx)
; hActCtx : HANDLE in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procZombifyActCtx = kernel32.NewProc("ZombifyActCtx")
)

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