Why does 'msg * alarm' disappear after a while?

∥☆過路亽.° 提交于 2021-02-07 10:48:12

问题


I have a small powershell script which allows me to quickly set an alarm for myself. It basically just waits a specified number of minutes and then calls

msg * alarm!

This works well - a message box pops up. The only problem is it disappears after a while - so if I'm not at my desk, I'll miss the message box.

According to the documentation, found here, this is the behaviour when I don't specify a time value.

/time: seconds : Specifies the amount of time the message you sent is displayed on the user's screen. Once the time limit is reached, the message disappears. If no time limit is set, the message remains on the user's screen until the user sees the message and clicks OK.

However this isn't the case and it does disappear. Right now, I have to specify an arbitarily high number for it to stay.

    msg * /time:999999 alarm!

回答1:


Tracing the call's with cdb shows following function of interest when starting msg.exe and passing it the maximum timeout value of 999999:

command: msg * /time:999999 alarm

The timeout value of f423f (999999) gets passed to ShowMessageBox through the rax register.

WINSTA!WinStationSendMessageW+0x353:
000007fe`fbf1ec93 e874deffff      
call    WINSTA!CSmartSession::ShowMessageBox (000007fe`fbf1cb0c)
rax=00000000000f423f rbx=0000000000000000 rcx=0000000000000010

Starting msg.exe without any timeout value shows 3c (60) being passed to the ShowMessageBox function.

command: msg * alarm

WINSTA!WinStationSendMessageW+0x353:
000007fe`fbf1ec93 e874deffff      
call    WINSTA!CSmartSession::ShowMessageBox (000007fe`fbf1cb0c)
rax=000000000000003c rbx=0000000000000000 rcx=0000000000000010

My guess is that the documentation is not up-to-date (if it ever was)



来源:https://stackoverflow.com/questions/40456245/why-does-msg-alarm-disappear-after-a-while

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!