ホーム › System.Com › CoSetProxyBlanket
CoSetProxyBlanket
関数プロキシの認証情報や偽装レベルなどを設定する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT CoSetProxyBlanket(
IUnknown* pProxy,
DWORD dwAuthnSvc,
DWORD dwAuthzSvc,
LPWSTR pServerPrincName, // optional
RPC_C_AUTHN_LEVEL dwAuthnLevel,
RPC_C_IMP_LEVEL dwImpLevel,
void* pAuthInfo, // optional
DWORD dwCapabilities
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pProxy | IUnknown* | in |
| dwAuthnSvc | DWORD | in |
| dwAuthzSvc | DWORD | in |
| pServerPrincName | LPWSTR | inoptional |
| dwAuthnLevel | RPC_C_AUTHN_LEVEL | in |
| dwImpLevel | RPC_C_IMP_LEVEL | in |
| pAuthInfo | void* | inoptional |
| dwCapabilities | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT CoSetProxyBlanket(
IUnknown* pProxy,
DWORD dwAuthnSvc,
DWORD dwAuthzSvc,
LPWSTR pServerPrincName, // optional
RPC_C_AUTHN_LEVEL dwAuthnLevel,
RPC_C_IMP_LEVEL dwImpLevel,
void* pAuthInfo, // optional
DWORD dwCapabilities
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoSetProxyBlanket(
IntPtr pProxy, // IUnknown*
uint dwAuthnSvc, // DWORD
uint dwAuthzSvc, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pServerPrincName, // LPWSTR optional
uint dwAuthnLevel, // RPC_C_AUTHN_LEVEL
uint dwImpLevel, // RPC_C_IMP_LEVEL
IntPtr pAuthInfo, // void* optional
uint dwCapabilities // DWORD
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoSetProxyBlanket(
pProxy As IntPtr, ' IUnknown*
dwAuthnSvc As UInteger, ' DWORD
dwAuthzSvc As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pServerPrincName As String, ' LPWSTR optional
dwAuthnLevel As UInteger, ' RPC_C_AUTHN_LEVEL
dwImpLevel As UInteger, ' RPC_C_IMP_LEVEL
pAuthInfo As IntPtr, ' void* optional
dwCapabilities As UInteger ' DWORD
) As Integer
End Function' pProxy : IUnknown*
' dwAuthnSvc : DWORD
' dwAuthzSvc : DWORD
' pServerPrincName : LPWSTR optional
' dwAuthnLevel : RPC_C_AUTHN_LEVEL
' dwImpLevel : RPC_C_IMP_LEVEL
' pAuthInfo : void* optional
' dwCapabilities : DWORD
Declare PtrSafe Function CoSetProxyBlanket Lib "ole32" ( _
ByVal pProxy As LongPtr, _
ByVal dwAuthnSvc As Long, _
ByVal dwAuthzSvc As Long, _
ByVal pServerPrincName As LongPtr, _
ByVal dwAuthnLevel As Long, _
ByVal dwImpLevel As Long, _
ByVal pAuthInfo As LongPtr, _
ByVal dwCapabilities As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoSetProxyBlanket = ctypes.windll.ole32.CoSetProxyBlanket
CoSetProxyBlanket.restype = ctypes.c_int
CoSetProxyBlanket.argtypes = [
ctypes.c_void_p, # pProxy : IUnknown*
wintypes.DWORD, # dwAuthnSvc : DWORD
wintypes.DWORD, # dwAuthzSvc : DWORD
wintypes.LPCWSTR, # pServerPrincName : LPWSTR optional
wintypes.DWORD, # dwAuthnLevel : RPC_C_AUTHN_LEVEL
wintypes.DWORD, # dwImpLevel : RPC_C_IMP_LEVEL
ctypes.POINTER(None), # pAuthInfo : void* optional
wintypes.DWORD, # dwCapabilities : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
CoSetProxyBlanket = Fiddle::Function.new(
lib['CoSetProxyBlanket'],
[
Fiddle::TYPE_VOIDP, # pProxy : IUnknown*
-Fiddle::TYPE_INT, # dwAuthnSvc : DWORD
-Fiddle::TYPE_INT, # dwAuthzSvc : DWORD
Fiddle::TYPE_VOIDP, # pServerPrincName : LPWSTR optional
-Fiddle::TYPE_INT, # dwAuthnLevel : RPC_C_AUTHN_LEVEL
-Fiddle::TYPE_INT, # dwImpLevel : RPC_C_IMP_LEVEL
Fiddle::TYPE_VOIDP, # pAuthInfo : void* optional
-Fiddle::TYPE_INT, # dwCapabilities : DWORD
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CoSetProxyBlanket(
pProxy: *mut core::ffi::c_void, // IUnknown*
dwAuthnSvc: u32, // DWORD
dwAuthzSvc: u32, // DWORD
pServerPrincName: *mut u16, // LPWSTR optional
dwAuthnLevel: u32, // RPC_C_AUTHN_LEVEL
dwImpLevel: u32, // RPC_C_IMP_LEVEL
pAuthInfo: *mut (), // void* optional
dwCapabilities: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int CoSetProxyBlanket(IntPtr pProxy, uint dwAuthnSvc, uint dwAuthzSvc, [MarshalAs(UnmanagedType.LPWStr)] string pServerPrincName, uint dwAuthnLevel, uint dwImpLevel, IntPtr pAuthInfo, uint dwCapabilities);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoSetProxyBlanket' -Namespace Win32 -PassThru
# $api::CoSetProxyBlanket(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities)#uselib "OLE32.dll"
#func global CoSetProxyBlanket "CoSetProxyBlanket" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CoSetProxyBlanket pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities ; 戻り値は stat
; pProxy : IUnknown* -> "sptr"
; dwAuthnSvc : DWORD -> "sptr"
; dwAuthzSvc : DWORD -> "sptr"
; pServerPrincName : LPWSTR optional -> "sptr"
; dwAuthnLevel : RPC_C_AUTHN_LEVEL -> "sptr"
; dwImpLevel : RPC_C_IMP_LEVEL -> "sptr"
; pAuthInfo : void* optional -> "sptr"
; dwCapabilities : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global CoSetProxyBlanket "CoSetProxyBlanket" sptr, int, int, wstr, int, int, sptr, int
; res = CoSetProxyBlanket(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities)
; pProxy : IUnknown* -> "sptr"
; dwAuthnSvc : DWORD -> "int"
; dwAuthzSvc : DWORD -> "int"
; pServerPrincName : LPWSTR optional -> "wstr"
; dwAuthnLevel : RPC_C_AUTHN_LEVEL -> "int"
; dwImpLevel : RPC_C_IMP_LEVEL -> "int"
; pAuthInfo : void* optional -> "sptr"
; dwCapabilities : DWORD -> "int"; HRESULT CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, LPWSTR pServerPrincName, RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, void* pAuthInfo, DWORD dwCapabilities)
#uselib "OLE32.dll"
#cfunc global CoSetProxyBlanket "CoSetProxyBlanket" intptr, int, int, wstr, int, int, intptr, int
; res = CoSetProxyBlanket(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities)
; pProxy : IUnknown* -> "intptr"
; dwAuthnSvc : DWORD -> "int"
; dwAuthzSvc : DWORD -> "int"
; pServerPrincName : LPWSTR optional -> "wstr"
; dwAuthnLevel : RPC_C_AUTHN_LEVEL -> "int"
; dwImpLevel : RPC_C_IMP_LEVEL -> "int"
; pAuthInfo : void* optional -> "intptr"
; dwCapabilities : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procCoSetProxyBlanket = ole32.NewProc("CoSetProxyBlanket")
)
// pProxy (IUnknown*), dwAuthnSvc (DWORD), dwAuthzSvc (DWORD), pServerPrincName (LPWSTR optional), dwAuthnLevel (RPC_C_AUTHN_LEVEL), dwImpLevel (RPC_C_IMP_LEVEL), pAuthInfo (void* optional), dwCapabilities (DWORD)
r1, _, err := procCoSetProxyBlanket.Call(
uintptr(pProxy),
uintptr(dwAuthnSvc),
uintptr(dwAuthzSvc),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pServerPrincName))),
uintptr(dwAuthnLevel),
uintptr(dwImpLevel),
uintptr(pAuthInfo),
uintptr(dwCapabilities),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CoSetProxyBlanket(
pProxy: Pointer; // IUnknown*
dwAuthnSvc: DWORD; // DWORD
dwAuthzSvc: DWORD; // DWORD
pServerPrincName: PWideChar; // LPWSTR optional
dwAuthnLevel: DWORD; // RPC_C_AUTHN_LEVEL
dwImpLevel: DWORD; // RPC_C_IMP_LEVEL
pAuthInfo: Pointer; // void* optional
dwCapabilities: DWORD // DWORD
): Integer; stdcall;
external 'OLE32.dll' name 'CoSetProxyBlanket';result := DllCall("OLE32\CoSetProxyBlanket"
, "Ptr", pProxy ; IUnknown*
, "UInt", dwAuthnSvc ; DWORD
, "UInt", dwAuthzSvc ; DWORD
, "WStr", pServerPrincName ; LPWSTR optional
, "UInt", dwAuthnLevel ; RPC_C_AUTHN_LEVEL
, "UInt", dwImpLevel ; RPC_C_IMP_LEVEL
, "Ptr", pAuthInfo ; void* optional
, "UInt", dwCapabilities ; DWORD
, "Int") ; return: HRESULT●CoSetProxyBlanket(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities) = DLL("OLE32.dll", "int CoSetProxyBlanket(void*, dword, dword, char*, dword, dword, void*, dword)")
# 呼び出し: CoSetProxyBlanket(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities)
# pProxy : IUnknown* -> "void*"
# dwAuthnSvc : DWORD -> "dword"
# dwAuthzSvc : DWORD -> "dword"
# pServerPrincName : LPWSTR optional -> "char*"
# dwAuthnLevel : RPC_C_AUTHN_LEVEL -> "dword"
# dwImpLevel : RPC_C_IMP_LEVEL -> "dword"
# pAuthInfo : void* optional -> "void*"
# dwCapabilities : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。