Win32 API 日本語リファレンス
ホームSystem.Js › JsGetOwnPropertyDescriptor

JsGetOwnPropertyDescriptor

関数
オブジェクト自身のプロパティ記述子を取得する。
DLLchakra.dll呼出規約winapi

シグネチャ

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

JsErrorCode JsGetOwnPropertyDescriptor(
    void* object,
    void* propertyId,
    void** propertyDescriptor
);

パラメーター

名前方向
objectvoid*in
propertyIdvoid*in
propertyDescriptorvoid**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   // JsErrorCode
function 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)。