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