1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

X64 crash?

Discussion in 'Plugins' started by vefatica, Jun 6, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    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;
    }
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,730
    Likes Received:
    80
    You're freeing a different pointer than the one Windows gave you.

    Rex Conn
    JP Software
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    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.
     

Share This Page