1,105,332 Community Members

[mASM] CreateFile, ReadFile, WriteFile, FileSplit, and HANDLES

Member Avatar
scriptkiddy
Newbie Poster
19 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, how is this done in assembly?

ofstream writer("settings.ini");
writer << "launch: 1"

ifstream reader("settings.ini")
char buffer[MAX_PATH];
reader.getline(buffer, MAX_PATH);

HANDLE hFile = CreateFileA(StubPath,GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);

memset(&overL, 0, sizeof(overL));
    overL.Offset = 0xffffffff; //end of file
    overL.OffsetHigh = -1;

    WriteFile(hFile, Settings, strlen(Settings), &dwBytesWritten, &overL);
    CloseHandle(hFile);

How would I split a string in assembly?

I am coding in mASM from C++, and I have discovered that some of my favourite functions are not the same as they are in assembly!

Basically, in my program, I am trying to create an ini file that I can read and write off of, and some other things that I always put in my programs. WriteFile is important to me too, so that I can write data at the end of my file, so it can be fetched by the user.

OR

I am trying to write data at the end of my program so that my file can fetch that data, and use that data as its settings, instead of reading an ini file.

Member Avatar
NotNull
Posting Whiz in Training
211 posts since Oct 2008
Reputation Points: 23 [?]
Q&As Helped to Solve: 21 [?]
Skill Endorsements: 0 [?]
 
0
 

There is no standard library for assembly language,
of course implementation of the aforementioned routines
are done on the bare metal.
You may want to fetch yourself a good old book on
assembly language, there are plenty of them out there.
In assembly language it is qwite easy to have data at
the end of your program such as initialization data
, you could simply declare the data there or add it in with
a hex editor, I don't know if there would be any complications
in an .EXE or Windows program, but that's why we have
debuggers.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article