Re: How do I setup Debug for COM in-proc server in VS 2005?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Pucca,

You are getting assemby view because it is trying to debug MMC.EXE and not
your dll. As you do not have MMC source code available it will attempt using
the assembly code, but that is beyond your focus.
There is something in your code that makes MMC to crash.

I would suggest the following:
1) I would remove the CoInitialize as it was not in the example and it
worked okay without it.
2) Comment all your code and try the extension as it was originally. If it
does not crash start uncommenting sections of your code to find out what is
causing the crashing.
if it crashes even with all your code commented, then I would suggest
creating a new project using the original sample and start adding your code
to it. This may help you to find and resolve the problem.
3) In regards to the memory used by your global variables. If it is within a
class the class destructor should take care of it, if not you add code for
that. Check if you have any memory leaks. Also, that kind of errors may
happen if you are trying to use deallocated pointers or objects already
destroyed.

Hope this helps.

Carlos Lozano
www.caxonline.net

"Pucca" wrote:

Hi Carlos,
I followed your steps and I am able to attach to the .msc process and debug
starts when I click on my property page. Thank you very much for the tip.

Yes, the sdk example sheet does work. I complete the property sheet for the
extended Computer property based on it and it works. I'm now working on the
extended property sheet for the User property sheet and am having quite a bit
of memory and crashing problems. The sdk smaple sheet I used and modifed is
PPgeext.cpp

I was able to find information about the exception on the internet about
CPropertyPage Create and I've followed the instruction and put in compiling
option to supress it.

Now I'm getting Exception error when I click on the Cancel button as follow.
It then only offer to switch to Assembly view and nothing more. How can I
find out what memory violation in my code is doing this? Also, Where in my
code should I relase all the global variable that I allocated in the
LoadInitialDialogValues method? Could this be causing the crashing becuase I
didn't release the memory from that module? Sorry, one more question, the
Windows sdk example didn't use CoInitialize. I added it in the Class sheet
that all my 3 property sheet is based on . Is this correct? Many thanks in
advance for any help you can extend.

CPropSheetExtension::CPropSheetExtension() : m_cref(0)
{
OBJECT_CREATED
HRESULT hResult = CoInitialize(NULL);
if(FAILED(hResult))//New Sy User
{
DisplayError( hResult, L"Error CoInitialize. - CPropSheetExtension");
GetErrorDetail();
}
}


The thread 'Win32 Thread' (0xfa8) has exited with code 0 (0x0).
First-chance exception at 0x77e55dea in mmc.exe: 0x800401FD: Object is not
connected to server.
First-chance exception at 0x77696f79 in mmc.exe: 0xC0000005: Access
violation reading location 0x00570070.
Unhandled exception at 0x77696f79 in mmc.exe: 0xC0000005: Access violation
reading location 0x00570070.



--
Thanks.


"Carlos Lozano" wrote:

Hi Pucca,

Was is the sample code in th SDK you used to built your dll from?
Did you try it first without adding any of your code? Did it work?

Carlos

"Pucca" wrote:

Hi Carlos,
Thank you so much for those wonderful information. I have first uninstalled
the dll from the release version on my server and then register the Debug
version of the dll. I am no able to start the Debug session from the Server.
But it starts with mmc.exe and then I have to go through the add snap-in bit
everytime. I am going to tryp your steps and that would help greatly.

I'm already getting a heap error message as soon as my dll is loaded. Can
you provide some idea on how to correct this? My 3 property pages are all in
this dll and each page is based on a common class property page I copy and
modify from the MS Windows SDK.

The output window may have more diagnostic information
HEAP[mmc.exe]: Invalid Address specified to RtlFreeHeap( 00090000, 001168C4 )
Windows has triggered a breakpoint in mmc.exe.

This may be due to a corruption of the heap, and indicates a bug in
mmc.exe or any of the DLLs it has loaded.

--
Thanks.


"Carlos Lozano" wrote:

Hello Pucca,

You can debug your property extension (dll file) by attaching to the process
it is running in. Debugging processes running on the server requires
installing only the remote debug tools, so you can debug remotely using your
development machine.

As you already have VS on your server, you can do the following:
1) Copy your project to the server and open it
2) Open your project on the server, remove the configuration from your
project to start using mmc.exe.
3) Set your break-points on your source code
4) Run an instance of DSA.msc (AD Users and computers) or the console you
are extending
5) On VS go to tools > debug processes, you should see a DSA instance
6) Attach to it and use default debugging options
7) Close the debug processes screen (once attached)
8) Open your property page, this will start debugging your code and should
break on your break-points.

Hope this helps.

Carlos Lozano
www.caxonline.net



"Pucca" wrote:

Hi Igor,

I installed the VS 2005 to the server where the AD resides and my COM dll is
registered. I set to start the debug with the mmc.exe instead of the .msc so
it came up as a gereic mmc container. I added AD Users and Groups snap-in to
it and click on the User property to invoke my property page and I got bunch
of error messages.

Honestly, I haven't worked with COM before this project (which supposed to
be done in C# originally but..... the property sheets end up can only be done
with COM). Anyway, my program recently have been crashing randomly but it's
always before I called the ADSI's ADsGetObject. I don't know what that
means. I wonder if these errors are creating the crashes. Can you have a
quick look and give me some hints on how to address this? I would really
appreciate it.

BTW, the 3 property sheets I created are based on a class that I got from
the windows SDK for creating ext property sheet for the AD. The
CoInitialize() is done in this base class that my 3 sheets inherits from. Is
this a right place for that?
CPropSheetExtension::CPropSheetExtension() : m_cref(0)
{
OBJECT_CREATED
HRESULT hResult = CoInitialize(NULL);
if(FAILED(hResult))//New Sy User
{
DisplayError( hResult, L"Error CoInitialize. - CPropSheetExtension");
GetErrorDetail();
}
}

----------------------------------------------------------------------------
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e750..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e274..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e274..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e274..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e258..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5c0..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5c0..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5c0..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5b8..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5b8..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5b8..
First-chance exception at 0x77e55dea in mmc.exe: Microsoft C++ exception:
long at memory location 0x00d8e5cc..
'mmc.exe': Loaded 'C:\WINDOWS\system32\ntmsmgr.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\PropertyPage\complete.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\wsecedit.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\scecli.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\Program Files\Support Tools\sidwkr.dll', No symbols
loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\filemgmt.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\cfgmgr32.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\Program Files\Microsoft SQL
Server\90\Tools\Binn\SqlManager.dll', No symbols loaded.
'mmc.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841\ATL80.dll', Symbols loaded.
'mmc.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_dec6ddd2\mfc80u.dll', Symbols loaded.
'mmc.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd\msvcp80.dll', Symbols loaded.
'mmc.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_3415f6d0\mfc80ENU.dll', Binary was not built with debug information.
'mmc.exe': Loaded 'C:\Program Files\Microsoft SQL
Server\90\Tools\Binn\Resources\1033\SqlManager.rll', Binary was not built
with debug information.
'mmc.exe': Loaded 'C:\WINDOWS\system32\msxml6.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\tapisnap.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\tscc.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\regapi.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\utildll.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\tapi32.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\mstlsapi.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\rdpsnd.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\uddi.mmc.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\SFU\admin\Sfuadmin.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\winssnap.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\winsrpc.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\wlanmon.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\wzcsapi.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\wbem\wbemcntl.dll', No symbols loaded.
'mmc.exe': Loaded 'C:\WINDOWS\system32\rasuser.dll', No symbols loaded.
HEAP[mmc.exe]: Invalid Address specified to RtlFreeHeap( 00090000, 00115F6C )
Windows has triggered a breakpoint in mmc.exe.

This may be due to a corruption of the heap, and indicates a bug in mmc.exe
or any of the DLLs it has loaded.

The output window may have more diagnostic information
HEAP[mmc.exe]: Invalid Address specified to RtlFreeHeap( 00090000, 0010AB14 )
Windows has triggered a breakpoint in mmc.exe.

This may be due to a corruption of the heap, and indicates a bug in mmc.exe
or any of the DLLs it has loaded.

The output window may have more diagnostic information
HEAP[mmc.exe]: Invalid Address specified to RtlFreeHeap( 00090000, 001168FC )
Windows has triggered a breakpoint in mmc.exe.

This may be due to a corruption of the heap, and indicates a bug in mmc.exe
or any of the DLLs it has loaded.

The output window may have more diagnostic information
'mmc.exe': Unloaded 'C:\WINDOWS\system32\uddi.mmc.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\tscc.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\mstlsapi.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\utildll.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\tapi32.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\regapi.dll'
'mmc.exe': Unloaded 'C:\Program Files\Microsoft SQL
Server\90\Tools\Binn\SqlManager.dll'
'mmc.exe': Unloaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd\msvcp80.dll'
'mmc.exe': Unloaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_dec6ddd2\mfc80u.dll'
'mmc.exe': Unloaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841\ATL80.dll'
'mmc.exe': Unloaded 'C:\Program Files\Microsoft SQL
Server\90\Tools\Binn\Resources\1033\SqlManager.rll'
'mmc.exe': Unloaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_3415f6d0\mfc80ENU.dll'
'mmc.exe': Unloaded 'C:\Program Files\Support Tools\sidwkr.dll'
'mmc.exe': Unloaded 'C:\PropertyPage\complete.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\mstsmmc.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\smlogcfg.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\pdh.dll'
'mmc.exe': Unloaded 'C:\WINDOWS\system32\odbcbcp.dll'
.



Relevant Pages

  • Re: How do I setup Debug for COM in-proc server in VS 2005?
    ... Was is the sample code in th SDK you used to built your dll from? ... I am no able to start the Debug session from the Server. ... Windows has triggered a breakpoint in mmc.exe. ... long at memory location 0x00d8e750.. ...
    (microsoft.public.win32.programmer.ole)
  • Re: How do I setup Debug for COM in-proc server in VS 2005?
    ... version of the dll. ... I am no able to start the Debug session from the Server. ... long at memory location 0x00d8e750.. ... violation reading location 0xfeeefef6. ...
    (microsoft.public.win32.programmer.ole)
  • Re: How do I setup Debug for COM in-proc server in VS 2005?
    ... I followed your steps and I am able to attach to the .msc process and debug ... Windows sdk example didn't use CoInitialize. ... Was is the sample code in th SDK you used to built your dll from? ... long at memory location 0x00d8e750.. ...
    (microsoft.public.win32.programmer.ole)
  • regsvr32 and error
    ... when trying to reg a dll i get this errer. ... failed - Invalid access to memory location ... Windows 2003 std. ...
    (microsoft.public.windows.server.general)
  • Need help passing an array to COM
    ... I used tlbimp to import the dll. ... I get "Invalid access to memory location." ... I was told that object x takes a BSTR array. ...
    (microsoft.public.dotnet.framework.interop)