ホーム › Networking.Clustering › ResUtilStartResourceService
ResUtilStartResourceService
関数指定したリソースのサービスを開始する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilStartResourceService(
LPCWSTR pszServiceName,
SC_HANDLE* phServiceHandle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszServiceName | LPCWSTR | in |
| phServiceHandle | SC_HANDLE* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilStartResourceService(
LPCWSTR pszServiceName,
SC_HANDLE* phServiceHandle
);[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilStartResourceService(
[MarshalAs(UnmanagedType.LPWStr)] string pszServiceName, // LPCWSTR
IntPtr phServiceHandle // SC_HANDLE* in/out
);<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilStartResourceService(
<MarshalAs(UnmanagedType.LPWStr)> pszServiceName As String, ' LPCWSTR
phServiceHandle As IntPtr ' SC_HANDLE* in/out
) As UInteger
End Function' pszServiceName : LPCWSTR
' phServiceHandle : SC_HANDLE* in/out
Declare PtrSafe Function ResUtilStartResourceService Lib "resutils" ( _
ByVal pszServiceName As LongPtr, _
ByVal phServiceHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilStartResourceService = ctypes.windll.resutils.ResUtilStartResourceService
ResUtilStartResourceService.restype = wintypes.DWORD
ResUtilStartResourceService.argtypes = [
wintypes.LPCWSTR, # pszServiceName : LPCWSTR
ctypes.c_void_p, # phServiceHandle : SC_HANDLE* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilStartResourceService = Fiddle::Function.new(
lib['ResUtilStartResourceService'],
[
Fiddle::TYPE_VOIDP, # pszServiceName : LPCWSTR
Fiddle::TYPE_VOIDP, # phServiceHandle : SC_HANDLE* in/out
],
-Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilStartResourceService(
pszServiceName: *const u16, // LPCWSTR
phServiceHandle: *mut *mut core::ffi::c_void // SC_HANDLE* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilStartResourceService([MarshalAs(UnmanagedType.LPWStr)] string pszServiceName, IntPtr phServiceHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilStartResourceService' -Namespace Win32 -PassThru
# $api::ResUtilStartResourceService(pszServiceName, phServiceHandle)#uselib "RESUTILS.dll"
#func global ResUtilStartResourceService "ResUtilStartResourceService" sptr, sptr
; ResUtilStartResourceService pszServiceName, phServiceHandle ; 戻り値は stat
; pszServiceName : LPCWSTR -> "sptr"
; phServiceHandle : SC_HANDLE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RESUTILS.dll"
#cfunc global ResUtilStartResourceService "ResUtilStartResourceService" wstr, sptr
; res = ResUtilStartResourceService(pszServiceName, phServiceHandle)
; pszServiceName : LPCWSTR -> "wstr"
; phServiceHandle : SC_HANDLE* in/out -> "sptr"; DWORD ResUtilStartResourceService(LPCWSTR pszServiceName, SC_HANDLE* phServiceHandle)
#uselib "RESUTILS.dll"
#cfunc global ResUtilStartResourceService "ResUtilStartResourceService" wstr, intptr
; res = ResUtilStartResourceService(pszServiceName, phServiceHandle)
; pszServiceName : LPCWSTR -> "wstr"
; phServiceHandle : SC_HANDLE* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilStartResourceService = resutils.NewProc("ResUtilStartResourceService")
)
// pszServiceName (LPCWSTR), phServiceHandle (SC_HANDLE* in/out)
r1, _, err := procResUtilStartResourceService.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszServiceName))),
uintptr(phServiceHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ResUtilStartResourceService(
pszServiceName: PWideChar; // LPCWSTR
phServiceHandle: Pointer // SC_HANDLE* in/out
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilStartResourceService';result := DllCall("RESUTILS\ResUtilStartResourceService"
, "WStr", pszServiceName ; LPCWSTR
, "Ptr", phServiceHandle ; SC_HANDLE* in/out
, "UInt") ; return: DWORD●ResUtilStartResourceService(pszServiceName, phServiceHandle) = DLL("RESUTILS.dll", "dword ResUtilStartResourceService(char*, void*)")
# 呼び出し: ResUtilStartResourceService(pszServiceName, phServiceHandle)
# pszServiceName : LPCWSTR -> "char*"
# phServiceHandle : SC_HANDLE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。