From 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Thu, 3 May 2018 16:02:14 +0200
Subject: mir_forkThread<typename> - stronger typizatioin for thread function
 parameter

---
 plugins/AVS/src/cache.cpp                          |   2 +-
 plugins/AVS/src/main.cpp                           |   2 +-
 plugins/AVS/src/poll.cpp                           |   2 +-
 plugins/AVS/src/services.cpp                       |  10 +-
 plugins/AssocMgr/src/utils.cpp                     |   5 +-
 plugins/AutoShutdown/src/cpuusage.cpp              |   6 +-
 plugins/AutoShutdown/src/frame.cpp                 |   2 +-
 plugins/AutoShutdown/src/settingsdlg.cpp           |   6 +-
 plugins/AutoShutdown/src/utils.cpp                 |   5 +-
 plugins/AvatarHistory/src/AvatarDlg.cpp            |  10 +-
 plugins/AvatarHistory/src/AvatarHistory.cpp        |   2 +-
 plugins/BasicHistory/src/HistoryWindow.cpp         |  13 +-
 plugins/BasicHistory/src/HistoryWindow.h           |   2 +-
 plugins/BasicHistory/src/Options.cpp               |   2 +-
 plugins/BasicHistory/src/Options.h                 |   2 +-
 plugins/BasicHistory/src/Scheduler.cpp             |  14 +-
 plugins/Boltun/src/actionQueue.cpp                 |   2 +-
 plugins/BuddyExpectator/src/BuddyExpectator.cpp    |   8 +-
 plugins/BuddyPounce/src/main.cpp                   |   2 +-
 plugins/Clist_modern/src/modern_aniavatars.cpp     |   2 +-
 plugins/Clist_modern/src/modern_awaymsg.cpp        |   2 +-
 plugins/Clist_modern/src/modern_cachefuncs.cpp     |   2 +-
 plugins/Clist_modern/src/modern_clc.cpp            |   4 +-
 plugins/Clist_modern/src/modern_clcpaint.cpp       |   2 +-
 plugins/Clist_nicer/src/clc.cpp                    |   2 +-
 plugins/Clist_nicer/src/clcpaint.cpp               |   2 +-
 plugins/Clist_nicer/src/cluiframes.cpp             |   2 +-
 plugins/Clist_nicer/src/contact.cpp                |   2 +-
 plugins/CloudFile/src/Services/google_service.cpp  |   6 +-
 .../CloudFile/src/Services/microsoft_service.cpp   |   6 +-
 plugins/CloudFile/src/Services/yandex_service.cpp  |   6 +-
 plugins/CloudFile/src/utils.cpp                    |   2 +-
 plugins/CmdLine/src/mimcmd_handlers.cpp            |   2 +-
 plugins/CmdLine/src/services.cpp                   |   2 +-
 plugins/Console/src/Console.cpp                    |   2 +-
 plugins/ContactsPlus/src/send.cpp                  |   2 +-
 plugins/CountryFlags/src/ip2country.cpp            |   2 +-
 plugins/Db_autobackups/src/backup.cpp              |   6 +-
 plugins/FTPFileYM/src/dbentry.cpp                  |   4 +-
 plugins/FTPFileYM/src/deletetimer.cpp              |   2 +-
 plugins/FTPFileYM/src/job_delete.cpp               |   6 +-
 plugins/FTPFileYM/src/job_delete.h                 |   2 +-
 plugins/FTPFileYM/src/job_packer.cpp               |  12 +-
 plugins/FTPFileYM/src/job_packer.h                 |   2 +-
 plugins/FTPFileYM/src/job_upload.cpp               |  16 +--
 plugins/FTPFileYM/src/job_upload.h                 |   2 +-
 plugins/FavContacts/src/contact_cache.cpp          |  10 +-
 plugins/GmailNotifier/src/notify.cpp               | 149 +++++++++++----------
 plugins/GmailNotifier/src/stdafx.h                 |   1 -
 plugins/HTTPServer/src/main.cpp                    |   5 +-
 plugins/HistoryStats/src/settings.cpp              |   2 +-
 plugins/HistoryStats/src/statistic.cpp             |  12 +-
 plugins/HistoryStats/src/statistic.h               |   4 +-
 .../src/historysweeperlight.cpp                    |   2 +-
 plugins/IEView/src/ChatHTMLBuilder.cpp             |   2 +-
 plugins/IEView/src/HistoryHTMLBuilder.cpp          |   4 +-
 plugins/IEView/src/MUCCHTMLBuilder.cpp             |   4 +-
 plugins/IEView/src/ScriverHTMLBuilder.cpp          |   6 +-
 plugins/IEView/src/TabSRMMHTMLBuilder.cpp          |  10 +-
 plugins/IEView/src/TemplateHTMLBuilder.cpp         |   4 +-
 plugins/Import/src/import.cpp                      |   4 +-
 plugins/Import/src/miranda.cpp                     |   2 +-
 plugins/KeyboardNotify/src/flash.cpp               |   4 +-
 plugins/KeyboardNotify/src/main.cpp                |   2 +-
 plugins/ListeningTo/src/listeningto.cpp            |   2 +-
 plugins/LotusNotify/src/LotusNotify.cpp            |   2 +-
 .../MirFoxCommons/MirFoxCommons_sharedMemory.cpp   |   2 +-
 plugins/MirFox/src/MirandaUtils.cpp                |   2 +-
 plugins/MirLua/Modules/m_schedule/src/main.cpp     |  24 ++--
 plugins/MirLua/src/m_message.cpp                   |   2 +-
 plugins/MirOTR/src/dbfilter.cpp                    |   4 +-
 plugins/MirOTR/src/utils.cpp                       |   4 +-
 plugins/MirandaG15/src/CAppletManager.cpp          |   2 +-
 .../src/LCDFramework/CLCDConnectionLogitech.cpp    |   6 +-
 .../src/LCDFramework/CLCDOutputManager.cpp         |   2 +-
 plugins/Msg_Export/src/options.cpp                 |   6 +-
 plugins/NewAwaySysMod/src/Client.cpp               |   2 +-
 plugins/NewAwaySysMod/src/MsgEventAdded.cpp        |  13 +-
 plugins/NewXstatusNotify/src/main.cpp              |   4 +-
 plugins/NewXstatusNotify/src/xstatus.cpp           |   2 +-
 plugins/New_GPG/src/utilities.cpp                  |   2 +-
 plugins/NewsAggregator/Src/CheckFeed.cpp           |  16 +--
 plugins/NewsAggregator/Src/Services.cpp            |   2 +-
 plugins/NewsAggregator/Src/Update.cpp              |   2 +-
 plugins/NotifyAnything/src/main.cpp                |   2 +-
 plugins/Nudge/src/main.cpp                         |  12 +-
 plugins/PackUpdater/Src/Utils.cpp                  |   6 +-
 plugins/PasteIt/src/PasteIt.cpp                    |   2 +-
 plugins/Ping/src/pingthread.cpp                    |   4 +-
 plugins/PluginUpdater/src/DlgListNew.cpp           |   3 +-
 plugins/PluginUpdater/src/DlgUpdate.cpp            |  14 +-
 plugins/Popup/src/history.cpp                      |   2 +-
 plugins/Popup/src/popup_wnd2.cpp                   |   2 +-
 plugins/Quotes/src/QuotesProviderBase.cpp          |   2 +-
 plugins/SMS/src/receive.cpp                        |   4 +-
 plugins/SMS/src/send.cpp                           |   2 +-
 plugins/Scriver/src/chat_window.cpp                |   9 +-
 plugins/Scriver/src/globals.cpp                    |   2 +-
 plugins/Scriver/src/msgdialog.cpp                  |   6 +-
 plugins/Scriver/src/msglog.cpp                     |   4 +-
 plugins/SecureIM/src/dbevent.cpp                   |   2 +-
 plugins/SecureIM/src/main.cpp                      |   2 +-
 plugins/SecureIM/src/svcs_proto.cpp                |   8 +-
 plugins/SeenPlugin/src/utils.cpp                   |  17 +--
 plugins/SendScreenshotPlus/src/CSend.cpp           |   2 +-
 plugins/ShellExt/src/shlcom.cpp                    |   7 +-
 plugins/SimpleAR/src/Main.cpp                      |   6 +-
 plugins/SkypeStatusChange/src/main.cpp             |   2 +-
 plugins/SmileyAdd/src/dlgboxsubclass.cpp           |   2 +-
 plugins/SmileyAdd/src/download.cpp                 |   2 +-
 plugins/SmileyAdd/src/imagecache.cpp               |   6 +-
 plugins/SmileyAdd/src/options.cpp                  |   2 +-
 plugins/SmileyAdd/src/services.cpp                 |   2 +-
 plugins/SmileyAdd/src/smltool.cpp                  |   5 +-
 plugins/SmileyAdd/src/smltool.h                    |   3 +-
 plugins/Spamotron/src/bayes.cpp                    |   2 +-
 plugins/Spamotron/src/spamotron.cpp                |  10 +-
 plugins/SplashScreen/src/main.cpp                  |   2 +-
 plugins/StartupSilence/src/main.cpp                |  79 ++++++-----
 plugins/StartupSilence/src/stdafx.h                |   1 -
 .../StatusManager/src/KeepStatus/keepstatus.cpp    |   2 +-
 plugins/StopSpamMod/src/utilities.cpp              |   2 +-
 plugins/TabSRMM/src/chat_main.cpp                  |   4 +-
 plugins/TabSRMM/src/chat_window.cpp                |  13 +-
 plugins/TabSRMM/src/contactcache.cpp               |   2 +-
 plugins/TabSRMM/src/globals.cpp                    |   2 +-
 plugins/TabSRMM/src/hotkeyhandler.cpp              |   4 +-
 plugins/TabSRMM/src/infopanel.cpp                  |   2 +-
 plugins/TabSRMM/src/msgdialog.cpp                  |   4 +-
 plugins/TabSRMM/src/msgdlgutils.cpp                |   4 +-
 plugins/TabSRMM/src/msglog.cpp                     |   2 +-
 plugins/TabSRMM/src/sendlater.cpp                  |   8 +-
 plugins/TabSRMM/src/sendqueue.cpp                  |  14 +-
 plugins/TabSRMM/src/templates.cpp                  |   4 +-
 plugins/TabSRMM/src/trayicon.cpp                   |   4 +-
 plugins/TipperYM/src/subst.cpp                     |   4 +-
 plugins/TipperYM/src/tipper.cpp                    |   2 +-
 plugins/TipperYM/src/translations.cpp              |   4 +-
 plugins/UserInfoEx/src/mir_contactqueue.cpp        |   2 +-
 plugins/UserInfoEx/src/mir_contactqueue.h          |   2 +-
 plugins/Variables/src/parse_miranda.cpp            |   2 +-
 plugins/Watrack_MPD/src/main.cpp                   |  22 +--
 plugins/Weather/src/weather_addstn.cpp             |   4 +-
 plugins/Weather/src/weather_update.cpp             |   2 +-
 plugins/WebView/src/webview.cpp                    |   6 +-
 plugins/WebView/src/webview.h                      |   1 -
 plugins/WebView/src/webview_alerts.cpp             |   2 +-
 plugins/WebView/src/webview_getdata.cpp            |   6 +-
 plugins/WebView/src/webview_services.cpp           |  26 ++--
 plugins/WhenWasIt/src/date_utils.cpp               |   2 +-
 plugins/WhenWasIt/src/services.cpp                 |   2 +-
 plugins/WhenWasIt/src/utils.cpp                    |   2 +-
 plugins/WhoUsesMyFiles/src/wumfplug.cpp            |   2 +-
 plugins/YAMN/src/browser/badconnect.cpp            |   2 +-
 plugins/YAPP/src/services.cpp                      |   8 +-
 155 files changed, 452 insertions(+), 487 deletions(-)

(limited to 'plugins')

diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 6b4ac7417e..1823bdef10 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -80,7 +80,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
 		mir_cslock lck(cachecs);
 		cc = arCache.find((CacheNode*)&hContact);
 		if (cc) {
-			cc->t_lastAccess = time(nullptr);
+			cc->t_lastAccess = time(0);
 			return (cc->loaded || findAny) ? cc : nullptr;
 		}
 
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index 23bcbd79c4..18cbe3ae9d 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -317,7 +317,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
 	mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
 	hLoaderEvent = CreateEvent(nullptr, TRUE, FALSE, szEventName);
 
-	SetThreadPriority(mir_forkthread(PicLoader, nullptr), THREAD_PRIORITY_IDLE);
+	SetThreadPriority(mir_forkthread(PicLoader), THREAD_PRIORITY_IDLE);
 
 	// Folders plugin support
 	hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars");
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index 471ca4a41f..60f9480438 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -62,7 +62,7 @@ static mir_cs cs;
 void InitPolls()
 {
 	// Init request queue
-	mir_forkthread(RequestThread, nullptr);
+	mir_forkthread(RequestThread);
 }
 
 void UninitPolls()
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index 5302ccfe36..cf7f6cafe9 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -718,7 +718,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
 	else ace = (AVATARCACHEENTRY *)GetAvatarBitmap((WPARAM)r->hContact, 0);
 
 	if (ace && (!(r->dwFlags & AVDRQ_RESPECTHIDDEN) || !(ace->dwFlags & AVS_HIDEONCLIST))) {
-		ace->t_lastAccess = time(nullptr);
+		ace->t_lastAccess = time(0);
 
 		if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == nullptr)
 			return 0;
@@ -750,12 +750,10 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
-static void ReloadMyAvatar(LPVOID lpParam)
+static void ReloadMyAvatar(char *szProto)
 {
 	Thread_SetName("AVS: ReloadMyAvatar");
 
-	char *szProto = (char *)lpParam;
-
 	mir_sleep(500);
 	if (g_shutDown)
 		return;
@@ -785,7 +783,7 @@ static void ReloadMyAvatar(LPVOID lpParam)
 			NotifyEventHooks(hMyAvatarChanged, (WPARAM)myAvatarProto, 0);
 	}
 
-	mir_free(lpParam);
+	mir_free(szProto);
 }
 
 INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
@@ -799,7 +797,7 @@ INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
 			continue;
 
 		if (!mir_strcmp(it->szProtoname, proto)) {
-			mir_forkthread(ReloadMyAvatar, mir_strdup(it->szProtoname));
+			mir_forkThread<char>(ReloadMyAvatar, mir_strdup(it->szProtoname));
 			return 0;
 		}
 	}
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp
index 02718bd02f..db1143432f 100644
--- a/plugins/AssocMgr/src/utils.cpp
+++ b/plugins/AssocMgr/src/utils.cpp
@@ -141,9 +141,8 @@ BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,cha
 
 /************************* Error Output ***************************/
 
-static void MessageBoxIndirectFree(void *param)
+static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
 {
-	MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)param;
 	MessageBoxIndirectA(mbp);
 	mir_free((char*)mbp->lpszCaption); /* does NULL check */
 	mir_free((char*)mbp->lpszText);    /* does NULL check */
@@ -176,7 +175,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
 		case NIIF_WARNING: mbp->dwStyle|=MB_ICONWARNING; break;
 		case NIIF_ERROR:   mbp->dwStyle|=MB_ICONERROR;
 	}
-	mir_forkthread(MessageBoxIndirectFree, mbp);
+	mir_forkThread<MSGBOXPARAMSA>(MessageBoxIndirectFree, mbp);
 }
 
 // LocalFree() the return value
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp
index 2959013407..25eb542f35 100644
--- a/plugins/AutoShutdown/src/cpuusage.cpp
+++ b/plugins/AutoShutdown/src/cpuusage.cpp
@@ -72,10 +72,8 @@ static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage)
 	return !Miranda_IsTerminated();
 }
 
-static void WinNT_PollThread(void *vparam)
+static void WinNT_PollThread(CpuUsageThreadParams *param)
 {
-	CpuUsageThreadParams *param = (CpuUsageThreadParams*)vparam;
-
 	DWORD dwBufferSize = 0, dwCount;
 	BYTE *pBuffer = nullptr;
 	PERF_DATA_BLOCK *pPerfData = nullptr;
@@ -204,7 +202,7 @@ DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, DWORD dwDe
 	param->hFirstEvent = hFirstEvent;
 
 	/* start thread */
-	if (mir_forkthread(WinNT_PollThread, param) != INVALID_HANDLE_VALUE)
+	if (mir_forkThread<CpuUsageThreadParams>(WinNT_PollThread, param) != INVALID_HANDLE_VALUE)
 		WaitForSingleObject(hFirstEvent, INFINITE); /* wait for first success */
 	else
 		mir_free(param); /* thread not started */
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index 5908be544f..89b010b0b7 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -290,7 +290,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP
 	case M_SET_COUNTDOWN:
 		if (dat->fTimeFlags&SDWTF_ST_TIME) {
 			dat->settingLastTime = (time_t)db_get_dw(NULL, "AutoShutdown", "TimeStamp", SETTING_TIMESTAMP_DEFAULT);
-			dat->countdown = time(nullptr);
+			dat->countdown = time(0);
 			if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown;
 			else dat->countdown = 0;
 		}
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index f16108840d..1aca711b4b 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -255,14 +255,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
 			GetLocalTime(&stBuf);
 			if (SystemTimeToTimeStamp(&st, &timestamp)) {
 				/* set to current date if earlier */
-				if (timestamp < time(nullptr)) {
+				if (timestamp < time(0)) {
 					st.wDay = stBuf.wDay;
 					st.wDayOfWeek = stBuf.wDayOfWeek;
 					st.wMonth = stBuf.wMonth;
 					st.wYear = stBuf.wYear;
 					if (SystemTimeToTimeStamp(&st, &timestamp)) {
 						/* step one day up if still earlier */
-						if (timestamp < time(nullptr)) {
+						if (timestamp < time(0)) {
 							timestamp += 24 * 60 * 60;
 							TimeStampToSystemTime(timestamp, &st);
 						}
@@ -351,7 +351,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
 				time_t timestamp;
 				DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
 				if (!SystemTimeToTimeStamp(&st, &timestamp))
-					timestamp = time(nullptr);
+					timestamp = time(0);
 				db_set_dw(NULL, "AutoShutdown", "TimeStamp", (DWORD)timestamp);
 			}
 			/* shutdown type */
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index e288740dbb..e80f819147 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -66,9 +66,8 @@ void TrimString(wchar_t *pszStr)
 
 /************************* Error Output ***************************/
 
-static void MessageBoxIndirectFree(void *param)
+static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
 {
-	MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)param;
 	MessageBoxIndirectA(mbp);
 	mir_free((char*)mbp->lpszCaption); /* does NULL check */
 	mir_free((char*)mbp->lpszText);    /* does NULL check */
@@ -99,7 +98,7 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, .
 	case NIIF_WARNING: mbp->dwStyle |= MB_ICONWARNING; break;
 	case NIIF_ERROR:   mbp->dwStyle |= MB_ICONERROR;
 	}
-	mir_forkthread(MessageBoxIndirectFree, mbp);
+	mir_forkThread<MSGBOXPARAMSA>(MessageBoxIndirectFree, mbp);
 }
 
 // LocalFree() the return value
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 987d5cf803..ed1bd5761b 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -64,10 +64,9 @@ public:
 	wchar_t *filelink;
 };
 
-static void __cdecl AvatarDialogThread(void *param)
+static void __cdecl AvatarDialogThread(AvatarDialogData *data)
 {
-	struct AvatarDialogData* data = (struct AvatarDialogData*)param;
-	DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)param);
+	DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AVATARDLG), data->parent, AvatarDlgProc, (LPARAM)data);
 }
 
 int OpenAvatarDialog(MCONTACT hContact, char* fn)
@@ -79,15 +78,14 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn)
 		return 0;
 	}
 
-	struct AvatarDialogData *avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData));
-	memset(avdlg, 0, sizeof(struct AvatarDialogData));
+	AvatarDialogData *avdlg = (AvatarDialogData*)calloc(1, sizeof(AvatarDialogData));
 	avdlg->hContact = hContact;
 	if (fn == nullptr)
 		avdlg->fn[0] = '\0';
 	else
 		MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, _countof(avdlg->fn));
 
-	mir_forkthread(AvatarDialogThread, (void*)avdlg);
+	mir_forkThread<AvatarDialogData>(AvatarDialogThread, avdlg);
 	return 0;
 }
 
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 476171afdd..371e873281 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -215,7 +215,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
 			DBEVENTINFO dbei = {};
 			dbei.szModule = GetContactProto(hContact);
 			dbei.flags = DBEF_READ | DBEF_UTF;
-			dbei.timestamp = (DWORD)time(nullptr);
+			dbei.timestamp = (DWORD)time(0);
 			dbei.eventType = EVENTTYPE_AVATAR_CHANGE;
 			dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
 			dbei.pBlob = blob;
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index d9d1b86a59..8425368ad1 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -923,7 +923,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
 		if (!historyWindow->isLoading) {
 			historyWindow->isLoading = true;
 			historyWindow->ReloadContacts();
-			mir_forkthread(HistoryWindow::FillHistoryThread, historyWindow);
+			mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, historyWindow);
 		}
 		DlgReturn(TRUE);
 
@@ -1180,9 +1180,8 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
 	return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
 }
 
-void HistoryWindow::FillHistoryThread(void* param)
+void HistoryWindow::FillHistoryThread(HistoryWindow *hInfo)
 {
-	HistoryWindow *hInfo = (HistoryWindow*)param;
 	HWND hwndList = hInfo->listWindow;
 	ListView_DeleteAllItems(hwndList);
 	hInfo->SelectEventGroup(-1);
@@ -1668,11 +1667,11 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
 		AppendMenu(hPopupMenu, searcher.IsAllUsers() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ALLUSERS, TranslateT("All contacts"));
 		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
 		HMENU hFilterMenu = CreatePopupMenu();
-		int filter = GetFilterNr();
+		DWORD filter = GetFilterNr();
 		AppendMenu(hFilterMenu, filter == 0 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERDEF, TranslateT("Default history events"));
 		AppendMenu(hFilterMenu, filter == 1 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERALL, TranslateT("All events"));
 		for (size_t i = 0; i < Options::instance->customFilters.size(); ++i) {
-			UINT flags = MF_STRING;
+			DWORD flags = MF_STRING;
 			if (filter - 2 == i)
 				flags |= MF_CHECKED;
 
@@ -1975,7 +1974,7 @@ bool HistoryWindow::ContactChanged(bool sync)
 					if (sync)
 						FillHistoryThread(this);
 					else
-						mir_forkthread(HistoryWindow::FillHistoryThread, this);
+						mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, this);
 					return true;
 				}
 			}
@@ -1988,7 +1987,7 @@ bool HistoryWindow::ContactChanged(bool sync)
 					if (sync)
 						FillHistoryThread(this);
 					else
-						mir_forkthread(HistoryWindow::FillHistoryThread, this);
+						mir_forkThread<HistoryWindow>(HistoryWindow::FillHistoryThread, this);
 					return true;
 				}
 			}
diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h
index d21403f421..8b19d2f439 100644
--- a/plugins/BasicHistory/src/HistoryWindow.h
+++ b/plugins/BasicHistory/src/HistoryWindow.h
@@ -29,7 +29,7 @@ private:
 	static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 	static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
 	static int HistoryDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc);
-	static void FillHistoryThread(void* param);
+	static void FillHistoryThread(HistoryWindow *hInfo);
 	static void Close(HistoryWindow* historyWindow);
 	static void ChangeToFreeWindow(HistoryWindow* historyWindow);
 	void ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent);
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 22f3cb55ae..ed1902db74 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -1808,7 +1808,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
 					break;
 				}
 
-				toCp.lastExport = time(nullptr);
+				toCp.lastExport = time(0);
 
 				*to = toCp;
 				EndDialog(hwndDlg, IDOK);
diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h
index acb27417f2..f10e807b27 100644
--- a/plugins/BasicHistory/src/Options.h
+++ b/plugins/BasicHistory/src/Options.h
@@ -123,7 +123,7 @@ struct TaskOptions
 
 		filePath += TranslateT("History");
 		filePath += L"_<contact>_<date>.<ext>";
-		lastExport = time(nullptr);
+		lastExport = time(0);
 	}
 };
 
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index 2601eeacfa..f234d55275 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -244,7 +244,7 @@ bool DoTask(TaskOptions& to)
 		return true;
 	}
 
-	DWORD now = time(nullptr);
+	DWORD now = time(0);
 	long long int t = to.eventDeltaTime * 60;
 	if (to.eventUnit > TaskOptions::Minute)
 		t *= 60LL;
@@ -715,7 +715,7 @@ void SchedulerThreadFunc(void*)
 
 	while (!finishThread) {
 		DWORD timeWait;
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		while (nextExportTime <= now)
 			if (!ExecuteCurrentTask(now))
 				return;
@@ -732,11 +732,11 @@ void StartThread(bool init)
 	StopThread();
 
 	initTask = false;
-	bool isExport = GetNextExportTime(init, time(nullptr));
+	bool isExport = GetNextExportTime(init, time(0));
 	if (isExport) {
 		finishThread = false;
 		hThreadEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
-		hThread = mir_forkthread(SchedulerThreadFunc, nullptr);
+		hThread = mir_forkthread(SchedulerThreadFunc);
 	}
 }
 
@@ -803,7 +803,7 @@ bool ExecuteCurrentTask(time_t now)
 		mir_cslock lck(Options::instance->criticalSection);
 		for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
 			if (it->forceExecute) {
-				it->lastExport = time(nullptr);
+				it->lastExport = time(0);
 				Options::instance->SaveTaskTime(*it);
 				to = *it;
 				isExport = true;
@@ -812,7 +812,7 @@ bool ExecuteCurrentTask(time_t now)
 			else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
 				time_t t = GetNextExportTime(*it);
 				if (t <= now) {
-					it->lastExport = time(nullptr);
+					it->lastExport = time(0);
 					Options::instance->SaveTaskTime(*it);
 					to = *it;
 					isExport = true;
@@ -1283,7 +1283,7 @@ void DoError(const TaskOptions& to, const std::wstring _error)
 		DBEVENTINFO dbei = {};
 		dbei.szModule = MODULE;
 		dbei.flags = DBEF_UTF | DBEF_READ;
-		dbei.timestamp = time(nullptr);
+		dbei.timestamp = time(0);
 		// For now I do not convert event data from string to blob, and event type must be message to handle it properly
 		dbei.eventType = EVENTTYPE_MESSAGE;
 		int len = (int)error.length() + 1;
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp
index fbad765f55..d75952e392 100644
--- a/plugins/Boltun/src/actionQueue.cpp
+++ b/plugins/Boltun/src/actionQueue.cpp
@@ -92,7 +92,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info)
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_SENT | DBEF_UTF;
 	dbei.szModule = BOLTUN_NAME;
-	dbei.timestamp = (DWORD)time(nullptr);
+	dbei.timestamp = (DWORD)time(0);
 
 	db_event_add(hContact, &dbei);
 	bot->AnswerGiven(hContact, *info);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 85b579f761..e7a9de1dae 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -73,7 +73,7 @@ time_t getLastSeen(MCONTACT hContact)
 
 void setLastSeen(MCONTACT hContact)
 {
-	db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(nullptr));
+	db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(0));
 	if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
 		db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
 }
@@ -213,7 +213,7 @@ bool isContactGoneFor(MCONTACT hContact, int days)
 {
 	time_t lastSeen = getLastSeen(hContact);
 	time_t lastInputMsg = getLastInputMsg(hContact);
-	time_t currentTime = time(nullptr);
+	time_t currentTime = time(0);
 
 	int daysSinceOnline = -1;
 	if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen) / (60 * 60 * 24));
@@ -640,7 +640,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
 
 int ContactAdded(WPARAM hContact, LPARAM)
 {
-	db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(nullptr));
+	db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(0));
 	return 0;
 }
 
@@ -670,7 +670,7 @@ extern "C" int __declspec(dllexport) Load(void)
 
 	// ensure all contacts are timestamped
 	DBVARIANT dbv;
-	DWORD current_time = (DWORD)time(nullptr);
+	DWORD current_time = (DWORD)time(0);
 
 	for (auto &hContact : Contacts()) {
 		if (!db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp
index cc8e31c67e..e2c5bd5ec9 100644
--- a/plugins/BuddyPounce/src/main.cpp
+++ b/plugins/BuddyPounce/src/main.cpp
@@ -70,7 +70,7 @@ int MsgAck(WPARAM, LPARAM lParam)
 					dbei.eventType = EVENTTYPE_MESSAGE;
 					dbei.flags = DBEF_UTF | DBEF_SENT;
 					dbei.szModule = (char*)ack->szModule;
-					dbei.timestamp = time(nullptr);
+					dbei.timestamp = time(0);
 					dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
 					dbei.pBlob = (PBYTE)(char*)pszUtf;
 					db_event_add(ack->hContact, &dbei);
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp
index c04448b182..b9e2d04ab6 100644
--- a/plugins/Clist_modern/src/modern_aniavatars.cpp
+++ b/plugins/Clist_modern/src/modern_aniavatars.cpp
@@ -996,7 +996,7 @@ int AniAva_InitModule()
 	_AniAva_LoadOptions();
 
 	s_hExitEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
-	mir_forkthread(_AniAva_AnimationTreadProc, nullptr);
+	mir_forkthread(_AniAva_AnimationTreadProc);
 	return 1;
 }
 
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index 79d9ea0c99..a2c0ef7927 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -152,7 +152,7 @@ void amRequestAwayMsg(MCONTACT hContact)
 void InitAwayMsgModule()
 {
 	hamProcessEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
-	g_hAwayMsgThread = mir_forkthread(amThreadProc, nullptr);
+	g_hAwayMsgThread = mir_forkthread(amThreadProc);
 }
 
 void UninitAwayMsgModule()
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index 060e141c5c..52f3ec176e 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -723,7 +723,7 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact)
 			contact->avatar_data = nullptr;
 
 		if (contact->avatar_data != nullptr)
-			contact->avatar_data->t_lastAccess = (DWORD)time(nullptr);
+			contact->avatar_data->t_lastAccess = (DWORD)time(0);
 	}
 	else contact->avatar_data = nullptr;
 
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 371d7ce1f2..2d552b4ad4 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -155,7 +155,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam)
 
 static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam)
 {
-	g_CluiData.t_now = time(nullptr);
+	g_CluiData.t_now = time(0);
 	if (hContact && lParam) {
 		DBEVENTINFO dbei = {};
 		db_event_get(lParam, &dbei);
@@ -598,7 +598,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR
 	switch (wParam) {
 	case TIMERID_INVALIDATE:
 		{
-			time_t cur_time = (time(nullptr) / 60);
+			time_t cur_time = (time(0) / 60);
 			if (cur_time != dat->last_tick_time) {
 				cliInvalidateRect(hwnd, nullptr, FALSE);
 				dat->last_tick_time = cur_time;
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index d9632a965a..b9995d711c 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -1836,7 +1836,7 @@ void CLCPaint::_FreePaintContext(_PaintContext &pc)
 
 void CLCPaint::_PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *_rcPaint)
 {
-	g_CluiData.t_now = time(nullptr);
+	g_CluiData.t_now = time(0);
 
 	if (_rcPaint && IsRectEmpty(_rcPaint)) return;       // check if draw area is not empty
 	if (!IsWindowVisible(hwnd)) return;                  // and window is visible
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 8ff5b06bff..8cab4be93d 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -67,7 +67,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam)
 {
 	DWORD new_freq = 0;
 
-	cfg::dat.t_now = time(nullptr);
+	cfg::dat.t_now = time(0);
 
 	if (hContact && lParam) {
 		DBEVENTINFO dbei = {};
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 6c013e5248..012fb45f44 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -1219,7 +1219,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint)
 	hbmTempAV = CreateCompatibleBitmap(g_HDC, g_maxAV_X, g_maxAV_Y);
 	hbmTempOldAV = reinterpret_cast<HBITMAP>(SelectObject(hdcTempAV, hbmTempAV));
 
-	cfg::dat.t_now = time(nullptr);
+	cfg::dat.t_now = time(0);
 	GetSystemTime(&cfg::dat.st);
 	SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);
 
diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp
index 2b28b797a7..5e11de208f 100644
--- a/plugins/Clist_nicer/src/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/cluiframes.cpp
@@ -2882,7 +2882,7 @@ static int CLUIFrameOnModulesLoad(WPARAM, LPARAM)
 {
 	mir_snwprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId());
 	g_hEventThread = CreateEvent(nullptr, TRUE, FALSE, g_ptszEventName);
-	hThreadMFUpdate = mir_forkthread(MF_UpdateThread, nullptr);
+	hThreadMFUpdate = mir_forkthread(MF_UpdateThread);
 	SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE);
 	CLUIFramesLoadMainMenu();
 	CLUIFramesCreateMenuForFrame(-1, nullptr, 000010000, false);
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp
index 7b815b40d8..9e3933a039 100644
--- a/plugins/Clist_nicer/src/contact.cpp
+++ b/plugins/Clist_nicer/src/contact.cpp
@@ -66,7 +66,7 @@ HANDLE hThreadMFUpdate = nullptr;
 
 static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep)
 {
-	DWORD  curTime = time(nullptr);
+	DWORD  curTime = time(0);
 	DWORD  frequency, eventCount;
 	MEVENT hEvent = db_event_last(hContact);
 
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index cd1d252c11..798981a9c9 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -36,7 +36,7 @@ bool CGDriveService::IsLoggedIn()
 	ptrA token(getStringA("TokenSecret"));
 	if (!token || token[0] == 0)
 		return false;
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	time_t expiresIn = getDword("ExpiresIn");
 	return now < expiresIn;
 }
@@ -55,7 +55,7 @@ void CGDriveService::Login(HWND owner)
 		setString("TokenSecret", node.as_string().c_str());
 
 		node = root.at("expires_in");
-		time_t expiresIn = time(nullptr) + node.as_int();
+		time_t expiresIn = time(0) + node.as_int();
 		setDword("ExpiresIn", expiresIn);
 
 		return;
@@ -116,7 +116,7 @@ void CGDriveService::RequestAccessTokenThread(void *param)
 	db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str());
 
 	node = root.at("expires_in");
-	time_t expiresIn = time(nullptr) + node.as_int();
+	time_t expiresIn = time(0) + node.as_int();
 	db_set_dw(NULL, GetAccountName(), "ExpiresIn", expiresIn);
 
 	node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 2a3f3c19b4..722560aec8 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -36,7 +36,7 @@ bool COneDriveService::IsLoggedIn()
 	ptrA token(getStringA("TokenSecret"));
 	if (!token || token[0] == 0)
 		return false;
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	time_t expiresIn = getDword("ExpiresIn");
 	return now < expiresIn;
 }
@@ -54,7 +54,7 @@ void COneDriveService::Login(HWND owner)
 		db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str());
 
 		node = root.at("expires_in");
-		time_t expiresIn = time(nullptr) + node.as_int();
+		time_t expiresIn = time(0) + node.as_int();
 		setDword("ExpiresIn", expiresIn);
 
 		return;
@@ -117,7 +117,7 @@ void COneDriveService::RequestAccessTokenThread(void *param)
 	setString("TokenSecret", node.as_string().c_str());
 
 	node = root.at("expires_in");
-	time_t expiresIn = time(nullptr) + node.as_int();
+	time_t expiresIn = time(0) + node.as_int();
 	setDword("ExpiresIn", expiresIn);
 
 	node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index acc9fb0315..6609e7c4b3 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -36,7 +36,7 @@ bool CYandexService::IsLoggedIn()
 	ptrA token(getStringA("TokenSecret"));
 	if (!token || token[0] == 0)
 		return false;
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	time_t expiresIn = getDword("ExpiresIn");
 	return now < expiresIn;
 }
@@ -55,7 +55,7 @@ void CYandexService::Login(HWND owner)
 		setString("TokenSecret", node.as_string().c_str());
 
 		node = root.at("expires_in");
-		time_t expiresIn = time(nullptr) + node.as_int();
+		time_t expiresIn = time(0) + node.as_int();
 		setDword("ExpiresIn", expiresIn);
 
 		node = root.at("refresh_token");
@@ -119,7 +119,7 @@ void CYandexService::RequestAccessTokenThread(void *param)
 	setString("TokenSecret", node.as_string().c_str());
 
 	node = root.at("expires_in");
