I am building an existing MFC application with Visual Studio 2012. The application uses "RichEdit20A"
controls and custom controls which inherit CRichEditCtrl
.
During InitInstance()
the application calls ::AfxInitRichEdit2()
, which calls AtlLoadSystemLibraryUsingFullPath(L"RICHED20.DLL")
, which callsLoadLibraryExW(pszLibrary, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)
. The latter call fails and returns NULL
. GetLastError()
returns 87 (The parameter is incorrect.). This happens on both Win7 x64 and Win8 x64.
The failing call seems to have been introduced in the Visual Studio 2012 runtime (it is inside a conditional #if NTDDI_VERSION >= NTDDI_WIN8
). The application worked just fine when built with Visual Studio 2008.
Does anyone know why this happens and how to fix (or work around) this issue? Alternatively, is there any way to "revert" the runtime to use the older load behavior?