如何屏蔽 Ctrl和Alt之间的Win和App键?或告知他们的键值也行。(100分)

  • 主题发起人 主题发起人 老赵
  • 开始时间 开始时间

老赵

Unregistered / Unconfirmed
GUEST, unregistred user!
如题。Tab的键值?
 
Tab的键值? VK_TAB
 
键值:VK_LWIN,VK_RWIN,VK_APPS
屏蔽比较难,据说用 Vxd 很容易,找一个叫 热血 的大富翁,他做过。
你找 ID = 234079 的贴子。
 
VK_LWIN = 91;
VK_RWIN = 92;
VK_APPS = 93;
 
左Win键 : #91 OR $5B
右Win键 : #92 OR $5C
右App键 : #93 OR $5D

 
如何才能屏蔽呢?
 
转:
WINDOWS NT/2000下如何屏蔽CTRL+ALT+DEL
作者:ac952_z_cn

前言
在WINDOWS 9X环境中我们可以使用SystemParametersInfo (SPI_SCREENSAVERRUNNING, 1,NULL, 0);来屏蔽CTRL+ALT+DEL,但在NT/2000环境下却行不通,即使使用WH_KEYBOARD_LL这个低级的键盘hook也无法拦截!笔者通过替换GINA DLL的方式很好地实现了在NT/2000下屏蔽CTRL+ALT+DEL的功能。

下载源代码 6K

一、原理
在NT/2000中交互式的登陆支持是由WinLogon调用GINA DLL实现的,GINA DLL提供了一个交互式的界面为用户登陆提供认证请求。在WinLogon初始化时,就向系统注册截获CTRL+ALT+DEL消息,所以其他程序就无法得到CTRL+ALT+DEL的消息。
WinLogon会和GINA DLL进行交互,缺省是MSGINA.DLL(在System32目录下)。微软同时也为我们提供的接口,自己
可以编GINA DLL来代替MSGINA.DLL。

WinLogon初始化时会创建3个桌面:
(1)、winlogon桌面:主要显示window 安全等界面,如你按下CTRL+ALT+DEL,登陆的界面等
(2)、应用程序桌面:我们平时见到的那个有我的电脑的界面
(3)、屏幕保护桌面:屏幕保护显示界面。

在用户登陆以后,按下CTRL+ALT+DEL键的时候,WinLogon回调用GINA DLL的输出函数:WlxLoggedOnSAS,
这时正处于winlogon桌面,我们只要直接将他转向应用程序桌面,系统就不会显示Windows安全那个界面,换一种说法
也就是用户按下CTRL+ALT+DEL后,不会起什么作用。当是我们在切换桌面的时候会出现屏幕闪动!

二、程序实现
GINA DLL要输出下列函数(winlogon会调用)
WlxActivateUserShell
WlxDisplayLockedNotice
WlxDisplaySASNotice
WlxDisplayStatusMessage
WlxGetStatusMessage
WlxInitialize
WlxIsLockOk
WlxIsLogoffOk
WlxLoggedOnSAS
WlxLoggedOutSAS
WlxLogoff
WlxNegotiate
WlxNetworkProviderLoad
WlxRemoveStatusMessage
WlxScreenSaverNotify
WlxShutdown
WlxStartApplication
WlxWkstaLockedSAS
为了简化编程,我们从MSGINA.DLL中动态获取上诉函数,在自定义的DLL中(以下称为NoReboot.DLL)中直接调用MSGINA.DLL
的函数即可。现在我们要处理的就是WlxLoggedOnSAS函数:


int WINAPI WlxLoggedOnSAS (
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved)
{
HANDLE hMutex;
WriteInfo("WlxLoggedOnSAS /r/n"); //用于记录信息
if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL){ //屏蔽CTRL_ALT_DEL,也可以根据特定条件来决定是否要屏蔽
//我采用了Mutex来控制是否屏蔽,(注意:要用unicode)
hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, L"_ac952_z_cn_CTRL_ALT_DEL");
if (hMutex){
CloseHandle(hMutex);
WriteInfo("disble CTRL+ALT+DEL /r/n");
return WLX_SAS_ACTION_NONE; //将屏幕切换到应用程序桌面,屏蔽掉CTRL+ALT+DEL
}
else
WriteInfo("not disble CTRL+ALT+DEL /r/n");
}
return prcWlxLoggedOnSAS ( //这是我从MSGINA.DLL中获取的函数。
pWlxContext,
dwSasType,
pReserved);
}

我们要在自己的程序中调用hMutex = CreateMutex(NULL, FALSE, "_ac952_z_cn_CTRL_ALT_DEL");就可屏蔽CTRL+ALT+DEL。

三、安装和注意事项:

在编写GIAN DLL中要注意,GINA DLL使用的是unicode。

