[C++]Where can I find a simple FindPattern in c++ ? menu

Shout-Out

User Tag List

Results 1 to 14 of 14
  1. #1
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++]Where can I find a simple FindPattern in c++ ?

    Hi.
    First of all, don't forget that i'm a french, so i'll do some mistakes
    I am looking for a simple FindPattern function in C++. I already searhed everywhere, and i didn't found anything. So if someone has got this function ...

    Thank you !
    Bye

    [C++]Where can I find a simple FindPattern in c++ ?
  2. #2
    qjlex's Avatar Member
    Reputation
    1
    Join Date
    Oct 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CopyPast from WoWX
    Header File
    Code:
    #pragma once
    
    extern unsigned long dwStartAddress, dwLen;
    
    bool bDataCompare( const unsigned char* pData, const unsigned char* bMask, const char* szMask );
    unsigned long dwFindPattern( unsigned char *bMask,char * szMask, unsigned long dw_Address = dwStartAddress, unsigned long dw_Len = dwLen );
    Code File
    Code:
    // Credits: Dominik, Patrick
    
    unsigned long dwStartAddress = 0x00401000, dwLen = 0x00861FFF;
    
    bool bDataCompare(const unsigned char* pData, const unsigned char* bMask, const char* szMask)
    {
        for(;*szMask;++szMask,++pData,++bMask)
            if(*szMask=='x' && *pData!=*bMask )
                return false;
        return (*szMask) == 0;
    }
    
    unsigned long dwFindPattern( unsigned char *bMask,char * szMask, unsigned long dw_Address = dwStartAddress, unsigned long dw_Len = dwLen )
    {
        for(unsigned long i=0; i < dw_Len; i++)
    		if( bDataCompare( (unsigned char*)( dw_Address+i ),bMask,szMask) )
                return (unsigned long)(dw_Address+i);
        return 0;
    }

  3. #3
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already try this code ... But it doesn't work. I'll try again tomorrow.
    See you !

  4. #4
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Searching 'string' with 'mask' from A to B would be basic enough and faster to write it yourself.

  5. #5
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is my code :
    Code:
    int ThreadLocalStorage = dwFindPattern("xxxxxx????xxx????xxxxx????xx????","\xEB\x02\x33\xC0\x8B\xD\x00\x00\x00\x00\x64\x8B\x15\x00\x00\x00\x00\x8B\x34\x8A\x8B\xD\x00\x00\x00\x00\x89\x81\x00\x00\x00\x00");
        int CConnection = Memory.ReadInteger(Memory.ReadInteger(ThreadLocalStorage + 0x16));
        int CConnectionOffset = Memory.ReadInteger(ThreadLocalStorage + 0x1C);
        int CurrentManager = Memory.ReadInteger(CConnection + CConnectionOffset);
    
        int LocalGUID = Memory.ReadInteger(CurrentManager + ObjectManager::LocalGUID);
    
        int currentObject = Memory.ReadInteger(CurrentManager + ObjectManager::FirstObject);
        while (currentObject != 0 && currentObject % 2 == 0)
        {
            if (Memory.GetTargetGUID() == WowObjectFields::OBJECT_FIELD_GUID)
                    std::cout << Memory.ReadInteger(currentObject + WowUnitFields::UNIT_FIELD_HEALTH);
    
            currentObject = Memory.ReadInteger(currentObject + ObjectManager::NextObject);
        }
    And this code doesn't work ^^ To write this function myself, i have to know how it works ...
    Thanks you !

  6. #6
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I read:
    Code:
    unsigned long dwFindPattern(unsigned char* bMask, char* szMask);
    What you did:
    Code:
    int dwFindPattern(char* szMask, unsigned char* bMask);
    You should try to understand what you copy, or it won't help you.

    PS: You are asking for C++ code but you use C#?
    Last edited by eLaps; 05-09-2010 at 06:00 AM.

  7. #7
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your answer ! No, i'm using C++. I had try with your code, but it's the same result ^^ I realy don't see where is the problem ...

  8. #8
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used an external dll ( blackrain ) to find "threadlocalstorage". Now, my code is
    Code:
       MemoryRead Memory;
        long ThreadLocalStorage = 8457509;
        
        int CConnection = Memory.ReadInteger(Memory.ReadInteger(ThreadLocalStorage + 0x16));
        int CConnectionOffset = Memory.ReadInteger(ThreadLocalStorage + 0x1C);
        int CurrentManager = Memory.ReadInteger(CConnection + CConnectionOffset);
    
        int LocalGUID = Memory.ReadInteger(CurrentManager + ObjectManager::LocalGUID);
    
        int currentObject = Memory.ReadInteger(CurrentManager + ObjectManager::FirstObject);
    
        int PlayerAdress;
        while (currentObject != 0 && currentObject % 2 == 0)
        {
            int type = Memory.ReadInteger(currentObject + 0x14);
    
            if(type == WowObjectType: LAYER)
             std::cout << Memory.ReadInteger(currentObject + 0x36)<<std::endl;
    
            currentObject = Memory.ReadInteger(currentObject + ObjectManager::NextObject);
        }
    But this code still doesn't work. This code should return player's level.
    Last edited by guillaume76290; 05-09-2010 at 10:05 AM.

  9. #9
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you refer to addresses, you really should at least use unsigned int or DWORD instead of int or long as you did for the TLS address.
    Even if you probably won't access anything beyond user memory, negative addresses don't make any sense to me.
    Additionally, a GUID in wow is nothing but an unsigned __int64.
    And even if I assume that WowObjectType: LAYER should read WowObjectType::PLAYER, at BaseAddress + 0x36 you will find all but the player's level.
    Read about how to read the descriptor fields ...
    If you copy & paste code (or copy from C#, paste & mess code), you at least have to understand it.

  10. #10
    WannaBeProgrammer's Avatar Member
    Reputation
    2
    Join Date
    Feb 2009
    Posts
    156
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dosent Chyper´s lib inculde this?

  11. #11
    nopz's Avatar Active Member
    Reputation
    67
    Join Date
    Aug 2009
    Posts
    56
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you are using BlackRain :
    ( ripped from BlackRain.Common.Objects )

    Code:
    protected T GetStorageField<T>(uint field) where T : struct
    {
      field = field *4; // He's anal.
      var m_pStorage = ObjectManager.Memory.ReadUInt(BaseAddress + 0x08);
    
      return (T)ObjectManager.Memory.ReadObject(m_pStorage + field, typeof(T));
    }
    ( ripped from BlackRain WowObjects )
    Code:
    public int Level
    {
      get { return GetStorageField<int>((uint)Offsets.WowUnitFields.UNIT_FIELD_LEVEL); } // 0x36
    }
    So What you should do instead of :
    Code:
    std::cout << Memory.ReadInteger(currentObject + (0x36))<<std::endl;
    is :
    Code:
    int storage = Memory.ReadUInt(currentObject + 0x08);
    std::cout << Memory.ReadInt(storage + 0x36 * 4) <<std::endl;
    Something like that.
    When you read from Descriptors you have to add the descriptor offset and * 4 the field offset you want.

    I hope it will help you.
    BTW : join the group xD : French developers - MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides
    Last edited by nopz; 05-10-2010 at 06:30 AM.
    My blog: https://pimpmykitty.wordpress.com
    PyFasm: https://github.com/srounet/pyfasm
    Pymem: https://github.com/srounet/pymem

  12. #12
    GliderPro's Avatar Member
    Reputation
    -1
    Join Date
    Mar 2009
    Posts
    93
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by WannaBeProgrammer View Post
    Dosent Chyper´s lib inculde this?
    Yes. HadesMem includes pattern searching functions.

  13. #13
    guillaume76290's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Solved][C++]Where can I find a simple FindPattern in C++ ?

    Thanks for your answer ! It works, but i used a different way ^^
    Bye !

  14. #14
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not c++, but you can view my implementation in Obj-C, VERY similar: OffsetController.m - pocketgnome - Project Hosting on Google Code

    check out findPattern
    https://tanaris4.com

Similar Threads

  1. Where can I find the display ids of things that don't have object ids?
    By PiePirate in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 12-19-2007, 08:14 AM
  2. Where can I buy a simple 100g?
    By Mike3667 in forum World of Warcraft General
    Replies: 6
    Last Post: 11-05-2007, 09:01 PM
  3. Where can I find Channel_49's vendors?
    By coolkid1 in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 11-05-2007, 04:44 PM
  4. Where can I find a cracked IDA Pro
    By vivec45 in forum World of Warcraft General
    Replies: 2
    Last Post: 08-16-2007, 01:57 AM
  5. Where can i find some games?
    By botter9 in forum Gaming Chat
    Replies: 4
    Last Post: 03-25-2007, 01:14 PM
All times are GMT -5. The time now is 05:38 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