Jump to content
Tuts 4 You

[Request] Edit Bytes


GameOver

Recommended Posts

Hi, I'm GameOver and I have just registered to this website (So go easy on me, please :rolleyes: )

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? :help

Visual Basic Version = 10.0.26001.1

.Net Version = 4.3 Beta

Edited by GameOver
Link to comment

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 File
Dim 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 file
btFileDump(442) = 04
btFileDump(443) = 04
btFileDump(444) = 04
btFileDump(445) = 04
btFileDump(446) = 04
btFileDump(447) = 03

Afterward 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()
Link to comment

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.aspx

Whats the error/exception that you are getting?

Edited by atom0s
Link to comment

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?

Link to comment

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.

Link to comment

Urm.. With this bit of code...

btFileDump(442) = 04

btFileDump(443) = 04

btFileDump(444) = 04

btFileDump(445) = 04

btFileDump(446) = 04

How would I change the value from 04 to FF?

When I change it to FF blue lines appear under it.. =|

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...