-	time_t expiresIn = time(nullptr) + node.as_int();
+	time_t expiresIn = time(0) + node.as_int();
 	setDword("ExpiresIn", expiresIn);
 
 	node = root.at("refresh_token");
diff --git a/plugins/CloudFile/src/utils.cpp b/plugins/CloudFile/src/utils.cpp
index 4d1ed11fa6..cb9bb8bf94 100644
--- a/plugins/CloudFile/src/utils.cpp
+++ b/plugins/CloudFile/src/utils.cpp
@@ -28,7 +28,7 @@ MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD cbBlob, PBY
 {
 	DBEVENTINFO dbei = {};
 	dbei.szModule = MODULE;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.eventType = type;
 	dbei.cbBlob = cbBlob;
 	dbei.pBlob = pBlob;
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index b24ef0eaba..2971dbd8c3 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -745,7 +745,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re
 
 							strncpy_s(module, ack->szModule, _countof(module));
 							e.szModule = module;
-							e.timestamp = (DWORD)time(nullptr);
+							e.timestamp = (DWORD)time(0);
 
 							db_event_add(ack->hContact, &e);
 						}
diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp
index 66f1c6d310..333cc893a1 100644
--- a/plugins/CmdLine/src/services.cpp
+++ b/plugins/CmdLine/src/services.cpp
@@ -72,7 +72,7 @@ int StartServer()
 	{
 		if (sdCmdLine->instances == 0)
 		{
-			HANDLE server = mir_forkthread(ServerWorkerThread, nullptr);
+			HANDLE server = mir_forkthread(ServerWorkerThread);
 			if (server)
 			{
 				wchar_t path[MIMFOLDER_SIZE];
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp
index b0a746d157..32660d933f 100644
--- a/plugins/Console/src/Console.cpp
+++ b/plugins/Console/src/Console.cpp
@@ -1215,7 +1215,7 @@ void InitConsole()
 
 	LoadSettings();
 
-	hConsoleThread = mir_forkthread(ConsoleThread, nullptr);
+	hConsoleThread = mir_forkthread(ConsoleThread);
 
 	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole);
 	HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp
index 430bbe36b3..d13f37a2f3 100644
--- a/plugins/ContactsPlus/src/send.cpp
+++ b/plugins/ContactsPlus/src/send.cpp
@@ -402,7 +402,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
 			dbei.szModule = GetContactProto(ackData->hContact);
 			dbei.eventType = EVENTTYPE_CONTACTS;
 			dbei.flags = DBEF_SENT | DBEF_UTF;
-			dbei.timestamp = time(nullptr);
+			dbei.timestamp = time(0);
 			//make blob
 			TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend));
 			memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend)));
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp
index 1014bb8753..ce4c45e020 100644
--- a/plugins/CountryFlags/src/ip2country.cpp
+++ b/plugins/CountryFlags/src/ip2country.cpp
@@ -305,7 +305,7 @@ void InitIpToCountry(void)
 	/* Services */
 	CreateServiceFunction(MS_FLAGS_IPTOCOUNTRY,ServiceIpToCountry);
 #ifdef BINCONV
-	mir_forkthread(BinConvThread,NULL);
+	mir_forkthread(BinConvThread);
 #endif
 }
 
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index df31953a22..cb43a50d68 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -243,7 +243,7 @@ int Backup(wchar_t *backup_filename)
 		}
 		SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
 		UpdateWindow(progress_dialog);
-		db_set_dw(0, MODULE, "LastBackupTimestamp", (DWORD)time(nullptr));
+		db_set_dw(0, MODULE, "LastBackupTimestamp", (DWORD)time(0));
 
 		if (options.use_cloudfile)
 		{
@@ -308,7 +308,7 @@ void BackupStart(wchar_t *backup_filename)
 	}
 	if (backup_filename != nullptr)
 		tm = mir_wstrdup(backup_filename);
-	if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) {
+	if (mir_forkthread(BackupThread, tm) == INVALID_HANDLE_VALUE) {
 		InterlockedExchange(&m_state, 0); /* Backup done. */
 		mir_free(tm);
 	}
@@ -316,7 +316,7 @@ void BackupStart(wchar_t *backup_filename)
 
 VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
 {
-	time_t t = time(nullptr);
+	time_t t = time(0);
 	time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", 0);
 	if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24)))))
 		BackupStart(nullptr);
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp
index f5c5684327..79f74005f4 100644
--- a/plugins/FTPFileYM/src/dbentry.cpp
+++ b/plugins/FTPFileYM/src/dbentry.cpp
@@ -137,7 +137,7 @@ void DBEntry::add(GenericJob *job)
 	DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName);
 
 	if (job->m_tab->m_iOptAutoDelete != -1) {
-		time_t deleteTS = time(nullptr);
+		time_t deleteTS = time(0);
 		deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
 		DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS);
 	}
@@ -149,7 +149,7 @@ void DBEntry::add(GenericJob *job)
 void DBEntry::setDeleteTS(GenericJob *job)
 {
 	if (job->m_tab->m_iOptAutoDelete != -1) {
-		time_t deleteTS = time(nullptr);
+		time_t deleteTS = time(0);
 		deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
 		DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS);
 	}
diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp
index fe642e8a83..cb7b0063d7 100644
--- a/plugins/FTPFileYM/src/deletetimer.cpp
+++ b/plugins/FTPFileYM/src/deletetimer.cpp
@@ -56,7 +56,7 @@ void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD)
 
 	DBEntry *entry = DBEntry::getFirst();
 	while (entry != nullptr) {
-		if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(nullptr)) {
+		if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(0)) {
 			DeleteJob *job = new DeleteJob(new DBEntry(entry), nullptr);
 			job->start();
 		}
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp
index 6bb44b32dd..d9efb9ae97 100644
--- a/plugins/FTPFileYM/src/job_delete.cpp
+++ b/plugins/FTPFileYM/src/job_delete.cpp
@@ -38,10 +38,8 @@ DeleteJob::~DeleteJob()
 	delete m_entry;
 }
 
-void DeleteJob::waitingThread(void *arg)
+void DeleteJob::waitingThread(DeleteJob *job)
 {
-	DeleteJob *job = (DeleteJob *)arg;
-
 	while (!Miranda_IsTerminated()) {
 		mir_cslockfull lock(mutexJobCount);
 		if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -67,7 +65,7 @@ void DeleteJob::waitingThread(void *arg)
 
 void DeleteJob::start()
 {
-	mir_forkthread(&DeleteJob::waitingThread, this);
+	mir_forkThread<DeleteJob>(&DeleteJob::waitingThread, this);
 }
 
 void DeleteJob::run()
diff --git a/plugins/FTPFileYM/src/job_delete.h b/plugins/FTPFileYM/src/job_delete.h
index 73e6b79822..a3d719fa92 100644
--- a/plugins/FTPFileYM/src/job_delete.h
+++ b/plugins/FTPFileYM/src/job_delete.h
@@ -37,7 +37,7 @@ private:
 	char *getDelFileString();
 	char *getDelUrlString();
 
-	static void waitingThread(void *arg); 
+	static void __cdecl waitingThread(DeleteJob *job);
 	void run();
 
 public:
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp
index 79c4c9454e..e85e28910b 100644
--- a/plugins/FTPFileYM/src/job_packer.cpp
+++ b/plugins/FTPFileYM/src/job_packer.cpp
@@ -75,10 +75,8 @@ void PackerJob::addToUploadDlg()
 	start();
 }
 
-void PackerJob::waitingThread(void *arg)
+void PackerJob::waitingThread(PackerJob *job)
 {
-	PackerJob *job = (PackerJob *)arg;
-
 	while (!Miranda_IsTerminated()) {
 		mir_cslockfull lock(mutexJobCount);
 		if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -103,7 +101,7 @@ void PackerJob::waitingThread(void *arg)
 
 void PackerJob::start()
 {
-	mir_forkthread(&PackerJob::waitingThread, this);
+	mir_forkThread<PackerJob>(&PackerJob::waitingThread, this);
 }
 
 void PackerJob::pack()
@@ -115,7 +113,7 @@ void PackerJob::pack()
 	}
 
 	setStatus(STATUS_PACKING);
-	m_startTS = time(nullptr);
+	m_startTS = time(0);
 
 	int res = createZipFile();
 	if (res == ZIP_OK) {
@@ -230,10 +228,10 @@ uLong PackerJob::getFileTime(wchar_t *file, tm_zip*, uLong *dt)
 void PackerJob::updateStats()
 {
 	DWORD dwNewTick = GetTickCount();
-	if (m_uiReaded && (time(nullptr) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
+	if (m_uiReaded && (time(0) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
 		m_lastUpdateTick = dwNewTick;
 
-		double speed = ((double)m_uiReaded / 1024) / (time(nullptr) - m_startTS);
+		double speed = ((double)m_uiReaded / 1024) / (time(0) - m_startTS);
 		mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
 
 		double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0;
diff --git a/plugins/FTPFileYM/src/job_packer.h b/plugins/FTPFileYM/src/job_packer.h
index 14edcbeda1..36c5a0ddb8 100644
--- a/plugins/FTPFileYM/src/job_packer.h
+++ b/plugins/FTPFileYM/src/job_packer.h
@@ -36,7 +36,7 @@ private:
 	static mir_cs mutexJobCount;
 	static int iRunningJobCount;
 
-	static void waitingThread(void *arg); 
+	static void __cdecl waitingThread(PackerJob *job);
 	static uLong getFileTime(wchar_t *file, tm_zip *tmzip, uLong *dt);
 
 	void pack(); 
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp
index f7edbebf25..0fd6aae79c 100644
--- a/plugins/FTPFileYM/src/job_upload.cpp
+++ b/plugins/FTPFileYM/src/job_upload.cpp
@@ -95,7 +95,7 @@ void UploadJob::autoSend()
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_SENT;
 	dbei.szModule = szProto;
-	dbei.timestamp = (DWORD)time(nullptr);
+	dbei.timestamp = (DWORD)time(0);
 	dbei.cbBlob = (DWORD)mir_strlen(m_szFileLink) + 1;
 	dbei.pBlob = (PBYTE)m_szFileLink;
 	db_event_add(m_hContact, &dbei);
@@ -137,7 +137,7 @@ void UploadJob::pauseHandler()
 void UploadJob::resume()
 {
 	m_uiSent = 0;
-	m_startTS = time(nullptr);
+	m_startTS = time(0);
 	if (!isCompleted()) {
 		curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
 		setStatus(STATUS_UPLOADING);
@@ -150,10 +150,8 @@ void UploadJob::cancel()
 	curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
 }
 
-void UploadJob::waitingThread(void *arg)
+void UploadJob::waitingThread(UploadJob *job)
 {
-	UploadJob *job = (UploadJob *)arg;
-
 	while (!Miranda_IsTerminated()) {
 		mir_cslockfull lock(mutexJobCount);
 		if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -182,7 +180,7 @@ void UploadJob::waitingThread(void *arg)
 
 void UploadJob::start()
 {
-	mir_forkthread(&UploadJob::waitingThread, this);
+	mir_forkThread<UploadJob>(&UploadJob::waitingThread, this);
 }
 
 char *UploadJob::getChmodString()
@@ -312,7 +310,7 @@ void UploadJob::upload()
 	if (uploadFile) {
 		curl_easy_setopt(m_hCurl, CURLOPT_UPLOAD, 1L);
 		setStatus(STATUS_CONNECTING);
-		m_startTS = time(nullptr);
+		m_startTS = time(0);
 
 		int result = curl_easy_perform(hCurl);
 		curl_slist_free_all(headerList);
@@ -385,8 +383,8 @@ size_t UploadJob::ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg)
 
 void UploadJob::updateStats()
 {
-	if (m_uiSent && (time(nullptr) > m_startTS)) {
-		double speed = ((double)m_uiSent / 1024) / (time(nullptr) - m_startTS);
+	if (m_uiSent && (time(0) > m_startTS)) {
+		double speed = ((double)m_uiSent / 1024) / (time(0) - m_startTS);
 		m_avgSpeed = speed;
 		for (int i = 0; i < _countof(m_lastSpeed); i++) {
 			m_avgSpeed += (m_lastSpeed[i] == 0 ? speed : m_lastSpeed[i]);
diff --git a/plugins/FTPFileYM/src/job_upload.h b/plugins/FTPFileYM/src/job_upload.h
index 211eee3756..cf46c48a06 100644
--- a/plugins/FTPFileYM/src/job_upload.h
+++ b/plugins/FTPFileYM/src/job_upload.h
@@ -53,7 +53,7 @@ private:
 
 	CURL* curlInit(char *szUrl, struct curl_slist *headerList);
 
-	static void waitingThread(void *arg); 
+	static void __cdecl waitingThread(UploadJob *job);
 	static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg);
 	static INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); 
 
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp
index 13bd394571..7e69ffa91d 100644
--- a/plugins/FavContacts/src/contact_cache.cpp
+++ b/plugins/FavContacts/src/contact_cache.cpp
@@ -30,9 +30,9 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent)
 	if (dbei.eventType != EVENTTYPE_MESSAGE)
 		return 0;
 
-	float weight = GetEventWeight(time(nullptr) - dbei.timestamp);
-	float q = GetTimeWeight(time(nullptr) - m_lastUpdate);
-	m_lastUpdate = time(nullptr);
+	float weight = GetEventWeight(time(0) - dbei.timestamp);
+	float q = GetTimeWeight(time(0) - m_lastUpdate);
+	m_lastUpdate = time(0);
 	if (!weight)
 		return 0;
 
@@ -77,8 +77,8 @@ float CContactCache::GetTimeWeight(unsigned long age)
 
 void CContactCache::Rebuild()
 {
-	unsigned long timestamp = time(nullptr);
-	m_lastUpdate = time(nullptr);
+	unsigned long timestamp = time(0);
+	m_lastUpdate = time(0);
 
 	for (auto &hContact : Contacts()) {
 		TContactInfo *info = new TContactInfo;
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp
index ee1bbc04e4..8222d5c4cf 100644
--- a/plugins/GmailNotifier/src/notify.cpp
+++ b/plugins/GmailNotifier/src/notify.cpp
@@ -1,5 +1,76 @@
 #include "stdafx.h"
 
+static void __cdecl Login_ThreadFunc(Account *curAcc)
+{
+	if (curAcc == nullptr)
+		return;
+
+	HANDLE hTempFile;
+	DWORD  dwBytesWritten, dwBufSize = 1024;
+	char szTempName[MAX_PATH];
+	char buffer[1024];
+	char *str_temp;
+	char lpPathBuffer[1024];
+
+	if (GetBrowser(lpPathBuffer)) {
+		if (opt.AutoLogin == 0) {
+			if (curAcc->hosted[0]) {
+				mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
+				mir_strcat(lpPathBuffer, curAcc->hosted);
+				mir_strcat(lpPathBuffer, "/?logout");
+			}
+			else {
+				mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
+			}
+		}
+		else {
+			if (curAcc->hosted[0]) {
+				GetTempPathA(dwBufSize, buffer);
+				GetTempFileNameA(buffer, "gmail", 0, szTempName);
+
+				hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+				mir_strcpy(buffer, FORMDATA1);
+				mir_strcat(buffer, curAcc->hosted);
+				mir_strcat(buffer, FORMDATA2);
+				mir_strcat(buffer, curAcc->hosted);
+				mir_strcat(buffer, FORMDATA3);
+				mir_strcat(buffer, "<input type=hidden name=userName value=");
+				mir_strcat(buffer, curAcc->name);
+				if ((str_temp = strstr(buffer, "@")) != nullptr)
+					*str_temp = '\0';
+				mir_strcat(buffer, "><input type=hidden name=password value=");
+				mir_strcat(buffer, curAcc->pass);
+				mir_strcat(buffer, "></form></body>");
+				WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr);
+				CloseHandle(hTempFile);
+				mir_strcat(lpPathBuffer, szTempName);
+			}
+			else {
+				char *szEncodedURL = mir_urlEncode(curAcc->name);
+				mir_strcat(lpPathBuffer, LINK);
+				mir_strcat(lpPathBuffer, szEncodedURL);
+				//mir_strcat(lpPathBuffer, "&Passwd=");
+				//mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass));
+				if (opt.AutoLogin == 1)
+					mir_strcat(lpPathBuffer, "&PersistentCookie=yes");
+				mir_free(szEncodedURL);
+			}
+		}
+	}
+
+	STARTUPINFOA suInfo = { 0 };
+	PROCESS_INFORMATION procInfo;
+	suInfo.cb = sizeof(suInfo);
+	suInfo.wShowWindow = SW_MAXIMIZE;
+	if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo))
+		CloseHandle(procInfo.hProcess);
+
+	if (curAcc->hosted[0]) {
+		Sleep(30000);
+		DeleteFileA(szTempName);
+	}
+}
+
 int OpenBrowser(WPARAM hContact, LPARAM)
 {
 	char *proto = GetContactProto(hContact);
@@ -16,7 +87,7 @@ int OpenBrowser(WPARAM hContact, LPARAM)
 			DeleteResults(curAcc->results.next);
 			curAcc->results.next = nullptr;
 		}
-		mir_forkthread(Login_ThreadFunc, curAcc);
+		mir_forkThread<Account>(Login_ThreadFunc, curAcc);
 	}
 	return FALSE;
 }
@@ -27,6 +98,8 @@ INT_PTR Notifying(WPARAM, LPARAM lParam)
 	return 0;
 }
 
+/////////////////////////////////////////////////////////////////////////////////////////
+
 static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 	MCONTACT hContact = PUGetContact(hWnd);
@@ -76,7 +149,7 @@ void NotifyUser(Account *curAcc)
 			dbei.eventType = EVENTTYPE_MESSAGE;
 			dbei.flags = DBEF_READ;
 			dbei.szModule = MODULE_NAME;
-			dbei.timestamp = time(nullptr);
+			dbei.timestamp = time(0);
 
 			resultLink *prst = curAcc->results.next;
 			for (int i = 0; i < newMails; i++) {
@@ -135,75 +208,3 @@ void DeleteResults(resultLink *prst)
 		free(prst);
 	}
 }
-
-void __cdecl Login_ThreadFunc(void *lpParam)
-{
-	if (lpParam == nullptr)
-		return;
-
-	HANDLE hTempFile;
-	DWORD  dwBytesWritten, dwBufSize = 1024;
-	char szTempName[MAX_PATH];
-	char buffer[1024];
-	char *str_temp;
-	char lpPathBuffer[1024];
-	Account *curAcc = (Account *)lpParam;
-
-	if (GetBrowser(lpPathBuffer)) {
-		if (opt.AutoLogin == 0) {
-			if (curAcc->hosted[0]) {
-				mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
-				mir_strcat(lpPathBuffer, curAcc->hosted);
-				mir_strcat(lpPathBuffer, "/?logout");
-			}
-			else {
-				mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
-			}
-		}
-		else {
-			if (curAcc->hosted[0]) {
-				GetTempPathA(dwBufSize, buffer);
-				GetTempFileNameA(buffer, "gmail", 0, szTempName);
-
-				hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
-				mir_strcpy(buffer, FORMDATA1);
-				mir_strcat(buffer, curAcc->hosted);
-				mir_strcat(buffer, FORMDATA2);
-				mir_strcat(buffer, curAcc->hosted);
-				mir_strcat(buffer, FORMDATA3);
-				mir_strcat(buffer, "<input type=hidden name=userName value=");
-				mir_strcat(buffer, curAcc->name);
-				if ((str_temp = strstr(buffer, "@")) != nullptr)
-					*str_temp = '\0';
-				mir_strcat(buffer, "><input type=hidden name=password value=");
-				mir_strcat(buffer, curAcc->pass);
-				mir_strcat(buffer, "></form></body>");
-				WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr);
-				CloseHandle(hTempFile);
-				mir_strcat(lpPathBuffer, szTempName);
-			}
-			else {
-				char *szEncodedURL = mir_urlEncode(curAcc->name);
-				mir_strcat(lpPathBuffer, LINK);
-				mir_strcat(lpPathBuffer, szEncodedURL);
-				//mir_strcat(lpPathBuffer, "&Passwd=");
-				//mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass));
-				if (opt.AutoLogin == 1)
-					mir_strcat(lpPathBuffer, "&PersistentCookie=yes");
-				mir_free(szEncodedURL);
-			}
-		}
-	}
-
-	STARTUPINFOA suInfo = { 0 };
-	PROCESS_INFORMATION procInfo;
-	suInfo.cb = sizeof(suInfo);
-	suInfo.wShowWindow = SW_MAXIMIZE;
-	if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo))
-		CloseHandle(procInfo.hProcess);
-
-	if (curAcc->hosted[0]) {
-		Sleep(30000);
-		DeleteFileA(szTempName);
-	}
-}
diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h
index f5cedab022..0012cb756c 100644
--- a/plugins/GmailNotifier/src/stdafx.h
+++ b/plugins/GmailNotifier/src/stdafx.h
@@ -85,7 +85,6 @@ BOOL GetBrowser(char *);
 void NotifyUser(Account *);
 int OptInit(WPARAM, LPARAM);
 void Check_ThreadFunc(void *);
-void Login_ThreadFunc(void *);
 int OpenBrowser(WPARAM, LPARAM);
 void DeleteResults(resultLink *);
 void BuildList(void);
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index 859806d57e..5409b6f430 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -560,9 +560,8 @@ static INT_PTR nHttpGetAllShares(WPARAM /*wParam*/, LPARAM /*lParam*/)
 // Developer       : KN
 /////////////////////////////////////////////////////////////////////
 
-void HandleNewConnection(void *ch)
+void __cdecl HandleNewConnection(CLHttpUser *pclUser)
 {
-	CLHttpUser * pclUser = (CLHttpUser *)ch;
 	pclUser->HandleNewConnection();
 	delete pclUser;
 }
@@ -587,7 +586,7 @@ void ConnectionOpen(HNETLIBCONN hNewConnection, DWORD dwRemoteIP)
 	stAddr.S_un.S_addr = htonl(dwRemoteIP);
 
 	CLHttpUser *pclUser = new CLHttpUser(hNewConnection, stAddr);
-	mir_forkthread(HandleNewConnection, pclUser);
+	mir_forkThread<CLHttpUser>(HandleNewConnection, pclUser);
 }
 
 /////////////////////////////////////////////////////////////////////
diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp
index 722e6e0c96..f41602217c 100644
--- a/plugins/HistoryStats/src/settings.cpp
+++ b/plugins/HistoryStats/src/settings.cpp
@@ -41,7 +41,7 @@ Settings::CharMapper::CharMapper(const Settings& settings)
 Settings::Filter::Filter(const ext::string& strID)
 	: m_strID(strID), m_nMode(fwmWordsMatching), m_nRef(0)
 {
-	time_t curTime = time(nullptr);
+	time_t curTime = time(0);
 	struct tm* curTM = localtime(&curTime);
 
 	m_strName += utils::intToPadded(1900 + curTM->tm_year, 4);
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp
index 842e24106e..321ad138a7 100644
--- a/plugins/HistoryStats/src/statistic.cpp
+++ b/plugins/HistoryStats/src/statistic.cpp
@@ -1188,7 +1188,7 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN
 	m_nFirstTime(0),
 	m_nLastTime(0)
 {
-	m_TimeStarted = TimeZone_ToLocal(time(nullptr));
+	m_TimeStarted = TimeZone_ToLocal(time(0));
 	m_MSecStarted = GetTickCount();
 	m_AverageMinTime = settings.m_AverageMinTime * 24 * 60 * 60; // calculate seconds from days
 }
@@ -1214,7 +1214,7 @@ bool Statistic::createStatistics()
 	utils::centerDialog(m_hWndProgress);
 	UpdateWindow(m_hWndProgress);
 
-	HANDLE hThread = mir_forkthread(threadProcSteps, (void*)this);
+	HANDLE hThread = mir_forkThread<Statistic>(threadProcSteps, this);
 
 	bool bDone = false;
 	MSG msg;
@@ -1304,11 +1304,10 @@ void Statistic::createStatisticsSteps()
 	setProgressLabel(false, TranslateT("Done"));
 }
 
-void __cdecl Statistic::threadProc(void *lpParameter)
+void __cdecl Statistic::threadProc(Statistic* pStats)
 {
 	Thread_SetName("HistoryStats: Statistic::threadProc");
 
-	Statistic* pStats = reinterpret_cast<Statistic*>(lpParameter);
 	SetEvent(pStats->m_hThreadPushEvent);
 
 	// perform action
@@ -1324,10 +1323,9 @@ void __cdecl Statistic::threadProc(void *lpParameter)
 	m_bRunning = false;
 }
 
-void __cdecl Statistic::threadProcSteps(void *lpParameter)
+void __cdecl Statistic::threadProcSteps(Statistic *pStats)
 {
 	Thread_SetName("HistoryStats: Statistic::threadProcSteps");
-	Statistic *pStats = reinterpret_cast<Statistic*>(lpParameter);
 	if (pStats->m_Settings.m_ThreadLowPriority)
 		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
 
@@ -1421,7 +1419,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS
 	Statistic *pStats = new Statistic(settings, invokedFrom, hInst);
 	pStats->m_hThreadPushEvent = hEvent;
 	// create worker thread
-	HANDLE hThread = mir_forkthread(threadProc, (void*)pStats);
+	HANDLE hThread = mir_forkThread<Statistic>(threadProc, pStats);
 
 	// wait for thread to place itself on thread unwind stack
 	if (hThread != nullptr)
diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h
index e05254b5d7..fc4f2cacb0 100644
--- a/plugins/HistoryStats/src/statistic.h
+++ b/plugins/HistoryStats/src/statistic.h
@@ -160,8 +160,8 @@ private:
 	explicit Statistic(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst);
 	bool createStatistics();
 	void createStatisticsSteps();
-	static void __cdecl threadProc(void *lpParameter);
-	static void __cdecl threadProcSteps(void *lpParameter);
+	static void __cdecl threadProc(Statistic *pStats);
+	static void __cdecl threadProcSteps(Statistic *pStats);
 
 public:
 	~Statistic();
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
index ffb4298471..e73fb24e0c 100644
--- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp
+++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
@@ -30,7 +30,7 @@ typedef struct
 // build criteria
 time_t BuildCriteria(int dwti)
 {
-	time_t tim = time(nullptr);
+	time_t tim = time(0);
 
 	switch (dwti) {
 	case 0:
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp
index 22e77eef4e..b956a740c7 100644
--- a/plugins/IEView/src/ChatHTMLBuilder.cpp
+++ b/plugins/IEView/src/ChatHTMLBuilder.cpp
@@ -41,7 +41,7 @@ static const char *classNames[] = {
 ChatHTMLBuilder::ChatHTMLBuilder()
 {
 	setLastEventType(-1);
-	setLastEventTime(time(nullptr));
+	setLastEventTime(time(0));
 }
 
 void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index 7be90be9b5..cf343e9651 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -65,8 +65,8 @@ static const char *dbSpanSettingNames[] = {
 HistoryHTMLBuilder::HistoryHTMLBuilder()
 {
 	setLastEventType(-1);
-	setLastEventTime(time(nullptr));
-	startedTime = time(nullptr);
+	setLastEventTime(time(0));
+	startedTime = time(0);
 }
 
 bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp
index d42635dc8f..bbcdd90c3e 100644
--- a/plugins/IEView/src/MUCCHTMLBuilder.cpp
+++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp
@@ -37,7 +37,7 @@ static const char *classNames[] = {
 MUCCHTMLBuilder::MUCCHTMLBuilder()
 {
 	setLastEventType(-1);
-	setLastEventTime(time(nullptr));
+	setLastEventTime(time(0));
 }
 
 void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -86,7 +86,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check)
 
 	szResult[0] = '\0';
 	struct tm tm_now, tm_today;
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	time_t today;
 	tm_now = *localtime(&now);
 	tm_today = tm_now;
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index 3b575be015..c0e569cca7 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -64,8 +64,8 @@ static const char *classNames[] = {
 ScriverHTMLBuilder::ScriverHTMLBuilder()
 {
 	setLastEventType(-1);
-	setLastEventTime(time(nullptr));
-	startedTime = time(nullptr);
+	setLastEventTime(time(0));
+	startedTime = time(0);
 }
 
 bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -128,7 +128,7 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod
 
 	if ((mode == 0 || mode == 1) && (dwFlags & SMF_LOG_SHOWDATE)) {
 		struct tm tm_now, tm_today;
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		time_t today;
 		tm_now = *localtime(&now);
 		tm_today = tm_now;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
index 4cde3546ac..01e63bdc89 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
@@ -77,9 +77,9 @@ static const char *classNames[] = {
 TabSRMMHTMLBuilder::TabSRMMHTMLBuilder()
 {
 	setLastEventType(-1);
-	setLastEventTime(time(nullptr));
-	lastEventTime = time(nullptr);
-	startedTime = time(nullptr);
+	setLastEventTime(time(0));
+	lastEventTime = time(0);
+	startedTime = time(0);
 }
 
 bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO *dbei)
@@ -158,7 +158,7 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG
 	const char *szFormat;
 
 	struct tm tm_now, tm_today;
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	time_t today;
 
 	if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) {
@@ -291,7 +291,7 @@ time_t TabSRMMHTMLBuilder::getStartedTime()
 
 void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
 {
-	DWORD today = (DWORD)time(nullptr);
+	DWORD today = (DWORD)time(0);
 	today = today - today % 86400;
 	DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
 	DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp
index 576b372b70..bdf5882c08 100644
--- a/plugins/IEView/src/TemplateHTMLBuilder.cpp
+++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 TemplateHTMLBuilder::TemplateHTMLBuilder()
 {
 	iLastEventType = -1;
-	startedTime = lastEventTime = time(nullptr);
+	startedTime = lastEventTime = time(0);
 	groupTemplate = nullptr;
 }
 
@@ -85,7 +85,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo
 		TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? L"s" : L"t", str, _countof(str));
 	else { // date
 		struct tm tm_now, tm_today;
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		time_t today;
 		tm_now = *localtime(&now);
 		tm_today = tm_now;
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 752400ecc8..1e54739a08 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -1052,7 +1052,7 @@ void MirandaImport(HWND hdlg)
 	dstDb->SetCacheSafetyMode(FALSE);
 
 	// Start benchmark timer
-	DWORD dwTimer = time(nullptr);
+	DWORD dwTimer = time(0);
 
 	OBJLIST<char> arSkippedAccs(1, CompareModules);
 	arSkippedAccs.insert(newStr("CListGroups"));
@@ -1143,7 +1143,7 @@ void MirandaImport(HWND hdlg)
 	delete srcDb;
 
 	// Stop timer
-	dwTimer = time(nullptr) - dwTimer;
+	dwTimer = time(0) - dwTimer;
 
 	// Print statistics
 	AddMessage(LPGENW("Import completed in %d seconds."), dwTimer);
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp
index 56b28849b2..977b62652f 100644
--- a/plugins/Import/src/miranda.cpp
+++ b/plugins/Import/src/miranda.cpp
@@ -227,7 +227,7 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP
 	case WM_INITDIALOG:
 		TranslateDialogDefault(hwndDlg);
 		{
-			dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(nullptr));
+			dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(0));
 			struct tm *TM = localtime(&dwSinceDate);
 
 			struct _SYSTEMTIME ST = { 0 };
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp
index 2a47c528b7..b5da36a964 100644
--- a/plugins/KeyboardNotify/src/flash.cpp
+++ b/plugins/KeyboardNotify/src/flash.cpp
@@ -310,7 +310,7 @@ void testSequence(wchar_t *testStr)
 	static FLASHING_SEQUENCE Test = {0};
 	Test = str2FS(testStr);
 	
-	mir_forkthread(TestThread, (void*)&Test);
+	mir_forkthread(TestThread, &Test);
 }
 
 
@@ -339,7 +339,7 @@ void previewFlashing(BOOL buttonState)
 		return;
 
 	bPreviewSemaphore = TRUE;
-	mir_forkthread(PreviewThread, nullptr);
+	mir_forkthread(PreviewThread);
 }
 
 
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index 305a817183..091fe7d903 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -914,7 +914,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
 	mir_snwprintf(eventName, L"%s/ExitEvent", eventPrefix);
 	hExitEvent = CreateEvent(nullptr, FALSE, FALSE, eventName);
 
-	hThread = mir_forkthread(FlashThreadFunction, nullptr);
+	hThread = mir_forkthread(FlashThreadFunction);
 
 	HookEvent(ME_MC_ENABLED, OnMetaChanged);
 	HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index d57cdb86bf..955cbbd483 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -429,7 +429,7 @@ static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **va
 				}
 				else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) {
 					wchar_t tmp[128];
-					TimeZone_ToStringT(time(nullptr), L"d s", tmp, _countof(tmp));
+					TimeZone_ToStringT(time(0), L"d s", tmp, _countof(tmp));
 					buffer->replace(j, i + 1, tmp);
 				}
 				else {
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index e8d3277e4b..ef35101dbc 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -555,7 +555,7 @@ int check() {
 	Menu_EnableItem(hMenuHandle, !running);
 
 	log(L"check: starting checkthread");
-	mir_forkthread(checkthread, nullptr);
+	mir_forkthread(checkthread);
 
 	return 0;
 }
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
index 5696e7695a..7a1fa45ad6 100644
--- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
+++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp
@@ -1230,7 +1230,7 @@ time_t
 SharedMemoryUtils::mfGetCurrentTimestamp()
 {
 
-	time_t currentTimestamp = time(nullptr);
+	time_t currentTimestamp = time(0);
 	//logger->log_dp(L"mfGetCurrentTimestamp() [" SCNuPTR L"]", currentTimestamp);
 	return currentTimestamp;
 
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index 233b45be76..20deed6d35 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -294,7 +294,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_SENT | DBEF_UTF;
 	dbei.szModule = targetHandleSzProto;
-	dbei.timestamp = (DWORD)time(nullptr);
+	dbei.timestamp = (DWORD)time(0);
 	dbei.cbBlob = (DWORD)bufSize;
 	dbei.pBlob = (PBYTE)msgBuffer;
 	db_event_add(hContact, &dbei);
diff --git a/plugins/MirLua/Modules/m_schedule/src/main.cpp b/plugins/MirLua/Modules/m_schedule/src/main.cpp
index fd6820ea9f..0e7fc3c92c 100644
--- a/plugins/MirLua/Modules/m_schedule/src/main.cpp
+++ b/plugins/MirLua/Modules/m_schedule/src/main.cpp
@@ -24,7 +24,7 @@ struct ScheduleTask
 
 	ScheduleTask()
 	{
-		timestamp = time(nullptr);
+		timestamp = time(0);
 		interval = 0;
 		repeat = false;
 	}
@@ -63,7 +63,7 @@ void ExecuteTaskThread(void *arg)
 	{
 		mir_cslock lock(threadLock);
 
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		if (task->timestamp + task->interval >= now)
 			task->timestamp += task->interval;
 		else
@@ -87,7 +87,7 @@ wait:	WaitForSingleObject(hScheduleEvent, waitTime);
 			if (Miranda_IsTerminated())
 				return;
 
-			time_t now = time(nullptr);
+			time_t now = time(0);
 			if (task->timestamp > now)
 			{
 				waitTime = (task->timestamp - now) * 1000;
@@ -165,7 +165,7 @@ static int fluent_Do(lua_State *L)
 
 	ScheduleTask *task = *(ScheduleTask**)lua_touserdata(L, lua_upvalueindex(1));
 
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	if (task->timestamp < now)
 	{
 		if (task->interval == 0)
@@ -323,7 +323,7 @@ static int fluent_Week(lua_State *L)
 
 static int fluent_Monday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(1 - ti->tm_wday);
 
@@ -339,7 +339,7 @@ static int fluent_Monday(lua_State *L)
 
 static int fluent_Tuesday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(2 - ti->tm_wday);
 
@@ -355,7 +355,7 @@ static int fluent_Tuesday(lua_State *L)
 
 static int fluent_Wednesday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(3 - ti->tm_wday);
 
@@ -371,7 +371,7 @@ static int fluent_Wednesday(lua_State *L)
 
 static int fluent_Thursday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(4 - ti->tm_wday);
 
@@ -387,7 +387,7 @@ static int fluent_Thursday(lua_State *L)
 
 static int fluent_Friday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(5 - ti->tm_wday);
 
@@ -403,7 +403,7 @@ static int fluent_Friday(lua_State *L)
 
 static int fluent_Saturday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(6 - ti->tm_wday);
 
@@ -419,7 +419,7 @@ static int fluent_Saturday(lua_State *L)
 
 static int fluent_Sunday(lua_State *L)
 {
-	time_t timestamp = time(nullptr);
+	time_t timestamp = time(0);
 	struct tm *ti = localtime(&timestamp);
 	ti->tm_mday += abs(-ti->tm_wday);
 
@@ -446,7 +446,7 @@ static int schedule_At(lua_State *L)
 {
 	ScheduleTask **task = (ScheduleTask**)lua_newuserdata(L, sizeof(ScheduleTask));
 	*task = new ScheduleTask();
-	(*task)->timestamp = luaM_opttimestamp(L, 1, time(nullptr));
+	(*task)->timestamp = luaM_opttimestamp(L, 1, time(0));
 
 	lua_newtable(L);
 	lua_newtable(L);
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp
index e382616954..b35b4dd67d 100644
--- a/plugins/MirLua/src/m_message.cpp
+++ b/plugins/MirLua/src/m_message.cpp
@@ -36,7 +36,7 @@ static int message_Send(lua_State *L)
 	else if ((res = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message)) != ACKRESULT_FAILED) {
 		DBEVENTINFO dbei = {};
 		dbei.szModule = MODULE;
-		dbei.timestamp = time(nullptr);
+		dbei.timestamp = time(0);
 		dbei.eventType = EVENTTYPE_MESSAGE;
 		dbei.cbBlob = (DWORD)mir_strlen(message);
 		dbei.pBlob = (PBYTE)mir_strdup(message);
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index 4c6108f6d0..155907a3cf 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -23,7 +23,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) {
 	DBEVENTINFO info = {};
 	next = DeleteEvents.first;
 	while (current = next) {
-		if (difftime(time(nullptr), current->timestamp) < 1) break;
+		if (difftime(time(0), current->timestamp) < 1) break;
 		if (!db_event_get(current->hDbEvent, &info)) // && info.flags&DBEF_READ)
 		{
 			db_event_delete(current->hContact, current->hDbEvent);
@@ -133,7 +133,7 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam)
 			DeleteEventNode *node = new DeleteEventNode();
 			node->hContact = hContact;
 			node->hDbEvent = lParam;
-			node->timestamp = time(nullptr);
+			node->timestamp = time(0);
 			node->next = nullptr;
 			mir_cslock lck(RemoveChainCS);
 			if (DeleteEvents.last)
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index a89ef8121f..0dcd1e1cfe 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -238,7 +238,7 @@ void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) {
 	T2Utf utf(buff);
 
 	PROTORECVEVENT pre = {0};
-	pre.timestamp = time(nullptr);
+	pre.timestamp = time(0);
 	pre.szMessage = utf;
 	pre.flags = PREF_BYPASS_OTR;
 	ProtoChainRecvMsg(hContact, &pre);	
@@ -249,7 +249,7 @@ void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) {
 	mir_snprintf(buff, "%s%s", LANG_INLINE_PREFIX, msg);
 
 	PROTORECVEVENT pre = {0};
-	pre.timestamp = time(nullptr);
+	pre.timestamp = time(0);
 	pre.szMessage = buff;
 	pre.flags = PREF_BYPASS_OTR;
 	ProtoChainRecvMsg(hContact, &pre);
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 4b9692dd87..80181272d1 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -661,7 +661,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob)
 				dbei.eventType = EVENTTYPE_MESSAGE;
 				dbei.flags = DBEF_SENT | DBEF_UTF;
 				dbei.szModule = szProto;
-				dbei.timestamp = time(nullptr);
+				dbei.timestamp = time(0);
 				// Check if protocoll is valid
 				if (dbei.szModule == nullptr)
 					return;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
index 2ec4f18332..f704f1ee08 100644
--- a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
+++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp
@@ -21,9 +21,9 @@ DWORD WINAPI notificationCallback(IN int,
 }
 
 
-void __cdecl initializeDrawingThread(void *pParam)
+void __cdecl initializeDrawingThread(CLCDConnectionLogitech *pParam)
 {
-	((CLCDConnectionLogitech*)pParam)->runDrawingThread();
+	pParam->runDrawingThread();
 }
 
 void CLCDConnectionLogitech::runDrawingThread() {
@@ -109,7 +109,7 @@ CLCDConnectionLogitech::CLCDConnectionLogitech()
 
 	CLCDConnectionLogitech::m_pInstance = this;
 
-	m_hDrawingThread = mir_forkthread(initializeDrawingThread, (void*)this);
+	m_hDrawingThread = mir_forkThread<CLCDConnectionLogitech>(initializeDrawingThread, this);
 }
 
 //************************************************************************
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
index a40b18d2a8..53cd59b701 100644
--- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
+++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp
@@ -64,7 +64,7 @@ CLCDScreen *CLCDOutputManager::GetActiveScreen()
 //************************************************************************
 bool CLCDOutputManager::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog)
 {
-	srand ( time(nullptr) );
+	srand ( time(0) );
 
 	InitDebug();
 
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index 64d2a01d83..88f4f6001f 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -144,10 +144,8 @@ struct ExportDialogData {
 	HWND hDialog;
 };
 
-void exportContactsMessages(void *p)
+void __cdecl exportContactsMessages(ExportDialogData *data)
 {
-	ExportDialogData *data = (ExportDialogData *)p;
-	
 	HWND hDlg = data->hDialog;
 	HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS);
 	HWND hStatus = GetDlgItem(hDlg, IDC_EXP_ALL_STATUS);
@@ -291,7 +289,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected)
 	ShowWindow(hDlg, SW_SHOWNORMAL);
 	
 	// Process the export in other thread
-	mir_forkthread(&exportContactsMessages, data);
+	mir_forkThread<ExportDialogData>(&exportContactsMessages, data);
 	return 0;
 }
 
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp
index 661385e298..975db0e8cd 100644
--- a/plugins/NewAwaySysMod/src/Client.cpp
+++ b/plugins/NewAwaySysMod/src/Client.cpp
@@ -71,7 +71,7 @@ void InitUpdateMsgs()
 	}
 	else if (!g_hUpdateMsgsThread && UpdateMsgs) {
 		g_hTerminateUpdateMsgsThread = CreateEvent(nullptr, TRUE, FALSE, nullptr);
-		g_hUpdateMsgsThread = (HANDLE)mir_forkthread(UpdateMsgsThreadProc, nullptr);
+		g_hUpdateMsgsThread = mir_forkthread(UpdateMsgsThreadProc);
 	}
 }
 
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
index 266437ea13..f86c1d6e00 100644
--- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
+++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
@@ -48,11 +48,10 @@ public:
 };
 
 // _ad must be allocated using "new CAutoreplyData()"
-void __cdecl AutoreplyDelayThread(void *_ad)
+void __cdecl AutoreplyDelayThread(CAutoreplyData *ad)
 {
 	Thread_SetName("NewAwaySysMod: AutoreplyDelayThread");
 
-	CAutoreplyData *ad = (CAutoreplyData*)_ad;
 	_ASSERT(ad && ad->hContact && ad->Reply.GetLen());
 	char *szProto = GetContactProto(ad->hContact);
 	if (!szProto) {
@@ -69,7 +68,7 @@ void __cdecl AutoreplyDelayThread(void *_ad)
 		dbeo.eventType = EVENTTYPE_MESSAGE;
 		dbeo.flags = DBEF_SENT | DBEF_UTF;
 		dbeo.szModule = szProto;
-		dbeo.timestamp = time(nullptr);
+		dbeo.timestamp = time(0);
 
 		dbeo.cbBlob = ReplyLen;
 		dbeo.pBlob = (PBYTE)(char*)pszReply;
@@ -114,7 +113,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
 	if (dbei->flags & DBEF_SENT || (dbei->eventType != EVENTTYPE_MESSAGE && dbei->eventType != EVENTTYPE_URL && dbei->eventType != EVENTTYPE_FILE))
 		return 0;
 
-	if (time(nullptr) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages
+	if (time(0) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages
 		return 0;
 
 	char *szProto = GetContactProto(hContact);
@@ -133,7 +132,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
 			return 0;
 
 		// remove outdated events first
-		DWORD CurTime = time(nullptr);
+		DWORD CurTime = time(0);
 		int i;
 		for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
 			if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
@@ -155,7 +154,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
 	// ugly workaround for metacontacts, part i; store all metacontacts' events to a temporary array, so we'll be able to get the 'source' protocol when subcontact event happens later. we need the protocol to get its status and per-status settings properly
 	if (!mir_strcmp(szProto, META_PROTO)) {
 		// remove outdated events first
-		DWORD CurTime = time(nullptr);
+		DWORD CurTime = time(0);
 		for (int i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
 			if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
 				MetacontactEvents.RemoveElem(i);
@@ -232,7 +231,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
 	
 	if (Reply.GetLen()) {
 		CAutoreplyData *ad = new CAutoreplyData(hContact, Reply);
-		mir_forkthread(AutoreplyDelayThread, ad);
+		mir_forkThread<CAutoreplyData>(AutoreplyDelayThread, ad);
 	}
 	return 0;
 }
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 60649d6deb..09d9025e14 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -270,7 +270,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt)
 	dbei.eventType = EVENTTYPE_STATUSCHANGE;
 	dbei.flags = DBEF_READ | DBEF_UTF;
 
-	dbei.timestamp = (DWORD)time(nullptr);
+	dbei.timestamp = (DWORD)time(0);
 	dbei.szModule = MODULE;
 	MEVENT hDBEvent = db_event_add(smi->hContact, &dbei);
 
@@ -355,7 +355,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
 		dbei.eventType = EVENTTYPE_STATUSCHANGE;
 		dbei.flags = DBEF_READ | DBEF_UTF;
 
-		dbei.timestamp = (DWORD)time(nullptr);
+		dbei.timestamp = (DWORD)time(0);
 		dbei.szModule = MODULE;
 		MEVENT hDBEvent = db_event_add(hContact, &dbei);
 
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index 4c73abb6f9..697876bf22 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -298,7 +298,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc)
 		dbei.pBlob = (PBYTE)(char*)blob;
 		dbei.eventType = EVENTTYPE_STATUSCHANGE;
 		dbei.flags = DBEF_READ | DBEF_UTF;
-		dbei.timestamp = (DWORD)time(nullptr);
+		dbei.timestamp = (DWORD)time(0);
 		dbei.szModule = MODULE;
 		MEVENT hDBEvent = db_event_add(xsc->hContact, &dbei);
 
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 33de2251a7..f8c2531190 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -568,7 +568,7 @@ void HistoryLog(MCONTACT hContact, db_event evt)
 	Event.eventType = evt.eventType;
 	Event.flags = evt.flags;
 	if (!evt.timestamp)
-		Event.timestamp = (DWORD)time(nullptr);
+		Event.timestamp = (DWORD)time(0);
 	else
 		Event.timestamp = evt.timestamp;
 	Event.cbBlob = (DWORD)mir_strlen((char*)evt.pBlob) + 1;
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp
index 448cf8d1da..559b52d3d9 100644
--- a/plugins/NewsAggregator/Src/CheckFeed.cpp
+++ b/plugins/NewsAggregator/Src/CheckFeed.cpp
@@ -176,7 +176,7 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr
 
 	if (!MesExist) {
 		if (stamp == 0)
-			stamp = time(nullptr);
+			stamp = time(0);
 
 		T2Utf pszMessage(message);
 
@@ -392,10 +392,10 @@ void CheckCurrentFeed(MCONTACT hContact)
 								szChildText = xmlGetText(child);
 							if (szChildText) {
 								time_t stamp = DateToUnixTime(szChildText, 0);
-								double deltaupd = difftime(time(nullptr), stamp);
-								double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+								double deltaupd = difftime(time(0), stamp);
+								double deltacheck = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
 								if (deltaupd - deltacheck >= 0) {
-									db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+									db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
 									xmlDestroyNode(hXml);
 									return;
 								}
@@ -525,10 +525,10 @@ void CheckCurrentFeed(MCONTACT hContact)
 							if (szChildText) {
 								wchar_t *lastupdtime = (wchar_t *)szChildText;
 								time_t stamp = DateToUnixTime(lastupdtime, 1);
-								double deltaupd = difftime(time(nullptr), stamp);
-								double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+								double deltaupd = difftime(time(0), stamp);
+								double deltacheck = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
 								if (deltaupd - deltacheck >= 0) {
-									db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+									db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
 									xmlDestroyNode(hXml);
 									return;
 								}
@@ -601,7 +601,7 @@ void CheckCurrentFeed(MCONTACT hContact)
 			xmlDestroyNode(hXml);
 		}
 	}
-	db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
+	db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(0));
 }
 
 void CheckCurrentFeedAvatar(MCONTACT hContact)
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index bf9030bb6f..0cc91bec3e 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -38,7 +38,7 @@ int NewsAggrInit(WPARAM, LPARAM)
 
 	for (auto &hContact : Contacts(MODULE)) {
 		if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
-			db_set_dw(hContact, MODULE, "LastCheck", time(nullptr));
+			db_set_dw(hContact, MODULE, "LastCheck", time(0));
 		db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE);
 	}
 
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp
index 893a00239b..45db5d3f7e 100644
--- a/plugins/NewsAggregator/Src/Update.cpp
+++ b/plugins/NewsAggregator/Src/Update.cpp
@@ -32,7 +32,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
 		bool HaveUpdates = FALSE;
 		for (auto &hContact : Contacts(MODULE)) {
 			if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) {
-				double diff = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+				double diff = difftime(time(0), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
 				if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
 					UpdateListAdd(hContact);
 					HaveUpdates = TRUE;
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp
index 6069a5962e..2cef244540 100644
--- a/plugins/NotifyAnything/src/main.cpp
+++ b/plugins/NotifyAnything/src/main.cpp
@@ -948,7 +948,7 @@ void start_threads()
 {
 	g_exit_threads = false;
 	g_udp_thread = mir_forkthread(udptcpThreadFunc, (void *)1);
-	g_tcp_thread = mir_forkthread(udptcpThreadFunc, nullptr);
+	g_tcp_thread = mir_forkthread(udptcpThreadFunc);
 }
 
 void stop_threads()
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 4770a71d76..25ab897289 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -45,7 +45,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam, LPARAM lParam)
 INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
 {
 	char *protoName = GetContactProto(hContact);
-	int diff = time(nullptr) - db_get_dw(hContact, "Nudge", "LastSent", time(nullptr) - 30);
+	int diff = time(0) - db_get_dw(hContact, "Nudge", "LastSent", time(0) - 30);
 	if (diff < GlobalNudge.sendTimeSec) {
 		wchar_t msg[500];
 		mir_snwprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
@@ -59,7 +59,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
 		return 0;
 	}
 
-	db_set_dw(hContact, "Nudge", "LastSent", time(nullptr));
+	db_set_dw(hContact, "Nudge", "LastSent", time(0));
 
 	if (GlobalNudge.useByProtocol) {
 		for (auto &p : arNudges)
@@ -85,7 +85,7 @@ int NudgeReceived(WPARAM hContact, LPARAM lParam)
 {
 	char *protoName = GetContactProto(hContact);
 
-	DWORD currentTimestamp = time(nullptr);
+	DWORD currentTimestamp = time(0);
 	DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
 
 	int diff = currentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived", currentTimestamp - 30);
@@ -409,7 +409,7 @@ int Preview()
 				if (p->openMessageWindow)
 					CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
 				if (p->shakeChat)
-					ShakeChat(hContact, (LPARAM)time(nullptr));
+					ShakeChat(hContact, (LPARAM)time(0));
 			}
 		}
 	}
@@ -425,7 +425,7 @@ int Preview()
 			if (DefaultNudge.openMessageWindow)
 				CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
 			if (DefaultNudge.shakeChat)
-				ShakeChat(hContact, (LPARAM)time(nullptr));
+				ShakeChat(hContact, (LPARAM)time(0));
 		}
 	}
 	return 0;
@@ -470,7 +470,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
 	DBEVENTINFO dbei = {};
 	dbei.szModule = MODULENAME;
 	dbei.flags = DBEF_SENT | DBEF_UTF;
-	dbei.timestamp = (DWORD)time(nullptr);
+	dbei.timestamp = (DWORD)time(0);
 	dbei.eventType = 1;
 	dbei.cbBlob = (DWORD)mir_strlen(buff) + 1;
 	dbei.pBlob = (PBYTE)buff;
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index ae5706dfaa..9554653ffd 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -374,15 +374,15 @@ void DoCheck(int iFlag)
 			MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
 	}
 	else if (iFlag) {
-		hCheckThread = mir_forkthread(CheckUpdates, nullptr);
-		db_set_dw(NULL, MODNAME, "LastUpdate", time(nullptr));
+		hCheckThread = mir_forkthread(CheckUpdates);
+		db_set_dw(NULL, MODNAME, "LastUpdate", time(0));
 	}
 }
 
 BOOL AllowUpdateOnStartup()
 {
 	if (OnlyOnceADay) {
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
 
 		if ((now - was) < 86400)
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 6839195d4b..d5b3b77d88 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -128,7 +128,7 @@ void PasteIt(MCONTACT hContact, int mode)
 					dbei.eventType = EVENTTYPE_MESSAGE;
 					dbei.flags = DBEF_SENT;
 					dbei.szModule = szProto;
-					dbei.timestamp = (DWORD)time(nullptr);
+					dbei.timestamp = (DWORD)time(0);
 					dbei.cbBlob = (DWORD)mir_strlen(pasteToWeb->szFileLink) + 1;
 					dbei.pBlob = (PBYTE)pasteToWeb->szFileLink;
 					db_event_add(hContact, &dbei);
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index 080f044345..6bac84f199 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -147,7 +147,7 @@ void __cdecl sttCheckStatusThreadProc(void*)
 							i->responding = pa.responding;
 							i->round_trip_time = pa.round_trip_time;
 							history_entry.first = i->round_trip_time;
-							history_entry.second = time(nullptr);
+							history_entry.second = time(0);
 							history_map[i->item_id].push_back(history_entry);
 							// maintain history (-1 represents no response)
 							while (history_map[i->item_id].size() >= MAX_HISTORY)
@@ -227,7 +227,7 @@ void start_ping_thread()
 {
 	if (status_update_thread)
 		CloseHandle(status_update_thread);
-	status_update_thread = mir_forkthread(sttCheckStatusThreadProc, nullptr);
+	status_update_thread = mir_forkthread(sttCheckStatusThreadProc);
 }
 
 void stop_ping_thread()
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 7151781255..0402a1dc9b 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -423,8 +423,7 @@ static void DoGetList()
 		SetForegroundWindow(hwndDialog);
 		SetFocus(hwndDialog);
 	}
-	else
-		hListThread = mir_forkthread(GetList, nullptr);
+	else hListThread = mir_forkthread(GetList);
 }
 
 void UninitListNew()
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index a657c4a1a2..800ee9852c 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -384,9 +384,9 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
 		delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
 		SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
 #if MIRANDA_VER >= 0x0A00
-		db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
+		db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
 #endif
-		mir_forkthread(InitTimer, nullptr);
+		mir_forkthread(InitTimer);
 		break;
 	}
 
@@ -837,9 +837,9 @@ static void DoCheck(bool bSilent = true)
 	else {
 		opts.bSilent = bSilent;
 #if MIRANDA_VER >= 0x0A00
-		db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
+		db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
 #endif
-		hCheckThread = mir_forkthread(CheckUpdates, nullptr);
+		hCheckThread = mir_forkthread(CheckUpdates);
 	}
 }
 
@@ -874,7 +874,7 @@ void CheckUpdateOnStartup()
 {
 	if (opts.bUpdateOnStartup) {
 		if (opts.bOnlyOnceADay) {
-			time_t now = time(nullptr),
+			time_t now = time(0),
 				was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
 
 			if ((now - was) < 86400)
@@ -921,7 +921,7 @@ void InitTimer(void *type)
 	switch ((INT_PTR)type) {
 	case 0: // default, plan next check relative to last check
 		{
-			time_t now = time(nullptr);
+			time_t now = time(0);
 			time_t was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
 
 			interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
@@ -954,5 +954,5 @@ void InitTimer(void *type)
 
 void CreateTimer() {
 	hTimer = CreateWaitableTimer(nullptr, FALSE, nullptr);
-	mir_forkthread(InitTimer, nullptr);
+	mir_forkthread(InitTimer);
 }
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index 163fea25bb..5be7176009 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -82,7 +82,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew)
 		ppd->lpzText = mir_strdup(ppd->lpzText);
 	}
 	ppd->lpzSkin = mir_strdup(ppd->lpzSkin);
-	ppd->dwTimestamp = time(nullptr);
+	ppd->dwTimestamp = time(0);
 	{
 		mir_cslock lck(csPopupHistory);
 		if (arPopupHistory.getCount() >= popupHistoryBuffer) {
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index fada19920f..63dab2976a 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -815,7 +815,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg)
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_SENT | DBEF_UTF;
 	dbei.szModule = GetContactProto(hContact);
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.cbBlob = (int)mir_strlen(msg) + 1;
 	dbei.pBlob = (PBYTE)msg;
 	db_event_add(hContact, &dbei);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index 86f2cedecf..9acd7c06f0 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -547,7 +547,7 @@ bool show_popup(const IQuotesProvider* pProvider,
 
 void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/)
 {
-	time_t nTime = ::time(nullptr);
+	time_t nTime = ::time(0);
 
 	if (false == rsSymbol.empty())
 		db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsSymbol.c_str());
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp
index 55c1a491b5..71f2d052a5 100644
--- a/plugins/SMS/src/receive.cpp
+++ b/plugins/SMS/src/receive.cpp
@@ -65,7 +65,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
 				MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize);
 
 				dbei.szModule = GetModuleName(hContact);
-				dbei.timestamp = time(nullptr);
+				dbei.timestamp = time(0);
 				dbei.flags = DBEF_UTF;
 				dbei.eventType = ICQEVENTTYPE_SMS;
 				dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, ((dwBuffLen + dwPhoneSize)), "SMS From: +%s\r\n%s", szPhone, lpszMessageUTF) + sizeof(DWORD));
@@ -93,7 +93,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
 
 				DBEVENTINFO dbei = {};
 				dbei.szModule = GetModuleName(hContact);
-				dbei.timestamp = time(nullptr);
+				dbei.timestamp = time(0);
 				dbei.flags = DBEF_UTF;
 				dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION;
 				if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) {
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp
index 0970e5c400..f1a9f98653 100644
--- a/plugins/SMS/src/send.cpp
+++ b/plugins/SMS/src/send.cpp
@@ -60,7 +60,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP
 			WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, nullptr, nullptr);
 			dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize);
 
-			pdbei->timestamp = time(nullptr);
+			pdbei->timestamp = time(0);
 			pdbei->flags = (DBEF_SENT | DBEF_UTF);
 			pdbei->eventType = ICQEVENTTYPE_SMS;
 			pdbei->cbBlob = (mir_snprintf(lpszBuff, dwBuffSize, "SMS To: +%s\r\n%s", szPhone, lpszMessageUTF) + 4);
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index f53118c989..5021e20fb0 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -375,11 +375,10 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit*)
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
-static void __cdecl phase2(void *lParam)
+static void __cdecl phase2(SESSION_INFO *si)
 {
 	Thread_SetName("Scriver: phase2");
 
-	SESSION_INFO *si = (SESSION_INFO*)lParam;
 	Sleep(30);
 	if (si && si->pDlg)
 		si->pDlg->RedrawLog2();
@@ -401,7 +400,7 @@ void CChatRoomDlg::RedrawLog()
 					index++;
 			}
 			StreamInEvents(pLog, true);
-			mir_forkthread(phase2, m_si);
+			mir_forkThread<SESSION_INFO>(phase2, m_si);
 		}
 		else StreamInEvents(m_si->pLogEnd, true);
 	}
