ホーム › Networking.Clustering › RegisterAppInstance
RegisterAppInstance
関数プロセスにアプリインスタンスIDを登録する。
シグネチャ
// NTLANMAN.dll
#include <windows.h>
DWORD RegisterAppInstance(
HANDLE ProcessHandle,
GUID* AppInstanceId,
BOOL ChildrenInheritAppInstance
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ProcessHandle | HANDLE | in |
| AppInstanceId | GUID* | in |
| ChildrenInheritAppInstance | BOOL | in |
戻り値の型: DWORD
各言語での呼び出し定義
// NTLANMAN.dll
#include <windows.h>
DWORD RegisterAppInstance(
HANDLE ProcessHandle,
GUID* AppInstanceId,
BOOL ChildrenInheritAppInstance
);[DllImport("NTLANMAN.dll", ExactSpelling = true)]
static extern uint RegisterAppInstance(
IntPtr ProcessHandle, // HANDLE
ref Guid AppInstanceId, // GUID*
bool ChildrenInheritAppInstance // BOOL
);<DllImport("NTLANMAN.dll", ExactSpelling:=True)>
Public Shared Function RegisterAppInstance(
ProcessHandle As IntPtr, ' HANDLE
ByRef AppInstanceId As Guid, ' GUID*
ChildrenInheritAppInstance As Boolean ' BOOL
) As UInteger
End Function' ProcessHandle : HANDLE
' AppInstanceId : GUID*
' ChildrenInheritAppInstance : BOOL
Declare PtrSafe Function RegisterAppInstance Lib "ntlanman" ( _
ByVal ProcessHandle As LongPtr, _
ByVal AppInstanceId As LongPtr, _
ByVal ChildrenInheritAppInstance As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterAppInstance = ctypes.windll.ntlanman.RegisterAppInstance
RegisterAppInstance.restype = wintypes.DWORD
RegisterAppInstance.argtypes = [
wintypes.HANDLE, # ProcessHandle : HANDLE
ctypes.c_void_p, # AppInstanceId : GUID*
wintypes.BOOL, # ChildrenInheritAppInstance : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NTLANMAN.dll')
RegisterAppInstance = Fiddle::Function.new(
lib['RegisterAppInstance'],
[
Fiddle::TYPE_VOIDP, # ProcessHandle : HANDLE
Fiddle::TYPE_VOIDP, # AppInstanceId : GUID*
Fiddle::TYPE_INT, # ChildrenInheritAppInstance : BOOL
],
-Fiddle::TYPE_INT)#[link(name = "ntlanman")]
extern "system" {
fn RegisterAppInstance(
ProcessHandle: *mut core::ffi::c_void, // HANDLE
AppInstanceId: *mut GUID, // GUID*
ChildrenInheritAppInstance: i32 // BOOL
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NTLANMAN.dll")]
public static extern uint RegisterAppInstance(IntPtr ProcessHandle, ref Guid AppInstanceId, bool ChildrenInheritAppInstance);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NTLANMAN_RegisterAppInstance' -Namespace Win32 -PassThru
# $api::RegisterAppInstance(ProcessHandle, AppInstanceId, ChildrenInheritAppInstance)#uselib "NTLANMAN.dll"
#func global RegisterAppInstance "RegisterAppInstance" sptr, sptr, sptr
; RegisterAppInstance ProcessHandle, varptr(AppInstanceId), ChildrenInheritAppInstance ; 戻り値は stat
; ProcessHandle : HANDLE -> "sptr"
; AppInstanceId : GUID* -> "sptr"
; ChildrenInheritAppInstance : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "NTLANMAN.dll" #cfunc global RegisterAppInstance "RegisterAppInstance" sptr, var, int ; res = RegisterAppInstance(ProcessHandle, AppInstanceId, ChildrenInheritAppInstance) ; ProcessHandle : HANDLE -> "sptr" ; AppInstanceId : GUID* -> "var" ; ChildrenInheritAppInstance : BOOL -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "NTLANMAN.dll" #cfunc global RegisterAppInstance "RegisterAppInstance" sptr, sptr, int ; res = RegisterAppInstance(ProcessHandle, varptr(AppInstanceId), ChildrenInheritAppInstance) ; ProcessHandle : HANDLE -> "sptr" ; AppInstanceId : GUID* -> "sptr" ; ChildrenInheritAppInstance : BOOL -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD RegisterAppInstance(HANDLE ProcessHandle, GUID* AppInstanceId, BOOL ChildrenInheritAppInstance) #uselib "NTLANMAN.dll" #cfunc global RegisterAppInstance "RegisterAppInstance" intptr, var, int ; res = RegisterAppInstance(ProcessHandle, AppInstanceId, ChildrenInheritAppInstance) ; ProcessHandle : HANDLE -> "intptr" ; AppInstanceId : GUID* -> "var" ; ChildrenInheritAppInstance : BOOL -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD RegisterAppInstance(HANDLE ProcessHandle, GUID* AppInstanceId, BOOL ChildrenInheritAppInstance) #uselib "NTLANMAN.dll" #cfunc global RegisterAppInstance "RegisterAppInstance" intptr, intptr, int ; res = RegisterAppInstance(ProcessHandle, varptr(AppInstanceId), ChildrenInheritAppInstance) ; ProcessHandle : HANDLE -> "intptr" ; AppInstanceId : GUID* -> "intptr" ; ChildrenInheritAppInstance : BOOL -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ntlanman = windows.NewLazySystemDLL("NTLANMAN.dll")
procRegisterAppInstance = ntlanman.NewProc("RegisterAppInstance")
)
// ProcessHandle (HANDLE), AppInstanceId (GUID*), ChildrenInheritAppInstance (BOOL)
r1, _, err := procRegisterAppInstance.Call(
uintptr(ProcessHandle),
uintptr(AppInstanceId),
uintptr(ChildrenInheritAppInstance),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RegisterAppInstance(
ProcessHandle: THandle; // HANDLE
AppInstanceId: PGUID; // GUID*
ChildrenInheritAppInstance: BOOL // BOOL
): DWORD; stdcall;
external 'NTLANMAN.dll' name 'RegisterAppInstance';result := DllCall("NTLANMAN\RegisterAppInstance"
, "Ptr", ProcessHandle ; HANDLE
, "Ptr", AppInstanceId ; GUID*
, "Int", ChildrenInheritAppInstance ; BOOL
, "UInt") ; return: DWORD●RegisterAppInstance(ProcessHandle, AppInstanceId, ChildrenInheritAppInstance) = DLL("NTLANMAN.dll", "dword RegisterAppInstance(void*, void*, bool)")
# 呼び出し: RegisterAppInstance(ProcessHandle, AppInstanceId, ChildrenInheritAppInstance)
# ProcessHandle : HANDLE -> "void*"
# AppInstanceId : GUID* -> "void*"
# ChildrenInheritAppInstance : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。