The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: thefs18 on March 19, 2007, 12:21:21 PM

Title: Two lines.
Post by: thefs18 on March 19, 2007, 12:21:21 PM
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:
Title: Re: Two lines.
Post by: Shantanu Gadgil on March 19, 2007, 02:21:33 PM
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
Title: Re: Two lines.
Post by: thefs18 on March 19, 2007, 05:10:34 PM
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
Title: Re: Two lines.
Post by: Shantanu Gadgil on March 19, 2007, 06:12:28 PM
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
Title: Re: Two lines.
Post by: thefs18 on March 19, 2007, 06:53:17 PM
Ah okay. Thank you very much for your time.  :8)