Win32 API 日本語リファレンス
ホームStorage.FileSystem › CloseEncryptedFileRaw

CloseEncryptedFileRaw

関数
暗号化ファイルのRAW操作コンテキストを閉じる。
DLLADVAPI32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// ADVAPI32.dll
#include <windows.h>

void CloseEncryptedFileRaw(
    void* pvContext
);

パラメーター

名前方向説明
pvContextvoid*inシステム定義のコンテキストブロックへのポインター。コンテキストブロックは OpenEncryptedFileRaw 関数によって返されます。

戻り値の型: void

公式ドキュメント

バックアップまたは復元操作の完了後に暗号化ファイルを閉じ、関連するシステムリソースを解放します。

解説(Remarks)

CloseEncryptedFileRaw 関数は、システム定義のコンテキストブロックなどの割り当て済みシステムリソースを解放し、ファイルを閉じます。

BackupRead 関数および BackupWrite 関数は、暗号化されていないファイルのバックアップと復元を処理します。

Windows 8、Windows Server 2012 以降では、この関数は次のテクノロジでサポートされています。

テクノロジ サポート
Server Message Block (SMB) 3.0 プロトコル はい
SMB 3.0 透過的フェールオーバー (TFO) いいえ
SMB 3.0 とスケールアウトファイル共有 (SO) いいえ
クラスター共有ボリュームファイルシステム (CsvFS) いいえ
回復性のあるファイルシステム (ReFS) いいえ

SMB 3.0 は、継続的可用性機能を備えた共有上での EFS をサポートしないことに注意してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// ADVAPI32.dll
#include <windows.h>

void CloseEncryptedFileRaw(
    void* pvContext
);
[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern void CloseEncryptedFileRaw(
    IntPtr pvContext   // void*
);
<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Sub CloseEncryptedFileRaw(
    pvContext As IntPtr   ' void*
)
End Sub
' pvContext : void*
Declare PtrSafe Sub CloseEncryptedFileRaw Lib "advapi32" ( _
    ByVal pvContext As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CloseEncryptedFileRaw = ctypes.windll.advapi32.CloseEncryptedFileRaw
CloseEncryptedFileRaw.restype = None
CloseEncryptedFileRaw.argtypes = [
    ctypes.POINTER(None),  # pvContext : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
CloseEncryptedFileRaw = Fiddle::Function.new(
  lib['CloseEncryptedFileRaw'],
  [
    Fiddle::TYPE_VOIDP,  # pvContext : void*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "advapi32")]
extern "system" {
    fn CloseEncryptedFileRaw(
        pvContext: *mut ()  // void*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern void CloseEncryptedFileRaw(IntPtr pvContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_CloseEncryptedFileRaw' -Namespace Win32 -PassThru
# $api::CloseEncryptedFileRaw(pvContext)
#uselib "ADVAPI32.dll"
#func global CloseEncryptedFileRaw "CloseEncryptedFileRaw" sptr
; CloseEncryptedFileRaw pvContext
; pvContext : void* -> "sptr"
#uselib "ADVAPI32.dll"
#func global CloseEncryptedFileRaw "CloseEncryptedFileRaw" sptr
; CloseEncryptedFileRaw pvContext
; pvContext : void* -> "sptr"
; void CloseEncryptedFileRaw(void* pvContext)
#uselib "ADVAPI32.dll"
#func global CloseEncryptedFileRaw "CloseEncryptedFileRaw" intptr
; CloseEncryptedFileRaw pvContext
; pvContext : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procCloseEncryptedFileRaw = advapi32.NewProc("CloseEncryptedFileRaw")
)

// pvContext (void*)
r1, _, err := procCloseEncryptedFileRaw.Call(
	uintptr(pvContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure CloseEncryptedFileRaw(
  pvContext: Pointer   // void*
); stdcall;
  external 'ADVAPI32.dll' name 'CloseEncryptedFileRaw';
result := DllCall("ADVAPI32\CloseEncryptedFileRaw"
    , "Ptr", pvContext   ; void*
    , "Int")   ; return: void
●CloseEncryptedFileRaw(pvContext) = DLL("ADVAPI32.dll", "int CloseEncryptedFileRaw(void*)")
# 呼び出し: CloseEncryptedFileRaw(pvContext)
# pvContext : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "advapi32" fn CloseEncryptedFileRaw(
    pvContext: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;
proc CloseEncryptedFileRaw(
    pvContext: pointer  # void*
) {.importc: "CloseEncryptedFileRaw", stdcall, dynlib: "ADVAPI32.dll".}
pragma(lib, "advapi32");
extern(Windows)
void CloseEncryptedFileRaw(
    void* pvContext   // void*
);
ccall((:CloseEncryptedFileRaw, "ADVAPI32.dll"), stdcall, Cvoid,
      (Ptr{Cvoid},),
      pvContext)
# pvContext : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void CloseEncryptedFileRaw(
    void* pvContext);
]]
local advapi32 = ffi.load("advapi32")
-- advapi32.CloseEncryptedFileRaw(pvContext)
-- pvContext : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ADVAPI32.dll');
const CloseEncryptedFileRaw = lib.func('__stdcall', 'CloseEncryptedFileRaw', 'void', ['void *']);
// CloseEncryptedFileRaw(pvContext)
// pvContext : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ADVAPI32.dll", {
  CloseEncryptedFileRaw: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.CloseEncryptedFileRaw(pvContext)
// pvContext : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void CloseEncryptedFileRaw(
    void* pvContext);
C, "ADVAPI32.dll");
// $ffi->CloseEncryptedFileRaw(pvContext);
// pvContext : void*
// 構造体/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 Advapi32 extends StdCallLibrary {
    Advapi32 INSTANCE = Native.load("advapi32", Advapi32.class);
    void CloseEncryptedFileRaw(
        Pointer pvContext   // void*
    );
}
@[Link("advapi32")]
lib LibADVAPI32
  fun CloseEncryptedFileRaw = CloseEncryptedFileRaw(
    pvContext : Void*   # void*
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CloseEncryptedFileRawNative = Void Function(Pointer<Void>);
typedef CloseEncryptedFileRawDart = void Function(Pointer<Void>);
final CloseEncryptedFileRaw = DynamicLibrary.open('ADVAPI32.dll')
    .lookupFunction<CloseEncryptedFileRawNative, CloseEncryptedFileRawDart>('CloseEncryptedFileRaw');
// pvContext : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure CloseEncryptedFileRaw(
  pvContext: Pointer   // void*
); stdcall;
  external 'ADVAPI32.dll' name 'CloseEncryptedFileRaw';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CloseEncryptedFileRaw"
  c_CloseEncryptedFileRaw :: Ptr () -> IO ()
-- pvContext : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let closeencryptedfileraw =
  foreign "CloseEncryptedFileRaw"
    ((ptr void) @-> returning void)
(* pvContext : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library advapi32 (t "ADVAPI32.dll"))
(cffi:use-foreign-library advapi32)

(cffi:defcfun ("CloseEncryptedFileRaw" close-encrypted-file-raw :convention :stdcall) :void
  (pv-context :pointer))   ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CloseEncryptedFileRaw = Win32::API::More->new('ADVAPI32',
    'void CloseEncryptedFileRaw(LPVOID pvContext)');
# my $ret = $CloseEncryptedFileRaw->Call($pvContext);
# pvContext : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目