Solved

How can I Disable and enable ( alt+ctrl+del  ,  alt+tab and alt+f4)?

Posted on 2004-03-25
5
2,058 Views
Last Modified: 2009-07-29
How can I Disable and enable ( alt+ctrl+del  ,  alt+tab and alt+f4) under win9x – winme – winxp .

I am waiting your answers
Thanks
0
Comment
Question by:peruzzi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Accepted Solution

by:
calinutz earned 75 total points
ID: 10675548
Under XP try this

procedure DisableTaskMgr(bTF: Boolean);
var
  reg: TRegistry;
begin
  reg := TRegistry.Create;
  reg.RootKey := HKEY_CURRENT_USER;

  reg.OpenKey('Software', True);
  reg.OpenKey('Microsoft', True);
  reg.OpenKey('Windows', True);
  reg.OpenKey('CurrentVersion', True);
  reg.OpenKey('Policies', True);
  reg.OpenKey('System', True);

  if bTF = True then
  begin
    reg.WriteString('DisableTaskMgr', '1');
  end
  else if bTF = False then
  begin
    reg.DeleteValue('DisableTaskMgr');
  end;
  reg.CloseKey;
end;

Of course call it with true like
DisableTaskMgr(True);
0
 

Author Comment

by:peruzzi
ID: 10677309
Hi calinutz
it is an excelant code ,but I also need a solution for alt+f4 and alt+tab

I am waiting

thanks
0
 
LVL 7

Assisted Solution

by:knightmad
knightmad earned 50 total points
ID: 10687537
Take a look at http://geocities.yahoo.com.br/armlessjohn/Hidden_Resources.html, I posted source and binaries for both your questions.
Regards,
Fernando (a.k.a knightmad)
0
 

Author Comment

by:peruzzi
ID: 10690598
Hi guys
thanks for your help

peruzzi
0
 

Expert Comment

by:smhp
ID: 10797048
// Filename: lsGina
// Author  : Sima HuaPeng
// Mail      :smhp@playicq.com
// Time    : 2002-10-13
// GINA    : Graphical Identification and Authentication
// SAS     : Secure Attention Sequence

library lsGina;

uses
  Windows,
  Messages,
  SysUtils,
  Classes,
  Winwlx,
  Define in 'Define.pas';

var
   myHandle:THandle=0;
   hGlobalWlx:THandle=0;
   g_pWinlogon:Pointer;


{$R *.res}

//------------------------------------------------------------------------------
// 用户登陆成功后,Winlogon.exe调用该函数启动用户外壳程序
function WlxActivateUserShell (
                                pWlxContext: Pointer;
                                pszDesktopName: PWideChar;
                                pszMprLogonScript: PWideChar;
                                pEnvironment: Pointer
                                ): BOOL; stdcall;
