From 5afcb73210219d4d44ffb736067ee21cd866ca10 Mon Sep 17 00:00:00 2001
From: Kirill Volinsky <mataes2007@gmail.com>
Date: Thu, 28 Jun 2012 18:34:22 +0000
Subject: FileAsMessage: compilation fix

git-svn-id: http://svn.miranda-ng.org/main/trunk@672 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/FileAsMessage/base64.c                 |  93 ----------------
 plugins/FileAsMessage/crc32.cpp                |   2 +
 plugins/FileAsMessage/dialog.cpp               |  27 +++--
 plugins/FileAsMessage/fileecho.opt             | Bin 54784 -> 0 bytes
 plugins/FileAsMessage/fileecho.vcxproj         | 144 +++++--------------------
 plugins/FileAsMessage/fileecho.vcxproj.filters |   3 +
 plugins/FileAsMessage/main.cpp                 |  96 ++++++-----------
 plugins/FileAsMessage/main.h                   |  22 ++--
 plugins/FileAsMessage/optionsdlg.cpp           |  12 +--
 9 files changed, 88 insertions(+), 311 deletions(-)
 delete mode 100644 plugins/FileAsMessage/base64.c
 delete mode 100644 plugins/FileAsMessage/fileecho.opt

(limited to 'plugins/FileAsMessage')

diff --git a/plugins/FileAsMessage/base64.c b/plugins/FileAsMessage/base64.c
deleted file mode 100644
index 220cd85027..0000000000
--- a/plugins/FileAsMessage/base64.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#define XNetlib_GetBase64DecodedBufferSize(cchEncoded)  (((cchEncoded)>>2)*3)
-#define XNetlib_GetBase64EncodedBufferSize(cbDecoded)  (((cbDecoded)*4+11)/12*4+1)
-
-static char base64chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-int XNetlibBase64Encode(WPARAM wParam,LPARAM lParam)
-{
-	NETLIBBASE64 *nlb64=(NETLIBBASE64*)lParam;
-	int iIn;
-	char *pszOut;
-	PBYTE pbIn;
-
-	if(nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
-	}
-	if(nlb64->cchEncoded<XNetlib_GetBase64EncodedBufferSize(nlb64->cbDecoded)) {
-		SetLastError(ERROR_BUFFER_OVERFLOW);
-		return 0;
-	}
-	nlb64->cchEncoded=XNetlib_GetBase64EncodedBufferSize(nlb64->cbDecoded);
-	for(iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3,pbIn+=3,pszOut+=4) {
-		pszOut[0]=base64chars[pbIn[0]>>2];
-		if(nlb64->cbDecoded-iIn==1) {
-			pszOut[1]=base64chars[(pbIn[0]&3)<<4];
-			pszOut[2]='=';
-			pszOut[3]='=';
-			pszOut+=4;
-			break;
-		}
-		pszOut[1]=base64chars[((pbIn[0]&3)<<4)|(pbIn[1]>>4)];
-		if(nlb64->cbDecoded-iIn==2) {
-			pszOut[2]=base64chars[(pbIn[1]&0xF)<<2];
-			pszOut[3]='=';
-			pszOut+=4;
-			break;
-		}
-		pszOut[2]=base64chars[((pbIn[1]&0xF)<<2)|(pbIn[2]>>6)];
-		pszOut[3]=base64chars[pbIn[2]&0x3F];
-	}
-	pszOut[0]='\0';
-	return 1;
-}
-
-BYTE Base64CharToInt(char c)
-{
-	if(c>='A' && c<='Z') return c-'A';
-	if(c>='a' && c<='z') return c-'a'+26;
-	if(c>='0' && c<='9') return c-'0'+52;
-	if(c=='+') return 62;
-	if(c=='/') return 63;
-	if(c=='=') return 64;
-	return 255;
-}
-
-int XNetlibBase64Decode(WPARAM wParam,LPARAM lParam)
-{
-	NETLIBBASE64 *nlb64=(NETLIBBASE64*)lParam;
-	char *pszIn;
-	PBYTE pbOut;
-	BYTE b1,b2,b3,b4;
-	int iIn;
-
-	if(nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
-	}
-	if(nlb64->cchEncoded&3) {
-		SetLastError(ERROR_INVALID_DATA);
-		return 0;
-	}
-	if(nlb64->cbDecoded<XNetlib_GetBase64DecodedBufferSize(nlb64->cchEncoded)) {
-		SetLastError(ERROR_BUFFER_OVERFLOW);
-		return 0;
-	}
-	nlb64->cbDecoded=XNetlib_GetBase64DecodedBufferSize(nlb64->cchEncoded);
-	for(iIn=0,pszIn=nlb64->pszEncoded,pbOut=nlb64->pbDecoded;iIn<nlb64->cchEncoded;iIn+=4,pszIn+=4,pbOut+=3) {
-		b1=Base64CharToInt(pszIn[0]);
-		b2=Base64CharToInt(pszIn[1]);
-		b3=Base64CharToInt(pszIn[2]);
-		b4=Base64CharToInt(pszIn[3]);
-		if(b1==255 || b1==64 || b2==255 || b2==64 || b3==255 || b4==255) {
-			SetLastError(ERROR_INVALID_DATA);
-			return 0;
-		}
-		pbOut[0]=(b1<<2)|(b2>>4);
-		if(b3==64) {nlb64->cbDecoded-=2; break;}
-		pbOut[1]=(b2<<4)|(b3>>2);
-		if(b4==64) {nlb64->cbDecoded--; break;}
-		pbOut[2]=b4|(b3<<6);
-	}
-	return 1;
-}
diff --git a/plugins/FileAsMessage/crc32.cpp b/plugins/FileAsMessage/crc32.cpp
index e75eb6446e..ab34393f8d 100644
--- a/plugins/FileAsMessage/crc32.cpp
+++ b/plugins/FileAsMessage/crc32.cpp
@@ -1,3 +1,5 @@
+#include "main.h"
+
 const ulong CRCPoly = 0xEDB88320;
 ulong CRC32Table[256];
 
