flat assembler
Message board for the users of flat assembler.

Index > Main > Rewrite from C++ to FASM

Author
Thread Post new topic Reply to topic
Snejk47



Joined: 04 Aug 2011
Posts: 2
Snejk47 04 Aug 2011, 14:47
Hi all, I'm new here Smile

I have C++ source file (SDK header) and i wanna convert it to FASM.
C++ file and what i now have done. I wanna rewrite all but i don't know how to convert for example this:
Code:
struct TPluginInfo
{
     int cbSize;
 wchar_t* ShortName;
 int Version;
        wchar_t* Description;
       wchar_t* Author;
    wchar_t* AuthorMail;
        wchar_t* Copyright;
 wchar_t* Homepage;
  char Flag;      
    int ReplaceDefaultModule;
};    


How can I check what I have to insert instead of an "int" or "unsigned int" or "wchar_t *"?

Snejk.
Post 04 Aug 2011, 14:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4333
Location: Now
edfed 04 Aug 2011, 15:54
only char flag is a byte value inside the struct

all others, like wchar_t* ShortName are just pointers to char strings containing the name in ascii.

i note that you omited to end the file names by a 0 bytes.
you should end all individual file names with a null char other wize, you will have problems to exploit them.

int can be 16 or 32 bits
depend on the application you want to do.
Post 04 Aug 2011, 15:54
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1620
Location: Toronto, Canada
AsmGuru62 04 Aug 2011, 17:22
Also, different structure packing options in C++ may cause a misalignment of last field in a structure in FASM.
Post 04 Aug 2011, 17:22
View user's profile Send private message Send e-mail Reply with quote
addes3



Joined: 09 May 2011
Posts: 29
addes3 04 Aug 2011, 22:08
You should change the DB's to EQU's.

And the L"" are wide (unicode) strings, so just wrapping them in single quotes may not work.
Post 04 Aug 2011, 22:08
View user's profile Send private message Reply with quote
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 06 Aug 2011, 02:28
The FASM equivelent would look something like this
Code:
struct TPluginInfo
    cbSize               dd ?
    ShortName            dd ?
    Version              dd ?
    Description          dd ?
    Author               dd ?
    AuthorMail           dd ?
    Copyright            dd ?
    Homepage             dd ?
    Flag                 dd ? ; assumes that char is padded to dword alignment
    ReplaceDefaultModule dd ? 
ends
    
Post 06 Aug 2011, 02:28
View user's profile Send private message Reply with quote
addes3



Joined: 09 May 2011
Posts: 29
addes3 12 Aug 2011, 20:45
Post 12 Aug 2011, 20:45
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 12 Aug 2011, 23:02
rain_storm
maybe this would be better ?
Code:
struct TPluginInfo 
    .cbSize               dd ? 
    .ShortName            dd ? 
    .Version              dd ? 
    .Description          dd ? 
    .Author               dd ? 
    .AuthorMail           dd ? 
    .Copyright            dd ? 
    .Homepage             dd ? 
    .Flag                 dd ? ; assumes that char is padded to dword alignment 
    .ReplaceDefaultModule dd ?  
ends    
Post 12 Aug 2011, 23:02
View user's profile Send private message Reply with quote
Snejk47



Joined: 04 Aug 2011
Posts: 2
Snejk47 13 Aug 2011, 16:04
Thank you very much for all Wink
Post 13 Aug 2011, 16:04
View user's profile Send private message 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.