hMailServer Thread ID via API.

Use this forum if you want to discuss a problem or ask a question related to a hMailServer beta release.
Post Reply
User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

hMailServer Thread ID via API.

Post by SorenR » 2019-04-10 14:12

I modified my 5.4.2 to include "oApp.Status.ThreadID" :mrgreen:
I use it for my LogWriter so I can crossmatch with the normal logging.

Example...

This custom log track the logic of the EventHandler script in my server. 465/25 is SMTP port, DISCONNECT will force terminate TCPIP connection not returning a SMTP status code, IDS = Intrution Detection System, "IDS BAN" is handled by an external script running every 60 seconds. The sequence "IDS Add" followed by "IDS Delete" describe receipt of valid email.
ThreadID is the left most column.

Code: Select all

1844		"2019-04-10 03:02:31.625"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:31.781"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:31.842"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:32.170"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:32.249"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:32.249"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:32.249"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:32.578"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:32.592"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:32.592"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:33.203"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:33.281"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:33.281"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:33.281"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:34.203"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:34.203"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:48.967"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:48.983"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:48.983"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:49.202"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:49.545"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:49.545"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:49.545"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:50.092"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:50.108"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:50.108"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:50.655"	"***************	103.116.12.239  	465"
3260		"2019-04-10 03:02:50.655"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:50.670"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:51.185"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:51.185"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:51.217"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:51.217"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:51.233"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:51.763"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:51.763"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:51.763"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:52.170"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:52.310"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:52.310"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:52.327"	"SnowShoe       	103.116.12.239"
1176		"2019-04-10 03:02:52.874"	"***************	103.116.12.239  	25"
1176		"2019-04-10 03:02:52.874"	"IDS Add        	103.116.12.239"
1176		"2019-04-10 03:02:52.874"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:53.185"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:53.405"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:53.405"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:53.405"	"SnowShoe       	103.116.12.239"
3064		"2019-04-10 03:02:53.920"	"***************	103.116.12.239  	25"
3064		"2019-04-10 03:02:53.920"	"IDS Add        	103.116.12.239"
3064		"2019-04-10 03:02:53.935"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:54.138"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:54.499"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:54.499"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:54.499"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:55.108"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:55.124"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:55.124"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:55.124"	"SnowShoe       	103.116.12.239"
3064		"2019-04-10 03:02:56.155"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:56.155"	"DISCONNECT     	103.116.12.239"
3064		"2019-04-10 03:02:56.169"	"***************	103.116.12.239  	465"
3064		"2019-04-10 03:02:56.169"	"IDS Add        	103.116.12.239"
3064		"2019-04-10 03:02:56.169"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:56.716"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:56.716"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:56.733"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:57.138"	"DISCONNECT     	103.116.12.239"
1176		"2019-04-10 03:02:57.185"	"DISCONNECT     	103.116.12.239"
3064		"2019-04-10 03:02:57.202"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:57.280"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:57.280"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:57.280"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:58.202"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:58.202"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:59.123"	"DISCONNECT     	103.116.12.239"
2560		"2019-04-10 03:03:00.310"	"IDS BAN        	103.116.12.239"
2572		"2019-04-10 03:05:44.539"	"***************	204.232.178.184 	25 	web1.valentus.com"
2572		"2019-04-10 03:05:44.539"	"IDS Add        	204.232.178.184"
200		"2019-04-10 03:06:49.693"	"IDS Delete     	204.232.178.184"
VBScript is notoriously bad at file locking when writing to files, so I'm using my "filelock" routine...
I decided to log the events where script is waiting for locked file to clear lock (If (i > 0) Or (Err.Num... etc.).

Code: Select all

...
...
On Error Resume Next
For i = 0 To 30
   Err.Clear
   Set OpenFile = .OpenTextFile(strPath, Append, True, Unicode)
   If (i > 0) Or (Err.Number <> 0) Then EventLog.Write( "Function OpenFile, i: " & i & ", Err.Number: " & Err.Number )
   If (Not Err.Number = 70) Then Exit For
   Wait(1)
Next
...
...
and got this ... "Err.Number: 70" means file is locked.

Code: Select all

1844		"2019-04-10 03:02:33.203"	"Function OpenFile, i: 0, Err.Number: 70"
1844		"2019-04-10 03:02:34.203"	"Function OpenFile, i: 1, Err.Number: 0"
1844		"2019-04-10 03:02:51.186"	"Function OpenFile, i: 0, Err.Number: 70"
3260		"2019-04-10 03:02:52.171"	"Function OpenFile, i: 0, Err.Number: 70"
1176		"2019-04-10 03:02:53.186"	"Function OpenFile, i: 0, Err.Number: 70"
3064		"2019-04-10 03:02:54.139"	"Function OpenFile, i: 0, Err.Number: 70"
1176		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
3064		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 0"
3260		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1844		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1844		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
1176		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 0"
3260		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
3260		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 0"
1844		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 70"
1844		"2019-04-10 03:02:59.123"	"Function OpenFile, i: 4, Err.Number: 0"
Looks a bit confusing since there are no obvious identifiers. However if we clean it up and sort by ThreadID we get this... And it all becomes more readable :mrgreen:

Code: Select all

1844		"2019-04-10 03:02:33.203"	"Function OpenFile, i: 0, Err.Number: 70"
1844		"2019-04-10 03:02:34.203"	"Function OpenFile, i: 1, Err.Number: 0"

1844		"2019-04-10 03:02:51.186"	"Function OpenFile, i: 0, Err.Number: 70"
1844		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1844		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
1844		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 70"
1844		"2019-04-10 03:02:59.123"	"Function OpenFile, i: 4, Err.Number: 0"

3260		"2019-04-10 03:02:52.171"	"Function OpenFile, i: 0, Err.Number: 70"
3260		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
3260		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
3260		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 0"

1176		"2019-04-10 03:02:53.186"	"Function OpenFile, i: 0, Err.Number: 70"
1176		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1176		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 0"

3064		"2019-04-10 03:02:54.139"	"Function OpenFile, i: 0, Err.Number: 70"
3064		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 0"
This actually show the "file locking" theory works :mrgreen:
It also allows us to match the lines from the custom log and the EventLog by ThreadID and timestamp.

Code: Select all

1844		"2019-04-10 03:02:31.625"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:31.781"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:31.842"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:32.170"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:32.578"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:32.592"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:32.592"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:33.203"	"Function OpenFile, i: 0, Err.Number: 70"
1844		"2019-04-10 03:02:34.203"	"Function OpenFile, i: 1, Err.Number: 0"
1844		"2019-04-10 03:02:34.203"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:48.967"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:48.983"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:48.983"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:49.202"	"DISCONNECT     	103.116.12.239"
1844		"2019-04-10 03:02:49.545"	"***************	103.116.12.239  	465"
1844		"2019-04-10 03:02:49.545"	"IDS Add        	103.116.12.239"
1844		"2019-04-10 03:02:49.545"	"SnowShoe       	103.116.12.239"
1844		"2019-04-10 03:02:51.186"	"Function OpenFile, i: 0, Err.Number: 70"
1844		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1844		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
1844		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 70"
1844		"2019-04-10 03:02:59.123"	"Function OpenFile, i: 4, Err.Number: 0"
1844		"2019-04-10 03:02:59.123"	"DISCONNECT     	103.116.12.239"

3260		"2019-04-10 03:02:32.249"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:32.249"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:32.249"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:33.203"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:33.281"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:33.281"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:33.281"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:34.203"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:50.655"	"***************	103.116.12.239  	465"
3260		"2019-04-10 03:02:50.655"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:50.670"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:51.185"	"DISCONNECT     	103.116.12.239"
3260		"2019-04-10 03:02:51.217"	"***************	103.116.12.239  	25"
3260		"2019-04-10 03:02:51.217"	"IDS Add        	103.116.12.239"
3260		"2019-04-10 03:02:51.233"	"SnowShoe       	103.116.12.239"
3260		"2019-04-10 03:02:52.171"	"Function OpenFile, i: 0, Err.Number: 70"
3260		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
3260		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 70"
3260		"2019-04-10 03:02:58.202"	"Function OpenFile, i: 3, Err.Number: 0"
3260		"2019-04-10 03:02:58.202"	"DISCONNECT     	103.116.12.239"

2572		"2019-04-10 03:02:50.092"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:50.108"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:50.108"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:51.185"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:51.763"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:51.763"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:51.763"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:52.170"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:52.310"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:52.310"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:52.327"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:53.185"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:53.405"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:53.405"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:53.405"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:54.138"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:54.499"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:54.499"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:54.499"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:55.108"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:55.124"	"***************	103.116.12.239  	25"
2572		"2019-04-10 03:02:55.124"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:55.124"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:56.155"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:56.716"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:56.716"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:56.733"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:57.138"	"DISCONNECT     	103.116.12.239"
2572		"2019-04-10 03:02:57.280"	"***************	103.116.12.239  	465"
2572		"2019-04-10 03:02:57.280"	"IDS Add        	103.116.12.239"
2572		"2019-04-10 03:02:57.280"	"SnowShoe       	103.116.12.239"
2572		"2019-04-10 03:02:58.202"	"DISCONNECT     	103.116.12.239"

1176		"2019-04-10 03:02:52.874"	"***************	103.116.12.239  	25"
1176		"2019-04-10 03:02:52.874"	"IDS Add        	103.116.12.239"
1176		"2019-04-10 03:02:52.874"	"SnowShoe       	103.116.12.239"
1176		"2019-04-10 03:02:53.186"	"Function OpenFile, i: 0, Err.Number: 70"
1176		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 70"
1176		"2019-04-10 03:02:57.186"	"Function OpenFile, i: 2, Err.Number: 0"
1176		"2019-04-10 03:02:57.185"	"DISCONNECT     	103.116.12.239"

3064		"2019-04-10 03:02:53.920"	"***************	103.116.12.239  	25"
3064		"2019-04-10 03:02:53.920"	"IDS Add        	103.116.12.239"
3064		"2019-04-10 03:02:53.935"	"SnowShoe       	103.116.12.239"
3064		"2019-04-10 03:02:54.139"	"Function OpenFile, i: 0, Err.Number: 70"
3064		"2019-04-10 03:02:56.155"	"Function OpenFile, i: 1, Err.Number: 0"
3064		"2019-04-10 03:02:56.155"	"DISCONNECT     	103.116.12.239"
3064		"2019-04-10 03:02:56.169"	"***************	103.116.12.239  	465"
3064		"2019-04-10 03:02:56.169"	"IDS Add        	103.116.12.239"
3064		"2019-04-10 03:02:56.169"	"SnowShoe       	103.116.12.239"
3064		"2019-04-10 03:02:57.202"	"DISCONNECT     	103.116.12.239"

2560		"2019-04-10 03:03:00.310"	"IDS BAN        	103.116.12.239"

2572		"2019-04-10 03:05:44.539"	"***************	204.232.178.184 	25 	web1.valentus.com"
2572		"2019-04-10 03:05:44.539"	"IDS Add        	204.232.178.184"
"SMTPD"	2572	491	"2019-04-10 03:06:04.117"	"204.232.178.184"	"SENT: 220 mx.acme.inc ESMTP"
"SMTPD"	2572	491	"2019-04-10 03:06:04.445"	"204.232.178.184"	"RECEIVED: EHLO web1.valentus.com"
"SMTPD"	2572	491	"2019-04-10 03:06:24.100"	"204.232.178.184"	"SENT: 250-mx.acme.inc[nl]250 SIZE"
"SMTPD"	2572	491	"2019-04-10 03:06:24.225"	"204.232.178.184"	"RECEIVED: MAIL FROM:<support@valentus.com>"
"SMTPD"	2572	491	"2019-04-10 03:06:24.225"	"204.232.178.184"	"SENT: 250 OK"
"SMTPD"	2572	491	"2019-04-10 03:06:24.335"	"204.232.178.184"	"RECEIVED: RCPT TO:<road.runner@acme.inc>"
"SMTPD"	2572	0	"2019-04-10 03:06:24.397"	"TCP"	"DNS lookup: 184.178.232.204.zen.spamhaus.org, 0 addresses found: (none), Match: False"
"SMTPD"	2572	0	"2019-04-10 03:06:24.757"	"TCP"	"DNS lookup: 184.178.232.204.b.barracudacentral.org, 0 addresses found: (none), Match: False"
"SMTPD"	2572	0	"2019-04-10 03:06:24.913"	"TCP"	"DNS lookup: 184.178.232.204.bl.spamcop.net, 0 addresses found: (none), Match: False"
"SMTPD"	2572	491	"2019-04-10 03:06:24.913"	"204.232.178.184"	"SENT: 250 OK"
"SMTPD"	2572	491	"2019-04-10 03:06:25.022"	"204.232.178.184"	"RECEIVED: DATA"
"SMTPD"	2572	491	"2019-04-10 03:06:45.162"	"204.232.178.184"	"SENT: 354 OK, send."
200		"2019-04-10 03:06:49.693"	"IDS Delete     	204.232.178.184"
"SMTPD"	200	491	"2019-04-10 03:06:49.756"	"204.232.178.184"	"SENT: 250 Queued (4.515 seconds)"
"SMTPD"	1176	491	"2019-04-10 03:06:49.881"	"204.232.178.184"	"RECEIVED: QUIT"
"SMTPD"	1176	491	"2019-04-10 03:06:49.881"	"204.232.178.184"	"SENT: 221 goodbye"

Modification to hMailServer 5.4.2-B1964:

Code: Select all

diff -bur hmailserver-5.4.2-B1964/hmailserver/source/Server/COM/InterfaceStatus.cpp hmailserver-5.4.2/hmailserver/source/Server/COM/InterfaceStatus.cpp
--- hmailserver-5.4.2-B1964/hmailserver/source/Server/COM/InterfaceStatus.cpp	2014-06-07 10:03:10.000000000 +0200
+++ hmailserver-5.4.2/hmailserver/source/Server/COM/InterfaceStatus.cpp	2019-03-04 14:45:12.484375000 +0100
@@ -125,4 +125,20 @@
    }
 }
 
