GameOver Posted March 1, 2010 Posted March 1, 2010 (edited) Hi, I'm GameOver and I have just registered to this website (So go easy on me, please ) I am currently developing a patching application for some software.. I know the bytes that I need to change in order to turn the program from a trial into the full version. Basically I need some VB code (or help me write some VB code) that changes the hex from 00 01 02 03 04 FF to 04 04 04 04 04 03 Any help? Visual Basic Version = 10.0.26001.1 .Net Version = 4.3 Beta Edited March 1, 2010 by GameOver
atom0s Posted March 1, 2010 Posted March 1, 2010 You can use various framework methods to read and alter files. Such as FileStream to read the file into a byte array like this:(I converted this from C# so sorry if it's not 100% exact for VB.NET):' Open, Read, Dump, and Close FileDim fStream As New FileStream(strFilePath, FileMode.Open, FileAccess.Read)Dim btFileDump As Byte() = New Byte(fStream.Length - 1) {}fStream.Read(btFileDump, 0, CInt(fStream.Length))fStream.Close()fStream.Dispose()You can then alter the bytes easily at the offset using stuff such as:' Alter some data in the filebtFileDump(442) = 04btFileDump(443) = 04btFileDump(444) = 04btFileDump(445) = 04btFileDump(446) = 04btFileDump(447) = 03Afterward you can save the file using:'Save file to disk.Dim fStream = new File.Create(strFilePath)fStream.Write(btFileDump, 0, btFileDump.Length);fStream.Close()fStream.Dispose()
GameOver Posted March 1, 2010 Author Posted March 1, 2010 Cheers!And will this work with non printable characters?
atom0s Posted March 1, 2010 Posted March 1, 2010 Cheers!And will this work with non printable characters?Yes, you are directly editing the bytes.
GameOver Posted March 1, 2010 Author Posted March 1, 2010 Urm.. I'm having some problems with the code.. =| It says that the FileStream does not support writing.
atom0s Posted March 1, 2010 Posted March 1, 2010 (edited) Urm.. I'm having some problems with the code.. =| It says that the FileStream does not support writing.Odd, I've used it personally in some of my projects. I code in C# though rather then VB.NET when I'm using a manged language. But the code is basically the same. Check out this page on MSDN and see if you or I overlooked something. I converted what I posted from C# so I might have missed something VB.NET needs./>http://msdn.microsoft.com/en-us/library/system.io.filestream.aspxWhats the error/exception that you are getting? Edited March 2, 2010 by atom0s
ghandi Posted March 2, 2010 Posted March 2, 2010 I code in C# though rather then VB.NET when I'm using a native language.Native? That's confusing because i was under the impression that C# & VB.NET were managed code... Did you mean managed atom0s or am i not getting your meaning?
atom0s Posted March 2, 2010 Posted March 2, 2010 Native? That's confusing because i was under the impression that C# & VB.NET were managed code... Did you mean managed atom0s or am i not getting your meaning?Whoops yea meant managed lol.
GameOver Posted March 2, 2010 Author Posted March 2, 2010 Urm.. With this bit of code...btFileDump(442) = 04btFileDump(443) = 04btFileDump(444) = 04btFileDump(445) = 04btFileDump(446) = 04How would I change the value from 04 to FF?When I change it to FF blue lines appear under it.. =|
atom0s Posted March 2, 2010 Posted March 2, 2010 In VB.NET you need to use &H in front of hex values, so for example:FF would be &HFF
GameOver Posted March 3, 2010 Author Posted March 3, 2010 In VB.NET you need to use &H in front of hex values, so for example:FF would be &HFFGenius! Cheers =)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now