From f2ed2a1f6db7eea018e07eeaef5747eb4e9f0a35 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 2 Feb 2013 15:35:23 +0000 Subject: - Do not load plugin when a fatal error occures - fixed error on CreateDirTree (fixes #208) git-svn-id: http://svn.miranda-ng.org/main/trunk@3394 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HTTPServer/src/main.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 68eca1ea7a..561218666a 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -879,50 +879,51 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections); if (! hHttpAcceptConnectionsService) { MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare); if (! hHttpAddChangeRemoveService) { MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare); if (! hHttpGetShareService) { MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_SHARE"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares); if (! hHttpGetAllShares) { MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); if (!hEventSystemInit) { MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_MODULESLOADED"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); if (!hPreShutdown) { MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_PRESHUTDOWN"), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } if(CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)szPluginPath)) { MessageBox(NULL, _T("Failed to retrieve plugin path."), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } - _tcscat(szPluginPath,_T("\\HTTPServer\\")); - if(CreateDirectoryTree(szPluginPath)) + _tcsncat(szPluginPath,_T("\\HTTPServer\\"), MAX_PATH); + int err = CreateDirectoryTree(szPluginPath) + if((err != 0) && (err != ERROR_ALREADY_EXISTS)) { MessageBox(NULL, _T("Failed to create HTTPServer directory."), MSG_BOX_TITEL, MB_OK); - return 0; + return 1; } nPluginPathLen = strlen(szPluginPath); -- cgit v1.2.3