GINA DLL的安装:
键名 : /HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/Winlogon
变量名 : GinaDLL
变量类型 : [REG_SZ]
内容 : "你的GINA DLL的名称" 如:"NoReboot.DLL:

将你的GINA DLL(NoReboot.dll)拷贝到系统目录下(system32),重启机器,你的GINA DLL(NoReboot.dll)就会运行。
如果出现进不了你的系统,那你进入DOS后,将msgina.dll拷贝成你的GINA DLL(NoReboot.dll)就可进入了,或者进入
安全模式,删除掉那个键值。
 
VK_LWIN = 91;
VK_RWIN = 92;
VK_APPS = 93;
其他的:
vk_LButton = $01;
vk_RButton = $02;
vk_Cancel = $03;
vk_MButton = $04; { NOT contiguous with L & RBUTTON }
vk_Back = $08;
vk_Tab = $09;
vk_Clear = $0C;
vk_Return = $0D;
vk_Shift = $10;
vk_Control = $11;
vk_Menu = $12;
vk_Pause = $13;
vk_Capital = $14;
vk_Escape = $1B;
vk_Space = $20;
vk_Prior = $21;
vk_Next = $22;
vk_End = $23;
vk_Home = $24;
vk_Left = $25;
vk_Up = $26;
vk_Right = $27;
vk_Down = $28;
vk_Select = $29;
vk_Print = $2A;
vk_Execute = $2B;
vk_SnapShot = $2C;
vk_Copy = $2C not used by keyboards }
vk_Insert = $2D;
vk_Delete = $2E;
vk_Help = $2F;
vk_A thru vk_Z are the same as their ASCII equivalents: 'A' thru 'Z' }
vk_0 thru vk_9 are the same as their ASCII equivalents: '0' thru '9' }
vk_NumPad0 = $60;
vk_NumPad1 = $61;
vk_NumPad2 = $62;
vk_NumPad3 = $63;
vk_NumPad4 = $64;
vk_NumPad5 = $65;
vk_NumPad6 = $66;
vk_NumPad7 = $67;
vk_NumPad8 = $68;
vk_NumPad9 = $69;
vk_Multiply = $6A;
vk_Add = $6B;
vk_Separator = $6C;
vk_Subtract = $6D;
vk_Decimal = $6E;
vk_Divide = $6F;
vk_F1 = $70;
vk_F2 = $71;
vk_F3 = $72;
vk_F4 = $73;
vk_F5 = $74;
vk_F6 = $75;
vk_F7 = $76;
vk_F8 = $77;
vk_F9 = $78;
vk_F10 = $79;
vk_F11 = $7A;
vk_F12 = $7B;
vk_F13 = $7C;
vk_F14 = $7D;
vk_F15 = $7E;
vk_F16 = $7F;
vk_F17 = $80;
vk_F18 = $81;
vk_F19 = $82;
vk_F20 = $83;
vk_F21 = $84;
vk_F22 = $85;
vk_F23 = $86;
vk_F24 = $87;
vk_NumLock = $90;
vk_Scroll = $91;
 
值得看看!
 
[blue]看看下面吧!~[:D]
VK_LWIN = 91;
VK_RWIN = 92;
VK_APPS = 93;
其他的:
vk_LButton = $01;
vk_RButton = $02;
vk_Cancel = $03;
vk_MButton = $04; { NOT contiguous with L & RBUTTON }
vk_Back = $08;
vk_Tab = $09;
vk_Clear = $0C;
vk_Return = $0D;
vk_Shift = $10;
vk_Control = $11;
vk_Menu = $12;
vk_Pause = $13;
vk_Capital = $14;
vk_Escape = $1B;
vk_Space = $20;
vk_Prior = $21;
vk_Next = $22;
vk_End = $23;
vk_Home = $24;
vk_Left = $25;
vk_Up = $26;
vk_Right = $27;
vk_Down = $28;
vk_Select = $29;
vk_Print = $2A;
vk_Execute = $2B;
vk_SnapShot = $2C;
vk_Copy = $2C not used by keyboards }
vk_Insert = $2D;
vk_Delete = $2E;
vk_Help = $2F;
vk_A thru vk_Z are the same as their ASCII equivalents: 'A' thru 'Z' }
vk_0 thru vk_9 are the same as their ASCII equivalents: '0' thru '9' }
vk_NumPad0 = $60;
vk_NumPad1 = $61;
vk_NumPad2 = $62;
vk_NumPad3 = $63;
vk_NumPad4 = $64;
vk_NumPad5 = $65;
vk_NumPad6 = $66;
vk_NumPad7 = $67;
vk_NumPad8 = $68;
vk_NumPad9 = $69;
vk_Multiply = $6A;
vk_Add = $6B;
vk_Separator = $6C;
vk_Subtract = $6D;
vk_Decimal = $6E;
vk_Divide = $6F;
vk_F1 = $70;
vk_F2 = $71;
vk_F3 = $72;
vk_F4 = $73;
vk_F5 = $74;
vk_F6 = $75;
vk_F7 = $76;
vk_F8 = $77;
vk_F9 = $78;
vk_F10 = $79;
vk_F11 = $7A;
vk_F12 = $7B;
vk_F13 = $7C;
vk_F14 = $7D;
vk_F15 = $7E;
vk_F16 = $7F;
vk_F17 = $80;
vk_F18 = $81;
vk_F19 = $82;
vk_F20 = $83;
vk_F21 = $84;
vk_F22 = $85;
vk_F23 = $86;
vk_F24 = $87;
vk_NumLock = $90;
vk_Scroll = $91;
[/blue]
 
你的系统是WIN9X还是基于NT的?
 
都有
现在是NT,将来肯定有98。
 
在Win9x下,屏蔽很容易!简单和复杂的方法都有!但是在NT/2000中就难多了,我也不知道
听听其他的高手,学习学习!!!!
 
你只是想屏蔽还想知道键值?
 
当然是屏蔽。
 
一定要用到HOOK的
帮你找找看
好像重庆一家公司的有一个代码
找找看
 
很简单的一行代码:
uses SysUtils,windows,mmsystem;
procedure SystemKey();
var
temp:integer;
begin
{屏蔽系统键}
SystemParametersInfo(spi_screensaverrunning,1,@temp,0);
{释放系统键}
SystemParametersInfo(spi_screensaverrunning,0,@temp,0);
end;
仅供参考!谢谢!
 
请看这里
http://www.delphibbs.com/delphibbs/dispq.asp?lid=754593
帮我回答,和这个差不多,我这里有gina的VC原程序,那为大哥翻成DELPHI
 
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
i:byte;
begin
i:=1;
case (sender as tspeedbutton).groupindex of
1: i:=$10;
2: i:=$12;
3: i:=$11;
4: i:=20;
5: i:=144;
6: i:=145;
7: i:=9;
8: i:=27;
9: i:=91;
end;
if (sender as tspeedbutton).down=true then
clientform.send('keydown'+chr(i))
else
clientform.send('keyup'+chr(i));
end;
----------------------------------------------------------------------------object Form1: TForm1
Left = 460
Top = 213
AutoSize = True
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = '特殊按键'
ClientHeight = 89
ClientWidth = 186
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsStayOnTop
Icon.Data = {
0000010001001010100000000000280100001600000028000000100000002000
00000100040000000000C0000000000000000000000000000000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
000000000000000000BBBB00000000000BB00BB000000000BB0000BB00000000
BBB00BBB0000000BBBBBBBBBB000000000BBBB0000000000000BB00000000000
F000000F00000000000BB000000000000BBBBBB000000BBBBBBBBBBBBBB00BBB
00000000BBB00B00BBBBBBBB00B000000BBBBBB000000000000000000000FC3F
0000F81F0000F00F0000E0070000E0070000C0030000C0030000800100008001
00008001000080010000000000000000000000000000300C0000781E0000}
OldCreateOrder = False
Position = poDesktopCenter
OnKeyDown = FormKeyDown
OnKeyUp = FormKeyUp
PixelsPerInch = 96
TextHeight = 13
object SpeedButton2: TSpeedButton
Tag = 2
Left = 64
Top = 0
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 2
Caption = 'Alt'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton3: TSpeedButton
Tag = 3
Left = 128
Top = 0
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 3
Caption = 'Ctrl'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton4: TSpeedButton
Tag = 4
Left = 0
Top = 32
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 4
Caption = 'Capslock'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton5: TSpeedButton
Tag = 5
Left = 64
Top = 32
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 5
Caption = 'Numlock'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton6: TSpeedButton
Tag = 6
Left = 129
Top = 32
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 6
Caption = 'Scrolllock'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton7: TSpeedButton
Tag = 7
Left = 0
Top = 64
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 7
Caption = 'Tab'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton8: TSpeedButton
Tag = 8
Left = 64
Top = 64
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 8
Caption = 'Esc'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton9: TSpeedButton
Tag = 9
Left = 129
Top = 64
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 9
Caption = 'Win'
Spacing = 0
OnClick = SpeedButton1Click
end
object SpeedButton1: TSpeedButton
Tag = 9
Left = 1
Top = 0
Width = 57
Height = 25
AllowAllUp = True
GroupIndex = 1
Caption = 'Shift'
Spacing = 0
OnClick = SpeedButton1Click
end
end
 
后退
顶部