| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2268 人关注过本帖
标题:程序出现passed to RtlLockHeap 和First-chance exception in Quiver4_19.e ...
只看楼主 加入收藏
tokyo206
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-5-13
收藏
 问题点数:0 回复次数:1 
程序出现passed to RtlLockHeap 和First-chance exception in Quiver4_19.exe (KER
求助]我用VC编写了一个程序,但是发生了不知道的错误,望达人帮忙解决,谢谢

在进行程序编译时出现了下面的错误
1、在将数据接受屏蔽后出现了First-chance exception in Quiver4_19.exe (KERNEL32.DLL): 0xC0000005: Access Violation.的错误
2、在开启数据接受的时候出现了HEAP[Quiver4_19.exe]: Invalid heap signature for heap at 130000, passed to RtlLockHeap
能请高手解答么,谢谢啊

以下是代码

进程函数负责监视
UINT CSerialPort::CommThread(LPVOID pParam)
{
// Cast the void pointer passed to the thread back to
// a pointer of CSerialPort class
CSerialPort *port = (CSerialPort*)pParam;

// Set the status variable in the dialog class to
// TRUE to indicate the thread is running.
port->m_bThreadAlive = TRUE;

// Misc. variables
DWORD BytesTransfered = 0;
DWORD Event = 0;
DWORD CommEvent = 0;
DWORD dwError = 0;
COMSTAT comstat;
unsigned int cnt1=0;
CString strcnt1;
BOOL bResult = TRUE;
//AfxMessageBox("i am in the Thread!");
// Clear comm buffers at startup
if (port->m_hComm) // check if the port is opened
PurgeComm(port->m_hComm, PURGE_RXCLEAR | PURGE_TXCLEAR | PURGE_RXABORT | PURGE_TXABORT);

// begin forever loop. This loop will run as long as the thread is alive.
for (;;)
{
bResult = WaitCommEvent(port->m_hComm, &Event, &port->m_ov);

if (!bResult)
{
// If WaitCommEvent() returns FALSE, process the last error to determin
// the reason..
switch (dwError = GetLastError())
{
case ERROR_IO_PENDING:
{
// This is a normal return value if there are no bytes
// to read at the port.
// Do nothing and continue
break;
}
case 87:
{
// Under Windows NT, this value is returned for some reason.
// I have not investigated why, but it is also a valid reply
// Also do nothing and continue.
break;
}
default:
{
// All other error codes indicate a serious error has
// occured. Process this error.
port->ProcessErrorMessage("WaitCommEvent()");
break;
}
}
}
else
{
bResult = ClearCommError(port->m_hComm, &dwError, &comstat);

if (comstat.cbInQue == 0)
continue;
} // end if bResult
Event = WaitForMultipleObjects(3, port->m_hEventArray, FALSE, INFINITE);//返回有信号事件索引

switch (Event)
{
case 0:
{
// Shutdown event. This is event zero so it will be
// the higest priority and be serviced first.

port->m_bThreadAlive = FALSE;

// 取消此进程
AfxEndThread(100);
break;
}
case 1: // 读串口事件
{
if (CommEvent & EV_RXCHAR)
// 从串口接收字符事件
{
ReceiveChar(port, comstat); //处理事件,传入串口极其状态
cnt1++;
strcnt1.Format("%d",cnt1);
TRACE("Get the EV_RXCHAR EVENT\n");
// AfxMessageBox(strcnt1); //调试
}

break;
}
case 2: // 写串口事件
{
// Write character event from port
WriteChar(port);
break;
}

} // end switch

} // close forever loop

return 0;
}
处理函数
ReceiveChar()处理消息
void CSerialPort::ReceiveChar(CSerialPort* port, COMSTAT comstat)
{
BOOL bRead = TRUE;
BOOL bResult = TRUE;
DWORD dwError = 0;
DWORD BytesRead = 0;
unsigned int cnt=0;
unsigned char RXBuff;

for (;;)
{
EnterCriticalSection(&port->m_csCommunicationSync);

// ClearCommError() will update the COMSTAT structure and
// clear any other errors.

bResult = ClearCommError(port->m_hComm, &dwError, &comstat);

LeaveCriticalSection(&port->m_csCommunicationSync);
if (comstat.cbInQue == 0)
{
// break out when all bytes have been read
break;
}

EnterCriticalSection(&port->m_csCommunicationSync);

if (bRead)
{
bResult = ReadFile(port->m_hComm, // Handle to COMM port
&RXBuff, // RX Buffer Pointer
1, // Read one byte
&BytesRead, // Stores number of bytes read
&port->m_ov); // pointer to the m_ov structure
// deal with the error code
if (!bResult)
{
switch (dwError = GetLastError())
{
case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
// Proceed on to GetOverlappedResults();
bRead = FALSE;
break;
}
default:
{
// Another error has occured. Process this error.
port->ProcessErrorMessage("ReadFile()");
break;
}
}
}
else
{
// ReadFile() returned complete. It is not necessary to call GetOverlappedResults()
bRead = TRUE;
}
} // close if (bRead)

if (!bRead)
{
bRead = TRUE;
bResult = GetOverlappedResult(port->m_hComm, // Handle to COMM port
&port->m_ov, // Overlapped structure
&BytesRead, // Stores number of bytes read
TRUE); // Wait flag

// deal with the error code
if (!bResult)
{
port->ProcessErrorMessage("GetOverlappedResults() in ReadFile()");
}
} // close if (!bRead)

LeaveCriticalSection(&port->m_csCommunicationSync);
TRACE("I am in ReciveChar Function!\n");
// notify parent that a byte was received
::SendMessage((port->m_pOwner)->m_hWnd, WM_COMM_RXCHAR, (WPARAM) RXBuff, (LPARAM) port->m_nPortNr);

CString strcnt;
cnt++;
strcnt.Format("%d",cnt);
//AfxMessageBox(strcnt); //调试
} // end forever loop

}



