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

NetReplExportDirDel

関数
レプリケーションのエクスポート用ディレクトリを削除する。
DLLNETAPI32.dll呼出規約winapi

シグネチャ

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

DWORD NetReplExportDirDel(
    LPCWSTR servername,
    LPCWSTR dirname
);

パラメーター

名前方向
servernameLPCWSTRin
dirnameLPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD NetReplExportDirDel(
    LPCWSTR servername,
    LPCWSTR dirname
);
[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint NetReplExportDirDel(
    [MarshalAs(UnmanagedType.LPWStr)] string servername,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string dirname   // LPCWSTR
);
<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function NetReplExportDirDel(
    <MarshalAs(UnmanagedType.LPWStr)> servername As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> dirname As String   ' LPCWSTR
) As UInteger
End Function
' servername : LPCWSTR
' dirname : LPCWSTR
Declare PtrSafe Function NetReplExportDirDel Lib "netapi32" ( _
    ByVal servername As LongPtr, _
    ByVal dirname As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NetReplExportDirDel = ctypes.windll.netapi32.NetReplExportDirDel
NetReplExportDirDel.restype = wintypes.DWORD
NetReplExportDirDel.argtypes = [
    wintypes.LPCWSTR,  # servername : LPCWSTR
    wintypes.LPCWSTR,  # dirname : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NETAPI32.dll')
NetReplExportDirDel = Fiddle::Function.new(
  lib['NetReplExportDirDel'],
  [
    Fiddle::TYPE_VOIDP,  # servername : LPCWSTR
    Fiddle::TYPE_VOIDP,  # dirname : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "netapi32")]
extern "system" {
    fn NetReplExportDirDel(
        servername: *const u16,  // LPCWSTR
        dirname: *const u16  // LPCWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NETAPI32.dll")]
public static extern uint NetReplExportDirDel([MarshalAs(UnmanagedType.LPWStr)] string servername, [MarshalAs(UnmanagedType.LPWStr)] string dirname);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_NetReplExportDirDel' -Namespace Win32 -PassThru
# $api::NetReplExportDirDel(servername, dirname)
#uselib "NETAPI32.dll"
#func global NetReplExportDirDel "NetReplExportDirDel" sptr, sptr
; NetReplExportDirDel servername, dirname   ; 戻り値は stat
; servername : LPCWSTR -> "sptr"
; dirname : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "NETAPI32.dll"
#cfunc global NetReplExportDirDel "NetReplExportDirDel" wstr, wstr
; res = NetReplExportDirDel(servername, dirname)
; servername : LPCWSTR -> "wstr"
; dirname : LPCWSTR -> "wstr"
; DWORD NetReplExportDirDel(LPCWSTR servername, LPCWSTR dirname)
#uselib "NETAPI32.dll"
#cfunc global NetReplExportDirDel "NetReplExportDirDel" wstr, wstr
; res = NetReplExportDirDel(servername, dirname)
; servername : LPCWSTR -> "wstr"
; dirname : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
	procNetReplExportDirDel = netapi32.NewProc("NetReplExportDirDel")
)

// servername (LPCWSTR), dirname (LPCWSTR)
r1, _, err := procNetReplExportDirDel.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(servername))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(dirname))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function NetReplExportDirDel(
  servername: PWideChar;   // LPCWSTR
  dirname: PWideChar   // LPCWSTR
): DWORD; stdcall;
  external 'NETAPI32.dll' name 'NetReplExportDirDel';
result := DllCall("NETAPI32\NetReplExportDirDel"
    , "WStr", servername   ; LPCWSTR
    , "WStr", dirname   ; LPCWSTR
    , "UInt")   ; return: DWORD
●NetReplExportDirDel(servername, dirname) = DLL("NETAPI32.dll", "dword NetReplExportDirDel(char*, char*)")
# 呼び出し: NetReplExportDirDel(servername, dirname)
# servername : LPCWSTR -> "char*"
# dirname : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。