3rd Tuesday of the month. 7:30PM - C/C++ Group, SPRS
Welcome to the C++ Users Group. This group is a "Special Interest Group" of the ACGNJ devoted to discussing programming languages in general and C, C++, and C++ for Windows programming in particular. Each month a small but hopefully useful program (complete with source code) is presented for discussion.
The object of this utility is to display the strings contained within any file. (A string is simply a group of characters.) The typical usage is for the recovery of information contained within damaged files that fail to open in their original applications. A word processor file, for example, will often contain most of the text of the document even if it can't be opened. Any discovered text can be copied using Ctrl-C and then pasted elsewhere. Use "Drag and Drop" from Windows Explorer to open any file.
Microsoft Visual C++ Version 6.0. |
Windows API. |
Dialog Based Applications. |
Timers. |
Automatic window element resizing. |
Keyboard hotkeys. |
Simple Drag and Drop. |
Simple Clipboard transfer. |
C language "stdio" file processing. |
ListBox handling. |
At the meeting on Tuesday night we will be discussing the utility and the source code.
SAMPLE CODE =========== void CSDlg::DoProcessFile() { enum STATETAG { BINARY, INTEXT, INPRETEXT } state = BINARY; char c, cLast=0, buff[25]; int ich, i=0; MSG msg; CString aout; if (NULL == (fs=fopen(m_filename, "rb"))) return; m_bAbort = false; GetDlgItem(IDC_CHECK1)->EnableWindow(false); // Disable Filter button GetDlgItem(IDC_READABORT)->EnableWindow(true ); // Enable Read Abort button CSApp * pApp = (CSApp *)AfxGetApp(); // Need for Macro. (PumpMessage.) m_ArrowHourGlass = true; CWaitCursor wait; // display wait cursor m_Timer = SetTimer(0, 2000, NULL); // Activity timer while(m_bAbort == false) { ich = fgetc(fs); if (ich == EOF) break; c = (char)(ich & 0xFF); // Now map CR-LF pairs, CR, or LF to newline if ('\r'==c) { ich = fgetc(fs); if (ich == EOF) break; c = (char)(ich & 0xFF); if('\n'==c) // CR-LF, normal text file. CR gets thrown away. ; else // CR-?? { ungetc(c, fs); // Put char back for next loop c = '\n'; // map CR to newline } } if (0 != cLast && 0 == c) { cLast = 0; c = ' '; } // Map multiple nulls to a single space. else cLast = c; switch (state) { case INPRETEXT: if (clean2(c)) { buff[i++] = c; if (i == 4) { state = INTEXT; buff[i] = 0; aout += buff; i=0; } } else { state = BINARY; i=0; } break; case INTEXT: if (clean2(c)) { if (c == '\n') { ADD_STRING_TO_LISTBOX(); } else aout += c; } else { ADD_STRING_TO_LISTBOX(); state = BINARY; i=0; } break; case BINARY: if (clean2(c)) { buff[i++] = c; state = INPRETEXT; } break; } } if (!aout.IsEmpty()) { ADD_STRING_TO_LISTBOX(); } if (i) { buff[i] = 0; aout = buff; ADD_STRING_TO_LISTBOX(); } fclose(fs); fs = NULL; KillTimer(m_Timer); m_Timer=0; m_ArrowHourGlass = false; if (m_bAbort) for (i=0; i<5; i++) { aout = "+++ ABORT BUTTON HIT. FILE TRUNCATED +++"; ADD_STRING_TO_LISTBOX(); } m_strings.SetTopIndex(m_strings.GetCount()-1); // Scroll to bottom. GetDlgItem(IDC_READABORT)->EnableWindow(false );// Disable Read Abort button GetDlgItem(IDC_CHECK1)->EnableWindow(true); // Enable Filter button }
November 2005 C/C++ Meeting Random Access Notes ================================================= www.acgnj.org C Users Journal - www.cuj.com www.codeproject.com Dr Dobbs = www.ddj.com www.codeguru.com msdn.microsoft.com www.dslreports.com How to clone a Hard Drive 1. Symantec (Norton) Ghost 2. Western Digital, Maxtor, Seagate 3. NTBackup, Re-install windows, NTBackup 4. Drive Image 5. Ztree ??? 6. Partition Magic FREE **** Visual Studio Express 2005 Free - C++ C# J# SQL Asp at the Microsoft web site. www.winxpnews.com www.win2knews.com www.wservernews.com Source Forge IDE Eclipse Java Intel C++ Borland JBuilder, Delphi, Oracle 10, SQ Lite The link to the Sony fiasco is http://www.sysinternals.com/blog/2005/10/sony-rootkits-and-digital-rights.html Ztree is at http://www.ztree.com/ and for VS X 2005 http://msdn.microsoft.com/vstudio/express/default.aspx pick one or many and eclipse is http://eclipse.org
I decided to see if I could copy all the sectors off the disk using "Sector Access" which I had downloaded from www.simtel.net (cool site). Here is the link for "Sector Access":
http://www.simtel.net/pub/dl/52692.shtmlI used the string of sectors feature and copied every sector starting at "00000000". I entered "2847" for the number of sectors. A complete disk image went into a file I named, "DISK.IMG" without any errors!!! This file was then dropped into StringsW.exe to recover ALL of the text on the floppy via the clipboard. WoW.