Win32 API 日本語リファレンス
ホームGlobalization › MappingFreeServices

MappingFreeServices

関数
MappingGetServicesで取得したサービス情報を解放する。
DLLelscore.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT MappingFreeServices(
    MAPPING_SERVICE_INFO* pServiceInfo
);

パラメーター

名前方向説明
pServiceInfoMAPPING_SERVICE_INFO*in先行する MappingGetServices の呼び出しによって取得されたサービス記述を含む MAPPING_SERVICE_INFO 構造体の配列へのポインターです。このパラメーターを NULL に設定することはできません。

戻り値の型: HRESULT

公式ドキュメント

アプリケーションが 1 つ以上の ELS サービスとやり取りするために割り当てられたメモリとリソースを解放します。これらのメモリとリソースは、アプリケーションが MappingGetServices を呼び出した際に割り当てられたものです。

戻り値

成功した場合は S_OK を返します。成功しなかった場合、この関数はエラーを示す HRESULT 値を返します。

解説(Remarks)

注意 サービスを解放する前に、それらのサービスによって生成されたプロパティ バッグを先に解放する必要があります。
現在、すべてのサービスはアプリケーション プロセス内で実行されるため、サービスが解放されても ELS プラットフォームはサービス DLL をアンロードしません。オペレーティング システムは、アプリケーションが終了した時点で自動的に DLL をアンロードします。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

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

MappingFreeServices = ctypes.windll.elscore.MappingFreeServices
MappingFreeServices.restype = ctypes.c_int
MappingFreeServices.argtypes = [
    ctypes.c_void_p,  # pServiceInfo : MAPPING_SERVICE_INFO*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('elscore.dll')
MappingFreeServices = Fiddle::Function.new(
  lib['MappingFreeServices'],
  [
    Fiddle::TYPE_VOIDP,  # pServiceInfo : MAPPING_SERVICE_INFO*
  ],
  Fiddle::TYPE_INT)
#[link(name = "elscore")]
extern "system" {
    fn MappingFreeServices(
        pServiceInfo: *mut MAPPING_SERVICE_INFO  // MAPPING_SERVICE_INFO*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("elscore.dll")]
public static extern int MappingFreeServices(IntPtr pServiceInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'elscore_MappingFreeServices' -Namespace Win32 -PassThru
# $api::MappingFreeServices(pServiceInfo)
#uselib "elscore.dll"
#func global MappingFreeServices "MappingFreeServices" sptr
; MappingFreeServices varptr(pServiceInfo)   ; 戻り値は stat
; pServiceInfo : MAPPING_SERVICE_INFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "elscore.dll"
#cfunc global MappingFreeServices "MappingFreeServices" var
; res = MappingFreeServices(pServiceInfo)
; pServiceInfo : MAPPING_SERVICE_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MappingFreeServices(MAPPING_SERVICE_INFO* pServiceInfo)
#uselib "elscore.dll"
#cfunc global MappingFreeServices "MappingFreeServices" var
; res = MappingFreeServices(pServiceInfo)
; pServiceInfo : MAPPING_SERVICE_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	elscore = windows.NewLazySystemDLL("elscore.dll")
	procMappingFreeServices = elscore.NewProc("MappingFreeServices")
)

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

extern "elscore" fn MappingFreeServices(
    pServiceInfo: [*c]MAPPING_SERVICE_INFO // MAPPING_SERVICE_INFO*
) callconv(std.os.windows.WINAPI) i32;
proc MappingFreeServices(
    pServiceInfo: ptr MAPPING_SERVICE_INFO  # MAPPING_SERVICE_INFO*
): int32 {.importc: "MappingFreeServices", stdcall, dynlib: "elscore.dll".}
pragma(lib, "elscore");
extern(Windows)
int MappingFreeServices(
    MAPPING_SERVICE_INFO* pServiceInfo   // MAPPING_SERVICE_INFO*
);
ccall((:MappingFreeServices, "elscore.dll"), stdcall, Int32,
      (Ptr{MAPPING_SERVICE_INFO},),
      pServiceInfo)
# pServiceInfo : MAPPING_SERVICE_INFO* -> Ptr{MAPPING_SERVICE_INFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MappingFreeServices(
    void* pServiceInfo);
]]
local elscore = ffi.load("elscore")
-- elscore.MappingFreeServices(pServiceInfo)
-- pServiceInfo : MAPPING_SERVICE_INFO*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('elscore.dll');
const MappingFreeServices = lib.func('__stdcall', 'MappingFreeServices', 'int32_t', ['void *']);
// MappingFreeServices(pServiceInfo)
// pServiceInfo : MAPPING_SERVICE_INFO* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("elscore.dll", {
  MappingFreeServices: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.MappingFreeServices(pServiceInfo)
// pServiceInfo : MAPPING_SERVICE_INFO* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MappingFreeServices(
    void* pServiceInfo);
C, "elscore.dll");
// $ffi->MappingFreeServices(pServiceInfo);
// pServiceInfo : MAPPING_SERVICE_INFO*
// 構造体/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 Elscore extends StdCallLibrary {
    Elscore INSTANCE = Native.load("elscore", Elscore.class);
    int MappingFreeServices(
        Pointer pServiceInfo   // MAPPING_SERVICE_INFO*
    );
}
@[Link("elscore")]
lib Libelscore
  fun MappingFreeServices = MappingFreeServices(
    pServiceInfo : MAPPING_SERVICE_INFO*   # MAPPING_SERVICE_INFO*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MappingFreeServicesNative = Int32 Function(Pointer<Void>);
typedef MappingFreeServicesDart = int Function(Pointer<Void>);
final MappingFreeServices = DynamicLibrary.open('elscore.dll')
    .lookupFunction<MappingFreeServicesNative, MappingFreeServicesDart>('MappingFreeServices');
// pServiceInfo : MAPPING_SERVICE_INFO* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MappingFreeServices(
  pServiceInfo: Pointer   // MAPPING_SERVICE_INFO*
): Integer; stdcall;
  external 'elscore.dll' name 'MappingFreeServices';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MappingFreeServices"
  c_MappingFreeServices :: Ptr () -> IO Int32
-- pServiceInfo : MAPPING_SERVICE_INFO* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mappingfreeservices =
  foreign "MappingFreeServices"
    ((ptr void) @-> returning int32_t)
(* pServiceInfo : MAPPING_SERVICE_INFO* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library elscore (t "elscore.dll"))
(cffi:use-foreign-library elscore)

(cffi:defcfun ("MappingFreeServices" mapping-free-services :convention :stdcall) :int32
  (p-service-info :pointer))   ; MAPPING_SERVICE_INFO*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MappingFreeServices = Win32::API::More->new('elscore',
    'int MappingFreeServices(LPVOID pServiceInfo)');
# my $ret = $MappingFreeServices->Call($pServiceInfo);
# pServiceInfo : MAPPING_SERVICE_INFO* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型