Omar Aziz
Omar Aziz

Reputation: 19

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.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvColumn.fmt = LVCFMT_CENTER;
lvColumn.cx = 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.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvItem.state = 0;      
lvItem.stateMask = 0;  
int ItmIndx = m_rcpHistList.GetItemCount();
while(OldFile.ReadString(stReadBuf))
{
    lvItem.iItem = ItmIndx;
    lvItem.iSubItem = 0;
    //m_rcpHistList.InsertItem(&lvItem);
    m_rcpHistList.SetItemText(ItmIndx, 0, stReadBuf);
    ItmIndx++;
}
OldFile.Close();

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

Upvotes: 0

Views: 99

Answers (1)

Omar Aziz
Omar Aziz

Reputation: 19

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

Upvotes: 1

Related Questions