TITLE C:\98DDK\src\usb\TEST98\SYS\testpnp.c .386P include listing.inc if @Version gt 510 .model FLAT else _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS _DATA SEGMENT DWORD USE32 PUBLIC 'DATA' _DATA ENDS CONST SEGMENT DWORD USE32 PUBLIC 'CONST' CONST ENDS _BSS SEGMENT DWORD USE32 PUBLIC 'BSS' _BSS ENDS _TLS SEGMENT DWORD USE32 PUBLIC 'TLS' _TLS ENDS ; COMDAT _Test98_AddDevice@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_PnP@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_FDO_PnP@16 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_FDO_PnPComplete@12 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_PnPRemove@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_StartFdo@12 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_Remove@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_Power@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_FDO_Power@8 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS ; COMDAT _Test98_PowerComplete@12 _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS FLAT GROUP _DATA, CONST, _BSS ASSUME CS: FLAT, DS: FLAT, SS: FLAT endif PUBLIC _Test98_AddDevice@8 EXTRN __imp__IoCreateSymbolicLink@8:NEAR EXTRN __imp__KeInitializeEvent@12:NEAR EXTRN __imp__IoRegisterDeviceInterface@16:NEAR EXTRN __imp__KeInitializeSpinLock@4:NEAR EXTRN __imp__IoSetDeviceInterfaceState@8:NEAR EXTRN _GUID_TEST_DEVICE:BYTE EXTRN __imp__RtlInitUnicodeString@8:NEAR EXTRN __imp__IoAttachDeviceToDeviceStack@8:NEAR EXTRN __imp__IoCreateDevice@28:NEAR ; COMDAT _Test98_AddDevice@8 _TEXT SEGMENT $SG2792 DB '\', 00H, 'D', 00H, 'e', 00H, 'v', 00H, 'i', 00H, 'c', 00H DB 'e', 00H, '\', 00H, 'T', 00H, 'e', 00H, 's', 00H, 't', 00H, '-' DB 00H, '0', 00H, 00H, 00H ORG $+2 $SG2794 DB '\', 00H, 'D', 00H, 'o', 00H, 's', 00H, 'D', 00H, 'e', 00H DB 'v', 00H, 'i', 00H, 'c', 00H, 'e', 00H, 's', 00H, '\', 00H, 'T' DB 00H, 'e', 00H, 's', 00H, 't', 00H, '-', 00H, '0', 00H, 00H, 00H _DriverObject$ = 8 _PhysicalDeviceObject$ = 12 _status$ = -112 _deviceObject$ = -60 _deviceData$ = -116 _pdoUniName$ = -56 _pdoName$ = -100 _DeviceLinkBuffer$ = -48 _DeviceLinkUnicodeString$ = -68 _Test98_AddDevice@8 PROC NEAR ; COMDAT ; 37 : { 00046 55 push ebp 00047 8b ec mov ebp, esp 00049 83 ec 78 sub esp, 120 ; 00000078H 0004c 53 push ebx 0004d 56 push esi 0004e 57 push edi ; 38 : NTSTATUS status; ; 39 : PDEVICE_OBJECT deviceObject; ; 40 : PFDO_DEVICE_DATA deviceData; ; 41 : UNICODE_STRING deviceNameUni; ; 42 : PWCHAR deviceName; ; 43 : ULONG nameLength; ; 44 : ; 45 : UNICODE_STRING pdoUniName; ; 46 : WCHAR pdoName[] = L"\\Device\\Test-0" ; // DeviceNameBuffer 0004f be 00 00 00 00 mov esi, OFFSET FLAT:$SG2792 00054 8d 7d 9c lea edi, DWORD PTR _pdoName$[ebp] 00057 b9 07 00 00 00 mov ecx, 7 0005c f3 a5 rep movsd 0005e 66 a5 movsw ; 47 : ; 48 : WCHAR DeviceLinkBuffer[] = L"\\DosDevices\\Test-0"; 00060 be 00 00 00 00 mov esi, OFFSET FLAT:$SG2794 00065 8d 7d d0 lea edi, DWORD PTR _DeviceLinkBuffer$[ebp] 00068 b9 09 00 00 00 mov ecx, 9 0006d f3 a5 rep movsd 0006f 66 a5 movsw ; 49 : UNICODE_STRING DeviceLinkUnicodeString; ; 50 : ; 51 : RtlInitUnicodeString (&pdoUniName, pdoName); 00071 8d 45 9c lea eax, DWORD PTR _pdoName$[ebp] 00074 50 push eax 00075 8d 45 c8 lea eax, DWORD PTR _pdoUniName$[ebp] 00078 50 push eax 00079 ff 15 00 00 00 00 call DWORD PTR __imp__RtlInitUnicodeString@8 ; 52 : ; 53 : status = IoCreateDevice ( ; 54 : DriverObject, // our driver object ; 55 : sizeof (FDO_DEVICE_DATA), // device object extension size ; 56 : ; 57 : &pdoUniName, ; 58 : ; 59 : FILE_DEVICE_UNKNOWN, ; 60 : 0, // No special characteristics ; 61 : FALSE, ; 62 : &deviceObject); // The device object created 0007f 8d 45 c4 lea eax, DWORD PTR _deviceObject$[ebp] 00082 50 push eax 00083 6a 00 push 0 00085 6a 00 push 0 00087 6a 22 push 34 ; 00000022H 00089 8d 45 c8 lea eax, DWORD PTR _pdoUniName$[ebp] 0008c 50 push eax 0008d 6a 70 push 112 ; 00000070H 0008f 8b 45 08 mov eax, DWORD PTR _DriverObject$[ebp] 00092 50 push eax 00093 ff 15 00 00 00 00 call DWORD PTR __imp__IoCreateDevice@28 00099 89 45 90 mov DWORD PTR _status$[ebp], eax ; 63 : ; 64 : if (NT_SUCCESS (status)) { 0009c 83 7d 90 00 cmp DWORD PTR _status$[ebp], 0 000a0 0f 8c f5 00 00 00 jl $L2796 ; 65 : ; 66 : RtlInitUnicodeString (&DeviceLinkUnicodeString, ; 67 : DeviceLinkBuffer); 000a6 8d 45 d0 lea eax, DWORD PTR _DeviceLinkBuffer$[ebp] 000a9 50 push eax 000aa 8d 45 bc lea eax, DWORD PTR _DeviceLinkUnicodeString$[ebp] 000ad 50 push eax 000ae ff 15 00 00 00 00 call DWORD PTR __imp__RtlInitUnicodeString@8 ; 68 : ; 69 : status = IoCreateSymbolicLink(&DeviceLinkUnicodeString, ; 70 : &pdoUniName); 000b4 8d 45 c8 lea eax, DWORD PTR _pdoUniName$[ebp] 000b7 50 push eax 000b8 8d 45 bc lea eax, DWORD PTR _DeviceLinkUnicodeString$[ebp] 000bb 50 push eax 000bc ff 15 00 00 00 00 call DWORD PTR __imp__IoCreateSymbolicLink@8 000c2 89 45 90 mov DWORD PTR _status$[ebp], eax ; 71 : ; 72 : deviceData = (PFDO_DEVICE_DATA) deviceObject->DeviceExtension; 000c5 8b 45 c4 mov eax, DWORD PTR _deviceObject$[ebp] 000c8 8b 40 28 mov eax, DWORD PTR [eax+40] 000cb 89 45 8c mov DWORD PTR _deviceData$[ebp], eax ; 73 : RtlFillMemory (deviceData, sizeof (FDO_DEVICE_DATA), 0); 000ce 8b 7d 8c mov edi, DWORD PTR _deviceData$[ebp] 000d1 33 c0 xor eax, eax 000d3 b9 1c 00 00 00 mov ecx, 28 ; 0000001cH 000d8 f3 ab rep stosd ; 74 : ; 75 : deviceData->IsFDO = TRUE; 000da 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 000dd c6 40 07 01 mov BYTE PTR [eax+7], 1 ; 76 : deviceData->DebugLevel = TEST_DEFAULT_DEBUG_OUTPUT_LEVEL; 000e1 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 000e4 c7 40 08 88 cc cc cc mov DWORD PTR [eax+8], -858993528 ; cccccc88H ; 77 : deviceData->Self = deviceObject; 000eb 8b 45 c4 mov eax, DWORD PTR _deviceObject$[ebp] 000ee 8b 4d 8c mov ecx, DWORD PTR _deviceData$[ebp] 000f1 89 01 mov DWORD PTR [ecx], eax ; 78 : ; 79 : KeInitializeSpinLock (&deviceData->Spin); 000f3 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 000f6 83 c0 14 add eax, 20 ; 00000014H 000f9 50 push eax 000fa ff 15 00 00 00 00 call DWORD PTR __imp__KeInitializeSpinLock@4 ; 80 : ; 81 : deviceData->Removed = FALSE; 00100 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 00103 c6 40 1b 00 mov BYTE PTR [eax+27], 0 ; 82 : ; 83 : InitializeListHead (&deviceData->PDOs); 00107 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 0010a 83 c0 1c add eax, 28 ; 0000001cH 0010d 89 45 88 mov DWORD PTR -120+[ebp], eax 00110 8b 45 88 mov eax, DWORD PTR -120+[ebp] 00113 8b 4d 8c mov ecx, DWORD PTR _deviceData$[ebp] 00116 89 41 20 mov DWORD PTR [ecx+32], eax 00119 8b 45 88 mov eax, DWORD PTR -120+[ebp] 0011c 8b 4d 8c mov ecx, DWORD PTR _deviceData$[ebp] 0011f 89 41 1c mov DWORD PTR [ecx+28], eax ; 84 : ; 85 : // Set the PDO for use with PlugPlay functions ; 86 : deviceData->UnderlyingPDO = PhysicalDeviceObject; 00122 8b 45 0c mov eax, DWORD PTR _PhysicalDeviceObject$[ebp] 00125 8b 4d 8c mov ecx, DWORD PTR _deviceData$[ebp] 00128 89 41 28 mov DWORD PTR [ecx+40], eax ; 87 : ; 88 : // Attach our driver to the device stack. ; 89 : deviceData->TopOfStack = IoAttachDeviceToDeviceStack ( ; 90 : deviceObject, ; 91 : PhysicalDeviceObject); 0012b 8b 45 0c mov eax, DWORD PTR _PhysicalDeviceObject$[ebp] 0012e 50 push eax 0012f 8b 45 c4 mov eax, DWORD PTR _deviceObject$[ebp] 00132 50 push eax 00133 ff 15 00 00 00 00 call DWORD PTR __imp__IoAttachDeviceToDeviceStack@8 00139 8b 4d 8c mov ecx, DWORD PTR _deviceData$[ebp] 0013c 89 41 2c mov DWORD PTR [ecx+44], eax ; 92 : ; 93 : // Bias outstanding request to 1 so that we can look for a ; 94 : // transition to zero when processing the remove device PlugPlay IRP. ; 95 : ; 96 : deviceData->OutstandingIO = 1; 0013f 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 00142 c7 40 40 01 00 00 00 mov DWORD PTR [eax+64], 1 ; 97 : ; 98 : KeInitializeEvent(&deviceData->RemoveEvent, ; 99 : SynchronizationEvent, ; 100 : FALSE); // initialized to not signalled 00149 6a 00 push 0 0014b 6a 01 push 1 0014d 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 00150 83 c0 44 add eax, 68 ; 00000044H 00153 50 push eax 00154 ff 15 00 00 00 00 call DWORD PTR __imp__KeInitializeEvent@12 ; 101 : ; 102 : deviceObject->Flags &= ~DO_DEVICE_INITIALIZING; 0015a 8b 45 c4 mov eax, DWORD PTR _deviceObject$[ebp] 0015d 81 60 1c 7f ff ff ff and DWORD PTR [eax+28], -129 ; ffffff7fH ; 103 : deviceObject->Flags |= DO_POWER_PAGABLE; 00164 8b 45 c4 mov eax, DWORD PTR _deviceObject$[ebp] 00167 81 48 1c 00 20 00 00 or DWORD PTR [eax+28], 8192 ; 00002000H ; 104 : ; 105 : // register device functionality ; 106 : status = IoRegisterDeviceInterface ( ; 107 : PhysicalDeviceObject, ; 108 : (LPGUID) &GUID_TEST_DEVICE, ; 109 : NULL, // No ref string ; 110 : &deviceData->DevClassAssocName); 0016e 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 00171 83 c0 54 add eax, 84 ; 00000054H 00174 50 push eax 00175 6a 00 push 0 00177 68 00 00 00 00 push OFFSET FLAT:_GUID_TEST_DEVICE 0017c 8b 45 0c mov eax, DWORD PTR _PhysicalDeviceObject$[ebp] 0017f 50 push eax 00180 ff 15 00 00 00 00 call DWORD PTR __imp__IoRegisterDeviceInterface@16 00186 89 45 90 mov DWORD PTR _status$[ebp], eax ; 111 : ; 112 : status = IoSetDeviceInterfaceState ( ; 113 : &deviceData->DevClassAssocName, ; 114 : TRUE); 00189 6a 01 push 1 0018b 8b 45 8c mov eax, DWORD PTR _deviceData$[ebp] 0018e 83 c0 54 add eax, 84 ; 00000054H 00191 50 push eax 00192 ff 15 00 00 00 00 call DWORD PTR __imp__IoSetDeviceInterfaceState@8 00198 89 45 90 mov DWORD PTR _status$[ebp], eax $L2796: ; 115 : ; 116 : } ; 117 : ; 118 : return status; 0019b 8b 45 90 mov eax, DWORD PTR _status$[ebp] 0019e e9 00 00 00 00 jmp $L2783 $L2783: ; 119 : ; 120 : } 001a3 5f pop edi 001a4 5e pop esi 001a5 5b pop ebx 001a6 c9 leave 001a7 c2 08 00 ret 8 _Test98_AddDevice@8 ENDP _TEXT ENDS PUBLIC _Test98_PnP@8 PUBLIC _Test98_FDO_PnP@16 ; COMDAT _Test98_PnP@8 _TEXT SEGMENT _DeviceObject$ = 8 _Irp$ = 12 _irpStack$ = -16 _status$ = -12 _commonData$ = -4 _Test98_PnP@8 PROC NEAR ; COMDAT ; 141 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 10 sub esp, 16 ; 00000010H 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 142 : PIO_STACK_LOCATION irpStack; ; 143 : NTSTATUS status; ; 144 : PCOMMON_DEVICE_DATA commonData; ; 145 : KIRQL oldIrq; ; 146 : ; 147 : PAGED_CODE (); ; 148 : ; 149 : status = STATUS_SUCCESS; 00009 c7 45 f4 00 00 00 00 mov DWORD PTR _status$[ebp], 0 ; 150 : irpStack = IoGetCurrentIrpStackLocation (Irp); 00010 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00013 8b 40 60 mov eax, DWORD PTR [eax+96] 00016 89 45 f0 mov DWORD PTR _irpStack$[ebp], eax ; 151 : ASSERT (IRP_MJ_PNP == irpStack->MajorFunction); ; 152 : ; 153 : commonData = (PCOMMON_DEVICE_DATA) DeviceObject->DeviceExtension; 00019 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 0001c 8b 40 28 mov eax, DWORD PTR [eax+40] 0001f 89 45 fc mov DWORD PTR _commonData$[ebp], eax ; 154 : ; 155 : ; 156 : status = Test98_FDO_PnP ( ; 157 : DeviceObject, ; 158 : Irp, ; 159 : irpStack, ; 160 : (PFDO_DEVICE_DATA) commonData); 00022 8b 45 fc mov eax, DWORD PTR _commonData$[ebp] 00025 50 push eax 00026 8b 45 f0 mov eax, DWORD PTR _irpStack$[ebp] 00029 50 push eax 0002a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0002d 50 push eax 0002e 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 00031 50 push eax 00032 e8 00 00 00 00 call _Test98_FDO_PnP@16 00037 89 45 f4 mov DWORD PTR _status$[ebp], eax ; 161 : ; 162 : return status; 0003a 8b 45 f4 mov eax, DWORD PTR _status$[ebp] 0003d e9 00 00 00 00 jmp $L2803 $L2803: ; 163 : ; 164 : } 00042 5f pop edi 00043 5e pop esi 00044 5b pop ebx 00045 c9 leave 00046 c2 08 00 ret 8 _Test98_PnP@8 ENDP _TEXT ENDS PUBLIC _Test98_StartFdo@12 PUBLIC _Test98_FDO_PnPComplete@12 EXTRN __imp__IoDeleteDevice@4:NEAR EXTRN __imp__IoDetachDevice@4:NEAR EXTRN __imp__KeWaitForSingleObject@20:NEAR EXTRN __imp__ExFreePool@4:NEAR EXTRN __imp__MmUnmapIoSpace@8:NEAR EXTRN _Test98_IncIoCount@4:NEAR EXTRN _Test98_DecIoCount@4:NEAR EXTRN __imp_@IofCallDriver@8:NEAR EXTRN __imp_@IofCompleteRequest@8:NEAR EXTRN __imp_@InterlockedDecrement@4:NEAR ; COMDAT _Test98_FDO_PnP@16 _TEXT SEGMENT _DeviceObject$ = 8 _Irp$ = 12 _IrpStack$ = 16 _DeviceData$ = 20 _status$ = -28 _event$ = -48 _i$ = -20 _stack$ = -12 _irpSp$2829 = -56 _nextIrpSp$2830 = -52 _irpSp$2831 = -60 _Test98_FDO_PnP@16 PROC NEAR ; COMDAT ; 179 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 40 sub esp, 64 ; 00000040H 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 180 : NTSTATUS status; ; 181 : KIRQL oldIrq; ; 182 : KEVENT event; ; 183 : ULONG length; ; 184 : ULONG i; ; 185 : PLIST_ENTRY entry; ; 186 : PPDO_DEVICE_DATA pdoData; ; 187 : PDEVICE_RELATIONS relations; ; 188 : PIO_STACK_LOCATION stack; ; 189 : ; 190 : PAGED_CODE (); ; 191 : ; 192 : status = Test98_IncIoCount (DeviceData); 00009 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 0000c 50 push eax 0000d e8 00 00 00 00 call _Test98_IncIoCount@4 00012 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 193 : if (!NT_SUCCESS (status)) { 00015 83 7d e4 00 cmp DWORD PTR _status$[ebp], 0 00019 0f 8d 26 00 00 00 jge $L2822 ; 194 : Irp->IoStatus.Information = 0; 0001f 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00022 c7 40 1c 00 00 00 00 mov DWORD PTR [eax+28], 0 ; 195 : Irp->IoStatus.Status = status; 00029 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 0002c 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 0002f 89 41 18 mov DWORD PTR [ecx+24], eax ; 196 : IoCompleteRequest (Irp, IO_NO_INCREMENT); 00032 33 d2 xor edx, edx 00034 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 00037 ff 15 00 00 00 00 call DWORD PTR __imp_@IofCompleteRequest@8 ; 197 : return status; 0003d 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 00040 e9 b5 03 00 00 jmp $L2812 $L2822: ; 198 : } ; 199 : ; 200 : stack = IoGetCurrentIrpStackLocation (Irp); 00045 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00048 8b 40 60 mov eax, DWORD PTR [eax+96] 0004b 89 45 f4 mov DWORD PTR _stack$[ebp], eax ; 201 : ; 202 : switch (IrpStack->MinorFunction) { 0004e 8b 45 10 mov eax, DWORD PTR _IrpStack$[ebp] 00051 33 c9 xor ecx, ecx 00053 8a 48 01 mov cl, BYTE PTR [eax+1] 00056 89 4d c0 mov DWORD PTR -64+[ebp], ecx 00059 e9 4b 03 00 00 jmp $L2823 $L2827: ; 203 : case IRP_MN_START_DEVICE: ; 204 : // PnP manager send this IPR after assigning resoureces to the device; ; 205 : // the device may have been recently numerate and being started ; 206 : // for the first time ; 207 : ; 208 : if (DeviceData->Started) { 0005e 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00061 33 c9 xor ecx, ecx 00063 8a 48 1a mov cl, BYTE PTR [eax+26] 00066 85 c9 test ecx, ecx 00068 0f 84 0c 00 00 00 je $L2828 ; 209 : status = STATUS_SUCCESS; 0006e c7 45 e4 00 00 00 00 mov DWORD PTR _status$[ebp], 0 ; 210 : break; 00075 e9 5b 03 00 00 jmp $L2824 $L2828: ; 211 : } ; 212 : ; 213 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_TRACE, ("Start Device\n")); ; 214 : ; 215 : KeInitializeEvent (&event, NotificationEvent, FALSE); 0007a 6a 00 push 0 0007c 6a 00 push 0 0007e 8d 45 d0 lea eax, DWORD PTR _event$[ebp] 00081 50 push eax 00082 ff 15 00 00 00 00 call DWORD PTR __imp__KeInitializeEvent@12 ; 216 : IoCopyCurrentIrpStackLocationToNext (Irp); 00088 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0008b 8b 40 60 mov eax, DWORD PTR [eax+96] 0008e 89 45 c8 mov DWORD PTR _irpSp$2829[ebp], eax 00091 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00094 8b 40 60 mov eax, DWORD PTR [eax+96] 00097 83 e8 24 sub eax, 36 ; 00000024H 0009a 89 45 cc mov DWORD PTR _nextIrpSp$2830[ebp], eax 0009d 8b 7d cc mov edi, DWORD PTR _nextIrpSp$2830[ebp] 000a0 8b 75 c8 mov esi, DWORD PTR _irpSp$2829[ebp] 000a3 b9 07 00 00 00 mov ecx, 7 000a8 f3 a5 rep movsd 000aa 8b 45 cc mov eax, DWORD PTR _nextIrpSp$2830[ebp] 000ad c6 40 03 00 mov BYTE PTR [eax+3], 0 ; 217 : ; 218 : IoSetCompletionRoutine (Irp, ; 219 : Test98_FDO_PnPComplete, ; 220 : &event, ; 221 : TRUE, ; 222 : TRUE, ; 223 : TRUE); 000b1 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 000b4 8b 40 60 mov eax, DWORD PTR [eax+96] 000b7 83 e8 24 sub eax, 36 ; 00000024H 000ba 89 45 c4 mov DWORD PTR _irpSp$2831[ebp], eax 000bd 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000c0 c7 40 1c 00 00 00 00 mov DWORD PTR [eax+28], OFFSET FLAT:_Test98_FDO_PnPComplete@12 000c7 8d 45 d0 lea eax, DWORD PTR _event$[ebp] 000ca 8b 4d c4 mov ecx, DWORD PTR _irpSp$2831[ebp] 000cd 89 41 20 mov DWORD PTR [ecx+32], eax 000d0 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000d3 c6 40 03 00 mov BYTE PTR [eax+3], 0 000d7 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000da c6 40 03 40 mov BYTE PTR [eax+3], 64 ; 00000040H $L2832: 000de 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000e1 33 c9 xor ecx, ecx 000e3 8a 48 03 mov cl, BYTE PTR [eax+3] 000e6 80 c9 80 or cl, 128 ; 00000080H 000e9 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000ec 88 48 03 mov BYTE PTR [eax+3], cl $L2833: 000ef 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000f2 33 c9 xor ecx, ecx 000f4 8a 48 03 mov cl, BYTE PTR [eax+3] 000f7 80 c9 20 or cl, 32 ; 00000020H 000fa 8b 45 c4 mov eax, DWORD PTR _irpSp$2831[ebp] 000fd 88 48 03 mov BYTE PTR [eax+3], cl $L2834: ; 224 : ; 225 : status = IoCallDriver (DeviceData->TopOfStack, Irp); 00100 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00103 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 00106 8b 48 2c mov ecx, DWORD PTR [eax+44] 00109 ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 0010f 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 226 : ; 227 : if (STATUS_PENDING == status) { 00112 81 7d e4 03 01 00 00 cmp DWORD PTR _status$[ebp], 259 ; 00000103H 00119 0f 85 1e 00 00 00 jne $L2835 ; 228 : // wait for it... ; 229 : ; 230 : status = KeWaitForSingleObject (&event, ; 231 : Executive, ; 232 : KernelMode, ; 233 : FALSE, // Not allertable ; 234 : NULL); // No timeout structure 0011f 6a 00 push 0 00121 6a 00 push 0 00123 6a 00 push 0 00125 6a 00 push 0 00127 8d 45 d0 lea eax, DWORD PTR _event$[ebp] 0012a 50 push eax 0012b ff 15 00 00 00 00 call DWORD PTR __imp__KeWaitForSingleObject@20 00131 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 235 : ; 236 : ASSERT (STATUS_SUCCESS == status); ; 237 : ; 238 : status = Irp->IoStatus.Status; 00134 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00137 8b 40 18 mov eax, DWORD PTR [eax+24] 0013a 89 45 e4 mov DWORD PTR _status$[ebp], eax $L2835: ; 239 : } ; 240 : ; 241 : if (NT_SUCCESS(status)) { 0013d 83 7d e4 00 cmp DWORD PTR _status$[ebp], 0 00141 0f 8c 57 00 00 00 jl $L2836 ; 242 : // ; 243 : // Do what ever after device started ; 244 : // ; 245 : ; 246 : if ((NULL == stack->Parameters.StartDevice.AllocatedResources) || ; 247 : (NULL == stack->Parameters.StartDevice.AllocatedResourcesTranslated)) { 00147 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 0014a 83 78 04 00 cmp DWORD PTR [eax+4], 0 0014e 0f 84 0d 00 00 00 je $L2838 00154 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 00157 83 78 08 00 cmp DWORD PTR [eax+8], 0 0015b 0f 85 0c 00 00 00 jne $L2837 $L2838: ; 248 : ; 249 : status = STATUS_INSUFFICIENT_RESOURCES; 00161 c7 45 e4 9a 00 00 c0 mov DWORD PTR _status$[ebp], -1073741670 ; c000009aH ; 250 : break; 00168 e9 68 02 00 00 jmp $L2824 $L2837: ; 251 : } ; 252 : status = Test98_StartFdo (DeviceData, ; 253 : &stack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList, ; 254 : &stack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList); 0016d 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 00170 8b 40 08 mov eax, DWORD PTR [eax+8] 00173 83 c0 0c add eax, 12 ; 0000000cH 00176 50 push eax 00177 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 0017a 8b 40 04 mov eax, DWORD PTR [eax+4] 0017d 83 c0 0c add eax, 12 ; 0000000cH 00180 50 push eax 00181 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00184 50 push eax 00185 e8 00 00 00 00 call _Test98_StartFdo@12 0018a 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 255 : ; 256 : ; 257 : if (NT_SUCCESS (status)) { 0018d 83 7d e4 00 cmp DWORD PTR _status$[ebp], 0 00191 0f 8c 07 00 00 00 jl $L2839 ; 258 : DeviceData->Started = TRUE; 00197 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 0019a c6 40 1a 01 mov BYTE PTR [eax+26], 1 $L2839: $L2836: ; 259 : } ; 260 : } ; 261 : ; 262 : // ; 263 : // We must now complete the IRP, since we stopped it in the ; 264 : // completetion routine with MORE_PROCESSING_REQUIRED. ; 265 : // ; 266 : ; 267 : Irp->IoStatus.Information = 0; 0019e 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001a1 c7 40 1c 00 00 00 00 mov DWORD PTR [eax+28], 0 ; 268 : break; 001a8 e9 28 02 00 00 jmp $L2824 $L2840: ; 269 : ; 270 : case IRP_MN_QUERY_STOP_DEVICE: ; 271 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_TRACE, ("Query Stop Device\n")); ; 272 : ; 273 : // This occurs during shutdown when user explicitly requesting ; 274 : // the service to be stopped ; 275 : // ; 276 : ; 277 : if (DeviceData->NumPDOs) { 001ad 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 001b0 83 78 24 00 cmp DWORD PTR [eax+36], 0 001b4 0f 84 0c 00 00 00 je $L2841 ; 278 : status = STATUS_UNSUCCESSFUL; 001ba c7 45 e4 01 00 00 c0 mov DWORD PTR _status$[ebp], -1073741823 ; c0000001H ; 279 : } else { 001c1 e9 07 00 00 00 jmp $L2842 $L2841: ; 280 : status = STATUS_SUCCESS; 001c6 c7 45 e4 00 00 00 00 mov DWORD PTR _status$[ebp], 0 $L2842: ; 281 : } ; 282 : ; 283 : Irp->IoStatus.Status = status; 001cd 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 001d0 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 001d3 89 41 18 mov DWORD PTR [ecx+24], eax ; 284 : IoSkipCurrentIrpStackLocation (Irp); 001d6 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001d9 fe 40 23 inc BYTE PTR [eax+35] 001dc 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001df 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H ; 285 : status = IoCallDriver (DeviceData->TopOfStack, Irp); 001e3 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 001e6 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 001e9 8b 48 2c mov ecx, DWORD PTR [eax+44] 001ec ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 001f2 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 286 : ; 287 : Test98_DecIoCount (DeviceData); 001f5 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 001f8 50 push eax 001f9 e8 00 00 00 00 call _Test98_DecIoCount@4 ; 288 : return status; 001fe 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 00201 e9 f4 01 00 00 jmp $L2812 $L2843: ; 289 : ; 290 : case IRP_MN_STOP_DEVICE: ; 291 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_TRACE, ("Stop Device\n")); ; 292 : ; 293 : // PnP manager sends this IPR to stop a device so that it can reconfigure ; 294 : // its resources. sends this only after IRP_MN_QUERY_STOP_DEVICE ; 295 : // completed successfully ; 296 : // ; 297 : if (DeviceData->Started) { 00206 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00209 33 c9 xor ecx, ecx 0020b 8a 48 1a mov cl, BYTE PTR [eax+26] 0020e 85 c9 test ecx, ecx 00210 0f 84 1f 00 00 00 je $L2844 ; 298 : // ; 299 : // Free resources given by start device. ; 300 : // ; 301 : if (DeviceData->MappedPorts) { 00216 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00219 33 c9 xor ecx, ecx 0021b 8a 48 18 mov cl, BYTE PTR [eax+24] 0021e 85 c9 test ecx, ecx 00220 0f 84 0f 00 00 00 je $L2845 ; 302 : MmUnmapIoSpace (DeviceData->TestPortAddress, 1); 00226 6a 01 push 1 00228 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 0022b 8b 40 68 mov eax, DWORD PTR [eax+104] 0022e 50 push eax 0022f ff 15 00 00 00 00 call DWORD PTR __imp__MmUnmapIoSpace@8 $L2845: $L2844: ; 303 : } ; 304 : } ; 305 : DeviceData->Started = FALSE; 00235 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00238 c6 40 1a 00 mov BYTE PTR [eax+26], 0 ; 306 : ; 307 : // ; 308 : // don't need a completion routine so fire and forget. ; 309 : // ; 310 : Irp->IoStatus.Status = STATUS_SUCCESS; 0023c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0023f c7 40 18 00 00 00 00 mov DWORD PTR [eax+24], 0 ; 311 : IoSkipCurrentIrpStackLocation (Irp); 00246 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00249 fe 40 23 inc BYTE PTR [eax+35] 0024c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0024f 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H ; 312 : status = IoCallDriver (DeviceData->TopOfStack, Irp); 00253 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00256 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 00259 8b 48 2c mov ecx, DWORD PTR [eax+44] 0025c ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 00262 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 313 : ; 314 : Test98_DecIoCount (DeviceData); 00265 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00268 50 push eax 00269 e8 00 00 00 00 call _Test98_DecIoCount@4 ; 315 : return status; 0026e 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 00271 e9 84 01 00 00 jmp $L2812 $L2846: ; 316 : ; 317 : case IRP_MN_REMOVE_DEVICE: ; 318 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_TRACE, ("Remove Device\n")); ; 319 : ; 320 : // ; 321 : // PnP manager uses this IRP to dirct drivers to remove a device ; 322 : // ; 323 : DeviceData->Removed = TRUE; 00276 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00279 c6 40 1b 01 mov BYTE PTR [eax+27], 1 ; 324 : ; 325 : // ; 326 : // Complete any outstanding IRPs queued by the driver here. ; 327 : // ; 328 : ; 329 : IoSetDeviceInterfaceState (&DeviceData->DevClassAssocName, FALSE); 0027d 6a 00 push 0 0027f 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00282 83 c0 54 add eax, 84 ; 00000054H 00285 50 push eax 00286 ff 15 00 00 00 00 call DWORD PTR __imp__IoSetDeviceInterfaceState@8 ; 330 : ; 331 : // ; 332 : // complete any outstanding reqeusts now. ; 333 : // Fire and forget ; 334 : // ; 335 : ; 336 : IoSkipCurrentIrpStackLocation (Irp); 0028c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0028f fe 40 23 inc BYTE PTR [eax+35] 00292 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00295 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H ; 337 : IoCallDriver (DeviceData->TopOfStack, Irp); 00299 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 0029c 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 0029f 8b 48 2c mov ecx, DWORD PTR [eax+44] 002a2 ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 ; 338 : ; 339 : // ; 340 : // Wait for all outstanding requests to complete ; 341 : // ; 342 : i = InterlockedDecrement (&DeviceData->OutstandingIO); 002a8 8b 4d 14 mov ecx, DWORD PTR _DeviceData$[ebp] 002ab 83 c1 40 add ecx, 64 ; 00000040H 002ae ff 15 00 00 00 00 call DWORD PTR __imp_@InterlockedDecrement@4 002b4 89 45 ec mov DWORD PTR _i$[ebp], eax ; 343 : ; 344 : ASSERT (0 < i); ; 345 : ; 346 : if (0 != InterlockedDecrement (&DeviceData->OutstandingIO)) { 002b7 8b 4d 14 mov ecx, DWORD PTR _DeviceData$[ebp] 002ba 83 c1 40 add ecx, 64 ; 00000040H 002bd ff 15 00 00 00 00 call DWORD PTR __imp_@InterlockedDecrement@4 002c3 85 c0 test eax, eax 002c5 0f 84 15 00 00 00 je $L2847 ; 347 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_INFO, ; 348 : ("Remove Device waiting for request to complete\n")); ; 349 : ; 350 : KeWaitForSingleObject (&DeviceData->RemoveEvent, ; 351 : Suspended, ; 352 : KernelMode, ; 353 : FALSE, // Not Alertable ; 354 : NULL); // No timeout 002cb 6a 00 push 0 002cd 6a 00 push 0 002cf 6a 00 push 0 002d1 6a 05 push 5 002d3 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 002d6 83 c0 44 add eax, 68 ; 00000044H 002d9 50 push eax 002da ff 15 00 00 00 00 call DWORD PTR __imp__KeWaitForSingleObject@20 $L2847: ; 355 : } ; 356 : // ; 357 : // Free the associated resources ; 358 : // Detatch from the undelying devices. ; 359 : // ; 360 : Test98_KdPrint(DeviceData, TEST_DBG_PNP_INFO, ; 361 : ("IoDetachDevice: 0x%x\n", DeviceData->TopOfStack)); ; 362 : IoDetachDevice (DeviceData->TopOfStack); 002e0 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 002e3 8b 40 2c mov eax, DWORD PTR [eax+44] 002e6 50 push eax 002e7 ff 15 00 00 00 00 call DWORD PTR __imp__IoDetachDevice@4 ; 363 : ; 364 : // ; 365 : // Clean up any resources here ; 366 : // ; 367 : if (DeviceData->Started) { 002ed 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 002f0 33 c9 xor ecx, ecx 002f2 8a 48 1a mov cl, BYTE PTR [eax+26] 002f5 85 c9 test ecx, ecx 002f7 0f 84 1f 00 00 00 je $L2848 ; 368 : // ; 369 : // Free resources given by start device. ; 370 : // ; 371 : if (DeviceData->MappedPorts) { 002fd 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00300 33 c9 xor ecx, ecx 00302 8a 48 18 mov cl, BYTE PTR [eax+24] 00305 85 c9 test ecx, ecx 00307 0f 84 0f 00 00 00 je $L2849 ; 372 : MmUnmapIoSpace (DeviceData->TestPortAddress, 1); 0030d 6a 01 push 1 0030f 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00312 8b 40 68 mov eax, DWORD PTR [eax+104] 00315 50 push eax 00316 ff 15 00 00 00 00 call DWORD PTR __imp__MmUnmapIoSpace@8 $L2849: $L2848: ; 373 : } ; 374 : } ; 375 : ; 376 : ExFreePool (DeviceData->DevClassAssocName.Buffer); 0031c 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 0031f 8b 40 58 mov eax, DWORD PTR [eax+88] 00322 50 push eax 00323 ff 15 00 00 00 00 call DWORD PTR __imp__ExFreePool@4 ; 377 : Test98_KdPrint(DeviceData, TEST_DBG_PNP_INFO, ; 378 : ("IoDeleteDevice1: 0x%x\n", DeviceObject)); ; 379 : IoDeleteDevice (DeviceObject); 00329 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 0032c 50 push eax 0032d ff 15 00 00 00 00 call DWORD PTR __imp__IoDeleteDevice@4 ; 380 : ; 381 : return STATUS_SUCCESS; 00333 33 c0 xor eax, eax 00335 e9 c0 00 00 00 jmp $L2812 $L2850: ; 382 : ; 383 : case IRP_MN_QUERY_REMOVE_DEVICE: ; 384 : // ; 385 : // the driver indicates to system whether it can be removed ; 386 : // in response to this IPR... ; 387 : // ; 388 : ; 389 : Irp->IoStatus.Status = STATUS_SUCCESS; 0033a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0033d c7 40 18 00 00 00 00 mov DWORD PTR [eax+24], 0 ; 390 : IoSkipCurrentIrpStackLocation (Irp); 00344 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00347 fe 40 23 inc BYTE PTR [eax+35] 0034a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0034d 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H ; 391 : status = IoCallDriver (DeviceData->TopOfStack, Irp); 00351 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00354 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 00357 8b 48 2c mov ecx, DWORD PTR [eax+44] 0035a ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 00360 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 392 : Test98_DecIoCount (DeviceData); 00363 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00366 50 push eax 00367 e8 00 00 00 00 call _Test98_DecIoCount@4 ; 393 : return status; 0036c 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 0036f e9 86 00 00 00 jmp $L2812 $L2851: ; 394 : ; 395 : default: ; 396 : // ; 397 : // In the default case we merely call the next driver since ; 398 : // we don't know what to do. ; 399 : // Fire and Forget ; 400 : // ; 401 : IoSkipCurrentIrpStackLocation (Irp); 00374 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00377 fe 40 23 inc BYTE PTR [eax+35] 0037a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0037d 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H ; 402 : ; 403 : // ; 404 : // Done, do NOT complete the IRP, it will be processed by the lower ; 405 : // device object, which will complete the IRP ; 406 : // ; 407 : ; 408 : status = IoCallDriver (DeviceData->TopOfStack, Irp); 00381 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00384 8b 55 0c mov edx, DWORD PTR _Irp$[ebp] 00387 8b 48 2c mov ecx, DWORD PTR [eax+44] 0038a ff 15 00 00 00 00 call DWORD PTR __imp_@IofCallDriver@8 00390 89 45 e4 mov DWORD PTR _status$[ebp], eax ; 409 : Test98_DecIoCount (DeviceData); 00393 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 00396 50 push eax 00397 e8 00 00 00 00 call _Test98_DecIoCount@4 ; 410 : return status; 0039c 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 0039f e9 56 00 00 00 jmp $L2812 ; 411 : } 003a4 e9 2c 00 00 00 jmp $L2824 $L2823: 003a9 83 7d c0 05 cmp DWORD PTR -64+[ebp], 5 003ad 0f 87 c1 ff ff ff ja $L2851 003b3 8b 45 c0 mov eax, DWORD PTR -64+[ebp] 003b6 ff 24 85 00 00 00 00 jmp DWORD PTR $L3014[eax*4] $L3014: 003bd 00 00 00 00 DD OFFSET FLAT:$L2827 003c1 00 00 00 00 DD OFFSET FLAT:$L2850 003c5 00 00 00 00 DD OFFSET FLAT:$L2846 003c9 00 00 00 00 DD OFFSET FLAT:$L2851 003cd 00 00 00 00 DD OFFSET FLAT:$L2843 003d1 00 00 00 00 DD OFFSET FLAT:$L2840 $L2824: ; 412 : ; 413 : Irp->IoStatus.Status = status; 003d5 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 003d8 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 003db 89 41 18 mov DWORD PTR [ecx+24], eax ; 414 : DbgRaiseIrql (DISPATCH_LEVEL, &oldIrq); ; 415 : IoCompleteRequest (Irp, IO_NO_INCREMENT); 003de 33 d2 xor edx, edx 003e0 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 003e3 ff 15 00 00 00 00 call DWORD PTR __imp_@IofCompleteRequest@8 ; 416 : DbgLowerIrql (oldIrq); ; 417 : ; 418 : Test98_DecIoCount (DeviceData); 003e9 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp] 003ec 50 push eax 003ed e8 00 00 00 00 call _Test98_DecIoCount@4 ; 419 : return status; 003f2 8b 45 e4 mov eax, DWORD PTR _status$[ebp] 003f5 e9 00 00 00 00 jmp $L2812 $L2812: ; 420 : } 003fa 5f pop edi 003fb 5e pop esi 003fc 5b pop ebx 003fd c9 leave 003fe c2 10 00 ret 16 ; 00000010H _Test98_FDO_PnP@16 ENDP _TEXT ENDS EXTRN __imp__KeSetEvent@12:NEAR ; COMDAT _Test98_FDO_PnPComplete@12 _TEXT SEGMENT _Irp$ = 12 _Context$ = 16 _Test98_FDO_PnPComplete@12 PROC NEAR ; COMDAT ; 435 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 53 push ebx 00004 56 push esi 00005 57 push edi ; 436 : UNREFERENCED_PARAMETER (DeviceObject); ; 437 : ; 438 : if (Irp->PendingReturned) { 00006 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00009 33 c9 xor ecx, ecx 0000b 8a 48 21 mov cl, BYTE PTR [eax+33] 0000e 85 c9 test ecx, ecx 00010 0f 84 17 00 00 00 je $L2856 ; 439 : IoMarkIrpPending( Irp ); 00016 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00019 8b 40 60 mov eax, DWORD PTR [eax+96] 0001c 33 c9 xor ecx, ecx 0001e 8a 48 03 mov cl, BYTE PTR [eax+3] 00021 80 c9 01 or cl, 1 00024 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00027 8b 40 60 mov eax, DWORD PTR [eax+96] 0002a 88 48 03 mov BYTE PTR [eax+3], cl $L2856: ; 440 : } ; 441 : ; 442 : KeSetEvent ((PKEVENT) Context, 1, FALSE); 0002d 6a 00 push 0 0002f 6a 01 push 1 00031 8b 45 10 mov eax, DWORD PTR _Context$[ebp] 00034 50 push eax 00035 ff 15 00 00 00 00 call DWORD PTR __imp__KeSetEvent@12 ; 443 : // No special priority ; 444 : // No Wait ; 445 : ; 446 : return STATUS_MORE_PROCESSING_REQUIRED; // Keep this IRP 0003b b8 16 00 00 c0 mov eax, -1073741802 ; c0000016H 00040 e9 00 00 00 00 jmp $L2855 $L2855: ; 447 : } 00045 5f pop edi 00046 5e pop esi 00047 5b pop ebx 00048 c9 leave 00049 c2 0c 00 ret 12 ; 0000000cH _Test98_FDO_PnPComplete@12 ENDP _TEXT ENDS PUBLIC _Test98_PnPRemove@8 ; COMDAT _Test98_PnPRemove@8 _TEXT SEGMENT _Device$ = 8 _PdoData$ = 12 _Test98_PnPRemove@8 PROC NEAR ; COMDAT ; 463 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 53 push ebx 00004 56 push esi 00005 57 push edi ; 464 : PdoData->Removed = TRUE; 00006 8b 45 0c mov eax, DWORD PTR _PdoData$[ebp] 00009 c6 40 1b 01 mov BYTE PTR [eax+27], 1 ; 465 : ; 466 : // ; 467 : // Complete any outsanding requests with STATUS_DELETE_PENDING. ; 468 : // ; 469 : if (PdoData->Attached) { 0000d 8b 45 0c mov eax, DWORD PTR _PdoData$[ebp] 00010 33 c9 xor ecx, ecx 00012 8a 48 1a mov cl, BYTE PTR [eax+26] 00015 85 c9 test ecx, ecx 00017 0f 84 07 00 00 00 je $L2860 ; 470 : return STATUS_SUCCESS; 0001d 33 c0 xor eax, eax 0001f e9 1e 00 00 00 jmp $L2859 $L2860: ; 471 : } ; 472 : ; 473 : // ; 474 : // Free any resources. ; 475 : // ; 476 : ExFreePool (PdoData->HardwareIDs); 00024 8b 45 0c mov eax, DWORD PTR _PdoData$[ebp] 00027 8b 40 14 mov eax, DWORD PTR [eax+20] 0002a 50 push eax 0002b ff 15 00 00 00 00 call DWORD PTR __imp__ExFreePool@4 ; 477 : ; 478 : Test98_KdPrint(PdoData, TEST_DBG_PNP_INFO, ; 479 : ("IoDeleteDevice2: 0x%x\n", Device)); ; 480 : IoDeleteDevice (Device); 00031 8b 45 08 mov eax, DWORD PTR _Device$[ebp] 00034 50 push eax 00035 ff 15 00 00 00 00 call DWORD PTR __imp__IoDeleteDevice@4 ; 481 : return STATUS_SUCCESS; 0003b 33 c0 xor eax, eax 0003d e9 00 00 00 00 jmp $L2859 $L2859: ; 482 : } 00042 5f pop edi 00043 5e pop esi 00044 5b pop ebx 00045 c9 leave 00046 c2 08 00 ret 8 _Test98_PnPRemove@8 ENDP _TEXT ENDS EXTRN __imp__MmMapIoSpace@16:NEAR ; COMDAT _Test98_StartFdo@12 _TEXT SEGMENT _FdoData$ = 8 _PartialResourceList$ = 12 _PartialResourceListTranslated$ = 16 _i$ = -12 _status$ = -16 _resource$ = -4 _resourceTrans$ = -8 _Test98_StartFdo@12 PROC NEAR ; COMDAT ; 495 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 18 sub esp, 24 ; 00000018H 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 496 : ULONG i; ; 497 : NTSTATUS status = STATUS_SUCCESS; 00009 c7 45 f0 00 00 00 00 mov DWORD PTR _status$[ebp], 0 ; 498 : PCM_PARTIAL_RESOURCE_DESCRIPTOR resource; ; 499 : PCM_PARTIAL_RESOURCE_DESCRIPTOR resourceTrans; ; 500 : ; 501 : Test98_KdPrint (FdoData, TEST_DBG_PNP_TRACE, ("StartFdo\n")); ; 502 : ; 503 : for (i = 0, ; 504 : resource = &PartialResourceList->PartialDescriptors[0], ; 505 : resourceTrans = &PartialResourceListTranslated->PartialDescriptors[0]; ; 506 : ; 507 : i < PartialResourceList->Count && NT_SUCCESS(status); ; 508 : i++, resource++, resourceTrans++) { 00010 c7 45 f4 00 00 00 00 mov DWORD PTR _i$[ebp], 0 00017 8b 45 0c mov eax, DWORD PTR _PartialResourceList$[ebp] 0001a 83 c0 08 add eax, 8 0001d 89 45 fc mov DWORD PTR _resource$[ebp], eax 00020 8b 45 10 mov eax, DWORD PTR _PartialResourceListTranslated$[ebp] 00023 83 c0 08 add eax, 8 00026 89 45 f8 mov DWORD PTR _resourceTrans$[ebp], eax 00029 e9 0b 00 00 00 jmp $L2869 $L2870: 0002e ff 45 f4 inc DWORD PTR _i$[ebp] 00031 83 45 fc 10 add DWORD PTR _resource$[ebp], 16 ; 00000010H 00035 83 45 f8 10 add DWORD PTR _resourceTrans$[ebp], 16 ; 00000010H $L2869: 00039 8b 45 0c mov eax, DWORD PTR _PartialResourceList$[ebp] 0003c 8b 4d f4 mov ecx, DWORD PTR _i$[ebp] 0003f 39 48 04 cmp DWORD PTR [eax+4], ecx 00042 0f 86 0e 01 00 00 jbe $L2871 00048 83 7d f0 00 cmp DWORD PTR _status$[ebp], 0 0004c 0f 8c 04 01 00 00 jl $L2871 ; 509 : ; 510 : switch (resource->Type) { 00052 8b 45 fc mov eax, DWORD PTR _resource$[ebp] 00055 33 c9 xor ecx, ecx 00057 8a 08 mov cl, BYTE PTR [eax] 00059 89 4d ec mov DWORD PTR -20+[ebp], ecx 0005c e9 d7 00 00 00 jmp $L2872 $L2876: ; 511 : case CmResourceTypePort: ; 512 : ; 513 : FdoData->PhysicalAddress = resource->u.Port.Start; 00061 8b 45 fc mov eax, DWORD PTR _resource$[ebp] 00064 83 c0 04 add eax, 4 00067 8b 08 mov ecx, DWORD PTR [eax] 00069 8b 40 04 mov eax, DWORD PTR [eax+4] 0006c 8b 55 08 mov edx, DWORD PTR _FdoData$[ebp] 0006f 83 c2 60 add edx, 96 ; 00000060H 00072 89 0a mov DWORD PTR [edx], ecx 00074 89 42 04 mov DWORD PTR [edx+4], eax ; 514 : Test98_KdPrint (FdoData, TEST_DBG_PNP_INFO, ; 515 : ("HardwareResource: Port (%x) ->", ; 516 : FdoData->PhysicalAddress.LowPart)); ; 517 : ; 518 : switch (resourceTrans->Type) { 00077 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 0007a 33 c9 xor ecx, ecx 0007c 8a 08 mov cl, BYTE PTR [eax] 0007e 89 4d e8 mov DWORD PTR -24+[ebp], ecx 00081 e9 44 00 00 00 jmp $L2877 $L2881: ; 519 : case CmResourceTypePort: ; 520 : ; 521 : ASSERT (1 == resourceTrans->u.Port.Length); ; 522 : ; 523 : // Nothing to do here but note the address; ; 524 : FdoData->TestPortAddress = ; 525 : (PVOID) resourceTrans->u.Port.Start.LowPart; 00086 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 00089 8b 40 04 mov eax, DWORD PTR [eax+4] 0008c 8b 4d 08 mov ecx, DWORD PTR _FdoData$[ebp] 0008f 89 41 68 mov DWORD PTR [ecx+104], eax ; 526 : ; 527 : break; 00092 e9 4c 00 00 00 jmp $L2878 $L2882: ; 528 : ; 529 : case CmResourceTypeMemory: ; 530 : // ; 531 : // We need to map the memory ; 532 : // ; 533 : ; 534 : ASSERT (1 == resourceTrans->u.Memory.Length); ; 535 : ; 536 : FdoData->TestPortAddress = ; 537 : MmMapIoSpace (resourceTrans->u.Memory.Start, ; 538 : resourceTrans->u.Memory.Length, ; 539 : MmNonCached); 00097 6a 00 push 0 00099 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 0009c 8b 40 0c mov eax, DWORD PTR [eax+12] 0009f 50 push eax 000a0 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 000a3 83 c0 04 add eax, 4 000a6 8b 08 mov ecx, DWORD PTR [eax] 000a8 8b 40 04 mov eax, DWORD PTR [eax+4] 000ab 50 push eax 000ac 51 push ecx 000ad ff 15 00 00 00 00 call DWORD PTR __imp__MmMapIoSpace@16 000b3 8b 4d 08 mov ecx, DWORD PTR _FdoData$[ebp] 000b6 89 41 68 mov DWORD PTR [ecx+104], eax ; 540 : ; 541 : ; 542 : FdoData->MappedPorts = TRUE; 000b9 8b 45 08 mov eax, DWORD PTR _FdoData$[ebp] 000bc c6 40 18 01 mov BYTE PTR [eax+24], 1 ; 543 : ; 544 : Test98_KdPrint_Cont (FdoData, TEST_DBG_PNP_INFO, ; 545 : ("Mem: (%x)\n", FdoData->TestPortAddress)); ; 546 : break; 000c0 e9 1e 00 00 00 jmp $L2878 $L2883: ; 547 : ; 548 : default: ; 549 : Test98_KdPrint_Cont (FdoData, TEST_DBG_PNP_INFO, ; 550 : ("Unknown \n", FdoData->TestPortAddress)); ; 551 : ; 552 : } 000c5 e9 19 00 00 00 jmp $L2878 $L2877: 000ca 83 7d e8 01 cmp DWORD PTR -24+[ebp], 1 000ce 0f 84 b2 ff ff ff je $L2881 000d4 83 7d e8 03 cmp DWORD PTR -24+[ebp], 3 000d8 0f 84 b9 ff ff ff je $L2882 000de e9 00 00 00 00 jmp $L2878 $L2878: ; 553 : ; 554 : break; 000e3 e9 69 00 00 00 jmp $L2873 $L2884: ; 555 : ; 556 : case CmResourceTypeMemory: ; 557 : ; 558 : ASSERT (CmResourceTypeMemory == resourceTrans->Type); ; 559 : ; 560 : FdoData->PhysicalAddress = resource->u.Memory.Start; 000e8 8b 45 fc mov eax, DWORD PTR _resource$[ebp] 000eb 83 c0 04 add eax, 4 000ee 8b 08 mov ecx, DWORD PTR [eax] 000f0 8b 40 04 mov eax, DWORD PTR [eax+4] 000f3 8b 55 08 mov edx, DWORD PTR _FdoData$[ebp] 000f6 83 c2 60 add edx, 96 ; 00000060H 000f9 89 0a mov DWORD PTR [edx], ecx 000fb 89 42 04 mov DWORD PTR [edx+4], eax ; 561 : FdoData->TestPortAddress = ; 562 : MmMapIoSpace (resourceTrans->u.Memory.Start, ; 563 : resourceTrans->u.Memory.Length, ; 564 : MmNonCached); 000fe 6a 00 push 0 00100 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 00103 8b 40 0c mov eax, DWORD PTR [eax+12] 00106 50 push eax 00107 8b 45 f8 mov eax, DWORD PTR _resourceTrans$[ebp] 0010a 83 c0 04 add eax, 4 0010d 8b 08 mov ecx, DWORD PTR [eax] 0010f 8b 40 04 mov eax, DWORD PTR [eax+4] 00112 50 push eax 00113 51 push ecx 00114 ff 15 00 00 00 00 call DWORD PTR __imp__MmMapIoSpace@16 0011a 8b 4d 08 mov ecx, DWORD PTR _FdoData$[ebp] 0011d 89 41 68 mov DWORD PTR [ecx+104], eax ; 565 : ; 566 : FdoData->MappedPorts = TRUE; 00120 8b 45 08 mov eax, DWORD PTR _FdoData$[ebp] 00123 c6 40 18 01 mov BYTE PTR [eax+24], 1 ; 567 : ; 568 : ASSERT (1 == resource->u.Memory.Length); ; 569 : ; 570 : Test98_KdPrint (FdoData, TEST_DBG_PNP_INFO, ; 571 : ("HardwareResource: Memory (%x) -> Mem (%x)", ; 572 : FdoData->PhysicalAddress.LowPart, ; 573 : FdoData->TestPortAddress)); ; 574 : ; 575 : break; 00127 e9 25 00 00 00 jmp $L2873 $L2885: ; 576 : ; 577 : case CmResourceTypeInterrupt: ; 578 : default: ; 579 : ; 580 : Test98_KdPrint (FdoData, TEST_DBG_PNP_ERROR, ; 581 : ("Unhandled resource type (0x%x)\n", ; 582 : resource->Type)); ; 583 : status = STATUS_UNSUCCESSFUL; 0012c c7 45 f0 01 00 00 c0 mov DWORD PTR _status$[ebp], -1073741823 ; c0000001H ; 584 : } 00133 e9 19 00 00 00 jmp $L2873 $L2872: 00138 83 7d ec 01 cmp DWORD PTR -20+[ebp], 1 0013c 0f 84 1f ff ff ff je $L2876 00142 83 7d ec 03 cmp DWORD PTR -20+[ebp], 3 00146 0f 84 9c ff ff ff je $L2884 0014c e9 db ff ff ff jmp $L2885 $L2873: ; 585 : } 00151 e9 d8 fe ff ff jmp $L2870 $L2871: ; 586 : return status; 00156 8b 45 f0 mov eax, DWORD PTR _status$[ebp] 00159 e9 00 00 00 00 jmp $L2864 $L2864: ; 587 : } 0015e 5f pop edi 0015f 5e pop esi 00160 5b pop ebx 00161 c9 leave 00162 c2 0c 00 ret 12 ; 0000000cH _Test98_StartFdo@12 ENDP _TEXT ENDS PUBLIC _Test98_Remove@8 EXTRN __imp__IoInvalidateDeviceRelations@8:NEAR EXTRN __imp_@KfAcquireSpinLock@4:NEAR EXTRN __imp_@KfReleaseSpinLock@8:NEAR ; COMDAT _Test98_Remove@8 _TEXT SEGMENT _Remove$ = 8 _FdoData$ = 12 _irql$ = -4 _entry$ = -8 _pdoData$ = -20 _found$ = -16 _handle$ = -12 __EX_Blink$2899 = -28 __EX_Flink$2900 = -24 _Test98_Remove@8 PROC NEAR ; COMDAT ; 599 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 1c sub esp, 28 ; 0000001cH 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 600 : KIRQL irql; ; 601 : PLIST_ENTRY entry; ; 602 : PPDO_DEVICE_DATA pdoData; ; 603 : BOOLEAN found = FALSE; 00009 c6 45 f0 00 mov BYTE PTR _found$[ebp], 0 ; 604 : PVOID handle = NULL; 0000d c7 45 f4 00 00 00 00 mov DWORD PTR _handle$[ebp], 0 ; 605 : ; 606 : KeAcquireSpinLock (&FdoData->Spin, &irql); 00014 8b 4d 0c mov ecx, DWORD PTR _FdoData$[ebp] 00017 83 c1 14 add ecx, 20 ; 00000014H 0001a ff 15 00 00 00 00 call DWORD PTR __imp_@KfAcquireSpinLock@4 00020 88 45 fc mov BYTE PTR _irql$[ebp], al ; 607 : ; 608 : for (entry = FdoData->PDOs.Flink; ; 609 : entry != &FdoData->PDOs; ; 610 : entry = entry->Flink) { 00023 8b 45 0c mov eax, DWORD PTR _FdoData$[ebp] 00026 8b 40 1c mov eax, DWORD PTR [eax+28] 00029 89 45 f8 mov DWORD PTR _entry$[ebp], eax 0002c e9 08 00 00 00 jmp $L2894 $L2895: 00031 8b 45 f8 mov eax, DWORD PTR _entry$[ebp] 00034 8b 00 mov eax, DWORD PTR [eax] 00036 89 45 f8 mov DWORD PTR _entry$[ebp], eax $L2894: 00039 8b 45 0c mov eax, DWORD PTR _FdoData$[ebp] 0003c 83 c0 1c add eax, 28 ; 0000001cH 0003f 3b 45 f8 cmp eax, DWORD PTR _entry$[ebp] 00042 0f 84 63 00 00 00 je $L2896 ; 611 : ; 612 : pdoData = CONTAINING_RECORD (entry, PDO_DEVICE_DATA, Link); 00048 8b 45 f8 mov eax, DWORD PTR _entry$[ebp] 0004b 83 e8 1c sub eax, 28 ; 0000001cH 0004e 89 45 ec mov DWORD PTR _pdoData$[ebp], eax ; 613 : if (!handle) { 00051 83 7d f4 00 cmp DWORD PTR _handle$[ebp], 0 00055 0f 85 08 00 00 00 jne $L2897 ; 614 : handle = pdoData->Self; 0005b 8b 45 ec mov eax, DWORD PTR _pdoData$[ebp] 0005e 8b 00 mov eax, DWORD PTR [eax] 00060 89 45 f4 mov DWORD PTR _handle$[ebp], eax $L2897: ; 615 : } ; 616 : if (handle == Remove->HardwareHandle) { 00063 8b 45 08 mov eax, DWORD PTR _Remove$[ebp] 00066 8b 4d f4 mov ecx, DWORD PTR _handle$[ebp] 00069 39 48 04 cmp DWORD PTR [eax+4], ecx 0006c 0f 85 34 00 00 00 jne $L2898 ; 617 : pdoData->Attached = FALSE; 00072 8b 45 ec mov eax, DWORD PTR _pdoData$[ebp] 00075 c6 40 1a 00 mov BYTE PTR [eax+26], 0 ; 618 : RemoveEntryList (&pdoData->Link); 00079 8b 45 ec mov eax, DWORD PTR _pdoData$[ebp] 0007c 8b 40 1c mov eax, DWORD PTR [eax+28] 0007f 89 45 e8 mov DWORD PTR __EX_Flink$2900[ebp], eax 00082 8b 45 ec mov eax, DWORD PTR _pdoData$[ebp] 00085 8b 40 20 mov eax, DWORD PTR [eax+32] 00088 89 45 e4 mov DWORD PTR __EX_Blink$2899[ebp], eax 0008b 8b 45 e8 mov eax, DWORD PTR __EX_Flink$2900[ebp] 0008e 8b 4d e4 mov ecx, DWORD PTR __EX_Blink$2899[ebp] 00091 89 01 mov DWORD PTR [ecx], eax 00093 8b 45 e4 mov eax, DWORD PTR __EX_Blink$2899[ebp] 00096 8b 4d e8 mov ecx, DWORD PTR __EX_Flink$2900[ebp] 00099 89 41 04 mov DWORD PTR [ecx+4], eax ; 619 : FdoData->NumPDOs--; 0009c 8b 45 0c mov eax, DWORD PTR _FdoData$[ebp] 0009f ff 48 24 dec DWORD PTR [eax+36] ; 620 : found = TRUE; 000a2 c6 45 f0 01 mov BYTE PTR _found$[ebp], 1 $L2898: ; 621 : } ; 622 : } 000a6 e9 86 ff ff ff jmp $L2895 $L2896: ; 623 : KeReleaseSpinLock (&FdoData->Spin, irql); 000ab 8b 4d 0c mov ecx, DWORD PTR _FdoData$[ebp] 000ae 8b 55 fc mov edx, DWORD PTR _irql$[ebp] 000b1 83 c1 14 add ecx, 20 ; 00000014H 000b4 ff 15 00 00 00 00 call DWORD PTR __imp_@KfReleaseSpinLock@8 ; 624 : ; 625 : if (found) { 000ba 33 c0 xor eax, eax 000bc 8a 45 f0 mov al, BYTE PTR _found$[ebp] 000bf 85 c0 test eax, eax 000c1 0f 84 16 00 00 00 je $L2901 ; 626 : IoInvalidateDeviceRelations (FdoData->UnderlyingPDO, BusRelations); 000c7 6a 00 push 0 000c9 8b 45 0c mov eax, DWORD PTR _FdoData$[ebp] 000cc 8b 40 28 mov eax, DWORD PTR [eax+40] 000cf 50 push eax 000d0 ff 15 00 00 00 00 call DWORD PTR __imp__IoInvalidateDeviceRelations@8 ; 627 : return STATUS_SUCCESS; 000d6 33 c0 xor eax, eax 000d8 e9 0a 00 00 00 jmp $L2888 $L2901: ; 628 : } ; 629 : return STATUS_INVALID_PARAMETER; 000dd b8 0d 00 00 c0 mov eax, -1073741811 ; c000000dH 000e2 e9 00 00 00 00 jmp $L2888 $L2888: ; 630 : } 000e7 5f pop edi 000e8 5e pop esi 000e9 5b pop ebx 000ea c9 leave 000eb c2 08 00 ret 8 _Test98_Remove@8 ENDP _TEXT ENDS PUBLIC _Test98_Power@8 PUBLIC _Test98_FDO_Power@8 ; COMDAT _Test98_Power@8 _TEXT SEGMENT _DeviceObject$ = 8 _Irp$ = 12 _irpStack$ = -12 _status$ = -8 _commonData$ = -4 _Test98_Power@8 PROC NEAR ; COMDAT ; 643 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 0c sub esp, 12 ; 0000000cH 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 644 : PIO_STACK_LOCATION irpStack; ; 645 : NTSTATUS status; ; 646 : PCOMMON_DEVICE_DATA commonData; ; 647 : ; 648 : PAGED_CODE (); ; 649 : ; 650 : status = STATUS_SUCCESS; 00009 c7 45 f8 00 00 00 00 mov DWORD PTR _status$[ebp], 0 ; 651 : irpStack = IoGetCurrentIrpStackLocation (Irp); 00010 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00013 8b 40 60 mov eax, DWORD PTR [eax+96] 00016 89 45 f4 mov DWORD PTR _irpStack$[ebp], eax ; 652 : ASSERT (IRP_MJ_POWER == irpStack->MajorFunction); ; 653 : ; 654 : commonData = (PCOMMON_DEVICE_DATA) DeviceObject->DeviceExtension; 00019 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 0001c 8b 40 28 mov eax, DWORD PTR [eax+40] 0001f 89 45 fc mov DWORD PTR _commonData$[ebp], eax ; 655 : ; 656 : status = Test98_FDO_Power ((PFDO_DEVICE_DATA) DeviceObject->DeviceExtension, ; 657 : Irp); 00022 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00025 50 push eax 00026 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 00029 8b 40 28 mov eax, DWORD PTR [eax+40] 0002c 50 push eax 0002d e8 00 00 00 00 call _Test98_FDO_Power@8 00032 89 45 f8 mov DWORD PTR _status$[ebp], eax ; 658 : return status; 00035 8b 45 f8 mov eax, DWORD PTR _status$[ebp] 00038 e9 00 00 00 00 jmp $L2904 $L2904: ; 659 : } 0003d 5f pop edi 0003e 5e pop esi 0003f 5b pop ebx 00040 c9 leave 00041 c2 08 00 ret 8 _Test98_Power@8 ENDP _TEXT ENDS PUBLIC _Test98_PowerComplete@12 EXTRN __imp__PoRequestPowerIrp@24:NEAR EXTRN __imp__PoSetPowerState@12:NEAR EXTRN __imp__PoCallDriver@8:NEAR EXTRN __imp__PoStartNextPowerIrp@4:NEAR ; COMDAT _Test98_FDO_Power@8 _TEXT SEGMENT _Data$ = 8 _Irp$ = 12 _status$ = -16 _hookit$ = -12 _powerState$ = -4 _powerType$ = -20 _stack$ = -8 _irpSp$2944 = -28 _nextIrpSp$2945 = -24 _irpSp$2947 = -32 _Test98_FDO_Power@8 PROC NEAR ; COMDAT ; 676 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 28 sub esp, 40 ; 00000028H 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 677 : NTSTATUS status; ; 678 : BOOLEAN hookit = FALSE; 00009 c6 45 f4 00 mov BYTE PTR _hookit$[ebp], 0 ; 679 : POWER_STATE powerState; ; 680 : POWER_STATE_TYPE powerType; ; 681 : PIO_STACK_LOCATION stack; ; 682 : ; 683 : stack = IoGetCurrentIrpStackLocation (Irp); 0000d 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00010 8b 40 60 mov eax, DWORD PTR [eax+96] 00013 89 45 f8 mov DWORD PTR _stack$[ebp], eax ; 684 : powerType = stack->Parameters.Power.Type; 00016 8b 45 f8 mov eax, DWORD PTR _stack$[ebp] 00019 8b 40 08 mov eax, DWORD PTR [eax+8] 0001c 89 45 ec mov DWORD PTR _powerType$[ebp], eax ; 685 : powerState = stack->Parameters.Power.State; 0001f 8b 45 f8 mov eax, DWORD PTR _stack$[ebp] 00022 8b 40 0c mov eax, DWORD PTR [eax+12] 00025 89 45 fc mov DWORD PTR _powerState$[ebp], eax ; 686 : ; 687 : PAGED_CODE (); ; 688 : ; 689 : status = Test98_IncIoCount (Data); 00028 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0002b 50 push eax 0002c e8 00 00 00 00 call _Test98_IncIoCount@4 00031 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 690 : if (!NT_SUCCESS (status)) { 00034 83 7d f0 00 cmp DWORD PTR _status$[ebp], 0 00038 0f 8d 30 00 00 00 jge $L2920 ; 691 : PoStartNextPowerIrp (Irp); 0003e 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00041 50 push eax 00042 ff 15 00 00 00 00 call DWORD PTR __imp__PoStartNextPowerIrp@4 ; 692 : Irp->IoStatus.Information = 0; 00048 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0004b c7 40 1c 00 00 00 00 mov DWORD PTR [eax+28], 0 ; 693 : Irp->IoStatus.Status = status; 00052 8b 45 f0 mov eax, DWORD PTR _status$[ebp] 00055 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 00058 89 41 18 mov DWORD PTR [ecx+24], eax ; 694 : IoCompleteRequest (Irp, IO_NO_INCREMENT); 0005b 33 d2 xor edx, edx 0005d 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp] 00060 ff 15 00 00 00 00 call DWORD PTR __imp_@IofCompleteRequest@8 ; 695 : return status; 00066 8b 45 f0 mov eax, DWORD PTR _status$[ebp] 00069 e9 4d 02 00 00 jmp $L2914 $L2920: ; 696 : } ; 697 : ; 698 : switch (stack->MinorFunction) { 0006e 8b 45 f8 mov eax, DWORD PTR _stack$[ebp] 00071 33 c9 xor ecx, ecx 00073 8a 48 01 mov cl, BYTE PTR [eax+1] 00076 89 4d dc mov DWORD PTR -36+[ebp], ecx 00079 e9 4a 01 00 00 jmp $L2921 $L2925: ; 699 : case IRP_MN_SET_POWER: ; 700 : Test98_KdPrint(Data, ; 701 : TEST_DBG_PNP_TRACE, ; 702 : ("Test-PnP Setting %s state to %d\n", ; 703 : ((powerType == SystemPowerState) ? "System" : "Device"), ; 704 : powerState.SystemState)); ; 705 : ; 706 : switch (powerType) { 0007e 8b 45 ec mov eax, DWORD PTR _powerType$[ebp] 00081 89 45 d8 mov DWORD PTR -40+[ebp], eax 00084 e9 f8 00 00 00 jmp $L2926 $L2930: ; 707 : case DevicePowerState: ; 708 : ; 709 : status = Irp->IoStatus.Status = STATUS_SUCCESS; 00089 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0008c c7 40 18 00 00 00 00 mov DWORD PTR [eax+24], 0 00093 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00096 8b 40 18 mov eax, DWORD PTR [eax+24] 00099 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 710 : ; 711 : if (Data->DeviceState == powerState.DeviceState) { 0009c 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0009f 8b 4d fc mov ecx, DWORD PTR _powerState$[ebp] 000a2 39 48 10 cmp DWORD PTR [eax+16], ecx 000a5 0f 85 0a 00 00 00 jne $L2931 ; 712 : break; 000ab e9 ea 00 00 00 jmp $L2927 ; 713 : ; 714 : } else if (Data->DeviceState < powerState.DeviceState) { 000b0 e9 35 00 00 00 jmp $L2932 $L2931: 000b5 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 000b8 8b 4d fc mov ecx, DWORD PTR _powerState$[ebp] 000bb 39 48 10 cmp DWORD PTR [eax+16], ecx 000be 0f 8d 22 00 00 00 jge $L2933 ; 715 : // ; 716 : // Powering down ; 717 : // ; 718 : ; 719 : PoSetPowerState (Data->Self, powerType, powerState); 000c4 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 000c7 50 push eax 000c8 8b 45 ec mov eax, DWORD PTR _powerType$[ebp] 000cb 50 push eax 000cc 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 000cf 8b 00 mov eax, DWORD PTR [eax] 000d1 50 push eax 000d2 ff 15 00 00 00 00 call DWORD PTR __imp__PoSetPowerState@12 ; 720 : Data->DeviceState = powerState.DeviceState; 000d8 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 000db 8b 4d 08 mov ecx, DWORD PTR _Data$[ebp] 000de 89 41 10 mov DWORD PTR [ecx+16], eax ; 721 : ; 722 : } else { 000e1 e9 04 00 00 00 jmp $L2934 $L2933: ; 723 : // ; 724 : // Powering Up ; 725 : // ; 726 : hookit = TRUE; 000e6 c6 45 f4 01 mov BYTE PTR _hookit$[ebp], 1 $L2934: $L2932: ; 727 : } ; 728 : ; 729 : break; 000ea e9 ab 00 00 00 jmp $L2927 $L2935: ; 730 : ; 731 : case SystemPowerState: ; 732 : if (Data->PowerQueryLock) { 000ef 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 000f2 33 c9 xor ecx, ecx 000f4 8a 48 19 mov cl, BYTE PTR [eax+25] 000f7 85 c9 test ecx, ecx 000f9 0f 84 0c 00 00 00 je $L2936 ; 733 : // ; 734 : // The reception of a power irp resolves the query lock. ; 735 : // ; 736 : Data->PowerQueryLock = FALSE; 000ff 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 00102 c6 40 19 00 mov BYTE PTR [eax+25], 0 ; 737 : } else { 00106 e9 00 00 00 00 jmp $L2937 $L2936: $L2937: ; 738 : ASSERT (Data->SystemState != powerState.SystemState); ; 739 : } ; 740 : ; 741 : status = Irp->IoStatus.Status = STATUS_SUCCESS; 0010b 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0010e c7 40 18 00 00 00 00 mov DWORD PTR [eax+24], 0 00115 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00118 8b 40 18 mov eax, DWORD PTR [eax+24] 0011b 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 742 : ; 743 : if (Data->SystemState == powerState.SystemState) { 0011e 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 00121 8b 4d fc mov ecx, DWORD PTR _powerState$[ebp] 00124 39 48 0c cmp DWORD PTR [eax+12], ecx 00127 0f 85 0a 00 00 00 jne $L2938 ; 744 : break; 0012d e9 68 00 00 00 jmp $L2927 ; 745 : ; 746 : } else if (Data->SystemState < powerState.SystemState) { 00132 e9 40 00 00 00 jmp $L2939 $L2938: 00137 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0013a 8b 4d fc mov ecx, DWORD PTR _powerState$[ebp] 0013d 39 48 0c cmp DWORD PTR [eax+12], ecx 00140 0f 8d 2d 00 00 00 jge $L2940 ; 747 : // ; 748 : // Powering down ; 749 : // ; 750 : ; 751 : Data->SystemState = powerState.SystemState; 00146 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 00149 8b 4d 08 mov ecx, DWORD PTR _Data$[ebp] 0014c 89 41 0c mov DWORD PTR [ecx+12], eax ; 752 : ; 753 : powerState.DeviceState = PowerDeviceD3; 0014f c7 45 fc 04 00 00 00 mov DWORD PTR _powerState$[ebp], 4 ; 754 : PoRequestPowerIrp (Data->Self, ; 755 : IRP_MN_SET_POWER, ; 756 : powerState, ; 757 : NULL, // no completion function ; 758 : NULL, // and no context ; 759 : NULL); 00156 6a 00 push 0 00158 6a 00 push 0 0015a 6a 00 push 0 0015c 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 0015f 50 push eax 00160 6a 02 push 2 00162 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 00165 8b 00 mov eax, DWORD PTR [eax] 00167 50 push eax 00168 ff 15 00 00 00 00 call DWORD PTR __imp__PoRequestPowerIrp@24 ; 760 : ; 761 : } else { 0016e e9 04 00 00 00 jmp $L2941 $L2940: ; 762 : // ; 763 : // Powering Up ; 764 : // ; 765 : hookit = TRUE; 00173 c6 45 f4 01 mov BYTE PTR _hookit$[ebp], 1 $L2941: $L2939: ; 766 : } ; 767 : break; 00177 e9 1e 00 00 00 jmp $L2927 ; 768 : } 0017c e9 19 00 00 00 jmp $L2927 $L2926: 00181 83 7d d8 00 cmp DWORD PTR -40+[ebp], 0 00185 0f 84 64 ff ff ff je $L2935 0018b 83 7d d8 01 cmp DWORD PTR -40+[ebp], 1 0018f 0f 84 f4 fe ff ff je $L2930 00195 e9 00 00 00 00 jmp $L2927 $L2927: ; 769 : ; 770 : break; 0019a e9 42 00 00 00 jmp $L2922 $L2942: ; 771 : ; 772 : case IRP_MN_QUERY_POWER: ; 773 : // ; 774 : Data->PowerQueryLock = TRUE; 0019f 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 001a2 c6 40 19 01 mov BYTE PTR [eax+25], 1 ; 775 : status = Irp->IoStatus.Status = STATUS_SUCCESS; 001a6 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001a9 c7 40 18 00 00 00 00 mov DWORD PTR [eax+24], 0 001b0 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001b3 8b 40 18 mov eax, DWORD PTR [eax+24] 001b6 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 776 : break; 001b9 e9 23 00 00 00 jmp $L2922 $L2943: ; 777 : ; 778 : default: ; 779 : break; 001be e9 1e 00 00 00 jmp $L2922 ; 780 : } 001c3 e9 19 00 00 00 jmp $L2922 $L2921: 001c8 83 7d dc 02 cmp DWORD PTR -36+[ebp], 2 001cc 0f 84 ac fe ff ff je $L2925 001d2 83 7d dc 03 cmp DWORD PTR -36+[ebp], 3 001d6 0f 84 c3 ff ff ff je $L2942 001dc e9 00 00 00 00 jmp $L2922 $L2922: ; 781 : ; 782 : IoCopyCurrentIrpStackLocationToNext (Irp); 001e1 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001e4 8b 40 60 mov eax, DWORD PTR [eax+96] 001e7 89 45 e4 mov DWORD PTR _irpSp$2944[ebp], eax 001ea 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 001ed 8b 40 60 mov eax, DWORD PTR [eax+96] 001f0 83 e8 24 sub eax, 36 ; 00000024H 001f3 89 45 e8 mov DWORD PTR _nextIrpSp$2945[ebp], eax 001f6 8b 7d e8 mov edi, DWORD PTR _nextIrpSp$2945[ebp] 001f9 8b 75 e4 mov esi, DWORD PTR _irpSp$2944[ebp] 001fc b9 07 00 00 00 mov ecx, 7 00201 f3 a5 rep movsd 00203 8b 45 e8 mov eax, DWORD PTR _nextIrpSp$2945[ebp] 00206 c6 40 03 00 mov BYTE PTR [eax+3], 0 ; 783 : ; 784 : if (hookit) { 0020a 33 c0 xor eax, eax 0020c 8a 45 f4 mov al, BYTE PTR _hookit$[ebp] 0020f 85 c0 test eax, eax 00211 0f 84 75 00 00 00 je $L2946 ; 785 : status = Test98_IncIoCount (Data); 00217 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0021a 50 push eax 0021b e8 00 00 00 00 call _Test98_IncIoCount@4 00220 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 786 : ASSERT (STATUS_SUCCESS == status); ; 787 : IoSetCompletionRoutine (Irp, ; 788 : Test98_PowerComplete, ; 789 : NULL, ; 790 : TRUE, ; 791 : TRUE, ; 792 : TRUE); 00223 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00226 8b 40 60 mov eax, DWORD PTR [eax+96] 00229 83 e8 24 sub eax, 36 ; 00000024H 0022c 89 45 e0 mov DWORD PTR _irpSp$2947[ebp], eax 0022f 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 00232 c7 40 1c 00 00 00 00 mov DWORD PTR [eax+28], OFFSET FLAT:_Test98_PowerComplete@12 00239 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 0023c c7 40 20 00 00 00 00 mov DWORD PTR [eax+32], 0 00243 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 00246 c6 40 03 00 mov BYTE PTR [eax+3], 0 0024a 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 0024d c6 40 03 40 mov BYTE PTR [eax+3], 64 ; 00000040H $L2948: 00251 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 00254 33 c9 xor ecx, ecx 00256 8a 48 03 mov cl, BYTE PTR [eax+3] 00259 80 c9 80 or cl, 128 ; 00000080H 0025c 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 0025f 88 48 03 mov BYTE PTR [eax+3], cl $L2949: 00262 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 00265 33 c9 xor ecx, ecx 00267 8a 48 03 mov cl, BYTE PTR [eax+3] 0026a 80 c9 20 or cl, 32 ; 00000020H 0026d 8b 45 e0 mov eax, DWORD PTR _irpSp$2947[ebp] 00270 88 48 03 mov BYTE PTR [eax+3], cl $L2950: ; 793 : status = PoCallDriver (Data->TopOfStack, Irp); 00273 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00276 50 push eax 00277 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0027a 8b 40 2c mov eax, DWORD PTR [eax+44] 0027d 50 push eax 0027e ff 15 00 00 00 00 call DWORD PTR __imp__PoCallDriver@8 00284 89 45 f0 mov DWORD PTR _status$[ebp], eax ; 794 : ; 795 : } else { 00287 e9 1e 00 00 00 jmp $L2951 $L2946: ; 796 : // ; 797 : // Power IRPS come synchronously; drivers must call ; 798 : // PoStartNextPowerIrp, when they are ready for the next power ; 799 : // irp. This can be called here, or in the completion routine ; 800 : // ; 801 : PoStartNextPowerIrp (Irp); 0028c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 0028f 50 push eax 00290 ff 15 00 00 00 00 call DWORD PTR __imp__PoStartNextPowerIrp@4 ; 802 : ; 803 : status = PoCallDriver (Data->TopOfStack, Irp); 00296 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00299 50 push eax 0029a 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 0029d 8b 40 2c mov eax, DWORD PTR [eax+44] 002a0 50 push eax 002a1 ff 15 00 00 00 00 call DWORD PTR __imp__PoCallDriver@8 002a7 89 45 f0 mov DWORD PTR _status$[ebp], eax $L2951: ; 804 : } ; 805 : ; 806 : Test98_DecIoCount (Data); 002aa 8b 45 08 mov eax, DWORD PTR _Data$[ebp] 002ad 50 push eax 002ae e8 00 00 00 00 call _Test98_DecIoCount@4 ; 807 : return status; 002b3 8b 45 f0 mov eax, DWORD PTR _status$[ebp] 002b6 e9 00 00 00 00 jmp $L2914 $L2914: ; 808 : } 002bb 5f pop edi 002bc 5e pop esi 002bd 5b pop ebx 002be c9 leave 002bf c2 08 00 ret 8 _Test98_FDO_Power@8 ENDP _TEXT ENDS ; COMDAT _Test98_PowerComplete@12 _TEXT SEGMENT _DeviceObject$ = 8 _Irp$ = 12 _powerState$ = -4 _powerType$ = -16 _stack$ = -12 _data$ = -8 _Test98_PowerComplete@12 PROC NEAR ; COMDAT ; 817 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 18 sub esp, 24 ; 00000018H 00006 53 push ebx 00007 56 push esi 00008 57 push edi ; 818 : POWER_STATE powerState; ; 819 : POWER_STATE_TYPE powerType; ; 820 : PIO_STACK_LOCATION stack; ; 821 : PFDO_DEVICE_DATA data; ; 822 : ; 823 : UNREFERENCED_PARAMETER (Context); ; 824 : ; 825 : data = (PFDO_DEVICE_DATA) DeviceObject->DeviceExtension; 00009 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp] 0000c 8b 40 28 mov eax, DWORD PTR [eax+40] 0000f 89 45 f8 mov DWORD PTR _data$[ebp], eax ; 826 : stack = IoGetCurrentIrpStackLocation (Irp); 00012 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 00015 8b 40 60 mov eax, DWORD PTR [eax+96] 00018 89 45 f4 mov DWORD PTR _stack$[ebp], eax ; 827 : powerType = stack->Parameters.Power.Type; 0001b 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 0001e 8b 40 08 mov eax, DWORD PTR [eax+8] 00021 89 45 f0 mov DWORD PTR _powerType$[ebp], eax ; 828 : powerState = stack->Parameters.Power.State; 00024 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 00027 8b 40 0c mov eax, DWORD PTR [eax+12] 0002a 89 45 fc mov DWORD PTR _powerState$[ebp], eax ; 829 : ; 830 : switch (stack->MinorFunction) { 0002d 8b 45 f4 mov eax, DWORD PTR _stack$[ebp] 00030 33 c9 xor ecx, ecx 00032 8a 48 01 mov cl, BYTE PTR [eax+1] 00035 89 4d ec mov DWORD PTR -20+[ebp], ecx 00038 e9 8c 00 00 00 jmp $L2960 $L2964: ; 831 : case IRP_MN_SET_POWER: ; 832 : switch (powerType) { 0003d 8b 45 f0 mov eax, DWORD PTR _powerType$[ebp] 00040 89 45 e8 mov DWORD PTR -24+[ebp], eax 00043 e9 54 00 00 00 jmp $L2965 $L2969: ; 833 : case DevicePowerState: ; 834 : ASSERT (powerState.DeviceState < data->DeviceState); ; 835 : data->DeviceState = powerState.DeviceState; 00048 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 0004b 8b 4d f8 mov ecx, DWORD PTR _data$[ebp] 0004e 89 41 10 mov DWORD PTR [ecx+16], eax ; 836 : ; 837 : PoSetPowerState (data->Self, powerType, powerState); 00051 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 00054 50 push eax 00055 8b 45 f0 mov eax, DWORD PTR _powerType$[ebp] 00058 50 push eax 00059 8b 45 f8 mov eax, DWORD PTR _data$[ebp] 0005c 8b 00 mov eax, DWORD PTR [eax] 0005e 50 push eax 0005f ff 15 00 00 00 00 call DWORD PTR __imp__PoSetPowerState@12 ; 838 : break; 00065 e9 4b 00 00 00 jmp $L2966 $L2970: ; 839 : ; 840 : case SystemPowerState: ; 841 : // ; 842 : // the work of requesting the Device Power IRP on ; 843 : // behalf of the SystemPower Irp is work done by the FDO ; 844 : // ; 845 : ; 846 : ASSERT (powerState.SystemState < data->SystemState); ; 847 : data->SystemState = powerState.SystemState; 0006a 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 0006d 8b 4d f8 mov ecx, DWORD PTR _data$[ebp] 00070 89 41 0c mov DWORD PTR [ecx+12], eax ; 848 : ; 849 : powerState.DeviceState = PowerDeviceD0; 00073 c7 45 fc 01 00 00 00 mov DWORD PTR _powerState$[ebp], 1 ; 850 : PoRequestPowerIrp (data->Self, ; 851 : IRP_MN_SET_POWER, ; 852 : powerState, ; 853 : NULL, // no completion function ; 854 : NULL, // and no context ; 855 : NULL); 0007a 6a 00 push 0 0007c 6a 00 push 0 0007e 6a 00 push 0 00080 8b 45 fc mov eax, DWORD PTR _powerState$[ebp] 00083 50 push eax 00084 6a 02 push 2 00086 8b 45 f8 mov eax, DWORD PTR _data$[ebp] 00089 8b 00 mov eax, DWORD PTR [eax] 0008b 50 push eax 0008c ff 15 00 00 00 00 call DWORD PTR __imp__PoRequestPowerIrp@24 ; 856 : break; 00092 e9 1e 00 00 00 jmp $L2966 ; 857 : } 00097 e9 19 00 00 00 jmp $L2966 $L2965: 0009c 83 7d e8 00 cmp DWORD PTR -24+[ebp], 0 000a0 0f 84 c4 ff ff ff je $L2970 000a6 83 7d e8 01 cmp DWORD PTR -24+[ebp], 1 000aa 0f 84 98 ff ff ff je $L2969 000b0 e9 00 00 00 00 jmp $L2966 $L2966: ; 858 : break; 000b5 e9 1e 00 00 00 jmp $L2961 $L2971: ; 859 : ; 860 : case IRP_MN_QUERY_POWER: ; 861 : ; 862 : ; 863 : ; 864 : ASSERT (IRP_MN_QUERY_POWER != stack->MinorFunction); ; 865 : break; 000ba e9 19 00 00 00 jmp $L2961 $L2972: ; 866 : ; 867 : default: ; 868 : ASSERT (0xBADBAD == IRP_MN_QUERY_POWER); ; 869 : break; 000bf e9 14 00 00 00 jmp $L2961 ; 870 : } 000c4 e9 0f 00 00 00 jmp $L2961 $L2960: 000c9 83 7d ec 02 cmp DWORD PTR -20+[ebp], 2 000cd 0f 84 6a ff ff ff je $L2964 000d3 e9 00 00 00 00 jmp $L2961 $L2961: ; 871 : ; 872 : ; 873 : PoStartNextPowerIrp (Irp); 000d8 8b 45 0c mov eax, DWORD PTR _Irp$[ebp] 000db 50 push eax 000dc ff 15 00 00 00 00 call DWORD PTR __imp__PoStartNextPowerIrp@4 ; 874 : Test98_DecIoCount (data); 000e2 8b 45 f8 mov eax, DWORD PTR _data$[ebp] 000e5 50 push eax 000e6 e8 00 00 00 00 call _Test98_DecIoCount@4 ; 875 : ; 876 : return STATUS_SUCCESS; 000eb 33 c0 xor eax, eax 000ed e9 00 00 00 00 jmp $L2955 $L2955: ; 877 : } 000f2 5f pop edi 000f3 5e pop esi 000f4 5b pop ebx 000f5 c9 leave 000f6 c2 0c 00 ret 12 ; 0000000cH _Test98_PowerComplete@12 ENDP _TEXT ENDS END