CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2010
    Posts
    19

    [RESOLVED] Comparision

    I have a database of hexadecimal lists like
    "12 A2 3E BB DC 5E AD C7 00 ?? A2 00 EE ?? C3 55 90"
    there are ??(two question marks) for unknown value

    I have to compare the lists in database with a list of actual hex values read from an executable file. There are no question marks in these hex values read, instead there is an hex value

    I am trying to find the efficient way to compare these two lists.

    One way I thought of is to make binary search trees of the two lists but the problem with this solution is how do I treat "??" in the first list.

    or help me with another "efficient" way.

    Any help is appreciated.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Comparision

    Quote Originally Posted by aquarianutsav View Post
    I have a database of hexadecimal lists like
    "12 A2 3E BB DC 5E AD C7 00 ?? A2 00 EE ?? C3 55 90"
    there are ??(two question marks) for unknown value
    What is a data type of this field in the database?
    Where do you "see" this double-question-mark?
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2010
    Posts
    19

    Re: Comparision

    with database i meant ini file.

    that ini file has more than 5000 sections and in each section there is this list which is the value of key "signature"

    i have to compare this signature with the signature ot the exe file and find the type of exe file.

  4. #4
    Join Date
    Dec 2010
    Posts
    19

    Re: Comparision

    for example :

    [!EP (ExE Pack) V1.0 -> Elite Coding Group]
    signature = 60 68 54 ?? ?? ?? B8 48 ?? ?? ?? FF
    ep_only = true

    [Nullsoft Install System v1.98]
    signature = 83 EC 0C 53 56 57 FF 15 2C 81 40
    ep_only = true


    [Nullsoft Install System v1.xx]
    signature = 50 53 51 52 1E 06 9C B8 21 35 CD 21 53 BB ?? ?? 26 ?? ?? 49 48 5B
    ep_only = true

    [Zortech C]
    signature = E8 ?? ?? 2E FF ?? ?? ?? FC 06
    ep_only = true

  5. #5
    Join Date
    Apr 2008
    Posts
    725

    Re: Comparision

    make a regex for each type. map from the regex/type onto all the read values that match the regex.

    60 60 54 [0-9a-fA-F]{2} [0-9a-fA-F]{2} [0-9a-fA-F]{2} b8 48 ...

  6. #6
    Join Date
    Dec 2010
    Posts
    19

    Re: Comparision

    The time taken in reading the values of keys of around 5500 sections is 16 seconds and it takes only a second to make 5500 maps from the values read.

    How do I reduce the time taken to read the file?

  7. #7
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Comparision

    How are you reading it now?

  8. #8
    Join Date
    Dec 2010
    Posts
    19

    Re: Comparision

    previously I was reading it using GetPrivateProfileString and GetPrivateProfileSectionNames.
    Now I am using 'fread' and it has solved the purpose.
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured