- May
- 13,121
- 180
Rex, I recently included _ENVCOUNT in my 4UTILS plugin. A user reported to me privately that TCC/X64 crashes when he tries "ECHO %_ENVCOUNT" (code below). It's pretty simple code; Google and MS searches turned up nothing. Are you aware of any related problems? Thanks.
Code:
INT WINAPI _ENVCOUNT ( WCHAR *psz )
{
DWORD dwCount = 0;
WCHAR *pEnv = GetEnvironmentStrings();
if ( pEnv == NULL )
return error(GetLastError(), L"GetEnvironmentStrings");
while ( *pEnv )
{
if ( *pEnv != L'=' )
dwCount += 1;
while ( *pEnv++ );
}
FreeEnvironmentStrings(pEnv);
Sprintf(psz, L"%lu", dwCount);
return 0;
}