Fiddling with EnumServicesStatusExW

Paul Vriens at
Wed May 13 06:43:46 CDT 2009

(I accidentally only sent this message to Rob only)


To get away from the tests stuff I thought I'd resurrect my plans to
implement EnumServiceStatusExW (the A-version is needed by SysInternal's
Process Explorer amongst others).

I have most of the stuff ready:

- Added svcctl_EnumServicesStatusExW to
- Added svcctl_EnumServicesStatusExW to
- Added a enumeration routine to
/wine/wine-git/programs/services/services.c (and .h of course)
- Changed EnumServiceStatusExW in /wine/wine-git/dll/advapi32/service.c
to call svcctl_EnumServicesStatusExW

There is one important thing I can't get my head around.

The call to EnumServicesStatusExW passes a pointer to a BYTE *
lpServices with a length of cBufSize.

lpServices is an array of some ENUM_SERVICE_STATUS_PROCESSW structs. The
first two parameters of these structs are pointers to
WCHAR strings. The strings for all these structs (on Windows) can be
found after all the structs themselves. So imagine that we should have 2
services in our lpServices to be passed back to the initial caller:

0000 [0].lpServiceName -> 0088
0008 [0].lpDisplayName -> 0114
0016 [0].SERVICE_STATUS struct of 7 DWORDS
0044 [1].lpServiceName -> 0140
0052 [1].lpDisplayName -> 0166
0060 [1].SERVICE_STATUS struct of 7 DWORDS
0088 "ServiceName1"
0114 "DisplayName1"
0140 "ServiceName1'
0166 "DisplayName1"

(The above is what EnumServicesStatusExW would pass back to the caller)

The enumeration I have in services.c fills the lpServiceName pointer to
the actual string. Likewise for lpDisplayName. This is all in the RPC
world (where the lpServices address is different to the caller passed
address). When lpServices is passed back to the caller I can see that
the SERVICE_STATUS structs are correct but the pointers to the strings
are pointing to the original ones.

How can I make sure the pointers to the strings are correctly passed
back as well? Should the RPC stuff take care of these pointers and
'translate' them?

We could of course teach EnumServicesStatusExW to change the pointers to
the appropriate ones. We know exactly where there strings are so it
should be fairly trivial to change those pointers. This however seems
like a hack.

Any idea is welcome.



More information about the wine-devel mailing list