![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Professional Programmer
|
Great! Thank you so much for your help, The Dark. I'll take out fin, and see if I can figure out how to make the * show up for every 1% overwritten. If I run into trouble with that, I'll post here.
Off topic: How are you managing to move up so fast in Conflict Online without getting your factories destroyed or your bank account robbed clean? Someone keeps robbing my bank account, and it's driving me up the walls. Thanks again for all your help, and thank you Ruben for helping me clean up my code.
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
#12 | |
|
Expert Programmer
Join Date: Jun 2005
Posts: 874
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#13 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
@Prm: Yeah no problem, btw in your code you had: int number = 0; int number2 = 0; int number3 = 0; int number4 = 0; int number5 = 0; int number6 = 0; int number7 = 0; int number8 = 0; int number9 = 0; int number10 = 0; int number = 0, number2 = 0, number3 = 0, number4 = 0, number5 = 0, number6 = 0, number7 = 0, number8 = 0, number9 = 0, number10 = 0;
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#14 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 874
Rep Power: 4
![]() |
Conflict online is a game written by JavaMan, he wrote a post about it on this very site!
Its one of those click the button multiplayer rpg type web games, but I'll probably drop out soon (about 4 weeks is my limit for these type of games). |
|
|
|
|
|
#15 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
The only game like that, which I tried was mafia.org, 4 years back, it was fun at the time, but I should have directed my time elsewhere.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#16 |
|
Professional Programmer
|
@Ruben: That was when I thought I needed 10 sets of numbers to write to the file, when I really only needed one. I now just have the one int. I didn't know you could call mulitiple ints with multiple values. I thought you could only call multiple ints. I learned something new today.
@The Dark/Peter: (whichever one you would rather me call you) Suppose I wrote a story on my family computer entitled The Uncensored Adventures of Paul McLain* and it was a book I didn't want mom to see. (You can guess why) Suppose futhermore that I panicked and decided to SecureOverwrite my story because I knew mom was better with the computer than she seems and she knew how to use a file recovery program. I wanted to make multiple passes over that data with different random numbers. Would it be ok to open the file with "fout" more than one time before I deleted the file, and overwriting first the original text and then the random number string or would I be writing into that "free" space? *Disclamer: I have never written such a book, and most likely will not write it, because I have no "adventures" to share. (And if I did, I don't think I would foolishly put them on a computer)
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
#17 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 874
Rep Power: 4
![]() |
I think that opening the file as you are should be OK, since the file is not being truncated, the data will most likely be written over the existing data.
As I said, the OS can move files around in the background, for example when you edit your infamous book, the word processor probably writes the new version to a new file, and then deletes the old file and renames the new one to the correct name. This means you now have two copies of of the file on disk, one in the actual file, and one in the deleted area of the disk. This may happen lots of times, unless you write the whole book in one sitting, which would probably be an adventure in itself. I think finding all these areas and removing them would be very tricky and would require intimate knowledge of the OS involved. A defrag after the delete would probably make anything much harder to recover, and you can probably say you were just doing it for performance reasons ![]() |
|
|
|
|
|
#18 |
|
Professional Programmer
|
Thanks. I'm not trying to hide anything, just to let you know, I just wanted to develop a decent algorithim for overwriting the file and then deleting it. Thanks for the input.
![]()
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
#19 |
|
Professional Programmer
|
Ok, I decided to make SecureOverwrite a Windows program, by coding it in the Win32 API. Everything GUI wise is going ok, but I'm having trouble with writing to the file. It seems that I don't quite understand how to use CreateFile() to open my file and WriteFile() to overwrite it. I wanted to overwrite everything with "0"'s, but I am getting random gobbledegook that makes me think strange memory is getting written. Here is my code so far, what could I do to fix it?
void SecureOverwrite()
{
struct stat results;
int sizeFile;
if (stat(Buffer, &results) == 0)
{
sizeFile = results.st_size;
}
if (stat(Buffer, &results) != 0)
{
MessageBox(0, "File not found.", "Not found", MB_OK | MB_ICONINFORMATION);
}
DWORD wmWritten;
HANDLE out = CreateFile ( Buffer, GENERIC_WRITE, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
int number;
char strData[2] = "0";
int theLimit, x;
for (theLimit = 1; theLimit <= sizeFile; theLimit++)
{
//number = (int) x * rand() / (RAND_MAX + 1.0);
WriteFile(out, strData, (DWORD)(sizeof(strData)), &wmWritten, NULL);
}
CloseHandle(out);
}Thanks. ![]()
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
#20 |
|
Professional Programmer
|
Yay, yay yay! I got it using fwrite() instead of WriteFile()! I don't know why WriteFile() wouldn't work for me, I just couldn't figure it out. :p
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|