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

SQLDataSourcesA

関数
利用可能なODBCデータソースを列挙する。
DLLODBC32.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// ODBC32.dll  (ANSI / -A)
#include <windows.h>

SHORT SQLDataSourcesA(
    void* henv,
    WORD fDirection,
    BYTE* szDSN,   // optional
    SHORT cbDSNMax,
    SHORT* pcbDSN,
    BYTE* szDescription,   // optional
    SHORT cbDescriptionMax,
    SHORT* pcbDescription
);

パラメーター

名前方向説明
henvvoid*inoutODBCの環境ハンドル。データソース列挙対象。
fDirectionWORDin取得方向。SQL_FETCH_FIRST/NEXT等を指定して列挙する。
szDSNBYTE*outoptionalデータソース名を受け取るバッファ。出力用。
cbDSNMaxSHORTinszDSNバッファのバイト長。
pcbDSNSHORT*inout実際に返されたDSNのバイト長を受け取るポインタ。
szDescriptionBYTE*outoptionalデータソースの説明を受け取るバッファ。出力用。
cbDescriptionMaxSHORTinszDescriptionバッファのバイト長。
pcbDescriptionSHORT*inout実際に返された説明のバイト長を受け取るポインタ。

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll  (ANSI / -A)
#include <windows.h>

SHORT SQLDataSourcesA(
    void* henv,
    WORD fDirection,
    BYTE* szDSN,   // optional
    SHORT cbDSNMax,
    SHORT* pcbDSN,
    BYTE* szDescription,   // optional
    SHORT cbDescriptionMax,
    SHORT* pcbDescription
);
[DllImport("ODBC32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern short SQLDataSourcesA(
    IntPtr henv,   // void* in/out
    ushort fDirection,   // WORD
    IntPtr szDSN,   // BYTE* optional, out
    short cbDSNMax,   // SHORT
    ref short pcbDSN,   // SHORT* in/out
    IntPtr szDescription,   // BYTE* optional, out
    short cbDescriptionMax,   // SHORT
    ref short pcbDescription   // SHORT* in/out
);
<DllImport("ODBC32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SQLDataSourcesA(
    henv As IntPtr,   ' void* in/out
    fDirection As UShort,   ' WORD
    szDSN As IntPtr,   ' BYTE* optional, out
    cbDSNMax As Short,   ' SHORT
    ByRef pcbDSN As Short,   ' SHORT* in/out
    szDescription As IntPtr,   ' BYTE* optional, out
    cbDescriptionMax As Short,   ' SHORT
    ByRef pcbDescription As Short   ' SHORT* in/out
) As Short
End Function
' henv : void* in/out
' fDirection : WORD
' szDSN : BYTE* optional, out
' cbDSNMax : SHORT
' pcbDSN : SHORT* in/out
' szDescription : BYTE* optional, out
' cbDescriptionMax : SHORT
' pcbDescription : SHORT* in/out
Declare PtrSafe Function SQLDataSourcesA Lib "odbc32" ( _
    ByVal henv As LongPtr, _
    ByVal fDirection As Integer, _
    ByVal szDSN As LongPtr, _
    ByVal cbDSNMax As Integer, _
    ByRef pcbDSN As Integer, _
    ByVal szDescription As LongPtr, _
    ByVal cbDescriptionMax As Integer, _
    ByRef pcbDescription As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SQLDataSourcesA = ctypes.windll.odbc32.SQLDataSourcesA
SQLDataSourcesA.restype = ctypes.c_short
SQLDataSourcesA.argtypes = [
    ctypes.POINTER(None),  # henv : void* in/out
    ctypes.c_ushort,  # fDirection : WORD
    ctypes.POINTER(ctypes.c_ubyte),  # szDSN : BYTE* optional, out
    ctypes.c_short,  # cbDSNMax : SHORT
    ctypes.POINTER(ctypes.c_short),  # pcbDSN : SHORT* in/out
    ctypes.POINTER(ctypes.c_ubyte),  # szDescription : BYTE* optional, out
    ctypes.c_short,  # cbDescriptionMax : SHORT
    ctypes.POINTER(ctypes.c_short),  # pcbDescription : SHORT* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLDataSourcesA = Fiddle::Function.new(
  lib['SQLDataSourcesA'],
  [
    Fiddle::TYPE_VOIDP,  # henv : void* in/out
    -Fiddle::TYPE_SHORT,  # fDirection : WORD
    Fiddle::TYPE_VOIDP,  # szDSN : BYTE* optional, out
    Fiddle::TYPE_SHORT,  # cbDSNMax : SHORT
    Fiddle::TYPE_VOIDP,  # pcbDSN : SHORT* in/out
    Fiddle::TYPE_VOIDP,  # szDescription : BYTE* optional, out
    Fiddle::TYPE_SHORT,  # cbDescriptionMax : SHORT
    Fiddle::TYPE_VOIDP,  # pcbDescription : SHORT* in/out
  ],
  Fiddle::TYPE_SHORT)
#[link(name = "odbc32")]
extern "system" {
    fn SQLDataSourcesA(
        henv: *mut (),  // void* in/out
        fDirection: u16,  // WORD
        szDSN: *mut u8,  // BYTE* optional, out
        cbDSNMax: i16,  // SHORT
        pcbDSN: *mut i16,  // SHORT* in/out
        szDescription: *mut u8,  // BYTE* optional, out
        cbDescriptionMax: i16,  // SHORT
        pcbDescription: *mut i16  // SHORT* in/out
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Ansi)]
public static extern short SQLDataSourcesA(IntPtr henv, ushort fDirection, IntPtr szDSN, short cbDSNMax, ref short pcbDSN, IntPtr szDescription, short cbDescriptionMax, ref short pcbDescription);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLDataSourcesA' -Namespace Win32 -PassThru
# $api::SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
#uselib "ODBC32.dll"
#func global SQLDataSourcesA "SQLDataSourcesA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SQLDataSourcesA henv, fDirection, varptr(szDSN), cbDSNMax, varptr(pcbDSN), varptr(szDescription), cbDescriptionMax, varptr(pcbDescription)   ; 戻り値は stat
; henv : void* in/out -> "sptr"
; fDirection : WORD -> "sptr"
; szDSN : BYTE* optional, out -> "sptr"
; cbDSNMax : SHORT -> "sptr"
; pcbDSN : SHORT* in/out -> "sptr"
; szDescription : BYTE* optional, out -> "sptr"
; cbDescriptionMax : SHORT -> "sptr"
; pcbDescription : SHORT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ODBC32.dll"
#cfunc global SQLDataSourcesA "SQLDataSourcesA" sptr, int, var, int, var, var, int, var
; res = SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
; henv : void* in/out -> "sptr"
; fDirection : WORD -> "int"
; szDSN : BYTE* optional, out -> "var"
; cbDSNMax : SHORT -> "int"
; pcbDSN : SHORT* in/out -> "var"
; szDescription : BYTE* optional, out -> "var"
; cbDescriptionMax : SHORT -> "int"
; pcbDescription : SHORT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; SHORT SQLDataSourcesA(void* henv, WORD fDirection, BYTE* szDSN, SHORT cbDSNMax, SHORT* pcbDSN, BYTE* szDescription, SHORT cbDescriptionMax, SHORT* pcbDescription)
#uselib "ODBC32.dll"
#cfunc global SQLDataSourcesA "SQLDataSourcesA" intptr, int, var, int, var, var, int, var
; res = SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
; henv : void* in/out -> "intptr"
; fDirection : WORD -> "int"
; szDSN : BYTE* optional, out -> "var"
; cbDSNMax : SHORT -> "int"
; pcbDSN : SHORT* in/out -> "var"
; szDescription : BYTE* optional, out -> "var"
; cbDescriptionMax : SHORT -> "int"
; pcbDescription : SHORT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLDataSourcesA = odbc32.NewProc("SQLDataSourcesA")
)

// henv (void* in/out), fDirection (WORD), szDSN (BYTE* optional, out), cbDSNMax (SHORT), pcbDSN (SHORT* in/out), szDescription (BYTE* optional, out), cbDescriptionMax (SHORT), pcbDescription (SHORT* in/out)
r1, _, err := procSQLDataSourcesA.Call(
	uintptr(henv),
	uintptr(fDirection),
	uintptr(szDSN),
	uintptr(cbDSNMax),
	uintptr(pcbDSN),
	uintptr(szDescription),
	uintptr(cbDescriptionMax),
	uintptr(pcbDescription),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLDataSourcesA(
  henv: Pointer;   // void* in/out
  fDirection: Word;   // WORD
  szDSN: Pointer;   // BYTE* optional, out
  cbDSNMax: Smallint;   // SHORT
  pcbDSN: Pointer;   // SHORT* in/out
  szDescription: Pointer;   // BYTE* optional, out
  cbDescriptionMax: Smallint;   // SHORT
  pcbDescription: Pointer   // SHORT* in/out
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLDataSourcesA';
result := DllCall("ODBC32\SQLDataSourcesA"
    , "Ptr", henv   ; void* in/out
    , "UShort", fDirection   ; WORD
    , "Ptr", szDSN   ; BYTE* optional, out
    , "Short", cbDSNMax   ; SHORT
    , "Ptr", pcbDSN   ; SHORT* in/out
    , "Ptr", szDescription   ; BYTE* optional, out
    , "Short", cbDescriptionMax   ; SHORT
    , "Ptr", pcbDescription   ; SHORT* in/out
    , "Short")   ; return: SHORT
●SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription) = DLL("ODBC32.dll", "int SQLDataSourcesA(void*, int, void*, int, void*, void*, int, void*)")
# 呼び出し: SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
# henv : void* in/out -> "void*"
# fDirection : WORD -> "int"
# szDSN : BYTE* optional, out -> "void*"
# cbDSNMax : SHORT -> "int"
# pcbDSN : SHORT* in/out -> "void*"
# szDescription : BYTE* optional, out -> "void*"
# cbDescriptionMax : SHORT -> "int"
# pcbDescription : SHORT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "odbc32" fn SQLDataSourcesA(
    henv: ?*anyopaque, // void* in/out
    fDirection: u16, // WORD
    szDSN: [*c]u8, // BYTE* optional, out
    cbDSNMax: i16, // SHORT
    pcbDSN: [*c]i16, // SHORT* in/out
    szDescription: [*c]u8, // BYTE* optional, out
    cbDescriptionMax: i16, // SHORT
    pcbDescription: [*c]i16 // SHORT* in/out
) callconv(std.os.windows.WINAPI) i16;
proc SQLDataSourcesA(
    henv: pointer,  # void* in/out
    fDirection: uint16,  # WORD
    szDSN: ptr uint8,  # BYTE* optional, out
    cbDSNMax: int16,  # SHORT
    pcbDSN: ptr int16,  # SHORT* in/out
    szDescription: ptr uint8,  # BYTE* optional, out
    cbDescriptionMax: int16,  # SHORT
    pcbDescription: ptr int16  # SHORT* in/out
): int16 {.importc: "SQLDataSourcesA", stdcall, dynlib: "ODBC32.dll".}
pragma(lib, "odbc32");
extern(Windows)
short SQLDataSourcesA(
    void* henv,   // void* in/out
    ushort fDirection,   // WORD
    ubyte* szDSN,   // BYTE* optional, out
    short cbDSNMax,   // SHORT
    short* pcbDSN,   // SHORT* in/out
    ubyte* szDescription,   // BYTE* optional, out
    short cbDescriptionMax,   // SHORT
    short* pcbDescription   // SHORT* in/out
);
ccall((:SQLDataSourcesA, "ODBC32.dll"), stdcall, Int16,
      (Ptr{Cvoid}, UInt16, Ptr{UInt8}, Int16, Ptr{Int16}, Ptr{UInt8}, Int16, Ptr{Int16}),
      henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
# henv : void* in/out -> Ptr{Cvoid}
# fDirection : WORD -> UInt16
# szDSN : BYTE* optional, out -> Ptr{UInt8}
# cbDSNMax : SHORT -> Int16
# pcbDSN : SHORT* in/out -> Ptr{Int16}
# szDescription : BYTE* optional, out -> Ptr{UInt8}
# cbDescriptionMax : SHORT -> Int16
# pcbDescription : SHORT* in/out -> Ptr{Int16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int16_t SQLDataSourcesA(
    void* henv,
    uint16_t fDirection,
    uint8_t* szDSN,
    int16_t cbDSNMax,
    int16_t* pcbDSN,
    uint8_t* szDescription,
    int16_t cbDescriptionMax,
    int16_t* pcbDescription);
]]
local odbc32 = ffi.load("odbc32")
-- odbc32.SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
-- henv : void* in/out
-- fDirection : WORD
-- szDSN : BYTE* optional, out
-- cbDSNMax : SHORT
-- pcbDSN : SHORT* in/out
-- szDescription : BYTE* optional, out
-- cbDescriptionMax : SHORT
-- pcbDescription : SHORT* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ODBC32.dll');
const SQLDataSourcesA = lib.func('__stdcall', 'SQLDataSourcesA', 'int16_t', ['void *', 'uint16_t', 'uint8_t *', 'int16_t', 'int16_t *', 'uint8_t *', 'int16_t', 'int16_t *']);
// SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
// henv : void* in/out -> 'void *'
// fDirection : WORD -> 'uint16_t'
// szDSN : BYTE* optional, out -> 'uint8_t *'
// cbDSNMax : SHORT -> 'int16_t'
// pcbDSN : SHORT* in/out -> 'int16_t *'
// szDescription : BYTE* optional, out -> 'uint8_t *'
// cbDescriptionMax : SHORT -> 'int16_t'
// pcbDescription : SHORT* in/out -> 'int16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ODBC32.dll", {
  SQLDataSourcesA: { parameters: ["pointer", "u16", "pointer", "i16", "pointer", "pointer", "i16", "pointer"], result: "i16" },
});
// lib.symbols.SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription)
// henv : void* in/out -> "pointer"
// fDirection : WORD -> "u16"
// szDSN : BYTE* optional, out -> "pointer"
// cbDSNMax : SHORT -> "i16"
// pcbDSN : SHORT* in/out -> "pointer"
// szDescription : BYTE* optional, out -> "pointer"
// cbDescriptionMax : SHORT -> "i16"
// pcbDescription : SHORT* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int16_t SQLDataSourcesA(
    void* henv,
    uint16_t fDirection,
    uint8_t* szDSN,
    int16_t cbDSNMax,
    int16_t* pcbDSN,
    uint8_t* szDescription,
    int16_t cbDescriptionMax,
    int16_t* pcbDescription);
