May 21, 2024, 09:48:39 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


RtlZeroMemory

Started by Brian, October 24, 2015, 03:23:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

Hi,

I've seen RtlZeroMemory written like this:

RtlZeroMemory(buffer,LEN(buffer))

and this:

RtlZeroMemory(&buffer,LEN(buffer))

Does it make a difference to have the '&' in there. Or, more correctly, what is the difference?

Brian

LarryMc

the declaration of rtlzeromemory says that the first parameter is a pointer to memory and the second parameter is the length of that memory

when you see it like this
RtlZeroMemory(buffer,LEN(buffer))
buffer has been defined as either a STRING,ISTRING,WSTRING, or some structure type
that's because all of those type of variables are passed as pointers

when you see it like this
RtlZeroMemory(&buffer,LEN(buffer))
buffer has been declared as something other than the above like
int buffer
float buffer
etc
since those types are passed by value you have to use the & to force the variable to be passed by reference to the memory location (POINTER)

hope that makes sense
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

That makes great sense, Larry - thank you

Brian