How can a program reboot my PC

创建类似Visual Studio的界面                                        Visual Studio界面Visual Studio的界面如下,很多人喜欢这种界面风格,尤其是主框架下的两个活动窗口:左侧为嵌套Tab控件的浮动窗口,底部为嵌套信息输出窗口的浮动窗口。这种浮动窗口类似于可浮动的工具栏,可以停靠在主窗口的任意一边,也可以浮动在主窗口内的任何位置,窗口的大小可以随鼠标的拖动而 阅读详情
 Subject: <Q:08.01> - How can a program reboot my PC?
Date: 8 Feb 2002 20:16:09 -0400

You can generate a "cold" boot or a "warm" boot. A cold boot is the same
as turning the power off and on; a warm boot is the same as Ctrl-Alt-Del
and skips the power-on self 'test.

For a warm boot, store the hex value 1234 in the word at 0040:0072. For
a cold boot, store 0 in that word. Then, if you want to live
dangerously, jump to address FFFF:0000. Here's C code to do it:

/* WARNING: data loss possible */
void bootme(int want_warm) /* arg 0 = cold boot, 1 = warm */
{
void (far* boot)(void) = (void (far*)(void))0xFFFF0000UL;

unsigned far* type = (unsigned far*)0x00400072UL;
*type = (want_warm ? 0x1234 : 0);
(*boot)( );
}

What's wrong with that method? It will boot right away, without closing
files, flushing disk caches, etc. If you boot without flushing a
write-behind disk cache (if one is running), you could lose data or
trash the file allocation table in your hard drive.

There are two methods of signaling the cache to flush its buffers:

(1) Simulate a keyboard Ctrl-Alt-Del in the keystroke translation
function of the BIOS (INT 15 AH=4F; but see notes below)

(2) Issue a disk reset (DOS function 0D). Most disk-cache programs hook
one or both of those interrupts, so if you use both methods you'll
probably be safe.

When user code simulates a Ctrl-Alt-Del, one or more of the programs
that have hooked INT 15 AH=4F can ask that the key be ignored by
clearing the carry flag. For example, HyperDisk does this when it has
started but not finished a cache flush. So if the carry flag comes back
cleared, the boot code has to wait a couple of clock ticks and then try
again. (None of this matters on older machines whose BIOS can't support
101- or 102-key keyboards; see the discussion of INT 21 AH=4F in
<Q:04.07> [What is the SysRq key for?])

C code that tries to signal the disk cache (if any) to flush is given
below. Turbo Pascal code by Timo Salmi that does more or less the same
job may be found at question 49 (as of this writing) in the Turbo Pascal
FAQ in comp.lang.pascal, and is downloadable as file FAQPAS2.TXT, which
is part of: <ftp://garbo.uwasa.fi/pc/link/>

Here's C code that reboots after trying to signal the disk cache:

#include <dos.h>

void bootme(int want_warm) /* arg 0 = cold boot, 1 = warm */
{
union REGS reg;

void (far* boot)(void) = (void (far*)(void))0xFFFF0000UL;
unsigned far* boottype = (unsigned far*)0x00400072UL;
char far* shiftstate = (char far*)0x00400017UL;
unsigned ticks;
int time_to_waste;

/* Simulate reception of Ctrl-Alt-Del: */
for (;;)
{
*shiftstate |= 0x0C; /* turn on Ctrl & Alt */
reg.h.ah = 0x4F; /* see notes below */
reg.h.al = 0x53; /* 0x53 = Del's scan code */
reg.x.cflag = 1; /* sentinel for ignoring key */
int86(0x15, &reg, &reg);

/* If carry flag is still set, we've finished. */
if(reg.x.cflag)
break;

/* Else waste some time before trying again: */
reg.h.ah = 0;
int86(0x1A, &reg, &reg); /* system time into CX:DX */

ticks = reg.x.dx;
for (time_to_waste = 3; time_to_waste > 0; )
{
reg.h.ah = 0;
int86(0x1A, &reg, &reg);
if (ticks != reg.x.dx)
ticks = reg.x.dx , --time_to_waste;
}
}

/* Issue a DOS disk reset request: */
reg.h.ah = 0x0D;
int86(0x21, &reg, &reg);

/* Set boot type and boot: */
*boottype = (want_warm ? 0x1234 : 0);
(*boot)( );
}

