Basic Black Magic findPattern() question menu

Shout-Out

User Tag List

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

    Basic Black Magic findPattern() question

    Hello. I've just downloaded black magic and i am trying to read window calculator's window title (that is on my computer called "Calculadora").

    so, from what i've understood,

    Code:
    string pattern = "43 61 6C 63 75 6C 61 64 6F 72 61"; //"Calculadora" in hex
    string mask = "xxxxxxxxxx"; // 11 x's -> as many as there are chars in "Calculadora"
    
    BlackMagic memread = new BlackMagic();
    if (memread.OpenProcessAndThread(SProcess.GetProcessFromProcessName("calc")))
    {
    uint dwCodeLoc = memread.FindPattern(pattern, mask);
    Console.WriteLine(dwCodeLoc);
    Console.WriteLine(memread.ReadUnicodeString(dwCodeLoc, 40));
    so what I get is always something like "MZ". I've tried ReadASCIIString too and the same thing happens(though the text is kinda dif, but trash the same way). This must be really simple, what might I be doing wrong?

    Thanks!

    Basic Black Magic findPattern() question
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    x in the mask means 'anything'. Also, I suggest you use something a bit different to test your patterns with.

    Code:
                foreach (var p in System.Diagnostics.Process.GetProcesses())
                {
                    if (p.MainWindowTitle == "Calculadora")
                        return p;
                }

  3. #3
    devouredelysium's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi. Thanks for the reply! Are you sure? From what I've read on the help file I think the ? is what makes it mean 'anything'. Or am I wrong? What should I put in the mask instead of x, then?

    In the help file it states:

    szMask (String)
    A string of 'x' (match), '!' (not-match), or '?' (wildcard).
    Last edited by devouredelysium; 06-07-2009 at 11:48 AM.

  4. #4
    devouredelysium's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK. I think it's how I put it. The x is right. But what was wrong was that the hex codes I've put were in ascii when they really should be in unicode.

    But i still can't get my data and now I know why. I've looked that value in MHS and it is giving me the following address: 0x0046DEB0. Problem is that my black magic is saying my main module only goes from 0x320000 to 0x34E000. What may the problem? Usually when you search in MHS it will search for well over 0x400000 to 0x7FFF0000, which is really a much bigger range that main module seems to be. I've already searched in all other modules too and they seem to be in a totaly different range(0x75A50000)

  5. #5
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do not specify a range in which you want it to search, the class will automatically only search through the text segment of the main module. You want to call this method, in which you provide the address to start and the number of bytes to scan: public uint FindPattern(uint dwStart, int nSize, string szPattern, string szMask).

Similar Threads

  1. Replies: 2
    Last Post: 10-01-2015, 04:06 AM
  2. C# Question (Black Magic)
    By petergm in forum Programming
    Replies: 3
    Last Post: 06-11-2012, 02:17 PM
All times are GMT -5. The time now is 12:12 AM. 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