0

I had created a dll file(using C++) which captures password changes. Now I need to send it to a Windows service(created by me using C#) which uses WCF service. How to communicate with the service?

(the dll is primitive,without classes,and uses _stdcall as it needs to called by Windows OS)

Or are there any other ways to do it? Can the dll itself can be written in C#?(unmanaged)

rampireram
  • 481
  • 2
  • 7
  • 16
  • possible duplicate of [Create WCF service for unmanaged C++ clients](http://stackoverflow.com/questions/686452/create-wcf-service-for-unmanaged-c-clients) – Scott Chamberlain Jan 24 '14 at 06:00
  • That doesn't work the way I want to! – rampireram Jan 24 '14 at 06:02
  • 1
    Well you haven't really explained what you want so how would we know. – Scott Chamberlain Jan 24 '14 at 06:03
  • In my dll, there will be 3 methods and just tat.. PasswordChangeNotify, PasswordInitialize and PasswordFilter .. And if i add any other methods, it wouldn't work! It never fires when password is changed – rampireram Jan 24 '14 at 06:09
  • I don't understand, you are saying it does work when you have only those 3 methods but if you add a 4th it stops working. Also you would need to make `PasswordChangeNotify` call your new 4th method, it would not work on it's own. – Scott Chamberlain Jan 24 '14 at 06:11
  • Ya.. but as we use certain assemblies, the dll gets certain dependencies and its no longer a native(independent) dll and thats wer the problem starts I guess ! – rampireram Jan 24 '14 at 06:17

1 Answers1

1

I was in a similar situation as you and I found a much easier solution. The sourceforge project passwdhk gives you a pre-made native DLL that implements the password filter interface. That DLL then will launch a external program (which you can write entirely in C#) and passing the username and password information in as arguments.

Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
  • That helps! And I already had a look.. But being in an organisation I can't trust 3rd party apps. – rampireram Jan 24 '14 at 06:18
  • But you will trust strangers on a question and answer site? Also the entire program is less than 2k lines of code (likely less than 1k if you don't count blank lines and comments), you could easily review the entire program before compiling it and deploying it (or stealing the idea and implementing the same solution yourselves) – Scott Chamberlain Jan 24 '14 at 06:19