C, "ODBC32.dll");
// $ffi->SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription);
// henv : void* in/out
// fDirection : WORD
// szDSN : BYTE* optional, out
// cbDSNMax : SHORT
// pcbDSN : SHORT* in/out
// szDescription : BYTE* optional, out
// cbDescriptionMax : SHORT
// pcbDescription : SHORT* in/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 Odbc32 extends StdCallLibrary {
    Odbc32 INSTANCE = Native.load("odbc32", Odbc32.class, W32APIOptions.ASCII_OPTIONS);
    short SQLDataSourcesA(
        Pointer henv,   // void* in/out
        short fDirection,   // WORD
        byte[] szDSN,   // BYTE* optional, out
        short cbDSNMax,   // SHORT
        ShortByReference pcbDSN,   // SHORT* in/out
        byte[] szDescription,   // BYTE* optional, out
        short cbDescriptionMax,   // SHORT
        ShortByReference pcbDescription   // SHORT* in/out
    );
}
@[Link("odbc32")]
lib LibODBC32
  fun SQLDataSourcesA = SQLDataSourcesA(
    henv : Void*,   # void* in/out
    fDirection : UInt16,   # WORD
    szDSN : UInt8*,   # BYTE* optional, out
    cbDSNMax : Int16,   # SHORT
    pcbDSN : Int16*,   # SHORT* in/out
    szDescription : UInt8*,   # BYTE* optional, out
    cbDescriptionMax : Int16,   # SHORT
    pcbDescription : Int16*   # SHORT* in/out
  ) : Int16
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SQLDataSourcesANative = Int16 Function(Pointer<Void>, Uint16, Pointer<Uint8>, Int16, Pointer<Int16>, Pointer<Uint8>, Int16, Pointer<Int16>);
typedef SQLDataSourcesADart = int Function(Pointer<Void>, int, Pointer<Uint8>, int, Pointer<Int16>, Pointer<Uint8>, int, Pointer<Int16>);
final SQLDataSourcesA = DynamicLibrary.open('ODBC32.dll')
    .lookupFunction<SQLDataSourcesANative, SQLDataSourcesADart>('SQLDataSourcesA');
