se puede hacer eso ? es decir, apagar el pc como si apretaras el botón de reiniciar de la computadora , supongo que se deve de poder por que de alguna formar el sistema lo ase al apagar/reiniciar de modo normal y al ocurrir errores graves .

se vale en cualquier lenguaje , saludos!
Última edición por Snopk el 29 Sep 2009, 02:30, editado 1 vez en total.
http://www.freundt-esta-aburrido.blogspot.com
si pero tene en cuenta que a veces eso pasa a nivel hardware y no soft
como por ejemplo las pcs modernas y algunas no tanto , al elevarse la temperatura a cierto valor
se reinicia automaticamente, y ese reinicio no es por soft , sino por medio de hardware, osea es independiente del sistema operativo que este en ese momento.

y por otro lado tmb cuando se accede a alguna zona no permitida de memoria en algun windows , tamb se reinicia solo.
para hacer lo que queres, tenes q acceder a una zona de memoria no permitida(algun overflow o algo) y ahi pum reinicio brusco, pero sino creo q no es posible.
No hay éxito como el fracaso, pero el fracaso no es ningun éxito...
No se si sera algo estupido mi respuesta, pero xq no lo haces simplemente desde la shell?

si tu caso es un remoto desde algun cliente, simplemente entra desde la shell y ponle el comando shutdown -s -t 00

-s = apagar o tambien puedes usar -r = reiniciar
-t el tiempo de apagado o reinicio, obvio si pones 00 lo hara inmediatamente, si pones 05 = 5 segundos y asi.

si esta no es la respuesta que buscabas disculpame

shutdown -s -t 00
shutdown -r -t 00

y si quieres anular el reinicio o el apagado solo poniendo shutdown -a
Hasta ahora nada habia hecho cambiar mi firma.... Pero esto es un clasico... xD
polifemo escribió:any... Estoy rifando una patada en el culo y vos te estás comprando todos los números....Tus eternos comentarios de libertad e igualdad de hippie fracasado me tienen los huevos al plato....Aflojá hermano... porque te convierto en historia....
POLIFEMO.
blackmaster1212 escribió:No se si sera algo estupido mi respuesta, pero xq no lo haces simplemente desde la shell?

si tu caso es un remoto desde algun cliente, simplemente entra desde la shell y ponle el comando shutdown -s -t 00

-s = apagar o tambien puedes usar -r = reiniciar
-t el tiempo de apagado o reinicio, obvio si pones 00 lo hara inmediatamente, si pones 05 = 5 segundos y asi.

si esta no es la respuesta que buscabas disculpame

shutdown -s -t 00
shutdown -r -t 00

y si quieres anular el reinicio o el apagado solo poniendo shutdown -a
no ,no era lo que buscaba
lo que dice leos_79 esta interesante, voy a buscar una lista o algo que diga cuando se reinicia la pc de ese modo y tratar de cometer esos errores apropósito .
cualquier otra idea comentenla
saludos
http://www.freundt-esta-aburrido.blogspot.com
'**************************************
' Name: Absolutely Fastest, SmallestCode
' to Shutdown a Windows NT/2000/XP Compute
' r
' Description:This code instantly shuts


' down any NT-based OS, ie Windows NT 4, W
' indows 2000, XP, Server 2003, Longhorn,
' etc. (Not 95/98/Me).
I know there's a lot of code On the site that does this, but remember that on NT, things Get harder because your process needs the shutdown privilege. Other coders have used Win32 APIs To gain this privilege, but as I have said in my previous articles...the power lies in Native API.
In this unique example, only a Single API call is needed To enable the privilege, followed by another API call to instantly terminate the computer. If you compile this application, double-clicking on it will shut down your PC within a second.


Do what you please With it...it might Not be very useful most of the time (because it doesn't save any files), but If you ever need a quick shutdown (let's say you just ran a virus), this is as fast as pulling out the power cord.
' By: Ion Alex Ionescu
'
' Returns:A closed PC.
'
' Side Effects:Nothing will be saved, in
' stant shutdown.
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=53100&lngWId=1'for details.'**************************************

' // QuikDown 1.0
' // Written by Alex Ionescu
' // ©Relsoft Technologies 2004
' // COMMENTS: Smallest code to turn off
' a PC in the fastest way possible on NT.
' // *************
' // APIs
' // *************
' // Undocumented Native API to get Shut


' down Privilege


Public Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
' // Native API to Shutdown the System


Public Declare Function NtShutdownSystem& Lib "ntdll" (ByVal ShutdownAction&)
' // *************
' // Constants
' // *************
' // The Shutdown Privilege
Public Const SE_SHUTDOWN_PRIVILEGE& = 19
' // The Shutdown Actions
Public Const SHUTDOWN& = 0
Public Const RESTART& = 1
Public Const POWEROFF& = 2


Sub Main()

' // Instantly closes the computer on ex
' ecution
RtlAdjustPrivilege SE_SHUTDOWN_PRIVILEGE, 1, 0, 0' // Give us Shutdown Privileges
NtShutdownSystem SHUTDOWN ' // Take System Down
End Sub
genial, es exactamente el código que buscaba, savia que de algun modo se podía hacer e incluso en vb6.
gracias
http://www.freundt-esta-aburrido.blogspot.com
Responder

Volver a “Otros lenguajes”