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

📄 immediat.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 2 页
字号:
  00022	51		 push	 ecx
  00023	50		 push	 eax
  00024	8d 8e d8 00 00
	00		 lea	 ecx, DWORD PTR [esi+216]
  0002a	50		 push	 eax
  0002b	51		 push	 ecx
  0002c	50		 push	 eax
  0002d	ff 75 fc	 push	 DWORD PTR _OldIrql$[ebp]
  00030	50		 push	 eax
  00031	56		 push	 esi
  00032	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 266  : 
; 267  :     SerialDpcEpilogue(Extension, Dpc);

  00037	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  0003a	56		 push	 esi
  0003b	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  00040	5e		 pop	 esi

; 268  : 
; 269  : }

  00041	c9		 leave
  00042	c2 10 00	 ret	 16			; 00000010H
_SerialCompleteImmediate@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialGrabImmediateFromIsr@4
PUBLIC	_SerialTimeoutImmediate@16
; Function compile flags: /Ogsy
;	COMDAT _SerialTimeoutImmediate@16
_TEXT	SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialTimeoutImmediate@16 PROC NEAR			; COMDAT

; 279  : {

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

; 280  : 
; 281  :     PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 282  :     KIRQL OldIrql;
; 283  : 
; 284  :     UNREFERENCED_PARAMETER(SystemContext1);
; 285  :     UNREFERENCED_PARAMETER(SystemContext2);
; 286  : 
; 287  : 
; 288  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialTimeoutImmediate\n"));
; 289  : 
; 290  :     IoAcquireCancelSpinLock(&OldIrql);

  00004	8d 45 fc	 lea	 eax, DWORD PTR _OldIrql$[ebp]
  00007	56		 push	 esi
  00008	50		 push	 eax
  00009	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 291  : 
; 292  :     SerialTryToCompleteCurrent(
; 293  :         Extension,
; 294  :         SerialGrabImmediateFromIsr,
; 295  :         OldIrql,
; 296  :         STATUS_TIMEOUT,
; 297  :         &Extension->CurrentImmediateIrp,
; 298  :         NULL,
; 299  :         NULL,
; 300  :         &Extension->ImmediateTotalTimer,
; 301  :         NULL,
; 302  :         SerialGetNextImmediate,
; 303  :         SERIAL_REF_TOTAL_TIMER
; 304  :         );

  0000f	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]
  00012	6a 04		 push	 4
  00014	33 c0		 xor	 eax, eax
  00016	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextImmediate@20
  0001b	8d 8e 28 04 00
	00		 lea	 ecx, DWORD PTR [esi+1064]
  00021	50		 push	 eax
  00022	51		 push	 ecx
  00023	50		 push	 eax
  00024	50		 push	 eax
  00025	8d 86 d8 00 00
	00		 lea	 eax, DWORD PTR [esi+216]
  0002b	50		 push	 eax
  0002c	68 02 01 00 00	 push	 258			; 00000102H
  00031	ff 75 fc	 push	 DWORD PTR _OldIrql$[ebp]
  00034	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabImmediateFromIsr@4
  00039	56		 push	 esi
  0003a	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 305  : 
; 306  :     SerialDpcEpilogue(Extension, Dpc);

  0003f	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  00042	56		 push	 esi
  00043	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  00048	5e		 pop	 esi

; 307  : }

  00049	c9		 leave
  0004a	c2 10 00	 ret	 16			; 00000010H
_SerialTimeoutImmediate@16 ENDP
_TEXT	ENDS
EXTRN	_SerialProcessEmptyTransmit@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGetNextImmediate@20
PAGESER	SEGMENT
_CurrentOpIrp$ = 8
_NewIrp$ = 16
_Extension$ = 24
_OldIrql$ = 8
_SerialGetNextImmediate@20 PROC NEAR			; COMDAT

