News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Two lines.

Started by thefs18, March 19, 2007, 12:21:21 PM

Previous topic - Next topic

thefs18

Hey People. I've been reading about ASM recently it's nice. Anyway, i've wrote two wrappers in C++ and i just need help in converting them into MASM32 because i'm not too sure how to do this. I've searched and searched but i cannot seem to figure a way on how to do this. Well, here are the two lines of code;


PHEADER pHeader = PHEADER(pbyBuffer); // C++


PHEADER is a structure with two members in it. One is a DWORD variable which holds the size, and the second member is a WORD variable which i do a case statement on it (in C++). Also, i was wondering if somebody could convert this line of C++ code for me?.


pdwSize = PDWORD(pbyBuffer);


That just gets the total entries inside of pbyBuffer. This is declared as a PByte. I would prefer the code in MASM32 if that is possible. I appreciate anybodys time if they could help me convert these two lines. Cheers.

:dance:

Shantanu Gadgil

Hi,
Welcome thefs18.

The C++ lines that you have written are just "typcasting". In assembly what you need to do is "mov" value of variable "pbyBuffer" into the variable "pHeader".
Thats all!

Also, just a note, i think this subforum is to deal with issues related to the MASM32 package and not programming in general. I think the "Campus" would be a more appropriate location for the same.

Hope that helps,

Cheers,
Shantanu
To ret is human, to jmp divine!

thefs18

I apologize for my stupidness. I shall try to remember next time. So, basically it's just like;


mov pHeader, pbyBuffer


Right?.  :red Cheers.  :U

Shantanu Gadgil

mov pHeader, pbyBuffer
Right...thats the idea but you can't move a variable into another variable so you'll have to use a register or "push" one and "pop" into the other!

Regards,
Shantanu
To ret is human, to jmp divine!

thefs18

Ah okay. Thank you very much for your time.  :8)