// henv : void* in/out -> Pointer<Void>
// fDirection : WORD -> Uint16
// szDSN : BYTE* optional, out -> Pointer<Uint8>
// cbDSNMax : SHORT -> Int16
// pcbDSN : SHORT* in/out -> Pointer<Int16>
// szDescription : BYTE* optional, out -> Pointer<Uint8>
// cbDescriptionMax : SHORT -> Int16
// pcbDescription : SHORT* in/out -> Pointer<Int16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SQLDataSourcesA(
  henv: Pointer;   // void* in/out
  fDirection: Word;   // WORD
  szDSN: Pointer;   // BYTE* optional, out
  cbDSNMax: Smallint;   // SHORT
  pcbDSN: Pointer;   // SHORT* in/out
  szDescription: Pointer;   // BYTE* optional, out
  cbDescriptionMax: Smallint;   // SHORT
  pcbDescription: Pointer   // SHORT* in/out
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLDataSourcesA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SQLDataSourcesA"
  c_SQLDataSourcesA :: Ptr () -> Word16 -> Ptr Word8 -> Int16 -> Ptr Int16 -> Ptr Word8 -> Int16 -> Ptr Int16 -> IO Int16
-- henv : void* in/out -> Ptr ()
-- fDirection : WORD -> Word16
-- szDSN : BYTE* optional, out -> Ptr Word8
-- cbDSNMax : SHORT -> Int16
-- pcbDSN : SHORT* in/out -> Ptr Int16
-- szDescription : BYTE* optional, out -> Ptr Word8
-- cbDescriptionMax : SHORT -> Int16
-- pcbDescription : SHORT* in/out -> Ptr Int16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let sqldatasourcesa =
  foreign "SQLDataSourcesA"
    ((ptr void) @-> uint16_t @-> (ptr uint8_t) @-> int16_t @-> (ptr int16_t) @-> (ptr uint8_t) @-> int16_t @-> (ptr int16_t) @-> returning int16_t)
