En fait je suis en train de developper un driver qui doit refuser l'hibernation de windows sous certaines conditions.
Lors de la recepetion de l'IRP IRP_MN_SET_POWER, je complete l'IRP avec un status ERROR_UNSUCCESSFUL
Le code que j'utilise est le suivant :
Le probleme c'est que ce bout de code marche sur windows XP mais ne marche pas sur Vista.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 NTSTATUS SrvCore_DispatchPower(__in PDEVICE_OBJECT pDeviceObject, __in PIRP pIrp) { PIO_STACK_LOCATION _pIrpStack = NULL; NTSTATUS _Status = STATUS_SUCCESS; _pIrpStack = IoGetCurrentIrpStackLocation(pIrp); if (_pIrpStack->MinorFunction == IRP_MN_SET_POWER) { if (_pIrpStack->Parameters.Power.ShutdownType == PowerActionHibernate) { SrvCore_log(LOG_TRACE,"la demande d'hibernation n'est pas accepté en mode furtif \n"); pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL; PoStartNextPowerIrp(pIrp); IoCompleteRequest (pIrp, IO_NO_INCREMENT); return STATUS_SUCCESS; } } pIrp->IoStatus.Status = STATUS_SUCCESS; PoStartNextPowerIrp(pIrp); IoCompleteRequest (pIrp, IO_NO_INCREMENT); return STATUS_SUCCESS; }
Comment je pourrai refuser l'hibernation sur vista ?
Merci d'avance
Partager