LPCSTR lpFuncName;
LPWSTR lpwDllCmdLine;
BOOL bUnregister,bSilent,bConsole,bInstall,bNoRegister;
- UINT nDllCount;
+ UINT nDllCount, fuOldErrorMode;
HMODULE hDll;
DLLREGISTER fnDllRegister;
DLLINSTALL fnDllInstall;
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);
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);