IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Steven Picard on March 13, 2008, 09:47:41 PM

Title: Clearing RAM
Post by: Steven Picard on March 13, 2008, 09:47:41 PM
I am writing some software that locks down the PC for a short time (while a person is working from home for our company) and then I restore the PC to its former state.  One thing I need to do is to clear the RAM entirely so there's no chance of passwords or anything sensitive hanging around.  I tried some techniques but they are just too slow and I really don't know how effective they were.

Does anyone have any ideas?  Sapero? Paul?  :-[
Title: Re: Clearing RAM
Post by: Ionic Wind Support Team on March 13, 2008, 11:43:04 PM
Nothing simple comes to mind.  Besides turning off the computer and waiting 5 minutes.

It would have to be a kernel process since normal processes only have access to their own virtual ram page, and not the entire system memory map.

Paul.
Title: Re: Clearing RAM
Post by: Steven Picard on March 14, 2008, 09:59:48 AM
That's what I figured.  I tried just allocating and clearing chunks of memory until there was no more.  The issue with that was (as a kinda good side effect) I ended up using up all the swap file.  It's good to clear that out since passwords can be found in there as well.  The problem was we are only accessing virtual memory so there is no guarantee I'm really clearing it out and it took at least 5-7 minutes on a 512MB system with 2Gigs swap (in a virtual machine) which is really not too practicle for my type of application.
Title: Re: Clearing RAM
Post by: Steven Picard on March 14, 2008, 10:03:47 AM
I suppose this could be written as a system driver.  I did some studying on writing drivers, mainly in C++ but it could be done in Aurora (or EBasic for that matter I believe) since it really is just a WIN32 (cdecl) DLL with a arbitrarily specified entry point.  I never got around to writing one so I am just going off of what I read.  I know there are 3 levels of driver.  The lower the level the fewer windows API's I have access to and in Vista the new rule is I have to have it signed as authentic by MS which means the average Joe just isn't going to write them anymore.  Darn Vista.
Title: Re: Clearing RAM
Post by: sapero on March 14, 2008, 12:52:00 PM
To allocate memory, call VirtualAlloc, then lock the (commited) memory in RAM by calling VirtualLock.
Read also about SetProcessWorkingSetSize function.

You can also call AllocateUserPhysicalPages while running as service, or in system account.
Title: Re: Clearing RAM
Post by: Steven Picard on March 14, 2008, 01:32:52 PM
Thanks, sapero, I'll look into those.