Win32 API 日本語リファレンス
ホームStorage.OperationRecorder › OperationEnd

OperationEnd

関数
プリフェッチ最適化用に操作記録の終了を通知する。
DLLADVAPI32.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

BOOL OperationEnd(
    OPERATION_END_PARAMETERS* OperationEndParams
);

パラメーター

名前方向説明
OperationEndParamsOPERATION_END_PARAMETERS*in記録するI/O操作の終了情報を格納したOPERATION_END_PARAMETERS構造体へのポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

OperationEnd = ctypes.windll.advapi32.OperationEnd
OperationEnd.restype = wintypes.BOOL
OperationEnd.argtypes = [
    ctypes.c_void_p,  # OperationEndParams : OPERATION_END_PARAMETERS*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
OperationEnd = Fiddle::Function.new(
  lib['OperationEnd'],
  [
    Fiddle::TYPE_VOIDP,  # OperationEndParams : OPERATION_END_PARAMETERS*
  ],
  Fiddle::TYPE_INT)
#[link(name = "advapi32")]
extern "system" {
    fn OperationEnd(
        OperationEndParams: *mut OPERATION_END_PARAMETERS  // OPERATION_END_PARAMETERS*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll")]
public static extern bool OperationEnd(IntPtr OperationEndParams);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_OperationEnd' -Namespace Win32 -PassThru
# $api::OperationEnd(OperationEndParams)
#uselib "ADVAPI32.dll"
#func global OperationEnd "OperationEnd" sptr
; OperationEnd varptr(OperationEndParams)   ; 戻り値は stat
; OperationEndParams : OPERATION_END_PARAMETERS* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ADVAPI32.dll"
#cfunc global OperationEnd "OperationEnd" var
; res = OperationEnd(OperationEndParams)
; OperationEndParams : OPERATION_END_PARAMETERS* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL OperationEnd(OPERATION_END_PARAMETERS* OperationEndParams)
#uselib "ADVAPI32.dll"
#cfunc global OperationEnd "OperationEnd" var
; res = OperationEnd(OperationEndParams)
; OperationEndParams : OPERATION_END_PARAMETERS* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procOperationEnd = advapi32.NewProc("OperationEnd")
)

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

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

typedef OperationEndNative = Int32 Function(Pointer<Void>);
typedef OperationEndDart = int Function(Pointer<Void>);
final OperationEnd = DynamicLibrary.open('ADVAPI32.dll')
    .lookupFunction<OperationEndNative, OperationEndDart>('OperationEnd');
// OperationEndParams : OPERATION_END_PARAMETERS* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function OperationEnd(
  OperationEndParams: Pointer   // OPERATION_END_PARAMETERS*
): BOOL; stdcall;
  external 'ADVAPI32.dll' name 'OperationEnd';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "OperationEnd"
  c_OperationEnd :: Ptr () -> IO CInt
-- OperationEndParams : OPERATION_END_PARAMETERS* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let operationend =
  foreign "OperationEnd"
    ((ptr void) @-> returning int32_t)
(* OperationEndParams : OPERATION_END_PARAMETERS* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library advapi32 (t "ADVAPI32.dll"))
(cffi:use-foreign-library advapi32)

(cffi:defcfun ("OperationEnd" operation-end :convention :stdcall) :int32
  (operation-end-params :pointer))   ; OPERATION_END_PARAMETERS*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $OperationEnd = Win32::API::More->new('ADVAPI32',
    'BOOL OperationEnd(LPVOID OperationEndParams)');
# my $ret = $OperationEnd->Call($OperationEndParams);
# OperationEndParams : OPERATION_END_PARAMETERS* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型