Posted March 1, 201015 yr 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, 201015 yr by GameOver
March 1, 201015 yr 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()
March 1, 201015 yr Cheers!And will this work with non printable characters?Yes, you are directly editing the bytes.
March 1, 201015 yr Author Urm.. I'm having some problems with the code.. =| It says that the FileStream does not support writing.
March 1, 201015 yr 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, 201015 yr by atom0s
March 2, 201015 yr 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?
March 2, 201015 yr 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.
March 2, 201015 yr Author 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.. =|
March 2, 201015 yr In VB.NET you need to use &H in front of hex values, so for example:FF would be &HFF
March 3, 201015 yr Author In VB.NET you need to use &H in front of hex values, so for example:FF would be &HFFGenius! Cheers =)
Create an account or sign in to comment