ホーム › System.WindowsProgramming › RecordFeatureError
RecordFeatureError
関数フィーチャーで発生したエラーを記録する。
シグネチャ
// api-ms-win-core-featurestaging-l1-1-0.dll
#include <windows.h>
void RecordFeatureError(
DWORD featureId,
const FEATURE_ERROR* error
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| featureId | DWORD | in | エラーを記録する対象の機能ID。 |
| error | FEATURE_ERROR* | in | 記録するエラー情報を格納したFEATURE_ERROR構造体へのポインタ。 |
戻り値の型: void
各言語での呼び出し定義
// api-ms-win-core-featurestaging-l1-1-0.dll
#include <windows.h>
void RecordFeatureError(
DWORD featureId,
const FEATURE_ERROR* error
);[DllImport("api-ms-win-core-featurestaging-l1-1-0.dll", ExactSpelling = true)]
static extern void RecordFeatureError(
uint featureId, // DWORD
IntPtr error // FEATURE_ERROR*
);<DllImport("api-ms-win-core-featurestaging-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Sub RecordFeatureError(
featureId As UInteger, ' DWORD
[error] As IntPtr ' FEATURE_ERROR*
)
End Sub' featureId : DWORD
' error : FEATURE_ERROR*
Declare PtrSafe Sub RecordFeatureError Lib "api-ms-win-core-featurestaging-l1-1-0" ( _
ByVal featureId As Long, _
ByVal error As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RecordFeatureError = ctypes.windll.LoadLibrary("api-ms-win-core-featurestaging-l1-1-0.dll").RecordFeatureError
RecordFeatureError.restype = None
RecordFeatureError.argtypes = [
wintypes.DWORD, # featureId : DWORD
ctypes.c_void_p, # error : FEATURE_ERROR*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-featurestaging-l1-1-0.dll')
RecordFeatureError = Fiddle::Function.new(
lib['RecordFeatureError'],
[
-Fiddle::TYPE_INT, # featureId : DWORD
Fiddle::TYPE_VOIDP, # error : FEATURE_ERROR*
],
Fiddle::TYPE_VOID)#[link(name = "api-ms-win-core-featurestaging-l1-1-0")]
extern "system" {
fn RecordFeatureError(
featureId: u32, // DWORD
error: *const FEATURE_ERROR // FEATURE_ERROR*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-featurestaging-l1-1-0.dll")]
public static extern void RecordFeatureError(uint featureId, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-featurestaging-l1-1-0_RecordFeatureError' -Namespace Win32 -PassThru
# $api::RecordFeatureError(featureId, error)#uselib "api-ms-win-core-featurestaging-l1-1-0.dll"
#func global RecordFeatureError "RecordFeatureError" sptr, sptr
; RecordFeatureError featureId, varptr(error)
; featureId : DWORD -> "sptr"
; error : FEATURE_ERROR* -> "sptr"出力引数:
#uselib "api-ms-win-core-featurestaging-l1-1-0.dll" #func global RecordFeatureError "RecordFeatureError" int, var ; RecordFeatureError featureId, error ; featureId : DWORD -> "int" ; error : FEATURE_ERROR* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-core-featurestaging-l1-1-0.dll" #func global RecordFeatureError "RecordFeatureError" int, sptr ; RecordFeatureError featureId, varptr(error) ; featureId : DWORD -> "int" ; error : FEATURE_ERROR* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void RecordFeatureError(DWORD featureId, FEATURE_ERROR* error) #uselib "api-ms-win-core-featurestaging-l1-1-0.dll" #func global RecordFeatureError "RecordFeatureError" int, var ; RecordFeatureError featureId, error ; featureId : DWORD -> "int" ; error : FEATURE_ERROR* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void RecordFeatureError(DWORD featureId, FEATURE_ERROR* error) #uselib "api-ms-win-core-featurestaging-l1-1-0.dll" #func global RecordFeatureError "RecordFeatureError" int, intptr ; RecordFeatureError featureId, varptr(error) ; featureId : DWORD -> "int" ; error : FEATURE_ERROR* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_featurestaging_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-featurestaging-l1-1-0.dll")
procRecordFeatureError = api_ms_win_core_featurestaging_l1_1_0.NewProc("RecordFeatureError")
)
// featureId (DWORD), error (FEATURE_ERROR*)
r1, _, err := procRecordFeatureError.Call(
uintptr(featureId),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure RecordFeatureError(
featureId: DWORD; // DWORD
error: Pointer // FEATURE_ERROR*
); stdcall;
external 'api-ms-win-core-featurestaging-l1-1-0.dll' name 'RecordFeatureError';result := DllCall("api-ms-win-core-featurestaging-l1-1-0\RecordFeatureError"
, "UInt", featureId ; DWORD
, "Ptr", error ; FEATURE_ERROR*
, "Int") ; return: void●RecordFeatureError(featureId, error) = DLL("api-ms-win-core-featurestaging-l1-1-0.dll", "int RecordFeatureError(dword, void*)")
# 呼び出し: RecordFeatureError(featureId, error)
# featureId : DWORD -> "dword"
# error : FEATURE_ERROR* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "api-ms-win-core-featurestaging-l1-1-0" fn RecordFeatureError(
featureId: u32, // DWORD
error: [*c]FEATURE_ERROR // FEATURE_ERROR*
) callconv(std.os.windows.WINAPI) void;proc RecordFeatureError(
featureId: uint32, # DWORD
error: ptr FEATURE_ERROR # FEATURE_ERROR*
) {.importc: "RecordFeatureError", stdcall, dynlib: "api-ms-win-core-featurestaging-l1-1-0.dll".}pragma(lib, "api-ms-win-core-featurestaging-l1-1-0");
extern(Windows)
void RecordFeatureError(
uint featureId, // DWORD
FEATURE_ERROR* error // FEATURE_ERROR*
);ccall((:RecordFeatureError, "api-ms-win-core-featurestaging-l1-1-0.dll"), stdcall, Cvoid,
(UInt32, Ptr{FEATURE_ERROR}),
featureId, error)
# featureId : DWORD -> UInt32
# error : FEATURE_ERROR* -> Ptr{FEATURE_ERROR}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void RecordFeatureError(
uint32_t featureId,
void* error);
]]
local api-ms-win-core-featurestaging-l1-1-0 = ffi.load("api-ms-win-core-featurestaging-l1-1-0")
-- api-ms-win-core-featurestaging-l1-1-0.RecordFeatureError(featureId, error)
-- featureId : DWORD
-- error : FEATURE_ERROR*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('api-ms-win-core-featurestaging-l1-1-0.dll');
const RecordFeatureError = lib.func('__stdcall', 'RecordFeatureError', 'void', ['uint32_t', 'void *']);
// RecordFeatureError(featureId, error)
// featureId : DWORD -> 'uint32_t'
// error : FEATURE_ERROR* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("api-ms-win-core-featurestaging-l1-1-0.dll", {
RecordFeatureError: { parameters: ["u32", "pointer"], result: "void" },
});
// lib.symbols.RecordFeatureError(featureId, error)
// featureId : DWORD -> "u32"
// error : FEATURE_ERROR* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void RecordFeatureError(
uint32_t featureId,
void* error);
C, "api-ms-win-core-featurestaging-l1-1-0.dll");
// $ffi->RecordFeatureError(featureId, error);
// featureId : DWORD
// error : FEATURE_ERROR*
// 構造体/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 Api-ms-win-core-featurestaging-l1-1-0 extends StdCallLibrary {
Api-ms-win-core-featurestaging-l1-1-0 INSTANCE = Native.load("api-ms-win-core-featurestaging-l1-1-0", Api-ms-win-core-featurestaging-l1-1-0.class);
void RecordFeatureError(
int featureId, // DWORD
Pointer error // FEATURE_ERROR*
);
}@[Link("api-ms-win-core-featurestaging-l1-1-0")]
lib Libapi-ms-win-core-featurestaging-l1-1-0
fun RecordFeatureError = RecordFeatureError(
featureId : UInt32, # DWORD
error : FEATURE_ERROR* # FEATURE_ERROR*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RecordFeatureErrorNative = Void Function(Uint32, Pointer<Void>);
typedef RecordFeatureErrorDart = void Function(int, Pointer<Void>);
final RecordFeatureError = DynamicLibrary.open('api-ms-win-core-featurestaging-l1-1-0.dll')
.lookupFunction<RecordFeatureErrorNative, RecordFeatureErrorDart>('RecordFeatureError');
// featureId : DWORD -> Uint32
// error : FEATURE_ERROR* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure RecordFeatureError(
featureId: DWORD; // DWORD
error: Pointer // FEATURE_ERROR*
); stdcall;
external 'api-ms-win-core-featurestaging-l1-1-0.dll' name 'RecordFeatureError';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RecordFeatureError"
c_RecordFeatureError :: Word32 -> Ptr () -> IO ()
-- featureId : DWORD -> Word32
-- error : FEATURE_ERROR* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let recordfeatureerror =
foreign "RecordFeatureError"
(uint32_t @-> (ptr void) @-> returning void)
(* featureId : DWORD -> uint32_t *)
(* error : FEATURE_ERROR* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library api-ms-win-core-featurestaging-l1-1-0 (t "api-ms-win-core-featurestaging-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-core-featurestaging-l1-1-0)
(cffi:defcfun ("RecordFeatureError" record-feature-error :convention :stdcall) :void
(feature-id :uint32) ; DWORD
(error :pointer)) ; FEATURE_ERROR*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RecordFeatureError = Win32::API::More->new('api-ms-win-core-featurestaging-l1-1-0',
'void RecordFeatureError(DWORD featureId, LPVOID error)');
# my $ret = $RecordFeatureError->Call($featureId, $error);
# featureId : DWORD -> DWORD
# error : FEATURE_ERROR* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型