The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: brixton on December 25, 2005, 05:31:29 PM

Title: Clearing BYTE buffer
Post by: brixton on December 25, 2005, 05:31:29 PM
How do I clear the contents of a BYTE buffer?  Like with registers, I can just xor register, register

Apologies for such a simple question,

-brixton
Title: Re: Clearing BYTE buffer
Post by: G`HOST on December 25, 2005, 06:40:24 PM
invoke RtlZeroMemory........................
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/Kernel_r/hh/Kernel_r/k109_63d9f0fb-d698-4707-9018-de2fa851a94b.xml.asp
:U
Title: Re: Clearing BYTE buffer
Post by: brixton on December 25, 2005, 08:21:27 PM
Looks great, thanks, perfect, amazing, yeah!

Is there any other way of doing it though, except a small loop moving 0 to each BYTE PTR?

Actually I suppose I'm just being greedy now  :lol
Title: Re: Clearing BYTE buffer
Post by: Mincho Georgiev on December 25, 2005, 09:12:09 PM
Yes ,there is a third way, you separating the whole array on dwords and using DWORD PTR ,it's mutch more faster than a BYTE PTR loop.
Title: Re: Clearing BYTE buffer
Post by: hutch-- on December 25, 2005, 09:15:15 PM
brixton,

Usual trick is unless you need to zero fill the entire string, just write a zero to the first location and its a zero length string that you can write to.
Title: Re: Clearing BYTE buffer
Post by: brixton on December 25, 2005, 10:05:23 PM
Thanks for all the replies, and yes hutch--, I did that and it suits my needs for this particular project.  Thanks!  :bg :U