|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
『楼 主』:
帮忙把这段关闭显示器代码汇编成EXE文件?
.486
.model flat, stdcall
option casemap :none ; case sensitive
include D:\Language\masm32\include\windows.inc
include D:\Language\masm32\include\user32.inc
include D:\Language\masm32\include\kernel32.inc
includelib D:\Language\masm32\lib\user32.lib
includelib D:\Language\masm32\lib\kernel32.lib
.code
start:
invoke Sleep, 500
invoke SendMessage, HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2
invoke ExitProcess, 0
end start
http://blog.sina.com.cn/s/blog_591884640100dhyx.html
我自己下了个汇编,屡试不行
可能是代码在D:\有问题吧
不甚感激
[ Last edited by bd123456789 on 2010-6-12 at 19:44 ]
|
|
2010-6-12 19:42 |
|
|
wang6610
银牌会员
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
|
2010-6-25 11:25 |
|
|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
|
2010-6-26 17:16 |
|
|
wang6610
银牌会员
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第
4 楼』:
@echo off
more +5 "%~0"|debug&graftabl 936>nul
copy/b/y $tmp$ "MONITOR.exe">nul
del/a/f/q $tmp$
goto:eof
e0100 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00
e0110 B8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
e0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0130 00 00 00 00 00 00 00 00 00 00 00 00 B0 00 00 00
e0140 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
e0150 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F
e0160 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20
e0170 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 00
e0180 5D F3 DC FD 19 92 B2 AE 19 92 B2 AE 19 92 B2 AE
e0190 97 8D A1 AE 10 92 B2 AE E5 B2 A0 AE 18 92 B2 AE
e01A0 52 69 63 68 19 92 B2 AE 00 00 00 00 00 00 00 00
e01B0 50 45 00 00 4C 01 01 00 B1 48 21 4A 00 00 00 00
e01C0 00 00 00 00 E0 00 0F 01 0B 01 05 0C 00 02 00 00
e01D0 00 00 00 00 00 00 00 00 20 10 00 00 00 10 00 00
e01E0 00 20 00 00 00 00 40 00 00 10 00 00 00 02 00 00
e01F0 04 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
e0200 00 20 00 00 00 02 00 00 00 00 00 00 02 00 00 00
e0210 00 00 10 00 00 10 00 00 00 00 10 00 00 10 00 00
e0220 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00
e0230 5C 10 00 00 3C 00 00 00 00 00 00 00 00 00 00 00
e0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0280 00 00 00 00 00 00 00 00 00 10 00 00 14 00 00 00
e0290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e02A0 00 00 00 00 00 00 00 00 2E 74 65 78 74 00 00 00
e02B0 EC 00 00 00 00 10 00 00 00 02 00 00 00 02 00 00
e02C0 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 60
e02D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e02E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e02F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0300 D6 10 00 00 C8 10 00 00 00 00 00 00 AC 10 00 00
e0310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0320 68 F4 01 00 00 E8 2A 00 00 00 6A 02 68 70 F1 00
e0330 00 68 12 01 00 00 68 FF FF 00 00 E8 08 00 00 00
e0340 6A 00 E8 07 00 00 00 CC FF 25 0C 10 40 00 FF 25
e0350 04 10 40 00 FF 25 00 10 40 00 CC CC A4 10 00 00
e0360 00 00 00 00 00 00 00 00 BC 10 00 00 0C 10 00 00
e0370 98 10 00 00 00 00 00 00 00 00 00 00 DE 10 00 00
e0380 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0390 00 00 00 00 00 00 00 00 D6 10 00 00 C8 10 00 00
e03A0 00 00 00 00 AC 10 00 00 00 00 00 00 E2 01 53 65
e03B0 6E 64 4D 65 73 73 61 67 65 41 00 00 75 73 65 72
e03C0 33 32 2E 64 6C 6C 00 00 80 00 45 78 69 74 50 72
e03D0 6F 63 65 73 73 00 60 02 53 6C 65 65 70 00 6B 65
e03E0 72 6E 65 6C 33 32 2E 64 6C 6C 00 00 00 00 00 00
e03F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e04F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rcx
4FF
n$tmp$
w
q
存为a.bat,双击它。
|
|
|
2010-6-26 21:30 |
|
|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
|
2010-6-27 16:40 |
|
|
netwinxp
高级用户
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第
6 楼』:
其实这个的原理和屏保中的多长时间不动就关闭显示器是一样的,首先得保证显示器符合能源之星,其次电源方案设置也很有关系,再者移动鼠标或按键盘可能会让显示器重开。根据网上的讨论用这条消息存在系统重启的风险。
DOS(非WIN命令行)下通过INT 10H调用或直接I/O关显示器才是实打实的。
BTW:-1是开显示,你试试不用2,而是用0看看。
在播放软件的while循环中可以对这条消息采用返回0处理,能阻止在播放时受屏保或显示器节电的“骚扰”。
***编译一点问题都没有,一个GUI的,一个Consol的***
[ Last edited by netwinxp on 2010-6-29 at 01:47 ]
附件
1: offDisp.rar (2010-6-29 01:46, 977 bytes,下载次数: 15)
|
|
2010-6-29 00:13 |
|
|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
『第
7 楼』:
十分感谢
我下了附件,运行EXE,提示如下;
威胁:结束360安全卫士的程序将会导致实时安全保护失效,并可能对您的电脑和个人资料造成危险。建议您检查该程序,并使用360安全卫士木马云查杀对系统进行全盘扫描。
来源:C:\Documents and Settings\Administrator\桌面\offDisp\offDisp\OffDispGui.exe
不知道是什么?
|
|
2010-6-30 07:55 |
|
|
netwinxp
高级用户
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第
8 楼』:
下面是反汇编代码,你可以看看(或者请人看看到底有没有问题),连可能的病毒“尸体”都没有!傻堵软件要误报谁也没办法...你直接用命令行的那个得了。
Disassembly of File: OffDisplay.exe
Code Offset = 00000400, Code Size = 00000200
Data Offset = 00000000, Data Size = 00000000
对象数目=2 (就下面两个), Imagebase = 00400000h
.text RVA: 00001000 Offset: 00000400 Size: 00000200 Flags: 60000020
.rdata RVA: 00002000 Offset: 00000600 Size: 00000200 Flags: 40000040
+++++++++++++++++++ ++++++++++++++++++
No Menu Resources
No Dialog Resources
Number of Imported Modules=0
Number of Exported Functions=0
+++++++++++++++++++++++++++++++++++++
程序入口=00401000 (OffDisplay.exe File Offset:00001600)
//******************** Program Entry Point ********
;我们定义了参数传递规则为stdcall(WINAPI),所以参数自右向左入栈,
;并且由被调用函数清理堆栈。
:00401000 68F4010000 push 000001F4;参数500
:00401005 E82A000000 call 00401034;调用sleep
:0040100A 6A02 push 00000002;参数2
:0040100C 6870F10000 push 0000F170;参数SC_MONITORPOWER
:00401011 6812010000 push 00000112;参数WM_SYSCOMMAND
:00401016 68FFFF0000 push 0000FFFF;参数HWND_BROADCAST
:0040101B E808000000 call 00401028;调用SendMessage
:00401020 6A00 push 00000000;参数0
:00401022 E807000000 call 0040102E;调用ExitProcess
:00401027 CC int 03;主程序到此不往下
;;;;;;;;;;;;;;;;;汇编语言产生的中间跳转语句;;;;;;;;;;;;;;;;;;;;;;;;;;
*CALL at Address:0040101B
:00401028 FF250C204000 jmp dword ptr [0040200C];跳向真正SendMessage指针
*CALL at Address:00401022
:0040102E FF2504204000 jmp dword ptr [00402004];跳向真正ExitProcess指针
*CALL at Address:00401005
:00401034 FF2500204000 jmp dword ptr [00402000];跳向真正sleep指针
;;;注:masm32会产生一个中间跳转(for win32的link用VC的,masm本身不带),我也没办法;;;
:全0
;00402000 8E 20 00 00 80 20;程序尾部
[ Last edited by netwinxp on 2010-6-30 at 18:45 ]
|
|
2010-6-30 13:03 |
|
|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
『第
9 楼』:
楼上大哥!为什么运行了两个EXE都没有关显示器?
我是先选中EXE 再按回车键,不动鼠标的,但也没办法关呀?
有人测试成功过吗?
[ Last edited by bd123456789 on 2010-7-3 at 09:46 ]
|
|
2010-7-3 09:45 |
|
|
netwinxp
高级用户
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第
10 楼』:
不是跟你说了——
1、该消息是显示器节电模式,而不是关显示器。
2、和电源管理方案有关,如果电源方案为“一直开着”或者“关显示器:从不”,那肯定无效。
3、和显示器本身有关,如果非“即插即用显示器”则可能会无效。
4、和windows版本及有关组件版本有关,太高的好像也不行。
===================================
真正可以关视频的可以用INT 10H来完成(DOS)
OnVideo proc far
mov bl,36h
mov ax,1200h
int 10h
ret
OnVideo endp
OffVideo proc far
mov bl,36h
mov ax,1201h
int 10h
ret
OfficeVideo endp
;你把这两段到纯DOS试试,肯定有效,在DOS直接写屏的时候我就经常用它。
================================
那个消息基本上没多少P用,网上多半以讹传讹,只是你说不能编译,我才编译一下。其真正的作用是——对此消息返回0处理,从而阻止屏幕保护和显示器节电模式。
[ Last edited by netwinxp on 2010-7-3 at 15:09 ]
|
|
2010-7-3 15:01 |
|
|
wang6610
银牌会员
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第
11 楼』:
Quote: | OnVideo proc far
mov bl,36h
mov ax,1200h
int 10h
ret
OnVideo endp
OffVideo proc far
mov bl,36h
mov ax,1201h
int 10h
ret
OfficeVideo endp |
|
请netwinxp把这一段编译成dos可执行文件,我不懂汇编。
|
|
|
2010-7-3 18:02 |
|
|
netwinxp
高级用户
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第
12 楼』:
那只是段子程序,算了我写一个。
参数S(-S、/S)=关显示器 O(-O、/O)=开显示器,不分大小写
*****仅纯DOS有效,虚拟机未测试不知兼容性****
;源代码
.MODEL TINY
.286
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 81H
CMDLINE DB 10 DUP(0)
ORG 100H
MAIN PROC NEAR
MOV SI,1
GETCMD:
CMP CMDLINE[SI],'-'
JE NEXT1
CMP CMDLINE[SI],'/'
JE NEXT1
CMP CMDLINE[SI],'S'
JE RCHKS
CMP CMDLINE[SI],'s'
JE RCHKS
CMP CMDLINE[SI],'O'
JE RCHKO
CMP CMDLINE[SI],'o'
JE RCHKO
JMP HELPTXT
NEXT1:
INC SI
JMP GETCMD
RCHKS:
INC SI
CMP CMDLINE[SI],0DH
JE OFFVIDEO
JMP HELPTXT
RCHKO:
INC SI
CMP CMDLINE[SI],0DH
JE ONVIDEO
HELPTXT:
MOV AX,CS
MOV DS,AX
MOV AH,09H
MOV DX,OFFSET HLPSTR
INT 21H
EXIT:
MOV AX,4C00H
INT 21H
OFFVIDEO:
MOV BL,36H
MOV AX,1201H
INT 10H
JMP EXIT
ONVIDEO:
MOV BL,36H
MOV AX,1200H
INT 10H
JMP EXIT
HLPSTR DB 'Turn on/off display for DOS',0Dh,0Ah,'S to turn off,O to turn on,other to help.$'
MAIN ENDP
CODE ENDS
END MAIN [ Last edited by netwinxp on 2010-7-3 at 22:02 ]
附件
1: offvideo.rar (2010-7-3 21:52, 241 bytes,下载次数: 10)
|
|
2010-7-3 21:51 |
|
|
wang6610
银牌会员
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第
13 楼』:
Quote: | Originally posted by netwinxp at 2010-7-3 09:51 PM:
那只是段子程序,算了我写一个。
参数S(-S、/S)=关显示器 O(-O、/O)=开显示器,不分大小写
*****仅纯DOS有效,虚拟机未测试不知兼容性****[/colo ... |
|
vpc有效,谢谢。。。。
|
|
|
2010-7-3 22:33 |
|
|
bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
『第
14 楼』:
多谢了
我找了一下,网上的,,,
在附件里,比较好用..而且适合XP
[ Last edited by bd123456789 on 2010-7-5 at 09:16 ]
附件
1: 关闭显示器.rar (2010-7-5 09:15, 63.1 K,下载次数: 26)
|
|
2010-7-5 09:15 |
|
|
netwinxp
高级用户
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第
15 楼』:
我知道前面的windows程序不能关屏幕的问题出在哪里了,因为程序运行一下就退出去了,所以就失效了。
你试试下面的能不能关闭10秒左右?如果行,就好办了
我这里的显卡设置有问题,不能测试,包括你提供的那个都不起作用。
[ Last edited by netwinxp on 2010-7-5 at 15:14 ]
附件
1: OffDisplay.rar (2010-7-5 15:12, 481 bytes,下载次数: 9)
|
|
2010-7-5 15:01 |
|