⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	51		 push	 ecx

; 1116 :    PLIST_ENTRY pIrpLink;
; 1117 :    PIRP pIrp;
; 1118 :    PIO_STACK_LOCATION pIrpStack;
; 1119 :    PDEVICE_OBJECT pDevObj;
; 1120 :    PDRIVER_OBJECT pDrvObj;
; 1121 :    KIRQL oldIrql;
; 1122 : 
; 1123 :    SerialDump(SERTRACECALLS, ("SERIAL: Entering SerialUnstallIrps\n"));
; 1124 :    IoAcquireCancelSpinLock(&oldIrql);

  00005	8d 45 fc	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  00008	53		 push	 ebx
  00009	50		 push	 eax
  0000a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 1125 : 
; 1126 :    pIrpLink = PDevExt->StalledIrpQueue.Flink;

  00010	8b 45 08	 mov	 eax, DWORD PTR _PDevExt$[ebp]
  00013	8d 98 2c 05 00
	00		 lea	 ebx, DWORD PTR [eax+1324]
  00019	8b 03		 mov	 eax, DWORD PTR [ebx]

; 1127 : 
; 1128 :    while (pIrpLink != &PDevExt->StalledIrpQueue) {

  0001b	3b c3		 cmp	 eax, ebx
  0001d	74 53		 je	 SHORT $L15085
  0001f	56		 push	 esi
  00020	57		 push	 edi
$L15084:

; 1129 :       pIrp = CONTAINING_RECORD(pIrpLink, IRP, Tail.Overlay.ListEntry);

  00021	8d 70 a8	 lea	 esi, DWORD PTR [eax-88]

; 1130 :       RemoveEntryList(&pIrp->Tail.Overlay.ListEntry);
; 1131 : 
; 1132 :       pIrpStack = IoGetCurrentIrpStackLocation(pIrp);
; 1133 :       pDevObj = pIrpStack->DeviceObject;
; 1134 :       pDrvObj = pDevObj->DriverObject;
; 1135 :       IoSetCancelRoutine(pIrp, NULL);

  00024	33 d2		 xor	 edx, edx
  00026	8b 4e 5c	 mov	 ecx, DWORD PTR [esi+92]
  00029	8b 46 58	 mov	 eax, DWORD PTR [esi+88]
  0002c	89 01		 mov	 DWORD PTR [ecx], eax
  0002e	89 48 04	 mov	 DWORD PTR [eax+4], ecx
  00031	8b 7e 60	 mov	 edi, DWORD PTR [esi+96]
  00034	8d 4e 38	 lea	 ecx, DWORD PTR [esi+56]
  00037	8b 47 14	 mov	 eax, DWORD PTR [edi+20]
  0003a	89 45 08	 mov	 DWORD PTR _pDevObj$[ebp], eax
  0003d	8b 40 08	 mov	 eax, DWORD PTR [eax+8]
  00040	89 45 f8	 mov	 DWORD PTR _pDrvObj$[ebp], eax
  00043	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8

; 1136 :       IoReleaseCancelSpinLock(oldIrql);

  00049	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  0004c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 1137 : 
; 1138 :       SerialDump(SERPNPPOWER, ("SERIAL: Unstalling Irp 0x%x with 0x%x\n",
; 1139 :                                pIrp, pIrpStack->MajorFunction));
; 1140 : 
; 1141 :       pDrvObj->MajorFunction[pIrpStack->MajorFunction](pDevObj, pIrp);

  00052	0f b6 07	 movzx	 eax, BYTE PTR [edi]
  00055	8b 4d f8	 mov	 ecx, DWORD PTR _pDrvObj$[ebp]
  00058	56		 push	 esi
  00059	ff 75 08	 push	 DWORD PTR _pDevObj$[ebp]
  0005c	ff 54 81 38	 call	 DWORD PTR [ecx+eax*4+56]

; 1142 : 
; 1143 :       IoAcquireCancelSpinLock(&oldIrql);

  00060	8d 45 fc	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  00063	50		 push	 eax
  00064	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 1144 :       pIrpLink = PDevExt->StalledIrpQueue.Flink;

  0006a	8b 03		 mov	 eax, DWORD PTR [ebx]
  0006c	3b c3		 cmp	 eax, ebx
  0006e	75 b1		 jne	 SHORT $L15084
  00070	5f		 pop	 edi
  00071	5e		 pop	 esi
$L15085:

; 1145 :    }
; 1146 : 
; 1147 :    IoReleaseCancelSpinLock(oldIrql);

  00072	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00075	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
  0007b	5b		 pop	 ebx

; 1148 : 
; 1149 :    SerialDump(SERTRACECALLS, ("SERIAL: Leaving SerialUnstallIrps\n"));
; 1150 : }

  0007c	c9		 leave
  0007d	c2 04 00	 ret	 4
_SerialUnstallIrps@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialIRPPrologue@8
EXTRN	__imp_@InterlockedIncrement@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialIRPPrologue@8
_TEXT	SEGMENT
_PIrp$ = 8
_PDevExt$ = 12
_SerialIRPPrologue@8 PROC NEAR				; COMDAT

; 1172 : {

  00000	56		 push	 esi

; 1173 :    InterlockedIncrement(&PDevExt->PendingIRPCnt);

  00001	8b 74 24 0c	 mov	 esi, DWORD PTR _PDevExt$[esp]
  00005	8d 8e c8 04 00
	00		 lea	 ecx, DWORD PTR [esi+1224]
  0000b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedIncrement@4

; 1174 : 
; 1175 :    return SerialFilterIrps(PIrp, PDevExt);

  00011	56		 push	 esi
  00012	ff 74 24 0c	 push	 DWORD PTR _PIrp$[esp+4]
  00016	e8 00 00 00 00	 call	 _SerialFilterIrps@8
  0001b	5e		 pop	 esi

; 1176 : }

  0001c	c2 08 00	 ret	 8
_SerialIRPPrologue@8 ENDP
_TEXT	ENDS
EXTRN	__imp__KeSetEvent@12:NEAR
EXTRN	__imp_@InterlockedDecrement@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialIRPEpilogue@4
_TEXT	SEGMENT
_PDevExt$ = 8
_SerialIRPEpilogue@4 PROC NEAR				; COMDAT

; 1199 : {

  00000	56		 push	 esi

; 1200 :    LONG pendingCnt;
; 1201 : 
; 1202 :    pendingCnt = InterlockedDecrement(&PDevExt->PendingIRPCnt);

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _PDevExt$[esp]
  00005	8d 8e c8 04 00
	00		 lea	 ecx, DWORD PTR [esi+1224]
  0000b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4

; 1203 : 
; 1204 :    ASSERT(pendingCnt >= 0);
; 1205 : 
; 1206 :    if (pendingCnt == 0) {

  00011	85 c0		 test	 eax, eax
  00013	75 0f		 jne	 SHORT $L15114

; 1207 :       KeSetEvent(&PDevExt->PendingIRPEvent, IO_NO_INCREMENT, FALSE);

  00015	50		 push	 eax
  00016	81 c6 d0 04 00
	00		 add	 esi, 1232		; 000004d0H
  0001c	50		 push	 eax
  0001d	56		 push	 esi
  0001e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSetEvent@12
$L15114:
  00024	5e		 pop	 esi

; 1208 :    }
; 1209 : }

  00025	c2 04 00	 ret	 4
_SerialIRPEpilogue@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialInsertQueueDpc@16
EXTRN	__imp__KeInsertQueueDpc@12:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialInsertQueueDpc@16
_TEXT	SEGMENT
_PDpc$ = 8
_Sarg1$ = 12
_Sarg2$ = 16
_PDevExt$ = 20
_SerialInsertQueueDpc@16 PROC NEAR			; COMDAT