Reader Timo Salmi reported (26 July 1993) that the INT 15 AH=4F call may
not work on older PCs (below AT, XT2, XT286), according to Ralf Brown's
interrupt list (<Q:02.03> [What and where is Ralf Brown's interrupt
list?]).

Reader Roger Fulton reported (1 July 1993) that INT 15 AH=4F hangs even
a modern PC "ONLY when ANSI.SYS [is] loaded high using EMM386.EXE.
(Other things loaded high with EMM386.EXE were OK; ANSI.SYS loaded high
with QEMM386.SYS was OK; ANSI.SYS loaded low with EMM386.EXE installed
was OK.)" His solution was to use only the disk reset, INT 21 AH=0D,
which does flush SMARTDRV, then wait five seconds in hopes that any
other disk-caching software would have time to flush its queue.

Reader Per Bergland reported (10 Sep 1993) that the jump to FFFF:0000
will not work in Windows or other protected-mode programs. (For example,
when the above reboot code ran in a DOS session under Windows, a box
with "waiting for system shutdown" appeared. The PC hung and had to be
reset by cycling power.) His solution, which does a cold boot not a warm
boot, is to pulse pin 0 of the 8042 keyboard controller, which is
connected to the CPU's "reset" line.

He has tested the following code on various Compaqs, and expects it will
work for any AT-class machine; he cautions that you must first flush the
disk cache as indicated above.

cli
(AT) (AT) WaitOutReady: ; Busy-wait until 8042 ready for new command
in al,64h ; read 8042 status byte
test al,00000010b ; this bit indicates input buffer full
jnz (AT) (AT) WaitOutReady
mov al,0FEh ; Pulse "reset" = 8042 pin 0
out 64h,al ; The PC will reboot now
充电桩OCPP1.6J协议适配 本文介绍了在充电桩固件中快速适配OCPP1.6协议的方法,通过移植开源的MicroOcpp库实现标准化通信。文章详细说明了移植的前置条件、库框架结构、业务接口适配过程,特别是针对STM32F407平台和4G模组的WebSocket通信接口改造方案。移植完成后,建议使用开源OCPP服务器SteVe进行测试验证,并提供了测试工具推荐。该方法有效解决了不同品牌充电设备与管理系统间的互操作性问题,为充电桩产品快速满足国际准入标准提供了可行方案,显著降低了开发成本和时间。 阅读详情

相关推荐

内网(极空间)搭建gitlab跳板机转发端口及域名配置

然后,回头尝试用内网地址+15022 clone,成功,用公网的ip+15222 clone失败,那就是定位到时nginx转发的问题了。首先想到的就是 git clone是通过ssh的22端口进行下载的,那就需要打通22端口,则又配置22端口的nginx转发。然后,我通过ssh命令,做一个端口转发,以实现内网穿透,将服务端口链接到跳板机上。然后穿透到阿里云服务器跳板机的端口,只能内网访问,需要用nginx做个转发,才能用公网ip进行访问。然后,如上,我的80端口,映射15080,22端口映射15022。

God丶Davide的博客 6093

The program ‘make‘ can be found in the following packages 的解决方法

问题: 编译时make失败,有如下报错: zyyy@ubuntu16:/home/zyy/build$ make The program 'make' can be found in the following packages: * make * make-guile Try: sudo apt install <selected package> 解决方法: 执行命令sudo apt-get install build-essential zyyy@ubuntu16:/h

qq_33163046的博客 1万+

怎么在豆包里做生成式引擎优化(GEO)

本文系统介绍了豆包平台生成式引擎优化(GEO)的全套方法体系。文章首先解析了豆包与传统搜索引擎的核心差异,强调其多模态理解和上下文感知特性,并指出GEO需从关键词匹配转向用户意图动态解析。随后详细阐述了GEO优化的三大核心策略:用户意图解析技术、实时内容适配框架和权威信号强化方法,配以技术实现路径和案例说明。最后提出GEO与SEO融合的未来趋势,建议企业构建统一知识库,实现全渠道声誉管理。全文包含大量实操代码和工具链指导,为企业在AI时代的内容优化提供系统解决方案。

