services: Preparation to allow arbitrary data in service RPC messages.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-08-10 08:30:29 +02:00 committed by Alexandre Julliard
parent b6a505f9a5
commit 5f2b96b859
3 changed files with 6 additions and 6 deletions

View File

@ -46,7 +46,7 @@ typedef struct service_start_info_t
DWORD total_size; /* total request size */ DWORD total_size; /* total request size */
DWORD name_size; /* size of name in data buffer */ DWORD name_size; /* size of name in data buffer */
DWORD control; /* control code */ DWORD control; /* control code */
WCHAR data[1]; BYTE data[1];
} service_start_info; } service_start_info;
[ [

View File

@ -1046,14 +1046,14 @@ static BOOL process_send_control(struct process_entry *process, const WCHAR *nam
BOOL r; BOOL r;
/* calculate how much space we need to send the startup info */ /* 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 = HeapAlloc(GetProcessHeap(),0,FIELD_OFFSET(service_start_info, data[len]));
ssi->cmd = WINESERV_SENDCONTROL; ssi->cmd = WINESERV_SENDCONTROL;
ssi->control = dwControl; ssi->control = dwControl;
ssi->total_size = FIELD_OFFSET(service_start_info, data[len]); ssi->total_size = FIELD_OFFSET(service_start_info, data[len]);
ssi->name_size = strlenW(name) + 1; 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); r = process_send_command(process, ssi, ssi->total_size, result);
HeapFree( GetProcessHeap(), 0, ssi ); HeapFree( GetProcessHeap(), 0, ssi );

View File

@ -861,17 +861,17 @@ static BOOL process_send_start_message(struct process_entry *process, const WCHA
len = strlenW(name) + 1; len = strlenW(name) + 1;
for (i=0; i<argc; i++) for (i=0; i<argc; i++)
len += strlenW(argv[i])+1; len += strlenW(argv[i])+1;
len++; len = (len + 1) * sizeof(WCHAR);
ssi = HeapAlloc(GetProcessHeap(),0,FIELD_OFFSET(service_start_info, data[len])); ssi = HeapAlloc(GetProcessHeap(),0,FIELD_OFFSET(service_start_info, data[len]));
ssi->cmd = WINESERV_STARTINFO; ssi->cmd = WINESERV_STARTINFO;
ssi->control = 0; ssi->control = 0;
ssi->total_size = FIELD_OFFSET(service_start_info, data[len]); ssi->total_size = FIELD_OFFSET(service_start_info, data[len]);
ssi->name_size = strlenW(name) + 1; ssi->name_size = strlenW(name) + 1;
strcpyW(ssi->data, name); strcpyW((WCHAR *)ssi->data, name);
/* copy service args into a single buffer*/ /* 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<argc; i++) for (i=0; i<argc; i++)
{ {
strcpyW(p, argv[i]); strcpyW(p, argv[i]);