ホーム › System.Com › CoImpersonateClient
CoImpersonateClient
関数サーバースレッドが呼び出し元クライアントに偽装する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT CoImpersonateClient(void);パラメーターなし。戻り値: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT CoImpersonateClient(void);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoImpersonateClient();<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoImpersonateClient() As Integer
End FunctionDeclare PtrSafe Function CoImpersonateClient Lib "ole32" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoImpersonateClient = ctypes.windll.ole32.CoImpersonateClient
CoImpersonateClient.restype = ctypes.c_int
CoImpersonateClient.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
CoImpersonateClient = Fiddle::Function.new(
lib['CoImpersonateClient'],
[],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CoImpersonateClient() -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int CoImpersonateClient();
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoImpersonateClient' -Namespace Win32 -PassThru
# $api::CoImpersonateClient()#uselib "OLE32.dll"
#func global CoImpersonateClient "CoImpersonateClient"
; CoImpersonateClient ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global CoImpersonateClient "CoImpersonateClient"
; res = CoImpersonateClient(); HRESULT CoImpersonateClient()
#uselib "OLE32.dll"
#cfunc global CoImpersonateClient "CoImpersonateClient"
; res = CoImpersonateClient()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procCoImpersonateClient = ole32.NewProc("CoImpersonateClient")
)
r1, _, err := procCoImpersonateClient.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CoImpersonateClient: Integer; stdcall;
external 'OLE32.dll' name 'CoImpersonateClient';result := DllCall("OLE32\CoImpersonateClient", "Int")●CoImpersonateClient() = DLL("OLE32.dll", "int CoImpersonateClient()")
# 呼び出し: CoImpersonateClient()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。