By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

[C# COM development] output by Regasm

P: n/a
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(vs.71).aspx

I am using Regasm to generate Windows Registry scripts, here it is,

I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to the
real codebase dll (CSharpServer.dll), which contains the real implementation
of coclass and interface definition.

I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?

Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2.  
  3. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4. @="CSharpServer.InterfaceImplementation"
  5.  
  6. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7. @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10. @="CSharpServer.InterfaceImplementation"
  11.  
  12. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13. @="mscoree.dll"
  14. "ThreadingModel"="Both"
  15. "Class"="CSharpServer.InterfaceImplementation"
  16. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17. PublicKeyToken=null"
  18. "RuntimeVersion"="v2.0.50727"
  19.  
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21. "Class"="CSharpServer.InterfaceImplementation"
  22. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23. PublicKeyToken=null"
  24. "RuntimeVersion"="v2.0.50727"
  25.  
  26. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27. @="CSharpServer.InterfaceImplementation"
  28.  
  29. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George
Jul 19 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

I was working lately on COM implementation in .Net and found out that
running regasm with tlb option registers as well the full path to tlb and
the directory where the dll (assembly). is placed.

When you look into registry, in the TypeLib subkey for registered classes
you have the Guid of the key that contains the information.
This is located in: \\HKCR\TypeLib\[YourGuid]

I don't know why the generated registry information does not contain this
bit.

Some good articles on .Net COM development can be found here:

http://www.codeproject.com/useritems...rsInDotNet.asp
http://www.codeproject.com/dotnet/nettocom.asp

Best regards,
Cezary Nolewajka

Consultant | Microsoft Services | Microsoft | Poland

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(vs.71).aspx

I am using Regasm to generate Windows Registry scripts, here it is,

I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to
the
real codebase dll (CSharpServer.dll), which contains the real
implementation
of coclass and interface definition.

I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?

Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  3. @="CSharpServer.InterfaceImplementation"
  4. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  5. @="{C6659361-1625-4746-931C-36014B146679}"
  6. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  7. @="CSharpServer.InterfaceImplementation"
  8. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  9. @="mscoree.dll"
  10. "ThreadingModel"="Both"
  11. "Class"="CSharpServer.InterfaceImplementation"
  12. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  13. PublicKeyToken=null"
  14. "RuntimeVersion"="v2.0.50727"
  15. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  16. "Class"="CSharpServer.InterfaceImplementation"
  17. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  18. PublicKeyToken=null"
  19. "RuntimeVersion"="v2.0.50727"
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  21. @="CSharpServer.InterfaceImplementation"
  22. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  23. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  24.  


thanks in advance,
George
Jul 19 '07 #2

P: n/a

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(vs.71).aspx

I am using Regasm to generate Windows Registry scripts, here it is,

I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to
the
real codebase dll (CSharpServer.dll), which contains the real
implementation
of coclass and interface definition.

I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?
This line:
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"

is the reference data used by mscoree to load managed assemblies.
>
Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  3. @="CSharpServer.InterfaceImplementation"
  4. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  5. @="{C6659361-1625-4746-931C-36014B146679}"
  6. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  7. @="CSharpServer.InterfaceImplementation"
  8. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  9. @="mscoree.dll"
  10. "ThreadingModel"="Both"
  11. "Class"="CSharpServer.InterfaceImplementation"
  12. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  13. PublicKeyToken=null"
  14. "RuntimeVersion"="v2.0.50727"
  15. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  16. "Class"="CSharpServer.InterfaceImplementation"
  17. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  18. PublicKeyToken=null"
  19. "RuntimeVersion"="v2.0.50727"
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  21. @="CSharpServer.InterfaceImplementation"
  22. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  23. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  24.  


thanks in advance,
George

Jul 19 '07 #3

P: n/a
Hi Ben,
How do you think from the following line,
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"
mscoree.dll will find the actual codebase -- CSharpServer.dll? Why it could
find this CSharpServer.dll, other than some other dll?

(I have this question since from the registry line you quoted, there is no
information about CSharpServer.dll).
regards,
George

"Ben Voigt [C++ MVP]" wrote:
>
"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(vs.71).aspx

I am using Regasm to generate Windows Registry scripts, here it is,

I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to
the
real codebase dll (CSharpServer.dll), which contains the real
implementation
of coclass and interface definition.

I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?

This line:
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"

is the reference data used by mscoree to load managed assemblies.

Expand|Select|Wrap|Line Numbers
  1.  REGEDIT4
  2.  
  3.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4.  @="CSharpServer.InterfaceImplementation"
  5.  
  6.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7.  @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10.  @="CSharpServer.InterfaceImplementation"
  11.  
  12.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13.  @="mscoree.dll"
  14.  "ThreadingModel"="Both"
  15.  "Class"="CSharpServer.InterfaceImplementation"
  16.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17.  PublicKeyToken=null"
  18.  "RuntimeVersion"="v2.0.50727"
  19.  
  20.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21.  "Class"="CSharpServer.InterfaceImplementation"
  22.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23.  PublicKeyToken=null"
  24.  "RuntimeVersion"="v2.0.50727"
  25.  
  26.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27.  @="CSharpServer.InterfaceImplementation"
  28.  
  29.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30.  Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George


Jul 20 '07 #4

P: n/a
Thanks Cezary!
I have tested that you are correct! We have to use /tlb option.

I am writing C# COM server (managed code). Since there is no QueryInterface,
DllGetClassObject like in C++ native code, I am wondering how to know which
coclass is initialized and which method is invoking by client?

I have such question is because I only develop COM server, and there are
some dll level error (dll no longer available, something like this), so I
think COM client may use some coclass/methods which my COM server does not
support. But I do not have COM client source codes, so I am wondering how to
get the information (which coclass/method client is using).
thanks in advance,
George

"Cezary Nolewajka" wrote:
Hi,

I was working lately on COM implementation in .Net and found out that
running regasm with tlb option registers as well the full path to tlb and
the directory where the dll (assembly). is placed.

When you look into registry, in the TypeLib subkey for registered classes
you have the Guid of the key that contains the information.
This is located in: \\HKCR\TypeLib\[YourGuid]

I don't know why the generated registry information does not contain this
bit.

Some good articles on .Net COM development can be found here:

http://www.codeproject.com/useritems...rsInDotNet.asp
http://www.codeproject.com/dotnet/nettocom.asp

Best regards,
Cezary Nolewajka

Consultant | Microsoft Services | Microsoft | Poland

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(vs.71).aspx

I am using Regasm to generate Windows Registry scripts, here it is,

I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to
the
real codebase dll (CSharpServer.dll), which contains the real
implementation
of coclass and interface definition.

I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?

Expand|Select|Wrap|Line Numbers
  1.  REGEDIT4
  2.  
  3.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4.  @="CSharpServer.InterfaceImplementation"
  5.  
  6.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7.  @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10.  @="CSharpServer.InterfaceImplementation"
  11.  
  12.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13.  @="mscoree.dll"
  14.  "ThreadingModel"="Both"
  15.  "Class"="CSharpServer.InterfaceImplementation"
  16.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17.  PublicKeyToken=null"
  18.  "RuntimeVersion"="v2.0.50727"
  19.  
  20.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21.  "Class"="CSharpServer.InterfaceImplementation"
  22.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23.  PublicKeyToken=null"
  24.  "RuntimeVersion"="v2.0.50727"
  25.  
  26.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27.  @="CSharpServer.InterfaceImplementation"
  28.  
  29.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30.  Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George

Jul 21 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.