Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

X64 crash?

May
12,847
164
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;
}
 
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.
 
Back
Top