Commit 5f2b96b8 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

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

parent b6a505f9
...@@ -46,7 +46,7 @@ typedef struct service_start_info_t ...@@ -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;
[ [
......
...@@ -1046,14 +1046,14 @@ static BOOL process_send_control(struct process_entry *process, const WCHAR *nam ...@@ -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 );
......
...@@ -861,17 +861,17 @@ static BOOL process_send_start_message(struct process_entry *process, const WCHA ...@@ -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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment