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

📄 utils.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  000d9	75 25		 jne	 SHORT $L14873
  000db	ff d6		 call	 esi
  000dd	0f b6 c0	 movzx	 eax, al
  000e0	50		 push	 eax
  000e1	68 00 00 00 00	 push	 OFFSET FLAT:$SG14872
  000e6	e8 00 00 00 00	 call	 _DbgPrint
  000eb	59		 pop	 ecx
  000ec	59		 pop	 ecx
  000ed	6a 00		 push	 0
  000ef	68 14 01 00 00	 push	 276			; 00000114H
  000f4	68 00 00 00 00	 push	 OFFSET FLAT:$SG14875
  000f9	68 00 00 00 00	 push	 OFFSET FLAT:$SG14876
  000fe	ff d7		 call	 edi
$L14873:

; 277  : 
; 278  : 
; 279  :     oldIrp = *CurrentOpIrp;

  00100	8b 75 08	 mov	 esi, DWORD PTR _CurrentOpIrp$[ebp]
  00103	8b 1e		 mov	 ebx, DWORD PTR [esi]

; 280  : 
; 281  : #if DBG
; 282  :     if (oldIrp) {

  00105	85 db		 test	 ebx, ebx
  00107	74 1f		 je	 SHORT $L14879

; 283  : 
; 284  :         if (CompleteCurrent) {

  00109	80 7d 14 00	 cmp	 BYTE PTR _CompleteCurrent$[ebp], 0
  0010d	74 19		 je	 SHORT $L14879

; 285  : 
; 286  :             ASSERT(!oldIrp->CancelRoutine);

  0010f	83 7b 38 00	 cmp	 DWORD PTR [ebx+56], 0
  00113	74 13		 je	 SHORT $L14879
  00115	6a 00		 push	 0
  00117	68 1e 01 00 00	 push	 286			; 0000011eH
  0011c	68 00 00 00 00	 push	 OFFSET FLAT:$SG14881
  00121	68 00 00 00 00	 push	 OFFSET FLAT:$SG14882
  00126	ff d7		 call	 edi
$L14879:

; 287  : 
; 288  :         }
; 289  : 
; 290  :     }
; 291  : #endif
; 292  : 
; 293  :     //
; 294  :     // Check to see if there is a new irp to start up.
; 295  :     //
; 296  : 
; 297  :     if (!IsListEmpty(QueueToProcess)) {

  00128	8b 4d 0c	 mov	 ecx, DWORD PTR _QueueToProcess$[ebp]
  0012b	8b 01		 mov	 eax, DWORD PTR [ecx]
  0012d	3b c1		 cmp	 eax, ecx
  0012f	74 1c		 je	 SHORT $L14883

; 298  : 
; 299  :         PLIST_ENTRY headOfList;
; 300  : 
; 301  :         headOfList = RemoveHeadList(QueueToProcess);

  00131	8b 50 04	 mov	 edx, DWORD PTR [eax+4]
  00134	8b 08		 mov	 ecx, DWORD PTR [eax]

; 302  : 
; 303  :         *CurrentOpIrp = CONTAINING_RECORD(
; 304  :                             headOfList,
; 305  :                             IRP,
; 306  :                             Tail.Overlay.ListEntry
; 307  :                             );

  00136	83 c0 a8	 add	 eax, -88		; ffffffa8H
  00139	89 0a		 mov	 DWORD PTR [edx], ecx
  0013b	89 51 04	 mov	 DWORD PTR [ecx+4], edx

; 308  : 
; 309  :         IoSetCancelRoutine(
; 310  :             *CurrentOpIrp,
; 311  :             NULL
; 312  :             );

  0013e	8d 48 38	 lea	 ecx, DWORD PTR [eax+56]
  00141	33 d2		 xor	 edx, edx
  00143	89 06		 mov	 DWORD PTR [esi], eax
  00145	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8

; 313  : 
; 314  :     } else {

  0014b	eb 03		 jmp	 SHORT $L14898
$L14883:

; 315  : 
; 316  :         *CurrentOpIrp = NULL;

  0014d	83 26 00	 and	 DWORD PTR [esi], 0
$L14898:

; 317  : 
; 318  :     }
; 319  : 
; 320  :     *NextIrp = *CurrentOpIrp;

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

; 321  :     IoReleaseCancelSpinLock(OldIrql);

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

