if I order a memory block in this way...

Pixelmems db 1024 dup(?)

...is this memory automaticaly cleared by MASM32 ?
Or wich is the easiest way to clear such a memory ?

Posted on 2002-05-08 14:18:47 by Nordwind64
if your refering to remove all data out of a buffer try

cleanbuff proc
mov eax, offset Pixelmems
xor ebx,ebx
mov BYTE PTR [eax],0
inc ebx
mov BYTE PTR [eax+ebx],0
cmp ebx,1024
jne @B
cleanbuff endp
Posted on 2002-05-08 14:30:13 by Qages
Assuming by "clear" you mean fill with zeros:

Pixelmems db 1024 dup(0)
Posted on 2002-05-08 14:48:17 by iblis

thank you Quages and iblis !!!!!
dup(0), this is what I was looking for.

Posted on 2002-05-08 14:54:51 by Nordwind64
if U declare the buff this way: Pixelmems db 1024 dup(?) in .DATA? section the buff is created in heap and the file isn't bigger with extra 1024 bytes

but if U declare the buff this way: Pixelmems db 1024 dup(0) in .DATA or .CODE section the buff is created in file and that means the file will be bigger with extra 1024 bytes

U can use the LocalAlloc function (and/or familer to that) with uFlag set to LMEM_ZEROINIT. This way the func will automaticly alloc buff-space u need and fill it with zeros
Posted on 2002-05-08 15:08:03 by NEMO

thank you for your info's !!!

Greetings, Nordwind64
Posted on 2002-05-10 10:26:08 by Nordwind64
Eh... is that avatar appropriate?
Posted on 2002-05-10 15:18:25 by iblis
That avatar is never appropriate.....anywhere....anytime.....yech....:)
Posted on 2002-05-10 15:26:20 by emonk
how can any one get like that?
Posted on 2002-05-10 15:27:10 by Qages
(Someone correct me if im wrong) But I think as by standed the win32 PE loader initializes memory in a .BSS section to zero.

More simply what this means is that 'Pixelmems BYTE 1024 DUP(?)' will initally be allocated to zero.
Posted on 2002-05-11 02:18:07 by huh

huh, I think you're right. I tested it and the memory were always filled by Zero.

Ey, who deletes my atavar?
It wasn't beautiful, but very funny :grin: (but not pornographic!)

Ok, here is a normal atavar... :eek:

Greeting, Nordwind64
Posted on 2002-05-11 03:59:38 by Nordwind64
Huh is right, BSS (.data?) memory is cleared to zero by the PE loader
(prolly due to VirtualAlloc). BSS is pretty neat :), and it's *not* allocated
on the heap like nemo said, it's simply part of the image.
Posted on 2002-05-11 05:13:58 by f0dder
ups!!! :grin:
Posted on 2002-05-11 05:50:19 by NEMO