Search code examples
c#c++winapiautologinrundll32

Inject text in a rundll32.exe window


I must enter a username/password within a rundll32.exe process window. I've tought of the following:

  1. Get Login window handle from the rundll32.exe process
  2. Focus the window
  3. Inject the text in 2 textbox and click the ok button

Is it possible to do that in .NET or I must resort to lower level win32 api? Anywone as done that before and could point me in the right direction?


Solution

  • You are attempting to retrieve the window handle of the Exchange login dialog of the MAPI application (probably outlook), FROM a rundll32.exe process. This can be done from .Net using the SendKeys class, but this is not completely reliable:

    Alternatively you could establish the NETBIOS session in advance using NetUseAdd to establish a session. If this is successful, you will not need to enter the username and password. I don't know if this works with Exchange, but it does work with some other applications which use integrated authentication: