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

FhServiceOpenPipe

関数
ファイル履歴サービスへの制御パイプを開く。
DLLfhsvcctl.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT FhServiceOpenPipe(
    BOOL StartServiceIfStopped,
    FH_SERVICE_PIPE_HANDLE* Pipe
);

パラメーター

名前方向
StartServiceIfStoppedBOOLin
PipeFH_SERVICE_PIPE_HANDLE*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT FhServiceOpenPipe(
    BOOL StartServiceIfStopped,
    FH_SERVICE_PIPE_HANDLE* Pipe
);
[DllImport("fhsvcctl.dll", ExactSpelling = true)]
static extern int FhServiceOpenPipe(
    bool StartServiceIfStopped,   // BOOL
    IntPtr Pipe   // FH_SERVICE_PIPE_HANDLE* out
);
<DllImport("fhsvcctl.dll", ExactSpelling:=True)>
Public Shared Function FhServiceOpenPipe(
    StartServiceIfStopped As Boolean,   ' BOOL
    Pipe As IntPtr   ' FH_SERVICE_PIPE_HANDLE* out
) As Integer
End Function
' StartServiceIfStopped : BOOL
' Pipe : FH_SERVICE_PIPE_HANDLE* out
Declare PtrSafe Function FhServiceOpenPipe Lib "fhsvcctl" ( _
    ByVal StartServiceIfStopped As Long, _
    ByVal Pipe As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FhServiceOpenPipe = ctypes.windll.fhsvcctl.FhServiceOpenPipe
FhServiceOpenPipe.restype = ctypes.c_int
FhServiceOpenPipe.argtypes = [
    wintypes.BOOL,  # StartServiceIfStopped : BOOL
    ctypes.c_void_p,  # Pipe : FH_SERVICE_PIPE_HANDLE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('fhsvcctl.dll')
FhServiceOpenPipe = Fiddle::Function.new(
  lib['FhServiceOpenPipe'],
  [
    Fiddle::TYPE_INT,  # StartServiceIfStopped : BOOL
    Fiddle::TYPE_VOIDP,  # Pipe : FH_SERVICE_PIPE_HANDLE* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "fhsvcctl")]
extern "system" {
    fn FhServiceOpenPipe(
        StartServiceIfStopped: i32,  // BOOL
        Pipe: *mut *mut core::ffi::c_void  // FH_SERVICE_PIPE_HANDLE* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("fhsvcctl.dll")]
public static extern int FhServiceOpenPipe(bool StartServiceIfStopped, IntPtr Pipe);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fhsvcctl_FhServiceOpenPipe' -Namespace Win32 -PassThru
# $api::FhServiceOpenPipe(StartServiceIfStopped, Pipe)
#uselib "fhsvcctl.dll"
#func global FhServiceOpenPipe "FhServiceOpenPipe" sptr, sptr
; FhServiceOpenPipe StartServiceIfStopped, Pipe   ; 戻り値は stat
; StartServiceIfStopped : BOOL -> "sptr"
; Pipe : FH_SERVICE_PIPE_HANDLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "fhsvcctl.dll"
#cfunc global FhServiceOpenPipe "FhServiceOpenPipe" int, sptr
; res = FhServiceOpenPipe(StartServiceIfStopped, Pipe)
; StartServiceIfStopped : BOOL -> "int"
; Pipe : FH_SERVICE_PIPE_HANDLE* out -> "sptr"
; HRESULT FhServiceOpenPipe(BOOL StartServiceIfStopped, FH_SERVICE_PIPE_HANDLE* Pipe)
#uselib "fhsvcctl.dll"
#cfunc global FhServiceOpenPipe "FhServiceOpenPipe" int, intptr
; res = FhServiceOpenPipe(StartServiceIfStopped, Pipe)
; StartServiceIfStopped : BOOL -> "int"
; Pipe : FH_SERVICE_PIPE_HANDLE* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	fhsvcctl = windows.NewLazySystemDLL("fhsvcctl.dll")
	procFhServiceOpenPipe = fhsvcctl.NewProc("FhServiceOpenPipe")
)

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