ホーム › Networking.Clustering › ResUtilGetResourceDependentIPAddressProps
ResUtilGetResourceDependentIPAddressProps
関数依存先IPアドレスリソースのアドレス情報を取得する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilGetResourceDependentIPAddressProps(
HRESOURCE hResource,
LPWSTR pszAddress,
DWORD* pcchAddress,
LPWSTR pszSubnetMask,
DWORD* pcchSubnetMask,
LPWSTR pszNetwork,
DWORD* pcchNetwork
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hResource | HRESOURCE | in |
| pszAddress | LPWSTR | out |
| pcchAddress | DWORD* | inout |
| pszSubnetMask | LPWSTR | out |
| pcchSubnetMask | DWORD* | inout |
| pszNetwork | LPWSTR | out |
| pcchNetwork | DWORD* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilGetResourceDependentIPAddressProps(
HRESOURCE hResource,
LPWSTR pszAddress,
DWORD* pcchAddress,
LPWSTR pszSubnetMask,
DWORD* pcchSubnetMask,
LPWSTR pszNetwork,
DWORD* pcchNetwork
);[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilGetResourceDependentIPAddressProps(
IntPtr hResource, // HRESOURCE
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszAddress, // LPWSTR out
ref uint pcchAddress, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszSubnetMask, // LPWSTR out
ref uint pcchSubnetMask, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszNetwork, // LPWSTR out
ref uint pcchNetwork // DWORD* in/out
);<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilGetResourceDependentIPAddressProps(
hResource As IntPtr, ' HRESOURCE
<MarshalAs(UnmanagedType.LPWStr)> pszAddress As System.Text.StringBuilder, ' LPWSTR out
ByRef pcchAddress As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> pszSubnetMask As System.Text.StringBuilder, ' LPWSTR out
ByRef pcchSubnetMask As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> pszNetwork As System.Text.StringBuilder, ' LPWSTR out
ByRef pcchNetwork As UInteger ' DWORD* in/out
) As UInteger
End Function' hResource : HRESOURCE
' pszAddress : LPWSTR out
' pcchAddress : DWORD* in/out
' pszSubnetMask : LPWSTR out
' pcchSubnetMask : DWORD* in/out
' pszNetwork : LPWSTR out
' pcchNetwork : DWORD* in/out
Declare PtrSafe Function ResUtilGetResourceDependentIPAddressProps Lib "resutils" ( _
ByVal hResource As LongPtr, _
ByVal pszAddress As LongPtr, _
ByRef pcchAddress As Long, _
ByVal pszSubnetMask As LongPtr, _
ByRef pcchSubnetMask As Long, _
ByVal pszNetwork As LongPtr, _
ByRef pcchNetwork As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilGetResourceDependentIPAddressProps = ctypes.windll.resutils.ResUtilGetResourceDependentIPAddressProps
ResUtilGetResourceDependentIPAddressProps.restype = wintypes.DWORD
ResUtilGetResourceDependentIPAddressProps.argtypes = [
ctypes.c_ssize_t, # hResource : HRESOURCE
wintypes.LPWSTR, # pszAddress : LPWSTR out
ctypes.POINTER(wintypes.DWORD), # pcchAddress : DWORD* in/out
wintypes.LPWSTR, # pszSubnetMask : LPWSTR out
ctypes.POINTER(wintypes.DWORD), # pcchSubnetMask : DWORD* in/out
wintypes.LPWSTR, # pszNetwork : LPWSTR out
ctypes.POINTER(wintypes.DWORD), # pcchNetwork : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilGetResourceDependentIPAddressProps = Fiddle::Function.new(
lib['ResUtilGetResourceDependentIPAddressProps'],
[
Fiddle::TYPE_INTPTR_T, # hResource : HRESOURCE
Fiddle::TYPE_VOIDP, # pszAddress : LPWSTR out
Fiddle::TYPE_VOIDP, # pcchAddress : DWORD* in/out
Fiddle::TYPE_VOIDP, # pszSubnetMask : LPWSTR out
Fiddle::TYPE_VOIDP, # pcchSubnetMask : DWORD* in/out
Fiddle::TYPE_VOIDP, # pszNetwork : LPWSTR out
Fiddle::TYPE_VOIDP, # pcchNetwork : DWORD* in/out
],
-Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilGetResourceDependentIPAddressProps(
hResource: isize, // HRESOURCE
pszAddress: *mut u16, // LPWSTR out
pcchAddress: *mut u32, // DWORD* in/out
pszSubnetMask: *mut u16, // LPWSTR out
pcchSubnetMask: *mut u32, // DWORD* in/out
pszNetwork: *mut u16, // LPWSTR out
pcchNetwork: *mut u32 // DWORD* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilGetResourceDependentIPAddressProps(IntPtr hResource, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszAddress, ref uint pcchAddress, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszSubnetMask, ref uint pcchSubnetMask, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszNetwork, ref uint pcchNetwork);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilGetResourceDependentIPAddressProps' -Namespace Win32 -PassThru
# $api::ResUtilGetResourceDependentIPAddressProps(hResource, pszAddress, pcchAddress, pszSubnetMask, pcchSubnetMask, pszNetwork, pcchNetwork)#uselib "RESUTILS.dll"
#func global ResUtilGetResourceDependentIPAddressProps "ResUtilGetResourceDependentIPAddressProps" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ResUtilGetResourceDependentIPAddressProps hResource, varptr(pszAddress), varptr(pcchAddress), varptr(pszSubnetMask), varptr(pcchSubnetMask), varptr(pszNetwork), varptr(pcchNetwork) ; 戻り値は stat
; hResource : HRESOURCE -> "sptr"
; pszAddress : LPWSTR out -> "sptr"
; pcchAddress : DWORD* in/out -> "sptr"
; pszSubnetMask : LPWSTR out -> "sptr"
; pcchSubnetMask : DWORD* in/out -> "sptr"
; pszNetwork : LPWSTR out -> "sptr"
; pcchNetwork : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RESUTILS.dll" #cfunc global ResUtilGetResourceDependentIPAddressProps "ResUtilGetResourceDependentIPAddressProps" sptr, var, var, var, var, var, var ; res = ResUtilGetResourceDependentIPAddressProps(hResource, pszAddress, pcchAddress, pszSubnetMask, pcchSubnetMask, pszNetwork, pcchNetwork) ; hResource : HRESOURCE -> "sptr" ; pszAddress : LPWSTR out -> "var" ; pcchAddress : DWORD* in/out -> "var" ; pszSubnetMask : LPWSTR out -> "var" ; pcchSubnetMask : DWORD* in/out -> "var" ; pszNetwork : LPWSTR out -> "var" ; pcchNetwork : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RESUTILS.dll" #cfunc global ResUtilGetResourceDependentIPAddressProps "ResUtilGetResourceDependentIPAddressProps" sptr, sptr, sptr, sptr, sptr, sptr, sptr ; res = ResUtilGetResourceDependentIPAddressProps(hResource, varptr(pszAddress), varptr(pcchAddress), varptr(pszSubnetMask), varptr(pcchSubnetMask), varptr(pszNetwork), varptr(pcchNetwork)) ; hResource : HRESOURCE -> "sptr" ; pszAddress : LPWSTR out -> "sptr" ; pcchAddress : DWORD* in/out -> "sptr" ; pszSubnetMask : LPWSTR out -> "sptr" ; pcchSubnetMask : DWORD* in/out -> "sptr" ; pszNetwork : LPWSTR out -> "sptr" ; pcchNetwork : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ResUtilGetResourceDependentIPAddressProps(HRESOURCE hResource, LPWSTR pszAddress, DWORD* pcchAddress, LPWSTR pszSubnetMask, DWORD* pcchSubnetMask, LPWSTR pszNetwork, DWORD* pcchNetwork) #uselib "RESUTILS.dll" #cfunc global ResUtilGetResourceDependentIPAddressProps "ResUtilGetResourceDependentIPAddressProps" intptr, var, var, var, var, var, var ; res = ResUtilGetResourceDependentIPAddressProps(hResource, pszAddress, pcchAddress, pszSubnetMask, pcchSubnetMask, pszNetwork, pcchNetwork) ; hResource : HRESOURCE -> "intptr" ; pszAddress : LPWSTR out -> "var" ; pcchAddress : DWORD* in/out -> "var" ; pszSubnetMask : LPWSTR out -> "var" ; pcchSubnetMask : DWORD* in/out -> "var" ; pszNetwork : LPWSTR out -> "var" ; pcchNetwork : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ResUtilGetResourceDependentIPAddressProps(HRESOURCE hResource, LPWSTR pszAddress, DWORD* pcchAddress, LPWSTR pszSubnetMask, DWORD* pcchSubnetMask, LPWSTR pszNetwork, DWORD* pcchNetwork) #uselib "RESUTILS.dll" #cfunc global ResUtilGetResourceDependentIPAddressProps "ResUtilGetResourceDependentIPAddressProps" intptr, intptr, intptr, intptr, intptr, intptr, intptr ; res = ResUtilGetResourceDependentIPAddressProps(hResource, varptr(pszAddress), varptr(pcchAddress), varptr(pszSubnetMask), varptr(pcchSubnetMask), varptr(pszNetwork), varptr(pcchNetwork)) ; hResource : HRESOURCE -> "intptr" ; pszAddress : LPWSTR out -> "intptr" ; pcchAddress : DWORD* in/out -> "intptr" ; pszSubnetMask : LPWSTR out -> "intptr" ; pcchSubnetMask : DWORD* in/out -> "intptr" ; pszNetwork : LPWSTR out -> "intptr" ; pcchNetwork : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilGetResourceDependentIPAddressProps = resutils.NewProc("ResUtilGetResourceDependentIPAddressProps")
)
// hResource (HRESOURCE), pszAddress (LPWSTR out), pcchAddress (DWORD* in/out), pszSubnetMask (LPWSTR out), pcchSubnetMask (DWORD* in/out), pszNetwork (LPWSTR out), pcchNetwork (DWORD* in/out)
r1, _, err := procResUtilGetResourceDependentIPAddressProps.Call(
uintptr(hResource),
uintptr(pszAddress),
uintptr(pcchAddress),
uintptr(pszSubnetMask),
uintptr(pcchSubnetMask),
uintptr(pszNetwork),
uintptr(pcchNetwork),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ResUtilGetResourceDependentIPAddressProps(
hResource: NativeInt; // HRESOURCE
pszAddress: PWideChar; // LPWSTR out
pcchAddress: Pointer; // DWORD* in/out
pszSubnetMask: PWideChar; // LPWSTR out
pcchSubnetMask: Pointer; // DWORD* in/out
pszNetwork: PWideChar; // LPWSTR out
pcchNetwork: Pointer // DWORD* in/out
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilGetResourceDependentIPAddressProps';result := DllCall("RESUTILS\ResUtilGetResourceDependentIPAddressProps"
, "Ptr", hResource ; HRESOURCE
, "Ptr", pszAddress ; LPWSTR out
, "Ptr", pcchAddress ; DWORD* in/out
, "Ptr", pszSubnetMask ; LPWSTR out
, "Ptr", pcchSubnetMask ; DWORD* in/out
, "Ptr", pszNetwork ; LPWSTR out
, "Ptr", pcchNetwork ; DWORD* in/out
, "UInt") ; return: DWORD●ResUtilGetResourceDependentIPAddressProps(hResource, pszAddress, pcchAddress, pszSubnetMask, pcchSubnetMask, pszNetwork, pcchNetwork) = DLL("RESUTILS.dll", "dword ResUtilGetResourceDependentIPAddressProps(int, char*, void*, char*, void*, char*, void*)")
# 呼び出し: ResUtilGetResourceDependentIPAddressProps(hResource, pszAddress, pcchAddress, pszSubnetMask, pcchSubnetMask, pszNetwork, pcchNetwork)
# hResource : HRESOURCE -> "int"
# pszAddress : LPWSTR out -> "char*"
# pcchAddress : DWORD* in/out -> "void*"
# pszSubnetMask : LPWSTR out -> "char*"
# pcchSubnetMask : DWORD* in/out -> "void*"
# pszNetwork : LPWSTR out -> "char*"
# pcchNetwork : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。