ホーム › NetworkManagement.NetManagement › NetReplExportDirLock
NetReplExportDirLock
関数エクスポート用ディレクトリをロックする。
シグネチャ
// NETAPI32.dll
#include <windows.h>
DWORD NetReplExportDirLock(
LPCWSTR servername,
LPCWSTR dirname
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| servername | LPCWSTR | in |
| dirname | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// NETAPI32.dll
#include <windows.h>
DWORD NetReplExportDirLock(
LPCWSTR servername,
LPCWSTR dirname
);[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint NetReplExportDirLock(
[MarshalAs(UnmanagedType.LPWStr)] string servername, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string dirname // LPCWSTR
);<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function NetReplExportDirLock(
<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 NetReplExportDirLock 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
NetReplExportDirLock = ctypes.windll.netapi32.NetReplExportDirLock
NetReplExportDirLock.restype = wintypes.DWORD
NetReplExportDirLock.argtypes = [
wintypes.LPCWSTR, # servername : LPCWSTR
wintypes.LPCWSTR, # dirname : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NETAPI32.dll')
NetReplExportDirLock = Fiddle::Function.new(
lib['NetReplExportDirLock'],
[
Fiddle::TYPE_VOIDP, # servername : LPCWSTR
Fiddle::TYPE_VOIDP, # dirname : LPCWSTR
],
-Fiddle::TYPE_INT)#[link(name = "netapi32")]
extern "system" {
fn NetReplExportDirLock(
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 NetReplExportDirLock([MarshalAs(UnmanagedType.LPWStr)] string servername, [MarshalAs(UnmanagedType.LPWStr)] string dirname);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_NetReplExportDirLock' -Namespace Win32 -PassThru
# $api::NetReplExportDirLock(servername, dirname)#uselib "NETAPI32.dll"
#func global NetReplExportDirLock "NetReplExportDirLock" sptr, sptr
; NetReplExportDirLock servername, dirname ; 戻り値は stat
; servername : LPCWSTR -> "sptr"
; dirname : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NETAPI32.dll"
#cfunc global NetReplExportDirLock "NetReplExportDirLock" wstr, wstr
; res = NetReplExportDirLock(servername, dirname)
; servername : LPCWSTR -> "wstr"
; dirname : LPCWSTR -> "wstr"; DWORD NetReplExportDirLock(LPCWSTR servername, LPCWSTR dirname)
#uselib "NETAPI32.dll"
#cfunc global NetReplExportDirLock "NetReplExportDirLock" wstr, wstr
; res = NetReplExportDirLock(servername, dirname)
; servername : LPCWSTR -> "wstr"
; dirname : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
procNetReplExportDirLock = netapi32.NewProc("NetReplExportDirLock")
)
// servername (LPCWSTR), dirname (LPCWSTR)
r1, _, err := procNetReplExportDirLock.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(servername))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(dirname))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction NetReplExportDirLock(
servername: PWideChar; // LPCWSTR
dirname: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'NETAPI32.dll' name 'NetReplExportDirLock';result := DllCall("NETAPI32\NetReplExportDirLock"
, "WStr", servername ; LPCWSTR
, "WStr", dirname ; LPCWSTR
, "UInt") ; return: DWORD●NetReplExportDirLock(servername, dirname) = DLL("NETAPI32.dll", "dword NetReplExportDirLock(char*, char*)")
# 呼び出し: NetReplExportDirLock(servername, dirname)
# servername : LPCWSTR -> "char*"
# dirname : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。