阅读:2603回复:8
ZwShutdownSystem编译不过的问题。
我在驱动中想调用ZwShutdownSystem来实现在驱动中关机的功能。但是不知道为什么就是编译通不过。
我使用ddk 是2003版本的。编译提示如下: 1>shutdown.c(37) : error C2064: term does not evaluate to a function taking 2691 0600 arguments 我调用的代码是: BOOLEAN en; status = RtlAdjustPrivilege(0x13,1,1,&en); if(STATUS_NO_TOKEN == status ) status = RtlAdjustPrivilege(0x13,1,0,&en); status = ZwShutdownSystem(ShutdownPowerOff); 请问这应该怎么解决? |
|
沙发#
发布于:2007-12-20 12:23
HMODULE hntDll = ::LoadLibrary("ntdll.dll");
fpZwShutdownSystem1 = (fpZwShutdownSystem)GetProcAddress(hntDll, "ZwShutdownSystem") 动态调用. |
|
板凳#
发布于:2007-12-20 14:43
楼上的是Win32的,不是内核的
|
|
地板#
发布于:2007-12-20 16:20
直接Int 2e
|
|
|
地下室#
发布于:2007-12-20 20:28
Int 2e无法保存数据吧,跟硬重启是一样的
|
|
5楼#
发布于:2007-12-21 12:23
int 2e是系统服务调用。。。可以call到内核ntshutdownsystem。。。不懂别说好吧
|
|
|
6楼#
发布于:2008-03-23 20:37
楼上的好像windows xp以后都是通过sysenter指令进入内核的,int 2eh不好使吧
|
|
7楼#
发布于:2008-03-23 20:54
int 2e一样好使
|
|
|
8楼#
发布于:2008-03-29 21:47
386
.model flat, stdcall option casemap:none include w2k\ntddk.inc include w2k\ntdll.inc includelib ntdll.lib ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .code DriverEntry proc pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING local ShutDown:DWORD invoke RtlAdjustPrivilege,SE_SHUTDOWN_PRIVILEGE,TRUE,TRUE,addr ShutDown .if eax==00C000007Ch invoke RtlAdjustPrivilege,SE_SHUTDOWN_PRIVILEGE,TRUE,FALSE,addr ShutDown invoke ZwShutdownSystem,2 .endif mov eax, STATUS_DEVICE_CONFIGURATION_ERROR ret DriverEntry endp ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> end DriverEntry |
|
|