|
I had a thought about this last night. I will use a linked list of fixed size structures, let's say 128 bytes. Each entry may use one or more of these structures to span the data. The first would contain the time stamps, source details etc.. the next would act as an overflow from the first.
Continue like this until the end of the file is found, then, link the last to the first and overwrite the data within the first group of items, if more space is required, overwrite the next group also.
Depending on the size chosen for each structure, the wasted space would be limited to a few bytes for each entered record. In the header, I would only need to store the offset to the first and last. Each record would then store an offset to it's overflow and a count of it's overflows ( if required ) and the offset of the next list item.
On with the coding...
|
|
|
|
|
Could you consider to make a CP article on the subject? I find it really interesting, and so does others, I suspect.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Possibly, it really depends on how much closely it ties in with my project. Ultimatly I would like to make it re-usable, in which case I may create an article, if I have time.
|
|
|
|
|
I, for one, would (will) really look forward to such an article.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi All,
Here's an interesting one... Debug is Broken, Release is OK. I've got test cases down to failures on LARGE files in Debug Builds. The reason the large file does not exist in Release: Debug information is stripped (I'm literally probing my own EXE).
The original FileMapping code was shamelessly ripped from Matt Pietrek's An In-Depth Look into the Win32 Portable Executable File Format[^]. I can't seem to find what is wrong with the original useage.
I suspect this has to do with the Memory Manager's ability to keep up... Any ideas? Below is how I am using CreateFileMapping/MapViewOfFile.
Jeff
if( 0 == GetModuleFileName( NULL, szFilename, PATH_SIZE ) )
{
std::cout << _T("Error Retrieving Process Filename") << std::endl;
__leave;
}
hFile = CreateFile( szFilename, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if ( hFile == INVALID_HANDLE_VALUE )
{
std::cout << _T("Error - CreateFile()") << std::endl;
__leave;
}
hFileMapping = CreateFileMapping(hFile, NULL,
PAGE_READONLY, 0, 0, NULL);
if ( NULL == hFileMapping )
{
std::cout << _T("Error - CreateFileMapping()") << std::endl;
__leave;
}
PVOID pMappedFile = NULL;
pMappedFile = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
if ( NULL == pMappedFile )
{
std::cout << _T("Error - MapViewOfFile()") << std::endl;
__leave;
}
|
|
|
|
|
Where exactly are you picking up the error and did you make sure you SetLastError before the whole process?
|
|
|
|
|
Hi Waldermort,
WalderMort wrote: Where exactly are you picking up the error...
From the Output Window in Visual Studio .NET on Windows 2000.
I also confirmed it was a bug Windows XP, and Windows Server 2003. And confirmed the behavior using Visual Studio 2005. The bad thing was, it was my bug...
Basically, when inspecting ones own .CODE section, one of two methods is used:
1) if the image is a disk image, use (.TEXT Section)pSectionHeader-> PointerToRawData to locate the first .CODE page on DISK.
2) if the image is a memory image, use (.TEXT Section)pSectionHeader-> VirtualAddress to locate the first .CODE page in MEMORY.
PointerToRawData is usually 0x1000. VirtualAddress is larger - for example 0x3D00. The previous is added to a image Base Address - 0x400000 (hModule), PVOID from MapViewOfFile(), etc. Under certain circumstances (Debug Builds with large LIB files that cause a cross of Granulation Boundary), an ACCEESS_DENIED occurs - more correctly Access Violation.
With Debug builds, VirtualAddress != PointerToRawData. In Release builds, VirtualAddress == PointerToRawData. Hence the reason why Debug failed, and Release was successful.
My error crept in with the fact that VirtualAddress >>> PointerToRawData, and I was using VirtualAddress when probing the disk image in Debug.
What was especially frustrating was the fact that I wasted time in WinDbg on my spare Server (it only has 700 MHz CPU and 768MB of RAM) - painful. My development machine has dual 1GHz with 2GB of RAM. This is my personal Test lab at the house - complete with a pair of Cisco 1700s for segment testing
Jeff
|
|
|
|
|
BTW, I think this will make for an interesting article... Others could extend it as a Dynamic Disassembler, etc. I'll have to put a Cryptographic spin on it.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: I'll have to put a Cryptographic spin on it.
LMAO.
If you do make an article from it. Please, please, please make it 64-bit compatible.
Glad you found the error.
|
|
|
|
|
Jeffrey Walton wrote: I suspect this has to do with [something other than my code or logic]...
Famous last words.
Jeff
|
|
|
|
|
Usually my last words are "Doh! It was me"
|
|
|
|
|
hello
i am calling a web service written in C# , from MFC application , and i need to know how to change the time out of the web service from the MFC application
thanks alot
|
|
|
|
|
What do you want to do ? What time do you want to change ? Do you mean the web service returns a DateTime and you don't know how to read it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How I can send XML packet from client to server
|
|
|
|
|
|
Hello,
I am looking for examples of UML drawings. Drawings of class diagrams for a general dialog based GUI application. The GUI could be some general buttons for the user to press that leads to child dialogs getting opened for more user interactions.
Does anyone know of any case studies, examples, tutorials that explains what I am after? Or may be web sites of interest?
Thanks for any information you could provide.
|
|
|
|
|
Hi All,
Please clarfy this point.
I have two classes COne and CTwo.And in the class declaration of COne i have the following declarations.
Class COne Class CTwo
{ {
Public: Public:
CTwo* p; int i,j;
CTwo p1;
CTwo *p2=new CTwo;
}; };
I want to know when i should do a "CTwo *p" and When "CTwo p1" and when i should do "CTwo * p2=new CTwo" because after all the declarations we can access the member functions and data members of the class CTwo.
Thanking you,
Ashwath Hegde.
|
|
|
|
|
You dont need to ask repeated
|
|
|
|
|
He has posted slightly different code in each thread. Perhaps he should locate the 'edit' button instead?
|
|
|
|
|
It seems odd for COne to have both "has a" and "is a" constructs. Is that intentional?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
Does anyone know whic *.dll files I need to include with my VS2005 C++(MFC) Application
in order to run it on other machine, which does not have VS2005 installed ?
thanks
|
|
|
|
|
There's a redistributable program that comes with VC2005, which installs all the WinSXS stuff for MFC in the right folders. It's called vcredist2005 or something along those lines.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Thanks for replies guys, but I am interested specifically in the *.dll files which are required for given program to run on another machine.
|
|
|
|
|
Perhaps you should read the docs pertaining to the redistritubals for your compiler/SDK. Sometimes distributing a single dll is not permitted, the whole installer must be distributed instead.
This is the case with DirectX, you cannot distribute a single 3mb dll, you must send the 40mb installer or provide a weblink ( the installer will download and install ).
|
|
|
|