flat assembler
Message board for the users of flat assembler.

Index > Windows > Why not INCREMET VALUE

Author
Thread Post new topic Reply to topic
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
Hi. In this function not increment value:

Code:
proc Manager.New
        inc     [dm.count]
        stdcall MemoryInit, [id.array.heap], sizeof.ITEM_DOWNLOAD
        mov     ecx, id.array.point
        mov     [ecx], eax
     thread_create:
        xor     eax, eax
        invoke  CreateThread, eax, 1024*1024*32, ThreadFun, eax, eax, id.thread
        mov     [id.thread], eax
        .if     eax = 0
                invoke  GetLastError
                stdcall ErrorMessage, eax
        .endif
     copy_points:
        cld
        mov     esi, id.array
        imul    edi, [dm.count], 8
        add     edi, dm.items
        movsd
        movsd
     copy_data:
        mov     eax, [dm.count]
        mov     [id.id], eax
        stdcall MemoryCopy, [id.array.point], id, sizeof.ITEM_DOWNLOAD
        ret
endp        


Please help me!!!


Description:
Download
Filename: manager.rar
Filesize: 5.5 KB
Downloaded: 51 Time(s)


_________________
Forgive for my bad english, I from russia...
Post 25 Jan 2009, 10:35
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
What doesn't increment? Is it dm.count that doesn't increment?
Post 25 Jan 2009, 10:41
View user's profile Send private message Visit poster's website Reply with quote
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
Yes, of course dm.count, if call of my proc ShowDword, dm.count to see not increment!!!
Post 25 Jan 2009, 11:01
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Maybe because you overwrite the count value:
Code:
struct        ARRAY
       heap            dd ?
        point           dd ?
ends

struct DOWNLOAD_MANAGMENT
       items           ARRAY
       count           dd 0
        socket          SOCKET_INFO
ends

...

  mov     esi, id.array
       imul    edi, [dm.count], 8
  add     edi, dm.items ;<--- dm.count follows this address
        movsd
       movsd    
Post 25 Jan 2009, 11:27
View user's profile Send private message Visit poster's website Reply with quote
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
hm... yes... i'm must moved 2 dword in pointers on address items.point

thank you!
Post 25 Jan 2009, 12:09
View user's profile Send private message ICQ Number Reply with quote
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
So it is correct?
Code:
        cld
        mov     esi, id.array
        imul    ecx, [dm.count], 8
        lea     edi, [dm.items]
        add     [edi], ecx
        movsd
        movsd             
    
Post 25 Jan 2009, 12:30
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Your current setup mean that you are copying data into a dm structure but the structure is not large enough to hold all of your data so you start to overwrite whatever comes after the dm.item member.

I think you should consider using a different way to store your array.

Maybe you can try using a linked list. Just store the head of the list in the dm structure and then allocate each new item dynamically with each one linking to the next.
Post 25 Jan 2009, 12:34
View user's profile Send private message Visit poster's website Reply with quote
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
Ok... Thank you!
Post 25 Jan 2009, 12:45
View user's profile Send private message ICQ Number 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.