How to tell if a dll is registered

How perform I discover whether a DLL file written in C# is registered or not programmatically?

I already tried this code, but it doesn"t come off.

You watching: How to tell if a dll is registered

If I register a DLL file and also inspect making use of this code it returns. If I unregister it and run this same piece of code, it returns true aget. I"m providing the fullpath of the DLL file as discussion.

We emerged an easy DLL file in Visual C++. After that we registered it. Now we desire to confirm wheteher it is registered.

Bob, will certainly you replace the piece of code on your own, it is still hard for me?

If I register a DLL file, is tright here an entry present in the registry? Shall I uncover those entries and judge wheteher the DLL file is registered or not?

The last answer is functioning with some modifications. I looked in typelib instead of clsid.

earwicker der:Anymethod, I have actually done it via a slight change. It"s working currently.


c# .net
Share
Improve this question
Follow
edited Jul 25 "15 at 14:19
*

Peter Mortensen
27.9k2121 gold badges9494 silver badges123123 bronze badges
asked Mar 27 "09 at 9:37
karthikkarthik
1
Add a comment |

7 Answers 7


Active Oldest Votes
21
You have to uncover out the GUID of a COM object characterized in the DLL. Then look at this regisattempt key:

HKEY_CLASSES_ROOTCLSIDxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxInprocServer32Replace the x"s via the GUID.

It should have actually a default worth that includes the full path to the DLL.

See more: How To Forget Wireless Network Windows 8, How To Remove A Saved Wi


Share
Improve this answer
Follow
answered Mar 27 "09 at 10:10
*

Daniel EarwickerDaniel Earwicker
108k3535 gold badges193193 silver badges273273 bronze badges
3
Add a comment |
5
If you suppose registered in GAC, here is my consideration: to be registered in GAC, an assembly need to be signed via a strong name (have a public key token in it"s name).

So you have the right to try fill it utilizing Assembly.Load(string), if you acquired FileNotFoundException - assembly was not registered in GAC.

If got no error, however outcome Assembly.GetName().GetPublicKeyToken() is null or empty -- this mean you discovered assembly in application magazine, not in GAC.


Share
Improve this answer
Follow
answered Mar 27 "09 at 9:48
*

abatishchevabatishchev
91.8k7777 gold badges283283 silver badges420420 bronze badges
Add a comment |
3
You have the right to usage this:

My.Computer.Regisattempt.ClassesRoot.GetSubKeyNames.Contains("gEncrypt.clsEncrypt")Wbelow "gEncrypt.clsEncrypt" is ComName.ClassName.


Share
Improve this answer
Follow
edited Jul 25 "15 at 14:23
*

Peter Mortensen
27.9k2121 gold badges9494 silver badges123123 bronze badges
answered Jun 1 "11 at 16:12
*

javierjavier
3111 bronze badge
Add a comment |
2
Declare a guideline to InterfaceCall CoCreateInstance on the CLSID and IIDIf rerevolve value is not S_OK then class is not registered
Share
Improve this answer
Follow
answered Mar 27 "09 at 9:40
VinayVinay
4,67577 gold badges3131 silver badges4242 bronze badges
Add a comment |
2
course TestDll //Import your tested DLL right here public extern static int LoadLibrary(string lpLibFileName);try TestDll test = brand-new TestDll();catch(DllNotFoundException ex) return false;
Share
Improve this answer
Follow
edited Jul 25 "15 at 14:24
Peter Mortensen
27.9k2121 gold badges9494 silver badges123123 bronze badges
answered Nov 19 "10 at 14:52
FrancoisFrancois
2111 bronze badge
Add a comment |
2
If you know the CLSID of the COM dll, you deserve to simply inspect if there"s a key via that CLSID on HKEY_CLASSES_ROOTCLSIDCLSID-of-your-COM-component or HKEY_CLASSES_ROOTWow6432NodeCLSIDCLSID-of-your-COM-component (Wow6432Node => 32-little COM registered on a 64-little machine)

Here is an example:

private bool IsAlreadyRegistered() making use of (var classesRootKey = Microsoft.Win32.RegistryKey.OpenBaseKey( Microsoft.Win32.RegistryHive.ClassesRoot, Microsoft.Win32.RegistryView.Default)) const string clsid = "12345678-9012-3456-7890-123456789012"; var clsIdKey = classesRootKey.OpenSubKey(
"Wow6432NodeCLSID" + clsid) ?? classesRootKey.OpenSubKey(
"CLSID" + clsid); if (clsIdKey != null) clsIdKey.Dispose(); return true; rerevolve false;
Share
Improve this answer
Follow
answered Dec 5 "15 at 1:12
C. Augusto ProieteC. Augusto Proiete
15.1k22 gold badges3838 silver badges5656 bronze badges
Add a comment |
1
public extern static bool FreeLibrary(int hLibModule); public extern static int LoadLibrary(string lpLibFileName);public bool IsDllRegistered(string DllName) int libId = LoadLibrary(DllName); if (libId>0) FreeLibrary(libId); rerevolve (libId>0);
Share
Improve this answer
Follow
answered Mar 27 "09 at 9:40
BobbyShaftoeBobbyShaftoe
27.6k55 gold badges5050 silver badges7171 bronze badges
4
Add a comment |

Your Answer


Thanks for contributing an answer to Stack Overflow!

Please be sure to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to various other answers.Making statements based upon opinion; earlier them up through references or personal experience.

To learn even more, watch our tips on writing great answers.

See more: Windows Experience Index Update Fails


Draft saved
Draft discarded

Sign up or log in


Sign up using Google
Sign up using Facebook
Sign up utilizing Email and also Password
Submit

Message as a guest


Name
Email Required, yet never shown


Post as a guest


Name
Email

Required, yet never before shown


Blog post Your Answer Discard

By clicking “Article Your Answer”, you agree to our regards to organization, privacy plan and also cookie policy


The Overcirculation Blog
Featured on Meta
Visit chat
Linked
16
How to inspect if a COM component (EXE/DLL file) is registered or not (making use of .NET)?
0
how to discover install dll in C#
9
How to inspect COM dll is registered or not through C#?
11
How do I inspect if a COM dll is registered in C#
1
Checking if a DLL is registered
1
How perform I understand which dll is invoked in ASP page?
Related
1986
How do I calculate someone's age based on a DateTime type birthday?
3429
How deserve to I cast int to enum?
3968
How to enumerate an enum
1982
How execute I produce an Excel (.XLS and also .XLSX) file in C# without installing Microsoft Office?
2255
How execute I gain a continual byte representation of strings in C# without manually specifying an encoding?
884
Is tbelow a way to inspect if a file is in use?
290
Retrieving the COM course manufacturing facility for component through CLSID XXXX failed as a result of the adhering to error: 80040154
794
Metadata document '.dll' can not be discovered
1874
What is a NullReferenceException, and also how execute I settle it?
Hot Network-related Questions even more hot concerns

Question feed
Subscribe to RSS
Inquiry feed To subscribe to this RSS feed, copy and paste this URL right into your RSS reader.


lang-cs
Stack Overflow
Products
Company kind of
Stack Exchange Netjob-related
website design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.4.5.38983


Stack Overflow works best with JavaScript enabled
*

Your privacy

By clicking “Accept all cookies”, you agree Stack Exadjust can keep cookies on your tool and also disclose indevelopment in accordance through our Cookie Policy.