+STDMETHODIMP 
+InterfaceStatus::get_ThreadID(long *pVal)
+{
+   try
+   {
+      if (!m_pStatus)
+         return GetAccessDenied();
+
+      *pVal = m_pStatus->GetThreadID();
+      return S_OK;
+   }
+   catch (...)
+   {
+      return COMError::GenerateGenericMessage();
+   }
+}
 
diff -bur hmailserver-5.4.2-B1964/hmailserver/source/Server/COM/InterfaceStatus.h hmailserver-5.4.2/hmailserver/source/Server/COM/InterfaceStatus.h
--- hmailserver-5.4.2-B1964/hmailserver/source/Server/COM/InterfaceStatus.h	2014-06-07 10:03:10.000000000 +0200
+++ hmailserver-5.4.2/hmailserver/source/Server/COM/InterfaceStatus.h	2019-03-04 14:45:12.375000000 +0100
@@ -51,6 +51,7 @@
    STDMETHOD(get_RemovedViruses)(/*[out, retval]*/ long *pVal);
    STDMETHOD(get_RemovedSpamMessages)(/*[out, retval]*/ long *pVal);
    STDMETHOD(get_SessionCount)(eSessionType iType, long *pVal);
+   STDMETHOD(get_ThreadID)(/*[out, retval]*/ long *pVal);
 
 private:
 
diff -bur hmailserver-5.4.2-B1964/hmailserver/source/Server/Common/Util/ServerStatus.cpp hmailserver-5.4.2/hmailserver/source/Server/Common/Util/ServerStatus.cpp
--- hmailserver-5.4.2-B1964/hmailserver/source/Server/Common/Util/ServerStatus.cpp	2014-06-07 10:03:10.000000000 +0200
+++ hmailserver-5.4.2/hmailserver/source/Server/Common/Util/ServerStatus.cpp	2019-03-04 14:45:12.625000000 +0100
@@ -158,4 +158,11 @@
    {
       return SessionManager::Instance()->GetNumberOfConnections((SessionType) iSessionType);
    }
+
+   int 
+   ServerStatus::GetThreadID() const
+   {
+      DWORD dwThreadID = GetCurrentThreadId();
+      return dwThreadID;
+   }
 }
diff -bur hmailserver-5.4.2-B1964/hmailserver/source/Server/Common/Util/ServerStatus.h hmailserver-5.4.2/hmailserver/source/Server/Common/Util/ServerStatus.h
--- hmailserver-5.4.2-B1964/hmailserver/source/Server/Common/Util/ServerStatus.h	2014-06-07 10:03:10.000000000 +0200
+++ hmailserver-5.4.2/hmailserver/source/Server/Common/Util/ServerStatus.h	2019-03-04 14:45:12.562500000 +0100
@@ -36,6 +36,8 @@
 
       int GetNumberOfSessions(int iSessionType);
 
+      int GetThreadID() const;
+
    private:
 
       int m_iProcessedMessages;
diff -bur hmailserver-5.4.2-B1964/hmailserver/source/Server/hMailServer/hMailServer.idl hmailserver-5.4.2/hmailserver/source/Server/hMailServer/hMailServer.idl
--- hmailserver-5.4.2-B1964/hmailserver/source/Server/hMailServer/hMailServer.idl	2014-06-07 10:03:10.000000000 +0200
+++ hmailserver-5.4.2/hmailserver/source/Server/hMailServer/hMailServer.idl	2019-03-04 14:45:12.250000000 +0100
@@ -497,6 +497,7 @@
    [propget, id(4), helpstring("Gets the number of removed virues")] HRESULT RemovedViruses([out, retval] long *pVal);
    [propget, id(5), helpstring("Gets the number of detected spam messages")] HRESULT RemovedSpamMessages([out, retval] long *pVal);
    [propget, id(6), helpstring("Gets the current number of sessions")] HRESULT SessionCount([in] eSessionType iType, [out, retval] long *pVal);
+   [propget, id(7), helpstring("Gets the current thread number")] HRESULT ThreadID([out, retval] long *pVal);
 };
 
 [
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Post Reply