Read the content of the string intern pool

前端 未结 2 1012
情书的邮戳
情书的邮戳 2021-01-05 12:53

I would like to enumerate the strings that are in the string intern pool.

That is to say, I want to get the list of all the instances s

2条回答
  •  梦谈多话
    2021-01-05 13:16

    The SSCLI function that its pointing to is

    STRINGREF*AppDomainStringLiteralMap::GetStringLiteral(EEStringData *pStringData) 
    { 
        ... 
        DWORD dwHash = m_StringToEntryHashTable->GetHash(pStringData);
        if (m_StringToEntryHashTable->GetValue(pStringData, &Data, dwHash))
        {
            STRINGREF *pStrObj = NULL;
            pStrObj = ((StringLiteralEntry*)Data)->GetStringObject();
            _ASSERTE(!bAddIfNotFound || pStrObj);
            return pStrObj;
        }
        else { ... }
    
        return NULL; //Here, if this returns, the string is not interned
    }
    

    If you manage to find the native address of m_StringToEntryHashTable, you can enumerate the strings that exist.

提交回复
热议问题