From 0aafc6c4b2e485f5ee9bb0bdf3e687525859cb03 Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Sat, 14 Jan 2012 19:18:42 +0000 Subject: HTTPServer (patch from FREAK_THEMIGHTY): code cleanup header reorganisation MM_INTERFACE support new langpacks support rather technical changes git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@258 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- HTTPServer/AggressiveOptimize.h | 66 ------- HTTPServer/FileShareNode.cpp | 12 -- HTTPServer/FileShareNode.h | 2 +- HTTPServer/Glob.h | 33 +++- HTTPServer/GuiElements.cpp | 158 +++++---------- HTTPServer/GuiElements.h | 2 +- HTTPServer/HTTPServer_10.vcxproj | 235 +++++++++++++++++++++++ HTTPServer/HTTPServer_10.vcxproj.filters | 82 ++++++++ HTTPServer/HttpUser.cpp | 30 +-- HTTPServer/HttpUser.h | 2 +- HTTPServer/IndexCreation.h | 2 +- HTTPServer/IndexHTML.cpp | 28 ++- HTTPServer/IndexXML.cpp | 31 ++- HTTPServer/MimeHandling.cpp | 9 +- HTTPServer/MimeHandling.h | 82 ++++---- HTTPServer/data/HTTPServerIndex.html | 117 ++++++++---- HTTPServer/data/htdocs/@settings/index.xsl | 297 ++++++++++++++++++----------- HTTPServer/main.cpp | 126 ++++-------- 18 files changed, 781 insertions(+), 533 deletions(-) delete mode 100644 HTTPServer/AggressiveOptimize.h create mode 100644 HTTPServer/HTTPServer_10.vcxproj create mode 100644 HTTPServer/HTTPServer_10.vcxproj.filters diff --git a/HTTPServer/AggressiveOptimize.h b/HTTPServer/AggressiveOptimize.h deleted file mode 100644 index fab80a1..0000000 --- a/HTTPServer/AggressiveOptimize.h +++ /dev/null @@ -1,66 +0,0 @@ - -////////////////////////////// -// Version 1.10 -// Jan 23rd, 2000 -// Version 1.00 -// May 20th, 1999 -// Todd C. Wilson, Fresh Ground Software -// (todd@nopcode.com) -// This header file will kick in settings for Visual C++ 5 and 6 that will (usually) -// result in smaller exe's. -// The "trick" is to tell the compiler to not pad out the function calls; this is done -// by not using the /O1 or /O2 option - if you do, you implicitly use /Gy, which pads -// out each and every function call. In one single 500k dll, I managed to cut out 120k -// by this alone! -// The other two "tricks" are telling the Linker to merge all data-type segments together -// in the exe file. The relocation, read-only (constants) data, and code section (.text) -// sections can almost always be merged. Each section merged can save 4k in exe space, -// since each section is padded out to 4k chunks. This is very noticable with smaller -// exes, since you could have only 700 bytes of data, 300 bytes of code, 94 bytes of -// strings - padded out, this could be 12k of runtime, for 1094 bytes of stuff! -// Note that if you're using MFC static or some other 3rd party libs, you may get poor -// results with merging the readonly (.rdata) section - the exe may grow larger. -// To use this feature, define _MERGE_DATA_ in your project or before this header is used. -// With Visual C++ 5, the program uses a file alignement of 512 bytes, which results -// in a small exe. Under VC6, the program instead uses 4k, which is the same as the -// section size. The reason (from what I understand) is that 4k is the chunk size of -// the virtual memory manager, and that WinAlign (an end-user tuning tool for Win98) -// will re-align the programs on this boundary. The problem with this is that all of -// Microsoft's system exes and dlls are not tuned like this, and using 4k causes serious -// exe bloat. Very noticable for smaller programs. -// The "trick" for this is to use the undocumented FILEALIGN linker parm to change the -// padding from 4k to 1/2k, which results in a much smaller exe - anywhere from 20%-75% -// depending on the size. - - -#ifdef NDEBUG - -#if _MSC_VER <= 1200 -// /Og (global optimizations), /Os (favor small code), /Oy (no frame pointers) -//#pragma optimize("gsy",on) -#pragma optimize("g",on) -#pragma optimize("s",on) -#pragma optimize("y",on) - -#pragma comment(linker,"/RELEASE") - - -// Note that merging the .rdata section will result in LARGER exe's if you using -// MFC (esp. static link). If this is desirable, define _MERGE_RDATA_ in your project. -#ifdef _MERGE_RDATA_ -#pragma comment(linker,"/merge:.rdata=.data") -#endif // _MERGE_RDATA_ - -#pragma comment(linker,"/merge:.text=.data") -#pragma comment(linker,"/merge:.reloc=.data") - - -#if _MSC_VER >= 1000 -// Only supported/needed with VC6; VC5 already does 0x200 for release builds. -// Totally undocumented! And if you set it lower than 512 bytes, the program crashes. -// Either leave at 0x200 or 0x1000 -#pragma comment(linker,"/FILEALIGN:0x200") -#endif // _MSC_VER >= 1000 -#endif // _MSC_VER < 1200 - -#endif // NDEBUG diff --git a/HTTPServer/FileShareNode.cpp b/HTTPServer/FileShareNode.cpp index ede135a..e38cb39 100644 --- a/HTTPServer/FileShareNode.cpp +++ b/HTTPServer/FileShareNode.cpp @@ -15,21 +15,9 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif - #include "FileShareNode.h" -#include "Glob.h" #include "GuiElements.h" -#include - -#pragma warning( push, 3 ) -#include "newpluginapi.h" -#include "m_netlib.h" -#pragma warning( pop ) - CLFileShareNode * pclFirstNode = NULL; CRITICAL_SECTION csFileShareListAccess; diff --git a/HTTPServer/FileShareNode.h b/HTTPServer/FileShareNode.h index 706a31f..634b4ef 100644 --- a/HTTPServer/FileShareNode.h +++ b/HTTPServer/FileShareNode.h @@ -18,7 +18,7 @@ #ifndef FILE_SHARE_NODE_H #define FILE_SHARE_NODE_H -#include +#include "Glob.h" #include "m_HTTPServer.h" class CLShareUser { diff --git a/HTTPServer/Glob.h b/HTTPServer/Glob.h index a3a1f71..8dc270c 100644 --- a/HTTPServer/Glob.h +++ b/HTTPServer/Glob.h @@ -19,21 +19,36 @@ #define HTTP_SERVER_GLOB_H #include - -#ifndef INVALID_SET_FILE_POINTER -#define INVALID_SET_FILE_POINTER (unsigned long)(-1) -#endif - -#ifndef ULONG_PTR -#define ULONG_PTR ULONG -#endif +#include +#include +#include +#include +#include +#include +#include + +#define MIRANDA_VER 0x0900 +#include "newpluginapi.h" +#include "m_database.h" +#include "m_clist.h" +#include "m_clui.h" +#include "m_skin.h" +#include "m_langpack.h" +#include "m_options.h" +#include "m_system.h" +#include "m_history.h" +#include "m_userinfo.h" +#include "m_netlib.h" +#include "m_message.h" +#include "m_popup.h" +#include "m_protosvc.h" #define SD_RECEIVE 0x00 #define SD_SEND 0x01 #define SD_BOTH 0x02 #define MODULE "HTTPServer" -#define MSG_BOX_TITEL "Miranda (HTTPServer.dll)" +#define MSG_BOX_TITEL _T("Miranda (HTTPServer.dll)") #define SplitIpAddress( p ) (BYTE)(p>>24),(BYTE)(p>>16),(BYTE)(p>>8),(BYTE)(p) diff --git a/HTTPServer/GuiElements.cpp b/HTTPServer/GuiElements.cpp index d05af16..3716be5 100644 --- a/HTTPServer/GuiElements.cpp +++ b/HTTPServer/GuiElements.cpp @@ -15,57 +15,15 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif - #include "GuiElements.h" -#include -#include -#include - -#pragma warning( push, 3 ) -#include using namespace std; -#include "Glob.h" #include "m_HTTPServer.h" #include "FileShareNode.h" #include "resource.h" #include "IndexCreation.h" -#include "newpluginapi.h" -#include "m_database.h" -#include "m_clist.h" -#include "m_skin.h" -#include "m_langpack.h" -#include "m_options.h" -#include "m_system.h" -#include "m_history.h" -#include "m_userinfo.h" -#include "m_netlib.h" -#include "m_message.h" -#include "m_popup.h" -#include "m_clui.h" - -#pragma warning( pop ) - -struct NETLIBHTTPREQUEST_V032 { - int cbSize; - int requestType; //a REQUEST_ - DWORD flags; - char *szUrl; - NETLIBHTTPHEADER *headers; //If this is a POST request and headers - //doesn't contain a Content-Length it'll be added automatically - int headersCount; - char *pData; //data to be sent in POST request. - int dataLength; //must be 0 for REQUEST_GET/REQUEST_CONNECT - int resultCode; - char *szResultDescr; -}; - - #define MS_SHARE_NEW_FILE "HTTPServer/ShareNewFile" #define MS_SHOW_STATISTICS_VIEW "HTTPServer/ShowStatisticsView" @@ -111,7 +69,7 @@ string sPageKeyword = szDefaultPageKeyword; void ReplaceAll(string &sSrc, const char * pszReplace, const string &sNew) { string::size_type nCur = 0; - int nRepalceLen = strlen(pszReplace); + size_t nRepalceLen = strlen(pszReplace); while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) { sSrc.replace(nCur, nRepalceLen, sNew); nCur += sNew.size(); @@ -205,10 +163,6 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { externIP.s_addr = 0; nlreply = (NETLIBHTTPREQUEST *) CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM) hNetlibUser, (LPARAM) & nlhr); - if (nlreply == 0) { - nlhr.cbSize = sizeof(NETLIBHTTPREQUEST_V032); // try with old size - nlreply = (NETLIBHTTPREQUEST *) CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM) hNetlibUser, (LPARAM) & nlhr); - } if (nlreply) { if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) { nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated @@ -253,7 +207,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { string sCreateLink(const char * pszSrvPath) { char szTemp[30]; string sLink = DBGetString(NULL, MODULE, "ExternalSrvName", szDefaultExternalSrvName); - _snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress)); + mir_snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress)); ReplaceAll(sLink, "%LocalIP%", szTemp); if (sLink.find("%ExternalIP%") != sLink.npos) { @@ -266,11 +220,11 @@ string sCreateLink(const char * pszSrvPath) { dwExternalIpAddressGenerated = GetTickCount(); } - _snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwExternalIpAddress)); + mir_snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwExternalIpAddress)); ReplaceAll(sLink, "%ExternalIP%", szTemp); } - _snprintf(szTemp, sizeof(szTemp), "%d", dwLocalPortUsed, szTemp); + mir_snprintf(szTemp, sizeof(szTemp), "%d", dwLocalPortUsed, szTemp); ReplaceAll(sLink, "%Port%", szTemp); string sSrvPath = pszSrvPath; @@ -295,7 +249,7 @@ string sCreateLink(const char * pszSrvPath) { // Developer : KN, Houdini ///////////////////////////////////////////////////////////////////// -UINT CALLBACK ShareNewFileDialogHook( +UINT_PTR CALLBACK ShareNewFileDialogHook( HWND hDlg, // handle to child dialog box UINT uiMsg, // message identifier WPARAM wParam, // message parameter @@ -305,11 +259,11 @@ UINT CALLBACK ShareNewFileDialogHook( static int nInit = 0; - STFileShareInfo * pstShare = (STFileShareInfo *)GetWindowLong(hDlg, GWL_USERDATA); + STFileShareInfo * pstShare = (STFileShareInfo *)GetWindowLong(hDlg, GWLP_USERDATA); switch (uiMsg) { case WM_INITDIALOG: { pstShare = (STFileShareInfo *)((OPENFILENAME *)lParam)->lCustData; - SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)pstShare); + SetWindowLong(hDlg, GWLP_USERDATA, (LPARAM)pstShare); SetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, pstShare->nMaxDownloads, true); SendMessage(GetDlgItem(hDlg, IDC_ALLOWED_IPADDRESS), IPM_SETADDRESS, 0, pstShare->dwAllowedIP); @@ -422,7 +376,7 @@ UINT CALLBACK ShareNewFileDialogHook( //if( ! (pstShare->dwAllowedIP & pstShare->dwAllowedMask) if (!bTranslated || (strlen(pstShare->pszSrvPath) <= 0)) { - SetWindowLong(hDlg, DWL_MSGRESULT, 1); + SetWindowLong(hDlg, DWLP_MSGRESULT, 1); return true; } return false; @@ -485,7 +439,7 @@ UINT CALLBACK ShareNewFileDialogHook( bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(OPENFILENAME); - ofn.lpstrFilter = "All Files (*.*)\0*.*\0"; + ofn.lpstrFilter = _T("All Files (*.*)\0*.*\0"); ofn.lpstrFile = pstNewShare->pszRealPath; ofn.nMaxFile = pstNewShare->dwMaxRealPath; @@ -503,7 +457,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { | OFN_ALLOWMULTISELECT; ofn.hwndOwner = hwndOwner; ofn.hInstance = hInstance; - ofn.lpstrTitle = Translate("Specify a file to share"); + ofn.lpstrTitle = TranslateT("Specify a file to share"); ofn.lpTemplateName = MAKEINTRESOURCE(IDD_NEW_SHARE_PROPERTIES); ofn.lpfnHook = ShareNewFileDialogHook; ofn.lCustData = (LPARAM)pstNewShare; @@ -511,8 +465,8 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { if (!GetOpenFileName(&ofn)) { DWORD dwError = CommDlgExtendedError(); if (dwError) { - char szTemp[200]; - _snprintf(szTemp, sizeof(szTemp), "Failed to create File Open dialog the error returned was %d", dwError); + TCHAR szTemp[200]; + mir_sntprintf(szTemp, sizeof(szTemp), _T("Failed to create File Open dialog the error returned was %d"), dwError); MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK); } return false; @@ -547,7 +501,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0'; if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) { - MessageBox(NULL, "Failed to share new file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } pszFileNamePos++; @@ -557,7 +511,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { } else { if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) { - MessageBox(NULL, "Failed to share new file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } } @@ -609,7 +563,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { ListView_InsertItem(hShareList, &sItem); - _snprintf(szTmp, sizeof(szTmp), "%d", pclCur->st.nMaxDownloads); + mir_snprintf(szTmp, sizeof(szTmp), "%d", pclCur->st.nMaxDownloads); sItem.iSubItem = 1; sItem.pszText = szTmp; ListView_SetItem(hShareList, &sItem); @@ -649,7 +603,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { ListView_SetItem(hUserList, &sItem); if (pclCurUser->dwTotalSize) { - _snprintf(szTmp, sizeof(szTmp), "%d %%", (pclCurUser->dwCurrentDL * 100) / pclCurUser->dwTotalSize); + mir_snprintf(szTmp, sizeof(szTmp), "%d %%", (pclCurUser->dwCurrentDL * 100) / pclCurUser->dwTotalSize); } else { strcpy(szTmp, "? %%"); } @@ -661,9 +615,9 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { if (dwSpeed > 10000) { dwSpeed += 512; // make sure we round ot down correctly. dwSpeed /= 1024; - _snprintf(szTmp, sizeof(szTmp), "%d KB/Sec", dwSpeed); + mir_snprintf(szTmp, sizeof(szTmp), "%d KB/Sec", dwSpeed); } else { - _snprintf(szTmp, sizeof(szTmp), "%d B/Sec", dwSpeed); + mir_snprintf(szTmp, sizeof(szTmp), "%d B/Sec", dwSpeed); } sItem.iSubItem = 4; sItem.pszText = szTmp; @@ -733,7 +687,7 @@ void SetWindowsCtrls(HWND hwndDlg) { // Developer : KN, Houdini ///////////////////////////////////////////////////////////////////// -static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { +static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, @@ -758,36 +712,36 @@ static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, LVCOLUMN cCol = { 0 }; cCol.mask = LVCF_TEXT | LVCF_WIDTH; cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx1", 126); - cCol.pszText = Translate("Share name"); + cCol.pszText = TranslateT("Share name"); ListView_InsertColumn(hShareList, 0, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx2", 48); - cCol.pszText = Translate("Max Downloads"); + cCol.pszText = TranslateT("Max Downloads"); ListView_InsertColumn(hShareList, 1, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx3", 96); - cCol.pszText = Translate("Allowed IP"); + cCol.pszText = TranslateT("Allowed IP"); ListView_InsertColumn(hShareList, 2, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx4", 104); - cCol.pszText = Translate("Allowed Mask"); + cCol.pszText = TranslateT("Allowed Mask"); ListView_InsertColumn(hShareList, 3, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx5", 252); - cCol.pszText = Translate("Real path"); + cCol.pszText = TranslateT("Real path"); ListView_InsertColumn(hShareList, 4, &cCol); cCol.mask = LVCF_TEXT | LVCF_WIDTH; cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx6", 142); - cCol.pszText = Translate("Share name"); + cCol.pszText = TranslateT("Share name"); ListView_InsertColumn(hUserList, 0, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx7", 111); - cCol.pszText = Translate("User"); + cCol.pszText = TranslateT("User"); ListView_InsertColumn(hUserList, 1, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx8", 100); - cCol.pszText = Translate("Agent"); + cCol.pszText = TranslateT("Agent"); ListView_InsertColumn(hUserList, 2, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx9", 100); - cCol.pszText = Translate("Completed"); + cCol.pszText = TranslateT("Completed"); ListView_InsertColumn(hUserList, 3, &cCol); cCol.cx = DBGetContactSettingWord(NULL, MODULE, "StatWnd_cx10", 100); - cCol.pszText = Translate("Speed"); + cCol.pszText = TranslateT("Speed"); ListView_InsertColumn(hUserList, 4, &cCol); bool b = DBGetContactSettingByte(NULL, MODULE, "StatWnd_ShowHidden", 0) != 0; @@ -844,7 +798,7 @@ static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, strncpy(&szServPath[1], fileName+1, MAX_PATH-2); if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) { - MessageBox(NULL, "Failed to share new file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } } @@ -952,18 +906,18 @@ static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, if (ListView_GetItem(hShareList, &sItem)) { string sLink = sCreateLink(sItem.pszText); if (sLink.size() <= 0) { - MessageBox(hwndDlg, "Selected link size is 0", MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, _T("Selected link size is 0"), MSG_BOX_TITEL, MB_OK); return TRUE; } if (LOWORD(wParam) == ID_SHARELIST_COPYLINK) { if (!OpenClipboard(hwndDlg)) { - MessageBox(hwndDlg, "Failed to get access to clipboard", MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, _T("Failed to get access to clipboard"), MSG_BOX_TITEL, MB_OK); return TRUE; } if (!EmptyClipboard()) { - MessageBox(hwndDlg, "Failed to get close the clipboard", MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, _T("Failed to get close the clipboard"), MSG_BOX_TITEL, MB_OK); return TRUE; } @@ -977,14 +931,14 @@ static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, HANDLE hMyData = SetClipboardData(CF_TEXT, hglbCopy); if (! hMyData) - MessageBox(hwndDlg, "Failed to set clipboard data", MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, _T("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK); CloseClipboard(); } else { CallService(MS_UTILS_OPENURL, 0, (LPARAM)(const char*)sLink.c_str()); } } else { - MessageBox(hwndDlg, "ListView_GetItem failed", MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, _T("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK); } } else { MessageBox(hwndDlg, Translate("No share selected"), MSG_BOX_TITEL, MB_OK); @@ -1044,13 +998,7 @@ static BOOL CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wParam, void SendLinkToUser(WPARAM wParam, char *pszSrvPath) { string sLink = sCreateLink(pszSrvPath); - - //NB: Current versions of the convers plugin use the name - //"SRMsg/LaunchMessageWindow" instead. For compatibility you should call - //both names and the correct one will work. - - CallService(MS_MSG_SENDMESSAGE, (WPARAM)wParam, (LPARAM)sLink.c_str()); - CallService("SRMsg/LaunchMessageWindow", (WPARAM)wParam, (LPARAM)sLink.c_str()); + CallService(MS_MSG_SENDMESSAGE, wParam, (LPARAM)sLink.c_str()); } ///////////////////////////////////////////////////////////////////// @@ -1068,7 +1016,7 @@ void SendLinkToUser(WPARAM wParam, char *pszSrvPath) { // Developer : KN, Houdini ///////////////////////////////////////////////////////////////////// -static long nShareNewFile(WPARAM wParam, LPARAM lParam) { +static INT_PTR nShareNewFile(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; // used to be _MAX_PATH @@ -1125,7 +1073,7 @@ static long nShareNewFile(WPARAM wParam, LPARAM lParam) { } -static long nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) { +static INT_PTR nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) { if (hwndStatsticView) { BringWindowToTop(hwndStatsticView); return 0; @@ -1152,7 +1100,7 @@ static long nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) { // Developer : KN, Houdini ///////////////////////////////////////////////////////////////////// -static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { +static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { string sDefExt = DBGetString(NULL, MODULE, "ExternalSrvName", szDefaultExternalSrvName); @@ -1275,7 +1223,7 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, sizeof(szKeyWord)); DWORD dwExternalIP = GetExternIP(szUrl, szKeyWord); - _snprintf(szKeyWord, sizeof(szKeyWord), Translate("You external ip was detected as %d.%d.%d.%d\r\nby: %s") , + mir_snprintf(szKeyWord, sizeof(szKeyWord), Translate("You external ip was detected as %d.%d.%d.%d\r\nby: %s") , SplitIpAddress(dwExternalIP) , szUrl); MessageBox(hwndDlg, szKeyWord, MSG_BOX_TITEL, MB_OK); @@ -1295,14 +1243,14 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED; if (b != bNew) { DBWriteContactSettingByte(NULL, MODULE, "AddStatisticsMenuItem", bNew); - MessageBox(hwndDlg, Translate("You need to restart miranda to change the main menu"), MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, TranslateT("You need to restart miranda to change the main menu"), MSG_BOX_TITEL, MB_OK); } b = DBGetContactSettingByte(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0; bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED; if (b != bNew) { DBWriteContactSettingByte(NULL, MODULE, "AddAcceptConMenuItem", bNew); - MessageBox(hwndDlg, Translate("You need to restart miranda to change the main menu"), MSG_BOX_TITEL, MB_OK); + MessageBox(hwndDlg, TranslateT("You need to restart miranda to change the main menu"), MSG_BOX_TITEL, MB_OK); } bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED; @@ -1404,9 +1352,9 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) { odp.position = 900000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_HTTP_SERVER); - odp.flags = ODPF_BOLDGROUPS; - odp.pszTitle = Translate("HTTP Server"); - odp.pszGroup = Translate("Network"); + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; + odp.ptszTitle = LPGENT("HTTP Server"); + odp.ptszGroup = LPGENT("Network"); odp.pfnDlgProc = OptionsDlgProc; CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); return 0; @@ -1543,39 +1491,39 @@ void InitGuiElements() { hShareNewFileService = CreateServiceFunction(MS_SHARE_NEW_FILE, nShareNewFile); if (! hShareNewFileService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_SHARE_NEW_FILE", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_SHARE_NEW_FILE"), MSG_BOX_TITEL, MB_OK); return; } hShowStatisticsViewService = CreateServiceFunction(MS_SHOW_STATISTICS_VIEW, nShowStatisticsView); if (! hShowStatisticsViewService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_SHOW_STATISTICS_VIEW", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_SHOW_STATISTICS_VIEW"), MSG_BOX_TITEL, MB_OK); return; } CLISTMENUITEM mi; ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); - mi.flags = 0; + mi.flags = CMIF_TCHAR; mi.pszContactOwner = NULL; //all contacts mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); mi.position = -2000019955; - mi.pszName = Translate("HTTP Share new file"); + mi.ptszName = LPGENT("HTTP Share new file"); mi.pszService = MS_SHARE_NEW_FILE; hShareNewFileMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); if (!hShareNewFileMenuItem) { - MessageBox(NULL, "Failed to add contact menu item", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to add contact menu item"), MSG_BOX_TITEL, MB_OK); return; } if (DBGetContactSettingByte(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0) { mi.position = 1000085005; - mi.flags = 0; + mi.flags = CMIF_TCHAR; //mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); mi.pszContactOwner = NULL; - mi.pszName = Translate("Show HTTP server statistics"); + mi.ptszName = LPGENT("Show HTTP server statistics"); mi.pszService = MS_SHOW_STATISTICS_VIEW; hShowStatisticsViewMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) & mi); } @@ -1583,7 +1531,7 @@ void InitGuiElements() { hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); if (!hEventOptionsInitialize) - MessageBox(NULL, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to HookEvent ME_OPT_INITIALISE"), MSG_BOX_TITEL, MB_OK); bShowPopups = DBGetContactSettingByte(NULL, MODULE, "ShowPopups", bShowPopups) != 0; /* diff --git a/HTTPServer/GuiElements.h b/HTTPServer/GuiElements.h index 0ce1d11..c473d92 100644 --- a/HTTPServer/GuiElements.h +++ b/HTTPServer/GuiElements.h @@ -18,7 +18,7 @@ #ifndef GUI_ELEMENTS_H #define GUI_ELEMENTS_H -#include +#include "Glob.h" void InitGuiElements(); void UnInitGuiElements(); diff --git a/HTTPServer/HTTPServer_10.vcxproj b/HTTPServer/HTTPServer_10.vcxproj new file mode 100644 index 0000000..be05b38 --- /dev/null +++ b/HTTPServer/HTTPServer_10.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F7A70398-AFA0-4A58-B645-85268F9517DE} + HTTPServer + HTTPServer + + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + true + true + true + $(SolutionDir)\$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)\$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)\$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)\$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + + + Disabled + ../../include;../ExternalAPI + _DEBUG;WIN32;_WINDOWS;_USRDLL;_WIN32_IE=0x0400;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreadedDebug + Level3 + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + + + msvcrtd.lib;User32.lib;Kernel32.lib;Ws2_32.lib;Comdlg32.lib;comctl32.lib;libcpmtd.lib;%(AdditionalDependencies) + true + true + $(IntDir)$(TargetName).lib + Windows + 0x22500000 + false + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + + + Disabled + ../../include;../ExternalAPI + _DEBUG;WIN64;_WINDOWS;_USRDLL;_WIN32_IE=0x0400;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreadedDebug + Level3 + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + + + msvcrtd.lib;User32.lib;Kernel32.lib;Ws2_32.lib;Comdlg32.lib;comctl32.lib;libcpmtd.lib;%(AdditionalDependencies) + true + true + Windows + 0x22500000 + false + $(IntDir)$(TargetName).lib + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + + + Full + OnlyExplicitInline + ../../include;../ExternalAPI + NDEBUG;WIN32;_WINDOWS;_USRDLL;_WIN32_IE=0x0400;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + Size + + + NDEBUG;%(PreprocessorDefinitions) + + + msvcrt.lib;User32.lib;Kernel32.lib;Ws2_32.lib;Comdlg32.lib;comctl32.lib;libcpmt.lib;%(AdditionalDependencies) + true + Windows + 0x22500000 + true + true + false + $(IntDir)$(TargetName).lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + + + Full + OnlyExplicitInline + ../../include;../ExternalAPI + NDEBUG;WIN64;_WINDOWS;_USRDLL;_WIN32_IE=0x0400;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + Size + + + NDEBUG;%(PreprocessorDefinitions) + + + Windows + $(IntDir)$(TargetName).lib + 0x22500000 + false + true + true + msvcrt.lib;User32.lib;Kernel32.lib;Ws2_32.lib;Comdlg32.lib;comctl32.lib;libcpmt.lib;%(AdditionalDependencies) + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HTTPServer/HTTPServer_10.vcxproj.filters b/HTTPServer/HTTPServer_10.vcxproj.filters new file mode 100644 index 0000000..fc3de3d --- /dev/null +++ b/HTTPServer/HTTPServer_10.vcxproj.filters @@ -0,0 +1,82 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + + + {5e05f681-4ca1-4f05-8cf7-ad36d263563a} + + + {b7aa7d9f-57f6-4f53-bc69-a31070153186} + + + {c13934ba-ee0b-4ced-a1fc-0becf97da3db} + + + + + Resource Files + + + \ No newline at end of file diff --git a/HTTPServer/HttpUser.cpp b/HTTPServer/HttpUser.cpp index 2e10fc1..0dd9ad9 100644 --- a/HTTPServer/HttpUser.cpp +++ b/HTTPServer/HttpUser.cpp @@ -15,26 +15,12 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif - #include "HttpUser.h" #include "MimeHandling.h" #include "GuiElements.h" #include "IndexCreation.h" -#include "Glob.h" -#include -#include - -#pragma warning( push, 3 ) - -#include "newpluginapi.h" -#include "m_langpack.h" -#include "m_netlib.h" -#pragma warning( pop ) ///////////////////////////////////////////////////////////////////// @@ -251,7 +237,7 @@ void CLHttpUser::SendError(int iErrorCode, const char * pszError, const char * p pszDescription = pszError; char szBuf[1000]; - DWORD dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf) , + DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf) , "HTTP/1.1 %i %s\r\n" "Date: %s\r\n" "Server: MirandaWeb/%s\r\n" @@ -301,7 +287,7 @@ void CLHttpUser::SendRedir(int iErrorCode, const char * pszError, const char * p pszDescription = pszError; char szBuff[1000]; - DWORD dwBytesToWrite = _snprintf(szBuff, sizeof(szBuff) , + DWORD dwBytesToWrite = mir_snprintf(szBuff, sizeof(szBuff) , "HTTP/1.1 %i %s\r\n" "Date: %s\r\n" "Server: MirandaWeb/%s\r\n" @@ -566,7 +552,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { char szETag[ 50 ]; { - int nETagLen = _snprintf(szETag, sizeof(szETag), "\"%x-%x-%x\"", + int nETagLen = mir_snprintf(szETag, sizeof(szETag), "\"%x-%x-%x\"", nDataSize, stFileTime.dwHighDateTime, stFileTime.dwLowDateTime); if (!apszParam[eIfRange] || (strncmp(szETag, apszParam[eIfRange], nETagLen) == 0)) { @@ -636,7 +622,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n" "\r\n"; - dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szHttpPartial , + dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial , szCurTime , pszVersion, szETag , @@ -658,7 +644,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n" "\r\n"; - dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szHttpOk , + dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk , szCurTime , pszVersion, szETag , @@ -693,7 +679,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { DWORD dwCurTick = GetTickCount(); if (dwCurTick - dwLastUpdate >= 1000) {/* char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "Bytes tr %d Time %d Tick %d\n", dwCurrentDL - dwLastCurrentDL, dwCurTick - dwLastUpdate, dwCurTick ); + mir_snprintf( szTmp, sizeof( szTmp ), "Bytes tr %d Time %d Tick %d\n", dwCurrentDL - dwLastCurrentDL, dwCurTick - dwLastUpdate, dwCurTick ); OutputDebugString( szTmp ); */ dwSpeed = ((dwCurrentDL - dwLastCurrentDL) * 1000) / (dwCurTick - dwLastUpdate); @@ -745,7 +731,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { } /* char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "Current status : %d %% pos %d size %d\n", (dwCurrentDL * 100) / dwTotalSize, dwCurrentDL , dwTotalSize ); + mir_snprintf( szTmp, sizeof( szTmp ), "Current status : %d %% pos %d size %d\n", (dwCurrentDL * 100) / dwTotalSize, dwCurrentDL , dwTotalSize ); OutputDebugString( szTmp ); */ } @@ -761,7 +747,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { /* { char szBuf[200]; - _snprintf( szBuf, sizeof( szBuf ), "File Transfer stoped %d transfer complete %d\n", GetTickCount(), dwCurrentDL == nDataSize); + mir_snprintf( szBuf, sizeof( szBuf ), "File Transfer stoped %d transfer complete %d\n", GetTickCount(), dwCurrentDL == nDataSize); OutputDebugString( szBuf ); } */ diff --git a/HTTPServer/HttpUser.h b/HTTPServer/HttpUser.h index 00b43a7..7f29070 100644 --- a/HTTPServer/HttpUser.h +++ b/HTTPServer/HttpUser.h @@ -18,7 +18,7 @@ #ifndef HTTP_USER_H #define HTTP_USER_H -#include +#include "Glob.h" #include "m_HTTPServer.h" #include "FileShareNode.h" diff --git a/HTTPServer/IndexCreation.h b/HTTPServer/IndexCreation.h index c3892c4..0411825 100644 --- a/HTTPServer/IndexCreation.h +++ b/HTTPServer/IndexCreation.h @@ -19,7 +19,7 @@ #ifndef HTTP_INDEXCREATION_H #define HTTP_INDEXCREATION_H -#include +#include "Glob.h" #include "m_HTTPServer.h" #include "FileShareNode.h" diff --git a/HTTPServer/IndexHTML.cpp b/HTTPServer/IndexHTML.cpp index 27a2760..1adae53 100644 --- a/HTTPServer/IndexHTML.cpp +++ b/HTTPServer/IndexHTML.cpp @@ -15,16 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif #include "HttpUser.h" #include "MimeHandling.h" #include "GuiElements.h" -#include "Glob.h" -#include -#include #include "IndexCreation.h" eIndexCreationMode indexCreationMode; @@ -78,7 +72,7 @@ bool LoadIndexHTMLTemplate() { HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("HTTPServerIndex.html not found in Plugin Path"), MSG_BOX_TITEL, MB_OK); return false; } @@ -300,7 +294,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, strcpy(szMask, pszRealPath); strcat(szMask, "*"); - WIN32_FIND_DATAA fdFindFileData; + WIN32_FIND_DATA fdFindFileData; HANDLE hFind = FindFirstFile(szMask, &fdFindFileData); if (hFind == INVALID_HANDLE_VALUE) @@ -369,9 +363,9 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, } } - while (!strcmp(fdFindFileData.cFileName, ".") || - !strncmp(fdFindFileData.cFileName, "@", 1) || - (!strcmp(fdFindFileData.cFileName, "..") && !strcmp(pszSrvPath, "/")) || // hide .. in root + while (!_tcscmp(fdFindFileData.cFileName, _T(".")) || + !_tcsncmp(fdFindFileData.cFileName, _T("@"), 1) || + (!_tcscmp(fdFindFileData.cFileName, _T("..")) && !strcmp(pszSrvPath, "/")) || // hide .. in root ((*pszPos == 19) == ((fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0))) { if (!FindNextFile(hFind, &fdFindFileData)) { FindClose(hFind); @@ -424,13 +418,13 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, case SY_FILE_NAME: case SY_DIR_NAME: { - pszBuffer += _snprintf(pszBuffer, 250, "%s", szName); + pszBuffer += mir_snprintf(pszBuffer, 250, "%s", szName); break; } case SY_DIR_URL: { case SY_FILE_URL: - pszBuffer += _snprintf(pszBuffer, 250, "%s", szURL); + pszBuffer += mir_snprintf(pszBuffer, 250, "%s", szURL); break; } @@ -441,7 +435,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, (*pszPos == SY_FILE_CREATE_TIME) ? &ftFileCreateTime : &ftFileModifyTime, &systemTime); - pszBuffer += _snprintf(pszBuffer, 100, "%i/%02i/%02i %i:%02i:%02i", + pszBuffer += mir_snprintf(pszBuffer, 100, "%i/%02i/%02i %i:%02i:%02i", systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute, systemTime.wSecond); break; @@ -449,11 +443,11 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, case SY_FILE_SIZE: { if ((iFileSize >> 10) == 0) - pszBuffer += _snprintf(pszBuffer, 100, "%i Byte", iFileSize); + pszBuffer += mir_snprintf(pszBuffer, 100, "%i Byte", iFileSize); else if ((iFileSize >> 20) == 0) - pszBuffer += _snprintf(pszBuffer, 100, "%.1f KB", (float)(iFileSize) / 1024.0f); + pszBuffer += mir_snprintf(pszBuffer, 100, "%.1f KB", (float)(iFileSize) / 1024.0f); else - pszBuffer += _snprintf(pszBuffer, 100, "%.1f MB", (float)(iFileSize) / (1024.0f * 1024.0f)); + pszBuffer += mir_snprintf(pszBuffer, 100, "%.1f MB", (float)(iFileSize) / (1024.0f * 1024.0f)); break; } diff --git a/HTTPServer/IndexXML.cpp b/HTTPServer/IndexXML.cpp index 6806670..634ce72 100644 --- a/HTTPServer/IndexXML.cpp +++ b/HTTPServer/IndexXML.cpp @@ -15,16 +15,9 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif - #include "HttpUser.h" #include "MimeHandling.h" #include "GuiElements.h" -#include "Glob.h" -#include -#include #include "IndexCreation.h" @@ -78,7 +71,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, strcpy(szMask, pszRealPath); strcat(szMask, "*"); - WIN32_FIND_DATAA fdFindFileData; + WIN32_FIND_DATA fdFindFileData; HANDLE hFind = FindFirstFile(szMask, &fdFindFileData); if (hFind == INVALID_HANDLE_VALUE) @@ -133,7 +126,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, // Write dirname ReplaceSign(szFileName, MAX_PATH, '&', "&"); - pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), + pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " %s\r\n", szFileName); WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL); @@ -148,7 +141,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, ReplaceSign(szFileName, MAX_PATH, '&', "&"); if (fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), + pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n", szFileName); } else { pszExt = strrchr(szFileName, '.'); @@ -158,24 +151,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, pszExt++; } - pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), + pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n"); } @@ -202,7 +195,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, if (pclCur->bIsDirectory()) { szFileName[strlen(szFileName)-1] = '\0'; if (!strchr(szFileName, '/')) { // only one level deeper - pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), + pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n", szFileName); if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) @@ -230,24 +223,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, CloseHandle(hFileS); } - pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), + pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n"); if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) diff --git a/HTTPServer/MimeHandling.cpp b/HTTPServer/MimeHandling.cpp index 339051e..2069f16 100644 --- a/HTTPServer/MimeHandling.cpp +++ b/HTTPServer/MimeHandling.cpp @@ -1,12 +1,5 @@ -#include -#include -#include "MimeHandling.h" - -#ifndef TEST #include "Glob.h" -#else -char szPluginPath[10] = ""; -#endif +#include "MimeHandling.h" /* MIME type/ext map */ diff --git a/HTTPServer/MimeHandling.h b/HTTPServer/MimeHandling.h index f40fdf9..8286ff4 100644 --- a/HTTPServer/MimeHandling.h +++ b/HTTPServer/MimeHandling.h @@ -9,44 +9,44 @@ extern "C" { /* MIME DB Data structure ---------- ---------- - | mimeType | | mimeType | - |----------| |----------| - ----| next -----------------| next | - |----------| |----------| - | extList --- | extList --- - ---------- | ---------- | - --|--- --|--- - | ext | | ext | - |------| |------| - | next | | next | - --|--- ------ - --|--- - | ext | - |------| - | next | - ------ - */ - - typedef struct _ExtensionListCell { - char* ext; - struct _ExtensionListCell* next; - } ExtensionListCell ; - - - typedef struct _ContentType { - char* mimeType; - ExtensionListCell* extList; - struct _ContentType* next; - } ContentType ; - - typedef ContentType* ContentTypeDB; - typedef ExtensionListCell* ExtensionList; - - - - extern int bInitMimeHandling(); - extern const char * pszGetMimeType(const char * pszFileName); - -#ifdef __cplusplus -} -#endif + | mimeType | | mimeType | + |----------| |----------| + ----| next -----------------| next | + |----------| |----------| + | extList --- | extList --- + ---------- | ---------- | + --|--- --|--- + | ext | | ext | + |------| |------| + | next | | next | + --|--- ------ + --|--- + | ext | + |------| + | next | + ------ + */ + + typedef struct _ExtensionListCell { + char* ext; + struct _ExtensionListCell* next; + } ExtensionListCell ; + + + typedef struct _ContentType { + char* mimeType; + ExtensionListCell* extList; + struct _ContentType* next; + } ContentType ; + + typedef ContentType* ContentTypeDB; + typedef ExtensionListCell* ExtensionList; + + + + extern int bInitMimeHandling(); + extern const char * pszGetMimeType(const char * pszFileName); + +#ifdef __cplusplus +} +#endif diff --git a/HTTPServer/data/HTTPServerIndex.html b/HTTPServer/data/HTTPServerIndex.html index 4fdc419..ef79114 100644 --- a/HTTPServer/data/HTTPServerIndex.html +++ b/HTTPServer/data/HTTPServerIndex.html @@ -1,34 +1,83 @@ - - -Directory Listing of [DirectoryName] - - - - - - -[End] -[ForFilesDo][End] - - - - \ No newline at end of file + + + + + + + + + + + Verzeichnis [DirectoryName] + + + + + + + + +
-

