2013-02-27 2 views
0

J'ai ce code MSNAAppel ExitWindowsEx dans MSNA

extern GetStdHandle 
extern WriteFile 
extern AllocConsole 
extern FreeConsole 
extern SetConsoleTitleA 
extern SetConsoleCursorPosition 
extern Sleep 
extern ExitProcess 
extern ExitWindowsEx 


import GetStdHandle kernel32.dll 
import WriteFile kernel32.dll 
import AllocConsole kernel32.dll 
import FreeConsole kernel32.dll 
import SetConsoleTitleA kernel32.dll 
import SetConsoleCursorPosition kernel32.dll 
import Sleep kernel32.dll 
import ExitProcess kernel32.dll 
import ExitWindowsEx user32.dll 

. 
section .text use32 

..start: 

call [ExitWindowsEx] 

Quand je l'exécute, il ne fonctionne pas la fonction qui est d'éteindre l'ordinateur. Je lis qu'il nécessite des paramètres, mais comment exactement nous transmettre les paramètres comme celui-ci en C#

enter image description here

+0

« Pour arrêter ou redémarrer le système, le processus d'appel doit utiliser la AdjustTokenPrivileges fonction pour activer le privilège SE_SHUTDOWN_NAME. Pour plus d'informations, voir Courir avec des privilèges spéciaux. » ([Voir MSDN] (http://msdn.microsoft.com/en-us/library/windows/desktop/aa376868%28v=vs.85%29.aspx)) – Michael

Répondre

3

Je suppose que vous utilisez l'architecture Intel 32 bits. Dans ce cas, vous devez passer les arguments dans la pile.

mov eax, 1 
mov ebx, 0 
push eax 
push ebx 
call [ExitWindowsEx] 
+0

essayé encore Windows ne s'éteint pas – WantIt

+0

le code fonctionne si Poussez eax en premier. – WantIt

+0

comment pouvons-nous inclure user32 et extern et appeler exitwindowsex dans tasm? – WantIt

Questions connexes