解锁AI流量新红利!🚀 GEO优化(生成引擎优化)助您掌控AI搜索,让AI成为您的品牌最佳代言人! 2394

Ubuntu 出现The program 'make' can be found in the following packages问题的解决方法

    今天运行make命令时,提示如下信息:The program 'make' can be found in the following packages: * make * make-guile Try: apt install &lt;selected package&gt;    运行一下命令即可解决:sudo apt-get install build-essential...

知道自己不要什么,不管多么大的诱惑(欢迎关注:职谷智享) 1万+

MDF和DHF、DMR、DHR三者差异?注册与备案文件?医疗器械产品技术要求编写指导原则

定义:设计历史文档(DHF ) 指的是描述某医疗器械成品设计过程的有关记录。内容:DHF包括设计开发活动的所有记录。从最初的策划、客户需求、设计输入,设计输出、设计验证、设计确认、所有的设计评审,设计转换,以及设计变更相关的所有记录。均属于DHF的一部分。要求:各制造商应为每个类型的器械建立并保持设计历史文件。设计历史文件应包含或引用必要的记录,以证实设计符合经批准的设计计划和法规的要求。

学海无涯的专栏 9118

YOLO11改进-注意力-引入Deformable Large Kernel Attention (DLKA) 解决多尺度、小目标、遮挡等问题

Deformable Large Kernel Attention (DLKA) 是一种用于视觉任务的注意力机制,旨在提升模型在处理不同尺寸和形状对象时的灵活性和性能。DLKA 的设计灵感源自传统的注意力机制,但通过引入可变形核(deformable kernel)来增强对局部特征的适应能力。

qq_64693987的博客 4046

the program 'java' can be found in the folowing packages

Ubuntu系统安装jdk的问题,配置环境变量,并且立即生效之后报错如下: The program 'java' can be found in the following packages: * default-jre * gcj-5-jre-headless * openjdk-8-jre-headless * gcj-4.8-jre-headless * gcj-4.9-jr...

无关内外,方圆其中 1万+

MicroPython学习:在STM32上进行移植

本文将介绍如何在STM32上移植MicroPython,并提供相应的源代码。通过以上步骤,你已经成功地将MicroPython移植到STM32上,并可以使用MicroPython语言编写和运行代码。你可以进一步探索MicroPython的功能和API,以利用STM32的各种外设和功能。使用STM32CubeProgrammer或其他适当的烧录工具,将编译生成的MicroPython固件烧录到STM32微控制器中。打开该文件,并根据你的STM32微控制器类型进行必要的配置更改。模块来控制STM32的LED。

JeeVue的博客 1239

[Ubuntu] 解决The program 'make' can be found in the following packages:

解决[ubuntu]The program 'make' can be found in the following packages

2万+

2017年全国大学生电子设计竞赛综合测评题目解析——Multisim仿真

1.题目 给定两个单电源的双运放芯片READ2302G芯片(当时记得增益带宽积好像是6M),一片HD74LS74数字芯片双D触发器,需要详细电路图、手写报告,5个波形输出,测频,测幅,8:00公布题目,15:00停止答题,中间可以吃饭(也可以不吃继续做),15:00清场,休息一段时间后开始进场测试,打分。 2.要求 (1)一片运放搭建方波振荡电路,频率 20 KHz,误差 0.1 KHz,幅度 3...

DengFengLai123的博客 2万+

视觉Transformer实战 | 将卷积引入视觉Transformer(CvT)

CvT 是一种融合卷积神经网络与 Vision Transformer 优势的视觉模型,旨在解决 ViT 缺乏平移不变性和局部性等归纳偏置的问题。CvT 采用分层结构逐级降采样,使用卷积词元嵌入代替传统 patch 切分,引入卷积投影替代线性投影。这些设计使得 CvT 能够去除位置编码,在高分辨率输入下表现更优。本节深入解析 CvT 的核心原理,并提供完整的 PyTorch 代码实现,演示如何在实际数据集上训练和评估 CvT 模型。

盼小辉丶的博客 733

How to install java and eclipse on linux

First of all, download from the website of java. I download 'jdk-8u102-linux-i586.tar.gz' unzip it to the specifical derictory. with the command:tar -zxvf jdk-8u102-linux-i586.tar.gz -C /home/so...

weixin_30748995的博客 85

CodeX 登录报错 os error 10013?一键修复 CodeX 无法登录问题(亲测有效)

CodeX 登录时报 os error 10013?本文提供快速修复方案,实测有效,彻底解决登录报错:登录失败:failed to start login server: 以一种访问权限不允许的方式做了一个访问套接字的尝试。 (os error 10013)的问题💡

XiaoqiangClub的博客 2968

adb调试问题集锦

adb调试问题集锦

汽车以太网和SOA 7324

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

云服务器安装java过程出错:“The program 'java' can be found in the following packages”

学完了JDBC想在服务器上试试web工程部署,和本地机一样要安装java、mysql以及tomcat等等以及配置。 看教程完成以下步骤,选择在root文件夹里面新建java文件(命令行:mkdir java) 1. 下载JDK(wget+下载链接) 注意:不可以直接右键网页的连接复制下载。下载链接必须是运行中下载的连接否则下载也也无法解压,因为没有accpet 正确运行图: 2. 解压JDK ...

。 6913

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

nginx报错The program 'nginx' can be found in the following packages

安装nginx的时候出现以下提示: The program 'nginx' can be found in the following packages:  * nginx-extras  * nginx-full  * nginx-light  Try: apt-get install   开始我以为是我的nginx安装错了,然后找各种教程仔细看安装步骤,觉得没有

ryan的博客 7285

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

linux使用mysql 在输入了mysql 之后出现 the programe can be found in the following packages

如图 ,我在想使用putty工具,连接到我的服务器上使用mysql时出现了以下的错误,竟然懵逼了==。 后来发现原来是服务器的上面没有安装mysql的客户端程序,所以输入 apt install mysql-client-core-5.7 回车之后,等待安转完成就成功了。 回头想了一下,应该是因为服务器的环境是一键安装的,所以就没有安装mysql的客户端。

寰宇的博客 9536

在查找预编译头指令时遇到意外的文件结尾的错误

VC++的程序读了好些,自己写的倒是没多少.当开始用VC.net做C++程序时,一个简单的文件总是遇到"在查找预编译头指令时遇到意外的文件结尾的错误".  后查得知,VC.net默认情况下使用预编译头(/Yu),在加入新.h文件后编译时总出现fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾的错误。解决方法是在在include头文件的地方加上#include "std

aasa2的专栏 4088

几个函数

/*++Copyright (c) 1991  Microsoft CorporationModule Name:    security.cAbstract:    This module implements Object Security APIs for Win32Author:    Jim Anderson (JimA) 01-Jul-1991    Rob

aasa2的专栏 1833

HarddsikvolumeX和盘符对应关系

char buf[300] = {0}; QueryDosDevice("C:" ,buf, 300); /Device/HarddiskVolume1

aasa2的专栏 1683

字符串和数值之间的转换

CString str_code = "FFFFFFF1";unsigned long ulong_code = strtoul(str_code.GetBuffer(9), NULL, 16); char *_itoa(   int value,   char *string,   int radix );尽然把这些基本的东西忘了!   

aasa2的专栏 1123

几个代码

BOOLForceFileNoCompress(    IN  DWORD cArgs,    IN  LPSTR Args[],    OUT LPSTR *TextOut    )/*++Routine Description:    Check to see if this file is using NTFS compression, and if so,    uncompr

aasa2的专栏 1054

如果知道“Internet Explorer_Server”窗口去获取IWebbrowser2接口

msg = RegisterWindowMessage(WM_HTML_GETOBJECT); LRESULT WHandleSendMessageTimeOut(WHandle, msg, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes); ObjectFromLresult(lRes, IHTMLDoc

aasa2的专栏 897

一个资源写到文件的例子

void WriteResourceToFile(HINSTANCE hInstance,                         int idResource,                         char const *filename){    //  access the binary resource    HRSRC hResInfo = FindResource(

aasa2的专栏 873
上一篇: How can a program reboot my PC
下一篇: HarddsikvolumeX和盘符对应关系
aasa2
博客等级 码龄25年 4粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址