Reading strings from WDB cache files. menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading strings from WDB cache files.

    Hi, I've been working some on a WDB reader lately I can't seem to figure how they compute the length, sometimes it's the first byte before the string but often it's packed in some weird way.
    I remember pre mop they were just stored as normal null terminated strings, anyone who has done this before that could shed some light on this?

    It's used like this in DbQuestCache_Unpack and many other places.


    PHP Code:

      LOWORD
    (a2a) = 0x800;
      
    v6 CDataStore::GetStrLen((CDataStore *)&v9, (int)store);
      
    v7 v6;
      *(
    _DWORD *)(this 0x14) = v6;
      
    result CDataStore::GetCString_2(v3, (void *)(this 0x14), v6);

      
    thisa v3;
      
    LOWORD(v14) = 0x800;
      
    v10 CDataStore::GetStrLen((CDataStore *)&thisaa3);
      *(
    _DWORD *)(v4 96) = v10 CDataStore_sub_65BD22((CDataStore *)&thisa);// Set length for Name
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 608) = sub_67B804((CDataStore *)&thisaa3);// Set length for ObjectiveText
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 3608) = sub_67B804((CDataStore *)&thisaa3);// Set length for Description
      
    LOBYTE(a3) = 0;
      
    v11 CDataStore::GetStrLen((CDataStore *)&thisaa3);
      *(
    _DWORD *)(v4 6608) = v11 CDataStore_sub_65BD22((CDataStore *)&thisa);// Set length for EndText
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 7148) = sub_6816AA((CDataStore *)&thisaa3);// Set length for PortraitGiverText
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 8172) = CDataStore::GetStrLen((CDataStore *)&thisaa3);// Set length for PortraitGiverName
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 8428) = sub_6816AA((CDataStore *)&thisaa3);// Set length for PortraitTurnInDescription
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 9452) = CDataStore::GetStrLen((CDataStore *)&thisaa3);// Set length for PortraitTurnInName
      
    LOBYTE(a3) = 0;
      *(
    _DWORD *)(v4 9708) = sub_661CEC((CDataStore *)&thisaa3);// Set length for CompletionText 
    All related subs

    PHP Code:
    unsigned int __thiscall sub_67B804(CDataStore *thisint _18)
    {
      
    int v2// ebx@1
      
    unsigned int v3// eax@1
      
    int a2// [sp+Ch] [bp-4h]@0

      
    LOBYTE(a2) = 0;
      
    v2 = (int)this;
      
    v3 CDataStore::GetStrLen(thisa2);
      
    LOBYTE(a2) = 0;
      return 
    16 v3 CDataStore::GetLoByte(v2a2);
    }

    int __thiscall sub_661CEC(CDataStore *thisint _18)
    {
      
    unsigned int v2// eax@1
      
    int a2// [sp+Ch] [bp-4h]@0

      
    LOBYTE(a2) = 0;
      
    v2 CDataStore::GetStrLen(thisa2);
      
    LOBYTE(a2) = 0;
      return 
    v2 sub_65BB09(a2);
    }

    unsigned int __thiscall CDataStore::GetStrLen(CDataStore *thisint a2)
    {
      
    char v3// cl@1
      
    unsigned int result// eax@2
      
    unsigned int v5// esi@3
      
    unsigned __int8 v6// [sp+7h] [bp-1h]@1

      
    v3 BYTE1(this->m_data);
      
    v6 0;
      if ( 
    v3 == )
      {
        
    CDataStore::GetInt8((CDataStore *)&v6);
        
    result v6;
      }
      else
      {
        
    v5 = (unsigned int)LOBYTE(this->m_data) >> v3;
        
    CDataStore::GetInt8((CDataStore *)&v6);
        
    result = (v5 << BYTE1(this->m_data)) | ((unsigned int)v6 >> (BYTE1(this->m_data)));
        
    LOBYTE(this->m_data) = v6 << BYTE1(this->m_data);
      }
      return 
    result;
    }

    unsigned int __thiscall CDataStore::GetLoByte(CDataStore *thisint a2)
    {
      
    CDataStore *v2// esi@1
      
    unsigned __int8 v3// cl@1
      
    unsigned __int8 v4// dl@2
      
    unsigned int result// eax@2
      
    unsigned int v6// edi@5
      
    unsigned __int8 v7// bl@5
      
    char v8// dl@5
      
    unsigned int v9// eax@5
      
    char v10// cl@5
      
    unsigned __int8 v11// [sp+7h] [bp-1h]@3

      
    v2 this;
      
    v3 BYTE1(this->m_data);
      if ( 
    v3 4u )
      {
        
    v11 0;
        if ( 
    v3 == )
        {
          
    CDataStore::GetInt8((CDataStore *)&v11);
          
    result = (unsigned int)v11 >> 4;
          
    LOBYTE(v2->m_data) = 16 v11;
          
    BYTE1(v2->m_data) = 4;
        }
        else
        {
          
    v6 = (unsigned int)LOBYTE(v2->m_data) >> v3;
          
    CDataStore::GetInt8((CDataStore *)&v11);
          
    v7 v11;
          
    v8 BYTE1(v2->m_data) - 4;
          
    v9 = (unsigned int)v11 >> (v8);
          
    v10 BYTE1(v2->m_data) - 4;
          
    BYTE1(v2->m_data) = v8;
          
    result = (v6 << v10) | v9;
          
    LOBYTE(v2->m_data) = v7 << v10;
        }
      }
      else
      {
        
    v4 LOBYTE(v2->m_data);
        
    result = (unsigned int)v4 >> 4;
        
    LOBYTE(v2->m_data) = 16 v4;
        
    BYTE1(v2->m_data) = v3 4;
      }
      return 
    result;
    }

    unsigned int __thiscall CDataStore_sub_65BD22(CDataStore *this)
    {
      
    CDataStore *v1// esi@1
      
    unsigned __int8 v2// cl@3
      
    unsigned int result// eax@3
      
    char v4// [sp+7h] [bp-1h]@2

      
    v1 this;
      if ( 
    BYTE1(this->m_data) == )
      {
        
    v4 0;
        
    CDataStore::GetInt8((CDataStore *)&v4);
        
    LOBYTE(v1->m_data) = v4;
        
    BYTE1(v1->m_data) = 0;
      }
      
    v2 LOBYTE(v1->m_data);
      
    result = (unsigned int)v2 >> 7;
      ++
    BYTE1(v1->m_data);
      
    LOBYTE(v1->m_data) = v2;
      return 
    result;
    }

    unsigned int __thiscall CDataStore_sub_65BB09(CDataStore *thisint a2)
    {
      
    CDataStore *v2// esi@1
      
    unsigned __int8 v3// cl@1
      
    unsigned __int8 v4// dl@2
      
    unsigned int result// eax@2
      
    unsigned int v6// edi@5
      
    unsigned __int8 v7// bl@5
      
    char v8// dl@5
      
    unsigned int v9// eax@5
      
    char v10// cl@5
      
    unsigned __int8 v11// [sp+7h] [bp-1h]@3

      
    v2 this;
      
    v3 BYTE1(this->m_data);
      if ( 
    v3 5u )
      {
        
    v11 0;
        if ( 
    v3 == )
        {
          
    CDataStore::GetInt8((CDataStore *)&v11);
          
    result = (unsigned int)v11 >> 5;
          
    LOBYTE(v2->m_data) = v11;
          
    BYTE1(v2->m_data) = 3;
        }
        else
        {
          
    v6 = (unsigned int)LOBYTE(v2->m_data) >> v3;
          
    CDataStore::GetInt8((CDataStore *)&v11);
          
    v7 v11;
          
    v8 BYTE1(v2->m_data) - 5;
          
    v9 = (unsigned int)v11 >> (v8);
          
    v10 BYTE1(v2->m_data) - 5;
          
    BYTE1(v2->m_data) = v8;
          
    result = (v6 << v10) | v9;
          
    LOBYTE(v2->m_data) = v7 << v10;
        }
      }
      else
      {
        
    v4 LOBYTE(v2->m_data);
        
    result = (unsigned int)v4 >> 5;
        
    LOBYTE(v2->m_data) = v4;
        
    BYTE1(v2->m_data) = v3 3;
      }
      return 
    result;


    Reading strings from WDB cache files.
  2. #2
    doityourself's Avatar ★ Elder ★
    Reputation
    1424
    Join Date
    Nov 2008
    Posts
    843
    Thanks G/R
    35/448
    Trade Feedback
    0 (0%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    These things are just for reading the packet which is sent by the server. not reading the .wdb file.
    reading wdb files is still the same thing...

  3. #3
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by king48488 View Post
    These things are just for reading the packet which is sent by the server. not reading the .wdb file.
    reading wdb files is still the same thing...
    Lol, they use the cdatastore functions for reading the bytes from the cache file when wow loads them from disk at startup -_-

  4. #4
    doityourself's Avatar ★ Elder ★
    Reputation
    1424
    Join Date
    Nov 2008
    Posts
    843
    Thanks G/R
    35/448
    Trade Feedback
    0 (0%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    and the namelength is read/written with the bitstream shit.

    Your CDataStore::GetStrLen = BitUnpack::GetBitCT8
    0x67B804 = BitUnpack::GetBitCT12
    0x661CEC = BitUnpack::GetBitCT11
    0x65BD22 = BitUnpack::GetBit
    Your CDataStore::GetLoByte = BitUnpack::GetBitCT4
    0x65BB09 = BitUnpack::GetBitCT3
    0x6816AA = BitUnpack::GetBitCT10

  5. #5
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by king48488 View Post
    and the namelength is read/written with the bitstream shit.

    Your CDataStore::GetStrLen = BitUnpack::GetBitCT8
    0x67B804 = BitUnpack::GetBitCT12
    0x661CEC = BitUnpack::GetBitCT11
    0x65BD22 = BitUnpack::GetBit
    Your CDataStore::GetLoByte = BitUnpack::GetBitCT4
    0x65BB09 = BitUnpack::GetBitCT3
    0x6816AA = BitUnpack::GetBitCT10
    Ok, thanks.

Similar Threads

  1. Accessing WDB cache files (QuestCache.wdb)
    By Frosttall in forum WoW Memory Editing
    Replies: 3
    Last Post: 12-25-2012, 09:43 PM
  2. Reading multiple strings from another file?
    By Ryoushi. in forum Programming
    Replies: 0
    Last Post: 06-08-2009, 12:08 PM
  3. [Help] vb6 Reading from a random file
    By Murdok in forum Programming
    Replies: 3
    Last Post: 10-20-2008, 12:39 PM
  4. [Guide][VB.NET] Read a string from memory
    By Gothian in forum Programming
    Replies: 14
    Last Post: 08-18-2008, 04:39 PM
  5. [Guide][VB.NET] Reading a String From Memory
    By Gothian in forum WoW Memory Editing
    Replies: 14
    Last Post: 01-18-2008, 12:08 PM
All times are GMT -5. The time now is 01:02 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search