While researching ideas lately I discovered SysInternals Process Viewer can do EXACTLY what I would like to do.
However to do it involves the ("UnDocumented" NtDll.dll) and PsApi.dll
So far I have the parts of PsApi.dll working so that I understand them (basic enum processes, get the handles, names, get the modules (dll's) being used etc....)
So far the drawbacks are the relying on dll's that may not have the needed dll's or functions that I need on some operating systems (I can live with that or loadlibrary to check first sort of thing)
But I am wondering if maybe a better work-around is possible for all 32-bit OS'es?
Beyond that I have more or less found 2 examples (one in C, and one in VB.NET) that do the same thing, but I am the 1st to omit that[list=1][*] I am VERY weak at both languages (I am a VB6 die-hard (turning PB)[*] The VB.NET was easier to understand, but had to port from French comments to English and my own guessing on what the code actually does[*] Neither example have I gotten working, but it must because the compiled exe works.[/list=a]
What I would like to do...I thought should be simple...but here I am 10yrs later still trying to figure out why so hard, but at least I got a glimpse that "It CAN be done" is[list=1][*] Open a Serial Port (easy)[*] If the port is un-able to be opened, return the error that the port is in use (easy)[*] Rather than return "Port In Use" error, I would like to then go on to determine why or who? (hard, but I think PsApi and NtDll are my route to follow)[*] On error, then enumerate the processes, check each Module, or File Or other resource it has open and if matches, then change the error to "Because BLANK has it open"[/list=a]
Any other ideas? or any help from others in porting would be GREATLY appreciated

------------------
However to do it involves the ("UnDocumented" NtDll.dll) and PsApi.dll
So far I have the parts of PsApi.dll working so that I understand them (basic enum processes, get the handles, names, get the modules (dll's) being used etc....)
So far the drawbacks are the relying on dll's that may not have the needed dll's or functions that I need on some operating systems (I can live with that or loadlibrary to check first sort of thing)
But I am wondering if maybe a better work-around is possible for all 32-bit OS'es?
Beyond that I have more or less found 2 examples (one in C, and one in VB.NET) that do the same thing, but I am the 1st to omit that[list=1][*] I am VERY weak at both languages (I am a VB6 die-hard (turning PB)[*] The VB.NET was easier to understand, but had to port from French comments to English and my own guessing on what the code actually does[*] Neither example have I gotten working, but it must because the compiled exe works.[/list=a]
What I would like to do...I thought should be simple...but here I am 10yrs later still trying to figure out why so hard, but at least I got a glimpse that "It CAN be done" is[list=1][*] Open a Serial Port (easy)[*] If the port is un-able to be opened, return the error that the port is in use (easy)[*] Rather than return "Port In Use" error, I would like to then go on to determine why or who? (hard, but I think PsApi and NtDll are my route to follow)[*] On error, then enumerate the processes, check each Module, or File Or other resource it has open and if matches, then change the error to "Because BLANK has it open"[/list=a]
Any other ideas? or any help from others in porting would be GREATLY appreciated

------------------
Comment