Win32 API 日本語リファレンス
ホームSecurity.Authorization.UI › CreateSecurityPage

CreateSecurityPage

関数
アクセス制御編集用のセキュリティプロパティシートページを作成する。
DLLACLUI.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

HPROPSHEETPAGE CreateSecurityPage(
    ISecurityInformation* psi
);

パラメーター

名前方向説明
psiISecurityInformation*inセキュリティ情報を提供するISecurityInformationインターフェイスへのポインタ。

戻り値の型: HPROPSHEETPAGE

各言語での呼び出し定義

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

HPROPSHEETPAGE CreateSecurityPage(
    ISecurityInformation* psi
);
[DllImport("ACLUI.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateSecurityPage(
    IntPtr psi   // ISecurityInformation*
);
<DllImport("ACLUI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateSecurityPage(
    psi As IntPtr   ' ISecurityInformation*
) As IntPtr
End Function
' psi : ISecurityInformation*
Declare PtrSafe Function CreateSecurityPage Lib "aclui" ( _
    ByVal psi As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateSecurityPage = ctypes.windll.aclui.CreateSecurityPage
CreateSecurityPage.restype = ctypes.c_void_p
CreateSecurityPage.argtypes = [
    ctypes.c_void_p,  # psi : ISecurityInformation*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ACLUI.dll')
CreateSecurityPage = Fiddle::Function.new(
  lib['CreateSecurityPage'],
  [
    Fiddle::TYPE_VOIDP,  # psi : ISecurityInformation*
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "aclui")]
extern "system" {
    fn CreateSecurityPage(
        psi: *mut core::ffi::c_void  // ISecurityInformation*
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ACLUI.dll", SetLastError = true)]
public static extern IntPtr CreateSecurityPage(IntPtr psi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ACLUI_CreateSecurityPage' -Namespace Win32 -PassThru
# $api::CreateSecurityPage(psi)
#uselib "ACLUI.dll"
#func global CreateSecurityPage "CreateSecurityPage" sptr
; CreateSecurityPage psi   ; 戻り値は stat
; psi : ISecurityInformation* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ACLUI.dll"
#cfunc global CreateSecurityPage "CreateSecurityPage" sptr
; res = CreateSecurityPage(psi)
; psi : ISecurityInformation* -> "sptr"
; HPROPSHEETPAGE CreateSecurityPage(ISecurityInformation* psi)
#uselib "ACLUI.dll"
#cfunc global CreateSecurityPage "CreateSecurityPage" intptr
; res = CreateSecurityPage(psi)
; psi : ISecurityInformation* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	aclui = windows.NewLazySystemDLL("ACLUI.dll")
	procCreateSecurityPage = aclui.NewProc("CreateSecurityPage")
)

// psi (ISecurityInformation*)
r1, _, err := procCreateSecurityPage.Call(
	uintptr(psi),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HPROPSHEETPAGE
function CreateSecurityPage(
  psi: Pointer   // ISecurityInformation*
): THandle; stdcall;
  external 'ACLUI.dll' name 'CreateSecurityPage';
result := DllCall("ACLUI\CreateSecurityPage"
    , "Ptr", psi   ; ISecurityInformation*
    , "Ptr")   ; return: HPROPSHEETPAGE
●CreateSecurityPage(psi) = DLL("ACLUI.dll", "void* CreateSecurityPage(void*)")
# 呼び出し: CreateSecurityPage(psi)
# psi : ISecurityInformation* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "aclui" fn CreateSecurityPage(
    psi: ?*anyopaque // ISecurityInformation*
) callconv(std.os.windows.WINAPI) ?*anyopaque;
proc CreateSecurityPage(
    psi: pointer  # ISecurityInformation*
): pointer {.importc: "CreateSecurityPage", stdcall, dynlib: "ACLUI.dll".}
pragma(lib, "aclui");
extern(Windows)
void* CreateSecurityPage(
    void* psi   // ISecurityInformation*
);
ccall((:CreateSecurityPage, "ACLUI.dll"), stdcall, Ptr{Cvoid},
      (Ptr{Cvoid},),
      psi)
# psi : ISecurityInformation* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* CreateSecurityPage(
    void* psi);
]]
local aclui = ffi.load("aclui")
-- aclui.CreateSecurityPage(psi)
-- psi : ISecurityInformation*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ACLUI.dll');
const CreateSecurityPage = lib.func('__stdcall', 'CreateSecurityPage', 'void *', ['void *']);
// CreateSecurityPage(psi)
// psi : ISecurityInformation* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ACLUI.dll", {
  CreateSecurityPage: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.CreateSecurityPage(psi)
// psi : ISecurityInformation* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* CreateSecurityPage(
    void* psi);
C, "ACLUI.dll");
// $ffi->CreateSecurityPage(psi);
// psi : ISecurityInformation*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Aclui extends StdCallLibrary {
    Aclui INSTANCE = Native.load("aclui", Aclui.class);
    Pointer CreateSecurityPage(
        Pointer psi   // ISecurityInformation*
    );
}
@[Link("aclui")]
lib LibACLUI
  fun CreateSecurityPage = CreateSecurityPage(
    psi : Void*   # ISecurityInformation*
  ) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CreateSecurityPageNative = Pointer<Void> Function(Pointer<Void>);
typedef CreateSecurityPageDart = Pointer<Void> Function(Pointer<Void>);
final CreateSecurityPage = DynamicLibrary.open('ACLUI.dll')
    .lookupFunction<CreateSecurityPageNative, CreateSecurityPageDart>('CreateSecurityPage');
// psi : ISecurityInformation* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CreateSecurityPage(
  psi: Pointer   // ISecurityInformation*
): THandle; stdcall;
  external 'ACLUI.dll' name 'CreateSecurityPage';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CreateSecurityPage"
  c_CreateSecurityPage :: Ptr () -> IO (Ptr ())
-- psi : ISecurityInformation* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let createsecuritypage =
  foreign "CreateSecurityPage"
    ((ptr void) @-> returning (ptr void))
(* psi : ISecurityInformation* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library aclui (t "ACLUI.dll"))
(cffi:use-foreign-library aclui)

(cffi:defcfun ("CreateSecurityPage" create-security-page :convention :stdcall) :pointer
  (psi :pointer))   ; ISecurityInformation*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CreateSecurityPage = Win32::API::More->new('ACLUI',
    'HANDLE CreateSecurityPage(LPVOID psi)');
# my $ret = $CreateSecurityPage->Call($psi);
# psi : ISecurityInformation* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型