首页
论坛
专栏
课程

[原创]多桌面切换程序-通杀所有网管程序

2007-11-29 00:11 15708

[原创]多桌面切换程序-通杀所有网管程序

2007-11-29 00:11
15708
程序说明:
   程序启动后没用任何界面,只会再创建一个桌面,用WIN+1和WIN+2组合键在两个桌面间切换。一个桌面用于工作,一个桌面用于娱乐,互不干扰。


;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;  Programmed by nohacks, nohacks@163.com
;  Website: http://hi.baidu.com/nohacks
;           Win32 ASM is Masm
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;  版本信息
;     多桌面切换系统V1.0 -  可以两个桌面之间任意切换
;     
;                         2007年 11 月  28 日
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.486 
.model flat,stdcall 
option casemap:none 

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        Include 数据
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc 
include kernel32.inc 
include shell32.inc
include advapi32.inc

include debug.inc
includelib kernel32.lib 
include user32.inc 
includelib user32.lib 
includelib shell32.lib
includelib advapi32.lib

m2m	Macro M1,M2
	push	M2
	pop		M1
endm

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        Equ 数据 RC资源
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CREATE_DEFAULT_ERROR_MODE EQU         4000000H
ICO_ICO                   EQU         1
;DLG_MAIN                  EQU         1000

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.data 

IdDesktop db "http://hi.baidu.com/nohacks",0
ClassName db "SimpleWinClass",0       
AppName db " ",0       


.data?
 
hInstance HINSTANCE ?      
CommandLine LPSTR ? 
hWinMain    dd		?
hDesktopCurrent dd     ?  ;//当前桌面
hmyDesktop  dd         ?  ;//新桌面

.code 

;********************************************************************

StartMyExplore proc
  
LOCAL  sui:STARTUPINFO
LOCAL  pi:PROCESS_INFORMATION	

;invoke	RtlZeroMemory,addr sui,SIZEOF STARTUPINFO   
mov sui.cb,SIZEOF STARTUPINFO
mov sui.lpDesktop,offset IdDesktop
invoke CreateProcess,NULL,CTEXT("explorer"),NULL,NULL,TRUE,CREATE_DEFAULT_ERROR_MODE or CREATE_SEPARATE_WOW_VDM,NULL,NULL,addr sui,addr pi

[COLOR="Red"]invoke CreateProcess,NULL,CTEXT("ctfmon"),NULL,NULL,TRUE,CREATE_DEFAULT_ERROR_MODE or CREATE_SEPARATE_WOW_VDM,NULL,NULL,addr sui,addr pi[/COLOR]  ;解决新桌面输入法不可用的问题

ret

StartMyExplore endp

SetDesktop proc 
		
 invoke GetCurrentThreadId
 
 invoke GetThreadDesktop,eax   

 mov hDesktopCurrent,eax      ;//当前桌面
 
 mov hmyDesktop,0
 
 invoke OpenDesktop,addr IdDesktop,0,FALSE,0   ;检查桌面是否已经存在
     
      .if eax!=0
  	  	 	
     invoke CloseDesktop,eax
   
    .endif
 
invoke CreateDesktop,addr IdDesktop,NULL,NULL,0,MAXIMUM_ALLOWED,NULL
 
 mov hmyDesktop,eax
 
 .if eax==0
 
 ret
 	
 .endif
 
 invoke SetThreadDesktop,hmyDesktop
 
invoke SwitchDesktop,hmyDesktop
 
 invoke StartMyExplore
 
 ret

SetDesktop endp 


WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 

    .IF uMsg==WM_DESTROY 
       invoke  UnregisterHotKey,hWnd,hWnd      
       invoke  SwitchDesktop,hDesktopCurrent
       invoke CloseDesktop,hmyDesktop
       invoke PostQuitMessage,NULL            
        
     .ELSEIF   uMsg==  WM_CREATE
    
       push hWnd
       pop  hWinMain
      invoke LoadIcon,hInstance,ICO_ICO
       invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax    ;设置窗口图标  
       invoke SetWindowPos,hWnd,HWND_TOPMOST,0,0,0,0, SWP_NOMOVE or SWP_NOSIZE ;窗口置顶
       invoke RegisterHotKey,hWnd,7787,MOD_WIN,48   ;WIN+0
       invoke RegisterHotKey,hWnd,7788,MOD_WIN,49   ;WIN+1
       invoke RegisterHotKey,hWnd,7789,MOD_WIN,50   ;WIN+2
       invoke     SetDesktop

     .ELSEIF  uMsg==WM_HOTKEY
     
         .if wParam==7787
   	
   	 invoke  SwitchDesktop,hDesktopCurrent
         invoke PostQuitMessage,NULL               
 
        .endif
         
        .if  wParam==7788
       
        invoke SwitchDesktop,hDesktopCurrent
       
        .endif
       
       .if wParam==7789
   
        invoke SwitchDesktop,hmyDesktop
           
        .endif
     
       .ELSE
  
        invoke DefWindowProc,hWnd,uMsg,wParam,lParam     
        ret 
   .ENDIF
   
    xor eax,eax 
    ret 
WndProc endp 


WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD 
    LOCAL wc:WNDCLASSEX                                           
    LOCAL msg:MSG 
    LOCAL hwnd:HWND 

    mov   wc.cbSize,SIZEOF WNDCLASSEX                   
    mov   wc.style, CS_HREDRAW or CS_VREDRAW 
    mov   wc.lpfnWndProc, OFFSET WndProc 
    mov   wc.cbClsExtra,NULL 
    mov   wc.cbWndExtra,NULL 
    push  hInstance 
    pop   wc.hInstance 
    mov   wc.hbrBackground,COLOR_WINDOW+1 
    mov   wc.lpszMenuName,NULL 
    mov   wc.lpszClassName,OFFSET ClassName 
    invoke LoadIcon,NULL,IDI_APPLICATION 
    mov   wc.hIcon,eax 
    mov   wc.hIconSm,eax 
    invoke LoadCursor,NULL,IDC_ARROW 
    mov   wc.hCursor,eax 
    invoke RegisterClassEx, addr wc                      
    invoke CreateWindowEx,NULL,\ 
                ADDR ClassName,\ 
                ADDR AppName,\ 
                WS_OVERLAPPEDWINDOW,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                NULL,\ 
                NULL,\ 
                hInst,\ 
                NULL 
    mov   hwnd,eax 
   ;invoke ShowWindow, hwnd,CmdShow              
   ; invoke UpdateWindow, hwnd                                 

    .WHILE TRUE                                                        
                invoke GetMessage, ADDR msg,NULL,0,0 
                .BREAK .IF (!eax) 
                invoke TranslateMessage, ADDR msg 
                invoke DispatchMessage, ADDR msg 
   .ENDW 
    mov     eax,msg.wParam                                          
    ret 
WinMain endp 


;********************************************************************

start:
   invoke GetModuleHandle, NULL           
                                                                      
  mov hInstance,eax 
  invoke GetCommandLine                       
                                                               
  mov CommandLine,eax 
  invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT      
  
  invoke ExitProcess, eax                           

;********************************************************************

end        start





   不知道大家想过没有,这个程序还可用来免费上网,切换到新桌面以后,网管程序对桌面的锁定操作对新桌面无效,后在加个拦截关机,拦截鼠标锁定的功能(用HOOKAPI),这样在结账下机
后计算机仍然是开放状态达到免费上网的目的,可以基本通杀所有网管程序!

我根据上面的原理写了个工具:网吧超级防锁专家

下载地址:http://hi.baidu.com/nohacks/blog/item/4665f68db997f511b21bba2f.html

大家可以看看

[公告]安全测试和项目外包请将项目需求发到看雪企服平台:https://qifu.kanxue.com

