Win32 API 日本語リファレンス
ホームNetworking.WinInet › ExportCookieFileA

ExportCookieFileA

関数
クッキーを指定ファイルへエクスポートする。
DLLWININET.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

BOOL ExportCookieFileA(
    LPCSTR szFilename,
    BOOL fAppend
);

パラメーター

名前方向
szFilenameLPCSTRin
fAppendBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ExportCookieFileA(
    LPCSTR szFilename,
    BOOL fAppend
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool ExportCookieFileA(
    [MarshalAs(UnmanagedType.LPStr)] string szFilename,   // LPCSTR
    bool fAppend   // BOOL
);
<DllImport("WININET.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function ExportCookieFileA(
    <MarshalAs(UnmanagedType.LPStr)> szFilename As String,   ' LPCSTR
    fAppend As Boolean   ' BOOL
) As Boolean
End Function
' szFilename : LPCSTR
' fAppend : BOOL
Declare PtrSafe Function ExportCookieFileA Lib "wininet" ( _
    ByVal szFilename As String, _
    ByVal fAppend As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ExportCookieFileA = ctypes.windll.wininet.ExportCookieFileA
ExportCookieFileA.restype = wintypes.BOOL
ExportCookieFileA.argtypes = [
    wintypes.LPCSTR,  # szFilename : LPCSTR
    wintypes.BOOL,  # fAppend : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
ExportCookieFileA = Fiddle::Function.new(
  lib['ExportCookieFileA'],
  [
    Fiddle::TYPE_VOIDP,  # szFilename : LPCSTR
    Fiddle::TYPE_INT,  # fAppend : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn ExportCookieFileA(
        szFilename: *const u8,  // LPCSTR
        fAppend: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi)]
public static extern bool ExportCookieFileA([MarshalAs(UnmanagedType.LPStr)] string szFilename, bool fAppend);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_ExportCookieFileA' -Namespace Win32 -PassThru
# $api::ExportCookieFileA(szFilename, fAppend)
#uselib "WININET.dll"
#func global ExportCookieFileA "ExportCookieFileA" sptr, sptr
; ExportCookieFileA szFilename, fAppend   ; 戻り値は stat
; szFilename : LPCSTR -> "sptr"
; fAppend : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global ExportCookieFileA "ExportCookieFileA" str, int
; res = ExportCookieFileA(szFilename, fAppend)
; szFilename : LPCSTR -> "str"
; fAppend : BOOL -> "int"
; BOOL ExportCookieFileA(LPCSTR szFilename, BOOL fAppend)
#uselib "WININET.dll"
#cfunc global ExportCookieFileA "ExportCookieFileA" str, int
; res = ExportCookieFileA(szFilename, fAppend)
; szFilename : LPCSTR -> "str"
; fAppend : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procExportCookieFileA = wininet.NewProc("ExportCookieFileA")
)

// szFilename (LPCSTR), fAppend (BOOL)
r1, _, err := procExportCookieFileA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szFilename))),
	uintptr(fAppend),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ExportCookieFileA(
  szFilename: PAnsiChar;   // LPCSTR
  fAppend: BOOL   // BOOL
): BOOL; stdcall;
  external 'WININET.dll' name 'ExportCookieFileA';
result := DllCall("WININET\ExportCookieFileA"
    , "AStr", szFilename   ; LPCSTR
    , "Int", fAppend   ; BOOL
    , "Int")   ; return: BOOL
●ExportCookieFileA(szFilename, fAppend) = DLL("WININET.dll", "bool ExportCookieFileA(char*, bool)")
# 呼び出し: ExportCookieFileA(szFilename, fAppend)
# szFilename : LPCSTR -> "char*"
# fAppend : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。