; 322  : 
; 323  :     if (CompleteCurrent) {

  00160	80 7d 14 00	 cmp	 BYTE PTR _CompleteCurrent$[ebp], 0
  00164	74 2c		 je	 SHORT $L14901

; 324  : 
; 325  :         if (oldIrp) {

  00166	85 db		 test	 ebx, ebx
  00168	74 28		 je	 SHORT $L14901

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

  0016a	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  00171	74 0d		 je	 SHORT $L14903
  00173	53		 push	 ebx
  00174	68 00 00 00 00	 push	 OFFSET FLAT:$SG14908
  00179	e8 00 00 00 00	 call	 _DbgPrint
  0017e	59		 pop	 ecx
  0017f	59		 pop	 ecx
$L14903:

; 331  : 
; 332  :             SerialCompleteRequest(extension, oldIrp, IO_SERIAL_INCREMENT);

  00180	b2 02		 mov	 dl, 2
  00182	8b cb		 mov	 ecx, ebx
  00184	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  0018a	ff 75 18	 push	 DWORD PTR _extension$[ebp]
  0018d	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4
$L14901:
  00192	5f		 pop	 edi
  00193	5e		 pop	 esi
  00194	5b		 pop	 ebx

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

  00195	5d		 pop	 ebp
  00196	c2 18 00	 ret	 24			; 00000018H
_SerialGetNextIrpLocked@24 ENDP
PAGESER	ENDS
PUBLIC	_SerialRundownIrpRefs@16
PUBLIC	_SerialTryToCompleteCurrent@44
EXTRN	__imp__KeSynchronizeExecution@12:NEAR
;	COMDAT _SerialTryToCompleteCurrent@44
PAGESER	SEGMENT
$SG14939 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14942 DB	'f:\w2ddk\src\kernel\serial\utils.c', 00H
	ORG $+1
$SG14943 DB	'FALSE', 00H
	ORG $+2
$SG14952 DB	'f:\w2ddk\src\kernel\serial\utils.c', 00H
	ORG $+1
$SG14953 DB	'*_arg4 & _refType', 00H
	ORG $+2
$SG14971 DB	'SERIAL: Complete Irp: %x', 0aH, 00H
; Function compile flags: /Ogs
_Extension$ = 8
_SynchRoutine$ = 12
_IrqlForRelease$ = 16
_StatusToUse$ = 20
_CurrentOpIrp$ = 24
_QueueToProcess$ = 28
_IntervalTimer$ = 32
_TotalTimer$ = 36
_Starter$ = 40
_GetNextIrp$ = 44
_RefType$ = 48
_newIrp$14957 = 12
_SerialTryToCompleteCurrent@44 PROC NEAR		; COMDAT

; 388  : {

  000b6	55		 push	 ebp
  000b7	8b ec		 mov	 ebp, esp
  000b9	53		 push	 ebx
  000ba	56		 push	 esi

; 389  : 
; 390  :    SERIAL_LOCKED_PAGED_CODE();

  000bb	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000c1	57		 push	 edi
  000c2	ff d6		 call	 esi
  000c4	3c 01		 cmp	 al, 1
  000c6	76 32		 jbe	 SHORT $L14944
  000c8	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  000cf	75 29		 jne	 SHORT $L14944
  000d1	ff d6		 call	 esi
  000d3	0f b6 c0	 movzx	 eax, al
  000d6	50		 push	 eax
  000d7	68 00 00 00 00	 push	 OFFSET FLAT:$SG14939
  000dc	e8 00 00 00 00	 call	 _DbgPrint
  000e1	59		 pop	 ecx
  000e2	59		 pop	 ecx
  000e3	6a 00		 push	 0
  000e5	68 86 01 00 00	 push	 390			; 00000186H
  000ea	68 00 00 00 00	 push	 OFFSET FLAT:$SG14942
  000ef	68 00 00 00 00	 push	 OFFSET FLAT:$SG14943
  000f4	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14944:

; 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  :         );

  000fa	8b 5d 18	 mov	 ebx, DWORD PTR _CurrentOpIrp$[ebp]
  000fd	8b 7d 30	 mov	 edi, DWORD PTR _RefType$[ebp]
  00100	8b 03		 mov	 eax, DWORD PTR [ebx]
  00102	8b 70 60	 mov	 esi, DWORD PTR [eax+96]
  00105	83 c6 10	 add	 esi, 16			; 00000010H
  00108	85 3e		 test	 DWORD PTR [esi], edi
  0010a	75 17		 jne	 SHORT $L14950
  0010c	6a 00		 push	 0
  0010e	68 90 01 00 00	 push	 400			; 00000190H
  00113	68 00 00 00 00	 push	 OFFSET FLAT:$SG14952
  00118	68 00 00 00 00	 push	 OFFSET FLAT:$SG14953
  0011d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14950:
  00123	f7 d7		 not	 edi
  00125	21 3e		 and	 DWORD PTR [esi], edi

; 401  : 
; 402  :     if (SynchRoutine) {

  00127	8b 7d 08	 mov	 edi, DWORD PTR _Extension$[ebp]
  0012a	33 f6		 xor	 esi, esi
  0012c	39 75 0c	 cmp	 DWORD PTR _SynchRoutine$[ebp], esi
  0012f	74 10		 je	 SHORT $L14954

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

  00131	57		 push	 edi
  00132	ff 75 0c	 push	 DWORD PTR _SynchRoutine$[ebp]
  00135	ff b7 a0 00 00
	00		 push	 DWORD PTR [edi+160]
  0013b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12
$L14954:

; 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  :         );

  00141	57		 push	 edi
  00142	ff 75 24	 push	 DWORD PTR _TotalTimer$[ebp]
  00145	ff 75 20	 push	 DWORD PTR _IntervalTimer$[ebp]
  00148	53		 push	 ebx
  00149	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)) {

  0014e	8b 03		 mov	 eax, DWORD PTR [ebx]
  00150	8b 48 60	 mov	 ecx, DWORD PTR [eax+96]
  00153	39 71 10	 cmp	 DWORD PTR [ecx+16], esi
  00156	75 6d		 jne	 SHORT $L14956

; 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;

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

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

  0015b	81 f9 20 01 00
	c0		 cmp	 ecx, -1073741536	; c0000120H
  00161	89 48 18	 mov	 DWORD PTR [eax+24], ecx
  00164	75 05		 jne	 SHORT $L14959

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

  00166	8b 03		 mov	 eax, DWORD PTR [ebx]
  00168	89 70 1c	 mov	 DWORD PTR [eax+28], esi
$L14959:

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

  0016b	39 75 2c	 cmp	 DWORD PTR _GetNextIrp$[ebp], esi

; 449  : 
; 450  :             IoReleaseCancelSpinLock(IrqlForRelease);

  0016e	ff 75 10	 push	 DWORD PTR _IrqlForRelease$[ebp]
  00171	74 1f		 je	 SHORT $L14960
  00173	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  :                 );

  00179	57		 push	 edi
  0017a	8d 45 0c	 lea	 eax, DWORD PTR _newIrp$14957[ebp]
  0017d	6a 01		 push	 1
  0017f	50		 push	 eax
  00180	ff 75 1c	 push	 DWORD PTR _QueueToProcess$[ebp]
  00183	53		 push	 ebx
  00184	ff 55 2c	 call	 DWORD PTR _GetNextIrp$[ebp]

