ホーム › Security.Credentials › CredIsMarshaledCredentialW
CredIsMarshaledCredentialW
関数文字列がマーシャリング済み資格情報か判定する。
シグネチャ
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
BOOL CredIsMarshaledCredentialW(
LPCWSTR MarshaledCredential
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| MarshaledCredential | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
BOOL CredIsMarshaledCredentialW(
LPCWSTR MarshaledCredential
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool CredIsMarshaledCredentialW(
[MarshalAs(UnmanagedType.LPWStr)] string MarshaledCredential // LPCWSTR
);<DllImport("ADVAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function CredIsMarshaledCredentialW(
<MarshalAs(UnmanagedType.LPWStr)> MarshaledCredential As String ' LPCWSTR
) As Boolean
End Function' MarshaledCredential : LPCWSTR
Declare PtrSafe Function CredIsMarshaledCredentialW Lib "advapi32" ( _
ByVal MarshaledCredential As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CredIsMarshaledCredentialW = ctypes.windll.advapi32.CredIsMarshaledCredentialW
CredIsMarshaledCredentialW.restype = wintypes.BOOL
CredIsMarshaledCredentialW.argtypes = [
wintypes.LPCWSTR, # MarshaledCredential : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
CredIsMarshaledCredentialW = Fiddle::Function.new(
lib['CredIsMarshaledCredentialW'],
[
Fiddle::TYPE_VOIDP, # MarshaledCredential : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advapi32")]
extern "system" {
fn CredIsMarshaledCredentialW(
MarshaledCredential: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode)]
public static extern bool CredIsMarshaledCredentialW([MarshalAs(UnmanagedType.LPWStr)] string MarshaledCredential);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_CredIsMarshaledCredentialW' -Namespace Win32 -PassThru
# $api::CredIsMarshaledCredentialW(MarshaledCredential)#uselib "ADVAPI32.dll"
#func global CredIsMarshaledCredentialW "CredIsMarshaledCredentialW" wptr
; CredIsMarshaledCredentialW MarshaledCredential ; 戻り値は stat
; MarshaledCredential : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVAPI32.dll"
#cfunc global CredIsMarshaledCredentialW "CredIsMarshaledCredentialW" wstr
; res = CredIsMarshaledCredentialW(MarshaledCredential)
; MarshaledCredential : LPCWSTR -> "wstr"; BOOL CredIsMarshaledCredentialW(LPCWSTR MarshaledCredential)
#uselib "ADVAPI32.dll"
#cfunc global CredIsMarshaledCredentialW "CredIsMarshaledCredentialW" wstr
; res = CredIsMarshaledCredentialW(MarshaledCredential)
; MarshaledCredential : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procCredIsMarshaledCredentialW = advapi32.NewProc("CredIsMarshaledCredentialW")
)
// MarshaledCredential (LPCWSTR)
r1, _, err := procCredIsMarshaledCredentialW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(MarshaledCredential))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CredIsMarshaledCredentialW(
MarshaledCredential: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'ADVAPI32.dll' name 'CredIsMarshaledCredentialW';result := DllCall("ADVAPI32\CredIsMarshaledCredentialW"
, "WStr", MarshaledCredential ; LPCWSTR
, "Int") ; return: BOOL●CredIsMarshaledCredentialW(MarshaledCredential) = DLL("ADVAPI32.dll", "bool CredIsMarshaledCredentialW(char*)")
# 呼び出し: CredIsMarshaledCredentialW(MarshaledCredential)
# MarshaledCredential : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。