X64 crash?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
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;
}
 
#3
On Mon, 06 Jun 2011 14:36:10 -0400, you wrote:

|You're freeing a different pointer than the one Windows gave you.
|
|Rex Conn
|JP Software

Thanks. I'm embarrassed.