mirror of
https://github.com/reactos/reactos.git
synced 2024-08-13 06:37:06 +00:00
- Clean up RtlSecureZeroMemory
svn path=/trunk/; revision=41350
This commit is contained in:
parent
4ceaa89fbd
commit
50585c6349
|
@ -4688,19 +4688,24 @@ RtlCompareMemory (
|
|||
|
||||
FORCEINLINE
|
||||
PVOID
|
||||
RtlSecureZeroMemory(IN PVOID ptr,
|
||||
IN SIZE_T cnt)
|
||||
RtlSecureZeroMemory(IN PVOID Buffer,
|
||||
IN SIZE_T Length)
|
||||
{
|
||||
volatile char *vptr = (volatile char *)ptr;
|
||||
volatile char *VolatilePointer;
|
||||
|
||||
while (cnt)
|
||||
/* Get a volatile pointer to prevent any compiler optimizations */
|
||||
VolatilePointer = (volatile char *)Buffer;
|
||||
|
||||
/* Loop the whole buffer */
|
||||
while (Length)
|
||||
{
|
||||
*vptr = 0;
|
||||
vptr++;
|
||||
cnt--;
|
||||
/* Zero the current byte and move on */
|
||||
*VolatilePointer++ = 0;
|
||||
Length--;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
/* Return the pointer to ensure the compiler won't optimize this away */
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
typedef struct _OBJECT_TYPE_LIST {
|
||||
|
|
Loading…
Reference in a new issue