summaryrefslogtreecommitdiff
path: root/plugins/ConnectionNotify/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ConnectionNotify/src')
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp39
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.h35
-rw-r--r--plugins/ConnectionNotify/src/debug.cpp11
-rw-r--r--plugins/ConnectionNotify/src/netstat.cpp20
-rw-r--r--plugins/ConnectionNotify/src/pid2name.cpp12
5 files changed, 45 insertions, 72 deletions
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index b1d8f294ac..8bc6f5f6d5 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -1,42 +1,4 @@
-#include <windows.h>
-//#include <stdio.h>
-#include <tchar.h>
-#include <Commctrl.h>
-#include <assert.h>
-#include "pid2name.h"
-
-
-#ifdef _DEBUG
-#include "debug.h"
-#endif
-
-#include "resource.h"
-
-
-#include <newpluginapi.h>
-
-#include <m_clist.h>
-#include <m_skin.h>
-#include <m_database.h>
-#include <m_langpack.h>
-//#include <m_plugins.h>
-#include <m_options.h>
-#include <m_popup.h>
-#include <m_utils.h>
-#include <m_protomod.h>
-#include <m_protosvc.h>
-#include <m_system.h>
-//#include <m_updater.h>
-
#include "ConnectionNotify.h"
-#include "netstat.h"
-#include "filter.h"
-#include "version.h"
-
-#define MAX_SETTING_STR 512
-#define PLUGINNAME "ConnectionNotify"
-
-#define STATUS_COUNT 9
HINSTANCE hInst;
@@ -77,6 +39,7 @@ struct CONNECTION *connCurrentEditModal=NULL;
int currentStatus = ID_STATUS_OFFLINE,diffstat=0;
BOOL bOptionsOpen=FALSE;
TCHAR *tcpStates[]={_T("CLOSED"),_T("LISTEN"),_T("SYN_SENT"),_T("SYN_RCVD"),_T("ESTAB"),_T("FIN_WAIT1"),_T("FIN_WAIT2"),_T("CLOSE_WAIT"),_T("CLOSING"),_T("LAST_ACK"),_T("TIME_WAIT"),_T("DELETE_TCB")};
+
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
PLUGINNAME,
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.h b/plugins/ConnectionNotify/src/ConnectionNotify.h
index d60e8d0cef..3bf10c9ba4 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.h
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.h
@@ -1,9 +1,44 @@
+#include <windows.h>
+#include <Commctrl.h>
+#include <assert.h>
+#include <iphlpapi.h>
+#include <Tlhelp32.h>
+
+#include <newpluginapi.h>
+#include <m_core.h>
+#include <m_clist.h>
+#include <m_skin.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_popup.h>
+#include <m_utils.h>
+#include <m_protomod.h>
+#include <m_protosvc.h>
+#include <m_system.h>
+
+#ifdef _DEBUG
+#include "debug.h"
+#endif
+#include "resource.h"
+#include "netstat.h"
+#include "filter.h"
+#include "version.h"
+#include "pid2name.h"
+
+#define MAX_SETTING_STR 512
+#define PLUGINNAME "ConnectionNotify"
+#define MAX_LENGTH 512
+#define STATUS_COUNT 9
#if !defined(MIID_CONNECTIONNOTIFY)
#define MIID_CONNECTIONNOTIFY {0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } }
#endif
// 4BB5B4AA-C364-4F23-9746-D5B708A286A5
+// Note: could also use malloc() and free()
+#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);
//int __declspec(dllexport) Load(PLUGINLINK *link);
diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp
index d6bff90fe1..0400b3a673 100644
--- a/plugins/ConnectionNotify/src/debug.cpp
+++ b/plugins/ConnectionNotify/src/debug.cpp
@@ -1,7 +1,4 @@
-#include "debug.h"
-
-#define MAX_LENGTH 512
-
+#include "ConnectionNotify.h"
void _OutputDebugString(TCHAR* lpOutputString, ... )
{
@@ -36,7 +33,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )
case 's':
{
TCHAR* s = va_arg( argptr, TCHAR * );
- _stprintf(OutMsg,format,s);
+ mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s);
_tcsncpy(format,OutMsg,_countof(OutMsg));
j = _tcslen(format);
_tcscat(format,_T(" "));
@@ -46,7 +43,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )
case 'c':
{
char c = (char) va_arg( argptr, int );
- _stprintf(OutMsg,format,c);
+ mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c);
_tcsncpy(format,OutMsg,_countof(OutMsg));
j = _tcslen(format);
_tcscat(format,_T(" "));
@@ -56,7 +53,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ... )
case 'd':
{
int d = va_arg( argptr, int );
- _stprintf(OutMsg,format,d);
+ mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d);
_tcsncpy(format,OutMsg,_countof(OutMsg));
j = _tcslen(format);
_tcscat(format,_T(" "));
diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp
index 2dd190c823..36a8302571 100644
--- a/plugins/ConnectionNotify/src/netstat.cpp
+++ b/plugins/ConnectionNotify/src/netstat.cpp
@@ -1,18 +1,4 @@
-// GetTcpTable.cpp : Defines the entry point for the console application.
-//
-
-// Link to Ws2_32.lib
-//#include <winsock2.h>
-#include <ws2tcpip.h>
-// Link to Iphlpapi.lib
-#include <iphlpapi.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <m_core.h>
-#include "netstat.h"
-// Note: could also use malloc() and free()
-#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
-#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
+#include "ConnectionNotify.h"
struct CONNECTION* GetConnectionsTable()
{
@@ -176,10 +162,10 @@ void getDnsName(TCHAR *strIp,TCHAR *strHostName)
iaHost.s_addr = inet_addr(mir_t2a(strIp));
if ((h = gethostbyaddr ((char *)&iaHost, sizeof(struct in_addr), AF_INET))== NULL)
{ // get the host info error
- _stprintf(strHostName,_T("%s"), strIp);
+ _stprintf(strHostName,_T("%s"), strIp); //!!!!!!!!!!!
return;
}
- _stprintf(strHostName,_T("%s"),mir_a2t(h->h_name));
+ _stprintf(strHostName,_T("%s"),mir_a2t(h->h_name)); //!!!!!!!!!!!!!
//_tcsncpy_s(strHostName,128, h->h_name,_tcslen(h->h_name));
}
diff --git a/plugins/ConnectionNotify/src/pid2name.cpp b/plugins/ConnectionNotify/src/pid2name.cpp
index 46c51202c7..e3365a574f 100644
--- a/plugins/ConnectionNotify/src/pid2name.cpp
+++ b/plugins/ConnectionNotify/src/pid2name.cpp
@@ -1,12 +1,4 @@
-#include <Windows.h>
-// one can also use Winternl.h if needed
-//#include <Winternl.h> // for UNICODE_STRING and SYSTEM_INFORMATION_CLASS
-#include <stdio.h>
-#include <tchar.h>
-//#include <stdlib.h>
-
-#include <Tlhelp32.h>
-#include "pid2name.h"
+#include "ConnectionNotify.h"
void pid2name(DWORD procid,TCHAR* buffer)
{
@@ -23,7 +15,7 @@ void pid2name(DWORD procid,TCHAR* buffer)
{
if(ProcessStruct.th32ProcessID==procid)
{
- _stprintf(buffer,_T("%s"),ProcessStruct.szExeFile);
+ _stprintf(buffer,_T("%s"),ProcessStruct.szExeFile); //!!!!!!!!!!!!
break;
}
}