Author: sginsberg Date: Mon Jun 8 17:42:02 2009 New Revision: 41350
URL: http://svn.reactos.org/svn/reactos?rev=41350&view=rev Log: - Clean up RtlSecureZeroMemory
Modified: trunk/reactos/include/psdk/winnt.h
Modified: trunk/reactos/include/psdk/winnt.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=41... ============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Mon Jun 8 17:42:02 2009 @@ -4688,19 +4688,24 @@
FORCEINLINE PVOID -RtlSecureZeroMemory(IN PVOID ptr, - IN SIZE_T cnt) +RtlSecureZeroMemory(IN PVOID Buffer, + IN SIZE_T Length) { - volatile char *vptr = (volatile char *)ptr; - - while (cnt) + volatile char *VolatilePointer; + + /* 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 {