0xE06D7363 EXCEPTION
0xE06D7363
Visual C++ exception
The SEH exception used by the c++ try/catch/throw mechanism in Visual C++
what does this exception mean. ?
i am getting this error for the folllowing
CString Mac;
Mac.Format("%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0]
,pAdapter->Address[1] ,pAdapter->Address[2],pAdapter->Address[3],
pAdapter->Address[4],pAdapter->Address[5]);
i get this error only in WinXP, the code works fine for
win 98.
how to handle this exception
[554 byte] By [
Dhiru] at [2007-11-18 22:16:36]

# 1 Re: 0xE06D7363 EXCEPTION
0xE06D7363
Visual C++ exception
The SEH exception used by the c++ try/catch/throw mechanism in Visual C++
what does this exception mean. ?
i am getting this error for the folllowing
CString Mac;
Mac.Format("%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0]
,pAdapter->Address[1] ,pAdapter->Address[2],pAdapter->Address[3],
pAdapter->Address[4],pAdapter->Address[5]);
i get this error only in WinXP, the code works fine for
win 98.
Maybe you always had the error, and now it is exposed when you run your program using Windows XP.
Also, we don't know
1) if pAdapter is valid
2) whether Address really has at least 6 elements,
3) whether pAdapter->Address[x] is the correct type for the format "%x",
4) whether you've caused some sort of memory corruption in some other part of your code and it is affecting the way Format() works.
In other words, the code you posted is not really going to help in solving the problem (posting code that shows no problem isn't that helpful).
Unless you are willing to give us the entire project, you will have to solve this yourself. Why not use the debugger before you reach that line and inspect the values for pAdapter, Address, etc.?
how to handle this exception
You handle it by fixing your code.
Regards,
Paul McKenzie
# 2 Re: 0xE06D7363 EXCEPTION
heres the code..
if((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR) {
pAdapter = pAdapterInfo;
while (pAdapter) {
/*CString Mac,Descp;
CString Ip,IpMask,Gateway;
Mac = Descp = "";
Ip = IpMask = Gateway = "";
Mac.Format("%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0], \
pAdapter->Address[1] \
,pAdapter->Address[2],pAdapter->Address[3] \
,pAdapter->Address[4],pAdapter->Address[5]);
//Gateway = pAdapter->GatewayList.IpAddress.String;
//Descp = pAdapter->Description;
*/
char Mac[17],IpAddr[16],IpMask[16],Descp[256];
sprintf(Mac,"%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0], \
pAdapter->Address[1] \
,pAdapter->Address[2],pAdapter->Address[3] \
,pAdapter->Address[4],pAdapter->Address[5]);
sprintf(IpAddr,"%s",pAdapter->IpAddressList.IpAddress.String);
sprintf(IpMask,"%s",pAdapter->IpAddressList.IpMask.String);
sprintf(Descp,"%s",pAdapter->Description);
SetAdapterParams(Mac,IpAddr,IpMask,Descp);
pAdapter = pAdapter->Next;
} // while
}//if
*******************
now in XP the the code that has beeb commented out is the code... that is
causing this exceoption... this code using CString works fine with win 98.
aslo after debugging i found out the problem with CString, it throws an exception at this code
int AFX_CDECL AfxNewHandler(size_t /* nSize */)
{
AfxThrowMemoryException();
return 0;
}
void AFXAPI AfxThrowMemoryException()
{
THROW(&_simpleMemoryException);
}
this is happening with any CString that i use in that part of the code.
i guess it has do with allocating a buffer space or some memory.
whats the solution to this. how do i handle this. why dont i get this error
in win98. as u see i have to use arrays instead. does this mean that i'll have to change
everthing from Cstring to arrays...?
Dhiru at 2007-11-11 1:05:26 >

# 3 Re: 0xE06D7363 EXCEPTION
whats the solution to this. how do i handle this.The code you posted still doesn't show how pAdapterInfo is declared and how you allocate memory for it. If it is an invalid pointer, it is obvious that you get an exception sooner or later - either during the call to GetAdaptersInfo(), or later in CString::Format(), when you try to access the buffer elements. So please post the code which shows how pAdapterInfo is created (and please use code tags when posting code).
why dont i get this error
in win98. Because Win98's memory checking is less strict than on the NT based systems (Win2K and XP). An additional reason might be the arbitrary memory constellation your code finds when it uses an uninitialized pointer - under Win98, that pointer might incidentally point to some area of memory that your app owns. So while it is still overwriting the wrong memory under Win98 (most likely causing your app to behave strangely), the OS doesn't detect this error and hence doesn't throw the exception. However, as Paul said: The bug is there, and you're lucky that WinXP told you so, while Win98 let it pass by undetected.
as u see i have to use arrays instead. does this mean that i'll have to change everthing from Cstring to arrays...? :confused:
# 4 Re: 0xE06D7363 EXCEPTION
heres the entire code...i get the error for the CString Mac1, and Mac which is commented out. please let me know the error in code.
// abc.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iphlpapi.h>
#include "abc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#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
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
CheckAdapters();
}
return nRetCode;
}
void CheckAdapters(){
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO));
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW){
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
}
if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR){
pAdapter = pAdapterInfo;
while(pAdapterInfo){
printf("\n\tDes = %s",pAdapter->Description);
CString Mac1;
try{
Mac1 = "catchme";
}
catch(CMemoryException *Ex){
DWORD retVal = GetLastError();
printf("\nError...%d",retVal);
getchar();
}
/*CString Mac;
Mac.Format("%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0],\
pAdapter->Address[1] ,pAdapter->Address[2],pAdapter->Address[3] \
,pAdapter->Address[4],pAdapter->Address[5]); */
pAdapter = pAdapter->Next;
} // while
}//if
else {
printf("Call to GetAdaptersInfo failed...%d\n",GetLastError());
}
getchar();
}
Dhiru at 2007-11-11 1:07:22 >