diff --git a/plugins/FileAsMessage/dialog.cpp b/plugins/FileAsMessage/dialog.cpp
index 8ed9a6d967..5f6a6d5afd 100644
--- a/plugins/FileAsMessage/dialog.cpp
+++ b/plugins/FileAsMessage/dialog.cpp
@@ -1,8 +1,4 @@
 #include"main.h"
-#include"dialog.h"
-#include"resource.h"
-
-#include"crc32.cpp"
 
 char *szFEMode[] =
 {
@@ -321,7 +317,7 @@ void FILEECHO::setState(DWORD state)
 	iState = state;
 	int indx;
 
-	for(indx = 0; indx < ARRAY_SIZE(controlEnabled); indx++)
+	for(indx = 0; indx < SIZEOF(controlEnabled); indx++)
 	{
 		EnableWindow(GetDlgItem(hDlg, controlEnabled[indx][0]), (iState & controlEnabled[indx][1]) != 0);
 	}
@@ -430,7 +426,7 @@ int FILEECHO::createTransfer()
 		{
 			uint freq_table[256];
 			uchar *data;
-			uint len, chunk_offset, chunk_size, out_size;
+			uint len, chunk_offset, chunk_size, out_size, indx;
 			int chunk_count_limit;
 
 			codeSymb = 1;
@@ -476,6 +472,7 @@ int FILEECHO::createTransfer()
 		{
 			int EncodedMaxLen = Base64_GetEncodedBufferSize(Base64_GetDecodedBufferSize(chunkMaxLen));
 			int DecodedMaxLen = Base64_GetDecodedBufferSize(EncodedMaxLen);
+			int indx = 0;
 
 			codeSymb = '-';
 			chunkCount = (fileSize + DecodedMaxLen - 1) / DecodedMaxLen;
@@ -812,7 +809,7 @@ void FILEECHO::cmdDATA(char *param)
 		uchar *temp_buffer;
 
 		nlb.pszEncoded = param;
-		nlb.cchEncoded = strlen(param);
+		nlb.cchEncoded = (int)_tcslen(param);
 		temp_buffer = (uchar*)malloc(nlb.cchEncoded);
 		nlb.pbDecoded = temp_buffer;
 		nlb.cbDecoded = nlb.cchEncoded;
@@ -988,9 +985,9 @@ int FILEECHO::sendCmd(int id, int cmd, char *szParam, char *szPrefix)
 {
 	char *buf;
 	int retval;
-	int buflen = strlen(szServicePrefix) + strlen(szParam) + 2;
+	int buflen = (int)_tcslen(szServicePrefix) + (int)_tcslen(szParam) + 2;
 	if(szPrefix != NULL)
-		buflen += strlen(szPrefix);
+		buflen += (int)_tcslen(szPrefix);
 	
 	buf = (char*)malloc(buflen);
 	if(szPrefix == NULL)
@@ -1021,11 +1018,11 @@ void CreateDirectoryTree(char *szDir)
 
 void SubclassWnd(HWND hwnd, WNDPROC lpfnWndProc)
 {
-	SetWindowLong(hwnd, GWL_USERDATA, (LONG)GetWindowLong(hwnd, GWL_WNDPROC));
-	SetWindowLong(hwnd, GWL_WNDPROC, (LONG)lpfnWndProc);
+	SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)GetWindowLongPtr(hwnd, GWLP_WNDPROC));
+	SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG)lpfnWndProc);
 }
 #define CallSubclassed(hwnd, uMsg, wParam, lParam)\
