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