# 5 Re: 0xE06D7363 EXCEPTION
Well, just looking at your code:
if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR){
pAdapter = pAdapterInfo;
while(pAdapterInfo){
printf("\n\tDes = %s",pAdapter->Description);
CString Mac1;
try{
Mac1 = "catchme";
}
catch(CMemoryException *Ex){
DWORD retVal = GetLastError();
printf("\nError...%d",retVal);
getchar();
}
/*CString Mac;
Mac.Format("%02x-%02x-%02x-%02x-%02x-%02x",pAdapter->Address[0],\
pAdapter->Address[1] ,pAdapter->Address[2],pAdapter->Address[3] \
,pAdapter->Address[4],pAdapter->Address[5]); */
pAdapter = pAdapter->Next;
} // while
}//if
There are some things that *might* be wrong:
CString Mac1;
try
{
Mac1 = "catchme";
}
catch(CMemoryException *Ex)
{
DWORD retVal = GetLastError();
printf("\nError...%d",retVal);
getchar();
}
You are declaring a CString variable every time in the while...
I should declare it once before the while...
The same is for the MAC thing...
Try if that helps.
By the way: why are you not doing anything with these strings... Why fill them if they are useless?
# 6 Re: 0xE06D7363 EXCEPTION
Well, the allocation of the IP_ADAPTER_INFO structure is fine (although there is no need to use malloc - you could just at well create it locally on the stack. In fact, you fail to free the memory again). But that's not your real problem.
A thing which is definitely wrong is your while condition:while(pAdapterInfo)It should rather be while(pAdapter)since pAdapterInfo never changes in your loop. This leads to to an infinite loop, causing GetAdapterInfo() to be called at some time without a valid next pointer, which explains the crash.
And just another thing to watch out for:
(From MSDN): Windows Server 2003 and Windows XP: Use the GetAdaptersAddresses function instead of GetAdaptersInfo.
# 7 Re: 0xE06D7363 EXCEPTION
You are declaring a CString variable every time in the while...
I should declare it once before the while...So what? There is nothing wrong with declaring the CString object inside the loop.
# 8 Re: 0xE06D7363 EXCEPTION
ok i tried out a few things
void CheckAdapters(){
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO));
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW){
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
}
CString Mac1 ;
if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR){
pAdapter = pAdapterInfo;
while(pAdapter){
try{
Mac1 = "catchme";
}
catch(CMemoryException *Ex){
DWORD retVal = GetLastError();
printf("\nError...%d",retVal);
getchar();
}
pAdapter = pAdapter->Next;
} // while
}//if
else {
printf("Call to GetAdaptersInfo failed...%d\n",GetLastError());
}
getchar();
}
if u see the declaration just before the Second call to GetAdaptersInfo.
even if i declare it there, it still generates an Exception.
then i tried this...
i had the CString definition before the Second call to GetAdaptersInfo;
if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW){
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
}
CString Mac1 = "abc";
if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR){
pAdapter = pAdapterInfo;
while(pAdapter){
but it still generates and Exception...
then i did this...
i moved this definition to the Top of the FIRST GetAdpaters call
CString Mac1 = "abc";
if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW){
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
}
if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR){
pAdapter = pAdapterInfo;
while(pAdapter){
the program works fine.
but it still doesnt work if i were to declare it there.
the program works only if i were to define any variable before the First Call to GetAdaptersInfo.
has this got any thing to do with GetAdapterInfo function ??
why do i have to define the variables before the first call...
why doent the compiler allocate memeory within the while loop..
i guess its bad programming, pls correct me
Dhiru at 2007-11-11 1:11:30 >

# 9 Re: 0xE06D7363 EXCEPTION
Moving around a variable isn't what the problem is. All you're really doing is creating a new executable file, and just moving the bug to another place.
Why not just comment out the GetAdaptersInfo function? You will see that the error has nothing to do with where the CString is located, and the problem is that you are not using the GetAdaptersInfo function correctly, or you are assuming that it works correctly when it isn't working.
Regards,
Paul McKenzie
# 10 Re: 0xE06D7363 EXCEPTION
As a matter of fact, what do you think this line does?
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
It does not allocate ulOutBufLen bytes. It allocates 4 bytes, since sizeof(ulOutBufLen) is 4. What you want to do is this:
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(ulOutBufLen);
So your program is not working on Windows 98. It has a memory overwrite error, and you are just lucky that the Win98 version hasn't crashed (yet).
Regards,
Paul McKenzie
# 11 Re: 0xE06D7363 EXCEPTION
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(ulOutBufLen));
OOps, completely overlooked that one... :cool: