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

PssWalkMarkerCreate

関数
スナップショット走査用のウォークマーカーを作成する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

DWORD PssWalkMarkerCreate(
    const PSS_ALLOCATOR* Allocator,   // optional
    HPSSWALK* WalkMarkerHandle
);

パラメーター

名前方向説明
AllocatorPSS_ALLOCATOR*inoptionalメモリ確保/解放に使うカスタムアロケータを指すPSS_ALLOCATORへのポインタ。既定の場合はNULL可。
WalkMarkerHandleHPSSWALK*out作成された走査マーカーのHPSSWALKハンドルを受け取るポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PssWalkMarkerCreate(
    const PSS_ALLOCATOR* Allocator,   // optional
    HPSSWALK* WalkMarkerHandle
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint PssWalkMarkerCreate(
    IntPtr Allocator,   // PSS_ALLOCATOR* optional
    IntPtr WalkMarkerHandle   // HPSSWALK* out
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function PssWalkMarkerCreate(
    Allocator As IntPtr,   ' PSS_ALLOCATOR* optional
    WalkMarkerHandle As IntPtr   ' HPSSWALK* out
) As UInteger
End Function
' Allocator : PSS_ALLOCATOR* optional
' WalkMarkerHandle : HPSSWALK* out
Declare PtrSafe Function PssWalkMarkerCreate Lib "kernel32" ( _
    ByVal Allocator As LongPtr, _
    ByVal WalkMarkerHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PssWalkMarkerCreate = ctypes.windll.kernel32.PssWalkMarkerCreate
PssWalkMarkerCreate.restype = wintypes.DWORD
PssWalkMarkerCreate.argtypes = [
    ctypes.c_void_p,  # Allocator : PSS_ALLOCATOR* optional
    ctypes.c_void_p,  # WalkMarkerHandle : HPSSWALK* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
PssWalkMarkerCreate = Fiddle::Function.new(
  lib['PssWalkMarkerCreate'],
  [
    Fiddle::TYPE_VOIDP,  # Allocator : PSS_ALLOCATOR* optional
    Fiddle::TYPE_VOIDP,  # WalkMarkerHandle : HPSSWALK* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn PssWalkMarkerCreate(
        Allocator: *const PSS_ALLOCATOR,  // PSS_ALLOCATOR* optional
        WalkMarkerHandle: *mut *mut core::ffi::c_void  // HPSSWALK* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint PssWalkMarkerCreate(IntPtr Allocator, IntPtr WalkMarkerHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_PssWalkMarkerCreate' -Namespace Win32 -PassThru
# $api::PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
#uselib "KERNEL32.dll"
#func global PssWalkMarkerCreate "PssWalkMarkerCreate" sptr, sptr
; PssWalkMarkerCreate varptr(Allocator), WalkMarkerHandle   ; 戻り値は stat
; Allocator : PSS_ALLOCATOR* optional -> "sptr"
; WalkMarkerHandle : HPSSWALK* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "KERNEL32.dll"
#cfunc global PssWalkMarkerCreate "PssWalkMarkerCreate" var, sptr
; res = PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
; Allocator : PSS_ALLOCATOR* optional -> "var"
; WalkMarkerHandle : HPSSWALK* out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD PssWalkMarkerCreate(PSS_ALLOCATOR* Allocator, HPSSWALK* WalkMarkerHandle)
#uselib "KERNEL32.dll"
#cfunc global PssWalkMarkerCreate "PssWalkMarkerCreate" var, intptr
; res = PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
; Allocator : PSS_ALLOCATOR* optional -> "var"
; WalkMarkerHandle : HPSSWALK* out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procPssWalkMarkerCreate = kernel32.NewProc("PssWalkMarkerCreate")
)

// Allocator (PSS_ALLOCATOR* optional), WalkMarkerHandle (HPSSWALK* out)
r1, _, err := procPssWalkMarkerCreate.Call(
	uintptr(Allocator),
	uintptr(WalkMarkerHandle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PssWalkMarkerCreate(
  Allocator: Pointer;   // PSS_ALLOCATOR* optional
  WalkMarkerHandle: Pointer   // HPSSWALK* out
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'PssWalkMarkerCreate';
result := DllCall("KERNEL32\PssWalkMarkerCreate"
    , "Ptr", Allocator   ; PSS_ALLOCATOR* optional
    , "Ptr", WalkMarkerHandle   ; HPSSWALK* out
    , "UInt")   ; return: DWORD
●PssWalkMarkerCreate(Allocator, WalkMarkerHandle) = DLL("KERNEL32.dll", "dword PssWalkMarkerCreate(void*, void*)")
# 呼び出し: PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
# Allocator : PSS_ALLOCATOR* optional -> "void*"
# WalkMarkerHandle : HPSSWALK* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "kernel32" fn PssWalkMarkerCreate(
    Allocator: [*c]PSS_ALLOCATOR, // PSS_ALLOCATOR* optional
    WalkMarkerHandle: ?*anyopaque // HPSSWALK* out
) callconv(std.os.windows.WINAPI) u32;
proc PssWalkMarkerCreate(
    Allocator: ptr PSS_ALLOCATOR,  # PSS_ALLOCATOR* optional
    WalkMarkerHandle: pointer  # HPSSWALK* out
): uint32 {.importc: "PssWalkMarkerCreate", stdcall, dynlib: "KERNEL32.dll".}
pragma(lib, "kernel32");
extern(Windows)
uint PssWalkMarkerCreate(
    PSS_ALLOCATOR* Allocator,   // PSS_ALLOCATOR* optional
    void* WalkMarkerHandle   // HPSSWALK* out
);
ccall((:PssWalkMarkerCreate, "KERNEL32.dll"), stdcall, UInt32,
      (Ptr{PSS_ALLOCATOR}, Ptr{Cvoid}),
      Allocator, WalkMarkerHandle)
# Allocator : PSS_ALLOCATOR* optional -> Ptr{PSS_ALLOCATOR}
# WalkMarkerHandle : HPSSWALK* out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t PssWalkMarkerCreate(
    void* Allocator,
    void* WalkMarkerHandle);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
-- Allocator : PSS_ALLOCATOR* optional
-- WalkMarkerHandle : HPSSWALK* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const PssWalkMarkerCreate = lib.func('__stdcall', 'PssWalkMarkerCreate', 'uint32_t', ['void *', 'void *']);
// PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
// Allocator : PSS_ALLOCATOR* optional -> 'void *'
// WalkMarkerHandle : HPSSWALK* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("KERNEL32.dll", {
  PssWalkMarkerCreate: { parameters: ["pointer", "pointer"], result: "u32" },
});
// lib.symbols.PssWalkMarkerCreate(Allocator, WalkMarkerHandle)
// Allocator : PSS_ALLOCATOR* optional -> "pointer"
// WalkMarkerHandle : HPSSWALK* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t PssWalkMarkerCreate(
    void* Allocator,
    void* WalkMarkerHandle);
C, "KERNEL32.dll");
// $ffi->PssWalkMarkerCreate(Allocator, WalkMarkerHandle);
// Allocator : PSS_ALLOCATOR* optional
// WalkMarkerHandle : HPSSWALK* out
// 構造体/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);
    int PssWalkMarkerCreate(
        Pointer Allocator,   // PSS_ALLOCATOR* optional
        Pointer WalkMarkerHandle   // HPSSWALK* out
    );
}
@[Link("kernel32")]
lib LibKERNEL32
  fun PssWalkMarkerCreate = PssWalkMarkerCreate(
    Allocator : PSS_ALLOCATOR*,   # PSS_ALLOCATOR* optional
    WalkMarkerHandle : Void*   # HPSSWALK* out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PssWalkMarkerCreateNative = Uint32 Function(Pointer<Void>, Pointer<Void>);
typedef PssWalkMarkerCreateDart = int Function(Pointer<Void>, Pointer<Void>);
final PssWalkMarkerCreate = DynamicLibrary.open('KERNEL32.dll')
    .lookupFunction<PssWalkMarkerCreateNative, PssWalkMarkerCreateDart>('PssWalkMarkerCreate');
// Allocator : PSS_ALLOCATOR* optional -> Pointer<Void>
// WalkMarkerHandle : HPSSWALK* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PssWalkMarkerCreate(
  Allocator: Pointer;   // PSS_ALLOCATOR* optional
  WalkMarkerHandle: Pointer   // HPSSWALK* out
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'PssWalkMarkerCreate';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PssWalkMarkerCreate"
  c_PssWalkMarkerCreate :: Ptr () -> Ptr () -> IO Word32
-- Allocator : PSS_ALLOCATOR* optional -> Ptr ()
-- WalkMarkerHandle : HPSSWALK* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let psswalkmarkercreate =
  foreign "PssWalkMarkerCreate"
    ((ptr void) @-> (ptr void) @-> returning uint32_t)
(* Allocator : PSS_ALLOCATOR* optional -> (ptr void) *)
(* WalkMarkerHandle : HPSSWALK* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)

(cffi:defcfun ("PssWalkMarkerCreate" pss-walk-marker-create :convention :stdcall) :uint32
  (allocator :pointer)   ; PSS_ALLOCATOR* optional
  (walk-marker-handle :pointer))   ; HPSSWALK* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PssWalkMarkerCreate = Win32::API::More->new('KERNEL32',
    'DWORD PssWalkMarkerCreate(LPVOID Allocator, HANDLE WalkMarkerHandle)');
# my $ret = $PssWalkMarkerCreate->Call($Allocator, $WalkMarkerHandle);
# Allocator : PSS_ALLOCATOR* optional -> LPVOID
# WalkMarkerHandle : HPSSWALK* out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型