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

HcnCloseNamespace

関数
名前空間ハンドルを閉じる。
DLLcomputenetwork.dll呼出規約winapi

シグネチャ

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

HRESULT HcnCloseNamespace(
    void* Namespace
);

パラメーター

名前方向説明
Namespacevoid*inクローズする名前空間のハンドル。リソースを解放する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

HcnCloseNamespace = ctypes.windll.computenetwork.HcnCloseNamespace
HcnCloseNamespace.restype = ctypes.c_int
HcnCloseNamespace.argtypes = [
    ctypes.POINTER(None),  # Namespace : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computenetwork.dll')
HcnCloseNamespace = Fiddle::Function.new(
  lib['HcnCloseNamespace'],
  [
    Fiddle::TYPE_VOIDP,  # Namespace : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "computenetwork")]
extern "system" {
    fn HcnCloseNamespace(
        Namespace: *mut ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computenetwork.dll")]
public static extern int HcnCloseNamespace(IntPtr Namespace);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computenetwork_HcnCloseNamespace' -Namespace Win32 -PassThru
# $api::HcnCloseNamespace(Namespace)
#uselib "computenetwork.dll"
#func global HcnCloseNamespace "HcnCloseNamespace" sptr
; HcnCloseNamespace Namespace   ; 戻り値は stat
; Namespace : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "computenetwork.dll"
#cfunc global HcnCloseNamespace "HcnCloseNamespace" sptr
; res = HcnCloseNamespace(Namespace)
; Namespace : void* -> "sptr"
; HRESULT HcnCloseNamespace(void* Namespace)
#uselib "computenetwork.dll"
#cfunc global HcnCloseNamespace "HcnCloseNamespace" intptr
; res = HcnCloseNamespace(Namespace)
; Namespace : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computenetwork = windows.NewLazySystemDLL("computenetwork.dll")
	procHcnCloseNamespace = computenetwork.NewProc("HcnCloseNamespace")
)

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

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

typedef HcnCloseNamespaceNative = Int32 Function(Pointer<Void>);
typedef HcnCloseNamespaceDart = int Function(Pointer<Void>);
final HcnCloseNamespace = DynamicLibrary.open('computenetwork.dll')
    .lookupFunction<HcnCloseNamespaceNative, HcnCloseNamespaceDart>('HcnCloseNamespace');
// Namespace : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HcnCloseNamespace(
  Namespace: Pointer   // void*
): Integer; stdcall;
  external 'computenetwork.dll' name 'HcnCloseNamespace';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

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

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