ホーム › Networking.WinInet › GopherGetLocatorTypeA
GopherGetLocatorTypeA
関数Gopherロケーターの種類を解析して取得する(ANSI版)。
シグネチャ
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL GopherGetLocatorTypeA(
LPCSTR lpszLocator,
DWORD* lpdwGopherType
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpszLocator | LPCSTR | in | 種別を判定する対象のGopherロケーター文字列(ANSI)。 |
| lpdwGopherType | DWORD* | out | ロケーターの種別を示すGOPHER_TYPE_*ビットを受け取るDWORDポインタ。出力用。 |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL GopherGetLocatorTypeA(
LPCSTR lpszLocator,
DWORD* lpdwGopherType
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool GopherGetLocatorTypeA(
[MarshalAs(UnmanagedType.LPStr)] string lpszLocator, // LPCSTR
out uint lpdwGopherType // DWORD* out
);<DllImport("WININET.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GopherGetLocatorTypeA(
<MarshalAs(UnmanagedType.LPStr)> lpszLocator As String, ' LPCSTR
<Out> ByRef lpdwGopherType As UInteger ' DWORD* out
) As Boolean
End Function' lpszLocator : LPCSTR
' lpdwGopherType : DWORD* out
Declare PtrSafe Function GopherGetLocatorTypeA Lib "wininet" ( _
ByVal lpszLocator As String, _
ByRef lpdwGopherType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GopherGetLocatorTypeA = ctypes.windll.wininet.GopherGetLocatorTypeA
GopherGetLocatorTypeA.restype = wintypes.BOOL
GopherGetLocatorTypeA.argtypes = [
wintypes.LPCSTR, # lpszLocator : LPCSTR
ctypes.POINTER(wintypes.DWORD), # lpdwGopherType : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
GopherGetLocatorTypeA = Fiddle::Function.new(
lib['GopherGetLocatorTypeA'],
[
Fiddle::TYPE_VOIDP, # lpszLocator : LPCSTR
Fiddle::TYPE_VOIDP, # lpdwGopherType : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "wininet")]
extern "system" {
fn GopherGetLocatorTypeA(
lpszLocator: *const u8, // LPCSTR
lpdwGopherType: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GopherGetLocatorTypeA([MarshalAs(UnmanagedType.LPStr)] string lpszLocator, out uint lpdwGopherType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_GopherGetLocatorTypeA' -Namespace Win32 -PassThru
# $api::GopherGetLocatorTypeA(lpszLocator, lpdwGopherType)#uselib "WININET.dll"
#func global GopherGetLocatorTypeA "GopherGetLocatorTypeA" sptr, sptr
; GopherGetLocatorTypeA lpszLocator, varptr(lpdwGopherType) ; 戻り値は stat
; lpszLocator : LPCSTR -> "sptr"
; lpdwGopherType : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WININET.dll" #cfunc global GopherGetLocatorTypeA "GopherGetLocatorTypeA" str, var ; res = GopherGetLocatorTypeA(lpszLocator, lpdwGopherType) ; lpszLocator : LPCSTR -> "str" ; lpdwGopherType : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WININET.dll" #cfunc global GopherGetLocatorTypeA "GopherGetLocatorTypeA" str, sptr ; res = GopherGetLocatorTypeA(lpszLocator, varptr(lpdwGopherType)) ; lpszLocator : LPCSTR -> "str" ; lpdwGopherType : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GopherGetLocatorTypeA(LPCSTR lpszLocator, DWORD* lpdwGopherType) #uselib "WININET.dll" #cfunc global GopherGetLocatorTypeA "GopherGetLocatorTypeA" str, var ; res = GopherGetLocatorTypeA(lpszLocator, lpdwGopherType) ; lpszLocator : LPCSTR -> "str" ; lpdwGopherType : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GopherGetLocatorTypeA(LPCSTR lpszLocator, DWORD* lpdwGopherType) #uselib "WININET.dll" #cfunc global GopherGetLocatorTypeA "GopherGetLocatorTypeA" str, intptr ; res = GopherGetLocatorTypeA(lpszLocator, varptr(lpdwGopherType)) ; lpszLocator : LPCSTR -> "str" ; lpdwGopherType : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procGopherGetLocatorTypeA = wininet.NewProc("GopherGetLocatorTypeA")
)
// lpszLocator (LPCSTR), lpdwGopherType (DWORD* out)
r1, _, err := procGopherGetLocatorTypeA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszLocator))),
uintptr(lpdwGopherType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GopherGetLocatorTypeA(
lpszLocator: PAnsiChar; // LPCSTR
lpdwGopherType: Pointer // DWORD* out
): BOOL; stdcall;
external 'WININET.dll' name 'GopherGetLocatorTypeA';result := DllCall("WININET\GopherGetLocatorTypeA"
, "AStr", lpszLocator ; LPCSTR
, "Ptr", lpdwGopherType ; DWORD* out
, "Int") ; return: BOOL●GopherGetLocatorTypeA(lpszLocator, lpdwGopherType) = DLL("WININET.dll", "bool GopherGetLocatorTypeA(char*, void*)")
# 呼び出し: GopherGetLocatorTypeA(lpszLocator, lpdwGopherType)
# lpszLocator : LPCSTR -> "char*"
# lpdwGopherType : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。