Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. exe name

exe name

Scheduled Pinned Locked Moved C / C++ / MFC
json
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunit5
    wrote on last edited by
    #1

    Is there any API through which processes can be enumerated on the basis of Port they are using. Thanx Sunit

    never say die

    S L 2 Replies Last reply
    0
    • S sunit5

      Is there any API through which processes can be enumerated on the basis of Port they are using. Thanx Sunit

      never say die

      S Offline
      S Offline
      sunit5
      wrote on last edited by
      #2

      i feel this API <GetExtendedTcpTable> will work for me.If any body has another solution please let me know Sunit :-O

      never say die

      1 Reply Last reply
      0
      • S sunit5

        Is there any API through which processes can be enumerated on the basis of Port they are using. Thanx Sunit

        never say die

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You can use a combination of AllocateAndGetTcpExTableFromStack[^] or AllocateAndGetUdpExTableFromStack[^] from Iphlpapi.dll to find all open TCP/UDP ports and the PID of the process owning the handle. This technique should be used on OS prior to XP-SP2. Not available on 95/98/Me. On XP SP2/Vista/2003/2008 the function GetExtendedTcpTable [^]is available as the prior mentioned functions have been deprecated. Once you have the ports and the corresponding PID you can use CreateToolhelp32Snapshot toolhelp [^]functions to walk all available processes and find the name of the executable matching the PID. Structures you will need: MIB_TCPROW_OWNER_PID[^] MIB_TCPTABLE_OWNER_PID[^] Best Wishes, -David Delaune

        S 1 Reply Last reply
        0
        • L Lost User

          You can use a combination of AllocateAndGetTcpExTableFromStack[^] or AllocateAndGetUdpExTableFromStack[^] from Iphlpapi.dll to find all open TCP/UDP ports and the PID of the process owning the handle. This technique should be used on OS prior to XP-SP2. Not available on 95/98/Me. On XP SP2/Vista/2003/2008 the function GetExtendedTcpTable [^]is available as the prior mentioned functions have been deprecated. Once you have the ports and the corresponding PID you can use CreateToolhelp32Snapshot toolhelp [^]functions to walk all available processes and find the name of the executable matching the PID. Structures you will need: MIB_TCPROW_OWNER_PID[^] MIB_TCPTABLE_OWNER_PID[^] Best Wishes, -David Delaune

          S Offline
          S Offline
          sunit5
          wrote on last edited by
          #4

          Thanx a lot

          never say die

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups