🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
10 messages
10 total messages Started by Boguslaw Fries Tue, 04 Mar 2003 14:40
process name corresponding to the particular TCP/UDP port
#17746
Author: Boguslaw Fries
Date: Tue, 04 Mar 2003 14:40
7 lines
1057 bytes
Hi,
How could I determine the name ( + parameters ) of the process
which opened particular TCP/UDP port

I have Windows 2000 and Borland Builder 3.0

Boguslaw Fries
Re: process name corresponding to the particular TCP/UDP port
#17728
Author: Remy Lebeau (TeamB)
Date: Tue, 04 Mar 2003 18:15
14 lines
1509 bytes
You don't.  The API doesn't provide for that.  You'd probably have to
replace the WinSock DLL altogether, or at least implement the debug version
of it, so you can intercept the actual requests to create sockets.  That's
what firewalls and such have to do.  I have no idea how to actually do any
of that, though, sorry.


Gambit

"Boguslaw Fries" <B.Fries@luca-online.de> wrote in message
news:3e64b9a4$1@newsgroups.borland.com...

> How could I determine the name ( + parameters )
> of the process which opened particular TCP/UDP port
Re: process name corresponding to the particular TCP/UDP port
#17672
Author: Boguslaw Fries
Date: Wed, 05 Mar 2003 07:23
17 lines
1352 bytes
Yet I know slight more,
I found something but I idnt understand . May you help me in my
investigations?

It is possible in Win 2000?


 pCreateToolhelp32Snapshot = (PVOID) GetProcAddress( GetModuleHandle(
"kernel32.dll" ),
    "CreateToolhelp32Snapshot" );


HANDLE (WINAPI * pCreateToolhelp32Snapshot ) ( DWORD dwFlags,  DWORD
th32ProcessID );


Boguslaw FRies
Re: process name corresponding to the particular TCP/UDP port
#17677
Author: Boguslaw Fries
Date: Wed, 05 Mar 2003 14:28
10 lines
1407 bytes
I could add someting because I found it


 The procedure "AllocateAndGetTcpExTableFromStack" can fill dwProcessId
field in

PMIB_TCPEXTABLE structure, but
where is this WINAPI procedure??? and which paramameters hat?

Boguslaw Fries
Re: process name corresponding to the particular TCP/UDP port
#17679
Author: Nico Bendlin
Date: Wed, 05 Mar 2003 15:10
8 lines
1386 bytes
Boguslaw Fries wrote:
> where is this WINAPI procedure??? and which paramameters hat?

It's declared in Google.h ;)
http://www.google.net/search?q=AllocateAndGetTcpExTableFromStack

-- 
codito, ergo sum :]
Re: process name corresponding to the particular TCP/UDP port
#17687
Author: Remy Lebeau (TeamB)
Date: Wed, 05 Mar 2003 18:21
20 lines
1813 bytes
That only allows you to see which processes are running on the system in
general.  Not which TCP/UDP sockets they are associated with.  You'll still
have to intercept the socket requests at the lower levels in order to know
which processes are making the requests to begin with.  Then, assuming you
can get a process ID for each request, you can use the ToolHelp API to
resolve the process IDs to filenames.


Gambit

"Boguslaw Fries" <B.Fries@luca-online.de> wrote in message
news:3e65a4b7$1@newsgroups.borland.com...

>  pCreateToolhelp32Snapshot = (PVOID) GetProcAddress( GetModuleHandle(
> "kernel32.dll" ),
>     "CreateToolhelp32Snapshot" );
>
>
> HANDLE (WINAPI * pCreateToolhelp32Snapshot ) ( DWORD dwFlags,  DWORD
> th32ProcessID );
Re: process name corresponding to the particular TCP/UDP port
#17622
Author: Boguslaw Fries
Date: Thu, 06 Mar 2003 07:25
12 lines
1393 bytes
Thanks, I tried it but

typedef DWORD ( __import WINAPI *PAllocateTcp ) ( PMIB_TCPEXTABLE, bool,
HANDLE, DWORD, DWORD );

 pAllocateAndGetTcpExTableFromStack = ( PAllocateTcp * ) GetProcAddress(
LoadLibrary( "iphlpapi.dll"),
    "AllocateAndGetTcpExTableFromStack" );

returns NULL

I have windows 2000.
Re: process name corresponding to the particular TCP/UDP port
#17715
Author: Boguslaw Fries
Date: Thu, 06 Mar 2003 07:27
17 lines
1482 bytes
Thanks, I tried it
but
it returns NULL

typedef DWORD ( __import WINAPI *PAllocateTcp ) ( PMIB_TCPEXTABLE, bool,
HANDLE, DWORD, DWORD );
PAllocateTcp  *pAllocateAndGetTcpExTableFromStack;


 pAllocateAndGetTcpExTableFromStack = ( PAllocateTcp * ) GetProcAddress(
LoadLibrary( "iphlpapi.dll"),
    "AllocateAndGetTcpExTableFromStack" );


I have Windows 2000 and Borland Builder 3.0

Boguslaw Fries
Re: process name corresponding to the particular TCP/UDP port
#17708
Author: Remy Lebeau (TeamB)
Date: Thu, 06 Mar 2003 08:52
18 lines
1501 bytes
"Boguslaw Fries" <B.Fries@luca-online.de> wrote in message
news:3e66f6b1$1@newsgroups.borland.com...
> Thanks, I tried it but
<snip>
> returns NULL

Which means that either:

1) you don't have iphlpapi.dll on your system's search path

or else

2) you do have it, but AllocateAndGetTcpExTableFromStack() doesn't actually
exist in it.


Gambit
Re: process name corresponding to the particular TCP/UDP port
#17625
Author: Boguslaw Fries
Date: Thu, 06 Mar 2003 12:36
6 lines
1297 bytes
Yes :(
In my iphlpapi.dll there is no this API indeed.
Perhaps it is available starting from XP ? - I have windows 2000
Any extra idea?

Regards
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads