2

I have to register dll in Windows registry for Custom Credential Provider. Current register.reg looks like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_CLASSES_ROOT\CLSID\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_CLASSES_ROOT\CLSID\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}\InprocServer32]
@="WLA.dll"
"ThreadingModel"="Apartment"

I have to copy dll to C:\Windows\System32 and run register.reg to make it work but I do not want this. Is it possible to register dll without having to move in System32 and register from present working directory where register.reg lies along with dll.

I am new to this, any help regarding this shall be appreciated.

Thanks!

Shaheryar
  • 73
  • 8
  • Registry files work the same no matter in which directory you execute them. But registry is probably looking for dll files in "Windows\system32" folder by default. I'm not sure how this works. Do you think adding an absolute path to the dll file in registry would work? – GChuf Mar 28 '20 at 11:22
  • I don't want to give an absolute path. I just want to register from present working directory and tried with ".\WLA.dll" and it did not work. Anyhow thanks @GašperČefarin – Shaheryar Mar 28 '20 at 12:58
  • You cannot do that in .reg files. You'll have to do it with variables in powershell or a batch script. – GChuf Mar 28 '20 at 13:18
  • Ok I shall try with that. Thanks – Shaheryar Mar 28 '20 at 13:39

1 Answers1

2

Assume you want to register from C:\WLA. Now, the register file will look like

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_CLASSES_ROOT\CLSID\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}]
@="WLA"

[HKEY_CLASSES_ROOT\CLSID\{5fd3d285-0dd9-4362-8855-e0abaacd4af6}\InprocServer32]
@="C:\\WLA\\WLA.dll"
"ThreadingModel"="Apartment"

It should work now.