summaryrefslogtreecommitdiff
path: root/plugins/ConnectionNotify
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ConnectionNotify')
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp36
-rw-r--r--plugins/ConnectionNotify/src/debug.cpp2
-rw-r--r--plugins/ConnectionNotify/src/debug.h3
-rw-r--r--plugins/ConnectionNotify/src/filter.cpp2
-rw-r--r--plugins/ConnectionNotify/src/netstat.cpp14
-rw-r--r--plugins/ConnectionNotify/src/netstat.h10
-rw-r--r--plugins/ConnectionNotify/src/pid2name.cpp4
-rw-r--r--plugins/ConnectionNotify/src/pid2name.h2
-rw-r--r--plugins/ConnectionNotify/src/stdafx.h2
9 files changed, 37 insertions, 38 deletions
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 81bb0a8c75..275133cd1f 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -39,7 +39,7 @@ struct CONNECTION *connExceptionsTmp = NULL;
struct CONNECTION *connCurrentEditModal = NULL;
int currentStatus = ID_STATUS_OFFLINE, diffstat = 0;
BOOL bOptionsOpen = FALSE;
-TCHAR *tcpStates[] = { L"CLOSED", L"LISTEN", L"SYN_SENT", L"SYN_RCVD", L"ESTAB", L"FIN_WAIT1", L"FIN_WAIT2", L"CLOSE_WAIT", L"CLOSING", L"LAST_ACK", L"TIME_WAIT", L"DELETE_TCB" };
+wchar_t *tcpStates[] = { L"CLOSED", L"LISTEN", L"SYN_SENT", L"SYN_RCVD", L"ESTAB", L"FIN_WAIT1", L"FIN_WAIT2", L"CLOSE_WAIT", L"CLOSING", L"LAST_ACK", L"TIME_WAIT", L"DELETE_TCB" };
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -62,22 +62,22 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CONNEC
//=========================================================================================
-BOOL strrep(TCHAR *src, TCHAR *needle, TCHAR *newstring)
+BOOL strrep(wchar_t *src, wchar_t *needle, wchar_t *newstring)
{
- TCHAR *found, begining[MAX_SETTING_STR], tail[MAX_SETTING_STR];
+ wchar_t *found, begining[MAX_SETTING_STR], tail[MAX_SETTING_STR];
size_t pos = 0;
//strset(begining, ' ');
//strset(tail, ' ');
- if (!(found = _tcsstr(src, needle)))
+ if (!(found = wcsstr(src, needle)))
return FALSE;
pos = (found - src);
- _tcsncpy_s(begining, src, pos);
+ wcsncpy_s(begining, src, pos);
begining[pos] = 0;
pos = pos + mir_tstrlen(needle);
- _tcsncpy_s(tail, src + pos, _TRUNCATE);
+ wcsncpy_s(tail, src + pos, _TRUNCATE);
begining[pos] = 0;
pos = mir_sntprintf(src, mir_tstrlen(src), L"%s%s%s", begining, newstring, tail);
@@ -187,7 +187,7 @@ void fillExceptionsListView(HWND hwndDlg)
// items.
lvI.mask = LVIF_TEXT;
while (tmp) {
- TCHAR tmpAddress[25];
+ wchar_t tmpAddress[25];
lvI.iItem = i++;
lvI.iSubItem = 0;
lvI.pszText = tmp->PName;
@@ -207,7 +207,7 @@ void fillExceptionsListView(HWND hwndDlg)
lvI.pszText = tmpAddress;
ListView_SetItem(hwndList, &lvI);
lvI.iSubItem = 3;
- lvI.pszText = tmp->Pid ? LPGENT("Show") : LPGENT("Hide");
+ lvI.pszText = tmp->Pid ? LPGENW("Show") : LPGENW("Hide");
ListView_SetItem(hwndList, &lvI);
tmp = tmp->next;
@@ -246,7 +246,7 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L
switch (LOWORD(wParam)) {
case ID_OK:
{
- TCHAR tmpPort[6];
+ wchar_t tmpPort[6];
GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, _countof(tmpPort));
if (tmpPort[0] == '*')
connCurrentEditModal->intIntPort = -1;
@@ -294,7 +294,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
{
LVCOLUMN lvc = { 0 };
LVITEM lvI = { 0 };
- TCHAR buff[256];
+ wchar_t buff[256];
bOptionsOpen = TRUE;
TranslateDialogDefault(hwndDlg);//translate miranda function
#ifdef _WIN64
@@ -588,8 +588,8 @@ int ConnectionNotifyOptInit(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG);
- odp.ptszTitle = _T(PLUGINNAME);
- odp.ptszGroup = LPGENT("Plugins");
+ odp.pwszTitle = _T(PLUGINNAME);
+ odp.pwszGroup = LPGENW("Plugins");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcConnectionNotifyOpts;//callback function name
Options_AddPage(wParam, &odp);
@@ -698,7 +698,7 @@ static unsigned __stdcall checkthread(void *)
if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == NULL && (settingStatusMask & (1 << (cur->state - 1)))) {
#ifdef _DEBUG
- TCHAR msg[1024];
+ wchar_t msg[1024];
mir_sntprintf(msg, L"%s:%d\n%s:%d", cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort);
_OutputDebugString(L"New connection: %s", msg);
#endif
@@ -759,7 +759,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
//show popup
-void showMsg(TCHAR *pName, DWORD pid, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state)
+void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state)
{
POPUPDATAT ppd;
@@ -777,7 +777,7 @@ void showMsg(TCHAR *pName, DWORD pid, TCHAR *intIp, TCHAR *extIp, int intPort, i
ppd.lchContact = NULL;//(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
- TCHAR hostName[128];
+ wchar_t hostName[128];
getDnsName(extIp, hostName, _countof(hostName));
mir_sntprintf(ppd.lptzText, L"%s:%d\n%s:%d", hostName, extPort, intIp, intPort);
}
@@ -793,9 +793,9 @@ void showMsg(TCHAR *pName, DWORD pid, TCHAR *intIp, TCHAR *extIp, int intPort, i
ppd.iSeconds = settingInterval1;
//Now the "additional" data.
- _tcsncpy_s(mpd->strIntIp, intIp, _TRUNCATE);
- _tcsncpy_s(mpd->strExtIp, extIp, _TRUNCATE);
- _tcsncpy_s(mpd->PName, pName, _TRUNCATE);
+ wcsncpy_s(mpd->strIntIp, intIp, _TRUNCATE);
+ wcsncpy_s(mpd->strExtIp, extIp, _TRUNCATE);
+ wcsncpy_s(mpd->PName, pName, _TRUNCATE);
mpd->intIntPort = intPort;
mpd->intExtPort = extPort;
mpd->Pid = pid;
diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp
index 62aa9d9dae..506a0e07a1 100644
--- a/plugins/ConnectionNotify/src/debug.cpp
+++ b/plugins/ConnectionNotify/src/debug.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-void _OutputDebugString(TCHAR* lpOutputString, ...)
+void _OutputDebugString(wchar_t* lpOutputString, ...)
{
CMString format;
va_list args;
diff --git a/plugins/ConnectionNotify/src/debug.h b/plugins/ConnectionNotify/src/debug.h
index 90c46be0f5..3e3783dcc9 100644
--- a/plugins/ConnectionNotify/src/debug.h
+++ b/plugins/ConnectionNotify/src/debug.h
@@ -4,7 +4,6 @@
#include <windows.h>
#include <stdio.h>
-#include <tchar.h>
-void _OutputDebugString(TCHAR* lpOutputString, ...);
+void _OutputDebugString(wchar_t* lpOutputString, ...);
#endif \ No newline at end of file
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp
index e3843d12e3..f0c40dfed8 100644
--- a/plugins/ConnectionNotify/src/filter.cpp
+++ b/plugins/ConnectionNotify/src/filter.cpp
@@ -71,7 +71,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM
{
case ID_OK:
{
- TCHAR tmpPort[6];
+ wchar_t tmpPort[6];
if (bOptionsOpen)
{
MessageBox(hWnd, TranslateT("First close options window"), L"ConnectionNotify", MB_OK | MB_ICONSTOP);
diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp
index a12dfb0837..a9827bf7f4 100644
--- a/plugins/ConnectionNotify/src/netstat.cpp
+++ b/plugins/ConnectionNotify/src/netstat.cpp
@@ -41,15 +41,15 @@ struct CONNECTION *GetConnectionsTable()
if (pTcpTable->table[i].dwLocalAddr) {
IpAddr.S_un.S_addr = (ULONG)pTcpTable->table[i].dwLocalAddr;
//_snprintf(newConn->strIntIp,_countof(newConn->strIntIp),"%d.%d.%d.%d",IpAddr.S_un.S_un_b.s_b1,IpAddr.S_un.S_un_b.s_b2,IpAddr.S_un.S_un_b.s_b3,IpAddr.S_un.S_un_b.s_b4);
- TCHAR *strIntIp = mir_a2t(inet_ntoa(IpAddr));
- _tcsncpy(newConn->strIntIp, strIntIp, _countof(newConn->strIntIp) - 1);
+ wchar_t *strIntIp = mir_a2t(inet_ntoa(IpAddr));
+ wcsncpy(newConn->strIntIp, strIntIp, _countof(newConn->strIntIp) - 1);
mir_free(strIntIp);
}
if (pTcpTable->table[i].dwRemoteAddr) {
IpAddr.S_un.S_addr = (u_long)pTcpTable->table[i].dwRemoteAddr;
- TCHAR *strExtIp = mir_a2t(inet_ntoa(IpAddr));
- _tcsncpy(newConn->strExtIp, strExtIp, _countof(newConn->strExtIp) - 1);
+ wchar_t *strExtIp = mir_a2t(inet_ntoa(IpAddr));
+ wcsncpy(newConn->strExtIp, strExtIp, _countof(newConn->strExtIp) - 1);
mir_free(strExtIp);
}
newConn->state = pTcpTable->table[i].dwState;
@@ -123,7 +123,7 @@ void deleteConnectionsTable(struct CONNECTION *head)
head = NULL;
}
-struct CONNECTION *searchConnection(struct CONNECTION *head, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state)
+struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state)
{
for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) {
if (mir_tstrcmp(cur->strIntIp, intIp) == 0 &&
@@ -136,7 +136,7 @@ struct CONNECTION *searchConnection(struct CONNECTION *head, TCHAR *intIp, TCHAR
return NULL;
}
-void getDnsName(TCHAR *strIp, TCHAR *strHostName, size_t len)
+void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len)
{
in_addr iaHost;
@@ -144,5 +144,5 @@ void getDnsName(TCHAR *strIp, TCHAR *strHostName, size_t len)
iaHost.s_addr = inet_addr(szStrIP);
mir_free(szStrIP);
hostent *h = gethostbyaddr((char *)&iaHost, sizeof(struct in_addr), AF_INET);
- _tcsncpy_s(strHostName, len, (h == NULL) ? strIp : _A2T(h->h_name), _TRUNCATE);
+ wcsncpy_s(strHostName, len, (h == NULL) ? strIp : _A2T(h->h_name), _TRUNCATE);
}
diff --git a/plugins/ConnectionNotify/src/netstat.h b/plugins/ConnectionNotify/src/netstat.h
index 8ea8ed564a..f55bdd081f 100644
--- a/plugins/ConnectionNotify/src/netstat.h
+++ b/plugins/ConnectionNotify/src/netstat.h
@@ -4,17 +4,17 @@
struct CONNECTION
{
- TCHAR strIntIp[16];
- TCHAR strExtIp[16];
+ wchar_t strIntIp[16];
+ wchar_t strExtIp[16];
int intIntPort;
int intExtPort;
int state;
DWORD Pid;
- TCHAR PName[260];
+ wchar_t PName[260];
struct CONNECTION *next;
};
struct CONNECTION* GetConnectionsTable();
void deleteConnectionsTable(struct CONNECTION* head);
-struct CONNECTION* searchConnection(struct CONNECTION* head, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state);
-void getDnsName(TCHAR *strIp, TCHAR *strHostName, size_t len); \ No newline at end of file
+struct CONNECTION* searchConnection(struct CONNECTION* head, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state);
+void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len);
diff --git a/plugins/ConnectionNotify/src/pid2name.cpp b/plugins/ConnectionNotify/src/pid2name.cpp
index e30b032bdd..65270e6b00 100644
--- a/plugins/ConnectionNotify/src/pid2name.cpp
+++ b/plugins/ConnectionNotify/src/pid2name.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-void pid2name(DWORD procid, TCHAR *buffer, size_t bufLen)
+void pid2name(DWORD procid, wchar_t *buffer, size_t bufLen)
{
PROCESSENTRY32 ProcessStruct;
ProcessStruct.dwSize = sizeof(PROCESSENTRY32);
@@ -12,7 +12,7 @@ void pid2name(DWORD procid, TCHAR *buffer, size_t bufLen)
do {
if (ProcessStruct.th32ProcessID == procid) {
- _tcsncpy_s(buffer, bufLen, ProcessStruct.szExeFile, _TRUNCATE);
+ wcsncpy_s(buffer, bufLen, ProcessStruct.szExeFile, _TRUNCATE);
break;
}
} while (Process32Next(hSnap, &ProcessStruct));
diff --git a/plugins/ConnectionNotify/src/pid2name.h b/plugins/ConnectionNotify/src/pid2name.h
index d1e7609f10..70974afabf 100644
--- a/plugins/ConnectionNotify/src/pid2name.h
+++ b/plugins/ConnectionNotify/src/pid2name.h
@@ -3,6 +3,6 @@
#ifndef _INC_PID2NAME
#define _INC_PID2NAME
-void pid2name(DWORD, TCHAR*, size_t);
+void pid2name(DWORD, wchar_t*, size_t);
#endif
diff --git a/plugins/ConnectionNotify/src/stdafx.h b/plugins/ConnectionNotify/src/stdafx.h
index b82329e376..4e7f512ad0 100644
--- a/plugins/ConnectionNotify/src/stdafx.h
+++ b/plugins/ConnectionNotify/src/stdafx.h
@@ -40,7 +40,7 @@
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
-void showMsg(TCHAR *pName,DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state);
+void showMsg(wchar_t *pName,DWORD pid,wchar_t *intIp,wchar_t *extIp,int intPort,int extPort,int state);
//int __declspec(dllexport) Load(PLUGINLINK *link);
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
static unsigned __stdcall checkthread(void *dummy);