ChangeServiceConfigW
関数シグネチャ
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
BOOL ChangeServiceConfigW(
SC_HANDLE hService,
ENUM_SERVICE_TYPE dwServiceType,
SERVICE_START_TYPE dwStartType,
SERVICE_ERROR dwErrorControl,
LPCWSTR lpBinaryPathName, // optional
LPCWSTR lpLoadOrderGroup, // optional
DWORD* lpdwTagId, // optional
LPCWSTR lpDependencies, // optional
LPCWSTR lpServiceStartName, // optional
LPCWSTR lpPassword, // optional
LPCWSTR lpDisplayName // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hService | SC_HANDLE | in | サービスへのハンドル。このハンドルは OpenService または CreateService 関数によって返され、SERVICE_CHANGE_CONFIG アクセス権を持っている必要があります。詳細については、 Service Security and Access Rights を参照してください。 | ||||||||||||||
| dwServiceType | ENUM_SERVICE_TYPE | in | サービスの種類。既存のサービスの種類を変更しない場合は SERVICE_NO_CHANGE を指定します。それ以外の場合は、次のいずれかのサービスの種類を指定します。
SERVICE_WIN32_OWN_PROCESS または SERVICE_WIN32_SHARE_PROCESS を指定し、サービスが LocalSystem account のコンテキストで実行されている場合は、次の種類も指定できます。
| ||||||||||||||
| dwStartType | SERVICE_START_TYPE | in | サービスの開始オプション。既存の開始の種類を変更しない場合は SERVICE_NO_CHANGE を指定します。それ以外の場合は、次のいずれかの値を指定します。
| ||||||||||||||
| dwErrorControl | SERVICE_ERROR | in | このサービスの開始に失敗した場合のエラーの重大度と実行されるアクション。既存のエラー制御を変更しない場合は SERVICE_NO_CHANGE を指定します。それ以外の場合は、次のいずれかの値を指定します。
| ||||||||||||||
| lpBinaryPathName | LPCWSTR | inoptional | サービスバイナリファイルへの完全修飾パス。既存のパスを変更しない場合は NULL を指定します。パスにスペースが含まれる場合は、正しく解釈されるように引用符で囲む必要があります。たとえば、"d:\my share\myservice.exe" は ""d:\my share\myservice.exe"" と指定する必要があります。 パスには、自動開始サービスの引数を含めることもできます。たとえば、"d:\myshare\myservice.exe arg1 arg2" のように指定します。これらの引数は、サービスのエントリポイント (通常は main 関数) に渡されます。 別のコンピューター上のパスを指定する場合、リモート呼び出しで使用されるセキュリティコンテキストはローカルコンピューターのコンピューターアカウントであるため、その共有はローカルコンピューターのコンピューターアカウントからアクセスできる必要があります。ただし、この要件により、リモートコンピューターに潜在する脆弱性がローカルコンピューターに影響を及ぼす可能性があります。そのため、ローカルファイルを使用することをお勧めします。 | ||||||||||||||
| lpLoadOrderGroup | LPCWSTR | inoptional | このサービスが属するロード順序グループの名前。既存のグループを変更しない場合は NULL を指定します。サービスがグループに属さない場合は空文字列を指定します。 起動プログラムは、ロード順序グループを使用して、他のグループとの相対的な指定順序でサービスのグループをロードします。ロード順序グループの一覧は、次のレジストリキーの ServiceGroupOrder 値に含まれています。 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control | ||||||||||||||
| lpdwTagId | DWORD* | outoptional | lpLoadOrderGroup パラメーターで指定されたグループ内で一意となるタグ値を受け取る変数へのポインター。既存のタグを変更しない場合は NULL を指定します。 次のレジストリキーの GroupOrderList 値にタグ順序ベクトルを指定することで、ロード順序グループ内のサービス起動の順序付けにタグを使用できます。 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control タグは、SERVICE_BOOT_START または SERVICE_SYSTEM_START の開始の種類を持つドライバーサービスに対してのみ評価されます。 | ||||||||||||||
| lpDependencies | LPCWSTR | inoptional | このサービスを開始する前にシステムが開始する必要があるサービスまたはロード順序グループの名前を、NULL 区切りで列挙し、末尾を二重 NULL で終端した配列へのポインター。(グループへの依存とは、グループのすべてのメンバーを開始しようとした後に、グループの少なくとも 1 つのメンバーが実行されていれば、このサービスを実行できることを意味します。) 既存の依存関係を変更しない場合は NULL を指定します。サービスに依存関係がない場合は空文字列を指定します。 サービスとサービスグループは同じ名前空間を共有するため、グループ名にはサービス名と区別できるように SC_GROUP_IDENTIFIER をプレフィックスとして付ける必要があります。 | ||||||||||||||
| lpServiceStartName | LPCWSTR | inoptional | サービスを実行するアカウントの名前。既存のアカウント名を変更しない場合は NULL を指定します。サービスの種類が SERVICE_WIN32_OWN_PROCESS の場合は、DomainName\UserName の形式でアカウント名を使用します。サービスプロセスはこのユーザーとしてログオンします。アカウントが組み込みドメインに属する場合は、.\UserName を指定できます (対応する C/C++ 文字列は ".\\UserName" となります)。詳細については、 Service User Accounts と「解説」セクションの警告を参照してください。 共有プロセスは任意のユーザーとして実行できます。 サービスの種類が SERVICE_KERNEL_DRIVER または SERVICE_FILE_SYSTEM_DRIVER の場合、名前はシステムがデバイスドライバーをロードするために使用するドライバーオブジェクト名です。ドライバーが I/O システムによって作成される既定のオブジェクト名を使用する場合は NULL を指定します。 サービスは、管理されたアカウント (managed account) または仮想アカウント (virtual account) を使用するように構成できます。サービスが管理されたサービスアカウントを使用するように構成されている場合、名前は管理されたサービスアカウント名です。サービスが仮想アカウントを使用するように構成されている場合は、名前を NT SERVICE\ServiceName として指定します。管理されたサービスアカウントと仮想アカウントの詳細については、Service Accounts Step-by-Step Guide を参照してください。 Windows Server 2008、Windows Vista、Windows Server 2003、Windows XP: 管理されたサービスアカウントと仮想アカウントは、Windows 7 および Windows Server 2008 R2 までサポートされていません。 | ||||||||||||||
| lpPassword | LPCWSTR | inoptional | lpServiceStartName パラメーターで指定されたアカウント名のパスワード。既存のパスワードを変更しない場合は NULL を指定します。アカウントにパスワードがない場合、またはサービスが LocalService、NetworkService、もしくは LocalSystem アカウントで実行される場合は、空文字列を指定します。詳細については、 Service Record List を参照してください。 lpServiceStartName パラメーターで指定されたアカウント名が管理されたサービスアカウントまたは仮想アカウントの名前である場合、lpPassword パラメーターは NULL である必要があります。 ドライバーサービスではパスワードは無視されます。 | ||||||||||||||
| lpDisplayName | LPCWSTR | inoptional | アプリケーションがユーザーに対してサービスを識別するために使用する表示名。既存の表示名を変更しない場合は NULL を指定します。それ以外の場合、この文字列の最大長は 256 文字です。名前はサービスコントロールマネージャー内で大文字小文字が保持されます。表示名の比較は常に大文字小文字を区別しません。 このパラメーターでは、次の形式を使用してローカライズされた文字列を指定できます。 @[path]dllname,-strID 識別子 strID を持つ文字列が dllname からロードされます。path は省略可能です。詳細については、RegLoadMUIString を参照してください。 Windows Server 2003 および Windows XP: ローカライズされた文字列は Windows Vista までサポートされていません。 |
戻り値の型: BOOL
公式ドキュメント
サービスの構成パラメーターを変更します。(Unicode)
戻り値
関数が成功した場合、戻り値は 0 以外の値になります。
関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、 GetLastError を呼び出します。
次のエラーコードはサービスコントロールマネージャーによって設定される場合があります。その他のエラーコードは、サービスコントロールマネージャーが呼び出すレジストリ関数によって設定される場合があります。
| 戻りコード | 説明 |
|---|---|
| ハンドルが SERVICE_CHANGE_CONFIG アクセス権を持っていません。 | |
| 循環するサービス依存関係が指定されました。 | |
| 表示名が、サービス名または別の表示名として、サービスコントローラーマネージャーのデータベースに既に存在します。 | |
| 指定されたハンドルが無効です。 | |
| 指定されたパラメーターが無効です。 | |
| アカウント名が存在しないか、既にインストールされているサービスと同じバイナリファイルを共有するようにサービスが指定されているが、そのアカウント名がインストール済みのサービスと同じではありません。 | |
| サービスが削除対象としてマークされています。 |
解説(Remarks)
ChangeServiceConfig 関数は、サービスコントロールマネージャーのデータベース内の指定されたサービスの構成情報を変更します。現在の構成情報は、 QueryServiceConfig 関数を使用して取得できます。
実行中のサービスの構成を変更した場合、lpDisplayName を除いて、変更はサービスが停止されるまで有効になりません。サービスを再起動せずに資格情報を更新するには、LsaCallAuthenticationPackage 関数を使用します。
セキュリティに関する解説
lpServiceStartName パラメーターを設定すると、サービスのログオンアカウントが変更されます。これにより問題が発生する可能性があります。サービスプリンシパル名 (SPN) を登録している場合、それが誤ったアカウントに登録されることになります。同様に、ACE を使用してサービスへのアクセスを許可している場合、誤ったアカウントにアクセスが許可されることになります。例
例については、 Changing a Service's Configuration を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
BOOL ChangeServiceConfigW(
SC_HANDLE hService,
ENUM_SERVICE_TYPE dwServiceType,
SERVICE_START_TYPE dwStartType,
SERVICE_ERROR dwErrorControl,
LPCWSTR lpBinaryPathName, // optional
LPCWSTR lpLoadOrderGroup, // optional
DWORD* lpdwTagId, // optional
LPCWSTR lpDependencies, // optional
LPCWSTR lpServiceStartName, // optional
LPCWSTR lpPassword, // optional
LPCWSTR lpDisplayName // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool ChangeServiceConfigW(
IntPtr hService, // SC_HANDLE
uint dwServiceType, // ENUM_SERVICE_TYPE
uint dwStartType, // SERVICE_START_TYPE
uint dwErrorControl, // SERVICE_ERROR
[MarshalAs(UnmanagedType.LPWStr)] string lpBinaryPathName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpLoadOrderGroup, // LPCWSTR optional
IntPtr lpdwTagId, // DWORD* optional, out
[MarshalAs(UnmanagedType.LPWStr)] string lpDependencies, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpServiceStartName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpPassword, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpDisplayName // LPCWSTR optional
);<DllImport("ADVAPI32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ChangeServiceConfigW(
hService As IntPtr, ' SC_HANDLE
dwServiceType As UInteger, ' ENUM_SERVICE_TYPE
dwStartType As UInteger, ' SERVICE_START_TYPE
dwErrorControl As UInteger, ' SERVICE_ERROR
<MarshalAs(UnmanagedType.LPWStr)> lpBinaryPathName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpLoadOrderGroup As String, ' LPCWSTR optional
lpdwTagId As IntPtr, ' DWORD* optional, out
<MarshalAs(UnmanagedType.LPWStr)> lpDependencies As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpServiceStartName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpPassword As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpDisplayName As String ' LPCWSTR optional
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hService : SC_HANDLE
' dwServiceType : ENUM_SERVICE_TYPE
' dwStartType : SERVICE_START_TYPE
' dwErrorControl : SERVICE_ERROR
' lpBinaryPathName : LPCWSTR optional
' lpLoadOrderGroup : LPCWSTR optional
' lpdwTagId : DWORD* optional, out
' lpDependencies : LPCWSTR optional
' lpServiceStartName : LPCWSTR optional
' lpPassword : LPCWSTR optional
' lpDisplayName : LPCWSTR optional
Declare PtrSafe Function ChangeServiceConfigW Lib "advapi32" ( _
ByVal hService As LongPtr, _
ByVal dwServiceType As Long, _
ByVal dwStartType As Long, _
ByVal dwErrorControl As Long, _
ByVal lpBinaryPathName As LongPtr, _
ByVal lpLoadOrderGroup As LongPtr, _
ByVal lpdwTagId As LongPtr, _
ByVal lpDependencies As LongPtr, _
ByVal lpServiceStartName As LongPtr, _
ByVal lpPassword As LongPtr, _
ByVal lpDisplayName As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ChangeServiceConfigW = ctypes.windll.advapi32.ChangeServiceConfigW
ChangeServiceConfigW.restype = wintypes.BOOL
ChangeServiceConfigW.argtypes = [
wintypes.HANDLE, # hService : SC_HANDLE
wintypes.DWORD, # dwServiceType : ENUM_SERVICE_TYPE
wintypes.DWORD, # dwStartType : SERVICE_START_TYPE
wintypes.DWORD, # dwErrorControl : SERVICE_ERROR
wintypes.LPCWSTR, # lpBinaryPathName : LPCWSTR optional
wintypes.LPCWSTR, # lpLoadOrderGroup : LPCWSTR optional
ctypes.POINTER(wintypes.DWORD), # lpdwTagId : DWORD* optional, out
wintypes.LPCWSTR, # lpDependencies : LPCWSTR optional
wintypes.LPCWSTR, # lpServiceStartName : LPCWSTR optional
wintypes.LPCWSTR, # lpPassword : LPCWSTR optional
wintypes.LPCWSTR, # lpDisplayName : LPCWSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
ChangeServiceConfigW = Fiddle::Function.new(
lib['ChangeServiceConfigW'],
[
Fiddle::TYPE_VOIDP, # hService : SC_HANDLE
-Fiddle::TYPE_INT, # dwServiceType : ENUM_SERVICE_TYPE
-Fiddle::TYPE_INT, # dwStartType : SERVICE_START_TYPE
-Fiddle::TYPE_INT, # dwErrorControl : SERVICE_ERROR
Fiddle::TYPE_VOIDP, # lpBinaryPathName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpLoadOrderGroup : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpdwTagId : DWORD* optional, out
Fiddle::TYPE_VOIDP, # lpDependencies : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpServiceStartName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpPassword : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpDisplayName : LPCWSTR optional
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advapi32")]
extern "system" {
fn ChangeServiceConfigW(
hService: *mut core::ffi::c_void, // SC_HANDLE
dwServiceType: u32, // ENUM_SERVICE_TYPE
dwStartType: u32, // SERVICE_START_TYPE
dwErrorControl: u32, // SERVICE_ERROR
lpBinaryPathName: *const u16, // LPCWSTR optional
lpLoadOrderGroup: *const u16, // LPCWSTR optional
lpdwTagId: *mut u32, // DWORD* optional, out
lpDependencies: *const u16, // LPCWSTR optional
lpServiceStartName: *const u16, // LPCWSTR optional
lpPassword: *const u16, // LPCWSTR optional
lpDisplayName: *const u16 // LPCWSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool ChangeServiceConfigW(IntPtr hService, uint dwServiceType, uint dwStartType, uint dwErrorControl, [MarshalAs(UnmanagedType.LPWStr)] string lpBinaryPathName, [MarshalAs(UnmanagedType.LPWStr)] string lpLoadOrderGroup, IntPtr lpdwTagId, [MarshalAs(UnmanagedType.LPWStr)] string lpDependencies, [MarshalAs(UnmanagedType.LPWStr)] string lpServiceStartName, [MarshalAs(UnmanagedType.LPWStr)] string lpPassword, [MarshalAs(UnmanagedType.LPWStr)] string lpDisplayName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_ChangeServiceConfigW' -Namespace Win32 -PassThru
# $api::ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)#uselib "ADVAPI32.dll"
#func global ChangeServiceConfigW "ChangeServiceConfigW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; ChangeServiceConfigW hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, varptr(lpdwTagId), lpDependencies, lpServiceStartName, lpPassword, lpDisplayName ; 戻り値は stat
; hService : SC_HANDLE -> "wptr"
; dwServiceType : ENUM_SERVICE_TYPE -> "wptr"
; dwStartType : SERVICE_START_TYPE -> "wptr"
; dwErrorControl : SERVICE_ERROR -> "wptr"
; lpBinaryPathName : LPCWSTR optional -> "wptr"
; lpLoadOrderGroup : LPCWSTR optional -> "wptr"
; lpdwTagId : DWORD* optional, out -> "wptr"
; lpDependencies : LPCWSTR optional -> "wptr"
; lpServiceStartName : LPCWSTR optional -> "wptr"
; lpPassword : LPCWSTR optional -> "wptr"
; lpDisplayName : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVAPI32.dll" #cfunc global ChangeServiceConfigW "ChangeServiceConfigW" sptr, int, int, int, wstr, wstr, var, wstr, wstr, wstr, wstr ; res = ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) ; hService : SC_HANDLE -> "sptr" ; dwServiceType : ENUM_SERVICE_TYPE -> "int" ; dwStartType : SERVICE_START_TYPE -> "int" ; dwErrorControl : SERVICE_ERROR -> "int" ; lpBinaryPathName : LPCWSTR optional -> "wstr" ; lpLoadOrderGroup : LPCWSTR optional -> "wstr" ; lpdwTagId : DWORD* optional, out -> "var" ; lpDependencies : LPCWSTR optional -> "wstr" ; lpServiceStartName : LPCWSTR optional -> "wstr" ; lpPassword : LPCWSTR optional -> "wstr" ; lpDisplayName : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #cfunc global ChangeServiceConfigW "ChangeServiceConfigW" sptr, int, int, int, wstr, wstr, sptr, wstr, wstr, wstr, wstr ; res = ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, varptr(lpdwTagId), lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) ; hService : SC_HANDLE -> "sptr" ; dwServiceType : ENUM_SERVICE_TYPE -> "int" ; dwStartType : SERVICE_START_TYPE -> "int" ; dwErrorControl : SERVICE_ERROR -> "int" ; lpBinaryPathName : LPCWSTR optional -> "wstr" ; lpLoadOrderGroup : LPCWSTR optional -> "wstr" ; lpdwTagId : DWORD* optional, out -> "sptr" ; lpDependencies : LPCWSTR optional -> "wstr" ; lpServiceStartName : LPCWSTR optional -> "wstr" ; lpPassword : LPCWSTR optional -> "wstr" ; lpDisplayName : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; BOOL ChangeServiceConfigW(SC_HANDLE hService, ENUM_SERVICE_TYPE dwServiceType, SERVICE_START_TYPE dwStartType, SERVICE_ERROR dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, DWORD* lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName) #uselib "ADVAPI32.dll" #cfunc global ChangeServiceConfigW "ChangeServiceConfigW" intptr, int, int, int, wstr, wstr, var, wstr, wstr, wstr, wstr ; res = ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) ; hService : SC_HANDLE -> "intptr" ; dwServiceType : ENUM_SERVICE_TYPE -> "int" ; dwStartType : SERVICE_START_TYPE -> "int" ; dwErrorControl : SERVICE_ERROR -> "int" ; lpBinaryPathName : LPCWSTR optional -> "wstr" ; lpLoadOrderGroup : LPCWSTR optional -> "wstr" ; lpdwTagId : DWORD* optional, out -> "var" ; lpDependencies : LPCWSTR optional -> "wstr" ; lpServiceStartName : LPCWSTR optional -> "wstr" ; lpPassword : LPCWSTR optional -> "wstr" ; lpDisplayName : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ChangeServiceConfigW(SC_HANDLE hService, ENUM_SERVICE_TYPE dwServiceType, SERVICE_START_TYPE dwStartType, SERVICE_ERROR dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, DWORD* lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName) #uselib "ADVAPI32.dll" #cfunc global ChangeServiceConfigW "ChangeServiceConfigW" intptr, int, int, int, wstr, wstr, intptr, wstr, wstr, wstr, wstr ; res = ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, varptr(lpdwTagId), lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) ; hService : SC_HANDLE -> "intptr" ; dwServiceType : ENUM_SERVICE_TYPE -> "int" ; dwStartType : SERVICE_START_TYPE -> "int" ; dwErrorControl : SERVICE_ERROR -> "int" ; lpBinaryPathName : LPCWSTR optional -> "wstr" ; lpLoadOrderGroup : LPCWSTR optional -> "wstr" ; lpdwTagId : DWORD* optional, out -> "intptr" ; lpDependencies : LPCWSTR optional -> "wstr" ; lpServiceStartName : LPCWSTR optional -> "wstr" ; lpPassword : LPCWSTR optional -> "wstr" ; lpDisplayName : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procChangeServiceConfigW = advapi32.NewProc("ChangeServiceConfigW")
)
// hService (SC_HANDLE), dwServiceType (ENUM_SERVICE_TYPE), dwStartType (SERVICE_START_TYPE), dwErrorControl (SERVICE_ERROR), lpBinaryPathName (LPCWSTR optional), lpLoadOrderGroup (LPCWSTR optional), lpdwTagId (DWORD* optional, out), lpDependencies (LPCWSTR optional), lpServiceStartName (LPCWSTR optional), lpPassword (LPCWSTR optional), lpDisplayName (LPCWSTR optional)
r1, _, err := procChangeServiceConfigW.Call(
uintptr(hService),
uintptr(dwServiceType),
uintptr(dwStartType),
uintptr(dwErrorControl),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpBinaryPathName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpLoadOrderGroup))),
uintptr(lpdwTagId),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpDependencies))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpServiceStartName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpPassword))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpDisplayName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ChangeServiceConfigW(
hService: THandle; // SC_HANDLE
dwServiceType: DWORD; // ENUM_SERVICE_TYPE
dwStartType: DWORD; // SERVICE_START_TYPE
dwErrorControl: DWORD; // SERVICE_ERROR
lpBinaryPathName: PWideChar; // LPCWSTR optional
lpLoadOrderGroup: PWideChar; // LPCWSTR optional
lpdwTagId: Pointer; // DWORD* optional, out
lpDependencies: PWideChar; // LPCWSTR optional
lpServiceStartName: PWideChar; // LPCWSTR optional
lpPassword: PWideChar; // LPCWSTR optional
lpDisplayName: PWideChar // LPCWSTR optional
): BOOL; stdcall;
external 'ADVAPI32.dll' name 'ChangeServiceConfigW';result := DllCall("ADVAPI32\ChangeServiceConfigW"
, "Ptr", hService ; SC_HANDLE
, "UInt", dwServiceType ; ENUM_SERVICE_TYPE
, "UInt", dwStartType ; SERVICE_START_TYPE
, "UInt", dwErrorControl ; SERVICE_ERROR
, "WStr", lpBinaryPathName ; LPCWSTR optional
, "WStr", lpLoadOrderGroup ; LPCWSTR optional
, "Ptr", lpdwTagId ; DWORD* optional, out
, "WStr", lpDependencies ; LPCWSTR optional
, "WStr", lpServiceStartName ; LPCWSTR optional
, "WStr", lpPassword ; LPCWSTR optional
, "WStr", lpDisplayName ; LPCWSTR optional
, "Int") ; return: BOOL●ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) = DLL("ADVAPI32.dll", "bool ChangeServiceConfigW(void*, dword, dword, dword, char*, char*, void*, char*, char*, char*, char*)")
# 呼び出し: ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)
# hService : SC_HANDLE -> "void*"
# dwServiceType : ENUM_SERVICE_TYPE -> "dword"
# dwStartType : SERVICE_START_TYPE -> "dword"
# dwErrorControl : SERVICE_ERROR -> "dword"
# lpBinaryPathName : LPCWSTR optional -> "char*"
# lpLoadOrderGroup : LPCWSTR optional -> "char*"
# lpdwTagId : DWORD* optional, out -> "void*"
# lpDependencies : LPCWSTR optional -> "char*"
# lpServiceStartName : LPCWSTR optional -> "char*"
# lpPassword : LPCWSTR optional -> "char*"
# lpDisplayName : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "advapi32" fn ChangeServiceConfigW(
hService: ?*anyopaque, // SC_HANDLE
dwServiceType: u32, // ENUM_SERVICE_TYPE
dwStartType: u32, // SERVICE_START_TYPE
dwErrorControl: u32, // SERVICE_ERROR
lpBinaryPathName: [*c]const u16, // LPCWSTR optional
lpLoadOrderGroup: [*c]const u16, // LPCWSTR optional
lpdwTagId: [*c]u32, // DWORD* optional, out
lpDependencies: [*c]const u16, // LPCWSTR optional
lpServiceStartName: [*c]const u16, // LPCWSTR optional
lpPassword: [*c]const u16, // LPCWSTR optional
lpDisplayName: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc ChangeServiceConfigW(
hService: pointer, # SC_HANDLE
dwServiceType: uint32, # ENUM_SERVICE_TYPE
dwStartType: uint32, # SERVICE_START_TYPE
dwErrorControl: uint32, # SERVICE_ERROR
lpBinaryPathName: WideCString, # LPCWSTR optional
lpLoadOrderGroup: WideCString, # LPCWSTR optional
lpdwTagId: ptr uint32, # DWORD* optional, out
lpDependencies: WideCString, # LPCWSTR optional
lpServiceStartName: WideCString, # LPCWSTR optional
lpPassword: WideCString, # LPCWSTR optional
lpDisplayName: WideCString # LPCWSTR optional
): int32 {.importc: "ChangeServiceConfigW", stdcall, dynlib: "ADVAPI32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "advapi32");
extern(Windows)
int ChangeServiceConfigW(
void* hService, // SC_HANDLE
uint dwServiceType, // ENUM_SERVICE_TYPE
uint dwStartType, // SERVICE_START_TYPE
uint dwErrorControl, // SERVICE_ERROR
const(wchar)* lpBinaryPathName, // LPCWSTR optional
const(wchar)* lpLoadOrderGroup, // LPCWSTR optional
uint* lpdwTagId, // DWORD* optional, out
const(wchar)* lpDependencies, // LPCWSTR optional
const(wchar)* lpServiceStartName, // LPCWSTR optional
const(wchar)* lpPassword, // LPCWSTR optional
const(wchar)* lpDisplayName // LPCWSTR optional
);ccall((:ChangeServiceConfigW, "ADVAPI32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, UInt32, UInt32, Cwstring, Cwstring, Ptr{UInt32}, Cwstring, Cwstring, Cwstring, Cwstring),
hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)
# hService : SC_HANDLE -> Ptr{Cvoid}
# dwServiceType : ENUM_SERVICE_TYPE -> UInt32
# dwStartType : SERVICE_START_TYPE -> UInt32
# dwErrorControl : SERVICE_ERROR -> UInt32
# lpBinaryPathName : LPCWSTR optional -> Cwstring
# lpLoadOrderGroup : LPCWSTR optional -> Cwstring
# lpdwTagId : DWORD* optional, out -> Ptr{UInt32}
# lpDependencies : LPCWSTR optional -> Cwstring
# lpServiceStartName : LPCWSTR optional -> Cwstring
# lpPassword : LPCWSTR optional -> Cwstring
# lpDisplayName : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t ChangeServiceConfigW(
void* hService,
uint32_t dwServiceType,
uint32_t dwStartType,
uint32_t dwErrorControl,
const uint16_t* lpBinaryPathName,
const uint16_t* lpLoadOrderGroup,
uint32_t* lpdwTagId,
const uint16_t* lpDependencies,
const uint16_t* lpServiceStartName,
const uint16_t* lpPassword,
const uint16_t* lpDisplayName);
]]
local advapi32 = ffi.load("advapi32")
-- advapi32.ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)
-- hService : SC_HANDLE
-- dwServiceType : ENUM_SERVICE_TYPE
-- dwStartType : SERVICE_START_TYPE
-- dwErrorControl : SERVICE_ERROR
-- lpBinaryPathName : LPCWSTR optional
-- lpLoadOrderGroup : LPCWSTR optional
-- lpdwTagId : DWORD* optional, out
-- lpDependencies : LPCWSTR optional
-- lpServiceStartName : LPCWSTR optional
-- lpPassword : LPCWSTR optional
-- lpDisplayName : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('ADVAPI32.dll');
const ChangeServiceConfigW = lib.func('__stdcall', 'ChangeServiceConfigW', 'int32_t', ['void *', 'uint32_t', 'uint32_t', 'uint32_t', 'str16', 'str16', 'uint32_t *', 'str16', 'str16', 'str16', 'str16']);
// ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)
// hService : SC_HANDLE -> 'void *'
// dwServiceType : ENUM_SERVICE_TYPE -> 'uint32_t'
// dwStartType : SERVICE_START_TYPE -> 'uint32_t'
// dwErrorControl : SERVICE_ERROR -> 'uint32_t'
// lpBinaryPathName : LPCWSTR optional -> 'str16'
// lpLoadOrderGroup : LPCWSTR optional -> 'str16'
// lpdwTagId : DWORD* optional, out -> 'uint32_t *'
// lpDependencies : LPCWSTR optional -> 'str16'
// lpServiceStartName : LPCWSTR optional -> 'str16'
// lpPassword : LPCWSTR optional -> 'str16'
// lpDisplayName : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ADVAPI32.dll", {
ChangeServiceConfigW: { parameters: ["pointer", "u32", "u32", "u32", "buffer", "buffer", "pointer", "buffer", "buffer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName)
// hService : SC_HANDLE -> "pointer"
// dwServiceType : ENUM_SERVICE_TYPE -> "u32"
// dwStartType : SERVICE_START_TYPE -> "u32"
// dwErrorControl : SERVICE_ERROR -> "u32"
// lpBinaryPathName : LPCWSTR optional -> "buffer"
// lpLoadOrderGroup : LPCWSTR optional -> "buffer"
// lpdwTagId : DWORD* optional, out -> "pointer"
// lpDependencies : LPCWSTR optional -> "buffer"
// lpServiceStartName : LPCWSTR optional -> "buffer"
// lpPassword : LPCWSTR optional -> "buffer"
// lpDisplayName : LPCWSTR optional -> "buffer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ChangeServiceConfigW(
void* hService,
uint32_t dwServiceType,
uint32_t dwStartType,
uint32_t dwErrorControl,
const uint16_t* lpBinaryPathName,
const uint16_t* lpLoadOrderGroup,
uint32_t* lpdwTagId,
const uint16_t* lpDependencies,
const uint16_t* lpServiceStartName,
const uint16_t* lpPassword,
const uint16_t* lpDisplayName);
C, "ADVAPI32.dll");
// $ffi->ChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName);
// hService : SC_HANDLE
// dwServiceType : ENUM_SERVICE_TYPE
// dwStartType : SERVICE_START_TYPE
// dwErrorControl : SERVICE_ERROR
// lpBinaryPathName : LPCWSTR optional
// lpLoadOrderGroup : LPCWSTR optional
// lpdwTagId : DWORD* optional, out
// lpDependencies : LPCWSTR optional
// lpServiceStartName : LPCWSTR optional
// lpPassword : LPCWSTR optional
// lpDisplayName : LPCWSTR optional
// 構造体/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, W32APIOptions.UNICODE_OPTIONS);
boolean ChangeServiceConfigW(
Pointer hService, // SC_HANDLE
int dwServiceType, // ENUM_SERVICE_TYPE
int dwStartType, // SERVICE_START_TYPE
int dwErrorControl, // SERVICE_ERROR
WString lpBinaryPathName, // LPCWSTR optional
WString lpLoadOrderGroup, // LPCWSTR optional
IntByReference lpdwTagId, // DWORD* optional, out
WString lpDependencies, // LPCWSTR optional
WString lpServiceStartName, // LPCWSTR optional
WString lpPassword, // LPCWSTR optional
WString lpDisplayName // LPCWSTR optional
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("advapi32")]
lib LibADVAPI32
fun ChangeServiceConfigW = ChangeServiceConfigW(
hService : Void*, # SC_HANDLE
dwServiceType : UInt32, # ENUM_SERVICE_TYPE
dwStartType : UInt32, # SERVICE_START_TYPE
dwErrorControl : UInt32, # SERVICE_ERROR
lpBinaryPathName : UInt16*, # LPCWSTR optional
lpLoadOrderGroup : UInt16*, # LPCWSTR optional
lpdwTagId : UInt32*, # DWORD* optional, out
lpDependencies : UInt16*, # LPCWSTR optional
lpServiceStartName : UInt16*, # LPCWSTR optional
lpPassword : UInt16*, # LPCWSTR optional
lpDisplayName : UInt16* # LPCWSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ChangeServiceConfigWNative = Int32 Function(Pointer<Void>, Uint32, Uint32, Uint32, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>);
typedef ChangeServiceConfigWDart = int Function(Pointer<Void>, int, int, int, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>);
final ChangeServiceConfigW = DynamicLibrary.open('ADVAPI32.dll')
.lookupFunction<ChangeServiceConfigWNative, ChangeServiceConfigWDart>('ChangeServiceConfigW');
// hService : SC_HANDLE -> Pointer<Void>
// dwServiceType : ENUM_SERVICE_TYPE -> Uint32
// dwStartType : SERVICE_START_TYPE -> Uint32
// dwErrorControl : SERVICE_ERROR -> Uint32
// lpBinaryPathName : LPCWSTR optional -> Pointer<Utf16>
// lpLoadOrderGroup : LPCWSTR optional -> Pointer<Utf16>
// lpdwTagId : DWORD* optional, out -> Pointer<Uint32>
// lpDependencies : LPCWSTR optional -> Pointer<Utf16>
// lpServiceStartName : LPCWSTR optional -> Pointer<Utf16>
// lpPassword : LPCWSTR optional -> Pointer<Utf16>
// lpDisplayName : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ChangeServiceConfigW(
hService: THandle; // SC_HANDLE
dwServiceType: DWORD; // ENUM_SERVICE_TYPE
dwStartType: DWORD; // SERVICE_START_TYPE
dwErrorControl: DWORD; // SERVICE_ERROR
lpBinaryPathName: PWideChar; // LPCWSTR optional
lpLoadOrderGroup: PWideChar; // LPCWSTR optional
lpdwTagId: Pointer; // DWORD* optional, out
lpDependencies: PWideChar; // LPCWSTR optional
lpServiceStartName: PWideChar; // LPCWSTR optional
lpPassword: PWideChar; // LPCWSTR optional
lpDisplayName: PWideChar // LPCWSTR optional
): BOOL; stdcall;
external 'ADVAPI32.dll' name 'ChangeServiceConfigW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ChangeServiceConfigW"
c_ChangeServiceConfigW :: Ptr () -> Word32 -> Word32 -> Word32 -> CWString -> CWString -> Ptr Word32 -> CWString -> CWString -> CWString -> CWString -> IO CInt
-- hService : SC_HANDLE -> Ptr ()
-- dwServiceType : ENUM_SERVICE_TYPE -> Word32
-- dwStartType : SERVICE_START_TYPE -> Word32
-- dwErrorControl : SERVICE_ERROR -> Word32
-- lpBinaryPathName : LPCWSTR optional -> CWString
-- lpLoadOrderGroup : LPCWSTR optional -> CWString
-- lpdwTagId : DWORD* optional, out -> Ptr Word32
-- lpDependencies : LPCWSTR optional -> CWString
-- lpServiceStartName : LPCWSTR optional -> CWString
-- lpPassword : LPCWSTR optional -> CWString
-- lpDisplayName : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let changeserviceconfigw =
foreign "ChangeServiceConfigW"
((ptr void) @-> uint32_t @-> uint32_t @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint32_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> returning int32_t)
(* hService : SC_HANDLE -> (ptr void) *)
(* dwServiceType : ENUM_SERVICE_TYPE -> uint32_t *)
(* dwStartType : SERVICE_START_TYPE -> uint32_t *)
(* dwErrorControl : SERVICE_ERROR -> uint32_t *)
(* lpBinaryPathName : LPCWSTR optional -> (ptr uint16_t) *)
(* lpLoadOrderGroup : LPCWSTR optional -> (ptr uint16_t) *)
(* lpdwTagId : DWORD* optional, out -> (ptr uint32_t) *)
(* lpDependencies : LPCWSTR optional -> (ptr uint16_t) *)
(* lpServiceStartName : LPCWSTR optional -> (ptr uint16_t) *)
(* lpPassword : LPCWSTR optional -> (ptr uint16_t) *)
(* lpDisplayName : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library advapi32 (t "ADVAPI32.dll"))
(cffi:use-foreign-library advapi32)
(cffi:defcfun ("ChangeServiceConfigW" change-service-config-w :convention :stdcall) :int32
(h-service :pointer) ; SC_HANDLE
(dw-service-type :uint32) ; ENUM_SERVICE_TYPE
(dw-start-type :uint32) ; SERVICE_START_TYPE
(dw-error-control :uint32) ; SERVICE_ERROR
(lp-binary-path-name (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-load-order-group (:string :encoding :utf-16le)) ; LPCWSTR optional
(lpdw-tag-id :pointer) ; DWORD* optional, out
(lp-dependencies (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-service-start-name (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-password (:string :encoding :utf-16le)) ; LPCWSTR optional
(lp-display-name (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ChangeServiceConfigW = Win32::API::More->new('ADVAPI32',
'BOOL ChangeServiceConfigW(HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPVOID lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)');
# my $ret = $ChangeServiceConfigW->Call($hService, $dwServiceType, $dwStartType, $dwErrorControl, $lpBinaryPathName, $lpLoadOrderGroup, $lpdwTagId, $lpDependencies, $lpServiceStartName, $lpPassword, $lpDisplayName);
# hService : SC_HANDLE -> HANDLE
# dwServiceType : ENUM_SERVICE_TYPE -> DWORD
# dwStartType : SERVICE_START_TYPE -> DWORD
# dwErrorControl : SERVICE_ERROR -> DWORD
# lpBinaryPathName : LPCWSTR optional -> LPCWSTR
# lpLoadOrderGroup : LPCWSTR optional -> LPCWSTR
# lpdwTagId : DWORD* optional, out -> LPVOID
# lpDependencies : LPCWSTR optional -> LPCWSTR
# lpServiceStartName : LPCWSTR optional -> LPCWSTR
# lpPassword : LPCWSTR optional -> LPCWSTR
# lpDisplayName : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
- f ChangeServiceConfigA (ANSI版) — 既存サービスの構成情報を変更する。
- f ChangeServiceConfig2W — サービスの拡張構成情報を変更する。
- f CreateServiceW — 新しいサービスを作成しSCMデータベースに登録する。
- f OpenServiceW — 既存サービスを開いてハンドルを取得する。
- f QueryServiceConfigW — サービスの構成情報を取得する。
- f QueryServiceConfig2W — サービスの拡張構成情報を取得する。
- f QueryServiceDynamicInformation — 実行中サービスの動的な情報を取得する。
- f StartServiceW — 指定したサービスを開始する。