flat assembler
Message board for the users of flat assembler.

Index > Windows > Edit existing file Windows

Author
Thread Post new topic Reply to topic
donn



Joined: 05 Mar 2010
Posts: 321
donn 07 Jun 2016, 22:02
Hi,

This may be the wrong topic for this question, but I'm looking for advice/best practices for editing existing files in Windows.

Let's say we have a very large file and you just need to remove the 20th byte in the file. I understand if there are bytes at the end, you can truncate it, but the beginning seems trickier. In the meantime, I'm going the rewrite route.

For less complicated, maybe smaller files, and depending on the needs, it may be advantageous to save parts of the file as separate files and just update each one. But what about much larger files and the case where there is only one file being edited? Rewriting the entire file seems like it would take a huge performance hit for a small removal.


Thanks a lot
Post 07 Jun 2016, 22:02
View user's profile Send private message Reply with quote
Grom PE



Joined: 13 Mar 2008
Posts: 114
Location: i@grompe.org.ru
Grom PE 07 Jun 2016, 23:20
There's no way around rewriting the rest of the file.
File formats are usually designed in a way that such cutting doesn't happen often.
Post 07 Jun 2016, 23:20
View user's profile Send private message Visit poster's website Reply with quote
donn



Joined: 05 Mar 2010
Posts: 321
donn 08 Jun 2016, 00:06
That's too bad, but it makes sense if sequential addressing would become disjointed with gaps in the file.

Appreciated. Will need to research this more, but at least this allows us to get creative and come up with our own solutions.
Post 08 Jun 2016, 00:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20338
Location: In your JS exploiting you and your system
revolution 08 Jun 2016, 05:13
If the file is a simple linear format, like a text file, then your only option in all officially supported Windows file systems is to rewrite the entire remainder of the file.

But if the file is more structured, like exe or dll files, then in many cases you will only need to rewrite the affected section.
Post 08 Jun 2016, 05:13
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.