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

ResUtilRemoveResourceServiceEnvironment

関数
リソースサービスの環境変数設定を削除する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ResUtilRemoveResourceServiceEnvironment(
    LPCWSTR pszServiceName,
    PLOG_EVENT_ROUTINE pfnLogEvent,
    INT_PTR hResourceHandle
);

パラメーター

名前方向
pszServiceNameLPCWSTRin
pfnLogEventPLOG_EVENT_ROUTINEin
hResourceHandleINT_PTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ResUtilRemoveResourceServiceEnvironment(
    LPCWSTR pszServiceName,
    PLOG_EVENT_ROUTINE pfnLogEvent,
    INT_PTR hResourceHandle
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilRemoveResourceServiceEnvironment(
    [MarshalAs(UnmanagedType.LPWStr)] string pszServiceName,   // LPCWSTR
    IntPtr pfnLogEvent,   // PLOG_EVENT_ROUTINE
    IntPtr hResourceHandle   // INT_PTR
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilRemoveResourceServiceEnvironment(
    <MarshalAs(UnmanagedType.LPWStr)> pszServiceName As String,   ' LPCWSTR
    pfnLogEvent As IntPtr,   ' PLOG_EVENT_ROUTINE
    hResourceHandle As IntPtr   ' INT_PTR
) As UInteger
End Function
' pszServiceName : LPCWSTR
' pfnLogEvent : PLOG_EVENT_ROUTINE
' hResourceHandle : INT_PTR
Declare PtrSafe Function ResUtilRemoveResourceServiceEnvironment Lib "resutils" ( _
    ByVal pszServiceName As LongPtr, _
    ByVal pfnLogEvent As LongPtr, _
    ByVal hResourceHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilRemoveResourceServiceEnvironment = ctypes.windll.resutils.ResUtilRemoveResourceServiceEnvironment
ResUtilRemoveResourceServiceEnvironment.restype = wintypes.DWORD
ResUtilRemoveResourceServiceEnvironment.argtypes = [
    wintypes.LPCWSTR,  # pszServiceName : LPCWSTR
    ctypes.c_void_p,  # pfnLogEvent : PLOG_EVENT_ROUTINE
    ctypes.c_ssize_t,  # hResourceHandle : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilRemoveResourceServiceEnvironment = Fiddle::Function.new(
  lib['ResUtilRemoveResourceServiceEnvironment'],
  [
    Fiddle::TYPE_VOIDP,  # pszServiceName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pfnLogEvent : PLOG_EVENT_ROUTINE
    Fiddle::TYPE_INTPTR_T,  # hResourceHandle : INT_PTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "resutils")]
extern "system" {
    fn ResUtilRemoveResourceServiceEnvironment(
        pszServiceName: *const u16,  // LPCWSTR
        pfnLogEvent: *const core::ffi::c_void,  // PLOG_EVENT_ROUTINE
        hResourceHandle: isize  // INT_PTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilRemoveResourceServiceEnvironment([MarshalAs(UnmanagedType.LPWStr)] string pszServiceName, IntPtr pfnLogEvent, IntPtr hResourceHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilRemoveResourceServiceEnvironment' -Namespace Win32 -PassThru
# $api::ResUtilRemoveResourceServiceEnvironment(pszServiceName, pfnLogEvent, hResourceHandle)
#uselib "RESUTILS.dll"
#func global ResUtilRemoveResourceServiceEnvironment "ResUtilRemoveResourceServiceEnvironment" sptr, sptr, sptr
; ResUtilRemoveResourceServiceEnvironment pszServiceName, pfnLogEvent, hResourceHandle   ; 戻り値は stat
; pszServiceName : LPCWSTR -> "sptr"
; pfnLogEvent : PLOG_EVENT_ROUTINE -> "sptr"
; hResourceHandle : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RESUTILS.dll"
#cfunc global ResUtilRemoveResourceServiceEnvironment "ResUtilRemoveResourceServiceEnvironment" wstr, sptr, sptr
; res = ResUtilRemoveResourceServiceEnvironment(pszServiceName, pfnLogEvent, hResourceHandle)
; pszServiceName : LPCWSTR -> "wstr"
; pfnLogEvent : PLOG_EVENT_ROUTINE -> "sptr"
; hResourceHandle : INT_PTR -> "sptr"
; DWORD ResUtilRemoveResourceServiceEnvironment(LPCWSTR pszServiceName, PLOG_EVENT_ROUTINE pfnLogEvent, INT_PTR hResourceHandle)
#uselib "RESUTILS.dll"
#cfunc global ResUtilRemoveResourceServiceEnvironment "ResUtilRemoveResourceServiceEnvironment" wstr, intptr, intptr
; res = ResUtilRemoveResourceServiceEnvironment(pszServiceName, pfnLogEvent, hResourceHandle)
; pszServiceName : LPCWSTR -> "wstr"
; pfnLogEvent : PLOG_EVENT_ROUTINE -> "intptr"
; hResourceHandle : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilRemoveResourceServiceEnvironment = resutils.NewProc("ResUtilRemoveResourceServiceEnvironment")
)

// pszServiceName (LPCWSTR), pfnLogEvent (PLOG_EVENT_ROUTINE), hResourceHandle (INT_PTR)
r1, _, err := procResUtilRemoveResourceServiceEnvironment.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszServiceName))),
	uintptr(pfnLogEvent),
	uintptr(hResourceHandle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResUtilRemoveResourceServiceEnvironment(
  pszServiceName: PWideChar;   // LPCWSTR
  pfnLogEvent: Pointer;   // PLOG_EVENT_ROUTINE
  hResourceHandle: NativeInt   // INT_PTR
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilRemoveResourceServiceEnvironment';
result := DllCall("RESUTILS\ResUtilRemoveResourceServiceEnvironment"
    , "WStr", pszServiceName   ; LPCWSTR
    , "Ptr", pfnLogEvent   ; PLOG_EVENT_ROUTINE
    , "Ptr", hResourceHandle   ; INT_PTR
    , "UInt")   ; return: DWORD
●ResUtilRemoveResourceServiceEnvironment(pszServiceName, pfnLogEvent, hResourceHandle) = DLL("RESUTILS.dll", "dword ResUtilRemoveResourceServiceEnvironment(char*, void*, int)")
# 呼び出し: ResUtilRemoveResourceServiceEnvironment(pszServiceName, pfnLogEvent, hResourceHandle)
# pszServiceName : LPCWSTR -> "char*"
# pfnLogEvent : PLOG_EVENT_ROUTINE -> "void*"
# hResourceHandle : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。