Question

Scenario:

  • Delphi ISAPI dll written using Delphi XE, 32 Bit.

    ISAPI dll is running through IIS 7.5 on a Win 7 64 enterprise desktop machine.

    DLL runs fine.

    Debug the ISAPI DLL in the Delphi XE IDE by using Run->Attach to Process:

    Launch the ISAPI DLL and attach to the wpw3.exe *32 process in the debugger - can trace and debug code as it runs in the ISAPI context.

Problem:

  • My hard drive died last week and I got a new Win 7 installation - the standard corporate wide Win 7 64 Enterprise image (not the same as my previous Win 7 64 installation).

    Now, when I go into Run->Attach to Process, I no longer see the wpw3.exe *32 process by name, although it is visible in task manager by name. Invoking the 'show system processes' option on the 'Attach to Process' Dialog box does not help.

    What I DO see now (which I never saw before in my old deployment) is a long list of 'generic' System process with PID's but no descriptions other than 'System'.

    One of these processes is my wpw3.exe *32 process, and I have identified its PID using MS's Process Explorer. But if I try to attach to that process I get an error message - 'Cannot create process - access denied' - so I can't debug. (Same error message 'Error Opening process, Access denied' also shows in Process Explorer for certain properties, although the descriptive name of the process ' wpw3.exe *32' is visible there, associated with the PID.)

    How can I get the Run->Attach to process dialog box to display the proper wpw3.exe *32 process name and attach to it, so I can debug?

    Is this a Delphi problem? An IIS problem? An ISAPI problem? Is this one problem - ie lack of descriptive process name and inability to attach to process are caused by same problem; or is this two problems: one problem being lack of descriptive name, another the inability to attach to the process?

    (Do not want to use - cannot really use - webApp debugger for this - these are ISAPI dll's that are deployed to production exactly as they are written and debugged in IIS - I need to see them running in IIS context.)

  • Been debugging ISAPI dll's for several years this way, with different versions of Delphi and in various OS and server environments without any problems - never encountered this problem before. I am stumped.

Was it helpful?

Solution

My account has admin rights, but it hit me that I should try running DelphiXE as an admin – launch it with the ‘run as administrator’ option.

I got prompted ‘do you want to allow…’ – clicked yes and Delphi ran. Set up my process and hooked in and traced through my code - process names now visible and I can attach to my IIS process and debug in the Delphi Debugger.

I did not have to go through this step in my previous deployment, for whatever reason - but problem solved.

OTHER TIPS

If you want to debug a 32 bit ISAPI dll on a 64 bit OS you can use the following process.

This assumes that you have followed other steps to allow 32 bit ISAPI dlls to work.

  1. Stop IIS

    net stop w3svc

  2. Start the 32 bit worker process in debug mode

    %SYSTEMROOT%\SysWOW64\inetsrv\w3wp -debug

  3. Attach to the w3wp in the debugger. As you noted you need to be running Delphi with elevated privileges for this to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top