CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 1 of 1
  1. #1
    Join Date
    May 2019

    Exception Errors when doing 'Process Walking' with EnumServicesStatusEx...

    I'm getting a ton of seemingly random Exception Errors when doing Process Walking with Process32Next() and when enumerating Services associated with the process SvcHost.exe (found during Process Walking) with EnumServicesStatusEx().

    The Exception errors only occur the SECOND time I start Process Walking and reinitialise my LPENUM_SERVICE_STATUS_PROCESS struct and allocate heap memory on the second (effectively 4th) call to EnumServicesStatusEx() (from pcbBytesNeeded).

    What am I doing wrong?

    Am I not releasing the handles to OpenSCManager, LPENUM_SERVICE_STATUS_PROCESS and releasing the 'heap memory' allocated during EnumServicesStatusEx() properly?

    To clarify: I open the output window and begin Process Walking, when I find an SvcHost.exe instance I call EnumServicesStatusEx() (twice) and output the Services that share the same PID as that Process...

    When I CLOSE that window I release the OpenSCManager handle, the LPENUM_SERVICES_STATUS_PROCESS struct and release the heap memory associated with EnumServicesStatusEx().

    If I re-open the Window I should now have reset all the variables to begin Process Walking from the beginning again. However, the second time I open the window it is prone to a wide range of Exception Errors.

    What am I doing wrong?

    I'm using VS2017 in Debug mode.
    Last edited by Arianax; July 20th, 2019 at 11:25 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width