(* henv : void* in/out -> (ptr void) *)
(* fDirection : WORD -> uint16_t *)
(* szDSN : BYTE* optional, out -> (ptr uint8_t) *)
(* cbDSNMax : SHORT -> int16_t *)
(* pcbDSN : SHORT* in/out -> (ptr int16_t) *)
(* szDescription : BYTE* optional, out -> (ptr uint8_t) *)
(* cbDescriptionMax : SHORT -> int16_t *)
(* pcbDescription : SHORT* in/out -> (ptr int16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library odbc32 (t "ODBC32.dll"))
(cffi:use-foreign-library odbc32)

(cffi:defcfun ("SQLDataSourcesA" sqldata-sources-a :convention :stdcall) :int16
  (henv :pointer)   ; void* in/out
  (f-direction :uint16)   ; WORD
  (sz-dsn :pointer)   ; BYTE* optional, out
  (cb-dsnmax :int16)   ; SHORT
  (pcb-dsn :pointer)   ; SHORT* in/out
  (sz-description :pointer)   ; BYTE* optional, out
  (cb-description-max :int16)   ; SHORT
  (pcb-description :pointer))   ; SHORT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SQLDataSourcesA = Win32::API::More->new('ODBC32',
    'short SQLDataSourcesA(LPVOID henv, WORD fDirection, LPVOID szDSN, short cbDSNMax, LPVOID pcbDSN, LPVOID szDescription, short cbDescriptionMax, LPVOID pcbDescription)');
# my $ret = $SQLDataSourcesA->Call($henv, $fDirection, $szDSN, $cbDSNMax, $pcbDSN, $szDescription, $cbDescriptionMax, $pcbDescription);
# henv : void* in/out -> LPVOID
# fDirection : WORD -> WORD
# szDSN : BYTE* optional, out -> LPVOID
# cbDSNMax : SHORT -> short
# pcbDSN : SHORT* in/out -> LPVOID
# szDescription : BYTE* optional, out -> LPVOID
# cbDescriptionMax : SHORT -> short
# pcbDescription : SHORT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い