begin
    WriteInfo('WlxActivateUserShell'+ #13#10);

    //LockWS();                               // 登陆成功后,开始验证身份
   
    Result:=prcWlxActivateUserShell (pWlxContext,pszDesktopName,pszMprLogonScript,pEnvironment);
end;



//------------------------------------------------------------------------------
// 当没有任何用户登陆时,Winlogon.exe调用该函数显示一些提示信息
// 可以根据用户的动作模拟SAS事件的发送
procedure WlxDisplaySASNotice (pWlxContext:Pointer); stdcall;
begin
    prcWlxDisplaySASNotice(pWlxContext);
end;

//------------------------------------------------------------------------------
// 初始化,winlogon.exe向gina dll传递需要版本的接口函数分配表
function WlxInitialize (
    lpWinsta: PWideChar;
    hWlx: THandle;
    pvReserved: Pointer;
    pWinlogonFunctions: Pointer;
    var pWlxContext: Pointer
    ): BOOL; stdcall;
begin
    hGlobalWlx := hWlx;
    g_pWinlogon := pWinlogonFunctions;
    Result:=prcWlxInitialize (lpWinsta,hWlx,pvReserved,pWinlogonFunctions,pWlxContext);
end;

//------------------------------------------------------------------------------
// 当系统处于登陆成功,没有锁定的状态下
// Winlogon接收到SAS事件,于是调用该函数
// 现根据设置屏蔽所有事件,直接返回
function WlxLoggedOnSAS (pWlxContext:Pointer;dwSasType:DWORD;pReserved:Pointer):Integer; stdcall;
var      
   hMutex:THANDLE;
begin
   WriteInfo('WlxLoggedOnSAS' + #13#10);
   if ( dwSasType = WLX_SAS_TYPE_CTRL_ALT_DEL)          or
      ( dwSasType = WLX_SAS_TYPE_USER_LOGOFF   )        or
      ( dwSasType = WLX_SAS_TYPE_SCRNSVR_TIMEOUT )      or
      ( dwSasType = WLX_SAS_TYPE_TIMEOUT )              or
      ( dwSasType = WLX_SAS_TYPE_SWITCHUSER)  then
       begin //屏蔽CTRL_ALT_DEL,也可以根据特定条件来决定是否要屏蔽
         hMutex := OpenMutex(MUTEX_ALL_ACCESS, FALSE, 'SIMA_CTRL_ALT_DEL');   //我采用了Mutex来控制是否屏蔽,(注意:要用unicode)
         if (hMutex<>0) then
           begin
             CloseHandle(hMutex);
             WriteInfo('disble CTRL+ALT+DEL'+ #13#10);
             Result:=WLX_SAS_ACTION_NONE;
               Exit;
         end
         else  begin
             WriteInfo('not disble CTRL+ALT+DEL'+ #13#10);
           end;
   end;

   Result:=prcWlxLoggedOnSAS (pWlxContext,dwSasType,pReserved);
end;

//-------------------------------------------------------------------------------------------
// &#22312;&#27809;&#26377;&#20219;&#20309;&#19968;&#20010;&#29992;&#25143;&#30331;&#38470;&#30340;&#24773;&#20917;&#19979;&#65292;Winlogon.exe&#25509;&#25910;&#21040;SAS&#20107;&#20214;&#35843;&#29992;&#35813;&#20989;&#25968;
function WlxLoggedOutSAS (
    pWlxContext: Pointer;
    dwSasType: DWORD;
    pAuthenticationId: PLargeInteger; // PLUID
    pLogonSid: Pointer; // PSID
    pdwOptions: PDWORD;
    var phToken: THandle;
    pNprNotifyInfo: PWLX_MPR_NOTIFY_INFO;
    var pProfile: Pointer
    ): Integer; stdcall;
begin
  WriteInfo('WlxLoggedOutSAS'+ #13#10);

  Result:=prcWlxLoggedOutSAS (
        pWlxContext,
        dwSasType,
        pAuthenticationId,
        pLogonSid,
        pdwOptions,
        phToken,
        pNprNotifyInfo,
        pProfile);
end;

//-------------------------------------------------------------------------------------------
// Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#65292;&#36890;&#30693;gina dll&#29992;&#25143;&#27880;&#38144;&#25805;&#20316;
// &#20801;&#35768;gina dll&#20570;&#20986;&#30456;&#24212;&#30340;&#22788;&#29702;
procedure WlxLogoff(
    pWlxContext: Pointer
    ); stdcall;
begin
   WriteInfo('WlxLogoff \r\n');

   prcWlxLogoff(pWlxContext);
end;

//-------------------------------------------------------------------------------------------
// Winlogon.exe&#35843;&#29992;&#30340;gina dll&#20013;&#30340;&#31532;&#19968;&#20010;&#20989;&#25968;
// &#20351;gina dll&#30830;&#35748;&#26159;&#21542;&#25903;&#25345;&#24403;&#21069;&#29256;&#26412;&#30340;Winlogon.exe
// &#20256;&#36882;&#32473;winlogon.exe&#38656;&#35201;&#37027;&#20010;&#29256;&#26412;&#30340;&#25509;&#21475;&#20989;&#25968;
function WlxNegotiate (
    dwWinlogonVersion: DWORD;
    pdwDllVersion: PDWORD
    ): BOOL; stdcall;
begin
   WriteInfo('WlxNegotiate \r\n');
   Result:=prcWlxNegotiate (
                  dwWinlogonVersion,
                  pdwDllVersion);
end;

//-------------------------------------------------------------------------------------------
// &#22312;&#23631;&#20445;&#31243;&#24207;&#21551;&#21160;&#21069;&#19968;&#30636;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#65292;&#20801;&#35768;gina dll&#21516;&#23631;&#20445;&#31243;&#24207;&#20132;&#20114;
// &#36820;&#22238;FALSE&#34920;&#31034;&#23631;&#20445;&#31243;&#24207;&#19981;&#33021;&#21551;&#21160;
function WlxScreenSaverNotify(
    pWlxContext: Pointer;
    var pSecure: BOOL
    ): BOOL; stdcall;
begin
      WriteInfo('WlxScreenSaverNotify \r\n');
      Result:= prcWlxScreenSaverNotify (
              pWlxContext,
              pSecure);
end;

//-------------------------------------------------------------------------------------------
// &#22312;&#31995;&#32479;&#20851;&#38381;&#20043;&#21069;&#65292;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;
// &#20801;&#35768;gina dll&#22788;&#29702;&#19968;&#20123;&#31995;&#32479;&#20851;&#38381;&#21069;&#30340;&#22788;&#29702;
procedure WlxShutdown(
    pWlxContext: Pointer;
    ShutdownType: DWORD
    ); stdcall;
begin

      WriteInfo('WlxShutdown \r\n');

      prcWlxShutdown(pWlxContext, ShutdownType);
end;

//-------------------------------------------------------------------------------------------
// &#24403;&#31995;&#32479;&#35201;&#27714;&#22312;&#29992;&#25143;&#19978;&#19979;&#25991;&#20013;&#21551;&#21160;&#31243;&#24207;&#65292;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;
// &#36825;&#31181;&#24773;&#20917;&#21457;&#29983;&#22312;&#65306;&#27983;&#35272;&#22120;&#38750;&#27491;&#24120;&#20851;&#38381;&#38656;&#35201;&#37325;&#21551;&#25110;&#38656;&#35201;&#21551;&#21160;&#25193;&#23637;&#30340;&#20219;&#21153;&#31649;&#29702;&#22120;
// &#35813;&#25509;&#21475;gina dll&#21487;&#20197;&#36873;&#25321;&#24615;&#23454;&#29616;
function WlxStartApplication(
    pWlxContext: Pointer;
    pszDesktopName: PWideChar;
    pEnvironment: Pointer;
    pszCmdLine: PWideChar
    ): BOOL; stdcall;
begin
      WriteInfo('WlxStartApplication \r\n');
      Result:= prcWlxStartApplication (
                    pWlxContext,
                    pszDesktopName,
                    pEnvironment,
                    pszCmdLine);
end;

//------------------------------------------------------------------------------
// &#22312;&#38145;&#23450;&#29366;&#24577;&#19979;&#65292;Winlogon.exe&#25509;&#25910;&#21040;SAS&#20107;&#20214;&#35843;&#29992;&#35813;&#20989;&#25968;
// &#22312;&#36825;&#37324;&#36820;&#22238;&#26080;&#25928;&#20449;&#24687;&#65292;&#21017;&#21487;&#20197;&#23631;&#34109;&#38145;&#23450;&#29366;&#24577;&#19979;&#30340;&#28040;&#24687;
function WlxWkstaLockedSAS(
    pWlxContext: Pointer;
    dwSasType: DWORD
    ): Integer; stdcall;
begin
      WriteInfo('WlxWkstaLockedSAS \r\n');
      Result:= prcWlxWkstaLockedSAS (
              pWlxContext,
              dwSasType
            );
end;

//------------------------------------------------------------------------------
// &#31383;&#21475;&#36807;&#31243;
function LockedOffDlgProc(hwndDlg: HWnd;
                    Msg: UINT;
                    wParam: wParam;
                    lParam: lPARAM): integer; stdcall;

begin
   Case Msg of
        WM_INITDIALOG:;                              //&#31383;&#21475;&#30340;&#21021;&#22987;&#21270;
      WM_TIMER:;
   end;
   Result:=-1;
end;

//------------------------------------------------------------------------------
// &#24403;&#31995;&#32479;&#22788;&#20110;&#38145;&#23450;&#29366;&#24577;&#26102;&#65292;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;
// &#26174;&#31034;&#19968;&#20123;&#20449;&#24687;&#65292;&#22914;&#38145;&#23450;&#32773;&#12289;&#38145;&#23450;&#26102;&#38388;&#31561;
procedure WlxDisplayLockedNotice(pWlxContext:Pointer);stdcall;
var
   hDlgRet:Integer;
begin
      {hDlgRet := PWLX_DISPATCH_VERSION_1_3(g_pWinlogon).WlxDialogBoxParam
                                                    (
                                                            hGlobalWlx,
                                                            myHandle,
                                                      pWideChar(MAKEINTRESOURCE(100)),
                                                            0,
                                                            @LockedOffDlgProc,
                                                            0);
   
      if (hDlgRet=-1) then
      begin
           prcWlxDisplayLockedNotice(pWlxContext);
      end;}

        prcWlxDisplayLockedNotice(pWlxContext);
      WriteInfo('WlxDisplayLockedNotice \r\n');

end;

//------------------------------------------------------------------------------
// &#24403;gina dll&#35201;&#26174;&#31034;&#19968;&#20123;&#20449;&#24687;&#26102;&#65292;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;
// &#30452;&#25509;&#36820;&#22238;TRUE&#34920;&#31034;&#20449;&#24687;&#24050;&#32463;&#26174;&#31034;
function WlxDisplayStatusMessage(
    pWlxContext: Pointer;
    hDesktop: HDESK;
    dwOptions: DWORD;
    pTitle: PWideChar;
    pMessage: PWideChar
    ): BOOL; stdcall;
begin
      Result:=prcWlxDisplayStatusMessage(
                    pWlxContext,
                    hDesktop,
                    dwOptions,
                    pTitle,
                    pMessage
                         );
end;

//------------------------------------------------------------------------------
// Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#24471;&#21040;gina dll&#26174;&#31034;&#30340;&#29366;&#24577;&#20449;&#24687;
// &#30452;&#25509;&#36820;&#22238;TRUE&#34920;&#31034;&#20449;&#24687;&#24050;&#32463;&#25509;&#25910;
function WlxGetStatusMessage(
    pWlxContext: Pointer;
    var pdwOptions: DWORD;
    pMessage: PWideChar;
    dwBufferSize: DWORD
    ): BOOL; stdcall;
begin
      WriteInfo('WlxGetStatusMessage'+#13#10);
      Result:=prcWlxGetStatusMessage(
                    pWlxContext,
                    pdwOptions,
                    pMessage,
                    dwBufferSize
                  );
end;

//------------------------------------------------------------------------------
// &#22312;&#35797;&#22270;&#38145;&#23450;&#24037;&#20316;&#31449;&#20043;&#21069;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#65292;&#21028;&#26029;&#26159;&#21542;&#21487;&#20197;&#38145;&#23450;
// &#30452;&#25509;&#36820;&#22238;FALSE&#34920;&#31034;&#19981;&#33021;&#38145;&#23450;
function WlxIsLockOk(pWlxContext:Pointer):boolean;stdcall;
begin
        WriteInfo('WlxIsLogoffOk'+#13#10);
      Result:=prcWlxIsLockOk(pWlxContext);
end;

//------------------------------------------------------------------------------
// &#22312;&#35797;&#22270;&#27880;&#38144;&#26102;Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#65292;&#21028;&#26029;&#33021;&#21542;&#27880;&#38144;
// &#30452;&#25509;&#36820;&#22238;FALSE&#34920;&#31034;&#19981;&#33021;&#27880;&#38144;
function  WlxIsLogoffOk(pWlxContext:Pointer):boolean;stdcall;
begin
      WriteInfo('WlxIsLogoffOk'+#13#10);
      Result:=prcWlxIsLogoffOk(pWlxContext);
end;

//------------------------------------------------------------------------------
// Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#25910;&#38598;&#26377;&#25928;&#30340;&#35748;&#35777;&#20449;&#24687;
// &#36820;&#22238;TRUE&#34920;&#31034;&#29992;&#25143;&#34987;&#35782;&#21035;
function WlxNetworkProviderLoad(pWlxContext:Pointer;
                                pNprNotifyInfo:PWLX_MPR_NOTIFY_INFO):boolean;stdcall;
begin
      WriteInfo('WlxNetworkProviderLoad'+#13#10);
      Result:=prcWlxNetworkProviderLoad(pWlxContext,pNprNotifyInfo);
end;

//------------------------------------------------------------------------------
// Winlogon.exe&#35843;&#29992;&#35813;&#20989;&#25968;&#65292;&#21578;&#35785;gina dll&#20572;&#27490;&#26174;&#31034;&#29366;&#24577;&#20449;&#24687;
// &#30452;&#25509;&#36820;&#22238;TRUE&#34920;&#31034;&#20449;&#24687;&#24050;&#32463;&#21024;&#38500;
function WlxRemoveStatusMessage(pWlxContext:Pointer):Boolean;stdcall;
begin
        WriteInfo('WlxRemoveStatusMessage' + #13#10);
        Result:=prcWlxRemoveStatusMessage(pWlxContext);
end;

//------------------------------------------------------------------------------
procedure DllEntryPoint(dwReason:DWORD);
begin
  case dwReason of
       DLL_PROCESS_ATTACH:
            begin
                //myHandle = hinstDLL;
                if LoadMsGina then
                        WriteInfo('Init gina ok' + #13#10)
                else
                        WriteInfo('Init gina false' + #13#10);
            end;
        DLL_PROCESS_DETACH:
            Begin
                ReleaseMsGina;
                WriteInfo('release gina ok \r\n');
            end;
    end;
end;


exports
      WlxActivateUserShell                    Index 2,
      WlxDisplayLockedNotice                  Index 3,
      WlxDisplaySASNotice                  Index 4,
      WlxDisplayStatusMessage                  Index 5,
      WlxGetStatusMessage                  Index 6,
      WlxInitialize                        Index 7,
      WlxIsLockOk                        Index 8,
      WlxIsLogoffOk                        Index 9,
      WlxLoggedOnSAS                        Index 10,
      WlxLoggedOutSAS                        Index 11,
      WlxLogoff                        Index 12,
      WlxNegotiate                        Index 13,
      WlxNetworkProviderLoad                  Index 14,
      WlxRemoveStatusMessage                  Index 15,
      WlxScreenSaverNotify                  Index 16,
      WlxShutdown                        Index 17,
      WlxStartApplication                  Index 18,
      WlxWkstaLockedSAS                  Index 19;


begin
   DllProc:=@DllEntryPoint;
   DllEntryPoint(DLL_PROCESS_ATTACH);
   
end.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question