Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

storing data in a new pe section

Featured Replies

Posted

as the title says, i am creating a new section and storing data in it, i would like to know the best way to store a large amount of data and read it back, perfer delphi, but any lang would be good. :wub:

In my opinion, the best way of storing a huge amount of data is doing it on disk. The performance of your target gets slower when you use memory space to store it, especially when you are manging huge amount of data, as you stated.

Then, if you want to read data of the new section for being managed by your tool, the fastest way (for a good performance) is to choose not loading very large blocks in memory. I usually load blocks of 0x10000.

And talking about language, this is my way, there could be of course a lot of better ways...

type
bufType : array of Byte;procedure DumpingData (var buf : bufType; FileName : AnsiString; offset : Integer);
var
dump : TFileStream;begin
try
dump := TFileStream.Create (FileName,fmCreate);
dump.Seek (offset,soFromBeginning);
dump.Write (buf[0],Length(buf));
finally
dump.Free;
end;
end;

So, FileName should contain the entire path to your file, and buf should contain your wanted data to be stored. There could be done lots of previous checks, to be sure the file is accessible, the buffer is not empty, and so on...

To retrieve the data from disk, just change fmCreate by fmOpenRead and dump.Write by dump.Read...

Is this answering your question?

Cheers

Nacho_dj

  • Author

for instance if i wanted to save a group of settings, strings,integers etc inside a new pe section, what would the best way to write it be?

type
TSettings =record
setting1:string;
setting2:integer;
end;var
set : TSettings;
begin
set.setting1 := 'hello world';
set.setting2 := 20;
end;

say i wanted to write the simple data above into my new section. since i dont know the size of my record or my string snce the string is varialbe.? i was thinking about storing a dll or plugins in size a new section, just playing with ides atm. cheers.

Edited by StreamLine

You can define the length of string allocated, that way you know the size of the record.

e.g

TSettings =record
setting1: string[60];
setting2: integer;
end;

whats the point in that unless its a "packed" record?

  • Author

defining the length of the string wont help since im not sure what it will be, if i define it at 255, it wastes space or doesnt hold enough space, i cant tell how big the string will be,

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.