Click here to Skip to main content
16,004,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalconsole app w/ActiveX control Pin
sbeausol11-Apr-04 14:21
sbeausol11-Apr-04 14:21 
GeneralHelp->Communication between "frames" in a window. Pin
Victor Nikol11-Apr-04 14:20
Victor Nikol11-Apr-04 14:20 
GeneralCreating Animated GIFS Pin
DanYELL11-Apr-04 12:34
DanYELL11-Apr-04 12:34 
GeneralRe: Creating Animated GIFS Pin
l a u r e n11-Apr-04 17:54
l a u r e n11-Apr-04 17:54 
GeneralRetrieving image from Clipboard Pin
Anonymous11-Apr-04 10:31
Anonymous11-Apr-04 10:31 
GeneralRe: Retrieving image from Clipboard Pin
Anonymous11-Apr-04 10:32
Anonymous11-Apr-04 10:32 
GeneralRe: Retrieving image from Clipboard Pin
Ravi Bhavnani11-Apr-04 11:33
professionalRavi Bhavnani11-Apr-04 11:33 
GeneralIphlpapi and Divide by Zero Exception Pin
User 1278211-Apr-04 9:40
User 1278211-Apr-04 9:40 
I have the following code in a preferences dialog in an MFC app, which isn't always called, and looks like this:

PIP_ADAPTER_INFO    pAdapterInfo;
PIP_ADAPTER_INFO    pAdapter        =NULL;
DWORD               dwReturn        =0;

pAdapterInfo=(IP_ADAPTER_INFO*)malloc(sizeof(IP_ADAPTER_INFO));
ULONG ulOutLen=sizeof(IP_ADAPTER_INFO);

if(GetAdaptersInfo(pAdapterInfo,&ulOutLen)==ERROR_BUFFER_OVERFLOW)
{
    GlobalFree(pAdapterInfo);
    pAdapterInfo=(IP_ADAPTER_INFO*)malloc(sizeof(ulOutLen));
}

if((dwReturn=GetAdaptersInfo(pAdapterInfo,&ulOutLen))==NO_ERROR)
{
    pAdapter=pAdapterInfo;
    while(pAdapter)
    {
        //do something with pAdapter

        pAdapter=pAdapter->Next;
    }
}

The first time I run the executable after compile, I get this error:

The exception Integer division by zero.
(0xc0000094) occurred in the application at location 0x0040124d

Everything after that I run the same executable, the program runs fine, and the code in question works fine. But when I close the app, I get this error about three times:

The instruction at "0xSOMEADDRESs" referenced memory at "0x00000000".  The memory could not be "read".


I've tried commenting out various bits of the code to see which line causes the problem, but I can't find anything consist.


Any idea what's wrong or what I could do?

Thanks,
Aaron Stubbendieck

modified 12-Jul-20 21:01pm.

GeneralRe: Iphlpapi and Divide by Zero Exception Pin
Antti Keskinen11-Apr-04 11:36
Antti Keskinen11-Apr-04 11:36 
GeneralRe: Iphlpapi and Divide by Zero Exception Pin
User 1278213-Apr-04 11:11
User 1278213-Apr-04 11:11 
Generalclistctrl row hilight Pin
r00k1311-Apr-04 9:25
r00k1311-Apr-04 9:25 
GeneralRe: clistctrl row hilight Pin
Anonymous11-Apr-04 12:11
Anonymous11-Apr-04 12:11 
GeneralRe: clistctrl row hilight Pin
r00k1311-Apr-04 12:53
r00k1311-Apr-04 12:53 
GeneralRe: clistctrl row hilight Pin
Anonymous11-Apr-04 15:29
Anonymous11-Apr-04 15:29 
GeneralRe: clistctrl row hilight Pin
r00k1311-Apr-04 17:37
r00k1311-Apr-04 17:37 
GeneralRe: clistctrl row hilight Pin
Chris Richardson11-Apr-04 19:48
Chris Richardson11-Apr-04 19:48 
GeneralSecurity issue Pin
tank102511-Apr-04 6:55
tank102511-Apr-04 6:55 
GeneralRe: Security issue Pin
toxcct11-Apr-04 22:08
toxcct11-Apr-04 22:08 
GeneralSimple mathematical equations and graphs Pin
shanhotmale11-Apr-04 5:58
shanhotmale11-Apr-04 5:58 
GeneralRe: Simple mathematical equations and graphs Pin
Ravi Bhavnani11-Apr-04 6:23
professionalRavi Bhavnani11-Apr-04 6:23 
GeneralRe: Simple mathematical equations and graphs Pin
calius11-Apr-04 6:29
calius11-Apr-04 6:29 
GeneralRe: Simple mathematical equations and graphs Pin
toxcct11-Apr-04 22:06
toxcct11-Apr-04 22:06 
GeneralRe: Simple mathematical equations and graphs Pin
John R. Shaw11-Apr-04 23:45
John R. Shaw11-Apr-04 23:45 
GeneralHiding my menu bar Pin
yanuart11-Apr-04 5:57
yanuart11-Apr-04 5:57 
GeneralRe: Hiding my menu bar Pin
Ravi Bhavnani11-Apr-04 6:25
professionalRavi Bhavnani11-Apr-04 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.