ホーム › System.WindowsProgramming › FileSaveMarkNotExistW
FileSaveMarkNotExistW
関数存在しないファイルとしてバックアップに記録する(Unicode版)。
シグネチャ
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT FileSaveMarkNotExistW(
LPCWSTR lpFileList, // optional
LPCWSTR lpDir, // optional
LPCWSTR lpBaseName // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpFileList | LPCWSTR | inoptional | 存在しないものとして記録するファイル名リストを指す。 |
| lpDir | LPCWSTR | inoptional | 対象ファイルのディレクトリを指す。 |
| lpBaseName | LPCWSTR | inoptional | バックアップを識別するベース名を指す。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT FileSaveMarkNotExistW(
LPCWSTR lpFileList, // optional
LPCWSTR lpDir, // optional
LPCWSTR lpBaseName // optional
);[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int FileSaveMarkNotExistW(
[MarshalAs(UnmanagedType.LPWStr)] string lpFileList, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpDir, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpBaseName // LPCWSTR optional
);<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function FileSaveMarkNotExistW(
<MarshalAs(UnmanagedType.LPWStr)> lpFileList As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpDir As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpBaseName As String ' LPCWSTR optional
) As Integer
End Function' lpFileList : LPCWSTR optional
' lpDir : LPCWSTR optional
' lpBaseName : LPCWSTR optional
Declare PtrSafe Function FileSaveMarkNotExistW Lib "advpack" ( _
ByVal lpFileList As LongPtr, _
ByVal lpDir As LongPtr, _
ByVal lpBaseName As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FileSaveMarkNotExistW = ctypes.windll.advpack.FileSaveMarkNotExistW
FileSaveMarkNotExistW.restype = ctypes.c_int
FileSaveMarkNotExistW.argtypes = [
wintypes.LPCWSTR, # lpFileList : LPCWSTR optional
wintypes.LPCWSTR, # lpDir : LPCWSTR optional
wintypes.LPCWSTR, # lpBaseName : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVPACK.dll')
FileSaveMarkNotExistW = Fiddle::Function.new(
lib['FileSaveMarkNotExistW'],
[
Fiddle::TYPE_VOIDP, # lpFileList : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpDir : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpBaseName : LPCWSTR optional
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advpack")]
extern "system" {
fn FileSaveMarkNotExistW(
lpFileList: *const u16, // LPCWSTR optional
lpDir: *const u16, // LPCWSTR optional
lpBaseName: *const u16 // LPCWSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode)]
public static extern int FileSaveMarkNotExistW([MarshalAs(UnmanagedType.LPWStr)] string lpFileList, [MarshalAs(UnmanagedType.LPWStr)] string lpDir, [MarshalAs(UnmanagedType.LPWStr)] string lpBaseName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_FileSaveMarkNotExistW' -Namespace Win32 -PassThru
# $api::FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)#uselib "ADVPACK.dll"
#func global FileSaveMarkNotExistW "FileSaveMarkNotExistW" wptr, wptr, wptr
; FileSaveMarkNotExistW lpFileList, lpDir, lpBaseName ; 戻り値は stat
; lpFileList : LPCWSTR optional -> "wptr"
; lpDir : LPCWSTR optional -> "wptr"
; lpBaseName : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVPACK.dll"
#cfunc global FileSaveMarkNotExistW "FileSaveMarkNotExistW" wstr, wstr, wstr
; res = FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
; lpFileList : LPCWSTR optional -> "wstr"
; lpDir : LPCWSTR optional -> "wstr"
; lpBaseName : LPCWSTR optional -> "wstr"; HRESULT FileSaveMarkNotExistW(LPCWSTR lpFileList, LPCWSTR lpDir, LPCWSTR lpBaseName)
#uselib "ADVPACK.dll"
#cfunc global FileSaveMarkNotExistW "FileSaveMarkNotExistW" wstr, wstr, wstr
; res = FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
; lpFileList : LPCWSTR optional -> "wstr"
; lpDir : LPCWSTR optional -> "wstr"
; lpBaseName : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advpack = windows.NewLazySystemDLL("ADVPACK.dll")
procFileSaveMarkNotExistW = advpack.NewProc("FileSaveMarkNotExistW")
)
// lpFileList (LPCWSTR optional), lpDir (LPCWSTR optional), lpBaseName (LPCWSTR optional)
r1, _, err := procFileSaveMarkNotExistW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileList))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpDir))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpBaseName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction FileSaveMarkNotExistW(
lpFileList: PWideChar; // LPCWSTR optional
lpDir: PWideChar; // LPCWSTR optional
lpBaseName: PWideChar // LPCWSTR optional
): Integer; stdcall;
external 'ADVPACK.dll' name 'FileSaveMarkNotExistW';result := DllCall("ADVPACK\FileSaveMarkNotExistW"
, "WStr", lpFileList ; LPCWSTR optional
, "WStr", lpDir ; LPCWSTR optional
, "WStr", lpBaseName ; LPCWSTR optional
, "Int") ; return: HRESULT●FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName) = DLL("ADVPACK.dll", "int FileSaveMarkNotExistW(char*, char*, char*)")
# 呼び出し: FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
# lpFileList : LPCWSTR optional -> "char*"
# lpDir : LPCWSTR optional -> "char*"
# lpBaseName : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "advpack" fn FileSaveMarkNotExistW(
lpFileList: [*c]const u16, // LPCWSTR optional
lpDir: [*c]const u16, // LPCWSTR optional
lpBaseName: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc FileSaveMarkNotExistW(
lpFileList: WideCString, # LPCWSTR optional
lpDir: WideCString, # LPCWSTR optional
lpBaseName: WideCString # LPCWSTR optional
): int32 {.importc: "FileSaveMarkNotExistW", stdcall, dynlib: "ADVPACK.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "advpack");
extern(Windows)
int FileSaveMarkNotExistW(
const(wchar)* lpFileList, // LPCWSTR optional
const(wchar)* lpDir, // LPCWSTR optional
const(wchar)* lpBaseName // LPCWSTR optional
);ccall((:FileSaveMarkNotExistW, "ADVPACK.dll"), stdcall, Int32,
(Cwstring, Cwstring, Cwstring),
lpFileList, lpDir, lpBaseName)
# lpFileList : LPCWSTR optional -> Cwstring
# lpDir : LPCWSTR optional -> Cwstring
# lpBaseName : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t FileSaveMarkNotExistW(
const uint16_t* lpFileList,
const uint16_t* lpDir,
const uint16_t* lpBaseName);
]]
local advpack = ffi.load("advpack")
-- advpack.FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
-- lpFileList : LPCWSTR optional
-- lpDir : LPCWSTR optional
-- lpBaseName : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('ADVPACK.dll');
const FileSaveMarkNotExistW = lib.func('__stdcall', 'FileSaveMarkNotExistW', 'int32_t', ['str16', 'str16', 'str16']);
// FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
// lpFileList : LPCWSTR optional -> 'str16'
// lpDir : LPCWSTR optional -> 'str16'
// lpBaseName : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ADVPACK.dll", {
FileSaveMarkNotExistW: { parameters: ["buffer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName)
// lpFileList : LPCWSTR optional -> "buffer"
// lpDir : LPCWSTR optional -> "buffer"
// lpBaseName : LPCWSTR optional -> "buffer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FileSaveMarkNotExistW(
const uint16_t* lpFileList,
const uint16_t* lpDir,
const uint16_t* lpBaseName);
C, "ADVPACK.dll");
// $ffi->FileSaveMarkNotExistW(lpFileList, lpDir, lpBaseName);
// lpFileList : LPCWSTR optional
// lpDir : LPCWSTR optional
// lpBaseName : LPCWSTR optional
// 構造体/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 Advpack extends StdCallLibrary {
Advpack INSTANCE = Native.load("advpack", Advpack.class, W32APIOptions.UNICODE_OPTIONS);
int FileSaveMarkNotExistW(
WString lpFileList, // LPCWSTR optional
WString lpDir, // LPCWSTR optional
WString lpBaseName // LPCWSTR optional
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("advpack")]
lib LibADVPACK
fun FileSaveMarkNotExistW = FileSaveMarkNotExistW(
lpFileList : UInt16*, # LPCWSTR optional
lpDir : UInt16*, # LPCWSTR optional
lpBaseName : UInt16* # LPCWSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FileSaveMarkNotExistWNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>);
typedef FileSaveMarkNotExistWDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>);
final FileSaveMarkNotExistW = DynamicLibrary.open('ADVPACK.dll')
.lookupFunction<FileSaveMarkNotExistWNative, FileSaveMarkNotExistWDart>('FileSaveMarkNotExistW');
// lpFileList : LPCWSTR optional -> Pointer<Utf16>
// lpDir : LPCWSTR optional -> Pointer<Utf16>
// lpBaseName : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FileSaveMarkNotExistW(
lpFileList: PWideChar; // LPCWSTR optional
lpDir: PWideChar; // LPCWSTR optional
lpBaseName: PWideChar // LPCWSTR optional
): Integer; stdcall;
external 'ADVPACK.dll' name 'FileSaveMarkNotExistW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FileSaveMarkNotExistW"
c_FileSaveMarkNotExistW :: CWString -> CWString -> CWString -> IO Int32
-- lpFileList : LPCWSTR optional -> CWString
-- lpDir : LPCWSTR optional -> CWString
-- lpBaseName : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let filesavemarknotexistw =
foreign "FileSaveMarkNotExistW"
((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> returning int32_t)
(* lpFileList : LPCWSTR optional -> (ptr uint16_t) *)
(* lpDir : LPCWSTR optional -> (ptr uint16_t) *)
(* lpBaseName : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library advpack (t "ADVPACK.dll"))
(cffi:use-foreign-library advpack)
(cffi:defcfun ("FileSaveMarkNotExistW" file-save-mark-not-exist-w :convention :stdcall) :int32
(lp-file-list (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-dir (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-base-name (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FileSaveMarkNotExistW = Win32::API::More->new('ADVPACK',
'int FileSaveMarkNotExistW(LPCWSTR lpFileList, LPCWSTR lpDir, LPCWSTR lpBaseName)');
# my $ret = $FileSaveMarkNotExistW->Call($lpFileList, $lpDir, $lpBaseName);
# lpFileList : LPCWSTR optional -> LPCWSTR
# lpDir : LPCWSTR optional -> LPCWSTR
# lpBaseName : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f FileSaveMarkNotExistA (ANSI版) — 存在しないファイルとしてバックアップに記録する(ANSI版)。