ホーム › Networking.WinSock › WSARemoveServiceClass
WSARemoveServiceClass
関数指定したサービスクラスを登録解除する。
シグネチャ
// WS2_32.dll
#include <windows.h>
INT WSARemoveServiceClass(
GUID* lpServiceClassId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpServiceClassId | GUID* | in |
戻り値の型: INT
各言語での呼び出し定義
// WS2_32.dll
#include <windows.h>
INT WSARemoveServiceClass(
GUID* lpServiceClassId
);[DllImport("WS2_32.dll", SetLastError = true, ExactSpelling = true)]
static extern int WSARemoveServiceClass(
ref Guid lpServiceClassId // GUID*
);<DllImport("WS2_32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function WSARemoveServiceClass(
ByRef lpServiceClassId As Guid ' GUID*
) As Integer
End Function' lpServiceClassId : GUID*
Declare PtrSafe Function WSARemoveServiceClass Lib "ws2_32" ( _
ByVal lpServiceClassId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSARemoveServiceClass = ctypes.windll.ws2_32.WSARemoveServiceClass
WSARemoveServiceClass.restype = ctypes.c_int
WSARemoveServiceClass.argtypes = [
ctypes.c_void_p, # lpServiceClassId : GUID*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WS2_32.dll')
WSARemoveServiceClass = Fiddle::Function.new(
lib['WSARemoveServiceClass'],
[
Fiddle::TYPE_VOIDP, # lpServiceClassId : GUID*
],
Fiddle::TYPE_INT)#[link(name = "ws2_32")]
extern "system" {
fn WSARemoveServiceClass(
lpServiceClassId: *mut GUID // GUID*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WS2_32.dll", SetLastError = true)]
public static extern int WSARemoveServiceClass(ref Guid lpServiceClassId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WS2_32_WSARemoveServiceClass' -Namespace Win32 -PassThru
# $api::WSARemoveServiceClass(lpServiceClassId)#uselib "WS2_32.dll"
#func global WSARemoveServiceClass "WSARemoveServiceClass" sptr
; WSARemoveServiceClass varptr(lpServiceClassId) ; 戻り値は stat
; lpServiceClassId : GUID* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WS2_32.dll" #cfunc global WSARemoveServiceClass "WSARemoveServiceClass" var ; res = WSARemoveServiceClass(lpServiceClassId) ; lpServiceClassId : GUID* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WS2_32.dll" #cfunc global WSARemoveServiceClass "WSARemoveServiceClass" sptr ; res = WSARemoveServiceClass(varptr(lpServiceClassId)) ; lpServiceClassId : GUID* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT WSARemoveServiceClass(GUID* lpServiceClassId) #uselib "WS2_32.dll" #cfunc global WSARemoveServiceClass "WSARemoveServiceClass" var ; res = WSARemoveServiceClass(lpServiceClassId) ; lpServiceClassId : GUID* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT WSARemoveServiceClass(GUID* lpServiceClassId) #uselib "WS2_32.dll" #cfunc global WSARemoveServiceClass "WSARemoveServiceClass" intptr ; res = WSARemoveServiceClass(varptr(lpServiceClassId)) ; lpServiceClassId : GUID* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ws2_32 = windows.NewLazySystemDLL("WS2_32.dll")
procWSARemoveServiceClass = ws2_32.NewProc("WSARemoveServiceClass")
)
// lpServiceClassId (GUID*)
r1, _, err := procWSARemoveServiceClass.Call(
uintptr(lpServiceClassId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction WSARemoveServiceClass(
lpServiceClassId: PGUID // GUID*
): Integer; stdcall;
external 'WS2_32.dll' name 'WSARemoveServiceClass';result := DllCall("WS2_32\WSARemoveServiceClass"
, "Ptr", lpServiceClassId ; GUID*
, "Int") ; return: INT●WSARemoveServiceClass(lpServiceClassId) = DLL("WS2_32.dll", "int WSARemoveServiceClass(void*)")
# 呼び出し: WSARemoveServiceClass(lpServiceClassId)
# lpServiceClassId : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。