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

📄 utils.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 317  : 
; 318  :     }
; 319  : 
; 320  :     *NextIrp = *CurrentOpIrp;

  00032	8b 4d 10	 mov	 ecx, DWORD PTR _NextIrp$[ebp]
  00035	8b 06		 mov	 eax, DWORD PTR [esi]

; 321  :     IoReleaseCancelSpinLock(OldIrql);

  00037	ff 75 1c	 push	 DWORD PTR _OldIrql$[ebp]
  0003a	89 01		 mov	 DWORD PTR [ecx], eax
  0003c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 322  : 
; 323  :     if (CompleteCurrent) {

  00042	80 7d 14 00	 cmp	 BYTE PTR _CompleteCurrent$[ebp], 0
  00046	74 16		 je	 SHORT $L14845

; 324  : 
; 325  :         if (oldIrp) {

  00048	85 ff		 test	 edi, edi
  0004a	74 12		 je	 SHORT $L14845

; 326  : 
; 327  :             SerialDump(
; 328  :                 SERIRPPATH,
; 329  :                 ("SERIAL: Complete Irp: %x\n",oldIrp)
; 330  :                 );
; 331  : 
; 332  :             SerialCompleteRequest(extension, oldIrp, IO_SERIAL_INCREMENT);

  0004c	b2 02		 mov	 dl, 2
  0004e	8b cf		 mov	 ecx, edi
  00050	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00056	ff 75 18	 push	 DWORD PTR _extension$[ebp]
  00059	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4
$L14845:
  0005e	5f		 pop	 edi
  0005f	5e		 pop	 esi

; 333  :         }
; 334  :     }
; 335  : }

  00060	5d		 pop	 ebp
  00061	c2 18 00	 ret	 24			; 00000018H
_SerialGetNextIrpLocked@24 ENDP
PAGESER	ENDS
PUBLIC	_SerialRundownIrpRefs@16
PUBLIC	_SerialTryToCompleteCurrent@44
EXTRN	__imp__KeSynchronizeExecution@12:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialTryToCompleteCurrent@44
PAGESER	SEGMENT
_Extension$ = 8
_SynchRoutine$ = 12
_IrqlForRelease$ = 16
_StatusToUse$ = 20
_CurrentOpIrp$ = 24
_QueueToProcess$ = 28
_IntervalTimer$ = 32
_TotalTimer$ = 36
_Starter$ = 40
_GetNextIrp$ = 44
_RefType$ = 48
_newIrp$14881 = 12
_SerialTryToCompleteCurrent@44 PROC NEAR		; COMDAT

; 388  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	53		 push	 ebx
  00004	56		 push	 esi

; 389  : 
; 390  :    SERIAL_LOCKED_PAGED_CODE();
; 391  : 
; 392  :     //
; 393  :     // We can decrement the reference to "remove" the fact
; 394  :     // that the caller no longer will be accessing this irp.
; 395  :     //
; 396  : 
; 397  :     SERIAL_CLEAR_REFERENCE(
; 398  :         *CurrentOpIrp,
; 399  :         RefType
; 400  :         );

  00005	8b 75 18	 mov	 esi, DWORD PTR _CurrentOpIrp$[ebp]
  00008	8b 4d 30	 mov	 ecx, DWORD PTR _RefType$[ebp]