; 458  : 
; 459  :             if (newIrp) {

  00187	39 75 0c	 cmp	 DWORD PTR _newIrp$14957[ebp], esi
  0018a	74 42		 je	 SHORT $L14978

; 460  : 
; 461  :                 Starter(Extension);

  0018c	57		 push	 edi
  0018d	ff 55 28	 call	 DWORD PTR _Starter$[ebp]

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

  00190	eb 3c		 jmp	 SHORT $L14978
$L14960:

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

  00192	8b 33		 mov	 esi, DWORD PTR [ebx]

; 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;

  00194	83 23 00	 and	 DWORD PTR [ebx], 0

; 476  : 
; 477  :             IoReleaseCancelSpinLock(IrqlForRelease);

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

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

  0019d	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  001a4	74 0d		 je	 SHORT $L14966
  001a6	56		 push	 esi
  001a7	68 00 00 00 00	 push	 OFFSET FLAT:$SG14971
  001ac	e8 00 00 00 00	 call	 _DbgPrint
  001b1	59		 pop	 ecx
  001b2	59		 pop	 ecx
$L14966:

; 482  :             SerialCompleteRequest(Extension, oldIrp, IO_SERIAL_INCREMENT);

  001b3	b2 02		 mov	 dl, 2
  001b5	8b ce		 mov	 ecx, esi
  001b7	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  001bd	57		 push	 edi
  001be	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

⌨️ 快捷键说明

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