Directory Listing of [DirectoryName]

-[ForDirectoriesDo]
[DirectoryName]
-[IsFileType=jpg,jpeg,gif,png,bmp][End] -[IsFileType=zip,rar,ace,arj,lha,lhz,tar,gz][End] -[IsFileType=rtf,doc][End] -[IsFileType=txt,diz][End] -[IsFileType=pdf][End] -[IsFileType=exe,bat][End] -[IsFileType=html,htm,xml][End] -[IsFileType=avi,mpg][End] -[IsFileType=c,cpp,h][End] -[IsFileType=mp3,ogg,wav,mid,mod,xm][End] -[IsFileType=*][End][FileName][FileModified][FileSize]
+ + + + + + + + +[ForDirectoriesDo] + + + +[End] + +[ForFilesDo] + + + + + + +[End] + +
Verzeichnis [DirectoryName]
+ + folder + [DirectoryName] + +
+ +[IsFileType=jpg,jpeg,gif,png,bmp][End] +[IsFileType=zip,rar,ace,arj,lha,lhz,tar,gz,7z][End] +[IsFileType=rtf,doc][End] +[IsFileType=txt,diz][End] +[IsFileType=pdf][End] +[IsFileType=tex][End] +[IsFileType=java,jar][End] +[IsFileType=exe,bat,dll][End] +[IsFileType=html,htm,xml,php,css][End] +[IsFileType=avi,mpg,mpeg][End] +[IsFileType=c,cpp,h][End] +[IsFileType=mp3,ogg,wav,mid,mod,xm][End] +[IsFileType=*][End] + [FileName] + + [FileSize][FileModified][FileCreated]
+ + diff --git a/HTTPServer/data/htdocs/@settings/index.xsl b/HTTPServer/data/htdocs/@settings/index.xsl index d8e8f4e..e180baa 100644 --- a/HTTPServer/data/htdocs/@settings/index.xsl +++ b/HTTPServer/data/htdocs/@settings/index.xsl @@ -1,121 +1,204 @@ - + - - - - my Miranda Webserver - - - + - - - - - - - - - - - - - #EEEEFF - #DDDDEE - - - - + + + + + + + + + Verzeichnis + Miranda IM Webserver + + + + + + + + + + + + + + + + + <xsl:value-of select="$title" /> + + + + + + + + +
-