@@ -677,8 +676,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
 				return 0;
 			}
 			if (db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
-				if (m_iLastEnterTime + 2 < time(nullptr))
-					m_iLastEnterTime = time(nullptr);
+				if (m_iLastEnterTime + 2 < time(0))
+					m_iLastEnterTime = time(0);
 				else {
 					m_message.SendMsg(WM_KEYDOWN, VK_BACK, 0);
 					m_message.SendMsg(WM_KEYUP, VK_BACK, 0);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 9d5f880dc3..058f0d5286 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -142,7 +142,7 @@ static int ackevent(WPARAM, LPARAM lParam)
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_UTF | DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0);
 	dbei.szModule = GetContactProto(hContact);
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1;
 	dbei.pBlob = (PBYTE)item->sendBuffer;
 
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 0ea68c5da6..f40d639084 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -195,8 +195,8 @@ void CSrmmWindow::OnInitDialog()
 	SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr);
 
 	m_lastEventType = -1;
-	m_lastEventTime = time(nullptr);
-	m_startTime = time(nullptr);
+	m_lastEventTime = time(0);
+	m_startTime = time(0);
 
 	m_bUseRtl = db_get_b(m_hContact, SRMM_MODULE, "UseRTL", 0) != 0;
 	m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
@@ -322,7 +322,7 @@ void CSrmmWindow::OnInitDialog()
 
 		case LOADHISTORY_TIME:
 			if (m_hDbEventFirst == 0) {
-				dbei.timestamp = time(nullptr);
+				dbei.timestamp = time(0);
 				hPrevEvent = db_event_last(m_hContact);
 			}
 			else {
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 74c7d1330c..f388f9eae8 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -169,7 +169,7 @@ static EventData* GetTestEvent(DWORD flags)
 	evt->eventType = EVENTTYPE_MESSAGE;
 	evt->dwFlags = IEEDF_READ | flags;
 	evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-	evt->time = time(nullptr);
+	evt->time = time(0);
 	return evt;
 }
 
