From b2f4c7737b3a5e6260a95c30ec93add9b97fee76 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Thu, 31 Jan 2008 14:46:07 +0000 Subject: [PATCH] advapi32: Fix the size calculation in StartServiceW. Calculating an open-ended structure using sizeof doesn't yield an accurate size because of alignment. --- dlls/advapi32/service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 7cfd9ea27bf..9f27c40ea2c 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -484,7 +484,7 @@ static BOOL service_send_start_message(HANDLE pipe, LPCWSTR *argv, DWORD argc) for (i=0; icmd = WINESERV_STARTINFO; ssi->size = len; @@ -497,7 +497,7 @@ static BOOL service_send_start_message(HANDLE pipe, LPCWSTR *argv, DWORD argc) } *p=0; - r = WriteFile(pipe, ssi, sizeof *ssi + (len-1)*sizeof(WCHAR), &count, NULL); + r = WriteFile(pipe, ssi, FIELD_OFFSET(service_start_info, str[len]), &count, NULL); if (r) { r = ReadFile(pipe, &result, sizeof result, &count, NULL);