Directory Listing of

-
+ + + + + + + + + + + + + + + + + + - 3 - 1 + even + odd - - - - - - folder_gray.png - image2.png - tar.png - document2.png - txt.png - pdf.png - win_apps.png - www.png - video.png - source.png - sound.png - empty.png - - - - /icons/ - - - /placeholder.gif - 5 - - - - - . - / - - - . - - - - - - - - - - - - -
- - - GB - - - MB - - - KB - - - Byte - - -
-
- - + + + + + + folder + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + /icons/image2.png + /icons/tar.png + /icons/document2.png + /icons/txt.png + /icons/pdf.png + /icons/tex.png + /icons/source_java.png + /icons/win_apps.png + /icons/www.png + /icons/video.png + /icons/source.png + /icons/sound.png + /icons/empty.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Verzeichnis(se), Datei(en) + + + + + insgesamt + nach oben + + + + +
+ + + + + + + ... + + + + + + + + + + + + + + + + + + -
diff --git a/HTTPServer/main.cpp b/HTTPServer/main.cpp index 0ff96f6..a8816d1 100644 --- a/HTTPServer/main.cpp +++ b/HTTPServer/main.cpp @@ -15,45 +15,14 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifdef NDEBUG //release -#include "AggressiveOptimize.h" //create small code -#endif - -#include -#include -#include -#include -#include - -#pragma warning( push, 3 ) - -#include +#include "Glob.h" using namespace std; -#include "newpluginapi.h" -#include "m_database.h" -#include "m_clist.h" -#include "m_skin.h" -#include "m_langpack.h" -#include "m_options.h" -#include "m_system.h" -#include "m_history.h" -#include "m_userinfo.h" -#include "m_netlib.h" -#include "m_message.h" -#include "m_popup.h" -#include "m_protosvc.h" - -#pragma warning( pop ) - -//#include -//#include #include "m_HTTPServer.h" #include "FileShareNode.h" #include "HttpUser.h" #include "GuiElements.h" #include "MimeHandling.h" -#include "Glob.h" #include "resource.h" #include "IndexCreation.h" @@ -90,6 +59,8 @@ HANDLE hDirectBoundPort; HINSTANCE hInstance = NULL; PLUGINLINK *pluginLink; +MM_INTERFACE mmi; +int hLangpack = 0; string sLogFilePath; @@ -127,23 +98,6 @@ void (*MirandaFree)(void*); bool bShutdownInProgress = false; - -struct NETLIBUSERSETTINGS_V032 { - int cbSize; //to be filled in before calling - int useProxy; //1 or 0 - int proxyType; //a PROXYTYPE_ - char* szProxyServer; //can be NULL - int wProxyPort; //host byte order - int useProxyAuth; //1 or 0. Always 0 for SOCKS4 - char* szProxyAuthUser; //can be NULL, always used by SOCKS4 - char* szProxyAuthPassword; //can be NULL - int useProxyAuthNtlm; //1 or 0, only used by HTTP, HTTPS - int dnsThroughProxy; //1 or 0 - int specifyIncomingPorts; //1 or 0 - char* szIncomingPorts; //can be NULL. Of form "1024-1050,1060-1070,2000" -} ; - - char* pszVersion = "0.1.2.2"; PLUGININFOEX pluginInfo = { @@ -156,7 +110,7 @@ PLUGININFOEX pluginInfo = { "", "© 2003-2009 Kennet Nielsen, Vampik, Houdini", "http://www.miranda-im.org/download/details.php?action=viewfile&id=2304", - 0, + UNICODE_AWARE, 0, // {67848B07-83D2-49e9-8844-7E3DE268E304} { 0x67848b07, 0x83d2, 0x49e9, { 0x88, 0x44, 0x7e, 0x3d, 0xe2, 0x68, 0xe3, 0x4 } } @@ -253,12 +207,12 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) { void LogEvent(const char * pszTitle, const char * pszLog) { HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, "Failed to open or create log file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK); return; } if (SetFilePointer(hFile, 0, 0, FILE_END) == INVALID_SET_FILE_POINTER) { CloseHandle(hFile); - MessageBox(NULL, "Failed to move to the end of the log file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK); return; } @@ -276,7 +230,7 @@ void LogEvent(const char * pszTitle, const char * pszLog) { !bWriteToFile(hFile, " : ") || !bWriteToFile(hFile, pszLog, nLogLen) || !bWriteToFile(hFile, "\r\n")) { - MessageBox(NULL, "Failed to write some part of the log file", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK); } CloseHandle(hFile); } @@ -434,17 +388,17 @@ bool bWriteConfigurationFile() { strcat(szBuf, szConfigFile); HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, "Failed to open or create file " szConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to open or create file ") szConfigFile, MSG_BOX_TITEL, MB_OK); return false; } DWORD dwBytesWriten = 0; if (! WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, NULL)) { - MessageBox(NULL, "Failed to write xml header to file " szConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to write xml header to file ") szConfigFile, MSG_BOX_TITEL, MB_OK); } else { CLFileShareNode * pclCur = pclFirstNode; while (pclCur) { - DWORD dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szXmlData , + DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szXmlData , pclCur->st.pszSrvPath, pclCur->pszOrigRealPath, pclCur->st.nMaxDownloads, @@ -452,14 +406,14 @@ bool bWriteConfigurationFile() { SplitIpAddress(pclCur->st.dwAllowedMask)); if (! WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, NULL)) { - MessageBox(NULL, "Failed to write xml data to file " szConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to write xml data to file ") szConfigFile, MSG_BOX_TITEL, MB_OK); break; } pclCur = pclCur->pclNext; } if (! WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, NULL)) { - MessageBox(NULL, "Failed to write xml tail to file " szConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to write xml tail to file ") szConfigFile, MSG_BOX_TITEL, MB_OK); } } SetEndOfFile(hFile); @@ -482,7 +436,7 @@ bool bWriteConfigurationFile() { // Developer : KN, Houdini, changed By Sergio Vieira Rolanski ///////////////////////////////////////////////////////////////////// -static long nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { +static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { if (!lParam) return 1001; @@ -570,7 +524,7 @@ static long nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { // Developer : KN ///////////////////////////////////////////////////////////////////// -static long nGetShare(WPARAM /*wParam*/, LPARAM lParam) { +static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { if (!lParam) return 1001; @@ -609,7 +563,7 @@ static long nGetShare(WPARAM /*wParam*/, LPARAM lParam) { // Developer : KN ///////////////////////////////////////////////////////////////////// -static long nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) {/* +static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/) {/* STFileShareInfo ** pTarget = (STFileShareInfo**)lParam; CLFileShareNode * pclCur; @@ -700,7 +654,7 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { bIsOnline = ((int)ack->lParam != ID_STATUS_AWAY && (int)ack->lParam != ID_STATUS_NA); /* char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "%s New status %d\n" ,ack->szModule, (int)bIsOnline); + mir_snprintf( szTmp, sizeof( szTmp ), "%s New status %d\n" ,ack->szModule, (int)bIsOnline); OutputDebugString( szTmp );*/ return 0; } @@ -720,7 +674,7 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { // Developer : KN ///////////////////////////////////////////////////////////////////// -long nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { +INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); mi.flags = CMIM_NAME | CMIM_ICON; @@ -729,10 +683,7 @@ long nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { NETLIBUSERSETTINGS nus = { 0 }; nus.cbSize = sizeof(nus); if (! CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM) hNetlibUser, (LPARAM) &nus)) { - nus.cbSize = sizeof(NETLIBUSERSETTINGS_V032); - if (! CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM) hNetlibUser, (LPARAM) &nus)) { - Netlib_Logf(hNetlibUser, "Failed to get NETLIBUSERSETTINGS using MS_NETLIB_GETUSERSETTINGS"); - } + Netlib_Logf(hNetlibUser, "Failed to get NETLIBUSERSETTINGS using MS_NETLIB_GETUSERSETTINGS"); } NETLIBBIND nlb = { 0 }; @@ -741,13 +692,13 @@ long nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { if (nus.specifyIncomingPorts && nus.szIncomingPorts && nus.szIncomingPorts[0]) nlb.wPort = 0; else { - //MessageBox( NULL, "Debug message using default port!", MSG_BOX_TITEL, MB_OK ); + //MessageBox( NULL, _T("Debug message using default port!"), MSG_BOX_TITEL, MB_OK ); nlb.wPort = 80; } hDirectBoundPort = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM) & nlb); if (!hDirectBoundPort) { char szTemp[200]; - _snprintf(szTemp, sizeof(szTemp), "Failed to bind to port %s\r\nThis is most likely because another program or service is using this port" , + mir_snprintf(szTemp, sizeof(szTemp), "Failed to bind to port %s\r\nThis is most likely because another program or service is using this port" , nlb.wPort == 80 ? "80" : nus.szIncomingPorts); MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK); return 1001; @@ -756,13 +707,13 @@ long nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { dwLocalIpAddress = nlb.dwInternalIP; mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DISABLE_SERVER)); - mi.pszName = Translate("Disable HTTP server"); + mi.ptszName = LPGENT("Disable HTTP server"); Netlib_Logf(hNetlibUser, mi.pszName); } else if (hDirectBoundPort && wparam == 0) { Netlib_CloseHandle(hDirectBoundPort); hDirectBoundPort = 0; mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); - mi.pszName = Translate("Enable HTTP server"); + mi.ptszName = LPGENT("Enable HTTP server"); Netlib_Logf(hNetlibUser, mi.pszName); } else { return 0; // no changes; @@ -852,12 +803,12 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING | NUF_INCOMING /*| NUF_HTTPCONNS*/; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR /*| NUF_HTTPCONNS*/; nlu.szSettingsModule = MODULE; - nlu.szDescriptiveName = "HTTP Server"; + nlu.ptszDescriptiveName = LPGENT("HTTP Server"); hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu); if (!hNetlibUser) { - MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to register NetLib user"), MSG_BOX_TITEL, MB_OK); return 0; } @@ -983,48 +934,45 @@ extern "C" { int __declspec(dllexport)Load(PLUGINLINK *link) { pluginLink = link; - /* - MM_INTERFACE stMirandaMMI; - CallService( MS_SYSTEM_GET_MMI, NULL, (LPARAM) &stMirandaMMI ); - MirandaMalloc = stMirandaMMI.malloc; - MirandaFree = stMirandaMMI.free; - */ + mir_getMMI(&mmi); + mir_getLP(&pluginInfo); + InitializeCriticalSection(&csFileShareListAccess); hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections); if (! hHttpAcceptConnectionsService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS"), MSG_BOX_TITEL, MB_OK); return 0; } hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare); if (! hHttpAddChangeRemoveService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE"), MSG_BOX_TITEL, MB_OK); return 0; } hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare); if (! hHttpGetShareService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_SHARE"), MSG_BOX_TITEL, MB_OK); return 0; } hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares); if (! hHttpGetAllShares) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES"), MSG_BOX_TITEL, MB_OK); return 0; } hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); if (!hEventSystemInit) { - MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_MODULESLOADED"), MSG_BOX_TITEL, MB_OK); return 0; } hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); if (!hPreShutdown) { - MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to HookEvent ME_SYSTEM_PRESHUTDOWN"), MSG_BOX_TITEL, MB_OK); return 0; } @@ -1041,7 +989,7 @@ extern "C" { sLogFilePath += "HTTPServer.log"; if (! bInitMimeHandling()) { - MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(NULL, _T("Failed to read configuration file : ") szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); } // Plugin sweeper support @@ -1058,11 +1006,11 @@ extern "C" { CLISTMENUITEM mi; ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); - mi.flags = 0; + mi.flags = CMIF_TCHAR; mi.pszContactOwner = NULL; //all contacts mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); mi.position = 1000085000; - mi.pszName = Translate("Enable HTTP server"); + mi.ptszName = LPGENT("Enable HTTP server"); mi.pszService = MS_HTTP_ACCEPT_CONNECTIONS; hAcceptConnectionsMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) & mi); } -- cgit v1.2.3