Prev: lineGetGeneralInfo
Next: C# FTP
From: esmo2000 on 11 Jul 2006 23:13 Hi everyone, I was working through the tutorial MSDN posted at http://msdn.microsoft.com/msdnmag/issues/05/06/SecurityBriefs/ for replacing the msgina.dll . I am trying to (like so many others) create an automatic logon (sadly, no, I cannot use the pgina out there as amazing as it is! And I don't have time to understand it). Unfortunately, I am going through a lot of troubles! Here is what I was trying to do: I want to have a service which runs on a system account to communicate with the gina through sockets. The service actually does a few things (my motivations for keeping it outside of the Gina itself are complexity and security. Right now it runs on .NET and I don't want to introduce its vulnerabilities into the Gina for obvious reasons.). Next, I made a thread which is created when the Gina starts to be responsible for talking to that service. I got this to work sucessfully, and the two communicate fine. The next part was where I had troubles. To be consistent with the winlogon structure, i used postmessage to post a message to the dialog window. The end result should be that a control sequence is generated with logon information sent. In other words, an automatic logon. However, the postmessage always returns the error message illegal window handle. This is being drawn write from the GinaModalDialog class. I checked and the window handle DOES exist when I call postmessage. As an extreme measure, I tried testing it like this in the gina.cpp class: int Gina::LoggedOutSAS(DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo, PVOID* ppWinLogonProfile) { ZeroMemory(pNprNotifyInfo, sizeof *pNprNotifyInfo); *pdwOptions = 0; // we always let WinLogon load the user profile for us wchar_t* profilePath = 0; const wchar_t* domain = 0; const wchar_t* userName = 0; const wchar_t* password = 0; LogonDialog dlg(_pWinLogon); if(PostMessage(dlg.Gethwnd(), WM_USER+0x1234, NULL, NULL) == 0) {LDB1(L"Post message failure %d.", GetLastError());} else {LDB(L"Post message dlgA success.");} .... } And as before, the error I get is 1400, invalid window handle. I can imagine this postmessage failing in other spots, but I'm baffled why this case could ever fail. If anyone could help, I would be eternally grateful!
|
Pages: 1 Prev: lineGetGeneralInfo Next: C# FTP |