flat assembler
Message board for the users of flat assembler.

Index > Main > how to virtualy access structure inside structure?

Author
Thread Post new topic Reply to topic
at0mic



Joined: 09 Mar 2005
Posts: 12
at0mic 09 Mar 2005, 23:31
something like pseudocode:
Code:
include 'win32ax.inc'

struc RGB
{
 .R  POS
 .G  POS
 .B  POS
 }

struc POS
{

.x rb ?
.y rb ?
}

.data


buffer rb 1024
.code
start:

        lea ebx,[buffer]
        virtual at ebx
        lol RGB
        end virtual

        mov al, BYTE [lol.R.y]

invoke ExitProcess,0

.end start      


please help Privalov or the others Gurus!

I have troubles with:
Code:
struc IMAGE_NT_HEADERS
{
  .Signature         DWORD                   ?
  .FileHeader        IMAGE_FILE_HEADER
  .OptionalHeader    IMAGE_OPTIONAL_HEADER32
}       

_________________
at0mic!
Post 09 Mar 2005, 23:31
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 10 Mar 2005, 09:24
i think better way to use struct macro

Code:
struct IMAGE_NT_HEADERS
  .Signature            dd ?
  .FileHeader           IMAGE_FILE_HEADER
  .OptionalHeader       IMAGE_OPTIONAL_HEADER
ends
    


substructures can be accessed with this code

Code:
; .unth defined inside procedure

lea edi,[.inth]
mov eax,[edi+IMAGE_NT_HEADER.FileHeader.TimeDateStamp]
    


Code:
; and if you have mapped pe-file, for example (edi - pointer to mapped file)

mov eax,[edi+IMAGE_DOS_HEADER.e_lfanew]
mov esi,edi
add esi,eax
mov ecx,[esi+IMAGE_NT_HEADER.FileHeader.TimeDateStamp]
    
Post 10 Mar 2005, 09:24
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.