diff options
31 files changed, 221 insertions, 335 deletions
| diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.libBinary files differ index 300d38d115..92ef0ea82b 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.libBinary files differ index fa853c7ade..8c301e3aab 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.libBinary files differ index 300d38d115..92ef0ea82b 100644 --- a/bin12/lib/mir_core.lib +++ b/bin12/lib/mir_core.lib diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.libBinary files differ index fa853c7ade..8c301e3aab 100644 --- a/bin12/lib/mir_core64.lib +++ b/bin12/lib/mir_core64.lib diff --git a/include/m_string.h b/include/m_string.h index a97038a1ca..4619222fe9 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -458,26 +458,6 @@ public:  		memset(pch, ch, nLength);
  	}
 -	static BSTR __stdcall AllocSysString(const char* pchData, int nDataLength)
 -	{
 -		int nLen = ::MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pchData, nDataLength, NULL, NULL);
 -		BSTR bstr = ::SysAllocStringLen(NULL, nLen);
 -		if (bstr != NULL)
 -			::MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pchData, nDataLength, bstr, nLen);
 -
 -		return bstr;
 -	}
 -
 -	static BOOL __stdcall ReAllocSysString(const char* pchData, BSTR* pbstr, int nDataLength)
 -	{
 -		int nLen = ::MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pchData, nDataLength, NULL, NULL);
 -		BOOL bSuccess = ::SysReAllocStringLen(pbstr, NULL, nLen);
 -		if (bSuccess)
 -			::MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pchData, nDataLength, *pbstr, nLen);
 -
 -		return bSuccess;
 -	}
 -
  	static int __stdcall SafeStringLen(LPCSTR psz)
  	{
  		// returns length in bytes
 @@ -691,16 +671,6 @@ public:  		}
  	}
 -	static BSTR __stdcall AllocSysString(const wchar_t* pchData, int nDataLength)
 -	{
 -		return ::SysAllocStringLen(pchData, nDataLength);
 -	}
 -
 -	static BOOL __stdcall ReAllocSysString(const wchar_t* pchData, BSTR* pbstr, int nDataLength)
 -	{
 -		return ::SysReAllocStringLen(pbstr, pchData, nDataLength);
 -	}
 -
  	static int __stdcall SafeStringLen(LPCSTR psz)
  	{
  		// returns length in bytes
 @@ -924,13 +894,7 @@ public:  	void   AppendFormatV(PCXSTR pszFormat, va_list args);
  	// return a copy of string to be freed by mir_free()
 -	PXSTR Detouch() const;
 -
 -	// OLE BSTR support
 -
 -	// allocate a BSTR containing a copy of the string
 -	BSTR AllocSysString() const;
 -	BSTR SetSysString(BSTR* pbstr) const;
 +	PXSTR Detach() const;
  	// Set the string to the value of environment variable 'pszVar'
  	BOOL GetEnvironmentVariable(PCXSTR pszVar);
 diff --git a/include/m_string.inl b/include/m_string.inl index 4615319416..5167a15028 100644 --- a/include/m_string.inl +++ b/include/m_string.inl @@ -1376,22 +1376,6 @@ typename CMStringT<BaseType, StringTraits>::PCXSTR CMStringT<BaseType, StringTra  	return GetString();
  }
 -// OLE BSTR support
 -
 -// allocate a BSTR containing a copy of the string
 -template< typename BaseType, class StringTraits >
 -BSTR CMStringT<BaseType, StringTraits>::AllocSysString() const
 -{
 -	return StringTraits::AllocSysString(this->GetString(), this->GetLength());
 -}
 -
 -template< typename BaseType, class StringTraits >
 -BSTR CMStringT<BaseType, StringTraits>::SetSysString(BSTR* pbstr) const
 -{
 -	StringTraits::ReAllocSysString(this->GetString(), pbstr, this->GetLength());
 -	return *pbstr;
 -}
 -
  // Set the string to the value of environment variable 'pszVar'
  template< typename BaseType, class StringTraits >
  BOOL CMStringT<BaseType, StringTraits>::GetEnvironmentVariable(PCXSTR pszVar)
 @@ -1413,7 +1397,7 @@ BOOL CMStringT<BaseType, StringTraits>::GetEnvironmentVariable(PCXSTR pszVar)  // Set the string to the value of environment variable 'pszVar'
  template< typename BaseType, class StringTraits >
 -typename CMStringT<BaseType, StringTraits>::PXSTR CMStringT<BaseType, StringTraits>::Detouch() const
 +typename CMStringT<BaseType, StringTraits>::PXSTR CMStringT<BaseType, StringTraits>::Detach() const
  {
  	return StringTraits::MirCopy(CMStringT<BaseType, StringTraits>::GetString(), GetLength());
  }
 diff --git a/include/m_utils.h b/include/m_utils.h index ad381b7545..d4662d3370 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -33,7 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include <stdio.h>
  #if !defined(M_SYSTEM_H__)
 -#include "m_system.h"
 +#include <m_system.h>
 +#endif
 +
 +#if !defined(M_STRING_H__)
 +#include <m_string.h>
  #endif
  //this entire module is v0.1.0.1+
 @@ -136,14 +140,17 @@ struct CountryListEntry {  /******************************* Window lists *******************************/
 +/////////////////////////////////////////////////////////////////////////////////////////
  // allocates a window list
  // wParam = lParam = 0 (unused)
  // returns a handle to the new window list
 +
  #define MS_UTILS_ALLOCWINDOWLIST "Utils/AllocWindowList"
  __forceinline HANDLE WindowList_Create(void)
  {	return (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // destroys a window list
  // wParam = (HANDLE) window list handle
  // lParam = 0 (unused)
 @@ -153,10 +160,12 @@ __forceinline HANDLE WindowList_Destroy(HANDLE hList)  {	return (HANDLE)CallService(MS_UTILS_DESTROYWINDOWLIST, (WPARAM)hList, 0);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // adds a window to the specified window list
  // wParam = 0
  // lParam = (LPARAM)(WINDOWLISTENTRY*)&wle
  // returns 0 on success, nonzero on failure
 +
  typedef struct {
  	HANDLE hList;
  	HWND hwnd;
 @@ -169,29 +178,35 @@ __forceinline INT_PTR WindowList_Add(HANDLE hList, HWND hwnd, MCONTACT hContact)  	return CallService(MS_UTILS_ADDTOWINDOWLIST, 0, (LPARAM)&wle);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // removes a window from the specified window list
  // wParam = (WPARAM)(HANDLE)hList
  // lParam = (LPARAM)(HWND)hwnd
  // returns 0 on success, nonzero on failure
 +
  #define MS_UTILS_REMOVEFROMWINDOWLIST "Utils/RemoveFromWindowList"
  __forceinline INT_PTR WindowList_Remove(HANDLE hList, HWND hwnd) {
  	return CallService(MS_UTILS_REMOVEFROMWINDOWLIST, (WPARAM)hList, (LPARAM)hwnd);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // finds a window given the hContact
  // wParam = (WPARAM)(HANDLE)hList
  // lParam = (MCONTACT)hContact
  // returns the window handle on success, or NULL on failure
 +
  #define MS_UTILS_FINDWINDOWINLIST "Utils/FindWindowInList"
  __forceinline HWND WindowList_Find(HANDLE hList, MCONTACT hContact) {
  	return (HWND)CallService(MS_UTILS_FINDWINDOWINLIST, (WPARAM)hList, hContact);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // sends a message to all windows in a list using SendMessage
  // wParam = (WPARAM)(HANDLE)hList
  // lParam = (LPARAM)(MSG*)&msg
  // returns 0 on success, nonzero on failure
  // Only msg.message, msg.wParam and msg.lParam are used
 +
  #define MS_UTILS_BROADCASTTOWINDOWLIST "Utils/BroadcastToWindowList"
  __forceinline INT_PTR WindowList_Broadcast(HANDLE hList, UINT message, WPARAM wParam, LPARAM lParam) {
  	MSG msg;
 @@ -199,11 +214,13 @@ __forceinline INT_PTR WindowList_Broadcast(HANDLE hList, UINT message, WPARAM wP  	return CallService(MS_UTILS_BROADCASTTOWINDOWLIST, (WPARAM)hList, (LPARAM)&msg);
  }
 +/////////////////////////////////////////////////////////////////////////////////////////
  // sends a message to all windows in a list using PostMessage
  // wParam = (WPARAM)(HANDLE)hList
  // lParam = (LPARAM)(MSG*)&msg
  // returns 0 on success, nonzero on failure
  // Only msg.message, msg.wParam and msg.lParam are used
 +
  #define MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC "Utils/BroadcastToWindowListAsync"
  __forceinline INT_PTR WindowList_BroadcastAsync(HANDLE hList, UINT message, WPARAM wParam, LPARAM lParam) {
 @@ -219,10 +236,13 @@ __forceinline INT_PTR WindowList_BroadcastAsync(HANDLE hList, UINT message, WPAR  //the control will obey the SS_LEFT (0), SS_CENTER (1), and SS_RIGHT (2) styles
  //the control will send STN_CLICKED via WM_COMMAND when the link itself is clicked
 +/////////////////////////////////////////////////////////////////////////////////////////
  // Use this in a SendMessage to set the color of the url when control is enabled
  // wParam = DWORD color
  // lParam = not used
  #define HLK_SETENABLECOLOUR	 (WM_USER+101) // added in 0.3.1
 +
 +/////////////////////////////////////////////////////////////////////////////////////////
  // Use this in a SendMessage to set the color of the url when control is disabled
  // wParam = DWORD color
  // lParam = not used
 @@ -230,10 +250,11 @@ __forceinline INT_PTR WindowList_BroadcastAsync(HANDLE hList, UINT message, WPAR  /***************************** Window Position Saving ***************************/
 -//saves the position of a window in the database   v0.1.1.0+
 -//wParam = 0
 -//lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
 -//returns 0 on success, nonzero on failure
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// saves the position of a window in the database   v0.1.1.0+
 +// wParam = 0
 +// lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
 +// returns 0 on success, nonzero on failure
  typedef struct {
  	HWND hwnd;
  	MCONTACT hContact;
 @@ -247,14 +268,15 @@ __forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, con  	return CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, (LPARAM)&swp);
  }
 -//restores the position of a window from the database	 v0.1.1.0+
 -//wParam = flags
 -//lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
 -//returns 0 on success, nonzero on failure
 -//if no position was found in the database, the function returns 1 and does
 -//nothing
 -//the NoSize version won't use stored size information: the window is left the
 -//same size.
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// restores the position of a window from the database	 v0.1.1.0+
 +// wParam = flags
 +// lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
 +// returns 0 on success, nonzero on failure
 +// if no position was found in the database, the function returns 1 and does
 +// nothing
 +// the NoSize version won't use stored size information: the window is left the same size.
 +
  #define RWPF_NOSIZE 	1  //don't use stored size info: leave dialog same size
  #define RWPF_NOMOVE 	2  //don't use stored position
  #define RWPF_NOACTIVATE 4  //show but don't activate v0.3.3.0+
 @@ -275,10 +297,12 @@ __forceinline INT_PTR Utils_RestoreWindowPositionNoMove(HWND hwnd, MCONTACT hCon  	return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOMOVE, hContact, szModule, szNamePrefix);
  }
 -//Moves a RECT inside screen if it is outside.It works with multiple monitors	 v0.9.0.4+
 -//wParam = RECT *
 -//lParam = 0
 -//returns <0 on error, 0 if not changed the rect, 1 if changed the rect
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Moves a RECT inside screen if it is outside.It works with multiple monitors	 v0.9.0.4+
 +// wParam = RECT *
 +// lParam = 0
 +// returns <0 on error, 0 if not changed the rect, 1 if changed the rect
 +
  #define MS_UTILS_ASSERTINSIDESCREEN	"Utils/AssertInsideScreen"
  __forceinline INT_PTR Utils_AssertInsideScreen(RECT *rc) {
  	return CallService(MS_UTILS_ASSERTINSIDESCREEN, (WPARAM)rc, 0);
 @@ -296,70 +320,101 @@ __forceinline INT_PTR Utils_AssertInsideScreen(RECT *rc) {  /***************************** Bitmap Filter (0.1.2.1+) *************************/
 -//Loads a bitmap								v0.1.2.1+
 -//wParam = 0
 -//lParam = (LPARAM)(const char*)filename
 -//returns HBITMAP on success, NULL on failure
 -//This function uses OleLoadPicturePath() so supports BMP, JPEG and GIF. It may
 -//support PNG on future versions of Windows (or XP for that matter)
 -//For speed, if the file extension is .bmp or .rle it'll use LoadImage() so as
 -//to avoid the big lag loading OLE.
 -//Remember to DeleteObject() when you're done
 -#define MS_UTILS_LOADBITMAP   "Utils/LoadBitmap"
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Loads a bitmap								v0.1.2.1+
 +// wParam = 0
 +// lParam = (LPARAM)(const char*)filename
 +// returns HBITMAP on success, NULL on failure
 +// This function uses OleLoadPicturePath() so supports BMP, JPEG and GIF. It may
 +// support PNG on future versions of Windows (or XP for that matter)
 +// For speed, if the file extension is .bmp or .rle it'll use LoadImage() so as
 +// to avoid the big lag loading OLE.
 +// Remember to DeleteObject() when you're done
 +
 +#define MS_UTILS_LOADBITMAP "Utils/LoadBitmap"
 +#define MS_UTILS_LOADBITMAPW "Utils/LoadBitmapW"
  #ifdef _UNICODE
 -	#define MS_UTILS_LOADBITMAPW  "Utils/LoadBitmapW"
  	#define MS_UTILS_LOADBITMAPT MS_UTILS_LOADBITMAPW
  #else
  	#define MS_UTILS_LOADBITMAPT MS_UTILS_LOADBITMAP
  #endif
 -//Gets the filter strings for use in the open file dialog	   v0.1.2.1+
 -//wParam = cbLengthOfBuffer
 -//lParam = (LPARAM)(char*)pszBuffer
 -//Returns 0 on success, nonzero on failure
 -//See the MSDN under OPENFILENAME.lpstrFilter for the formatting
 -//An 'All Bitmaps' item is always first and 'All Files' is last.
 -//The returned string is already translated.
 -#define MS_UTILS_GETBITMAPFILTERSTRINGS  "Utils/GetBitmapFilterStrings"
 -
 -//Saves a path to a relative path (from the miranda directory)
 -//Only saves as a relative path if the file is in the miranda directory (or
 -//sub directory)
 -//wParam = (WPARAM)(char*)pszPath
 -//lParam = (LPARAM)(char*)pszNewPath
 -//pszPath is the path to convert and pszNewPath is the buffer that
 -//the new path is copied too.  pszNewPath MUST be of the size MAX_PATH.
 -//Returns numbers of chars copied.
 -//Unicode version is available since 0.6.2
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Gets the filter strings for use in the open file dialog
 +// See the MSDN under OPENFILENAME.lpstrFilter for the formatting
 +// An 'All Bitmaps' item is always first and 'All Files' is last.
 +// The returned string is already translated.
 +
 +EXTERN_C MIR_CORE_DLL(void) BmpFilterGetStrings(TCHAR *dest, size_t destLen);
 +
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Saves a path to a relative path (from the miranda directory)
 +// Only saves as a relative path if the file is in the miranda directory (or
 +// sub directory)
 +// wParam = (WPARAM)(char*)pszPath
 +// lParam = (LPARAM)(char*)pszNewPath
 +// pszPath is the path to convert and pszNewPath is the buffer that
 +// the new path is copied too.  pszNewPath MUST be of the size MAX_PATH.
 +// Returns numbers of chars copied.
 +// Unicode version is available since 0.6.2
 +
  #define MS_UTILS_PATHTORELATIVE "Utils/PathToRelative"
 +#define MS_UTILS_PATHTORELATIVEW "Utils/PathToRelativeW"
 +
 +#ifdef _UNICODE
 +	#define MS_UTILS_PATHTORELATIVET MS_UTILS_PATHTORELATIVEW
 +#else
 +	#define MS_UTILS_PATHTORELATIVET MS_UTILS_PATHTORELATIVE
 +#endif
 +
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Saves a path to a absolute path (from the miranda directory)
 +// wParam = (WPARAM)(char*)pszPath
 +// lParam = (LPARAM)(char*)pszNewPath
 +// pszPath is the path to convert and pszNewPath is the buffer that
 +// the new path is copied too.  pszNewPath MUST be of the size MAX_PATH.
 +// Returns numbers of chars copied.
 +// Unicode version is available since 0.6.2
 -//Saves a path to a absolute path (from the miranda directory)
 -//wParam = (WPARAM)(char*)pszPath
 -//lParam = (LPARAM)(char*)pszNewPath
 -//pszPath is the path to convert and pszNewPath is the buffer that
 -//the new path is copied too.  pszNewPath MUST be of the size MAX_PATH.
 -//Returns numbers of chars copied.
 -//Unicode version is available since 0.6.2
  #define MS_UTILS_PATHTOABSOLUTE "Utils/PathToAbsolute"
 +#define MS_UTILS_PATHTOABSOLUTEW "Utils/PathToAbsoluteW"
 +
 +#ifdef _UNICODE
 +	#define MS_UTILS_PATHTOABSOLUTET MS_UTILS_PATHTOABSOLUTEW
 +#else
 +	#define MS_UTILS_PATHTOABSOLUTET MS_UTILS_PATHTOABSOLUTE
 +#endif
 +
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Creates a directory tree (even more than one directories levels are missing) 0.7.0+
 +// wParam = 0 (unused)
 +// lParam = (LPARAM)(char*)pszPath - directory to be created
 +// Returns 0 on success error code otherwise
 +// Unicode version is available since 0.7.0
 -//Creates a directory tree (even more than one directories levels are missing) 0.7.0+
 -//wParam = 0 (unused)
 -//lParam = (LPARAM)(char*)pszPath - directory to be created
 -//Returns 0 on success error code otherwise
 -//Unicode version is available since 0.7.0
  #define MS_UTILS_CREATEDIRTREE "Utils/CreateDirTree"
 +#define MS_UTILS_CREATEDIRTREEW "Utils/CreateDirTreeW"
 +
 +#ifdef _UNICODE
 +	#define MS_UTILS_CREATEDIRTREET MS_UTILS_CREATEDIRTREEW
 +#else
 +	#define MS_UTILS_CREATEDIRTREET MS_UTILS_CREATEDIRTREE
 +#endif
 +/////////////////////////////////////////////////////////////////////////////////////////
  // Generates Random number of any length
 -//wParam = size - length of the random number to generate
 -//lParam = (LPARAM)(char*)pszArray - pointer to array to fill with random number
 -//Always returns 0
 +// wParam = size - length of the random number to generate
 +// lParam = (LPARAM)(char*)pszArray - pointer to array to fill with random number
 +// Always returns 0
 +
  #define MS_UTILS_GETRANDOM "Utils/GetRandom"
 -//Replace variables in text
 -//wParam = (char*/TCHAR*/WCHAR*)string (depends on RVF_UNICODE/RVF_TCHAR flag)
 -//lParam = (REPLACEVARSDATA *) data about variables, item with key = 0 terminates the list
 -//returns new string, use mir_free to destroy
 +/////////////////////////////////////////////////////////////////////////////////////////
 +// Replace variables in text
 +// wParam = (char*/TCHAR*/WCHAR*)string (depends on RVF_UNICODE/RVF_TCHAR flag)
 +// lParam = (REPLACEVARSDATA *) data about variables, item with key = 0 terminates the list
 +// returns new string, use mir_free to destroy
  // variables known by the core:
  // ----------------------------
 @@ -452,23 +507,6 @@ __forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {  	};
  #endif
 -#ifdef _UNICODE
 -	#define MS_UTILS_PATHTORELATIVEW         "Utils/PathToRelativeW"
 -	#define MS_UTILS_PATHTOABSOLUTEW         "Utils/PathToAbsoluteW"
 -	#define MS_UTILS_CREATEDIRTREEW          "Utils/CreateDirTreeW"
 -	#define MS_UTILS_GETBITMAPFILTERSTRINGSW "Utils/GetBitmapFilterStringsW"
 -
 -	#define MS_UTILS_PATHTORELATIVET         MS_UTILS_PATHTORELATIVEW
 -	#define MS_UTILS_PATHTOABSOLUTET         MS_UTILS_PATHTOABSOLUTEW
 -	#define MS_UTILS_CREATEDIRTREET          MS_UTILS_CREATEDIRTREEW
 -	#define MS_UTILS_GETBITMAPFILTERSTRINGST MS_UTILS_GETBITMAPFILTERSTRINGSW
 -#else
 -	#define MS_UTILS_PATHTORELATIVET         MS_UTILS_PATHTORELATIVE
 -	#define MS_UTILS_PATHTOABSOLUTET         MS_UTILS_PATHTOABSOLUTE
 -	#define MS_UTILS_CREATEDIRTREET          MS_UTILS_CREATEDIRTREE
 -	#define MS_UTILS_GETBITMAPFILTERSTRINGST MS_UTILS_GETBITMAPFILTERSTRINGS
 -#endif
 -
  /////////////////////////////////////////////////////////////////////////////////////////
  // one field form
 @@ -493,10 +531,12 @@ typedef struct  }
  ENTER_STRING;
 +/////////////////////////////////////////////////////////////////////////////////////////
  // enters one string
  // wParam = 0 (unused)
  // lParam = ENTER_STRING* (form description)
  // returns TRUE on pressing OK or FALSE if Cancel was pressed
 +
  #define MS_UTILS_ENTERSTRING "Utils/EnterString"
  __forceinline BOOL EnterString(ENTER_STRING *pForm)
 diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 4506c4011f..02ec9a34e0 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -99,13 +99,10 @@ static void RemoveProtoPic(const char *szProto)  static void SetProtoPic(char *szProto)  { -	TCHAR FileName[MAX_PATH]; -	OPENFILENAME ofn = { 0 }; -	TCHAR filter[256]; - -	filter[0] = '\0'; -	CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter); +	TCHAR FileName[MAX_PATH], filter[256]; +	BmpFilterGetStrings(filter, SIZEOF(filter));
 +	OPENFILENAME ofn = { 0 };  	ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;  	ofn.lpstrFilter = filter;  	ofn.hwndOwner = 0; diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index e7e19cab09..7411849efa 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -127,12 +127,10 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath)  	int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
  	if (tszPath == NULL) {
 -		OPENFILENAME ofn = { 0 };
  		TCHAR filter[256];
 +		BmpFilterGetStrings(filter, SIZEOF(filter));
 -		filter[0] = '\0';
 -		CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter);
 -
 +		OPENFILENAME ofn = { 0 };
  		ofn.lStructSize = sizeof(ofn);
  		ofn.hwndOwner = 0;
  		ofn.lpstrFile = FileName;
 @@ -257,7 +255,7 @@ static int InternalRemoveMyAvatar(char *protocol)  static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf)
  {
 -	filter.AppendFormat(_T("%s (*.bmp;*.jpg;*.gif;*.png"), TranslateT("All Files"));
 +	filter.AppendFormat(_T("%s (*.bmp;*.jpg;*.gif;*.png"), TranslateT("All files"));
  	if (swf) filter.Append(_T(";*.swf"));
  	if (xml) filter.Append(_T(";*.xml"));
 @@ -266,16 +264,16 @@ static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf)  	if (xml) filter.Append(_T(";*.XML"));
  	filter.AppendChar(0);
 -	filter.AppendFormat(_T("%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"), TranslateT("Windows Bitmaps"), 0, 0);
 -	filter.AppendFormat(_T("%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"), TranslateT("JPEG Bitmaps"), 0, 0);
 -	filter.AppendFormat(_T("%s (*.gif)%c*.GIF%c"), TranslateT("GIF Bitmaps"), 0, 0);
 -	filter.AppendFormat(_T("%s (*.png)%c*.PNG%c"), TranslateT("PNG Bitmaps"), 0, 0);
 +	filter.AppendFormat(_T("%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"), TranslateT("Windows bitmaps"), 0, 0);
 +	filter.AppendFormat(_T("%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"), TranslateT("JPEG bitmaps"), 0, 0);
 +	filter.AppendFormat(_T("%s (*.gif)%c*.GIF%c"), TranslateT("GIF bitmaps"), 0, 0);
 +	filter.AppendFormat(_T("%s (*.png)%c*.PNG%c"), TranslateT("PNG bitmaps"), 0, 0);
  	if (swf)
 -		filter.AppendFormat(_T("%s (*.swf)%c*.SWF%c"), TranslateT("Flash Animations"), 0, 0);
 +		filter.AppendFormat(_T("%s (*.swf)%c*.SWF%c"), TranslateT("Flash animations"), 0, 0);
  	if (xml)
 -		filter.AppendFormat(_T("%s (*.xml)%c*.XML%c"), TranslateT("XML Files"), 0, 0);
 +		filter.AppendFormat(_T("%s (*.xml)%c*.XML%c"), TranslateT("XML files"), 0, 0);
  	filter.AppendChar(0);
  }
 diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index d94c292e82..3489960f50 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -537,15 +537,14 @@ static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam)  int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact)
  {
 -	TCHAR filter[MAX_PATH];
 -	TCHAR file[MAX_PATH];
 -	OPENFILENAME ofn;
 -	memset(&ofn, 0, sizeof(OPENFILENAME));
 -	ofn.lStructSize = sizeof(OPENFILENAME);
 +	TCHAR filter[MAX_PATH], file[MAX_PATH];
 +	BmpFilterGetStrings(filter, SIZEOF(filter));
 +
 +	OPENFILENAME ofn = { 0 };
 +	ofn.lStructSize = sizeof(ofn);
  	ofn.hwndOwner = hwnd;
  	ofn.hInstance = hInst;
 -	CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, MAX_PATH, (LPARAM)filter);
  	ofn.lpstrFilter = filter;
  	ofn.nFilterIndex = 1;
 diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index dacd58ece0..57c9025fe5 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -1368,14 +1368,13 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,  	case WM_COMMAND:
  		if (LOWORD(wParam) == IDC_BROWSE) {
 -			TCHAR str[MAX_PATH];
 -			TCHAR filter[512];
 +			TCHAR str[MAX_PATH], filter[512];
 +			BmpFilterGetStrings(filter, SIZEOF(filter));
 +			GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
  			OPENFILENAME ofn = { 0 };
 -			GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
  			ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
  			ofn.hwndOwner = hwndDlg;
 -			CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter);
  			ofn.lpstrFilter = filter;
  			ofn.lpstrFile = str;
  			ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
 diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 9948c37ed3..23a6b172d4 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -740,26 +740,26 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,  		Utils::enableDlgControl(hwndDlg, IDC_SCROLL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
  		Utils::enableDlgControl(hwndDlg, IDC_PROPORTIONAL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
  		break;
 +	
  	case WM_COMMAND:
  		if (LOWORD(wParam) == IDC_BROWSE) {
 -			char str[MAX_PATH];
 -			OPENFILENAMEA ofn = { 0 };
 -			char filter[512];
 +			TCHAR str[MAX_PATH], filter[512];
 +			GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 +			BmpFilterGetStrings(filter, SIZEOF(filter));
 -			GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 +			OPENFILENAME ofn = { 0 };
  			ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
  			ofn.hwndOwner = hwndDlg;
  			ofn.hInstance = NULL;
 -			CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter);
  			ofn.lpstrFilter = filter;
  			ofn.lpstrFile = str;
  			ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
  			ofn.nMaxFile = SIZEOF(str);
  			ofn.nMaxFileTitle = MAX_PATH;
 -			ofn.lpstrDefExt = "bmp";
 -			if (!GetOpenFileNameA(&ofn))
 +			ofn.lpstrDefExt = _T("bmp");
 +			if (!GetOpenFileName(&ofn))
  				break;
 -			SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
 +			SetDlgItemText(hwndDlg, IDC_FILENAME, str);
  		}
  		else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
  			break;
 diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b913ee7822..0571b83aa8 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -244,24 +244,22 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP  		case IDC_BROWSE:
  			{
 -				char str[MAX_PATH];
 -				OPENFILENAMEA ofn = {0};
 -				char filter[512];
 +				TCHAR str[MAX_PATH], filter[512];
 +				GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 +				BmpFilterGetStrings(filter, SIZEOF(filter));
 -				GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 -				ofn.lStructSize = sizeof(OPENFILENAMEA);
 +				OPENFILENAME ofn = {0};
 +				ofn.lStructSize = sizeof(ofn);
  				ofn.hwndOwner = hwndDlg;
 -				ofn.hInstance = NULL;
 -				CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter);
  				ofn.lpstrFilter = filter;
  				ofn.lpstrFile = str;
  				ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
  				ofn.nMaxFile = SIZEOF(str);
  				ofn.nMaxFileTitle = MAX_PATH;
 -				ofn.lpstrDefExt = "bmp";
 -				if (!GetOpenFileNameA(&ofn))
 +				ofn.lpstrDefExt = _T("bmp");
 +				if (!GetOpenFileName(&ofn))
  					return FALSE;
 -				SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
 +				SetDlgItemText(hwndDlg, IDC_FILENAME, str);
  			}
  			break;
 diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 26e9bb388c..5a1fa0e324 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -5,8 +5,6 @@  #define _CRT_SECURE_NO_WARNINGS
 -#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
 -
  #include <windows.h>
  #include <commctrl.h>
  #include <time.h>
 diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 1733c367ba..55bfc761b6 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -693,7 +693,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)  	}
  	str.AppendFormat("\\fi-%u\\li%u", iIndent, iIndent);
 -	return str.Detouch();
 +	return str.Detach();
  }
  static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
 @@ -824,7 +824,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)  		str.Append("\\par}");
  	else
  		str.Append("}");
 -	return str.Detouch();
 +	return str.Detach();
  }
  static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
 diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 570065774e..abf43caaa6 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -334,7 +334,7 @@ static char* CreateRTFHeader(TWindowData *dat)  {
  	CMStringA str;
  	Build_RTF_Header(str, dat);
 -	return str.Detouch();
 +	return str.Detach();
  }
  static void AppendTimeStamp(TCHAR *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, TWindowData *dat, int iFontIDOffset)
 @@ -970,7 +970,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,  	dat->iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType);
  	dat->lastEventTime = dbei.timestamp;
 -	return str.Detouch();
 +	return str.Detach();
  }
  static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
 diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 131b24518f..9992d0af5a 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -55,7 +55,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)  		szUniqueID = mir_tstrdup(tszID);
  	}
 -	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch();
 +	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach();
  }
  static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
 @@ -95,7 +95,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)  		szUniqueID = mir_tstrdup(tszID);
  	}
 -	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch();
 +	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach();
  }
  static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
 @@ -135,7 +135,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)  		szUniqueID = mir_tstrdup(tszID);
  	}
 -	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch();
 +	return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach();
  }
  void registerMetaContactsTokens()
 diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index c5e7ba3036..9952d6e826 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -333,10 +333,8 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			break;
  		case IDC_LOAD:
 -			TCHAR szFilter[512];
 -			TCHAR szFileName[MAX_PATH];
 -
 -			CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(szFilter), (LPARAM)szFilter);
 +			TCHAR szFilter[512], szFileName[MAX_PATH];
 +			BmpFilterGetStrings(szFilter, SIZEOF(szFilter));
  			OPENFILENAME ofn = { 0 };
  			ofn.lStructSize = sizeof(ofn);
 diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 147b467ecc..e0bf3fe270 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -2907,21 +2907,21 @@ void CleanupNicknames(char *) {  /////////////////////////////////////////////////////////////////////////////////////////
  // EnterBitmapFileName - enters a bitmap filename
 -int __stdcall EnterBitmapFileName(char* szDest)
 +int __stdcall EnterBitmapFileName(TCHAR *szDest)
  {
 -	char szFilter[512];
 -	OPENFILENAMEA ofn = { 0 };
 -	*szDest = 0;
 +	TCHAR szFilter[512];
 +	BmpFilterGetStrings(szFilter, SIZEOF(szFilter));
 -	CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof szFilter, (LPARAM)szFilter);
 +	*szDest = 0;
 +	OPENFILENAME ofn = { 0 };
  	ofn.lStructSize = sizeof(OPENFILENAME);
  	ofn.lpstrFilter = szFilter;
  	ofn.lpstrFile = szDest;
  	ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
  	ofn.nMaxFile = MAX_PATH;
  	ofn.nMaxFileTitle = MAX_PATH;
 -	ofn.lpstrDefExt = "bmp";
 -	if (!GetOpenFileNameA(&ofn))
 +	ofn.lpstrDefExt = _T("bmp");
 +	if (!GetOpenFileName(&ofn))
  		return 1;
  	return ERROR_SUCCESS;
 diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h index 7ad0ce8a99..bc4f9b2b67 100644 --- a/protocols/SkypeClassic/src/skype.h +++ b/protocols/SkypeClassic/src/skype.h @@ -145,7 +145,7 @@ time_t SkypeTime(time_t *timer);  void MessageSendWatchThread(void*);
  int OkToExit(WPARAM wParam, LPARAM lParam);
  int MirandaExit(WPARAM wParam, LPARAM lParam);
 -int __stdcall EnterBitmapFileName( char* szDest );
 +int __stdcall EnterBitmapFileName(TCHAR *szDest);
  void CleanupNicknames(char *dummy);
  int InitVSApi();
  int FreeVSApi();
 diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 358a95e153..ba9f04275f 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -780,18 +780,17 @@ INT_PTR CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)  		if ( HIWORD( wParam ) == BN_CLICKED ) {
  			switch( LOWORD( wParam )) {
  			case IDC_SETAVATAR:
 -			{
 -				char szFileName[ MAX_PATH ];
 -				if ( EnterBitmapFileName( szFileName ) != ERROR_SUCCESS )
 +				TCHAR szFileName[ MAX_PATH ];
 +				if (EnterBitmapFileName(szFileName) != ERROR_SUCCESS)
  					return FALSE;
 -				hAvatar = ( HBITMAP )CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )szFileName);
 -				if ( hAvatar != NULL ){
 -					SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar );
 +				hAvatar = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)szFileName);
 +				if (hAvatar != NULL){
 +					SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar);
  					CallService(SKYPE_SETAVATAR, 0, ( LPARAM )szFileName);
  				}
  				break;
 -			}
 +
  			case IDC_DELETEAVATAR:
  				if ( hAvatar != NULL ) {
  					DeleteObject( hAvatar );
 diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index cc7163c13f..adfd6ea1ca 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -258,21 +258,21 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) {  	DBVARIANT dbv;
  	if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
  		char *jid = dbv.pszVal;
 -		char szFilter[512];
 -		char *szFileName = (char*) mir_alloc(_MAX_PATH);
 -		OPENFILENAMEA ofn = {0};
 -		CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, ( WPARAM ) sizeof( szFilter ), ( LPARAM )szFilter );
 +		
 +		TCHAR tszFilter[512], tszFileName[MAX_PATH];
 +		BmpFilterGetStrings(tszFilter, SIZEOF(tszFilter));
 +		tszFileName[0] = '\0';
 +
 +		OPENFILENAME ofn = {0};
  		ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
 -		ofn.hwndOwner = NULL;
 -		ofn.lpstrFilter = szFilter;
 +		ofn.lpstrFilter = tszFilter;
  		ofn.lpstrCustomFilter = NULL;
 -		ofn.lpstrFile = szFileName;
 +		ofn.lpstrFile = tszFileName;
  		ofn.nMaxFile = _MAX_PATH;
  		ofn.Flags = OFN_FILEMUSTEXIST;
 -		szFileName[0] = '\0';
 -		if ( GetOpenFileNameA( &ofn )) {
 +		if (GetOpenFileName(&ofn)) {
  			long size;
 -			FILE* fp = fopen( szFileName, "rb" );
 +			FILE* fp = _tfopen(tszFileName, _T("rb"));
  			if (fp) {
  				fseek(fp, 0, SEEK_END);
  				size = ftell(fp);
 @@ -284,6 +284,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) {  					char idStr[10];
  					char fileBuffer[2048];
  					int id = TlenSerialNext(proto);
 +					T2Utf szFileName(tszFileName);
  					mir_snprintf(idStr, SIZEOF(idStr), "%d", id);
  					item = TlenListAdd(proto, LIST_PICTURE, idStr);
  					item->ft = TlenFileCreateFT(proto, jid);
 diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 68ccac9a58..e768dde43c 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -165,10 +165,8 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo)  void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
  {
 -	TCHAR tszFileName[MAX_PATH]; tszFileName[0] = '\0'; - -	TCHAR filter[256]; filter[0] = '\0'; -	CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter); +	TCHAR tszFileName[MAX_PATH], filter[256]; +	BmpFilterGetStrings(filter, SIZEOF(filter));
  	OPENFILENAME ofn = { 0 };  	ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 83e9154511..2350d7d947 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -334,24 +334,23 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,  		}
  	case WM_COMMAND:
  		if (LOWORD(wParam) == IDC_BROWSE) {
 -			char str[MAX_PATH];
 -			OPENFILENAMEA ofn = { 0 };
 -			char filter[512];
 +			TCHAR str[MAX_PATH], filter[512];
 +			GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 -			GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
 +			OPENFILENAME ofn = { 0 };
  			ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
  			ofn.hwndOwner = hwndDlg;
  			ofn.hInstance = NULL;
 -			CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, SIZEOF(filter), (LPARAM) filter);
 +			BmpFilterGetStrings(filter, SIZEOF(filter));
  			ofn.lpstrFilter = filter;
  			ofn.lpstrFile = str;
  			ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
  			ofn.nMaxFile = SIZEOF(str);
  			ofn.nMaxFileTitle = MAX_PATH;
 -			ofn.lpstrDefExt = "bmp";
 -			if (!GetOpenFileNameA(&ofn))
 +			ofn.lpstrDefExt = _T("bmp");
 +			if (!GetOpenFileName(&ofn))
  				break;
 -			SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
 +			SetDlgItemText(hwndDlg, IDC_FILENAME, str);
  		}
  		else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
  			break;
 diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index 24abcbe7f0..8770eb8e40 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -37,6 +37,7 @@      <ClInclude Include="src\miranda.h" />
    </ItemGroup>
    <ItemGroup>
 +    <ClCompile Include="src\bitmaps.cpp" />
      <ClCompile Include="src\cmdline.cpp" />
      <ClCompile Include="src\http.cpp" />
      <ClCompile Include="src\icons.cpp" />
 diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index 8162971b59..7160a06293 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -112,6 +112,9 @@      <ClCompile Include="src\ui_utils.cpp">
        <Filter>Source Files</Filter>
      </ClCompile>
 +    <ClCompile Include="src\bitmaps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
    </ItemGroup>
    <ItemGroup>
      <ClInclude Include="src\commonheaders.h">
 diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj index 3c9ae7f200..626835ac80 100644 --- a/src/mir_core/mir_core_12.vcxproj +++ b/src/mir_core/mir_core_12.vcxproj @@ -28,6 +28,7 @@      <ClInclude Include="..\..\include\m_string.h" />
      <ClInclude Include="..\..\include\m_system.h" />
      <ClInclude Include="..\..\include\m_system_cpp.h" />
 +    <ClInclude Include="..\..\include\m_utils.h" />
      <ClInclude Include="src\commonheaders.h" />
      <ClInclude Include="src\json\internalJSONNode.h" />
      <ClInclude Include="src\json\JSONChildren.h" />
 @@ -40,6 +41,7 @@      <ClInclude Include="src\miranda.h" />
    </ItemGroup>
    <ItemGroup>
 +    <ClCompile Include="src\bitmaps.cpp" />
      <ClCompile Include="src\cmdline.cpp" />
      <ClCompile Include="src\http.cpp" />
      <ClCompile Include="src\icons.cpp" />
 diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters index 18af03d46d..ec0939a562 100644 --- a/src/mir_core/mir_core_12.vcxproj.filters +++ b/src/mir_core/mir_core_12.vcxproj.filters @@ -112,6 +112,9 @@      <ClCompile Include="src\json\JSONIterators.cpp">
        <Filter>Source Files\json</Filter>
      </ClCompile>
 +    <ClCompile Include="src\bitmaps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
    </ItemGroup>
    <ItemGroup>
      <ClInclude Include="..\..\include\m_core.h">
 @@ -171,6 +174,9 @@      <ClInclude Include="..\..\include\m_protoint.h">
        <Filter>Header Files</Filter>
      </ClInclude>
 +    <ClInclude Include="..\..\include\m_utils.h">
 +      <Filter>Header Files</Filter>
 +    </ClInclude>
    </ItemGroup>
    <ItemGroup>
      <None Include="..\..\include\m_string.inl">
 diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index ef180d7bdd..838a1d4b0b 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -372,8 +372,6 @@ mir_wstrcmpi                  @280  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@PBD@Z @370 NONAME
  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@PB_W@Z @371 NONAME
  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@_W@Z @372 NONAME
 -?AllocSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPA_WXZ @373 NONAME
 -?AllocSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @374 NONAME
  ?Append@?$CMSimpleStringT@D@@QAEXABV1@@Z @375 NONAME
  ?Append@?$CMSimpleStringT@D@@QAEXPBD@Z @376 NONAME
  ?Append@?$CMSimpleStringT@D@@QAEXPBDH@Z @377 NONAME
 @@ -500,8 +498,6 @@ mir_wstrcmpi                  @280  ?SetString@?$CMSimpleStringT@D@@QAEXPBDH@Z @498 NONAME
  ?SetString@?$CMSimpleStringT@_W@@QAEXPB_W@Z @499 NONAME
  ?SetString@?$CMSimpleStringT@_W@@QAEXPB_WH@Z @500 NONAME
 -?SetSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPA_WPAPA_W@Z @501 NONAME
 -?SetSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WPAPA_W@Z @502 NONAME
  ?SpanExcluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBE?AV1@PBD@Z @503 NONAME
  ?SpanExcluding@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBE?AV1@PB_W@Z @504 NONAME
  ?SpanIncluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBE?AV1@PBD@Z @505 NONAME
 @@ -731,8 +727,8 @@ mir_wstrcmpi                  @280  ?DeleteItem@CCtrlTreeView@@QAEXPAU_TREEITEM@@@Z @731 NONAME
  ?DeleteString@CCtrlCombo@@QAEXH@Z @732 NONAME
  ?DeleteString@CCtrlListBox@@QAEXH@Z @733 NONAME
 -?Detouch@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPADXZ @734 NONAME
 -?Detouch@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @735 NONAME
 +?Detach@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPADXZ @734 NONAME
 +?Detach@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @735 NONAME
  ?Disable@CCtrlBase@@QAEXXZ @736 NONAME
  ?DlgProc@CDlgBase@@MAEHIIJ@Z @737 NONAME
  ?DlgProc@CProtoIntDlgBase@@MAEHIIJ@Z @738 NONAME
 @@ -1242,3 +1238,4 @@ Proto_RegisterModule @1074 NONAME  ?isnull@JSONNode@@QBE_NXZ @1245 NONAME
  ??BJSONNode@@QBE_NXZ @1246 NONAME
  ?as_mstring@JSONNode@@QBE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1247 NONAME
 +BmpFilterGetStrings @1248
 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index c75553762f..248599e8b9 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -372,8 +372,6 @@ mir_wstrcmpi                  @280  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@PEBD@Z @370 NONAME
  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@PEB_W@Z @371 NONAME
  ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@_W@Z @372 NONAME
 -?AllocSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEA_WXZ @373 NONAME
 -?AllocSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @374 NONAME
  ?Append@?$CMSimpleStringT@D@@QEAAXAEBV1@@Z @375 NONAME
  ?Append@?$CMSimpleStringT@D@@QEAAXPEBD@Z @376 NONAME
  ?Append@?$CMSimpleStringT@D@@QEAAXPEBDH@Z @377 NONAME
 @@ -500,8 +498,6 @@ mir_wstrcmpi                  @280  ?SetString@?$CMSimpleStringT@D@@QEAAXPEBDH@Z @498 NONAME
  ?SetString@?$CMSimpleStringT@_W@@QEAAXPEB_W@Z @499 NONAME
  ?SetString@?$CMSimpleStringT@_W@@QEAAXPEB_WH@Z @500 NONAME
 -?SetSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEA_WPEAPEA_W@Z @501 NONAME
 -?SetSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WPEAPEA_W@Z @502 NONAME
  ?SpanExcluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBA?AV1@PEBD@Z @503 NONAME
  ?SpanExcluding@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBA?AV1@PEB_W@Z @504 NONAME
  ?SpanIncluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBA?AV1@PEBD@Z @505 NONAME
 @@ -731,8 +727,8 @@ mir_wstrcmpi                  @280  ?DeleteItem@CCtrlTreeView@@QEAAXPEAU_TREEITEM@@@Z @731 NONAME
  ?DeleteString@CCtrlCombo@@QEAAXH@Z @732 NONAME
  ?DeleteString@CCtrlListBox@@QEAAXH@Z @733 NONAME
 -?Detouch@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEADXZ @734 NONAME
 -?Detouch@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @735 NONAME
 +?Detach@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEADXZ @734 NONAME
 +?Detach@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @735 NONAME
  ?Disable@CCtrlBase@@QEAAXXZ @736 NONAME
  ?DlgProc@CDlgBase@@MEAA_JI_K_J@Z @737 NONAME
  ?DlgProc@CProtoIntDlgBase@@MEAA_JI_K_J@Z @738 NONAME
 @@ -1242,3 +1238,4 @@ Proto_RegisterModule @1074 NONAME  ?isnull@JSONNode@@QEBA_NXZ @1245 NONAME
  ??BJSONNode@@QEBA_NXZ @1246 NONAME
  ?as_mstring@JSONNode@@QEBA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1247 NONAME
 +BmpFilterGetStrings @1248
 diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index dddc7b8ca0..cd9d061e20 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -138,101 +138,9 @@ static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam)  ///////////////////////////////////////////////////////////////////////////////////////////////////
 -static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam)
 -{
 -	size_t bytesLeft = wParam;
 -	char *filter = (char*)lParam, *pfilter;
 -
 -	mir_strncpy(filter, Translate("All bitmaps"), bytesLeft); bytesLeft -= mir_strlen(filter);
 -	mir_strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft);
 -	pfilter = filter + mir_strlen(filter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_strncpy(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
 -	mir_strncat(pfilter, " (*.bmp;*.rle)", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*.BMP;*.RLE", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_strncpy(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
 -	mir_strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*.JPG;*.JPEG", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_strncpy(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
 -	mir_strncat(pfilter, " (*.gif)", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*.GIF", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_strncpy(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
 -	mir_strncat(pfilter, " (*.png)", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*.PNG", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_strncpy(pfilter, Translate("All files"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
 -	mir_strncat(pfilter, " (*)", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_strncpy(pfilter, "*", bytesLeft);
 -	pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	if (bytesLeft) *pfilter = '\0';
 -	return 0;
 -}
 -
 -static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam)
 -{
 -	size_t bytesLeft = wParam;
 -	TCHAR *filter = (TCHAR*)lParam, *pfilter;
 -
 -	mir_tstrncpy(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(filter);
 -	mir_tstrncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft);
 -	pfilter = filter + mir_tstrlen(filter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_tstrncpy(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
 -	mir_tstrncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*.BMP;*.RLE"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_tstrncpy(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
 -	mir_tstrncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*.JPG;*.JPEG"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_tstrncpy(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
 -	mir_tstrncat(pfilter, _T(" (*.gif)"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*.GIF"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_tstrncpy(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
 -	mir_tstrncat(pfilter, _T(" (*.png)"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*.PNG"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	mir_tstrncpy(pfilter, TranslateT("All files"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
 -	mir_tstrncat(pfilter, _T(" (*)"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -	mir_tstrncpy(pfilter, _T("*"), bytesLeft);
 -	pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
 -
 -	if (bytesLeft) *pfilter = '\0';
 -	return 0;
 -}
 -
  int InitBitmapFilter(void)
  {
  	CreateServiceFunction(MS_UTILS_LOADBITMAP, BmpFilterLoadBitmap);
 -	CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGS, BmpFilterGetStrings);
 -	CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW, BmpFilterGetStringsW);
  	CreateServiceFunction(MS_UTILS_LOADBITMAPW, BmpFilterLoadBitmapW);
  	return 0;
  }
 | 