; 1233 : {

  00000	53		 push	 ebx
  00001	56		 push	 esi

; 1234 :    BOOLEAN queued;
; 1235 : 
; 1236 :    InterlockedIncrement(&PDevExt->DpcCount);

  00002	8b 74 24 18	 mov	 esi, DWORD PTR _PDevExt$[esp+4]
  00006	57		 push	 edi
  00007	8d be 30 06 00
	00		 lea	 edi, DWORD PTR [esi+1584]
  0000d	8b cf		 mov	 ecx, edi
  0000f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedIncrement@4

; 1237 :    LOGENTRY(LOG_CNT, 'DpI1', PDpc, PDevExt->DpcCount, 0);
; 1238 : 
; 1239 :    queued = KeInsertQueueDpc(PDpc, Sarg1, Sarg2);

  00015	ff 74 24 18	 push	 DWORD PTR _Sarg2$[esp+8]
  00019	ff 74 24 18	 push	 DWORD PTR _Sarg1$[esp+12]
  0001d	ff 74 24 18	 push	 DWORD PTR _PDpc$[esp+16]
  00021	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeInsertQueueDpc@12
  00027	8a d8		 mov	 bl, al

; 1240 : 
; 1241 :    if (!queued) {

  00029	84 db		 test	 bl, bl
  0002b	75 1b		 jne	 SHORT $L15127

; 1242 :       ULONG pendingCnt;
; 1243 : 
; 1244 :       pendingCnt = InterlockedDecrement(&PDevExt->DpcCount);

  0002d	8b cf		 mov	 ecx, edi
  0002f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4

; 1245 : //      LOGENTRY(LOG_CNT, 'DpD1', PDpc, PDevExt->DpcCount, 0);
; 1246 : 
; 1247 :       if (pendingCnt == 0) {

  00035	85 c0		 test	 eax, eax
  00037	75 0f		 jne	 SHORT $L15127

; 1248 :          KeSetEvent(&PDevExt->PendingIRPEvent, IO_NO_INCREMENT, FALSE);

  00039	50		 push	 eax
  0003a	81 c6 d0 04 00
	00		 add	 esi, 1232		; 000004d0H
  00040	50		 push	 eax
  00041	56		 push	 esi
  00042	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSetEvent@12
$L15127:
  00048	5f		 pop	 edi

; 1249 :          LOGENTRY(LOG_CNT, 'DpF1', PDpc, PDevExt->DpcCount, 0);
; 1250 :       }
; 1251 :    }
; 1252 : 
; 1253 : #if 0 // DBG
; 1254 :    if (queued) {
; 1255 :       int i;
; 1256 : 
; 1257 :       for (i = 0; i < MAX_DPC_QUEUE; i++) {
; 1258 :                      if (PDevExt->DpcQueued[i].Dpc == PDpc) {
; 1259 :                         PDevExt->DpcQueued[i].QueuedCount++;
; 1260 :                         break;
; 1261 :                      }
; 1262 :       }
; 1263 : 
; 1264 :       ASSERT(i < MAX_DPC_QUEUE);
; 1265 :    }
; 1266 : #endif
; 1267 : 
; 1268 :    return queued;

  00049	8a c3		 mov	 al, bl
  0004b	5e		 pop	 esi
  0004c	5b		 pop	 ebx

; 1269 : }

  0004d	c2 10 00	 ret	 16			; 00000010H
_SerialInsertQueueDpc@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialSetTimer@20
EXTRN	__imp__KeSetTimer@16:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialSetTimer@20
_TEXT	SEGMENT
_Timer$ = 8
_DueTime$ = 12
_Dpc$ = 20
_PDevExt$ = 24
_SerialSetTimer@20 PROC NEAR				; COMDAT

; 1297 : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp

; 1298 :    BOOLEAN set;
; 1299 : 
; 1300 :    InterlockedIncrement(&PDevExt->DpcCount);

  00003	8b 45 18	 mov	 eax, DWORD PTR _PDevExt$[ebp]
  00006	53		 push	 ebx
  00007	56		 push	 esi
  00008	8d b0 30 06 00
	00		 lea	 esi, DWORD PTR [eax+1584]
  0000e	8b ce		 mov	 ecx, esi
  00010	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedIncrement@4

; 1301 :    LOGENTRY(LOG_CNT, 'DpI2', Dpc, PDevExt->DpcCount, 0);
; 1302 : 
; 1303 :    set = KeSetTimer(Timer, DueTime, Dpc);

  00016	ff 75 14	 push	 DWORD PTR _Dpc$[ebp]
  00019	ff 75 10	 push	 DWORD PTR _DueTime$[ebp+4]
  0001c	ff 75 0c	 push	 DWORD PTR _DueTime$[ebp]
  0001f	ff 75 08	 push	 DWORD PTR _Timer$[ebp]
  00022	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSetTimer@16
  00028	8a d8		 mov	 bl, al