@@ -333,7 +333,7 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode)
 	format[0] = '\0';
 	if ((mode == 0 || mode == 1) && (dwFlags & SMF_SHOWDATE)) {
 		struct tm tm_now, tm_today;
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		time_t today;
 		tm_now = *localtime(&now);
 		tm_today = tm_now;
diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp
index 495bc324e2..a072dd108c 100644
--- a/plugins/SecureIM/src/dbevent.cpp
+++ b/plugins/SecureIM/src/dbevent.cpp
@@ -5,7 +5,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText)
 	DBEVENTINFO dbei = {};
 	dbei.szModule = GetContactProto(hContact);
 	dbei.flags = DBEF_SENT | DBEF_READ;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.cbBlob = (int)mir_strlen(szText) + 1;
 	dbei.pBlob = (PBYTE)szText;
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 4cfa2d69b2..fd9dbd2f17 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -105,7 +105,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
 	}
 
 	if (!rsa_4096)
-		mir_forkthread(sttGenerateRSA, nullptr);
+		mir_forkthread(sttGenerateRSA);
 
 	mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
 
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp
index cc763dbb25..d2405a10d0 100644
--- a/plugins/SecureIM/src/svcs_proto.cpp
+++ b/plugins/SecureIM/src/svcs_proto.cpp
@@ -18,10 +18,8 @@ int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = nullptr)
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
-static void sttFakeAck(LPVOID param)
+static void sttFakeAck(TFakeAckParams *tParam)
 {
-	TFakeAckParams *tParam = (TFakeAckParams*)param;
-
 	Sleep(100);
 	if (tParam->msg == nullptr)
 		SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0);
@@ -33,13 +31,13 @@ static void sttFakeAck(LPVOID param)
 
 int returnNoError(MCONTACT hContact)
 {
-	mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
+	mir_forkThread<TFakeAckParams>(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
 	return 777;
 }
 
 int returnError(MCONTACT hContact, LPCSTR err)
 {
-	mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 666, err));
+	mir_forkThread<TFakeAckParams>(sttFakeAck, new TFakeAckParams(hContact, 666, err));
 	return 666;
 }
 
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 4d0a7a7eb5..efce4f5e25 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -514,12 +514,10 @@ void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus)
 }
 
 // will add hContact to queue and will return position;
-static void waitThread(void *param)
+static void waitThread(logthread_info* infoParam)
 {
 	Thread_SetName("SeenPlugin: waitThread");
 
-	logthread_info* infoParam = (logthread_info*)param;
-
 	WORD prevStatus = db_get_w(infoParam->hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE);
 
 	// I hope in 1.5 second all the needed info will be set
@@ -586,7 +584,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
 				mir_snprintf(str, "OffTime-%s", szProto);
 				DWORD t = db_get_dw(NULL, S_MOD, str, 0);
 				if (!t)
-					t = time(nullptr);
+					t = time(0);
 				DBWriteTimeTS(t, hContact);
 			}
 
@@ -613,7 +611,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
 			if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
 				return 0;
 
-			DBWriteTimeTS(time(nullptr), hContact);
+			DBWriteTimeTS(time(0), hContact);
 
 			if (g_bFileActive) FileWrite(hContact);
 			if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
@@ -636,7 +634,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
 				p->hContact = hContact;
 				mir_strncpy(p->sProtoName, cws->szModule, _countof(p->sProtoName));
 				arContacts.insert(p);
-				mir_forkthread(waitThread, p);
+				mir_forkThread<logthread_info>(waitThread, p);
 			}
 			p->currStatus = isIdleEvent ? db_get_w(hContact, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
 		}
@@ -645,11 +643,10 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
 	return 0;
 }
 
-static void cleanThread(void *param)
+static void cleanThread(logthread_info* infoParam)
 {
 	Thread_SetName("SeenPlugin: cleanThread");
 
-	logthread_info* infoParam = (logthread_info*)param;
 	char *szProto = infoParam->sProtoName;
 
 	// I hope in 10 secons all logged-in contacts will be listed
@@ -681,7 +678,7 @@ int ModeChange(WPARAM, LPARAM lparam)
 	if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName, "MetaContacts", 12))
 		return 0;
 
-	DBWriteTimeTS(time(nullptr), NULL);
+	DBWriteTimeTS(time(0), NULL);
 
 	WORD isetting = (WORD)ack->lParam;
 	if (isetting < ID_STATUS_OFFLINE)
@@ -695,7 +692,7 @@ int ModeChange(WPARAM, LPARAM lparam)
 			info->hContact = 0;
 			info->currStatus = 0;
 
-			mir_forkthread(cleanThread, info);
+			mir_forkThread<logthread_info>(cleanThread, info);
 		}
 	}
 	else if ((isetting == ID_STATUS_OFFLINE) && ((UINT_PTR)ack->hProcess > ID_STATUS_OFFLINE)) {
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index be37a59bf9..f985aec6f4 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -378,7 +378,7 @@ void CSend::DB_EventAdd(WORD EventType)
 	dbei.szModule = m_pszProto;
 	dbei.eventType = EventType;
 	dbei.flags = DBEF_SENT;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.flags |= DBEF_UTF;
 	dbei.cbBlob = m_cbEventMsg;
 	dbei.pBlob = (PBYTE)m_szEventMsg;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp
index 9307ddf530..608b35fd86 100644
--- a/plugins/ShellExt/src/shlcom.cpp
+++ b/plugins/ShellExt/src/shlcom.cpp
@@ -128,9 +128,8 @@ void NTAPI MainThreadIssueTransfer(ULONG_PTR param)
 	SetEvent(p->hEvent);
 }
 
-void __cdecl IssueTransferThread(void *param)
+void __cdecl IssueTransferThread(THeaderIPC *pipch)
 {
-	THeaderIPC *pipch = (THeaderIPC *)param;
 	HANDLE hMainThread = HANDLE(pipch->Param);
 
 	char szBuf[MAX_PATH];
@@ -377,12 +376,12 @@ void __stdcall ipcService(ULONG_PTR)
 			memcpy(cloned, pMMT, IPC_PACKET_SIZE);
 			ipcFixupAddresses(cloned);
 			DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &cloned->Param, THREAD_SET_CONTEXT, false, 0);
-			mir_forkthread(&IssueTransferThread, cloned);
+			mir_forkThread<THeaderIPC>(&IssueTransferThread, cloned);
 			goto Reply;
 		}
 		// the request was to clear the MRU entries, we have no return data
 		if (*bits & REQUEST_CLEARMRU) {
-			mir_forkthread(&ClearMRUThread, nullptr);
+			mir_forkthread(&ClearMRUThread);
 			goto Reply;
 		}
 		// the IPC header may have pointers that need to be translated
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index 8375b1e5df..5a73931214 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -175,7 +175,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
 			return FALSE;
 
 		if (!(dbei.flags & DBEF_SENT)) {
-			int timeBetween = time(nullptr) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
+			int timeBetween = time(0) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
 			if (timeBetween > interval || db_get_w(hContact, protocolname, "LastStatus", 0) != status) {
 				size_t msgLen = 1;
 				int isQun = db_get_b(hContact, pszProto, "IsQun", 0);
@@ -218,7 +218,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
 						dbei.eventType = EVENTTYPE_MESSAGE;
 						dbei.flags = DBEF_UTF | DBEF_SENT;
 						dbei.szModule = pszProto;
-						dbei.timestamp = time(nullptr);
+						dbei.timestamp = time(0);
 						dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
 						dbei.pBlob = (PBYTE)pszUtf;
 						db_event_add(hContact, &dbei);
@@ -231,7 +231,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
 			}
 		}
 
-		db_set_dw(hContact, protocolname, "LastReplyTS", time(nullptr));
+		db_set_dw(hContact, protocolname, "LastReplyTS", time(0));
 		db_set_w(hContact, protocolname, "LastStatus", status);
 	}
 	return 0;
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
index 819896be8f..5bd5d69fa5 100644
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ b/plugins/SkypeStatusChange/src/main.cpp
@@ -298,7 +298,7 @@ extern "C" int __declspec(dllexport) Load()
 	g_bMirandaIsShutdown = false;
 	g_hEventShutdown = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
 
-	g_hThread = mir_forkthread(ThreadFunc, nullptr);
+	g_hThread = mir_forkthread(ThreadFunc);
 
 	HookEvent(ME_PROTO_ACK, SSC_OnProtocolAck);
 	HookEvent(ME_SYSTEM_PRESHUTDOWN, SSC_OnPreShutdown);
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 61964955f1..884b323837 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -188,7 +188,7 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam)
 	stwp->direction = 0;
 	stwp->xPosition = pcbc->pt.x;
 	stwp->yPosition = pcbc->pt.y;
-	mir_forkthread(SmileyToolThread, stwp);
+	mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
 	return 0;
 }
 
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index 306b980276..328bae9afd 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -191,7 +191,7 @@ bool GetSmileyFile(CMStringW &url, const CMStringW &packstr)
 
 	if (!threadRunning) {
 		threadRunning = true;
-		mir_forkthread(SmileyDownloadThread, nullptr);
+		mir_forkthread(SmileyDownloadThread);
 	}
 
 	url = filename;
diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp
index cbf5c69a39..87e0426512 100644
--- a/plugins/SmileyAdd/src/imagecache.cpp
+++ b/plugins/SmileyAdd/src/imagecache.cpp
@@ -29,7 +29,7 @@ static UINT_PTR timerId;
 static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
 {
 	WaitForSingleObject(g_hMutexIm, 3000);
-	const time_t ts = time(nullptr) - 10;
+	const time_t ts = time(0) - 10;
 	if (lastmodule && ts > laststamp) {
 		FreeLibrary(lastmodule);
 		lastmodule = nullptr;
@@ -69,7 +69,7 @@ static HMODULE LoadDll(const CMStringW &file)
 		lastmodule = LoadLibraryEx(file.c_str(), nullptr, LOAD_LIBRARY_AS_DATAFILE);
 
 	}
-	laststamp = time(nullptr);
+	laststamp = time(0);
 
 	ReleaseMutex(g_hMutexIm);
 	return lastmodule;
@@ -98,7 +98,7 @@ long ImageBase::Release(void)
 
 	long cnt = m_lRefCount;
 	if (cnt) m_lRefCount = --cnt;
-	if (cnt == 0) m_timestamp = time(nullptr);
+	if (cnt == 0) m_timestamp = time(0);
 
 	ReleaseMutex(g_hMutexIm);
 	return cnt;
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index 3f1551fd42..897982ade5 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -538,7 +538,7 @@ void OptionsDialogType::ShowSmileyPreview(void)
 	stwp->direction = 1;
 	stwp->hContact = NULL;
 
-	mir_forkthread(SmileyToolThread, stwp);
+	mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
 }
 
 void OptionsType::Save(void)
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp
index adc15d008e..0bb2349dc5 100644
--- a/plugins/SmileyAdd/src/services.cpp
+++ b/plugins/SmileyAdd/src/services.cpp
@@ -125,7 +125,7 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam)
 	stwp->yPosition = smaddInfo->yPosition;
 	stwp->direction = smaddInfo->Direction;
 
