One of our programs crashes right at the end when it runs under Windows 7. We have traced it to this bit of code.
CT2W szwService(SERVICE\_WORKSTATION);
#if (_MSC_VER == 1500)
// XXXX The following weirdness is because Microsoft forgot that
// The signature for NetStatisticsGet should *always* be unicode!
LPTSTR szService = (LPTSTR)(LPWSTR)szwService;
#else
LPWSTR szService(szwService);
#endif
STAT_WORKSTATION_0 *pStatistics;
if (::NetStatisticsGet(NULL, szService, 0, 0, (LPBYTE*)&pStatistics) != NERR_Success)
...
The call to NetStatisticsGet returns NERR_Success on Windows XP (both 32 and 64 bits) but on Windows 7 (64-bit) it returns 0xC000000D (STATUS_INVALID_PARAMETER). Has anyone got an idea what to do next?