Win32 API 日本語リファレンス
ホームNetworkManagement.NetBios › Netbios

Netbios

関数
NetBIOS制御ブロックを介してNetBIOSコマンドを発行する。
DLLNETAPI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BYTE Netbios(
    NCB* pncb
);

パラメーター

名前方向
pncbNCB*inout

戻り値の型: BYTE

各言語での呼び出し定義

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

BYTE Netbios(
    NCB* pncb
);
[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern byte Netbios(
    IntPtr pncb   // NCB* in/out
);
<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function Netbios(
    pncb As IntPtr   ' NCB* in/out
) As Byte
End Function
' pncb : NCB* in/out
Declare PtrSafe Function Netbios Lib "netapi32" ( _
    ByVal pncb As LongPtr) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

Netbios = ctypes.windll.netapi32.Netbios
Netbios.restype = ctypes.c_ubyte
Netbios.argtypes = [
    ctypes.c_void_p,  # pncb : NCB* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
	procNetbios = netapi32.NewProc("Netbios")
)

// pncb (NCB* in/out)
r1, _, err := procNetbios.Call(
	uintptr(pncb),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BYTE
function Netbios(
  pncb: Pointer   // NCB* in/out
): Byte; stdcall;
  external 'NETAPI32.dll' name 'Netbios';
result := DllCall("NETAPI32\Netbios"
    , "Ptr", pncb   ; NCB* in/out
    , "UChar")   ; return: BYTE
●Netbios(pncb) = DLL("NETAPI32.dll", "byte Netbios(void*)")
# 呼び出し: Netbios(pncb)
# pncb : NCB* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。