Results 1 to 22 of 22

Thread: HEX editing

  1. #1
    craky2ooo
    Guest

    Angry HEX editing

    Hi

    I have a BIG problem....
    I'm working on an hex edit project,
    So, the problem is that I have the adress of the value that
    I want to modifie...this value is an Unsigned Long, when I store the value in a Long type variable
    it give me a Signed Long, but me I want a Unsigned Long!!
    So, in what type of variable I have to store it to have the correct value of an unsigned long?

    Understood?
    no?..
    hum...

    look at this ;

    Hex value = C7 CB4A DB
    When I store this in a Long..
    ea : Dim MyVariable as Long
    MyVariable=&HC7CB4ADB
    Text1.Text = MyVariable

    In the screen, in my text box I see '-615855161', and this value is the Signed Long of the hex value

    Me I need to see the Unsigned Long of the hex value that is '3679112135'

    So, if you understand something and how to resolve this, please help........

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Use C++ instead of VB, or manually convert the number yourself.
    Below is the source to one that I use.
    I didnt write it though.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    First part of source.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Second part of source.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5
    craky2ooo
    Guest

    Unhappy

    Don't have another option????

    Plzzzzzzzzzzzzzzzz

  6. #6
    craky2ooo
    Guest
    um...

    thanx for the help

    but if someone have an other option tell me...

  7. #7
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You can download it from here too :
    http://www.tu-darmstadt.de/~rkibria
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  8. #8
    craky2ooo
    Guest

    Question

    What is this URL for??
    For the binary editor?

  9. #9
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Yeah the official website for the hex editor.
    Its a real good editor. The one I use.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  10. #10
    craky2ooo
    Guest
    I/m using Hex WorkShop...that is really cool too

    With a great file compare option

  11. #11
    craky2ooo
    Guest
    The code you give me is in C or C++ !!
    I'm searching for a Visual Basic Solutions or (or code)

  12. #12
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  13. #13
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Also try this function out:

    VB Code:
    1. Private Sub Command1_Click()
    2. Dim MyVariable
    3. MyVariable = HexToDec("C7CB4ADB")
    4. Debug.Print MyVariable
    5.  
    6. End Sub
    7.  
    8.  
    9. Function HexToDec(ByVal sHex As String) As Variant
    10.  'Nucleus
    11.  Dim ba() As Byte, i&, bitval As Variant, b As Byte
    12.  bitval = 1
    13.  ba = sHex
    14.  For i = UBound(ba) - 1 To 0 Step -2
    15.     b = ba(i)
    16.     If b < 58 Then HexToDec = CDec(HexToDec + (b - 48) * bitval) Else HexToDec = CDec(HexToDec + (b - 55) * bitval)
    17.     bitval = CDec(bitval * 16)
    18.  Next i
    19. End Function

  14. #14
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    BTW when you convert hex C7CB4ADB to decimal the result is: 3351988955 not 3679112135.

  15. #15
    craky2ooo
    Guest

    Smile

    Thanx all

  16. #16
    craky2ooo
    Guest
    heu...
    plendj, do you know where I can find some of these ocx for my 16 bit version of vb 4 ??

  17. #17
    craky2ooo
    Guest

    Angry

    Nucleus..
    I have verify with HexWorkShop, the unsigned long for the hex C7 CB4A DB is 3679112135....

  18. #18
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Originally posted by craky2ooo
    Nucleus..
    I have verify with HexWorkShop, the unsigned long for the hex C7 CB4A DB is 3679112135....
    Well I verified it with the windows calculator and the base 10 value of C7CB4ADB (base 16) does not equal 3679112135.

    Do you mean you want to convert it to a different base?

  19. #19
    craky2ooo
    Guest
    Do you have a hex editor, if so try to convert the signed long value of the hex to his unsigned long....
    you'll see

  20. #20
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    I think its pretty tragic that theres an argument over the decimal value of a number...but just for the record i got the same as Nucleus...and i really doubt that the windows calc. is wrong....but maybe theres a mixup in this signed and unsigned stuff.
    You just proved that sig advertisements work.

  21. #21
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Perhaps it is the unsigned integer that is the cause of the differing results?

    I am sure someone knows the largest integer an unsigned integer can support?

  22. #22
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Code:
    unsigned Integer   0 - 65535
    unsigned Long      0 - 4294967295
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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