Search code examples
vb.netwindowssysinternalscomobjectcom-object

Why isn't handles.exe discovering my DLL while ProcessExplorer can?


The problem: On a windows server 2012 r2 box, I'm trying to use Chef to programmatically replace a .dll command component (aka a vb 6 library that I've registered on the box using regsvr32.exe) but when I try to copy over the file, the app pool of the website has a lock on it. I'm not sure if it matters, but the w3wp process is set to run as 32 bit via IIS.

My Solution (which isn't working): In order to fix it, I was thinking about using a command line tool to find the reference to the dll and then recycling the app pool that's using it. Unfortunately, while I can get SysInternals' process explorer to find the dll, Handles.exe (the supposed command line version of process explorer) does not return anything. I was hoping that someone might be able to tell me how I was using handles incorrectly, or if there was a better tool for this.

Process Explorer - it has found my dll ComHelper.dll ProcessExplorer_working

Handles via command line - it has not found my dll ComHelper.dll HandlesCommandLine_not_working

-- Edit -- This is the output of handles when I point it at w3wp while running as Admin HandlesSearchingForW3WP


Solution

  • I would suspect you are running into access issues. Are you running Handle from an elevated command prompt ? Are you able to get any output covering handles in w3wp.exe (by using the pid of the process in handle.exe command line) ?

    Looking at the handle enum output of w3wp.exe it seems,

    listdll.exe -d ComHelper.dll 
    

    may be what you are looking for. Handle seems to be focused on files opened not dlls loaded. listdll is a tool that can be downloaded from sysinternals.