JsGetOwnPropertyDescriptor
関数オブジェクト自身のプロパティ記述子を取得する。
シグネチャ
// chakra.dll
#include <windows.h>
JsErrorCode JsGetOwnPropertyDescriptor(
void* object,
void* propertyId,
void** propertyDescriptor
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| object | void* | in | プロパティ記述子を取得する対象のオブジェクト。 |
| propertyId | void* | in | 記述子を取得するプロパティの識別子(JsPropertyIdRef)。 |
| propertyDescriptor | void** | out | 取得したプロパティ記述子オブジェクトを受け取るポインタのアドレス。 |
戻り値の型: JsErrorCode
各言語での呼び出し定義
// chakra.dll
#include <windows.h>
JsErrorCode JsGetOwnPropertyDescriptor(
void* object,
void* propertyId,
void** propertyDescriptor
);[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsGetOwnPropertyDescriptor(
IntPtr object, // void*
IntPtr propertyId, // void*
IntPtr propertyDescriptor // void** out
);<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsGetOwnPropertyDescriptor(
[object] As IntPtr, ' void*
propertyId As IntPtr, ' void*
propertyDescriptor As IntPtr ' void** out
) As UInteger
End Function' object : void*
' propertyId : void*
' propertyDescriptor : void** out
Declare PtrSafe Function JsGetOwnPropertyDescriptor Lib "chakra" ( _
ByVal object As LongPtr, _
ByVal propertyId As LongPtr, _
ByVal propertyDescriptor As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JsGetOwnPropertyDescriptor = ctypes.windll.chakra.JsGetOwnPropertyDescriptor
JsGetOwnPropertyDescriptor.restype = wintypes.DWORD
JsGetOwnPropertyDescriptor.argtypes = [
ctypes.POINTER(None), # object : void*
ctypes.POINTER(None), # propertyId : void*
ctypes.c_void_p, # propertyDescriptor : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('chakra.dll')
JsGetOwnPropertyDescriptor = Fiddle::Function.new(
lib['JsGetOwnPropertyDescriptor'],
[
Fiddle::TYPE_VOIDP, # object : void*
Fiddle::TYPE_VOIDP, # propertyId : void*
Fiddle::TYPE_VOIDP, # propertyDescriptor : void** out
],
-Fiddle::TYPE_INT)#[link(name = "chakra")]
extern "system" {
fn JsGetOwnPropertyDescriptor(
object: *mut (), // void*
propertyId: *mut (), // void*
propertyDescriptor: *mut *mut () // void** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("chakra.dll")]
public static extern uint JsGetOwnPropertyDescriptor(IntPtr object, IntPtr propertyId, IntPtr propertyDescriptor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'chakra_JsGetOwnPropertyDescriptor' -Namespace Win32 -PassThru
# $api::JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)#uselib "chakra.dll"
#func global JsGetOwnPropertyDescriptor "JsGetOwnPropertyDescriptor" sptr, sptr, sptr
; JsGetOwnPropertyDescriptor object, propertyId, propertyDescriptor ; 戻り値は stat
; object : void* -> "sptr"
; propertyId : void* -> "sptr"
; propertyDescriptor : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "chakra.dll"
#cfunc global JsGetOwnPropertyDescriptor "JsGetOwnPropertyDescriptor" sptr, sptr, sptr
; res = JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
; object : void* -> "sptr"
; propertyId : void* -> "sptr"
; propertyDescriptor : void** out -> "sptr"; JsErrorCode JsGetOwnPropertyDescriptor(void* object, void* propertyId, void** propertyDescriptor)
#uselib "chakra.dll"
#cfunc global JsGetOwnPropertyDescriptor "JsGetOwnPropertyDescriptor" intptr, intptr, intptr
; res = JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
; object : void* -> "intptr"
; propertyId : void* -> "intptr"
; propertyDescriptor : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
chakra = windows.NewLazySystemDLL("chakra.dll")
procJsGetOwnPropertyDescriptor = chakra.NewProc("JsGetOwnPropertyDescriptor")
)
// object (void*), propertyId (void*), propertyDescriptor (void** out)
r1, _, err := procJsGetOwnPropertyDescriptor.Call(
uintptr(object),
uintptr(propertyId),
uintptr(propertyDescriptor),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // JsErrorCodefunction JsGetOwnPropertyDescriptor(
object: Pointer; // void*
propertyId: Pointer; // void*
propertyDescriptor: Pointer // void** out
): DWORD; stdcall;
external 'chakra.dll' name 'JsGetOwnPropertyDescriptor';result := DllCall("chakra\JsGetOwnPropertyDescriptor"
, "Ptr", object ; void*
, "Ptr", propertyId ; void*
, "Ptr", propertyDescriptor ; void** out
, "UInt") ; return: JsErrorCode●JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor) = DLL("chakra.dll", "dword JsGetOwnPropertyDescriptor(void*, void*, void*)")
# 呼び出し: JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
# object : void* -> "void*"
# propertyId : void* -> "void*"
# propertyDescriptor : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "chakra" fn JsGetOwnPropertyDescriptor(
object: ?*anyopaque, // void*
propertyId: ?*anyopaque, // void*
propertyDescriptor: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) u32;proc JsGetOwnPropertyDescriptor(
`object`: pointer, # void*
propertyId: pointer, # void*
propertyDescriptor: pointer # void** out
): uint32 {.importc: "JsGetOwnPropertyDescriptor", stdcall, dynlib: "chakra.dll".}pragma(lib, "chakra");
extern(Windows)
uint JsGetOwnPropertyDescriptor(
void* object, // void*
void* propertyId, // void*
void** propertyDescriptor // void** out
);ccall((:JsGetOwnPropertyDescriptor, "chakra.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
object, propertyId, propertyDescriptor)
# object : void* -> Ptr{Cvoid}
# propertyId : void* -> Ptr{Cvoid}
# propertyDescriptor : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t JsGetOwnPropertyDescriptor(
void* object,
void* propertyId,
void** propertyDescriptor);
]]
local chakra = ffi.load("chakra")
-- chakra.JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
-- object : void*
-- propertyId : void*
-- propertyDescriptor : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('chakra.dll');
const JsGetOwnPropertyDescriptor = lib.func('__stdcall', 'JsGetOwnPropertyDescriptor', 'uint32_t', ['void *', 'void *', 'void *']);
// JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
// object : void* -> 'void *'
// propertyId : void* -> 'void *'
// propertyDescriptor : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("chakra.dll", {
JsGetOwnPropertyDescriptor: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor)
// object : void* -> "pointer"
// propertyId : void* -> "pointer"
// propertyDescriptor : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t JsGetOwnPropertyDescriptor(
void* object,
void* propertyId,
void** propertyDescriptor);
C, "chakra.dll");
// $ffi->JsGetOwnPropertyDescriptor(object, propertyId, propertyDescriptor);
// object : void*
// propertyId : void*
// propertyDescriptor : void** out
// 構造体/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 Chakra extends StdCallLibrary {
Chakra INSTANCE = Native.load("chakra", Chakra.class);
int JsGetOwnPropertyDescriptor(
Pointer object, // void*
Pointer propertyId, // void*
Pointer propertyDescriptor // void** out
);
}@[Link("chakra")]
lib Libchakra
fun JsGetOwnPropertyDescriptor = JsGetOwnPropertyDescriptor(
object : Void*, # void*
propertyId : Void*, # void*
propertyDescriptor : Void** # void** out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef JsGetOwnPropertyDescriptorNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef JsGetOwnPropertyDescriptorDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final JsGetOwnPropertyDescriptor = DynamicLibrary.open('chakra.dll')
.lookupFunction<JsGetOwnPropertyDescriptorNative, JsGetOwnPropertyDescriptorDart>('JsGetOwnPropertyDescriptor');
// object : void* -> Pointer<Void>
// propertyId : void* -> Pointer<Void>
// propertyDescriptor : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function JsGetOwnPropertyDescriptor(
object: Pointer; // void*
propertyId: Pointer; // void*
propertyDescriptor: Pointer // void** out
): DWORD; stdcall;
external 'chakra.dll' name 'JsGetOwnPropertyDescriptor';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "JsGetOwnPropertyDescriptor"
c_JsGetOwnPropertyDescriptor :: Ptr () -> Ptr () -> Ptr () -> IO Word32
-- object : void* -> Ptr ()
-- propertyId : void* -> Ptr ()
-- propertyDescriptor : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let jsgetownpropertydescriptor =
foreign "JsGetOwnPropertyDescriptor"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* object : void* -> (ptr void) *)
(* propertyId : void* -> (ptr void) *)
(* propertyDescriptor : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library chakra (t "chakra.dll"))
(cffi:use-foreign-library chakra)
(cffi:defcfun ("JsGetOwnPropertyDescriptor" js-get-own-property-descriptor :convention :stdcall) :uint32
(object :pointer) ; void*
(property-id :pointer) ; void*
(property-descriptor :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $JsGetOwnPropertyDescriptor = Win32::API::More->new('chakra',
'DWORD JsGetOwnPropertyDescriptor(LPVOID object, LPVOID propertyId, LPVOID propertyDescriptor)');
# my $ret = $JsGetOwnPropertyDescriptor->Call($object, $propertyId, $propertyDescriptor);
# object : void* -> LPVOID
# propertyId : void* -> LPVOID
# propertyDescriptor : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型