-	CallWindowProc((WNDPROC)GetWindowLong(hwnd, GWL_USERDATA), hwnd, uMsg, wParam, lParam)
+	CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, uMsg, wParam, lParam)
 
 LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
@@ -1042,7 +1039,7 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
 			HBRUSH frameBrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
 			struct FILEECHO *dat;
 
-			dat = (struct FILEECHO*)GetWindowLong(GetParent(hwnd), GWL_USERDATA);
+			dat = (struct FILEECHO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
 			//if(dat == NULL)
 			//	return CallSubclassed(hwnd, uMsg, wParam, lParam);
 			GetClientRect(hwnd, &rc);
@@ -1137,7 +1134,7 @@ LRESULT CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
 {
 	struct FILEECHO *dat;
 
-	dat = (struct FILEECHO*)GetWindowLong(hDlg, GWL_USERDATA);
+	dat = (struct FILEECHO*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
 	switch( uMsg )
 	{
 		case WM_INITDIALOG:
@@ -1148,7 +1145,7 @@ LRESULT CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
 			dat->updateTitle();
 
 			CreateStatusWindow(WS_CHILD|WS_VISIBLE, "", hDlg, IDC_STATUS);
-			SetWindowLong(hDlg, GWL_USERDATA, (LONG)dat);
+			SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG)dat);
 			WindowList_Add(hFileList, hDlg, dat->hContact);
 			SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]);
 			SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[ICON_MAIN]);
diff --git a/plugins/FileAsMessage/fileecho.opt b/plugins/FileAsMessage/fileecho.opt
deleted file mode 100644
index c53a9eee75..0000000000
Binary files a/plugins/FileAsMessage/fileecho.opt and /dev/null differ
diff --git a/plugins/FileAsMessage/fileecho.vcxproj b/plugins/FileAsMessage/fileecho.vcxproj
index 96831799da..f56a0cb4d5 100644
--- a/plugins/FileAsMessage/fileecho.vcxproj
+++ b/plugins/FileAsMessage/fileecho.vcxproj
@@ -25,23 +25,19 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   </PropertyGroup>
@@ -67,14 +63,11 @@
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
@@ -82,38 +75,23 @@
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
       <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
-      <TargetMachine>MachineX86</TargetMachine>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
     </Link>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Release/fileecho.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
     <ResourceCompile>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0419</Culture>
-      <IgnoreStandardIncludePath>
-      </IgnoreStandardIncludePath>
       <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
@@ -121,38 +99,25 @@
     <ClCompile>
       <Optimization>Full</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
       <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
     </Link>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TypeLibraryName>.\Release/fileecho.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
     <ResourceCompile>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0419</Culture>
-      <IgnoreStandardIncludePath>
-      </IgnoreStandardIncludePath>
       <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
@@ -161,110 +126,51 @@
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
-      <TargetMachine>MachineX86</TargetMachine>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
     </Link>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Debug/fileecho.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
     <ResourceCompile>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0419</Culture>
-      <IgnoreStandardIncludePath>
-      </IgnoreStandardIncludePath>
       <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;FILEECHO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
     </Link>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TypeLibraryName>.\Debug/fileecho.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
     <ResourceCompile>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0419</Culture>
