-
Oct 17th, 2009, 03:21 PM
#1
Thread Starter
Lively Member
Might be simple, Might be hard: Reg_Binary
I'm stuck at the moment gents, and would like to ask for your help.
I have a registry value (reg_binary): B7 59 C4 4A
I know that this value contains a Date and a Time, you guessed it
How to convert?
I'm reading the value like this:
Code:
Dim ActiveSince() As Byte = Nothing
ActiveSince = My.Computer.Registry.LocalMachine.OpenSubKey("Software\MyApp\Version").GetValue("ActiveSince")
I'm not asking a lot of times here as almost everything is to be found when one searches carefully, at the moment I can't find it.
Your help would be appreciated a lot by me.
Kind Regards, Starf0x
-
Oct 17th, 2009, 04:33 PM
#2
Re: Might be simple, Might be hard: Reg_Binary
Have you tried DateTime.TryParse?
-
Oct 17th, 2009, 06:31 PM
#3
Thread Starter
Lively Member
Re: Might be simple, Might be hard: Reg_Binary
Thank you for your response.
The TryParse won't and can't work with a Byte Array.
I just tried on your advise
Starf0x
-
Oct 17th, 2009, 07:10 PM
#4
Re: Might be simple, Might be hard: Reg_Binary
Do you know how this date was written to the registry in the first place? Also, do you know what date it actually represents? Does it represent just a date or is it a date and a time?
I've never tried this before but just had a quick go and not getting very far... All I can do at the moment is return an Integer representation but I dont know if it is even anything like the actual date - I'm assuming it is though because it has 2007 at the end and it seems like too much of a coincidence that it would have a recent year at the end of it..
vb Code:
MessageBox.Show(BitConverter.ToInt32(DATE_BYTE_ARRAY_HERE, 0).ToString)
That gives me 1254382007 which I suppose could represent 12:54 on the 3rd day of the 8th month of 2007 but that is just a big guess at the moment.
The Date type does actually have a method named FromBinary which looks promising but the problem is it only works with a Long value (aka Int64) but when I try and do BitConverter.ToInt64 and pass in your byte array it basically tells me that the array is not long enough. Which is why I am wondering if your date is just a date and not a date and a time... but I dont know.
-
Oct 18th, 2009, 03:54 AM
#5
Thread Starter
Lively Member
Re: Might be simple, Might be hard: Reg_Binary
I can give you some examples;
B7 59 C4 4a = Thu Oct 01 09:26:47 2009
19 EC 9C 4a = Tue Sep 01 11:40:41 2009
4F 55 BE 4A = Sat Sep 26 19:54:23 2009
17 B8 C5 47 = Wed Feb 27 20:20:55 2009
These are actual examples, bit strange layout, but hey I didn't invent this :P
Starf0x
-
Oct 19th, 2009, 02:51 AM
#6
Re: Might be simple, Might be hard: Reg_Binary
How were you able to determine the dates from those values? BTW, Feb. 27, 2009 if Friday. =)
-
Oct 19th, 2009, 02:40 PM
#7
Thread Starter
Lively Member
Re: Might be simple, Might be hard: Reg_Binary
Another program shows those values, and it also reads these values.
Kind Regards, Starf0x
PS, I think that was a typo
-
Oct 19th, 2009, 02:42 PM
#8
Fanatic Member
Re: Might be simple, Might be hard: Reg_Binary
you can't look at the source code of the other program?
Where I'm from we only have one bit of advice for new comers: "If you hear banjos, turn and run".
VS 2008 .NetFW 2.0
-
Oct 19th, 2009, 02:50 PM
#9
Re: Might be simple, Might be hard: Reg_Binary
You need to also consider the fact it could be encrypted data.
-
Oct 19th, 2009, 03:09 PM
#10
Re: Might be simple, Might be hard: Reg_Binary
You need to also consider the fact it could be encrypted data.
Thats a good point - there doesnt seem to be any logical mapping to any .NET date/time type from that hex string.
Do you know if this other program was written in .NET code?
-
Oct 24th, 2009, 12:34 PM
#11
Thread Starter
Lively Member
Re: Might be simple, Might be hard: Reg_Binary
Nah, it is not written in .NET, else I would be able to do this
Seems to be a hard thing to crack?
Kind Regards, Starf0x
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|