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