================ Declaration =====================
This article is original, reproduced please maintain the integrity of the article (including this statement), and influential famous author and source.
This article link: http://blog.csdn.net/wlsgzl/article/details/42003487
=========================================
The computer has an SSD and a HHD,SSD only one partition to do the system disk, HHD 4 zones: D, E, F, G. where d drives the engineering code.
Restore the computer, Norton Convulsions, the first division of HHD to restore me ... Is this the rhythm of identifying the wrong hard drive?
=========================================
The result is a small piece of code that hasn't been backed up yet. So according to the previous ideas and write a bit.
So, here's the problem.
=========================================
Happy to look at the code effect, the result encountered a problem.
VS2010 will automatically stop where the problem occurs, which is excellent.
But, sadly, I opened the thread, and the error was the thread function.
void CMainFrame::D ealwithslavedata (LPVOID lpvoid) {//testcmscommwls* pslavecomm= (cmscommwls*) lpvoid; CString Strtempdata; EnterCriticalSection (& (PSLAVECOMM->M_CSDATARECV)); Strtempdata=pslavecomm->m_questrdata.front (); Pslavecomm->m_questrdata.pop (); LeaveCriticalSection (& (PSLAVECOMM->M_CSDATARECV)); OutputDebugString (strtempdata);}
Hit the breakpoint with the variable, found nothing wrong with the look, there is no error pointer.
Then began to search information.
=========================================
Useful tryentercriticalsection version instead of EnterCriticalSection, there are add macros to suppress COM support, there is speculation entercriticalsection nested and then everyone agrees.
Like this problem is to see the specific circumstances to determine, so there are all kinds of online answers, regardless of the true and false reproduced.
Most are not credible.
=========================================
Thought for a long time, I think I have to start with a hint: the most likely exception: 0xC0000005: An access violation occurred while writing to the location 0x00000014.
This position? This position is illegal to write.
There must be a problem writing the address.
Then you can only look at the hands of the LPVOID. There is nothing wrong with the appearance, no fruit.
Where is the next step in the value?
M_tpforslave.start (M_commctrl.m_hsmpdataneedhandle,dealwithslavedata,this);
is the third parameter.
At first glance it's nothing, isn't there? But who is this? It's cmainframe*!. And I have to be cmscomm*!.
The following is a good thing to do, passing in an argument of the specified type or casting the passed-in value to the correct format.
=============== Christmas is coming, but also to feel the deep evil from the great universe. ==================
Problem solving-the most likely exception at 0xXXXXXXXX after using criticalsection: 0xC0000005: Access violation when writing to location 0x00000014