; 401  : 
; 402  :     if (SynchRoutine) {

  0000b	8b 5d 08	 mov	 ebx, DWORD PTR _Extension$[ebp]
  0000e	57		 push	 edi
  0000f	8b 06		 mov	 eax, DWORD PTR [esi]
  00011	33 ff		 xor	 edi, edi
  00013	f7 d1		 not	 ecx
  00015	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  00018	83 c0 10	 add	 eax, 16			; 00000010H
  0001b	21 08		 and	 DWORD PTR [eax], ecx
  0001d	39 7d 0c	 cmp	 DWORD PTR _SynchRoutine$[ebp], edi
  00020	74 10		 je	 SHORT $L14878

; 403  : 
; 404  :         KeSynchronizeExecution(
; 405  :             Extension->Interrupt,
; 406  :             SynchRoutine,
; 407  :             Extension
; 408  :             );

  00022	53		 push	 ebx
  00023	ff 75 0c	 push	 DWORD PTR _SynchRoutine$[ebp]
  00026	ff b3 a0 00 00
	00		 push	 DWORD PTR [ebx+160]
  0002c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12
$L14878:

; 409  : 
; 410  :     }
; 411  : 
; 412  :     //
; 413  :     // Try to run down all other references to this irp.
; 414  :     //
; 415  : 
; 416  :     SerialRundownIrpRefs(
; 417  :         CurrentOpIrp,
; 418  :         IntervalTimer,
; 419  :         TotalTimer,
; 420  :         Extension
; 421  :         );

  00032	53		 push	 ebx
  00033	ff 75 24	 push	 DWORD PTR _TotalTimer$[ebp]
  00036	ff 75 20	 push	 DWORD PTR _IntervalTimer$[ebp]
  00039	56		 push	 esi
  0003a	e8 00 00 00 00	 call	 _SerialRundownIrpRefs@16

; 422  : 
; 423  :     //
; 424  :     // See if the ref count is zero after trying to kill everybody else.
; 425  :     //
; 426  : 
; 427  :     if (!SERIAL_REFERENCE_COUNT(*CurrentOpIrp)) {

  0003f	8b 06		 mov	 eax, DWORD PTR [esi]
  00041	8b 48 60	 mov	 ecx, DWORD PTR [eax+96]
  00044	39 79 10	 cmp	 DWORD PTR [ecx+16], edi
  00047	75 57		 jne	 SHORT $L14880

; 428  : 
; 429  :         PIRP newIrp;
; 430  : 
; 431  : 
; 432  :         //
; 433  :         // The ref count was zero so we should complete this
; 434  :         // request.
; 435  :         //
; 436  :         // The following call will also cause the current irp to be
; 437  :         // completed.
; 438  :         //
; 439  : 
; 440  :         (*CurrentOpIrp)->IoStatus.Status = StatusToUse;

  00049	8b 4d 14	 mov	 ecx, DWORD PTR _StatusToUse$[ebp]

; 441  : 
; 442  :         if (StatusToUse == STATUS_CANCELLED) {

  0004c	81 f9 20 01 00
	c0		 cmp	 ecx, -1073741536	; c0000120H
  00052	89 48 18	 mov	 DWORD PTR [eax+24], ecx
  00055	75 05		 jne	 SHORT $L14883

; 443  : 
; 444  :             (*CurrentOpIrp)->IoStatus.Information = 0;

  00057	8b 06		 mov	 eax, DWORD PTR [esi]
  00059	89 78 1c	 mov	 DWORD PTR [eax+28], edi
$L14883:

; 445  : 
; 446  :         }
; 447  : 
; 448  :         if (GetNextIrp) {

  0005c	39 7d 2c	 cmp	 DWORD PTR _GetNextIrp$[ebp], edi

; 449  : 
; 450  :             IoReleaseCancelSpinLock(IrqlForRelease);

  0005f	ff 75 10	 push	 DWORD PTR _IrqlForRelease$[ebp]
  00062	74 1f		 je	 SHORT $L14884
  00064	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 451  :             GetNextIrp(
; 452  :                 CurrentOpIrp,
; 453  :                 QueueToProcess,
; 454  :                 &newIrp,
; 455  :                 TRUE,
; 456  :                 Extension
; 457  :                 );

  0006a	53		 push	 ebx
  0006b	8d 45 0c	 lea	 eax, DWORD PTR _newIrp$14881[ebp]
  0006e	6a 01		 push	 1
  00070	50		 push	 eax
  00071	ff 75 1c	 push	 DWORD PTR _QueueToProcess$[ebp]
  00074	56		 push	 esi
  00075	ff 55 2c	 call	 DWORD PTR _GetNextIrp$[ebp]

; 458  : 
; 459  :             if (newIrp) {

  00078	39 7d 0c	 cmp	 DWORD PTR _newIrp$14881[ebp], edi
  0007b	74 2c		 je	 SHORT $L14892

; 460  : 
; 461  :                 Starter(Extension);

  0007d	53		 push	 ebx
  0007e	ff 55 28	 call	 DWORD PTR _Starter$[ebp]

; 462  : 
; 463  :             }
; 464  : 
; 465  :         } else {

  00081	eb 26		 jmp	 SHORT $L14892
$L14884:

; 466  : 
; 467  :             PIRP oldIrp = *CurrentOpIrp;

  00083	8b 3e		 mov	 edi, DWORD PTR [esi]

; 468  : 
; 469  :             //
; 470  :             // There was no get next routine.  We will simply complete
; 471  :             // the irp.  We should make sure that we null out the
; 472  :             // pointer to the pointer to this irp.
; 473  :             //
; 474  : 
; 475  :             *CurrentOpIrp = NULL;

  00085	83 26 00	 and	 DWORD PTR [esi], 0

; 476  : 
; 477  :             IoReleaseCancelSpinLock(IrqlForRelease);

  00088	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 478  :             SerialDump(
; 479  :                 SERIRPPATH,
; 480  :                 ("SERIAL: Complete Irp: %x\n",oldIrp)
; 481  :                 );
; 482  :             SerialCompleteRequest(Extension, oldIrp, IO_SERIAL_INCREMENT);

  0008e	b2 02		 mov	 dl, 2
  00090	8b cf		 mov	 ecx, edi
  00092	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00098	53		 push	 ebx
  00099	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 483  :         }
; 484  : 
; 485  :     } else {

  0009e	eb 09		 jmp	 SHORT $L14892
$L14880:

; 486  : 
; 487  :         IoReleaseCancelSpinLock(IrqlForRelease);

  000a0	ff 75 10	 push	 DWORD PTR _IrqlForRelease$[ebp]
  000a3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L14892:
  000a9	5f		 pop	 edi
  000aa	5e		 pop	 esi
  000ab	5b		 pop	 ebx

; 488  : 
; 489  :     }
; 490  : 
; 491  : }

  000ac	5d		 pop	 ebp
  000ad	c2 2c 00	 ret	 44			; 0000002cH
