Hello Pradeep,
Thanks for your post. As I understand, you want to capture the
Ctrl-Alt-Delete programmatically. Please correct me if there is
any misunderstanding. I'd like to share the following information with you:
To trap Ctrl+Alt+Del, generally speaking, you have three options: write a
GINA stub, write a keyboard driver, or replace TaskMgr.exe with your own
program. Creating a GINA stub is comparatively easy to implement among
these three options.
Yves is correct that we have to use VC instead of C#, VB to implement a
GINA Stub. As you know, a GINA Stub is a native dynamic-link library (DLL)
exported to Winlogon that requires a valid, consistent function to call
into. This requires a DLL export, which .NET Framework does not support.
Managed code (VB .NET, C#) has no concept of a consistent value for a
function pointer because these function pointers are proxies that are built
dynamically.
There is an existing GINA Stub sample in MSDN. To trap Ctrl-Alt-Delete, you
just need to replace its lxLoggedOnSAS with the one in my code snippet
below.
GinaStub Sample: Pass-through "Stub" Gina
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/
html/vcsmpginastubsample.asp?frame=true
/*----------------------------code snippet----------------------*/
int
WINAPI
WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved)
{
if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
{
/* Add additional code of you own */
return WLX_SAS_ACTION_NONE;
}
else
return GWlxLoggedOnSAS( pWlxContext, dwSasType, pReserved );
}
/*-----------------------------end of--------------------------------*/
In addition, I believe the following MSDN aritcles are helpful:
Typename, Disabling Keys in Windows XP with TrapKeys
http://msdn.microsoft.com/msdnmag/issues/02/09/CQA/default.aspx
WlxLoggedOnSAS
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/se
curity/wlxloggedonsas.asp
Loading and Running a GINA DLL
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/se
curity/loading_and_running_a_gina_dll.asp
Please feel free to let me know if you have any problems or concerns.
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! --
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.