-	mir_forkthread(SmileyToolThread, stwp);
+	mir_forkThread<SmileyToolWindowParam>(SmileyToolThread, stwp);
 
 	return TRUE;
 }
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp
index 84c0e687ea..d264e314e4 100644
--- a/plugins/SmileyAdd/src/smltool.cpp
+++ b/plugins/SmileyAdd/src/smltool.cpp
@@ -737,11 +737,10 @@ int SmileyToolWindowType::CalculateCoordinatesToButton(POINT pt, int scroll)
 	return pos;
 }
 
-void __cdecl SmileyToolThread(void *arg)
+void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp)
 {
 	Thread_SetName("SmileyAdd: SmileyToolThread");
 
-	SmileyToolWindowParam *stwp = (SmileyToolWindowParam*)arg;
 	if (stwp->pSmileyPack && stwp->pSmileyPack->VisibleSmileyCount()) {
 		WNDCLASSEX wndclass;
 		wndclass.cbSize = sizeof(wndclass);
@@ -761,7 +760,7 @@ void __cdecl SmileyToolThread(void *arg)
 		CreateWindowEx(WS_EX_TOPMOST | WS_EX_NOPARENTNOTIFY, L"SmileyTool", nullptr,
 			WS_BORDER | WS_POPUP | WS_VISIBLE,
 			CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-			((SmileyToolWindowParam*)arg)->hWndParent, nullptr, g_hInst, arg);
+			stwp->hWndParent, nullptr, g_hInst, stwp);
 
 		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
 
diff --git a/plugins/SmileyAdd/src/smltool.h b/plugins/SmileyAdd/src/smltool.h
index 41072787a0..26221543dd 100644
--- a/plugins/SmileyAdd/src/smltool.h
+++ b/plugins/SmileyAdd/src/smltool.h
@@ -35,8 +35,7 @@ struct SmileyToolWindowParam
 	MCONTACT hContact;
 };
 
-
-void __cdecl SmileyToolThread(void *arg);
+void __cdecl SmileyToolThread(SmileyToolWindowParam *stwp);
 
 #ifndef min
 #define min(A, B) ((A) < (B) ? (A) : (B)) 
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index dc4d23e635..c4fde0f693 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -276,7 +276,7 @@ void bayes_approve_contact(MCONTACT hContact)
 
 void dequeue_messages()
 {
-	time_t t = time(nullptr);
+	time_t t = time(0);
 	sqlite3_stmt *stmt;
 	const char *message;
 	wchar_t *messageW;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 0a628931f2..f23b7861e9 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -57,9 +57,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
 	/*** Dequeue and learn messages ***/
 	
 	if (bayesEnabled && _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
-		if (time(nullptr) - last_queue_check > 4*3600) { // dequeue every 4 hours
+		if (time(0) - last_queue_check > 4*3600) { // dequeue every 4 hours
 			dequeue_messages();
-			last_queue_check = time(nullptr);
+			last_queue_check = time(0);
 		}
 
 	/*** Check for conditional and unconditional approval ***/
@@ -375,7 +375,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
 		else
 			_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
 		_getOptS(buf, buflen, "Response", defaultResponse);
-		srand(time(nullptr));
+		srand(time(0));
 		_setCOptD(hContact, "ResponseNum", rand() % get_response_num(buf));
 		ReplaceVarsNum(challengeW, maxmsglen, _getCOptD(hContact, "ResponseNum", 0));
 		ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
@@ -507,14 +507,14 @@ extern "C" __declspec(dllexport) int Load()
 {
 	mir_getLP(&pluginInfo);
 
-	srand((unsigned)time(nullptr));
+	srand((unsigned)time(0));
 	bayesdb = nullptr;
 	if (_getOptB("BayesEnabled", defaultBayesEnabled)) {
 		if (CheckBayes()) {
 			OpenBayes();
 			if (_getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved)) {
 				dequeue_messages();
-				last_queue_check = time(nullptr);
+				last_queue_check = time(0);
 			}
 		}
 	}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index b143b9d756..e6d9106950 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -166,7 +166,7 @@ void SplashMain()
 					} //if
 				} while (FindNextFile(hFind, &ffd));
 
-				srand((unsigned)time(nullptr));
+				srand((unsigned)time(0));
 				int r = 0;
 				if (filescount) r = (rand() % filescount) + 1;
 
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp
index 4c525f867d..5bb39c8103 100644
--- a/plugins/StartupSilence/src/main.cpp
+++ b/plugins/StartupSilence/src/main.cpp
@@ -86,11 +86,49 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
 	return &pluginInfo;
 }
 
+static void __cdecl AdvSt(void*)
+{
+	Thread_SetName("StartupSilenc: AdvSt");
+
+	if ((Enabled == 1)) {
+		POPUPDATAT ppd = { 0 };
+		wchar_t *lptzText = L"";
+		db_set_b(NULL, "Skin", "UseSound", 0);
+		EnablePopupModule();
+
+		if (PopUp == 1) {
+			lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
+			ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+			ppd.lchContact = NULL;
+			ppd.iSeconds = PopUpTime;
+			wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
+			lptzText = TranslateW(MENU_NAMEW);
+			wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE);
+			PUAddPopupT(&ppd);
+		}
+
+		timer = 2;
+		Sleep(delay * 1000);
+		timer = 0;
+
+		if (PopUp == 1) {
+			lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED;
+			ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+			wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
+			PUAddPopupT(&ppd);
+		}
+		if (DefEnabled == 1) { //predefined sound setting
+			db_set_b(NULL, "Skin", "UseSound", DefSound);
+		}
+		else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts
+	}
+}
+
 INT_PTR StartupSilence()
 {
 	InitSettings();
 	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
-	mir_forkthread((pThreadFunc)AdvSt, nullptr);
+	mir_forkthread((pThreadFunc)AdvSt);
 	CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled);
 	CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
 	IsMenu();
@@ -220,45 +258,6 @@ void IsMenu()
 	}
 }
 
-static INT_PTR AdvSt()
-{
-	Thread_SetName("StartupSilenc: AdvSt");
-
-	if ((Enabled == 1)) {
-		POPUPDATAT ppd = {0};
-		wchar_t * lptzText =L"";
-		db_set_b(NULL, "Skin", "UseSound", 0);
-		EnablePopupModule();
-
-		if (PopUp == 1) {
-			lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
-			ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
-			ppd.lchContact = NULL;
-			ppd.iSeconds = PopUpTime;
-			wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
-			lptzText = TranslateW(MENU_NAMEW);
-			wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE);
-			PUAddPopupT(&ppd);
-		}
-
-		timer = 2;
-		Sleep(delay * 1000);
-		timer = 0;
-
-		if (PopUp == 1) {
-			lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED;
-			ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
-			wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE);
-			PUAddPopupT(&ppd);
-		}
-		if (DefEnabled == 1) { //predefined sound setting
-			db_set_b(NULL, "Skin", "UseSound", DefSound);
-		}
-		else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts
-	}
-	return 0;
-}
-
 INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
 {
 	db_set_b(NULL, MODULE_NAME, EnabledComp, !Enabled);
diff --git a/plugins/StartupSilence/src/stdafx.h b/plugins/StartupSilence/src/stdafx.h
index c6d9df5352..0a6e0c0be4 100644
--- a/plugins/StartupSilence/src/stdafx.h
+++ b/plugins/StartupSilence/src/stdafx.h
@@ -22,7 +22,6 @@
 #include "version.h"
 #include "resource.h"
 
-static INT_PTR AdvSt();
 static INT_PTR InitMenu();
 void InitSettings();
 void LoadSettings();
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 1b13ad2dfc..cd24606687 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -758,7 +758,7 @@ static void CheckContinuouslyFunction(void *)
 static VOID CALLBACK CheckContinueslyTimer(HWND, UINT, UINT_PTR, DWORD)
 {
 	if (db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE))
-		mir_forkthread(CheckContinuouslyFunction, nullptr);
+		mir_forkthread(CheckContinuouslyFunction);
 	else
 		CheckContinuouslyFunction(nullptr);
 }
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index 1328b68d78..5cd1e160a6 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -324,7 +324,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags)
 	Event.szModule = pluginName;
 	Event.eventType = event_type;
 	Event.flags = flags | DBEF_UTF;
-	Event.timestamp = (DWORD)time(nullptr);
+	Event.timestamp = (DWORD)time(0);
 	Event.cbBlob = (DWORD)mir_strlen(data) + 1;
 	Event.pBlob = (PBYTE)_strdup(data);
 	db_event_add(hContact, &Event);
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index 0f03ecf541..16bce15921 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -44,7 +44,7 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
 		si->pDlg->UpdateStatusBar();
 
 	if (mi)
-		mi->idleTimeStamp = time(nullptr);
+		mi->idleTimeStamp = time(0);
 }
 
 static void OnReplaceSession(SESSION_INFO *si)
@@ -77,7 +77,7 @@ static void OnChangeNick(SESSION_INFO *si)
 
 static void OnCreateModule(MODULEINFO *mi)
 {
-	mi->idleTimeStamp = time(nullptr);
+	mi->idleTimeStamp = time(0);
 }
 
 static void OnLoadSettings()
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index c7c020de8c..5c3799ae88 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -455,11 +455,10 @@ LBL_SkipEnd:
 	return false;
 }
 
-static void __cdecl phase2(void * lParam)
+static void __cdecl phase2(SESSION_INFO *si)
 {
 	Thread_SetName("TabSRMM: phase2");
 
-	SESSION_INFO *si = (SESSION_INFO*)lParam;
 	Sleep(30);
 	if (si && si->pDlg)
 		si->pDlg->RedrawLog2();
@@ -660,7 +659,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
 	if (ptszText[0] == '/' || m_si->iType == GCW_SERVER)
 		fSound = false;
 	Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
-	mi->idleTimeStamp = time(nullptr);
+	mi->idleTimeStamp = time(0);
 	mi->lastIdleCheck = 0;
 	UpdateStatusBar();
 	if (m_pContainer)
@@ -810,7 +809,7 @@ void CChatRoomDlg::RedrawLog()
 					index++;
 			}
 			StreamInEvents(pLog, TRUE);
-			mir_forkthread(phase2, m_si);
+			mir_forkThread<SESSION_INFO>(phase2, m_si);
 		}
 		else StreamInEvents(m_si->pLogEnd, TRUE);
 	}
@@ -894,7 +893,7 @@ void CChatRoomDlg::UpdateStatusBar()
 
 	wchar_t szFinalStatusBarText[512];
 	if (m_pPanel.isActive()) {
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		DWORD diff = (now - mi->idleTimeStamp) / 60;
 
 		if ((diff >= 1 && diff != mi->lastIdleCheck)) {
@@ -1270,8 +1269,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
 				break;
 
 			if (PluginConfig.m_bSendOnDblEnter) {
-				if (m_iLastEnterTime + 2 < time(nullptr)) {
-					m_iLastEnterTime = time(nullptr);
+				if (m_iLastEnterTime + 2 < time(0)) {
+					m_iLastEnterTime = time(0);
 					break;
 				}
 
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 92ae6c0c39..ce3e1c94b7 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -180,7 +180,7 @@ void CContactCache::updateStats(int iType, size_t value)
 		m_stats->lastReceivedChars = 0;
 		break;
 	case TSessionStats::INIT_TIMER:
-		m_stats->started = time(nullptr);
+		m_stats->started = time(0);
 		break;
 	case TSessionStats::SET_LAST_RCV:
 		m_stats->lastReceivedChars = (unsigned int)value;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 6935c5f924..6ff956a773 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -573,7 +573,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
 	dbei.cbBlob = (int)mir_strlen(szMsg) + 1;
 	dbei.flags = DBEF_UTF | DBEF_READ;
 	dbei.eventType = EVENTTYPE_STATUSCHANGE;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.szModule = (char*)c->getProto();
 	dat->StreamInEvents(0, 1, 1, &dbei);
 }
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 69300b36ad..94428ebea9 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -533,8 +533,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
 				SendMessage(pCont->m_hwnd, WM_TIMER, TIMERID_HEARTBEAT, 0);
 
 			// process send later contacts and jobs, if enough time has elapsed
-			if (sendLater->isAvail() && !sendLater->isInteractive() && (time(nullptr) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
-				sendLater->setLastProcessed(time(nullptr));
+			if (sendLater->isAvail() && !sendLater->isInteractive() && (time(0) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
+				sendLater->setLastProcessed(time(0));
 
 				// check the list of contacts that may have new send later jobs
 				// (added on user's request)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index dd938a0d8c..73de2f3dad 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -486,7 +486,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
 		wchar_t szBuf[256];
 
 		if (m_dat->m_idle) {
-			time_t diff = time(nullptr) - m_dat->m_idle;
+			time_t diff = time(0) - m_dat->m_idle;
 			int i_hrs = diff / 3600;
 			int i_mins = (diff - i_hrs * 3600) / 60;
 			mir_snwprintf(szBuf, TranslateT("%s    Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 4131d2a048..41a908d09c 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2028,8 +2028,8 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
 					break;
 
 				if (PluginConfig.m_bSendOnDblEnter) {
-					if (m_iLastEnterTime + 2 < time(nullptr)) {
-						m_iLastEnterTime = time(nullptr);
+					if (m_iLastEnterTime + 2 < time(0)) {
+						m_iLastEnterTime = time(0);
 						break;
 					}
 					else {
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 5e792de93a..4ef01fa859 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -130,7 +130,7 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP
 static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic)
 {
 	wchar_t szFinalFilename[MAX_PATH];
-	time_t t = time(nullptr);
+	time_t t = time(0);
 	struct tm *lt = localtime(&t);
 	DWORD setView = 1;
 
@@ -1154,7 +1154,7 @@ void CTabBaseDlg::FindFirstEvent()
 	case LOADHISTORY_TIME:
 		DBEVENTINFO dbei = {};
 		if (m_hDbEventFirst == 0)
-			dbei.timestamp = time(nullptr);
+			dbei.timestamp = time(0);
 		else
 			db_event_get(m_hDbEventFirst, &dbei);
 
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index af0aee1ff3..c4c0ac3a40 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1184,7 +1184,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D
 	HWND hwndrtf = m_hwndIEView ? m_hwndIWebBrowserControl : m_log.GetHwnd();
 
 	rtfFonts = m_pContainer->theme.rtfFonts ? m_pContainer->theme.rtfFonts : &(rtfFontsGlobal[0][0]);
-	time_t now = time(nullptr);
+	time_t now = time(0);
 
 	struct tm tm_now = *localtime(&now);
 	struct tm tm_today = tm_now;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index bd7b744e35..be918c6e92 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -161,7 +161,7 @@ CSendLater::CSendLater() :
 	m_hFilter(0)
 {
 	m_fAvail = M.GetByte("sendLaterAvail", 0) != 0;
-	m_last_sendlater_processed = time(nullptr);
+	m_last_sendlater_processed = time(0);
 	m_fIsInteractive = false;
 	m_fErrorPopups = M.GetByte("qmgrErrorPopups", 0) != 0;
 	m_fSuccessPopups = M.GetByte("qmgrSuccessPopups", 0) != 0;
@@ -344,7 +344,7 @@ int CSendLater::addJob(const char *szSetting, void *lParam)
 // this is ONLY called from the WM_TIMER handler and should never be executed directly.
 int CSendLater::sendIt(CSendLaterJob *job)
 {
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	if (job->bCode == CSendLaterJob::JOB_HOLD || job->bCode == CSendLaterJob::JOB_DEFERRED || job->fSuccess || job->fFailed || job->lastSent > now)
 		return 0;											// this one is frozen or done (will be removed soon), don't process it now.
 
@@ -440,7 +440,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
 				dbei.eventType = EVENTTYPE_MESSAGE;
 				dbei.flags = DBEF_SENT | DBEF_UTF;
 				dbei.szModule = GetContactProto((p->hContact));
-				dbei.timestamp = time(nullptr);
+				dbei.timestamp = time(0);
 				dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1;
 				dbei.pBlob = (PBYTE)(p->sendBuffer);
 				db_event_add(p->hContact, &dbei);
@@ -802,7 +802,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
 							else if (job->bCode == CSendLaterJob::JOB_AGE) {
 								job->fFailed = false;
 								job->bCode = '-';
-								job->created = time(nullptr);
+								job->created = time(0);
 							}
 							break;
 						}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 5b2fbd4979..a053cf5659 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -79,7 +79,7 @@ int SendQueue::addTo(CTabBaseDlg *dat, size_t iLen, int dwFlags)
 			// this entry is used, check if it's orphaned and can be removed...
 			if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it
 				continue;
-			if (time(nullptr) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
+			if (time(0) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
 				continue;
 			clearJob(i);
 			iFound = i;
@@ -99,7 +99,7 @@ entry_found:
 	memcpy(job.szSendBuffer, dat->m_sendBuffer, iLen);
 
 	job.dwFlags = dwFlags;
-	job.dwTime = time(nullptr);
+	job.dwTime = time(0);
 
 	HWND	hwndDlg = dat->GetHwnd();
 
@@ -359,7 +359,7 @@ void SendQueue::logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szE
 
 	dbei.flags = DBEF_SENT | DBEF_UTF;
 	dbei.cbBlob = (int)iMsgLen;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.szModule = (char *)szErrMsg;
 	dat->StreamInEvents(0, 1, 1, &dbei);
 }
@@ -462,7 +462,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam)
 	dbei.eventType = EVENTTYPE_MESSAGE;
 	dbei.flags = DBEF_SENT | DBEF_UTF;
 	dbei.szModule = GetContactProto(job.hContact);
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1;
 
 	if (dat)
@@ -552,7 +552,7 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b
 		dbei.eventType = EVENTTYPE_MESSAGE;
 		dbei.flags = DBEF_SENT | DBEF_UTF;
 		dbei.szModule = GetContactProto(dat->m_hContact);
-		dbei.timestamp = time(nullptr);
+		dbei.timestamp = time(0);
 		dbei.cbBlob = (int)mir_strlen(utfText) + 1;
 		dbei.pBlob = (PBYTE)(char*)utfText;
 		dat->StreamInEvents(0, 1, 1, &dbei);
@@ -578,13 +578,13 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b
 	wchar_t tszHeader[150];
 
 	if (fIsSendLater) {
-		time_t now = time(nullptr);
+		time_t now = time(0);
 		wchar_t tszTimestamp[30];
 		wcsftime(tszTimestamp, _countof(tszTimestamp), L"%Y.%m.%d - %H:%M", _localtime32((__time32_t *)&now));
 		mir_snprintf(szKeyName, "S%d", now);
 		mir_snwprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
 	}
-	else mir_snwprintf(tszHeader, L"M%d|", time(nullptr));
+	else mir_snwprintf(tszHeader, L"M%d|", time(0));
 
 	T2Utf utf_header(tszHeader);
 	size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index b24b4412e5..0c2db1ff55 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -241,7 +241,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*)
 
 	DBEVENTINFO dbei = {};
 	dbei.szModule = m_szProto;
-	dbei.timestamp = time(nullptr);
+	dbei.timestamp = time(0);
 	dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
 	dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
 	if (dbei.eventType == EVENTTYPE_ERRMSG)
@@ -250,7 +250,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*)
 	dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob) + 1;
 	dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
 	dbei.flags |= (rtl ? DBEF_RTL : 0);
-	m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(nullptr) - 1 : 0;
+	m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(0) - 1 : 0;
 	m_iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
 	m_log.SetText(L"");
 	m_dwFlags = MWF_LOG_ALL;
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index b649dfc931..8cd57b7863 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -94,7 +94,7 @@ void TSAPI CreateTrayMenus(int mode)
 		mir_snwprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId());
 		g_hEvent = CreateEvent(nullptr, FALSE, FALSE, g_eventName);
 		isAnimThreadRunning = TRUE;
-		hTrayAnimThread = mir_forkthread(TrayAnimThread, nullptr);
+		hTrayAnimThread = mir_forkthread(TrayAnimThread);
 
 		PluginConfig.g_hMenuTrayUnread = CreatePopupMenu();
 		PluginConfig.g_hMenuFavorites = CreatePopupMenu();
@@ -228,7 +228,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c
 					}
 				}
 			addnew:
-				db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(nullptr));
+				db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(0));
 				AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry);
 			}
 			else if (hMenu == PluginConfig.g_hMenuFavorites) {            // insert the item sorted...
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index cd69f7bf38..c2be17ac88 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -338,7 +338,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int
 	else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_reltime")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_reltime")) {
 		DWORD ts = LastMessageTimestamp(hContact, recv);
 		if (ts == 0) return false;
-		DWORD t = (DWORD)time(nullptr);
+		DWORD t = (DWORD)time(0);
 		DWORD diff = (t - ts);
 		int d = (diff / 60 / 60 / 24);
 		int h = (diff - d * 60 * 60 * 24) / 60 / 60;
@@ -366,7 +366,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int
 			if (i > 0)
 				hTmpContact = db_mc_getSub(hContact, i);
 			dwRecountTs = db_get_dw(hTmpContact, MODULE, "LastCountTS", 0);
-			dwTime = (DWORD)time(nullptr);
+			dwTime = (DWORD)time(0);
 			dwDiff = (dwTime - dwRecountTs);
 			if (dwDiff > (60 * 60 * 24 * 3)) {
 				db_set_dw(hTmpContact, MODULE, "LastCountTS", dwTime);
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp
index 5a8d31192f..a28b8a7798 100644
--- a/plugins/TipperYM/src/tipper.cpp
+++ b/plugins/TipperYM/src/tipper.cpp
@@ -266,7 +266,7 @@ int ModulesLoaded(WPARAM, LPARAM)
 	CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
 
 	// set Miranda start timestamp
-	db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(nullptr));
+	db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0));
 	return 0;
 }
 
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp
index bff2e51d8b..8a487fd6a2 100644
--- a/plugins/TipperYM/src/translations.cpp
+++ b/plugins/TipperYM/src/translations.cpp
@@ -105,7 +105,7 @@ wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, cons
 wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
 {
 	DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
-	DWORD t = (DWORD)time(nullptr);
+	DWORD t = (DWORD)time(0);
 	if (ts == 0) return nullptr;
 
 	DWORD diff = (ts > t) ? 0 : (t - ts);
@@ -481,7 +481,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam
 			if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
 				if (GetInt(dbv, &month)) {
 					db_free(&dbv);
-					time_t now = time(nullptr);
+					time_t now = time(0);
 					struct tm *ti = localtime(&now);
 					int yday_now = ti->tm_yday;
 
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp
index f74a5c1795..9b49a2c261 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.cpp
+++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp
@@ -38,7 +38,7 @@ CContactQueue::CContactQueue(int initialSize) :
 	_hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
 	_status = RUNNING;
 
-	mir_forkthread((pThreadFunc)CContactQueue::ThreadProc, this);
+	mir_forkThread<CContactQueue>(CContactQueue::ThreadProc, this);
 }
 
 CContactQueue::~CContactQueue()
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.h b/plugins/UserInfoEx/src/mir_contactqueue.h
index ce1e388f80..f40553ede6 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.h
+++ b/plugins/UserInfoEx/src/mir_contactqueue.h
@@ -138,7 +138,7 @@ protected:
 	
 	// This is a static method to redirect the thread's callback function
 	// to the desired class object.
-	static void ThreadProc(CContactQueue* obj)
+	static void __cdecl ThreadProc(CContactQueue* obj)
 	{
 		obj->Thread();
 	}
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index e81a75d802..d60c02cebf 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -617,7 +617,7 @@ static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
 	ai->flags |= AIF_DONTPARSE;
 
 	wchar_t ret[128];
-	return mir_wstrdup(TimeZone_ToStringT(time(nullptr), L"d s", ret, _countof(ret)));
+	return mir_wstrdup(TimeZone_ToStringT(time(0), L"d s", ret, _countof(ret)));
 }
 
 static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index e37684b920..913bc19f84 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -43,7 +43,7 @@ void ReStart(void*)
 	if(ghConnection)
 		Netlib_CloseHandle(ghConnection);
 	Sleep(500);
-	mir_forkthread(&Start, nullptr);
+	mir_forkthread(&Start);
 }
 
 int Parser()
@@ -56,7 +56,7 @@ int Parser()
 	nlpr.dwTimeout = 5;
 	if(!ghConnection)
 	{
-		mir_forkthread(&Start, nullptr);
+		mir_forkthread(&Start);
 	}
 	if(ghConnection)
 	{	
@@ -68,7 +68,7 @@ int Parser()
 			recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
 			if(recvResult == SOCKET_ERROR)
 			{
-				mir_forkthread(&ReStart, nullptr);
+				mir_forkthread(&ReStart);
 //				ReStart();
 				return 1;
 			}
@@ -81,7 +81,7 @@ int Parser()
 				recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
 				if(recvResult == SOCKET_ERROR)
 				{
-					mir_forkthread(&ReStart, nullptr);
+					mir_forkthread(&ReStart);
 					return 1;
 				}
 			}
@@ -91,14 +91,14 @@ int Parser()
 		recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
 		if(recvResult == SOCKET_ERROR)
 		{
-			mir_forkthread(&ReStart, nullptr);
+			mir_forkthread(&ReStart);
 			return 1;
 		}
 		Netlib_Send(ghConnection, "currentsong\n", (int)mir_strlen("currentsong\n"), 0);
 		recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr);
 		if(recvResult == SOCKET_ERROR)
 		{
-			mir_forkthread(&ReStart, nullptr);
+			mir_forkthread(&ReStart);
 			return 1;
 		}
 		nlpr.bytesUsed = nlpr.bytesAvailable;
@@ -266,7 +266,7 @@ void Stop()
 
 int Init()
 {
-	mir_forkthread(&Start, nullptr);
+	mir_forkthread(&Start);
 	return 0;
 }
 
@@ -280,7 +280,7 @@ HWND CheckPlayer(HWND, int)
 {
 	if(!ghConnection)
 	{
-		mir_forkthread(&Start, nullptr);
+		mir_forkthread(&Start);
 		return nullptr;
 	}
 	if(Parser())
@@ -294,7 +294,7 @@ int GetStatus(HWND)
 {
 	if(!ghConnection)
 	{
-		mir_forkthread(&Start, nullptr);
+		mir_forkthread(&Start);
 		return 0;
 	}
 	return Parser() ? -1 : gbState;
@@ -304,7 +304,7 @@ WCHAR* GetFileName(HWND, int)
 {
 	if(!ghConnection)
 	{
-		mir_forkthread(&Start, nullptr);
+		mir_forkthread(&Start);
 		return nullptr;
 	}
 	return nullptr;
@@ -314,7 +314,7 @@ int GetPlayerInfo(LPSONGINFO info, int)
 {
 	if(!ghConnection)
 	{
-		mir_forkthread(&Start, nullptr);
+		mir_forkthread(&Start);
 		return 0;
 	}
 	if(Parser())
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 45afe6cfcd..e683f561ac 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -160,7 +160,7 @@ INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
 	sttSID[_countof(sttSID) - 1] = 0;
 	sttSearchId = 1;
 	// create a thread for the ID search
-	mir_forkthread(BasicSearchTimerProc, nullptr);
+	mir_forkthread(BasicSearchTimerProc);
 	return sttSearchId;
 }
 
@@ -214,7 +214,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
 	GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
 
 	// search for the weather station using a thread
-	mir_forkthread(NameSearchTimerProc, nullptr);
+	mir_forkthread(NameSearchTimerProc);
 	return sttSearchId;
 }
 
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index 91a1755ede..d5540d041c 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -191,7 +191,7 @@ int UpdateWeather(MCONTACT hContact)
 
 			DBEVENTINFO dbei = {};
 			dbei.szModule = WEATHERPROTONAME;
-			dbei.timestamp = (DWORD)time(nullptr);
+			dbei.timestamp = (DWORD)time(0);
 			dbei.flags = DBEF_READ | DBEF_UTF;
 			dbei.eventType = EVENTTYPE_MESSAGE;
 			dbei.pBlob = szMessage;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 3359fe2cdf..ee0660d813 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -267,7 +267,7 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD)
 
 	if (!(db_get_b(NULL, MODULENAME, OFFLINE_STATUS, 1)))
 		if (!(db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)))
-			mir_forkthread(ContactLoop, nullptr);
+			mir_forkthread(ContactLoop);
 
 	db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
 }
@@ -350,7 +350,7 @@ int ModulesLoaded(WPARAM, LPARAM)
 
 	// get data on startup
 	if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
-		mir_forkthread(StartUpdate, nullptr);
+		mir_forkthread(StartUpdate);
 
 	return 0;
 }
@@ -394,7 +394,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
 /*****************************************************************************/
 INT_PTR UpdateAllMenuCommand(WPARAM, LPARAM)
 {
-	mir_forkthread(ContactLoop, nullptr);
+	mir_forkthread(ContactLoop);
 	return 0;
 }
 
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h
index eb6ffbf572..ced8d87a81 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -222,7 +222,6 @@ void NumSymbols(char *truncated);
 
 INT_PTR AutoUpdateMCmd(WPARAM wParam, LPARAM lParam);
 INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void AckFunc(void *dummy);
 int  SiteDeleted(WPARAM wParam, LPARAM lParam);
 
 int  WErrorPopup(MCONTACT hContact, wchar_t *textdisplay);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index 0610c9be34..2cf0cdaf5a 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -226,7 +226,7 @@ void SaveToFile(MCONTACT hContact, char *truncated)
 		char timestring[128], timeprefix[32];
 		char temptime1[32], temptime2[32];
 
-		time_t ftime = time(nullptr);
+		time_t ftime = time(0);
 		struct tm *nTime = localtime(&ftime);
 
 		mir_snprintf(timeprefix, " %s ", Translate("Last updated on"));
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index ef9ba7fa7e..7340f6a58c 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -270,7 +270,7 @@ void GetData(void *param)
 			if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
 				memset(&temptime, 0, sizeof(temptime));
 				memset(&tstr, 0, sizeof(tstr));
-				ftime = time(nullptr);
+				ftime = time(0);
 				nTime = localtime(&ftime);
 				// 12 hour
 				if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -289,7 +289,7 @@ void GetData(void *param)
 				db_get_ws(hContact, "CList", "MyHandle", &dbv);
 				memset(&temptime, 0, sizeof(temptime));
 				memset(&tstr, 0, sizeof(tstr));
-				ftime = time(nullptr);
+				ftime = time(0);
 				nTime = localtime(&ftime);
 				// 12 hour
 				if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -306,7 +306,7 @@ void GetData(void *param)
 				db_free(&dbv);
 			}
 
-			ftime = time(nullptr);
+			ftime = time(0);
 			nTime = localtime(&ftime);
 
 			strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 0784da7750..5830d5ea65 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -66,7 +66,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
 			}
 
 			if (invalidpresent) {
-				srand((unsigned)time(nullptr));
+				srand((unsigned)time(0));
 				wchar_t ranStr[7];
 				_itow((int)10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
 				mir_wstrcat(nick, ranStr); 
@@ -298,11 +298,11 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM)
 }
 
 /*****************************************************************************/
-static void __cdecl BasicSearchTimerProc(void *pszNick)
+static void __cdecl BasicSearchTimerProc(wchar_t *pszNick)
 {
 	PROTOSEARCHRESULT psr = { sizeof(psr) };
 	psr.flags = PSR_UNICODE;
-	psr.nick.w = (wchar_t*)pszNick;
+	psr.nick.w = pszNick;
 
 	// broadcast the search result
 	ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
@@ -310,7 +310,7 @@ static void __cdecl BasicSearchTimerProc(void *pszNick)
 
 	// exit the search
 	searchId = -1;
-	mir_free(psr.nick.w);
+	mir_free(pszNick);
 }
 
 INT_PTR BasicSearch(WPARAM, LPARAM lParam)
@@ -321,7 +321,7 @@ INT_PTR BasicSearch(WPARAM, LPARAM lParam)
 	searchId = 1;
 
 	// create a thread for the ID search
-	mir_forkthread(BasicSearchTimerProc, mir_wstrdup((const wchar_t*)lParam));
+	mir_forkThread<wchar_t>(BasicSearchTimerProc, mir_wstrdup((const wchar_t*)lParam));
 	return searchId;
 }
 
@@ -415,7 +415,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
 
 	if ((sameurl > 0) || (samename > 0)) // contact has the same url or name as another contact, add rand num to name
 	{
-		srand((unsigned) time(nullptr));
+		srand((unsigned) time(0));
 		
 		wchar_t ranStr[10];
 		_itow((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
@@ -445,15 +445,15 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
 }
 
 /*****************************************************************************/
-INT_PTR GetInfo(WPARAM, LPARAM)
-{
-	mir_forkthread(AckFunc, nullptr);
-	return 1;
-}
 
-/*****************************************************************************/
-void AckFunc(void*)
+static void __cdecl AckFunc(void*)
 {
 	for (auto &hContact : Contacts(MODULENAME))
 		ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
 }
+
+INT_PTR GetInfo(WPARAM, LPARAM)
+{
+	mir_forkthread(AckFunc);
+	return 1;
+}
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index 897f2af0eb..325f5dc895 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 time_t Today()
 {
-	time_t now = time(nullptr);
+	time_t now = time(0);
 	struct tm* date = localtime(&now);
 	date->tm_hour = date->tm_min = date->tm_sec = 0;
 	return mktime(date);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index efe7248156..4a1c23b575 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -184,7 +184,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*)
 
 INT_PTR RefreshUserDetailsService(WPARAM, LPARAM)
 {
-	mir_forkthread(RefreshUserDetailsWorkerThread, nullptr);
+	mir_forkthread(RefreshUserDetailsWorkerThread);
 	return 0;
 }
 
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index 9c807e8643..9d3c338627 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -39,7 +39,7 @@ int Log(char *format, ...)
 	if (!fout)
 		return -1;
 
-	time_t tNow = time(nullptr);
+	time_t tNow = time(0);
 	struct tm *now = localtime(&tNow);
 	strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now);
 	fputs(str, fout);
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
index f915b42d00..d3a30d33fa 100644
--- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
@@ -212,7 +212,7 @@ void ThreadProc(LPVOID)
 
 static INT_PTR WumfShowConnections(WPARAM,LPARAM)
 {
-	mir_forkthread(ThreadProc, nullptr);
+	mir_forkthread(ThreadProc);
 	CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hWumfBut, 0);
 	return 0;
 }
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp
index 894b0bace0..276d45ef4b 100644
--- a/plugins/YAMN/src/browser/badconnect.cpp
+++ b/plugins/YAMN/src/browser/badconnect.cpp
@@ -286,7 +286,7 @@ INT_PTR RunBadConnectionSvc(WPARAM wParam, LPARAM lParam)
 	HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
 	Param->ThreadRunningEV = ThreadRunningEV;
 
-	HANDLE NewThread = mir_forkthread(BadConnection, (void*)Param);
+	HANDLE NewThread = mir_forkthread(BadConnection, Param);
 	if (nullptr == NewThread)
 		return 0;
 
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index d9143ab624..a3d2ace7b4 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -69,7 +69,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM)
 	pd_out->opaque = pd_in->PluginData;
 	pd_out->timeout = pd_in->iSeconds;
 
-	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
 	if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
 		mir_free(pd_out->pwzTitle);
 		mir_free(pd_out->pwzText);
@@ -110,7 +110,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM)
 	pd_out->opaque = pd_in->PluginData;
 	pd_out->timeout = pd_in->iSeconds;
 
-	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
 	if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
 		mir_free(pd_out->pwzTitle);
 		mir_free(pd_out->pwzText);
@@ -149,7 +149,7 @@ void ShowPopup(PopupData &pd_in)
 	StripBBCodesInPlace(pd_out->pwzTitle);
 	StripBBCodesInPlace(pd_out->pwzText);
 
-	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
+	lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
 
 	if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
 		mir_free(pd_out->pwzTitle);
@@ -275,7 +275,7 @@ static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam)
 		pd_out.opaque = pd_in->PluginData;
 		pd_out.timeout = pd_in->iSeconds;
 
-		lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(nullptr));
+		lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0));
 	
 		SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out);
 	}
-- 
cgit v1.2.3