We have been having trouble with a program running on Windows 7 and we have traced it to this code.

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?