ホーム › System.Ole › UnRegisterTypeLib
UnRegisterTypeLib
関数指定したタイプライブラリの登録をシステムレジストリから削除する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT UnRegisterTypeLib(
const GUID* libID,
WORD wVerMajor,
WORD wVerMinor,
DWORD lcid,
SYSKIND syskind
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| libID | GUID* | in | タイプライブラリの GUID です。 |
| wVerMajor | WORD | in | タイプライブラリのメジャーバージョンです。 |
| wVerMinor | WORD | in | タイプライブラリのマイナーバージョンです。 |
| lcid | DWORD | in | ロケール識別子です。 |
| syskind | SYSKIND | in | 対象のオペレーティングシステムです。 |
戻り値の型: HRESULT
公式ドキュメント
システムレジストリからタイプライブラリ情報を削除します。アプリケーションが自身を正しくアンインストールできるようにするには、この API を使用します。
戻り値
この関数は次の値のいずれかを返すことがあります。
| 戻り値 | 説明 |
|---|---|
| 成功しました。 | |
| 1 つ以上の引数が無効です。 | |
| 操作を完了するためのメモリが不足しています。 | |
| 関数がファイルに書き込めませんでした。 | |
| システムの登録データベースを開けませんでした。 | |
| タイプライブラリを開けませんでした。 |
解説(Remarks)
インプロセスオブジェクトは通常、この API を DllUnregisterServer から呼び出します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT UnRegisterTypeLib(
const GUID* libID,
WORD wVerMajor,
WORD wVerMinor,
DWORD lcid,
SYSKIND syskind
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int UnRegisterTypeLib(
ref Guid libID, // GUID*
ushort wVerMajor, // WORD
ushort wVerMinor, // WORD
uint lcid, // DWORD
int syskind // SYSKIND
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function UnRegisterTypeLib(
ByRef libID As Guid, ' GUID*
wVerMajor As UShort, ' WORD
wVerMinor As UShort, ' WORD
lcid As UInteger, ' DWORD
syskind As Integer ' SYSKIND
) As Integer
End Function' libID : GUID*
' wVerMajor : WORD
' wVerMinor : WORD
' lcid : DWORD
' syskind : SYSKIND
Declare PtrSafe Function UnRegisterTypeLib Lib "oleaut32" ( _
ByVal libID As LongPtr, _
ByVal wVerMajor As Integer, _
ByVal wVerMinor As Integer, _
ByVal lcid As Long, _
ByVal syskind As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UnRegisterTypeLib = ctypes.windll.oleaut32.UnRegisterTypeLib
UnRegisterTypeLib.restype = ctypes.c_int
UnRegisterTypeLib.argtypes = [
ctypes.c_void_p, # libID : GUID*
ctypes.c_ushort, # wVerMajor : WORD
ctypes.c_ushort, # wVerMinor : WORD
wintypes.DWORD, # lcid : DWORD
ctypes.c_int, # syskind : SYSKIND
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
UnRegisterTypeLib = Fiddle::Function.new(
lib['UnRegisterTypeLib'],
[
Fiddle::TYPE_VOIDP, # libID : GUID*
-Fiddle::TYPE_SHORT, # wVerMajor : WORD
-Fiddle::TYPE_SHORT, # wVerMinor : WORD
-Fiddle::TYPE_INT, # lcid : DWORD
Fiddle::TYPE_INT, # syskind : SYSKIND
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn UnRegisterTypeLib(
libID: *const GUID, // GUID*
wVerMajor: u16, // WORD
wVerMinor: u16, // WORD
lcid: u32, // DWORD
syskind: i32 // SYSKIND
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int UnRegisterTypeLib(ref Guid libID, ushort wVerMajor, ushort wVerMinor, uint lcid, int syskind);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_UnRegisterTypeLib' -Namespace Win32 -PassThru
# $api::UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind)#uselib "OLEAUT32.dll"
#func global UnRegisterTypeLib "UnRegisterTypeLib" sptr, sptr, sptr, sptr, sptr
; UnRegisterTypeLib varptr(libID), wVerMajor, wVerMinor, lcid, syskind ; 戻り値は stat
; libID : GUID* -> "sptr"
; wVerMajor : WORD -> "sptr"
; wVerMinor : WORD -> "sptr"
; lcid : DWORD -> "sptr"
; syskind : SYSKIND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLib "UnRegisterTypeLib" var, int, int, int, int ; res = UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind) ; libID : GUID* -> "var" ; wVerMajor : WORD -> "int" ; wVerMinor : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLib "UnRegisterTypeLib" sptr, int, int, int, int ; res = UnRegisterTypeLib(varptr(libID), wVerMajor, wVerMinor, lcid, syskind) ; libID : GUID* -> "sptr" ; wVerMajor : WORD -> "int" ; wVerMinor : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT UnRegisterTypeLib(GUID* libID, WORD wVerMajor, WORD wVerMinor, DWORD lcid, SYSKIND syskind) #uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLib "UnRegisterTypeLib" var, int, int, int, int ; res = UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind) ; libID : GUID* -> "var" ; wVerMajor : WORD -> "int" ; wVerMinor : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT UnRegisterTypeLib(GUID* libID, WORD wVerMajor, WORD wVerMinor, DWORD lcid, SYSKIND syskind) #uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLib "UnRegisterTypeLib" intptr, int, int, int, int ; res = UnRegisterTypeLib(varptr(libID), wVerMajor, wVerMinor, lcid, syskind) ; libID : GUID* -> "intptr" ; wVerMajor : WORD -> "int" ; wVerMinor : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procUnRegisterTypeLib = oleaut32.NewProc("UnRegisterTypeLib")
)
// libID (GUID*), wVerMajor (WORD), wVerMinor (WORD), lcid (DWORD), syskind (SYSKIND)
r1, _, err := procUnRegisterTypeLib.Call(
uintptr(libID),
uintptr(wVerMajor),
uintptr(wVerMinor),
uintptr(lcid),
uintptr(syskind),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UnRegisterTypeLib(
libID: PGUID; // GUID*
wVerMajor: Word; // WORD
wVerMinor: Word; // WORD
lcid: DWORD; // DWORD
syskind: Integer // SYSKIND
): Integer; stdcall;
external 'OLEAUT32.dll' name 'UnRegisterTypeLib';result := DllCall("OLEAUT32\UnRegisterTypeLib"
, "Ptr", libID ; GUID*
, "UShort", wVerMajor ; WORD
, "UShort", wVerMinor ; WORD
, "UInt", lcid ; DWORD
, "Int", syskind ; SYSKIND
, "Int") ; return: HRESULT●UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind) = DLL("OLEAUT32.dll", "int UnRegisterTypeLib(void*, int, int, dword, int)")
# 呼び出し: UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind)
# libID : GUID* -> "void*"
# wVerMajor : WORD -> "int"
# wVerMinor : WORD -> "int"
# lcid : DWORD -> "dword"
# syskind : SYSKIND -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "oleaut32" fn UnRegisterTypeLib(
libID: [*c]GUID, // GUID*
wVerMajor: u16, // WORD
wVerMinor: u16, // WORD
lcid: u32, // DWORD
syskind: i32 // SYSKIND
) callconv(std.os.windows.WINAPI) i32;proc UnRegisterTypeLib(
libID: ptr GUID, # GUID*
wVerMajor: uint16, # WORD
wVerMinor: uint16, # WORD
lcid: uint32, # DWORD
syskind: int32 # SYSKIND
): int32 {.importc: "UnRegisterTypeLib", stdcall, dynlib: "OLEAUT32.dll".}pragma(lib, "oleaut32");
extern(Windows)
int UnRegisterTypeLib(
GUID* libID, // GUID*
ushort wVerMajor, // WORD
ushort wVerMinor, // WORD
uint lcid, // DWORD
int syskind // SYSKIND
);ccall((:UnRegisterTypeLib, "OLEAUT32.dll"), stdcall, Int32,
(Ptr{GUID}, UInt16, UInt16, UInt32, Int32),
libID, wVerMajor, wVerMinor, lcid, syskind)
# libID : GUID* -> Ptr{GUID}
# wVerMajor : WORD -> UInt16
# wVerMinor : WORD -> UInt16
# lcid : DWORD -> UInt32
# syskind : SYSKIND -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t UnRegisterTypeLib(
void* libID,
uint16_t wVerMajor,
uint16_t wVerMinor,
uint32_t lcid,
int32_t syskind);
]]
local oleaut32 = ffi.load("oleaut32")
-- oleaut32.UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind)
-- libID : GUID*
-- wVerMajor : WORD
-- wVerMinor : WORD
-- lcid : DWORD
-- syskind : SYSKIND
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLEAUT32.dll');
const UnRegisterTypeLib = lib.func('__stdcall', 'UnRegisterTypeLib', 'int32_t', ['void *', 'uint16_t', 'uint16_t', 'uint32_t', 'int32_t']);
// UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind)
// libID : GUID* -> 'void *'
// wVerMajor : WORD -> 'uint16_t'
// wVerMinor : WORD -> 'uint16_t'
// lcid : DWORD -> 'uint32_t'
// syskind : SYSKIND -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLEAUT32.dll", {
UnRegisterTypeLib: { parameters: ["pointer", "u16", "u16", "u32", "i32"], result: "i32" },
});
// lib.symbols.UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind)
// libID : GUID* -> "pointer"
// wVerMajor : WORD -> "u16"
// wVerMinor : WORD -> "u16"
// lcid : DWORD -> "u32"
// syskind : SYSKIND -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t UnRegisterTypeLib(
void* libID,
uint16_t wVerMajor,
uint16_t wVerMinor,
uint32_t lcid,
int32_t syskind);
C, "OLEAUT32.dll");
// $ffi->UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid, syskind);
// libID : GUID*
// wVerMajor : WORD
// wVerMinor : WORD
// lcid : DWORD
// syskind : SYSKIND
// 構造体/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 Oleaut32 extends StdCallLibrary {
Oleaut32 INSTANCE = Native.load("oleaut32", Oleaut32.class);
int UnRegisterTypeLib(
Pointer libID, // GUID*
short wVerMajor, // WORD
short wVerMinor, // WORD
int lcid, // DWORD
int syskind // SYSKIND
);
}@[Link("oleaut32")]
lib LibOLEAUT32
fun UnRegisterTypeLib = UnRegisterTypeLib(
libID : GUID*, # GUID*
wVerMajor : UInt16, # WORD
wVerMinor : UInt16, # WORD
lcid : UInt32, # DWORD
syskind : Int32 # SYSKIND
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef UnRegisterTypeLibNative = Int32 Function(Pointer<Void>, Uint16, Uint16, Uint32, Int32);
typedef UnRegisterTypeLibDart = int Function(Pointer<Void>, int, int, int, int);
final UnRegisterTypeLib = DynamicLibrary.open('OLEAUT32.dll')
.lookupFunction<UnRegisterTypeLibNative, UnRegisterTypeLibDart>('UnRegisterTypeLib');
// libID : GUID* -> Pointer<Void>
// wVerMajor : WORD -> Uint16
// wVerMinor : WORD -> Uint16
// lcid : DWORD -> Uint32
// syskind : SYSKIND -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function UnRegisterTypeLib(
libID: PGUID; // GUID*
wVerMajor: Word; // WORD
wVerMinor: Word; // WORD
lcid: DWORD; // DWORD
syskind: Integer // SYSKIND
): Integer; stdcall;
external 'OLEAUT32.dll' name 'UnRegisterTypeLib';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "UnRegisterTypeLib"
c_UnRegisterTypeLib :: Ptr () -> Word16 -> Word16 -> Word32 -> Int32 -> IO Int32
-- libID : GUID* -> Ptr ()
-- wVerMajor : WORD -> Word16
-- wVerMinor : WORD -> Word16
-- lcid : DWORD -> Word32
-- syskind : SYSKIND -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let unregistertypelib =
foreign "UnRegisterTypeLib"
((ptr void) @-> uint16_t @-> uint16_t @-> uint32_t @-> int32_t @-> returning int32_t)
(* libID : GUID* -> (ptr void) *)
(* wVerMajor : WORD -> uint16_t *)
(* wVerMinor : WORD -> uint16_t *)
(* lcid : DWORD -> uint32_t *)
(* syskind : SYSKIND -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library oleaut32 (t "OLEAUT32.dll"))
(cffi:use-foreign-library oleaut32)
(cffi:defcfun ("UnRegisterTypeLib" un-register-type-lib :convention :stdcall) :int32
(lib-id :pointer) ; GUID*
(w-ver-major :uint16) ; WORD
(w-ver-minor :uint16) ; WORD
(lcid :uint32) ; DWORD
(syskind :int32)) ; SYSKIND
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $UnRegisterTypeLib = Win32::API::More->new('OLEAUT32',
'int UnRegisterTypeLib(LPVOID libID, WORD wVerMajor, WORD wVerMinor, DWORD lcid, int syskind)');
# my $ret = $UnRegisterTypeLib->Call($libID, $wVerMajor, $wVerMinor, $lcid, $syskind);
# libID : GUID* -> LPVOID
# wVerMajor : WORD -> WORD
# wVerMinor : WORD -> WORD
# lcid : DWORD -> DWORD
# syskind : SYSKIND -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型