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