; 1304 : 
; 1305 :    if (set) {

  0002a	84 db		 test	 bl, bl
  0002c	74 08		 je	 SHORT $L15138

; 1306 :       InterlockedDecrement(&PDevExt->DpcCount);

  0002e	8b ce		 mov	 ecx, esi
  00030	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4
$L15138:

; 1307 : //      LOGENTRY(LOG_CNT, 'DpD2', Dpc, PDevExt->DpcCount, 0);
; 1308 :    }
; 1309 : 
; 1310 : #if 0 // DBG
; 1311 :    if (set) {
; 1312 :       int i;
; 1313 : 
; 1314 :       for (i = 0; i < MAX_DPC_QUEUE; i++) {
; 1315 :                      if (PDevExt->DpcQueued[i].Dpc == Dpc) {
; 1316 :                         PDevExt->DpcQueued[i].QueuedCount++;
; 1317 :                         break;
; 1318 :                      }
; 1319 :       }
; 1320 : 
; 1321 :       ASSERT(i < MAX_DPC_QUEUE);
; 1322 :    }
; 1323 : #endif
; 1324 : 
; 1325 :    return set;

  00036	8a c3		 mov	 al, bl
  00038	5e		 pop	 esi
  00039	5b		 pop	 ebx

; 1326 : }

  0003a	5d		 pop	 ebp
  0003b	c2 14 00	 ret	 20			; 00000014H
_SerialSetTimer@20 ENDP
_TEXT	ENDS
PUBLIC	_SerialDpcEpilogue@8
EXTRN	__imp__KeCancelTimer@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialCancelTimer@8
_TEXT	SEGMENT
_Timer$ = 8
_PDevExt$ = 12
_SerialCancelTimer@8 PROC NEAR				; COMDAT

; 1349 : {

  00000	53		 push	 ebx
  00001	56		 push	 esi

; 1350 :    BOOLEAN cancelled;
; 1351 : 
; 1352 :    cancelled = KeCancelTimer(Timer);

  00002	8b 74 24 0c	 mov	 esi, DWORD PTR _Timer$[esp+4]
  00006	56		 push	 esi
  00007	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeCancelTimer@4
  0000d	8a d8		 mov	 bl, al

; 1353 : 
; 1354 :    if (cancelled) {

  0000f	84 db		 test	 bl, bl
  00011	74 0c		 je	 SHORT $L15145

; 1355 :       SerialDpcEpilogue(PDevExt, Timer->Dpc);

  00013	ff 76 20	 push	 DWORD PTR [esi+32]
  00016	ff 74 24 14	 push	 DWORD PTR _PDevExt$[esp+8]
  0001a	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
$L15145:

; 1356 :    }
; 1357 : 
; 1358 :    return cancelled;

  0001f	8a c3		 mov	 al, bl
  00021	5e		 pop	 esi
  00022	5b		 pop	 ebx

; 1359 : }

  00023	c2 08 00	 ret	 8
_SerialCancelTimer@8 ENDP
; Function compile flags: /Ogsy
_TEXT	ENDS
;	COMDAT _SerialDpcEpilogue@8
_TEXT	SEGMENT
_PDevExt$ = 8
_SerialDpcEpilogue@8 PROC NEAR				; COMDAT

; 1379 : {

  00000	56		 push	 esi

; 1380 :    LONG pendingCnt;
; 1381 : #if 1 // !DBG
; 1382 :    UNREFERENCED_PARAMETER(PDpc);
; 1383 : #endif
; 1384 : 
; 1385 :    pendingCnt = InterlockedDecrement(&PDevExt->DpcCount);

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _PDevExt$[esp]
  00005	8d 8e 30 06 00
	00		 lea	 ecx, DWORD PTR [esi+1584]
  0000b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4

; 1386 : //   LOGENTRY(LOG_CNT, 'DpD3', PDpc, PDevExt->DpcCount, 0);
; 1387 : 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -