From 5f2b96b859d1087557949d855d6fd0e68b128a9d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 10 Aug 2016 08:30:29 +0200 Subject: [PATCH] services: Preparation to allow arbitrary data in service RPC messages. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- include/wine/svcctl.idl | 2 +- programs/services/rpc.c | 4 ++-- programs/services/services.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/wine/svcctl.idl b/include/wine/svcctl.idl index cadc5fd69c9..98412d6ec23 100644 --- a/include/wine/svcctl.idl +++ b/include/wine/svcctl.idl @@ -46,7 +46,7 @@ typedef struct service_start_info_t DWORD total_size; /* total request size */ DWORD name_size; /* size of name in data buffer */ DWORD control; /* control code */ - WCHAR data[1]; + BYTE data[1]; } service_start_info; [ diff --git a/programs/services/rpc.c b/programs/services/rpc.c index 3ebf378846b..54947c67218 100644 --- a/programs/services/rpc.c +++ b/programs/services/rpc.c @@ -1046,14 +1046,14 @@ static BOOL process_send_control(struct process_entry *process, const WCHAR *nam BOOL r; /* calculate how much space we need to send the startup info */ - len = strlenW(name) + 1; + len = (strlenW(name) + 1) * sizeof(WCHAR); ssi = HeapAlloc(GetProcessHeap(),0,FIELD_OFFSET(service_start_info, data[len])); ssi->cmd = WINESERV_SENDCONTROL; ssi->control = dwControl; ssi->total_size = FIELD_OFFSET(service_start_info, data[len]); ssi->name_size = strlenW(name) + 1; - strcpyW(ssi->data, name); + strcpyW((WCHAR *)ssi->data, name); r = process_send_command(process, ssi, ssi->total_size, result); HeapFree( GetProcessHeap(), 0, ssi ); diff --git a/programs/services/services.c b/programs/services/services.c index ae5da2bad75..8e49906fb7b 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -861,17 +861,17 @@ static BOOL process_send_start_message(struct process_entry *process, const WCHA len = strlenW(name) + 1; for (i=0; icmd = WINESERV_STARTINFO; ssi->control = 0; ssi->total_size = FIELD_OFFSET(service_start_info, data[len]); ssi->name_size = strlenW(name) + 1; - strcpyW(ssi->data, name); + strcpyW((WCHAR *)ssi->data, name); /* copy service args into a single buffer*/ - p = &ssi->data[ssi->name_size]; + p = (WCHAR *)&ssi->data[ssi->name_size * sizeof(WCHAR)]; for (i=0; i