; 347  : {

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

; 348  : 
; 349  :     KIRQL OldIrql;
; 350  : //    PSERIAL_DEVICE_EXTENSION Extension = CONTAINING_RECORD(
; 351  : //                                             CurrentOpIrp,
; 352  : //                                             SERIAL_DEVICE_EXTENSION,
; 353  : //                                             CurrentImmediateIrp
; 354  : //                                             );
; 355  :     PIRP OldIrp = *CurrentOpIrp;

  00006	8b 7d 08	 mov	 edi, DWORD PTR _CurrentOpIrp$[ebp]

; 356  : 
; 357  :     UNREFERENCED_PARAMETER(QueueToProcess);
; 358  :     UNREFERENCED_PARAMETER(CompleteCurrent);
; 359  :     SERIAL_LOCKED_PAGED_CODE();
; 360  : 
; 361  :     IoAcquireCancelSpinLock(&OldIrql);

  00009	8d 45 08	 lea	 eax, DWORD PTR _OldIrql$[ebp]
  0000c	8b 1f		 mov	 ebx, DWORD PTR [edi]
  0000e	50		 push	 eax
  0000f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 362  : 
; 363  :     ASSERT(Extension->TotalCharsQueued >= 1);
; 364  :     Extension->TotalCharsQueued--;

  00015	8b 75 18	 mov	 esi, DWORD PTR _Extension$[ebp]

; 365  : 
; 366  :     *CurrentOpIrp = NULL;
; 367  :     *NewIrp = NULL;

  00018	8b 45 10	 mov	 eax, DWORD PTR _NewIrp$[ebp]

; 368  :     KeSynchronizeExecution(
; 369  :         Extension->Interrupt,
; 370  :         SerialProcessEmptyTransmit,
; 371  :         Extension
; 372  :         );

  0001b	56		 push	 esi
  0001c	68 00 00 00 00	 push	 OFFSET FLAT:_SerialProcessEmptyTransmit@4
  00021	ff 8e 28 01 00
	00		 dec	 DWORD PTR [esi+296]
  00027	83 27 00	 and	 DWORD PTR [edi], 0
  0002a	83 20 00	 and	 DWORD PTR [eax], 0
  0002d	ff b6 a0 00 00
	00		 push	 DWORD PTR [esi+160]
  00033	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 373  :     IoReleaseCancelSpinLock(OldIrql);

  00039	ff 75 08	 push	 DWORD PTR _OldIrql$[ebp]
  0003c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 374  : 
; 375  :     SerialDump(
; 376  :         SERIRPPATH,
; 377  :         ("SERIAL: Complete Irp: %x\n",OldIrp)
; 378  :         );
; 379  :     
; 380  :     SerialCompleteRequest(Extension, OldIrp, IO_SERIAL_INCREMENT);

  00042	b2 02		 mov	 dl, 2
  00044	8b cb		 mov	 ecx, ebx
  00046	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  0004c	56		 push	 esi
  0004d	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4
  00052	5f		 pop	 edi
  00053	5e		 pop	 esi
  00054	5b		 pop	 ebx

; 381  : }

  00055	5d		 pop	 ebp
  00056	c2 14 00	 ret	 20			; 00000014H
_SerialGetNextImmediate@20 ENDP
; Function compile flags: /Ogsy
PAGESER	ENDS
;	COMDAT _SerialCancelImmediate@8
PAGESER	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelImmediate@8 PROC NEAR			; COMDAT

; 409  : 
; 410  :     PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _DeviceObject$[esp-4]

; 411  :     SERIAL_LOCKED_PAGED_CODE();
; 412  : 
; 413  :     SerialTryToCompleteCurrent(
; 414  :         Extension,
; 415  :         SerialGrabImmediateFromIsr,
; 416  :         Irp->CancelIrql,
; 417  :         STATUS_CANCELLED,
; 418  :         &Extension->CurrentImmediateIrp,
; 419  :         NULL,
; 420  :         NULL,
; 421  :         &Extension->ImmediateTotalTimer,
; 422  :         NULL,
; 423  :         SerialGetNextImmediate,
; 424  :         SERIAL_REF_CANCEL
; 425  :         );

  00004	6a 02		 push	 2
  00006	33 c9		 xor	 ecx, ecx
  00008	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextImmediate@20
  0000d	8b 40 28	 mov	 eax, DWORD PTR [eax+40]
  00010	51		 push	 ecx
  00011	8d 90 28 04 00
	00		 lea	 edx, DWORD PTR [eax+1064]
  00017	52		 push	 edx
  00018	51		 push	 ecx
  00019	51		 push	 ecx
  0001a	8d 88 d8 00 00
	00		 lea	 ecx, DWORD PTR [eax+216]
  00020	51		 push	 ecx
  00021	8b 4c 24 24	 mov	 ecx, DWORD PTR _Irp$[esp+24]
  00025	68 20 01 00 c0	 push	 -1073741536		; c0000120H
  0002a	8a 49 25	 mov	 cl, BYTE PTR [ecx+37]
  0002d	51		 push	 ecx
  0002e	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabImmediateFromIsr@4
  00033	50		 push	 eax
  00034	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 426  : 
; 427  : }

  00039	c2 08 00	 ret	 8
_SerialCancelImmediate@8 ENDP
PAGESER	ENDS
EXTRN	__imp__WRITE_PORT_UCHAR@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGiveImmediateToIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialGiveImmediateToIsr@4 PROC NEAR			; COMDAT

; 460  : 
; 461  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 462  :     SERIAL_LOCKED_PAGED_CODE();
; 463  : 
; 464  :     Extension->TransmitImmediate = TRUE;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]

; 465  :     Extension->ImmediateChar =
; 466  :         *((UCHAR *)
; 467  :          (Extension->CurrentImmediateIrp->AssociatedIrp.SystemBuffer));

  00004	8b 88 d8 00 00
	00		 mov	 ecx, DWORD PTR [eax+216]
  0000a	c6 80 a1 01 00
	00 01		 mov	 BYTE PTR [eax+417], 1
  00011	8b 51 0c	 mov	 edx, DWORD PTR [ecx+12]
  00014	8a 12		 mov	 dl, BYTE PTR [edx]
  00016	88 90 d8 01 00
	00		 mov	 BYTE PTR [eax+472], dl

; 468  : 
; 469  :     //
; 470  :     // The isr now has a reference to the irp.
; 471  :     //
; 472  : 
; 473  :     SERIAL_SET_REFERENCE(
; 474  :         Extension->CurrentImmediateIrp,
; 475  :         SERIAL_REF_ISR
; 476  :         );

  0001c	8b 49 60	 mov	 ecx, DWORD PTR [ecx+96]
  0001f	83 c1 10	 add	 ecx, 16			; 00000010H
  00022	83 09 01	 or	 DWORD PTR [ecx], 1

; 477  : 
; 478  :     //
; 479  :     // Check first to see if a write is going on.  If
; 480  :     // there is then we'll just slip in during the write.
; 481  :     //
; 482  : 
; 483  :     if (!Extension->WriteLength) {

  00025	33 c9		 xor	 ecx, ecx
  00027	39 88 e0 00 00
	00		 cmp	 DWORD PTR [eax+224], ecx
  0002d	75 27		 jne	 SHORT $L14921

; 484  : 
; 485  :         //
; 486  :         // If there is no normal write transmitting then we
; 487  :         // will "re-enable" the transmit holding register empty
; 488  :         // interrupt.  The 8250 family of devices will always
; 489  :         // signal a transmit holding register empty interrupt
; 490  :         // *ANY* time this bit is set to one.  By doing things
; 491  :         // this way we can simply use the normal interrupt code
; 492  :         // to start off this write.
; 493  :         //
; 494  :         // We've been keeping track of whether the transmit holding
; 495  :         // register is empty so it we only need to do this
; 496  :         // if the register is empty.
; 497  :         //
; 498  : 
; 499  :         if (Extension->HoldingEmpty) {

  0002f	38 88 a0 01 00
	00		 cmp	 BYTE PTR [eax+416], cl
  00035	74 1f		 je	 SHORT $L14921
  00037	56		 push	 esi

; 500  : 
; 501  :             DISABLE_ALL_INTERRUPTS(Extension->Controller);

  00038	8d b0 98 00 00
	00		 lea	 esi, DWORD PTR [eax+152]
  0003e	57		 push	 edi
  0003f	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  00045	8b 06		 mov	 eax, DWORD PTR [esi]
  00047	51		 push	 ecx
  00048	40		 inc	 eax
  00049	50		 push	 eax
  0004a	ff d7		 call	 edi

; 502  :             ENABLE_ALL_INTERRUPTS(Extension->Controller);

  0004c	8b 06		 mov	 eax, DWORD PTR [esi]
  0004e	6a 0f		 push	 15			; 0000000fH
  00050	40		 inc	 eax
  00051	50		 push	 eax
  00052	ff d7		 call	 edi
  00054	5f		 pop	 edi
  00055	5e		 pop	 esi
$L14921:

; 503  : 
; 504  :         }
; 505  : 
; 506  :     }
; 507  : 
; 508  :     return FALSE;

  00056	32 c0		 xor	 al, al

; 509  : 
; 510  : }

  00058	c2 04 00	 ret	 4
_SerialGiveImmediateToIsr@4 ENDP
; Function compile flags: /Ogsy
PAGESER	ENDS
;	COMDAT _SerialGrabImmediateFromIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialGrabImmediateFromIsr@4 PROC NEAR			; COMDAT

; 541  : 
; 542  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 543  :     SERIAL_LOCKED_PAGED_CODE();
; 544  : 
; 545  :     if (Extension->TransmitImmediate) {

  00000	8b 4c 24 04	 mov	 ecx, DWORD PTR _Context$[esp-4]
  00004	8d 81 a1 01 00
	00		 lea	 eax, DWORD PTR [ecx+417]
  0000a	80 38 00	 cmp	 BYTE PTR [eax], 0
  0000d	74 12		 je	 SHORT $L14934

; 546  : 
; 547  :         Extension->TransmitImmediate = FALSE;

  0000f	80 20 00	 and	 BYTE PTR [eax], 0

; 548  : 
; 549  :         //
; 550  :         // Since the isr no longer references this irp, we can
; 551  :         // decrement it's reference count.
; 552  :         //
; 553  : 
; 554  :         SERIAL_CLEAR_REFERENCE(
; 555  :             Extension->CurrentImmediateIrp,
; 556  :             SERIAL_REF_ISR
; 557  :             );

  00012	8b 81 d8 00 00
	00		 mov	 eax, DWORD PTR [ecx+216]
  00018	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0001b	83 c0 10	 add	 eax, 16			; 00000010H
  0001e	83 20 fe	 and	 DWORD PTR [eax], -2	; fffffffeH
$L14934:

; 558  : 
; 559  :     }
; 560  : 
; 561  :     return FALSE;

  00021	32 c0		 xor	 al, al

; 562  : 
; 563  : }

  00023	c2 04 00	 ret	 4
_SerialGrabImmediateFromIsr@4 ENDP
PAGESER	ENDS
END

⌨️ 快捷键说明

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