Today’s blog post was written to help you if you get a processshell access violation error.

processshellcommand access violation

When migrating from Win7 + VS2015 to Win10 + VS2017, most of our legacy MFC tools are facing the following issues:

from afxwin.h: CWnd * m_pMainWnd; // main window (usually the same AfxGetApp () -> m_pMainWnd)

  CSingleDocTemplate * pDocTemplate;pDocTemplate = new CSingleDocTemplate (    IDR_MAINFRAME,    RUNTIME_CLASS (CIFX_LogViewDoc),    RUNTIME_CLASS (CMainFrame), // SDI Main Frame Window    RUNTIME_CLASS (CIFX_LogViewView));AddDocTemplate (pDocTemplate);// Analysis command for standard line coverage commands, DDE, open fileCCommandLineInfo cmdInfo;ParseCommandLine (cmdInfo);// Shipping orders given on the direction lineif (! ProcessShellCommand (cmdInfo)) // -> "Access is considered denied"    false return;// The only window seemed to be initialized, so it was updated in the living room and kitchen.m_pMainWnd-> ShowWindow (SW_SHOW);m_pMainWnd-> UpdateWindow ();Returns TRUE; 

I’ve also tried calling ShowWindow () + UpdateWindow () before parsing the command line, mainly because it was suggested here:, but the site doesn’t work:

  Exception thrown 0x58198F2E (mfc140d.dll) from A.exe: 0xC0000005: read accessRoom violation 0x00000020. happened in -> m_pMainWnd-> ShowWindow (SW_SHOW); 

My MFC Apps Marketplace starts with:
“Unhandled exception. At 0x7823eafb (mfc80d.dll). At MyApp.exe.” Access 0xc0000005: Violation sees location 0xfdfe3f55. ”

I need help figuring out why this is happening, as well as some tips on how to find / fix the problem. This worked until I converted VC ++ 6 to Visual Studio 2005, but is now overlooked in both IDEs.

The error sometimes occurs when starting MyApp when Processshellcommand () is marked as InitInstance (). The home cmdinfo sends a FileNew command with the actual empty document name and the platform gets to work creating the document and view (SDIDoc app). Debugging shows that the error occurs in every part where the framework starts building the main window. In particular, it seems that while the person is in the window, the referenced handle cannot be retrieved.

A small stack looks like this:
– mfc80d.dll! CMapPtrToPtr :: G etValueAt ( void key = 0x000a05c4) * line 188 + 0x9 bytes
– mfc80d. * dll! chandlemap :: loo kuppermane nt (void h = 0x000a05c4) line 114 + 0x16 bytes
– mfc80d.dll! CWnd :: FromHandl ePermanent (HWND__ HWnd = 0x000a05c4) * line 321 + byte 0xc
– mfc80d.dll! _AfxCbtFilterHo ok (int code = 3, unsigned int wParam = 656836, long lParam = 1241572) string + 525 0x9 bytes
<< a series of calls that can remove user32.dll and ntdll.Dll here for brevity >>
– mfc80d.dll! AfxCtxCreateWin dowExA (uns igned long dwExStyle = 512, const char 6.lpClassName = 0x006a1800, const char 3.lpWindowName = 0x0035043w644,5w = 0x00 = int long X = 238, int Y = 0, int nWidth = 923, int nHeight = 1022, HWND__ * hWndParent = 0x00000000, HMENU__ * hMenu = 0x008f02e3, HINSTANCE__ * hInstance = 0x00400000, void * lpParam9. = 0x0012 bytes- mfc80d.dll! CWnd :: CreateEx ( unsigned indeed dwExStyle = 0, const char * lpszClassName = 0x00000000, const char * lpszWindowName = 0x003acf20, unsigned total wStyle = 13598, int x = -2147483648 , int y = -2147483648, int nWidth = -2147483648, int nHeight = -2147483648, HWND__ * hWndParent = 0x00000000, HMENU__ * nIDorHMenu = 0x008f02e3, void * = br 0x0012Parax- mfc80d.dll! CFrameWnd :: Crea te (const char 3.lpszClassName = 0x00000000, const char (empty) lpszWindowName = 0x003acf20, unsigned long dwStyle = 13598720, tagRECT const & rect =. .., CWnd * const pParentWnd = 0x00000000, char (empty) lpszMenuName = 0x00000080, unsigned long dwExStyle = 0, CCreateContext 6.pContext = 0x0012f9c8) string 560 + 0x54 bytes
– mfc80d.dll! CFrameWnd :: Load frame (unsi gned int nIDResource = 128, unsigned long CWnd dwDefaultStyle = 13598720, * pParentWnd = 0x00000000, CCreateContext 3.pContext = 0x0012f9) Line 692 + 0 x 35 bytes
– mfc80d.dll! CDocTemplate :: C reateNewFr ame (CDocum ent 1.pDoc = 0x01450040, CFrameWnd * pOther = 0x00000000) line 277 0x22 + byte
– mfc80d.dll! CSingleDocTempl ate :: OpenD ocumentFil e (const char 1.lpszPathName = 0x00000000, int bMakeVisible = 1) line 120 + 0x13 bytes mfc80d < br>-.dll! CDocManager :: In FileNew () line 848
– mfc80d.dll! CWinApp :: OnFile New () line 22
– mfc80d.dll! CWinApp :: Proces shellComm and (CComma ndLineInfo & rCmdInfo = …) Line 26

The actual exception is thrown in CMapPtrToPtr :: GetValue in the for loop. GetValue () shows how:

void * CMapPtrToPtr :: GetValueAt (v oid * key) const
// matches the value (or returns NULL – NULL values ​​are no different as a huge result)

// see if there is a
CAssoc * pAssoc;
for (pAssoc matches m_pHashTable [nHash]; pAssoc! = NULL; pAssoc = pAssoc-> pNext) // <--- *** An error is required here *** “Returns the value pAssoc->;

Returns NULL;

The most common value associated with m_pHashTable is 0xFDFDFDFD. Isn’t this note used in long general tea?
m_nHasTableSize is also 0xFDFDFDFD (4261281277), and the result is nHash 36950. It’s as if the hash table is usually invalid at this point, leading to an error.

Due to the transition from Win7 + VS2015 to Win10 + VS2017 we only have the following problems in our old MFC tool:

from afxwin.h: CWnd * m_pMainWnd; // main window of the house (usually the same) AfxGetApp () -> m_pMainWnd)

  CSingleDocTemplate * pDocTemplate;pDocTemplate corresponds to the new CSingleDocTemplate (    IDR_MAINFRAME,    RUNTIME_CLASS (CIFX_LogViewDoc),    RUNTIME_CLASS (CMainFrame), // main window of SDI box    RUNTIME_CLASS (CIFX_LogViewView));AddDocTemplate (pDocTemplate);// Connection analysis command Standard shell commands, DDE, open fileCCommandLineInfo cmdInfo;ParseCommandLine (cmdInfo);// Send the commands specified in all command linesif (! ProcessShellCommand (cmdInfo)) // -> "Access is considered denied"    return FALSE;// The only window frame is initialized, so display it but update it.m_pMainWnd-> ShowWindow (SW_SHOW);m_pMainWnd-> UpdateWindow ();Returns TRUE; 

I also tried calling ShowWindow () + UpdateWindow () before parsing the Acquire string like this suggested just doesn’t work:

processshellcommand access violation

  Exception on completion 0x58198F2E (mfc140d.dll) in A.exe: 0xC0000005: Search AccessPlace of injury 0x00000020. happened -> in m_pMainWnd-> ShowWindow (SW_SHOW);