上传的附件:
最新回复 (31)
北极星2003 25 2007-11-29 10:11
2
0
叫系统有点大了
非安全 17 2007-11-29 11:40
3
0
呵呵,是有点,已修正!
kgdurgwu 2007-11-29 13:09
4
0
不错的东东哈。。。。
三根火柴 4 2007-11-29 13:49
5
0
不错啊,支持个

炉子 3 2007-11-29 15:36
6
0
nice job  :)

我们这儿网吧的插卡器跟机箱电源连着-。-
没有风 10 2007-11-29 21:37
7
0
强大啊。佩服。
(而我还是那么菜。 )
以后多发原创啊。

请教一下,程序的原理就是创建一个新的桌面,接着加个拦截关机,拦截鼠标锁定的功能,就是这么简单吗??

你是怎么想到用这个来实现突破网吧限制的??

问题是如果上面的拦截功能被客户端给先拦截了,那会怎么样?
sudami 25 2007-11-29 21:50
8
0
虚拟桌面吧。codeproject上早有了。。。

Introduction
In my mind by far the coolest feature that a desktop manager can have is proper multiple (virtual) desktopping (shallow, I know). So, Windows XP doesn't have this feature, ah well there's a PowerTool that does it. Except - you can't change desktop just by mousing off the edge, and more seriously there doesn't appear to be any mechanism to transfer windows between desktops - which is very annoying, as things never open where you want them to.
Concept
I thought that the easiest way to do this is simply to show and hide windows in such a way as to give the impression of more than one desktop. About halfway through writing this I discovered SwitchDesktop, which looked quite complicated so I didn't bother trying it that way.
Technical Details
The program is an MFC Dialog App.
I found out how to list all the windows on the system and show and hide them from the tbarsort article. I ask Windows for handles to every window on the system using EnumWindows and filter out the irrelevant ones.
bool ValidWindow(HWND hwnd)
{
  if (!IsWindowVisible(hwnd)) return false;
  if (GetWindowTextLength(hwnd) == 0) return false;
  if (GetAsyncKeyState(VK_LBUTTON) && hwnd==GetForegroundWindow()) return false;
  char str[100];
  GetWindowText(hwnd,str,99);
  if(strncmp(str,"Desktop",100)==0) return false;
  if(strncmp(str,"Program Manager",100)==0) return false;
  return true;
}
BOOL CALLBACK AddToList(HWND hwnd,LPARAM ret)
{
  std::vector<HWND>* vecret=(std::vector<HWND>*)ret;
  if(ValidWindow(hwnd)) vecret->push_back(hwnd);
  return TRUE;
}
std::vector<HWND> WindowList()
{
  std::vector<HWND> windows;
  EnumWindows(AddToList,LPARAM(&windows));
  return windows;
}
Desktops can be switched by pressing the relevant button or with a keyboard shortcut, implemented with RegisterHotKey, for example Win+1 is registered by
RegisterHotKey(GetSafeHwnd(),1,MOD_WIN,'1');
For some reason the MFC ClassWizard doesn't know about the WM_HOTKEY message, so it has to be added manually to the message map:
ON_MESSAGE(WM_HOTKEY,OnHotKey)
By far the hardest thing to do was to detect when the mouse touched the edge of the screen (which is when the desktops change). Eventually I found the MouseHookDlg project (although I can't currently find a reference for it), which shows how to install a global mouse hook. All I have to do is package the dll with my app and call the simple function API_SetHooks to register a mouse callback, and put a handler in the message map:
ON_REGISTERED_MESSAGE(UWM_MOUSEMOVE, OnHookMouseMove)
having first registered this mesage by
UWM_MOUSEMOVE = RegisterWindowMessage(UWM_SHELL_HOOK_MSG);
Finally, I wanted it to be possible to drag windows off the side of the screen and have them come with you to the new desktop. I failed to find an actual way of checking if any windows are being dragged (I suspect it can be done with another global hook), instead if the left mouse button is down as the desktops are switched then the foreground window is transfered, hence the line
if (GetAsyncKeyState(VK_LBUTTON) && hwnd==GetForegroundWindow()) return false;
in the ValidWindow above, this works well but occasionally leads to accidental window transfers.
Conclusion
The program works fine, with one or two minor bugs (not bad for only a few hours' work). Occasionally windows get transfered when not intended, and much worse occasionally they get permanently hidden (don't do any absolutely vital work whilst using this program, there is a small chance that this will happen and you will be unable to save). I would be glad of suggestions for bug fixes especially for improving the dragging detection, extra features are unlikely to get added.
Blatant plug: visit my site for mostly various games written using OpenGL with MFC or GLUT.
sudami 25 2007-11-30 06:34
9
0


上传的附件:
winnip 1 2007-11-30 12:27
10
0
下载了,如何不顶一下。
winnip 1 2007-11-30 12:29
11
0
冒昧问下。这个代码咋没有呀HookDll.dll
winnip 1 2007-11-30 12:36
12
0
sudami
--------------------Configuration: Multiple Desktops - Win32 Debug--------------------
Error scanning file C:\Documents and Settings\Administrator\桌面\multipledesktops\res\Multiple Desktops.rc2 for dependencies.
Compiling resources...
C:\Documents and Settings\Administrator\桌面\multipledesktops\Multiple Desktops.rc(186) : 致命错误 RC1015: 无法打开包含文件 'res\Multiple Desktops.rc2'.
执行 rc.exe 时出错.

------------------------
编译出现这个问题。
wynney 24 2007-11-30 15:27
13
0
就只是个虚拟桌面....
wyzbuaa 2007-11-30 15:30
14
0
太强了,顶一下
combojiang 26 2007-11-30 16:04
15
0
好,帮顶。。。
yingyue 2007-11-30 17:54
16
0
很好,有意思
北极星2003 25 2007-11-30 21:06
17
0
这次网吧被你搞的非安全了
能从多桌面切换联想到网吧,很邪恶
bzhkl 5 2007-11-30 22:17
18
0
正好我常驻网吧 试试看
大菜一号 21 2007-12-3 01:09
19
0
na ni!?
我不常驻网吧的也要试试看
qyc 4 2007-12-3 14:48
20
0
有时两个桌面间切换没响应,这是BUG吗?
jadesoft 1 2007-12-3 16:50
21
0
呵呵!挺好的如果能杀掉那个讨厌的实名卡更好了,你们都不知道辽宁省为了赚更多的钱强制每个网吧必须使用实名卡!如果没有这个卡就不让上网,网吧老板为不赔本只能让每个来上网的客户来买这个“实名卡”。
郁闷!
jadesoft 1 2007-12-3 16:51
22
0
如果我有双翅膀坚决飞离这个垃圾地方。
supoingo 2007-12-3 22:34
23
0
以前用过,不过是用非asm写的,几百K,下了,用fasm的格式重写一下“”“”“”
supoingo 2007-12-3 22:40
24
0
看了,作者好像是黑防的VIP。只讨论tech,不看个人
ertyui 2007-12-12 10:08
25
0
我们这边下机直接关电源,有没有拦截对电源操作的软件。
hfyy 2 2007-12-12 18:10
26
0
又学一招   楼主好强
得顶!
非安全 17 2007-12-13 20:31
27
0
一般先象万象,EP什么的管理系统都没有进行反HOOK,我们很容易成功,并且经过测试,也的确如此!
非安全 17 2007-12-13 20:33
28
0
不会啊,经测试没出现这个问题啊
kagayaki 2007-12-23 23:56
29
0
我到现在也没法拦截关机, 万象结账后, 分机关机的功能不在万象 Client, 挂DLL到系统了
挂钩所有关机 API 也没用
tebesa 2007-12-24 09:33
30
0
好东东,收到了。我顶
鸡蛋壳 2008-1-31 11:27
31
0
ring0 彻底毁掉关机函数,万象是容许驱动的
ZSYL 2008-1-31 13:59
32
0
很好,很强大。o(∩_∩)o...
游客
登录 | 注册 方可回帖
返回