ホーム › Storage.FileHistory › FhServiceClosePipe
FhServiceClosePipe
関数ファイル履歴サービスの制御パイプを閉じる。
シグネチャ
// fhsvcctl.dll
#include <windows.h>
HRESULT FhServiceClosePipe(
FH_SERVICE_PIPE_HANDLE Pipe
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Pipe | FH_SERVICE_PIPE_HANDLE | in | 閉じる対象のファイル履歴サービスパイプハンドル。FhServiceOpenPipeで取得した値。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// fhsvcctl.dll
#include <windows.h>
HRESULT FhServiceClosePipe(
FH_SERVICE_PIPE_HANDLE Pipe
);[DllImport("fhsvcctl.dll", ExactSpelling = true)]
static extern int FhServiceClosePipe(
IntPtr Pipe // FH_SERVICE_PIPE_HANDLE
);<DllImport("fhsvcctl.dll", ExactSpelling:=True)>
Public Shared Function FhServiceClosePipe(
Pipe As IntPtr ' FH_SERVICE_PIPE_HANDLE
) As Integer
End Function' Pipe : FH_SERVICE_PIPE_HANDLE
Declare PtrSafe Function FhServiceClosePipe Lib "fhsvcctl" ( _
ByVal Pipe As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FhServiceClosePipe = ctypes.windll.fhsvcctl.FhServiceClosePipe
FhServiceClosePipe.restype = ctypes.c_int
FhServiceClosePipe.argtypes = [
wintypes.HANDLE, # Pipe : FH_SERVICE_PIPE_HANDLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('fhsvcctl.dll')
FhServiceClosePipe = Fiddle::Function.new(
lib['FhServiceClosePipe'],
[
Fiddle::TYPE_VOIDP, # Pipe : FH_SERVICE_PIPE_HANDLE
],
Fiddle::TYPE_INT)#[link(name = "fhsvcctl")]
extern "system" {
fn FhServiceClosePipe(
Pipe: *mut core::ffi::c_void // FH_SERVICE_PIPE_HANDLE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("fhsvcctl.dll")]
public static extern int FhServiceClosePipe(IntPtr Pipe);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fhsvcctl_FhServiceClosePipe' -Namespace Win32 -PassThru
# $api::FhServiceClosePipe(Pipe)#uselib "fhsvcctl.dll"
#func global FhServiceClosePipe "FhServiceClosePipe" sptr
; FhServiceClosePipe Pipe ; 戻り値は stat
; Pipe : FH_SERVICE_PIPE_HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "fhsvcctl.dll"
#cfunc global FhServiceClosePipe "FhServiceClosePipe" sptr
; res = FhServiceClosePipe(Pipe)
; Pipe : FH_SERVICE_PIPE_HANDLE -> "sptr"; HRESULT FhServiceClosePipe(FH_SERVICE_PIPE_HANDLE Pipe)
#uselib "fhsvcctl.dll"
#cfunc global FhServiceClosePipe "FhServiceClosePipe" intptr
; res = FhServiceClosePipe(Pipe)
; Pipe : FH_SERVICE_PIPE_HANDLE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
fhsvcctl = windows.NewLazySystemDLL("fhsvcctl.dll")
procFhServiceClosePipe = fhsvcctl.NewProc("FhServiceClosePipe")
)
// Pipe (FH_SERVICE_PIPE_HANDLE)
r1, _, err := procFhServiceClosePipe.Call(
uintptr(Pipe),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction FhServiceClosePipe(
Pipe: THandle // FH_SERVICE_PIPE_HANDLE
): Integer; stdcall;
external 'fhsvcctl.dll' name 'FhServiceClosePipe';result := DllCall("fhsvcctl\FhServiceClosePipe"
, "Ptr", Pipe ; FH_SERVICE_PIPE_HANDLE
, "Int") ; return: HRESULT●FhServiceClosePipe(Pipe) = DLL("fhsvcctl.dll", "int FhServiceClosePipe(void*)")
# 呼び出し: FhServiceClosePipe(Pipe)
# Pipe : FH_SERVICE_PIPE_HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "fhsvcctl" fn FhServiceClosePipe(
Pipe: ?*anyopaque // FH_SERVICE_PIPE_HANDLE
) callconv(std.os.windows.WINAPI) i32;proc FhServiceClosePipe(
Pipe: pointer # FH_SERVICE_PIPE_HANDLE
): int32 {.importc: "FhServiceClosePipe", stdcall, dynlib: "fhsvcctl.dll".}pragma(lib, "fhsvcctl");
extern(Windows)
int FhServiceClosePipe(
void* Pipe // FH_SERVICE_PIPE_HANDLE
);ccall((:FhServiceClosePipe, "fhsvcctl.dll"), stdcall, Int32,
(Ptr{Cvoid},),
Pipe)
# Pipe : FH_SERVICE_PIPE_HANDLE -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t FhServiceClosePipe(
void* Pipe);
]]
local fhsvcctl = ffi.load("fhsvcctl")
-- fhsvcctl.FhServiceClosePipe(Pipe)
-- Pipe : FH_SERVICE_PIPE_HANDLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('fhsvcctl.dll');
const FhServiceClosePipe = lib.func('__stdcall', 'FhServiceClosePipe', 'int32_t', ['void *']);
// FhServiceClosePipe(Pipe)
// Pipe : FH_SERVICE_PIPE_HANDLE -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("fhsvcctl.dll", {
FhServiceClosePipe: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.FhServiceClosePipe(Pipe)
// Pipe : FH_SERVICE_PIPE_HANDLE -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FhServiceClosePipe(
void* Pipe);
C, "fhsvcctl.dll");
// $ffi->FhServiceClosePipe(Pipe);
// Pipe : FH_SERVICE_PIPE_HANDLE
// 構造体/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 Fhsvcctl extends StdCallLibrary {
Fhsvcctl INSTANCE = Native.load("fhsvcctl", Fhsvcctl.class);
int FhServiceClosePipe(
Pointer Pipe // FH_SERVICE_PIPE_HANDLE
);
}@[Link("fhsvcctl")]
lib Libfhsvcctl
fun FhServiceClosePipe = FhServiceClosePipe(
Pipe : Void* # FH_SERVICE_PIPE_HANDLE
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FhServiceClosePipeNative = Int32 Function(Pointer<Void>);
typedef FhServiceClosePipeDart = int Function(Pointer<Void>);
final FhServiceClosePipe = DynamicLibrary.open('fhsvcctl.dll')
.lookupFunction<FhServiceClosePipeNative, FhServiceClosePipeDart>('FhServiceClosePipe');
// Pipe : FH_SERVICE_PIPE_HANDLE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FhServiceClosePipe(
Pipe: THandle // FH_SERVICE_PIPE_HANDLE
): Integer; stdcall;
external 'fhsvcctl.dll' name 'FhServiceClosePipe';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FhServiceClosePipe"
c_FhServiceClosePipe :: Ptr () -> IO Int32
-- Pipe : FH_SERVICE_PIPE_HANDLE -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let fhserviceclosepipe =
foreign "FhServiceClosePipe"
((ptr void) @-> returning int32_t)
(* Pipe : FH_SERVICE_PIPE_HANDLE -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library fhsvcctl (t "fhsvcctl.dll"))
(cffi:use-foreign-library fhsvcctl)
(cffi:defcfun ("FhServiceClosePipe" fh-service-close-pipe :convention :stdcall) :int32
(pipe :pointer)) ; FH_SERVICE_PIPE_HANDLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FhServiceClosePipe = Win32::API::More->new('fhsvcctl',
'int FhServiceClosePipe(HANDLE Pipe)');
# my $ret = $FhServiceClosePipe->Call($Pipe);
# Pipe : FH_SERVICE_PIPE_HANDLE -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。