![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-24 17:40 |
47,812 topics / 349,910 posts / today 1 new / 48,262 members |
| WinPE、PowerShell及其它命令行系统专区 » Help to compile the following code that turns off the monitor into an EXE file? |
| Printable Version 5,218 / 15 |
| Floor1 bd123456789 | Posted 2010-06-12 19:42 |
| 中级用户 Posts 216 Credits 360 | |
|
.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 I downloaded an assembly myself, but it didn't work repeatedly. Maybe the code has a problem in D:\. Thank you very much. [ Last edited by bd123456789 on 2010-6-12 at 19:44 ] |
|
| Floor2 wang6610 | Posted 2010-06-25 11:25 |
| 银牌会员 Posts 488 Credits 1,246 | |
|
Don't be grateful. Here's an address:
http://yanlibin.googlepages.com/monitor.rar http://blog.sina.com.cn/s/blog_591884640100dhyx.html [ Last edited by wang6610 on 2010-6-27 at 07:10 ] |
|
| Floor3 bd123456789 | Posted 2010-06-26 17:16 |
| 中级用户 Posts 216 Credits 360 | |
Originally posted by wang6610 at 2010-6-25 11:25 AM: Hehe I can't open this address? |
|
| Floor4 wang6610 | Posted 2010-06-26 21:30 |
| 银牌会员 Posts 488 Credits 1,246 | |
|
@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 Save as a.bat and double-click it. |
|
| Floor5 bd123456789 | Posted 2010-06-27 16:40 |
| 中级用户 Posts 216 Credits 360 | |
|
Thanks.
But found that it failed to turn off the monitor, maybe there is a mistake in the source code.. The following is in C++, anyone can solve? http://www.cn-dos.net/forum/viewthread.php?tid=51710&fpage=1&highlight= |
|
| Floor6 netwinxp | Posted 2010-06-29 00:13 |
| 高级用户 Posts 366 Credits 741 | |
|
Actually, the principle of this is the same as the screen saver where the monitor is turned off after a period of inactivity. First, make sure the monitor conforms to Energy Star. Second, the power scheme settings are also related. Moreover, moving the mouse or pressing the keyboard may make the monitor turn on again. According to online discussions, there is a risk of system restart with this message.
Under DOS (non-WIN command line), turning off the monitor through INT 10H call or direct I/O is the real deal. BTW: -1 is to turn on the display. You can try using 0 instead of 2. In the while loop of the playback software, you can handle this message by returning 0, which can prevent being "bothered" by the screen saver or monitor power saving during playback. ***There are no compilation problems at all, one is a GUI one, and one is a Consol one*** [ Last edited by netwinxp on 2010-6-29 at 01:47 ] Attachments offDisp.rar (977 bytes) |
|
| Floor7 bd123456789 | Posted 2010-06-30 07:55 |
| 中级用户 Posts 216 Credits 360 | |
|
Thanks a lot
I downloaded the attachment, ran the EXE, and got the following prompt; Threat: Ending the program of 360 Total Security will cause the real-time security protection to become ineffective, and may pose a danger to your computer and personal data. It is recommended to check this program and use 360 Total Security's cloud-based Trojan detection to perform a full scan of the system. Source: C:\Documents and Settings\Administrator\Desktop\offDisp\offDisp\OffDispGui.exe Don't know what it is? |
|
| Floor8 netwinxp | Posted 2010-06-30 13:03 |
| 高级用户 Posts 366 Credits 741 | |
|
Here is the translation:
Below is the disassembly code, you can take a look (or ask someone to see if there are really any problems), not even a possible virus "remains"! There's nothing we can do if the silly blocking software misreports... You can just use the command line one. Disassembly of File: OffDisplay.exe Code Offset = 00000400, Code Size = 00000200 Data Offset = 00000000, Data Size = 00000000 Number of objects = 2 (just the following two), 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 +++++++++++++++++++++++++++++++++++++ Program entry = 00401000 (OffDisplay.exe File Offset: 00001600) //******************** Program Entry Point ******** ;We defined the parameter passing rule as stdcall(WINAPI), so parameters are pushed onto the stack from right to left, ;and the called function cleans up the stack. :00401000 68F4010000 push 000001F4;Parameter 500 :00401005 E82A000000 call 00401034;Call sleep :0040100A 6A02 push 00000002;Parameter 2 :0040100C 6870F10000 push 0000F170;Parameter SC_MONITORPOWER :00401011 6812010000 push 00000112;Parameter WM_SYSCOMMAND :00401016 68FFFF0000 push 0000FFFF;Parameter HWND_BROADCAST :0040101B E808000000 call 00401028;Call SendMessage :00401020 6A00 push 00000000;Parameter 0 :00401022 E807000000 call 0040102E;Call ExitProcess :00401027 CC int 03;The main program doesn't go further from here ;;;;;;;;;;;;;;;;;Assembly language generated intermediate jump statements;;;;;;;;;;;;;;;;;;;;;;;;;; *CALL at Address: 0040101B :00401028 FF250C204000 jmp dword ptr ;Jump to the real SendMessage pointer *CALL at Address: 00401022 :0040102E FF2504204000 jmp dword ptr ;Jump to the real ExitProcess pointer *CALL at Address: 00401005 :00401034 FF2500204000 jmp dword ptr ;Jump to the real sleep pointer ;;;Note: masm32 will generate an intermediate jump (for win32's link using VC's, masm itself doesn't have it), I can't help it;;; :All zeros ;00402000 8E 20 00 00 80 20;End of the program [ Last edited by netwinxp on 2010-6-30 at 18:45 ] |
|
| Floor9 bd123456789 | Posted 2010-07-03 09:45 |
| 中级用户 Posts 216 Credits 360 | |
|
Brother upstairs! Why are both EXEs running and the monitor isn't turned off?
I selected the EXE first and then pressed the Enter key, without moving the mouse, but still couldn't turn it off? Has anyone tested and succeeded? [ Last edited by bd123456789 on 2010-7-3 at 09:46 ] |
|
| Floor10 netwinxp | Posted 2010-07-03 15:01 |
| 高级用户 Posts 366 Credits 741 | |
|
It's not that I told you -
1. This message is the monitor's power-saving mode, not turning off the monitor. 2. It's related to the power management scheme. If the power scheme is "always on" or "turn off monitor: never", it must be ineffective. 3. It's related to the monitor itself. If it's not a "plug and play monitor", it may be ineffective. 4. It's related to the Windows version and the version of relevant components. The too high one seems not okay. =================================== The real thing that can turn off the video can be done with 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 ;Try these two segments in pure DOS, it must be effective. I often use it when writing to the screen directly in DOS. ================================ That message is basically not very useful. Most of the online ones are passed on inaccurately. It's just that you said it can't be compiled, so I compiled it. Its real function is - return 0 for this message, thus preventing the screen saver and the monitor's power-saving mode. [ Last edited by netwinxp on 2010-7-3 at 15:09 ] |
|
| Floor11 wang6610 | Posted 2010-07-03 18:02 |
| 银牌会员 Posts 488 Credits 1,246 | |
|
```asm
``` |
|
| Floor12 netwinxp | Posted 2010-07-03 21:51 |
| 高级用户 Posts 366 Credits 741 | |
|
That's just a sample program. Forget it, I'll write one.
Parameters S (-S, /S) = turn off the monitor O (-O, /O) = turn on the monitor, case-insensitive *****Only valid in pure DOS, not tested in virtual machine, unknown compatibility**** Attachments offvideo.rar (241 bytes) |
|
| Floor13 wang6610 | Posted 2010-07-03 22:33 |
| 银牌会员 Posts 488 Credits 1,246 | |
Originally posted by netwinxp at 2010-7-3 09:51 PM: |
|
| Floor14 bd123456789 | Posted 2010-07-05 09:15 |
| 中级用户 Posts 216 Credits 360 | |
|
Thanks a lot
I looked it up, online,,, It's in the attachment, relatively easy to use.. and suitable for XP [ Last edited by bd123456789 on 2010-7-5 at 09:16 ] Attachments 关闭显示器.rar (63.1 KiB) |
|
| Floor15 netwinxp | Posted 2010-07-05 15:01 |
| 高级用户 Posts 366 Credits 741 | |
|
I know where the problem of the previous Windows program not being able to turn off the screen is. Because the program runs and then exits, so it fails.
You can try the following to see if it can be turned off for about 10 seconds? If it works, it will be easy. There is a problem with my graphics card settings, so I can't test. Including the one you provided doesn't work. [ Last edited by netwinxp on 2010-7-5 at 15:14 ] Attachments OffDisplay.rar (481 bytes) |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |