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