ホーム › System.Com › DcomChannelSetHResult
DcomChannelSetHResult
関数DCOMチャネルに対しアプリ固有のHRESULTを設定する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT DcomChannelSetHResult(
void* pvReserved, // optional
DWORD* pulReserved, // optional
HRESULT appsHR
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pvReserved | void* | inoptional | 予約済み。NULL を指定する。 |
| pulReserved | DWORD* | inoptional | 予約済み。NULL を指定する。 |
| appsHR | HRESULT | in | 現在の呼び出しに対して設定するアプリケーション固有の HRESULT 値。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT DcomChannelSetHResult(
void* pvReserved, // optional
DWORD* pulReserved, // optional
HRESULT appsHR
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int DcomChannelSetHResult(
IntPtr pvReserved, // void* optional
IntPtr pulReserved, // DWORD* optional
int appsHR // HRESULT
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function DcomChannelSetHResult(
pvReserved As IntPtr, ' void* optional
pulReserved As IntPtr, ' DWORD* optional
appsHR As Integer ' HRESULT
) As Integer
End Function' pvReserved : void* optional
' pulReserved : DWORD* optional
' appsHR : HRESULT
Declare PtrSafe Function DcomChannelSetHResult Lib "ole32" ( _
ByVal pvReserved As LongPtr, _
ByVal pulReserved As LongPtr, _
ByVal appsHR As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DcomChannelSetHResult = ctypes.windll.ole32.DcomChannelSetHResult
DcomChannelSetHResult.restype = ctypes.c_int
DcomChannelSetHResult.argtypes = [
ctypes.POINTER(None), # pvReserved : void* optional
ctypes.POINTER(wintypes.DWORD), # pulReserved : DWORD* optional
ctypes.c_int, # appsHR : HRESULT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
DcomChannelSetHResult = Fiddle::Function.new(
lib['DcomChannelSetHResult'],
[
Fiddle::TYPE_VOIDP, # pvReserved : void* optional
Fiddle::TYPE_VOIDP, # pulReserved : DWORD* optional
Fiddle::TYPE_INT, # appsHR : HRESULT
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn DcomChannelSetHResult(
pvReserved: *mut (), // void* optional
pulReserved: *mut u32, // DWORD* optional
appsHR: i32 // HRESULT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int DcomChannelSetHResult(IntPtr pvReserved, IntPtr pulReserved, int appsHR);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_DcomChannelSetHResult' -Namespace Win32 -PassThru
# $api::DcomChannelSetHResult(pvReserved, pulReserved, appsHR)#uselib "OLE32.dll"
#func global DcomChannelSetHResult "DcomChannelSetHResult" sptr, sptr, sptr
; DcomChannelSetHResult pvReserved, varptr(pulReserved), appsHR ; 戻り値は stat
; pvReserved : void* optional -> "sptr"
; pulReserved : DWORD* optional -> "sptr"
; appsHR : HRESULT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLE32.dll" #cfunc global DcomChannelSetHResult "DcomChannelSetHResult" sptr, var, int ; res = DcomChannelSetHResult(pvReserved, pulReserved, appsHR) ; pvReserved : void* optional -> "sptr" ; pulReserved : DWORD* optional -> "var" ; appsHR : HRESULT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLE32.dll" #cfunc global DcomChannelSetHResult "DcomChannelSetHResult" sptr, sptr, int ; res = DcomChannelSetHResult(pvReserved, varptr(pulReserved), appsHR) ; pvReserved : void* optional -> "sptr" ; pulReserved : DWORD* optional -> "sptr" ; appsHR : HRESULT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DcomChannelSetHResult(void* pvReserved, DWORD* pulReserved, HRESULT appsHR) #uselib "OLE32.dll" #cfunc global DcomChannelSetHResult "DcomChannelSetHResult" intptr, var, int ; res = DcomChannelSetHResult(pvReserved, pulReserved, appsHR) ; pvReserved : void* optional -> "intptr" ; pulReserved : DWORD* optional -> "var" ; appsHR : HRESULT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DcomChannelSetHResult(void* pvReserved, DWORD* pulReserved, HRESULT appsHR) #uselib "OLE32.dll" #cfunc global DcomChannelSetHResult "DcomChannelSetHResult" intptr, intptr, int ; res = DcomChannelSetHResult(pvReserved, varptr(pulReserved), appsHR) ; pvReserved : void* optional -> "intptr" ; pulReserved : DWORD* optional -> "intptr" ; appsHR : HRESULT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procDcomChannelSetHResult = ole32.NewProc("DcomChannelSetHResult")
)
// pvReserved (void* optional), pulReserved (DWORD* optional), appsHR (HRESULT)
r1, _, err := procDcomChannelSetHResult.Call(
uintptr(pvReserved),
uintptr(pulReserved),
uintptr(appsHR),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DcomChannelSetHResult(
pvReserved: Pointer; // void* optional
pulReserved: Pointer; // DWORD* optional
appsHR: Integer // HRESULT
): Integer; stdcall;
external 'OLE32.dll' name 'DcomChannelSetHResult';result := DllCall("OLE32\DcomChannelSetHResult"
, "Ptr", pvReserved ; void* optional
, "Ptr", pulReserved ; DWORD* optional
, "Int", appsHR ; HRESULT
, "Int") ; return: HRESULT●DcomChannelSetHResult(pvReserved, pulReserved, appsHR) = DLL("OLE32.dll", "int DcomChannelSetHResult(void*, void*, int)")
# 呼び出し: DcomChannelSetHResult(pvReserved, pulReserved, appsHR)
# pvReserved : void* optional -> "void*"
# pulReserved : DWORD* optional -> "void*"
# appsHR : HRESULT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ole32" fn DcomChannelSetHResult(
pvReserved: ?*anyopaque, // void* optional
pulReserved: [*c]u32, // DWORD* optional
appsHR: i32 // HRESULT
) callconv(std.os.windows.WINAPI) i32;proc DcomChannelSetHResult(
pvReserved: pointer, # void* optional
pulReserved: ptr uint32, # DWORD* optional
appsHR: int32 # HRESULT
): int32 {.importc: "DcomChannelSetHResult", stdcall, dynlib: "OLE32.dll".}pragma(lib, "ole32");
extern(Windows)
int DcomChannelSetHResult(
void* pvReserved, // void* optional
uint* pulReserved, // DWORD* optional
int appsHR // HRESULT
);ccall((:DcomChannelSetHResult, "OLE32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{UInt32}, Int32),
pvReserved, pulReserved, appsHR)
# pvReserved : void* optional -> Ptr{Cvoid}
# pulReserved : DWORD* optional -> Ptr{UInt32}
# appsHR : HRESULT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DcomChannelSetHResult(
void* pvReserved,
uint32_t* pulReserved,
int32_t appsHR);
]]
local ole32 = ffi.load("ole32")
-- ole32.DcomChannelSetHResult(pvReserved, pulReserved, appsHR)
-- pvReserved : void* optional
-- pulReserved : DWORD* optional
-- appsHR : HRESULT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLE32.dll');
const DcomChannelSetHResult = lib.func('__stdcall', 'DcomChannelSetHResult', 'int32_t', ['void *', 'uint32_t *', 'int32_t']);
// DcomChannelSetHResult(pvReserved, pulReserved, appsHR)
// pvReserved : void* optional -> 'void *'
// pulReserved : DWORD* optional -> 'uint32_t *'
// appsHR : HRESULT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLE32.dll", {
DcomChannelSetHResult: { parameters: ["pointer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.DcomChannelSetHResult(pvReserved, pulReserved, appsHR)
// pvReserved : void* optional -> "pointer"
// pulReserved : DWORD* optional -> "pointer"
// appsHR : HRESULT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DcomChannelSetHResult(
void* pvReserved,
uint32_t* pulReserved,
int32_t appsHR);
C, "OLE32.dll");
// $ffi->DcomChannelSetHResult(pvReserved, pulReserved, appsHR);
// pvReserved : void* optional
// pulReserved : DWORD* optional
// appsHR : HRESULT
// 構造体/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 Ole32 extends StdCallLibrary {
Ole32 INSTANCE = Native.load("ole32", Ole32.class);
int DcomChannelSetHResult(
Pointer pvReserved, // void* optional
IntByReference pulReserved, // DWORD* optional
int appsHR // HRESULT
);
}@[Link("ole32")]
lib LibOLE32
fun DcomChannelSetHResult = DcomChannelSetHResult(
pvReserved : Void*, # void* optional
pulReserved : UInt32*, # DWORD* optional
appsHR : Int32 # HRESULT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DcomChannelSetHResultNative = Int32 Function(Pointer<Void>, Pointer<Uint32>, Int32);
typedef DcomChannelSetHResultDart = int Function(Pointer<Void>, Pointer<Uint32>, int);
final DcomChannelSetHResult = DynamicLibrary.open('OLE32.dll')
.lookupFunction<DcomChannelSetHResultNative, DcomChannelSetHResultDart>('DcomChannelSetHResult');
// pvReserved : void* optional -> Pointer<Void>
// pulReserved : DWORD* optional -> Pointer<Uint32>
// appsHR : HRESULT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DcomChannelSetHResult(
pvReserved: Pointer; // void* optional
pulReserved: Pointer; // DWORD* optional
appsHR: Integer // HRESULT
): Integer; stdcall;
external 'OLE32.dll' name 'DcomChannelSetHResult';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DcomChannelSetHResult"
c_DcomChannelSetHResult :: Ptr () -> Ptr Word32 -> Int32 -> IO Int32
-- pvReserved : void* optional -> Ptr ()
-- pulReserved : DWORD* optional -> Ptr Word32
-- appsHR : HRESULT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dcomchannelsethresult =
foreign "DcomChannelSetHResult"
((ptr void) @-> (ptr uint32_t) @-> int32_t @-> returning int32_t)
(* pvReserved : void* optional -> (ptr void) *)
(* pulReserved : DWORD* optional -> (ptr uint32_t) *)
(* appsHR : HRESULT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ole32 (t "OLE32.dll"))
(cffi:use-foreign-library ole32)
(cffi:defcfun ("DcomChannelSetHResult" dcom-channel-set-hresult :convention :stdcall) :int32
(pv-reserved :pointer) ; void* optional
(pul-reserved :pointer) ; DWORD* optional
(apps-hr :int32)) ; HRESULT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DcomChannelSetHResult = Win32::API::More->new('OLE32',
'int DcomChannelSetHResult(LPVOID pvReserved, LPVOID pulReserved, int appsHR)');
# my $ret = $DcomChannelSetHResult->Call($pvReserved, $pulReserved, $appsHR);
# pvReserved : void* optional -> LPVOID
# pulReserved : DWORD* optional -> LPVOID
# appsHR : HRESULT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。