[ASM] IMAGE_DOS_HEADER

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by lBad, 22 Jan 2012.

Thread Status:
Not open for further replies.
  1. lBad

    lBad New Member

    Joined:
    20 Jan 2012
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    [ASM] IMAGE_OPTIONAL_HEADER32.DataDirectory

    Добрый день!
    Решил сделать для себя криптор, нашел примеры исходников в интернете на FASM, от Kas'a (Morphnah100). Попробовал скомпилировать, но ругается на строку:
    PHP:
    add eax,[edi+IMAGE_OPTIONAL_HEADER32.DataDirectory+eax
    Структура:
    PHP:
    struct IMAGE_DOS_HEADER
            e_magic           dw      
    ?
            
    e_cblp            dw      ?
            
    e_cp              dw      ?
            
    e_crlc            dw      ?
            
    e_cparhdr         dw      ?
            
    e_minalloc        dw      ?
            
    e_maxalloc        dw      ?
            
    e_ss              dw      ?
            
    e_sp              dw      ?
            
    e_csum            dw      ?
            
    e_ip              dw      ?
            
    e_cs              dw      ?
            
    e_lfarlc          dw      ?
            
    e_ovno            dw      ?
            
    e_res             rw      4
            e_oemid           dw      
    ?
            
    e_oeminfo         dw      ?
            
    e_res2            rw      10
            e_lfanew          dd      
    ?
    ends

    struct IMAGE_FILE_HEADER 
            Machine               dw    
    ?
            
    NumberOfSections      dw    ?
            
    TimeDateStamp         dd    ?
            
    PointerToSymbolTable  dd    ?
            
    NumberOfSymbols       dd    ?
            
    SizeOfOptionalHeader  dw    ?
            
    Characteristics       dw    ?
    ends

    struct IMAGE_DATA_DIRECTORY 
            VirtualAddress    dd      
    ?
            
    isize             dd      ?
    ends

    IMAGE_NUMBEROF_DIRECTORY_ENTRIES 
    16

    struct IMAGE_OPTIONAL_HEADER32
            Magic                         dw       
    ?
            
    MajorLinkerVersion            db       ?
            
    MinorLinkerVersion            db       ?
            
    SizeOfCode                    dd       ?
            
    SizeOfInitializedData         dd       ?
            
    SizeOfUninitializedData       dd       ?
            
    AddressOfEntryPoint           dd       ?
            
    BaseOfCode                    dd       ?
            
    BaseOfData                    dd       ?
            
    ImageBase                     dd       ?
            
    SectionAlignment              dd       ?
            
    FileAlignment                 dd       ?
            
    MajorOperatingSystemVersion   dw       ?
            
    MinorOperatingSystemVersion   dw       ?
            
    MajorImageVersion             dw       ?
            
    MinorImageVersion             dw       ?
            
    MajorSubsystemVersion         dw       ?
            
    MinorSubsystemVersion         dw       ?
            
    Win32VersionValue             dd       ?
            
    SizeOfImage                   dd       ?
            
    SizeOfHeaders                 dd       ?
            
    CheckSum                      dd       ?
            
    Subsystem                     dw       ?
            
    DllCharacteristics            dw       ?
            
    SizeOfStackReserve            dd       ?
            
    SizeOfStackCommit             dd       ?
            
    SizeOfHeapReserve             dd       ?
            
    SizeOfHeapCommit              dd       ?
            
    LoaderFlags                   dd       ?
            
    NumberOfRvaAndSizes           dd       ?
            
    DataDirectory                             rb (sizeof.IMAGE_DATA_DIRECTORY*IMAGE_NUMBEROF_DIRECTORY_ENTRIES)
    ends
    При компиле пишет: operand sizes do not match

    Исходники: Скачать
     
    #1 lBad, 22 Jan 2012
    Last edited: 22 Jan 2012
  2. DooD

    DooD Elder - Старейшина

    Joined:
    30 Sep 2010
    Messages:
    1,168
    Likes Received:
    442
    Reputations:
    288
    возможно ему надо указать явный размер,попробуй byte ptr
     
  3. lBad

    lBad New Member

    Joined:
    20 Jan 2012
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Проблему решил. Тему можно закрыть.
     
Thread Status:
Not open for further replies.