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

NPGetResourceInformation

関数
ネットワークリソースの情報をプロバイダーから取得する。
DLLdavclnt.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD NPGetResourceInformation(
    NETRESOURCEW* lpNetResource,
    void* lpBuffer,
    DWORD* lpBufferSize,
    LPWSTR* lplpSystem
);

パラメーター

名前方向
lpNetResourceNETRESOURCEW*in
lpBuffervoid*out
lpBufferSizeDWORD*inout
lplpSystemLPWSTR*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD NPGetResourceInformation(
    NETRESOURCEW* lpNetResource,
    void* lpBuffer,
    DWORD* lpBufferSize,
    LPWSTR* lplpSystem
);
[DllImport("davclnt.dll", ExactSpelling = true)]
static extern uint NPGetResourceInformation(
    IntPtr lpNetResource,   // NETRESOURCEW*
    IntPtr lpBuffer,   // void* out
    ref uint lpBufferSize,   // DWORD* in/out
    IntPtr lplpSystem   // LPWSTR* out
);
<DllImport("davclnt.dll", ExactSpelling:=True)>
Public Shared Function NPGetResourceInformation(
    lpNetResource As IntPtr,   ' NETRESOURCEW*
    lpBuffer As IntPtr,   ' void* out
    ByRef lpBufferSize As UInteger,   ' DWORD* in/out
    lplpSystem As IntPtr   ' LPWSTR* out
) As UInteger
End Function
' lpNetResource : NETRESOURCEW*
' lpBuffer : void* out
' lpBufferSize : DWORD* in/out
' lplpSystem : LPWSTR* out
Declare PtrSafe Function NPGetResourceInformation Lib "davclnt" ( _
    ByVal lpNetResource As LongPtr, _
    ByVal lpBuffer As LongPtr, _
    ByRef lpBufferSize As Long, _
    ByVal lplpSystem As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NPGetResourceInformation = ctypes.windll.davclnt.NPGetResourceInformation
NPGetResourceInformation.restype = wintypes.DWORD
NPGetResourceInformation.argtypes = [
    ctypes.c_void_p,  # lpNetResource : NETRESOURCEW*
    ctypes.POINTER(None),  # lpBuffer : void* out
    ctypes.POINTER(wintypes.DWORD),  # lpBufferSize : DWORD* in/out
    ctypes.c_void_p,  # lplpSystem : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('davclnt.dll')
NPGetResourceInformation = Fiddle::Function.new(
  lib['NPGetResourceInformation'],
  [
    Fiddle::TYPE_VOIDP,  # lpNetResource : NETRESOURCEW*
    Fiddle::TYPE_VOIDP,  # lpBuffer : void* out
    Fiddle::TYPE_VOIDP,  # lpBufferSize : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # lplpSystem : LPWSTR* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "davclnt")]
extern "system" {
    fn NPGetResourceInformation(
        lpNetResource: *mut NETRESOURCEW,  // NETRESOURCEW*
        lpBuffer: *mut (),  // void* out
        lpBufferSize: *mut u32,  // DWORD* in/out
        lplpSystem: *mut *mut u16  // LPWSTR* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("davclnt.dll")]
public static extern uint NPGetResourceInformation(IntPtr lpNetResource, IntPtr lpBuffer, ref uint lpBufferSize, IntPtr lplpSystem);
"@
$api = Add-Type -MemberDefinition $sig -Name 'davclnt_NPGetResourceInformation' -Namespace Win32 -PassThru
# $api::NPGetResourceInformation(lpNetResource, lpBuffer, lpBufferSize, lplpSystem)
#uselib "davclnt.dll"
#func global NPGetResourceInformation "NPGetResourceInformation" sptr, sptr, sptr, sptr
; NPGetResourceInformation varptr(lpNetResource), lpBuffer, varptr(lpBufferSize), varptr(lplpSystem)   ; 戻り値は stat
; lpNetResource : NETRESOURCEW* -> "sptr"
; lpBuffer : void* out -> "sptr"
; lpBufferSize : DWORD* in/out -> "sptr"
; lplpSystem : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "davclnt.dll"
#cfunc global NPGetResourceInformation "NPGetResourceInformation" var, sptr, var, var
; res = NPGetResourceInformation(lpNetResource, lpBuffer, lpBufferSize, lplpSystem)
; lpNetResource : NETRESOURCEW* -> "var"
; lpBuffer : void* out -> "sptr"
; lpBufferSize : DWORD* in/out -> "var"
; lplpSystem : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD NPGetResourceInformation(NETRESOURCEW* lpNetResource, void* lpBuffer, DWORD* lpBufferSize, LPWSTR* lplpSystem)
#uselib "davclnt.dll"
#cfunc global NPGetResourceInformation "NPGetResourceInformation" var, intptr, var, var
; res = NPGetResourceInformation(lpNetResource, lpBuffer, lpBufferSize, lplpSystem)
; lpNetResource : NETRESOURCEW* -> "var"
; lpBuffer : void* out -> "intptr"
; lpBufferSize : DWORD* in/out -> "var"
; lplpSystem : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	davclnt = windows.NewLazySystemDLL("davclnt.dll")
	procNPGetResourceInformation = davclnt.NewProc("NPGetResourceInformation")
)

// lpNetResource (NETRESOURCEW*), lpBuffer (void* out), lpBufferSize (DWORD* in/out), lplpSystem (LPWSTR* out)
r1, _, err := procNPGetResourceInformation.Call(
	uintptr(lpNetResource),
	uintptr(lpBuffer),
	uintptr(lpBufferSize),
	uintptr(lplpSystem),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function NPGetResourceInformation(
  lpNetResource: Pointer;   // NETRESOURCEW*
  lpBuffer: Pointer;   // void* out
  lpBufferSize: Pointer;   // DWORD* in/out
  lplpSystem: PPWideChar   // LPWSTR* out
): DWORD; stdcall;
  external 'davclnt.dll' name 'NPGetResourceInformation';
result := DllCall("davclnt\NPGetResourceInformation"
    , "Ptr", lpNetResource   ; NETRESOURCEW*
    , "Ptr", lpBuffer   ; void* out
    , "Ptr", lpBufferSize   ; DWORD* in/out
    , "Ptr", lplpSystem   ; LPWSTR* out
    , "UInt")   ; return: DWORD
●NPGetResourceInformation(lpNetResource, lpBuffer, lpBufferSize, lplpSystem) = DLL("davclnt.dll", "dword NPGetResourceInformation(void*, void*, void*, void*)")
# 呼び出し: NPGetResourceInformation(lpNetResource, lpBuffer, lpBufferSize, lplpSystem)
# lpNetResource : NETRESOURCEW* -> "void*"
# lpBuffer : void* out -> "void*"
# lpBufferSize : DWORD* in/out -> "void*"
# lplpSystem : LPWSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。