[REGSVR32] Disable error message boxes while loading a dll. CORE-12209

svn path=/trunk/; revision=73077
This commit is contained in:
Mark Jansen 2016-10-30 11:50:10 +00:00
parent 6acbbeddf8
commit 082463978d

View file

@ -258,7 +258,7 @@ int WINAPI _tWinMain(
LPCSTR lpFuncName;
LPWSTR lpwDllCmdLine;
BOOL bUnregister,bSilent,bConsole,bInstall,bNoRegister;
UINT nDllCount;
UINT nDllCount, fuOldErrorMode;
HMODULE hDll;
DLLREGISTER fnDllRegister;
DLLINSTALL fnDllInstall;
@ -386,9 +386,11 @@ int WINAPI _tWinMain(
if (*argv[i] != _T('/')) {
lptDllName = argv[i];
fuOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
// Everything is all setup, so load the dll now
hDll = LoadLibraryEx(lptDllName,0,LOAD_WITH_ALTERED_SEARCH_PATH);
if (hDll) {
SetErrorMode(fuOldErrorMode);
if (!bNoRegister) {
// Get the address of DllRegisterServer or DllUnregisterServer
fnDllRegister = (DLLREGISTER)GetProcAddress(hDll,lpFuncName);
@ -463,6 +465,7 @@ int WINAPI _tWinMain(
else {
// The dll could not be loaded; display an error message
dwErr = GetLastError();
SetErrorMode(fuOldErrorMode);
lptMsgBuffer = (LPTSTR)malloc((_tcslen(DllNotLoaded) + 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer,DllNotLoaded,lptDllName,dwErr);
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);