Software compiled in Visual Studio 6 that runs on Windows 7 crashing on memory read error in Windows 10

We have a button in our UI that pulls history to a modal. Whenever you click on this button now, in any of our builds , specifically on Windows 10 , the RAM usage surges and the program crashes immediately. Note that this is ONLY happening on Windows 10. Works fine on XP and 7 .

LV_COLUMN lvColumn;
lvColumn.fmt = LVCFMT_CENTER; = 550;
lvColumn.iSubItem = 0;
lvColumn.pszText = "Description";
m_rcpHistList.InsertColumn(0, &lvColumn);

From the above snippet I want to show you what is happening to the variable m_rcpHistList which is a CListCtrl object

LV_ITEM lvItem;
lvItem.state = 0;      
lvItem.stateMask = 0;  
int ItmIndx = m_rcpHistList.GetItemCount();
    lvItem.iItem = ItmIndx;
    lvItem.iSubItem = 0;
    m_rcpHistList.SetItemText(ItmIndx, 0, stReadBuf);

Here is the bottom of the function where the error is happening specifically on the line that is commented out on the InsertItem function call

When you step over that statement you get an Application error saying

the instruction at 0x000000076e4adds referenced memory at 0x000000000000001. The memory could not be read

Been trying to untangle this for about two weeks now . Any help or guidance would be greatly appreciated

1 answer

  • answered 2022-04-11 20:07 Omar Aziz

    The problem seems to be that there is a bug . I solved the problem by editing

    LV_ITEM lvItem;

    and changing it to LV_ITEM lvItem = {0};

    The problem lies in Paul McKenzie and WhozCraigs' answers

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum