ホーム › Storage.DistributedFileSystem › NetDfsRemove
NetDfsRemove
関数DFS名前空間からリンクまたはターゲットを削除する。
シグネチャ
// NETAPI32.dll
#include <windows.h>
DWORD NetDfsRemove(
LPWSTR DfsEntryPath,
LPWSTR ServerName, // optional
LPWSTR ShareName // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| DfsEntryPath | LPWSTR | in |
| ServerName | LPWSTR | inoptional |
| ShareName | LPWSTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// NETAPI32.dll
#include <windows.h>
DWORD NetDfsRemove(
LPWSTR DfsEntryPath,
LPWSTR ServerName, // optional
LPWSTR ShareName // optional
);[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint NetDfsRemove(
[MarshalAs(UnmanagedType.LPWStr)] string DfsEntryPath, // LPWSTR
[MarshalAs(UnmanagedType.LPWStr)] string ServerName, // LPWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string ShareName // LPWSTR optional
);<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function NetDfsRemove(
<MarshalAs(UnmanagedType.LPWStr)> DfsEntryPath As String, ' LPWSTR
<MarshalAs(UnmanagedType.LPWStr)> ServerName As String, ' LPWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> ShareName As String ' LPWSTR optional
) As UInteger
End Function' DfsEntryPath : LPWSTR
' ServerName : LPWSTR optional
' ShareName : LPWSTR optional
Declare PtrSafe Function NetDfsRemove Lib "netapi32" ( _
ByVal DfsEntryPath As LongPtr, _
ByVal ServerName As LongPtr, _
ByVal ShareName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NetDfsRemove = ctypes.windll.netapi32.NetDfsRemove
NetDfsRemove.restype = wintypes.DWORD
NetDfsRemove.argtypes = [
wintypes.LPCWSTR, # DfsEntryPath : LPWSTR
wintypes.LPCWSTR, # ServerName : LPWSTR optional
wintypes.LPCWSTR, # ShareName : LPWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NETAPI32.dll')
NetDfsRemove = Fiddle::Function.new(
lib['NetDfsRemove'],
[
Fiddle::TYPE_VOIDP, # DfsEntryPath : LPWSTR
Fiddle::TYPE_VOIDP, # ServerName : LPWSTR optional
Fiddle::TYPE_VOIDP, # ShareName : LPWSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "netapi32")]
extern "system" {
fn NetDfsRemove(
DfsEntryPath: *mut u16, // LPWSTR
ServerName: *mut u16, // LPWSTR optional
ShareName: *mut u16 // LPWSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NETAPI32.dll")]
public static extern uint NetDfsRemove([MarshalAs(UnmanagedType.LPWStr)] string DfsEntryPath, [MarshalAs(UnmanagedType.LPWStr)] string ServerName, [MarshalAs(UnmanagedType.LPWStr)] string ShareName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_NetDfsRemove' -Namespace Win32 -PassThru
# $api::NetDfsRemove(DfsEntryPath, ServerName, ShareName)#uselib "NETAPI32.dll"
#func global NetDfsRemove "NetDfsRemove" sptr, sptr, sptr
; NetDfsRemove DfsEntryPath, ServerName, ShareName ; 戻り値は stat
; DfsEntryPath : LPWSTR -> "sptr"
; ServerName : LPWSTR optional -> "sptr"
; ShareName : LPWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NETAPI32.dll"
#cfunc global NetDfsRemove "NetDfsRemove" wstr, wstr, wstr
; res = NetDfsRemove(DfsEntryPath, ServerName, ShareName)
; DfsEntryPath : LPWSTR -> "wstr"
; ServerName : LPWSTR optional -> "wstr"
; ShareName : LPWSTR optional -> "wstr"; DWORD NetDfsRemove(LPWSTR DfsEntryPath, LPWSTR ServerName, LPWSTR ShareName)
#uselib "NETAPI32.dll"
#cfunc global NetDfsRemove "NetDfsRemove" wstr, wstr, wstr
; res = NetDfsRemove(DfsEntryPath, ServerName, ShareName)
; DfsEntryPath : LPWSTR -> "wstr"
; ServerName : LPWSTR optional -> "wstr"
; ShareName : LPWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
procNetDfsRemove = netapi32.NewProc("NetDfsRemove")
)
// DfsEntryPath (LPWSTR), ServerName (LPWSTR optional), ShareName (LPWSTR optional)
r1, _, err := procNetDfsRemove.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(DfsEntryPath))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ServerName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ShareName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction NetDfsRemove(
DfsEntryPath: PWideChar; // LPWSTR
ServerName: PWideChar; // LPWSTR optional
ShareName: PWideChar // LPWSTR optional
): DWORD; stdcall;
external 'NETAPI32.dll' name 'NetDfsRemove';result := DllCall("NETAPI32\NetDfsRemove"
, "WStr", DfsEntryPath ; LPWSTR
, "WStr", ServerName ; LPWSTR optional
, "WStr", ShareName ; LPWSTR optional
, "UInt") ; return: DWORD●NetDfsRemove(DfsEntryPath, ServerName, ShareName) = DLL("NETAPI32.dll", "dword NetDfsRemove(char*, char*, char*)")
# 呼び出し: NetDfsRemove(DfsEntryPath, ServerName, ShareName)
# DfsEntryPath : LPWSTR -> "char*"
# ServerName : LPWSTR optional -> "char*"
# ShareName : LPWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。