响应的消息函数LONG CQuiver4_19Dlg::OnRecive(WPARAM wParam,LPARAM lParam)
{
unsigned int ser_ch;

ser_ch=wParam;
tempcnt++;
CString temp_message;
temp_message.Format("%d",tempcnt);

switch(RCnt) //接收数据(当屏蔽时发出第一个错误)
{
case 0:
if(ser_ch==255) RCnt++;TRACE("THE NUMBER 1\n");return 0;
case 5:
ser_buff[WriteCnt*5+RCnt-1]=ser_ch;RCnt=0;
WriteCnt++;if(WriteCnt>818) WriteCnt=0;TRACE("THE NUMBER 2\n");return 0;
default:
ser_buff[WriteCnt*5+RCnt-1]=ser_ch;RCnt++;TRACE("THE NUMBER 3\n");return 0;
}

return 0;
}

搜索更多相关主题的帖子: exception RtlLockHeap passed KER 
2006-05-13 15:36
tokyo206
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-5-13
收藏
得分:0 
下面是我进行程序调试追踪的信息,是一个串口接收数据的程序
Loaded 'C:\WINNT\system32\ntdll.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\MFC42D.DLL'
Loaded symbols for 'C:\WINNT\system32\MSVCRTD.DLL'
Loaded 'C:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\GDI32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\USER32.DLL', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\MFCO42D.DLL'
Loaded 'C:\WINNT\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\ADVAPI32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\HookDll.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\mfc42loc.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\indicdll.dll', no matching symbolic information found.
Initialisation for communicationport 1 completed.
Use Startmonitor to communicate.
Thread started
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
I am in ReciveChar Function!and count is:0
THE NUMBER 1:255
I am in ReciveChar Function!and count is:1
THE NUMBER 3:76
I am in ReciveChar Function!and count is:2
THE NUMBER 3:76
I am in ReciveChar Function!and count is:3
THE NUMBER 3:76
I am in ReciveChar Function!and count is:4
THE NUMBER 3:76
I am in ReciveChar Function!and count is:5
THE NUMBER 2:48
Get the EV_RXCHAR EVENT
Get the EV_RXCHAR EVENT
HEAP[Quiver4_19.exe]: Invalid heap signature for heap at 130000, passed to RtlLockHeap
2006-05-13 15:40
快速回复:程序出现passed to RtlLockHeap 和First-chance exception in Quiver4 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.072133 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved