|
Sir its failing here at first..
void ShowSymbolInfo( DWORD64 ModBase )
{
// Get module information
IMAGEHLP_MODULE64 ModuleInfo;
memset(&ModuleInfo, 0, sizeof(ModuleInfo) );
ModuleInfo.SizeOfStruct = sizeof(ModuleInfo);
<b>BOOL bRet = ::SymGetModuleInfo64( GetCurrentProcess(), ModBase, &ModuleInfo ); //failing here and says 'incorrect parameter'</b>
.......
.......
}
and i also checked by giving ModeBase still it's giving same error code (incorrect parameter)
|
|
|
|
|
This code works on my machine and I hope also on yours. You only have to add some checks.
I hope my C++ is not that cruel .
char szPDBFile[] = "<path to pdb file>\\Symbols.pdb";
HANDLE hProcess = GetCurrentProcess();
BOOL bRet = FALSE;
bRet = SymInitialize(hProcess, NULL, FALSE);
HANDLE hFile = CreateFileA((LPCSTR)&szPDBFile, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD dwFileSize = GetFileSize(hFile, NULL);
CloseHandle(hFile);
DWORD64 dwModBase = SymLoadModule64(hProcess, NULL, (LPCSTR)&szPDBFile, NULL, 0x10000000, dwFileSize);
bRet = SymEnumSymbols(hProcess, dwModBase, NULL, MyEnumSymbolsCallback, NULL);
bRet = SymUnloadModule64(hProcess, dwModBase);
bRet = SymCleanup(hProcess);
BOOL CALLBACK MyEnumSymbolsCallback(PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext)
{
return TRUE;
}
In this example I used the fixed base 0x10000000. If you need to load more than one pdb you have calculate this address and make sure the pdbs do not overlap in memory.
Examble:
1. PDB = 0x10000000
2. PDB = 0x10000000 + file size of 1. PDB
3. PDB = 0x10000000 + file size of 1. PDB + file size of 2. PDB
...
In addition make sure not to cause an exception in your callback, because SymEnumSymbols will return false (and GetLastError returns 0xC0000005 if you cause an access violation).
Greetings
Covean
|
|
|
|
|
Code for GetFileParams() ?
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
bool GetFileParams( const TCHAR* pFileName, DWORD64& BaseAddr, DWORD& FileSize )
{
// Check parameters
if( pFileName == 0 )
{
return false;
}
// Determine the extension of the file
TCHAR szFileExt[_MAX_EXT] = {0};
_tsplitpath( pFileName, NULL, NULL, NULL, szFileExt );
// Is it .PDB file ?
if( _tcsicmp( szFileExt, _T(".PDB") ) == 0 )
{
// Yes, it is a .PDB file
// Determine its size, and use a dummy base address
BaseAddr = 0x10000000; // it can be any non-zero value, but if we load symbols
// from more than one file, memory regions specified
// for different files should not overlap
// (region is "base address + file size")
if( !GetFileSize( pFileName, FileSize ) )
{
return false;
}
}
else
{
// It is not a .PDB file
// Base address and file size can be 0
BaseAddr = 0;
FileSize = 0;
}
// Complete
return true;
}
bool GetFileSize( const TCHAR* pFileName, DWORD& FileSize )
{
// Check parameters
if( pFileName == 0 )
{
return false;
}
// Open the file
HANDLE hFile = ::CreateFile( pFileName, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL );
if( hFile == INVALID_HANDLE_VALUE )
{
_tprintf( _T("CreateFile() failed. Error: %u \n"), ::GetLastError() );
return false;
}
// Obtain the size of the file
FileSize = ::GetFileSize( hFile, NULL );
if( FileSize == INVALID_FILE_SIZE )
{
_tprintf( _T("GetFileSize() failed. Error: %u \n"), ::GetLastError() );
// and continue ...
}
// Close the file
if( !::CloseHandle( hFile ) )
{
_tprintf( _T("CloseHandle() failed. Error: %u \n"), ::GetLastError() );
// and continue ...
}
// Complete
return ( FileSize != INVALID_FILE_SIZE );
}
|
|
|
|
|
I want to make an application consisting of text boxes, radio buttons and check buttons. I did it in visual basic.
But i want to know that is there is any difference between what we program in Code Blocks and in Visual C ?
|
|
|
|
|
Razanust wrote: I want to make an application consisting of text boxes, radio buttons and check buttons. I did it in visual basic.
Either you did or didn't.
Razanust wrote: But i want to know that is there is any difference between what we program in Code Blocks and in Visual C ?
Have you read what either one is? Code::Blocks is a C++ IDE whereas Visual C++ is a language. Do you want to compare Code::Blocks with Visual Studio instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Razanust wrote: is any difference between what we program in Code Blocks and in Visual C ?
yes, huge differences.
|
|
|
|
|
Hi ,
I am working on Windows 7 operating system. I have created a window application . When I minimize that window it get minimize properly but when I try to Maximize it its not able to Maximize . It is not showing any error , it just keep itself in the taskbar. Please tell me how can I proceed in this.
The window is getting maximize succesfuly in other Operating system like Vista and XP.
Thanks in Advance
|
|
|
|
|
what code is running when maximized?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Please,
would it be possible
to enumerate all MB-advantages shortly ?
Thank you !
virtual void BeHappy() = 0;
modified on Wednesday, March 24, 2010 7:38 AM
|
|
|
|
|
Fixed-length vs variable-length UNICODE, the first that comes in my mind:
UTF-8 is pretty much everywhere and the most used variable-length UNICODE encoding ("multibyte"). Alone for compatibility in network applications or together with XML it could be a very good idea to choose it, probably because it is a "fits-all" format. It is able to represent any UNICODE character, yet backwards compatible with ASCII (7 bit). Also see UTF-8 advantages and disadvantages[^].
/M
|
|
|
|
|
Thank you, Moak !
(I did not know, that "multibyte" does mean "UTF-8"... )
virtual void BeHappy() = 0;
|
|
|
|
|
That is incorrect MBCS and Unicode are different things. See http://msdn.microsoft.com/en-us/library/5z097dxa.aspx. VC++ implements MSCS as DBCS (Double Byte Character Sets).
-Saurabh
P.S. Some how auto links are not working.
|
|
|
|
|
MBCS is not same as Unicode as reported by other poster. See http://msdn.microsoft.com/en-us/library/5z097dxa.aspx for details.
-Saurabh
P.S. Some how auto links are not working.
|
|
|
|
|
Thank you, Saurabh !
(I would prefer to use UNICODE
since there is no a "size-fixed character type" (like TCHAR )
to use with MBCS sequences, and it (MBCS) is not fully supported in MFC... )
virtual void BeHappy() = 0;
|
|
|
|
|
You are welcome. If you are interested then you can read more about it in excellent articles from Michael Dunn.
http://www.codeproject.com/KB/string/cppstringguide1.aspx
http://www.codeproject.com/KB/string/cppstringguide2.aspx
-Saurabh
|
|
|
|
|
|
Hi,
Im writting mpeg files into ASF container.Its written successfully and run on VLC fine.But its not getting played in WMP.First,it shows the error message as "DX50 codec is not installed on ur system"..so,i have installed.still its npt getting played in WMP even its showing the corrct time.video is missing.how to solve this?
|
|
|
|
|
it looks WMP doesnt know the codec. Somethings missing in the installation for WMP.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
how to create document for .c files which consists of only code in it and does not have any comments included in it.when i am trying to create document using doxygen for the .c files of linphone 3.2.1 then i am getting a warning i.e.
compound _linconfig does have any document...and so on for many .c files...help needed urgently..
itsmesheen@rediffmail.com
|
|
|
|
|
It's all described here[^].
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
It can generate an on-line documentation browser (in HTML) and/or an off-line reference manual (in $\mbox{\LaTeX}$) from a set of documented source files.
where in my case the .c files are just with code not even a single comment i.e not at all documented..k??/
now which software will help me out...to know the functions defined in that particular .c file and what all are the called functions, calling functions...what are the input parameters with output parameters.....now reply
|
|
|
|
|
itssheen wrote: what are the input parameters with output parameters.
The link I gave you is to the doxygen system, try reading the documentation to find out what you can and cannot do with it.
itssheen wrote: now reply
Tempted as I am, I wil refrain from responding in kind to this rude ending to your message.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
itssheen wrote: .....now reply
As has been said, this is kinda rude.
But trying to answer your question... Doxygne is not psychic, it is just a tool to extract formatted comments from your code. If those comments don't exist, then you're just going to have to write them!
This is not as bad as it sounds - I had to do the same from scratch to a project, and I found lots of code that could be refactored as I went. I reduced the code size by a good 5%. That means 5% less bugs!
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
Hi,
i am working in console application in VC++(visual studio 2005).
i am having a problem while using CString.
i have mentioned sample code below.
#include "stdafx.h"
#include "server1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
CString str;
str="IP conneted"
printf("%s",str);
cout<<str;
}
return nRetCode;
}
while executing the code..
i get printed only first letter(I) of str.
so please help me..
is there any header or setting should i change in the visual studio environment?
|
|
|
|