-      <IgnoreStandardIncludePath>
-      </IgnoreStandardIncludePath>
       <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="dialog.cpp">
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="main.cpp">
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="optionsdlg.cpp">
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FILEECHO_EXPORTS</PreprocessorDefinitions>
-    </ClCompile>
+    <ClCompile Include="crc32.cpp" />
+    <ClCompile Include="dialog.cpp" />
+    <ClCompile Include="main.cpp" />
+    <ClCompile Include="optionsdlg.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="dialog.h" />
diff --git a/plugins/FileAsMessage/fileecho.vcxproj.filters b/plugins/FileAsMessage/fileecho.vcxproj.filters
index 661846e19c..68d28e0f7e 100644
--- a/plugins/FileAsMessage/fileecho.vcxproj.filters
+++ b/plugins/FileAsMessage/fileecho.vcxproj.filters
@@ -24,6 +24,9 @@
     <ClCompile Include="optionsdlg.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="crc32.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="dialog.h">
diff --git a/plugins/FileAsMessage/main.cpp b/plugins/FileAsMessage/main.cpp
index 782e97edc3..d9da47e448 100644
--- a/plugins/FileAsMessage/main.cpp
+++ b/plugins/FileAsMessage/main.cpp
@@ -1,27 +1,24 @@
 #include "main.h"
-#include "dialog.h"
-#include "resource.h"
 
-
-#include <stdio.h>
-#include <time.h>
-
-PLUGINLINK *pluginLink;
 PLUGININFOEX pluginInfo =
 {
-	sizeof( PLUGININFOEX ),
+	sizeof(PLUGININFOEX),
 	SERVICE_TITLE,
 	PLUGIN_MAKE_VERSION( 0,0,2,4 ),
-	"file tranfer by using the messaging services - as plain text",
+	"File tranfer by using the messaging services - as plain text",
 	"Denis Stanishevskiy // StDenis",
 	"stdenformiranda(at)fromru(dot)com",
 	"Copyright (c) 2004, Denis Stanishevskiy",
 	PLUGIN_URL,
-	0, 0
+	UNICODE_AWARE,
+	0,
+	// {34B5A402-1B79-4246-B041-43D0B590AE2C}
+	{ 0x34b5a402, 0x1b79, 0x4246, { 0xb0, 0x41, 0x43, 0xd0, 0xb5, 0x90, 0xae, 0x2c } }
 };
 
 HANDLE hFileList;
 HINSTANCE hInst;
+int hLangpack;
 
 char *szServiceTitle = SERVICE_TITLE;
 char *szServicePrefix = SERVICE_PREFIX;
@@ -79,7 +76,7 @@ int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam)
 		}
 	}
 */
-	for(indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
+	for(indx = 0; indx < SIZEOF(hIcons); indx++)
 		hIcons[indx] = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[indx]);
 
 	WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0,0);
@@ -106,7 +103,7 @@ int OnContactAdded(WPARAM wParam,LPARAM lParam)
 	return 0;
 }
 
-int OnRecvFile(WPARAM wParam, LPARAM lParam)
+INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam)
 {
 	HWND hwnd;
 	CLISTEVENT *clev = (CLISTEVENT*)lParam;
@@ -137,7 +134,7 @@ int OnRecvFile(WPARAM wParam, LPARAM lParam)
 	return 1;
 }
 
-int OnSendFile(WPARAM wParam, LPARAM lParam)
+INT_PTR OnSendFile(WPARAM wParam, LPARAM lParam)
 {
 	HWND hwnd;
 
@@ -164,7 +161,7 @@ int OnSendFile(WPARAM wParam, LPARAM lParam)
 	return 1;
 }
 
-int OnRecvMessage( WPARAM wParam, LPARAM lParam )
+INT_PTR OnRecvMessage( WPARAM wParam, LPARAM lParam )
 {
 	CCSDATA *pccsd = (CCSDATA *)lParam;
 	PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam;
@@ -205,7 +202,7 @@ int OnOptInitialise(WPARAM wParam, LPARAM lParam)
 	odp.pszGroup = Translate("Plugins");
 	odp.flags = ODPF_BOLDGROUPS;
 	odp.pfnDlgProc = (DLGPROC)OptionsDlgProc;
-	CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+	Options_AddPage(wParam, &odp);
 
 	return 0;
 }
@@ -214,15 +211,8 @@ int OnOptInitialise(WPARAM wParam, LPARAM lParam)
 // MirandaPluginInfo()
 // Called by Miranda to get Version
 //
-PLUGININFO *MirandaPluginInfo( DWORD dwVersion )
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD dwVersion)
 {
-/*
-	if(MessageBox(0,
-		"Achtung! This plugin is technology demo only. It didn't tested carefully.\n"
-		"Do you want to continue usage of this plugin?", SERVICE_TITLE,
-		MB_YESNO) != IDYES) return 0;
-//*/
-	if( dwVersion < PLUGIN_MAKE_VERSION( 0,3,3,0 ))return 0;
 	return &pluginInfo;
 }
 /*
@@ -238,35 +228,27 @@ DWORD CreateSetting(char *name, DWORD defvalue)
 
 int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
 {
-	if(!ServiceExists(MS_SKIN2_ADDICON))
+	int indx;
+	SKINICONDESC sid;
+	char ModuleName[MAX_PATH];
+
+	ZeroMemory(&sid, sizeof(sid));
+	sid.cbSize = sizeof(sid);
+	sid.pszSection = Translate("fileAsMessage");
+	GetModuleFileName(hInst, ModuleName, sizeof(ModuleName));
+	for(indx = 0; indx < SIZEOF(hIcons); indx++)
 	{
-		for(int indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
-			hIcons[indx] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(idIcons[indx]),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0);
+		//sid.pszSection = szIconGroup[indx];
+		sid.pszName = szIconId[indx];
+		sid.pszDescription = szIconName[indx];
+		sid.pszDefaultFile = ModuleName;
+		sid.iDefaultIndex = iIconId[indx];
+		Skin_AddIcon(&sid);
 	}
-	else
-	{
-		int indx;
-		SKINICONDESC sid;
-		char ModuleName[MAX_PATH];
-
-		ZeroMemory(&sid, sizeof(sid));
-		sid.cbSize = sizeof(sid);
-		sid.pszSection = Translate("fileAsMessage");
-		GetModuleFileName(hInst, ModuleName, sizeof(ModuleName));
-		for(indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
-		{
-			//sid.pszSection = szIconGroup[indx];
-			sid.pszName = szIconId[indx];
-			sid.pszDescription = szIconName[indx];
-			sid.pszDefaultFile = ModuleName;
-			sid.iDefaultIndex = iIconId[indx];
-			CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
-		}
-		for(indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
-			hIcons[indx] = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[indx]);
+	for(indx = 0; indx < SIZEOF(hIcons); indx++)
+		hIcons[indx] = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[indx]);
 
-		hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
-	}
+	hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
 	HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
 	while(hContact)
 	{
@@ -284,7 +266,7 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
 	mi.pszService = SERVICE_NAME "/FESendFile";
 	mi.pszContactOwner = NULL;
 	mi.flags = CMIF_NOTOFFLINE;
-	CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, ( LPARAM )&mi);
+	Menu_AddContactMenuItem(&mi);
 
 	return 0;
 }
@@ -292,9 +274,9 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
 //
 // Startup initializing
 //
-int Load( PLUGINLINK *link )
+extern "C" __declspec(dllexport) int Load(void)
 {
-	pluginLink = link;
+	mir_getLP(&pluginInfo);
 
 	InitCRC32();
 
@@ -328,14 +310,10 @@ int Load( PLUGINLINK *link )
 // Unload()
 // Called by Miranda when Plugin is unloaded.
 //
-int Unload( void )
+extern "C" __declspec(dllexport) int Unload(void)
 {
 //	if(hFileList)
 //		WindowList_Broadcast(hFileList, WM_CLOSE, 0,0);
-	if(!ServiceExists(MS_SKIN2_ADDICON))
-		for(int indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
-			DestroyIcon(hIcons[indx]);
-
 	if(hHookSkinIconsChanged != NULL)
 		UnhookEvent(hHookSkinIconsChanged);
 	UnhookEvent(hHookDbSettingChange);
@@ -350,9 +328,5 @@ int Unload( void )
 int WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID pReserved )
 {
 	hInst = hInstance;
-
-	if( dwReason == DLL_PROCESS_ATTACH )
-		DisableThreadLibraryCalls(hInstance);
-
 	return 1;
 }
diff --git a/plugins/FileAsMessage/main.h b/plugins/FileAsMessage/main.h
index 9437a87a98..e21472e5a1 100644
--- a/plugins/FileAsMessage/main.h
+++ b/plugins/FileAsMessage/main.h
@@ -1,11 +1,11 @@
-//#include "AggressiveOptimize.h"
-
 #define _CRT_SECURE_NO_WARNINGS
 #define _CRT_NONSTDC_NO_DEPRECATE
-
 #define _WIN32_WINNT 0x0501
+
 #include <windows.h>
 #include <stdio.h>
+#include <time.h>
+#include <commctrl.h>
 
 #include "newpluginapi.h"
 #include "m_system.h"
@@ -27,10 +27,11 @@
 #include "m_file.h"
 #include "win2k.h"
 
-#define ARRAY_SIZE(n)	(sizeof(n)/sizeof(n[0]))
+#include "dialog.h"
+#include "resource.h"
 
 #define MAXBUFSIZE 4096
-#define SERVICE_TITLE "file As Message"
+#define SERVICE_TITLE "File As Message"
 #define SERVICE_NAME "FileAsMessage"
 
 #define SERVICE_PREFIX "<%fAM-0023%>"
@@ -41,6 +42,7 @@
 						 PLUGIN_URL " for more information and download."
 extern char *szServiceTitle;
 extern char *szServicePrefix;
+extern const ulong INITCRC;
 
 #define WM_FE_MESSAGE		WM_USER+100
 #define WM_FE_STATUSCHANGE	WM_USER+101
@@ -52,12 +54,4 @@ extern HANDLE hEventNewFile;
 
 extern HICON hIcons[5];
 
-#ifdef __cplusplus
-extern "C" {
-#endif 
-int __declspec(dllexport) Load( PLUGINLINK *link );
-int __declspec(dllexport) Unload( void );
-    __declspec(dllexport) PLUGININFOEX *MirandaPluginInfo( DWORD dwVersion );
-#ifdef __cplusplus
-}
-#endif 
+ulong memcrc32(uchar *ptr, int size, ulong crc );
\ No newline at end of file
diff --git a/plugins/FileAsMessage/optionsdlg.cpp b/plugins/FileAsMessage/optionsdlg.cpp
index e39c574df2..da605d0f32 100644
--- a/plugins/FileAsMessage/optionsdlg.cpp
+++ b/plugins/FileAsMessage/optionsdlg.cpp
@@ -1,10 +1,4 @@
 #include "main.h"
-#include "resource.h"
-
-#include <commctrl.h>
-
-#pragma comment(lib, "comctl32.lib")
-
 
 DWORD settingDefault[] =
 {
@@ -49,7 +43,7 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
 		{	
 			TranslateDialogDefault(hwndDlg);
 			
-			for(int indx = 0; indx < ARRAY_SIZE(settingId); indx++)
+			for(int indx = 0; indx < SIZEOF(settingId); indx++)
 				if(settingId[indx] > 0)
 					SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]));
 				else
@@ -65,7 +59,7 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
 			if(//MAKEWPARAM(IDC_AUTO, BN_CLICKED) != wParam || 
 			   MAKEWPARAM(IDC_ALPHANUM, BN_CLICKED) != wParam)
 			{	
-				for(int indx = 0; indx < ARRAY_SIZE(settingId); indx++)
+				for(int indx = 0; indx < SIZEOF(settingId); indx++)
 				{
 					if(LOWORD(wParam) == abs(settingId[indx]))
 					{
@@ -94,7 +88,7 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
 				int value;
 				BOOL succ;
 				
-				for(int indx = 0; indx < ARRAY_SIZE(settingId); indx++)
+				for(int indx = 0; indx < SIZEOF(settingId); indx++)
 				{
 					if(settingId[indx] > 0)
 						value = SendDlgItemMessage(hwndDlg, settingId[indx], CPM_GETCOLOUR, 0, 0);
-- 
cgit v1.2.3