August 11, 2022, 05:40:33 AM


Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........

Clearing RAM

Started by Steven Picard, March 13, 2008, 09:47:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Steven Picard

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?  :-[

Ionic Wind Support Team

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.

Ionic Wind Support Team

Steven Picard

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.

Steven Picard

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.


March 14, 2008, 12:52:00 PM #4 Last Edit: March 14, 2008, 12:59:17 PM by sapero
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.

Steven Picard

Thanks, sapero, I'll look into those.