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