_SerialTryToCompleteCurrent@44 ENDP
PAGESER	ENDS
PUBLIC	_SerialCancelTimer@8
; Function compile flags: /Ogsy
;	COMDAT _SerialRundownIrpRefs@16
PAGESER	SEGMENT
_CurrentOpIrp$ = 8
_IntervalTimer$ = 12
_TotalTimer$ = 16
_PDevExt$ = 20
_SerialRundownIrpRefs@16 PROC NEAR			; COMDAT

; 530  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	56		 push	 esi

; 531  : 
; 532  :    SERIAL_LOCKED_PAGED_CODE();
; 533  : 
; 534  :     //
; 535  :     // This routine is called with the cancel spin lock held
; 536  :     // so we know only one thread of execution can be in here
; 537  :     // at one time.
; 538  :     //
; 539  : 
; 540  :     //
; 541  :     // First we see if there is still a cancel routine.  If
; 542  :     // so then we can decrement the count by one.
; 543  :     //
; 544  : 
; 545  :     if ((*CurrentOpIrp)->CancelRoutine) {

  00004	8b 75 08	 mov	 esi, DWORD PTR _CurrentOpIrp$[ebp]
  00007	8b 06		 mov	 eax, DWORD PTR [esi]
  00009	83 78 38 00	 cmp	 DWORD PTR [eax+56], 0
  0000d	74 16		 je	 SHORT $L14902

; 546  : 
; 547  :         SERIAL_CLEAR_REFERENCE(
; 548  :             *CurrentOpIrp,
; 549  :             SERIAL_REF_CANCEL
; 550  :             );

  0000f	8b 40 60	 mov	 eax, DWORD PTR [eax+96]

; 551  : 
; 552  :         IoSetCancelRoutine(
; 553  :             *CurrentOpIrp,
; 554  :             NULL
; 555  :             );

  00012	33 d2		 xor	 edx, edx
  00014	83 c0 10	 add	 eax, 16			; 00000010H
  00017	83 20 fd	 and	 DWORD PTR [eax], -3	; fffffffdH
  0001a	8b 0e		 mov	 ecx, DWORD PTR [esi]
  0001c	83 c1 38	 add	 ecx, 56			; 00000038H
  0001f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8
$L14902:

; 556  : 
; 557  :     }
; 558  : 
; 559  :     if (IntervalTimer) {

  00025	83 7d 0c 00	 cmp	 DWORD PTR _IntervalTimer$[ebp], 0
  00029	74 1a		 je	 SHORT $L14920

; 560  : 
; 561  :         //
; 562  :         // Try to cancel the operations interval timer.  If the operation
; 563  :         // returns true then the timer did have a reference to the
; 564  :         // irp.  Since we've canceled this timer that reference is
; 565  :         // no longer valid and we can decrement the reference count.
; 566  :         //
; 567  :         // If the cancel returns false then this means either of two things:
; 568  :         //
; 569  :         // a) The timer has already fired.
; 570  :         //
; 571  :         // b) There never was an interval timer.
; 572  :         //
; 573  :         // In the case of "b" there is no need to decrement the reference
; 574  :         // count since the "timer" never had a reference to it.
; 575  :         //
; 576  :         // In the case of "a", then the timer itself will be coming
; 577  :         // along and decrement it's reference.  Note that the caller
; 578  :         // of this routine might actually be the this timer, but it
; 579  :         // has already decremented the reference.
; 580  :         //
; 581  : 
; 582  :         if (SerialCancelTimer(IntervalTimer, PDevExt)) {

  0002b	ff 75 14	 push	 DWORD PTR _PDevExt$[ebp]
  0002e	ff 75 0c	 push	 DWORD PTR _IntervalTimer$[ebp]
  00031	e8 00 00 00 00	 call	 _SerialCancelTimer@8
  00036	84 c0		 test	 al, al
  00038	74 0b		 je	 SHORT $L14920

; 583  : 
; 584  :             SERIAL_CLEAR_REFERENCE(
; 585  :                 *CurrentOpIrp,
; 586  :                 SERIAL_REF_INT_TIMER
; 587  :                 );

  0003a	8b 06		 mov	 eax, DWORD PTR [esi]
  0003c	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0003f	83 c0 10	 add	 eax, 16			; 00000010H
  00042	83 20 f7	 and	 DWORD PTR [eax], -9	; fffffff7H
$L14920:

; 588  : 
; 589  :         }
; 590  : 
; 591  :     }
; 592  : 
; 593  :     if (TotalTimer) {

  00045	83 7d 10 00	 cmp	 DWORD PTR _TotalTimer$[ebp], 0
  00049	74 1a		 je	 SHORT $L14928

; 594  : 
; 595  :         //
; 596  :         // Try to cancel the operations total timer.  If the operation
; 597  :         // returns true then the timer did have a reference to the
; 598  :         // irp.  Since we've canceled this timer that reference is
; 599  :         // no longer valid and we can decrement the reference count.
; 600  :         //
; 601  :         // If the cancel returns false then this means either of two things:
; 602  :         //
; 603  :         // a) The timer has already fired.
; 604  :         //
; 605  :         // b) There never was an total timer.
; 606  :         //
; 607  :         // In the case of "b" there is no need to decrement the reference
; 608  :         // count since the "timer" never had a reference to it.
; 609  :         //
; 610  :         // In the case of "a", then the timer itself will be coming
; 611  :         // along and decrement it's reference.  Note that the caller
; 612  :         // of this routine might actually be the this timer, but it
; 613  :         // has already decremented the reference.
; 614  :         //
; 615  : 
; 616  :         if (SerialCancelTimer(TotalTimer, PDevExt)) {

  0004b	ff 75 14	 push	 DWORD PTR _PDevExt$[ebp]
  0004e	ff 75 10	 push	 DWORD PTR _TotalTimer$[ebp]
  00051	e8 00 00 00 00	 call	 _SerialCancelTimer@8
  00056	84 c0		 test	 al, al
  00058	74 0b		 je	 SHORT $L14928

; 617  : 
; 618  :             SERIAL_CLEAR_REFERENCE(
; 619  :                 *CurrentOpIrp,
; 620  :                 SERIAL_REF_TOTAL_TIMER
; 621  :                 );

  0005a	8b 06		 mov	 eax, DWORD PTR [esi]
  0005c	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0005f	83 c0 10	 add	 eax, 16			; 00000010H
  00062	83 20 fb	 and	 DWORD PTR [eax], -5	; fffffffbH

⌨️ 快捷键说明

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