ホーム › Storage.Jet › JetGetErrorInfoW
JetGetErrorInfoW
関数ESEのエラーに関する詳細情報を取得する(Unicode版)。
シグネチャ
// ESENT.dll
#include <windows.h>
INT JetGetErrorInfoW(
void* pvContext, // optional
void* pvResult,
DWORD cbMax,
DWORD InfoLevel,
DWORD grbit
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pvContext | void* | inoptional | エラー情報を取得する元となる入力コンテキスト(JET_ERR値等)へのポインタ。 |
| pvResult | void* | out | 取得したエラー情報を格納する出力バッファへのポインタ。 |
| cbMax | DWORD | in | pvResultバッファのバイト単位サイズ。 |
| InfoLevel | DWORD | in | 取得するエラー情報の詳細レベルを示すJET_ErrorInfo値。 |
| grbit | DWORD | in | 予約済み。通常は0を指定するフラグ引数。 |
戻り値の型: INT
各言語での呼び出し定義
// ESENT.dll
#include <windows.h>
INT JetGetErrorInfoW(
void* pvContext, // optional
void* pvResult,
DWORD cbMax,
DWORD InfoLevel,
DWORD grbit
);[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetGetErrorInfoW(
IntPtr pvContext, // void* optional
IntPtr pvResult, // void* out
uint cbMax, // DWORD
uint InfoLevel, // DWORD
uint grbit // DWORD
);<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetGetErrorInfoW(
pvContext As IntPtr, ' void* optional
pvResult As IntPtr, ' void* out
cbMax As UInteger, ' DWORD
InfoLevel As UInteger, ' DWORD
grbit As UInteger ' DWORD
) As Integer
End Function' pvContext : void* optional
' pvResult : void* out
' cbMax : DWORD
' InfoLevel : DWORD
' grbit : DWORD
Declare PtrSafe Function JetGetErrorInfoW Lib "esent" ( _
ByVal pvContext As LongPtr, _
ByVal pvResult As LongPtr, _
ByVal cbMax As Long, _
ByVal InfoLevel As Long, _
ByVal grbit As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JetGetErrorInfoW = ctypes.windll.esent.JetGetErrorInfoW
JetGetErrorInfoW.restype = ctypes.c_int
JetGetErrorInfoW.argtypes = [
ctypes.POINTER(None), # pvContext : void* optional
ctypes.POINTER(None), # pvResult : void* out
wintypes.DWORD, # cbMax : DWORD
wintypes.DWORD, # InfoLevel : DWORD
wintypes.DWORD, # grbit : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ESENT.dll')
JetGetErrorInfoW = Fiddle::Function.new(
lib['JetGetErrorInfoW'],
[
Fiddle::TYPE_VOIDP, # pvContext : void* optional
Fiddle::TYPE_VOIDP, # pvResult : void* out
-Fiddle::TYPE_INT, # cbMax : DWORD
-Fiddle::TYPE_INT, # InfoLevel : DWORD
-Fiddle::TYPE_INT, # grbit : DWORD
],
Fiddle::TYPE_INT)#[link(name = "esent")]
extern "system" {
fn JetGetErrorInfoW(
pvContext: *mut (), // void* optional
pvResult: *mut (), // void* out
cbMax: u32, // DWORD
InfoLevel: u32, // DWORD
grbit: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetGetErrorInfoW(IntPtr pvContext, IntPtr pvResult, uint cbMax, uint InfoLevel, uint grbit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetGetErrorInfoW' -Namespace Win32 -PassThru
# $api::JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)#uselib "ESENT.dll"
#func global JetGetErrorInfoW "JetGetErrorInfoW" sptr, sptr, sptr, sptr, sptr
; JetGetErrorInfoW pvContext, pvResult, cbMax, InfoLevel, grbit ; 戻り値は stat
; pvContext : void* optional -> "sptr"
; pvResult : void* out -> "sptr"
; cbMax : DWORD -> "sptr"
; InfoLevel : DWORD -> "sptr"
; grbit : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ESENT.dll"
#cfunc global JetGetErrorInfoW "JetGetErrorInfoW" sptr, sptr, int, int, int
; res = JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
; pvContext : void* optional -> "sptr"
; pvResult : void* out -> "sptr"
; cbMax : DWORD -> "int"
; InfoLevel : DWORD -> "int"
; grbit : DWORD -> "int"; INT JetGetErrorInfoW(void* pvContext, void* pvResult, DWORD cbMax, DWORD InfoLevel, DWORD grbit)
#uselib "ESENT.dll"
#cfunc global JetGetErrorInfoW "JetGetErrorInfoW" intptr, intptr, int, int, int
; res = JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
; pvContext : void* optional -> "intptr"
; pvResult : void* out -> "intptr"
; cbMax : DWORD -> "int"
; InfoLevel : DWORD -> "int"
; grbit : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
esent = windows.NewLazySystemDLL("ESENT.dll")
procJetGetErrorInfoW = esent.NewProc("JetGetErrorInfoW")
)
// pvContext (void* optional), pvResult (void* out), cbMax (DWORD), InfoLevel (DWORD), grbit (DWORD)
r1, _, err := procJetGetErrorInfoW.Call(
uintptr(pvContext),
uintptr(pvResult),
uintptr(cbMax),
uintptr(InfoLevel),
uintptr(grbit),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction JetGetErrorInfoW(
pvContext: Pointer; // void* optional
pvResult: Pointer; // void* out
cbMax: DWORD; // DWORD
InfoLevel: DWORD; // DWORD
grbit: DWORD // DWORD
): Integer; stdcall;
external 'ESENT.dll' name 'JetGetErrorInfoW';result := DllCall("ESENT\JetGetErrorInfoW"
, "Ptr", pvContext ; void* optional
, "Ptr", pvResult ; void* out
, "UInt", cbMax ; DWORD
, "UInt", InfoLevel ; DWORD
, "UInt", grbit ; DWORD
, "Int") ; return: INT●JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit) = DLL("ESENT.dll", "int JetGetErrorInfoW(void*, void*, dword, dword, dword)")
# 呼び出し: JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
# pvContext : void* optional -> "void*"
# pvResult : void* out -> "void*"
# cbMax : DWORD -> "dword"
# InfoLevel : DWORD -> "dword"
# grbit : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "esent" fn JetGetErrorInfoW(
pvContext: ?*anyopaque, // void* optional
pvResult: ?*anyopaque, // void* out
cbMax: u32, // DWORD
InfoLevel: u32, // DWORD
grbit: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc JetGetErrorInfoW(
pvContext: pointer, # void* optional
pvResult: pointer, # void* out
cbMax: uint32, # DWORD
InfoLevel: uint32, # DWORD
grbit: uint32 # DWORD
): int32 {.importc: "JetGetErrorInfoW", stdcall, dynlib: "ESENT.dll".}pragma(lib, "esent");
extern(Windows)
int JetGetErrorInfoW(
void* pvContext, // void* optional
void* pvResult, // void* out
uint cbMax, // DWORD
uint InfoLevel, // DWORD
uint grbit // DWORD
);ccall((:JetGetErrorInfoW, "ESENT.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}, UInt32, UInt32, UInt32),
pvContext, pvResult, cbMax, InfoLevel, grbit)
# pvContext : void* optional -> Ptr{Cvoid}
# pvResult : void* out -> Ptr{Cvoid}
# cbMax : DWORD -> UInt32
# InfoLevel : DWORD -> UInt32
# grbit : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t JetGetErrorInfoW(
void* pvContext,
void* pvResult,
uint32_t cbMax,
uint32_t InfoLevel,
uint32_t grbit);
]]
local esent = ffi.load("esent")
-- esent.JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
-- pvContext : void* optional
-- pvResult : void* out
-- cbMax : DWORD
-- InfoLevel : DWORD
-- grbit : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ESENT.dll');
const JetGetErrorInfoW = lib.func('__stdcall', 'JetGetErrorInfoW', 'int32_t', ['void *', 'void *', 'uint32_t', 'uint32_t', 'uint32_t']);
// JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
// pvContext : void* optional -> 'void *'
// pvResult : void* out -> 'void *'
// cbMax : DWORD -> 'uint32_t'
// InfoLevel : DWORD -> 'uint32_t'
// grbit : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ESENT.dll", {
JetGetErrorInfoW: { parameters: ["pointer", "pointer", "u32", "u32", "u32"], result: "i32" },
});
// lib.symbols.JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit)
// pvContext : void* optional -> "pointer"
// pvResult : void* out -> "pointer"
// cbMax : DWORD -> "u32"
// InfoLevel : DWORD -> "u32"
// grbit : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t JetGetErrorInfoW(
void* pvContext,
void* pvResult,
uint32_t cbMax,
uint32_t InfoLevel,
uint32_t grbit);
C, "ESENT.dll");
// $ffi->JetGetErrorInfoW(pvContext, pvResult, cbMax, InfoLevel, grbit);
// pvContext : void* optional
// pvResult : void* out
// cbMax : DWORD
// InfoLevel : DWORD
// grbit : DWORD
// 構造体/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 Esent extends StdCallLibrary {
Esent INSTANCE = Native.load("esent", Esent.class);
int JetGetErrorInfoW(
Pointer pvContext, // void* optional
Pointer pvResult, // void* out
int cbMax, // DWORD
int InfoLevel, // DWORD
int grbit // DWORD
);
}@[Link("esent")]
lib LibESENT
fun JetGetErrorInfoW = JetGetErrorInfoW(
pvContext : Void*, # void* optional
pvResult : Void*, # void* out
cbMax : UInt32, # DWORD
InfoLevel : UInt32, # DWORD
grbit : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef JetGetErrorInfoWNative = Int32 Function(Pointer<Void>, Pointer<Void>, Uint32, Uint32, Uint32);
typedef JetGetErrorInfoWDart = int Function(Pointer<Void>, Pointer<Void>, int, int, int);
final JetGetErrorInfoW = DynamicLibrary.open('ESENT.dll')
.lookupFunction<JetGetErrorInfoWNative, JetGetErrorInfoWDart>('JetGetErrorInfoW');
// pvContext : void* optional -> Pointer<Void>
// pvResult : void* out -> Pointer<Void>
// cbMax : DWORD -> Uint32
// InfoLevel : DWORD -> Uint32
// grbit : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function JetGetErrorInfoW(
pvContext: Pointer; // void* optional
pvResult: Pointer; // void* out
cbMax: DWORD; // DWORD
InfoLevel: DWORD; // DWORD
grbit: DWORD // DWORD
): Integer; stdcall;
external 'ESENT.dll' name 'JetGetErrorInfoW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "JetGetErrorInfoW"
c_JetGetErrorInfoW :: Ptr () -> Ptr () -> Word32 -> Word32 -> Word32 -> IO Int32
-- pvContext : void* optional -> Ptr ()
-- pvResult : void* out -> Ptr ()
-- cbMax : DWORD -> Word32
-- InfoLevel : DWORD -> Word32
-- grbit : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let jetgeterrorinfow =
foreign "JetGetErrorInfoW"
((ptr void) @-> (ptr void) @-> uint32_t @-> uint32_t @-> uint32_t @-> returning int32_t)
(* pvContext : void* optional -> (ptr void) *)
(* pvResult : void* out -> (ptr void) *)
(* cbMax : DWORD -> uint32_t *)
(* InfoLevel : DWORD -> uint32_t *)
(* grbit : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library esent (t "ESENT.dll"))
(cffi:use-foreign-library esent)
(cffi:defcfun ("JetGetErrorInfoW" jet-get-error-info-w :convention :stdcall) :int32
(pv-context :pointer) ; void* optional
(pv-result :pointer) ; void* out
(cb-max :uint32) ; DWORD
(info-level :uint32) ; DWORD
(grbit :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $JetGetErrorInfoW = Win32::API::More->new('ESENT',
'int JetGetErrorInfoW(LPVOID pvContext, LPVOID pvResult, DWORD cbMax, DWORD InfoLevel, DWORD grbit)');
# my $ret = $JetGetErrorInfoW->Call($pvContext, $pvResult, $cbMax, $InfoLevel, $grbit);
# pvContext : void* optional -> LPVOID
# pvResult : void* out -> LPVOID
# cbMax : DWORD -> DWORD
# InfoLevel : DWORD -> DWORD
# grbit : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。