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

📄 read.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 727  :     // Recall that the interval timer dpc can be lurking in some
; 728  :     // DPC queue.
; 729  :     //
; 730  : 
; 731  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_COMPLETE;

  0000f	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]

; 732  : 
; 733  :     SerialTryToCompleteCurrent(
; 734  :         extension,
; 735  :         NULL,
; 736  :         oldIrql,
; 737  :         STATUS_SUCCESS,
; 738  :         &extension->CurrentReadIrp,
; 739  :         &extension->ReadQueue,
; 740  :         &extension->ReadRequestIntervalTimer,
; 741  :         &extension->ReadRequestTotalTimer,
; 742  :         SerialStartRead,
; 743  :         SerialGetNextIrp,
; 744  :         SERIAL_REF_ISR
; 745  :         );

  00012	6a 01		 push	 1
  00014	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  00019	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  0001e	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00024	c7 86 2c 01 00
	00 fd ff ff ff	 mov	 DWORD PTR [esi+300], -3	; fffffffdH
  0002e	50		 push	 eax
  0002f	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  00035	50		 push	 eax
  00036	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0003c	50		 push	 eax
  0003d	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00043	50		 push	 eax
  00044	6a 00		 push	 0
  00046	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00049	6a 00		 push	 0
  0004b	56		 push	 esi
  0004c	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 746  : 
; 747  :     SerialDpcEpilogue(extension, Dpc);

  00051	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  00054	56		 push	 esi
  00055	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  0005a	5e		 pop	 esi

; 748  : }

  0005b	c9		 leave
  0005c	c2 10 00	 ret	 16			; 00000010H
_SerialCompleteRead@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialCancelCurrentRead@8
PUBLIC	_SerialGrabReadFromIsr@4
; Function compile flags: /Ogsy
;	COMDAT _SerialCancelCurrentRead@8
PAGESER	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelCurrentRead@8 PROC NEAR			; COMDAT

; 775  : 
; 776  :     PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;

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

; 777  :     SERIAL_LOCKED_PAGED_CODE();
; 778  : 
; 779  :     //
; 780  :     // We set this to indicate to the interval timer
; 781  :     // that the read has encountered a cancel.
; 782  :     //
; 783  :     // Recall that the interval timer dpc can be lurking in some
; 784  :     // DPC queue.
; 785  :     //
; 786  : 
; 787  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_CANCEL;
; 788  : 
; 789  :     SerialTryToCompleteCurrent(
; 790  :         extension,
; 791  :         SerialGrabReadFromIsr,
; 792  :         Irp->CancelIrql,
; 793  :         STATUS_CANCELLED,
; 794  :         &extension->CurrentReadIrp,
; 795  :         &extension->ReadQueue,
; 796  :         &extension->ReadRequestIntervalTimer,
; 797  :         &extension->ReadRequestTotalTimer,
; 798  :         SerialStartRead,
; 799  :         SerialGetNextIrp,
; 800  :         SERIAL_REF_CANCEL
; 801  :         );

  00004	6a 02		 push	 2
  00006	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  0000b	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  00010	8b 40 28	 mov	 eax, DWORD PTR [eax+40]
  00013	8d 88 b0 03 00
	00		 lea	 ecx, DWORD PTR [eax+944]
  00019	83 88 2c 01 00
	00 ff		 or	 DWORD PTR [eax+300], -1
  00020	51		 push	 ecx
  00021	8d 88 d8 03 00
	00		 lea	 ecx, DWORD PTR [eax+984]
  00027	51		 push	 ecx
  00028	8d 88 a4 00 00
	00		 lea	 ecx, DWORD PTR [eax+164]
  0002e	51		 push	 ecx
  0002f	8d 88 c4 00 00
	00		 lea	 ecx, DWORD PTR [eax+196]
  00035	51		 push	 ecx
  00036	8b 4c 24 24	 mov	 ecx, DWORD PTR _Irp$[esp+24]
  0003a	68 20 01 00 c0	 push	 -1073741536		; c0000120H
  0003f	8a 49 25	 mov	 cl, BYTE PTR [ecx+37]
  00042	51		 push	 ecx
  00043	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  00048	50		 push	 eax
  00049	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 802  : 
; 803  : }

  0004e	c2 08 00	 ret	 8
_SerialCancelCurrentRead@8 ENDP
; Function compile flags: /Ogsy
PAGESER	ENDS
;	COMDAT _SerialGrabReadFromIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialGrabReadFromIsr@4 PROC NEAR			; COMDAT

; 841  : 
; 842  :     PSERIAL_DEVICE_EXTENSION extension = Context;
; 843  :     SERIAL_LOCKED_PAGED_CODE();
; 844  : 
; 845  :     if (extension->ReadBufferBase !=
; 846  :         extension->InterruptReadBuffer) {

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	8b 88 ec 00 00
	00		 mov	 ecx, DWORD PTR [eax+236]
  0000a	3b 88 e8 00 00
	00		 cmp	 ecx, DWORD PTR [eax+232]
  00010	74 5f		 je	 SHORT $L14950

; 847  : 
; 848  :         //
; 849  :         // We need to set the information to the number of characters
; 850  :         // that the read wanted minus the number of characters that
; 851  :         // didn't get read into the interrupt buffer.
; 852  :         //
; 853  : 
; 854  :         extension->CurrentReadIrp->IoStatus.Information =
; 855  :             IoGetCurrentIrpStackLocation(
; 856  :                 extension->CurrentReadIrp
; 857  :                 )->Parameters.Read.Length -
; 858  :             ((extension->LastCharSlot - extension->CurrentCharSlot) + 1);

  00012	8b 88 c4 00 00
	00		 mov	 ecx, DWORD PTR [eax+196]
  00018	56		 push	 esi
  00019	8d 90 f4 00 00
	00		 lea	 edx, DWORD PTR [eax+244]
  0001f	57		 push	 edi
  00020	8b 71 60	 mov	 esi, DWORD PTR [ecx+96]
  00023	8b 3a		 mov	 edi, DWORD PTR [edx]
  00025	8b 76 04	 mov	 esi, DWORD PTR [esi+4]
  00028	2b b0 f8 00 00
	00		 sub	 esi, DWORD PTR [eax+248]
  0002e	8d 74 3e ff	 lea	 esi, DWORD PTR [esi+edi-1]
  00032	5f		 pop	 edi
  00033	89 71 1c	 mov	 DWORD PTR [ecx+28], esi

; 859  : 
; 860  :         //
; 861  :         // Switch back to the interrupt buffer.
; 862  :         //
; 863  : 
; 864  :         extension->ReadBufferBase = extension->InterruptReadBuffer;

  00036	8b 88 e8 00 00
	00		 mov	 ecx, DWORD PTR [eax+232]

; 865  :         extension->CurrentCharSlot = extension->InterruptReadBuffer;
; 866  :         extension->FirstReadableChar = extension->InterruptReadBuffer;
; 867  :         extension->LastCharSlot = extension->InterruptReadBuffer +
; 868  :                                       (extension->BufferSize - 1);
; 869  :         extension->CharsInInterruptBuffer = 0;

  0003c	83 a0 f0 00 00
	00 00		 and	 DWORD PTR [eax+240], 0
  00043	89 0a		 mov	 DWORD PTR [edx], ecx
  00045	8b 90 04 01 00
	00		 mov	 edx, DWORD PTR [eax+260]
  0004b	89 88 ec 00 00
	00		 mov	 DWORD PTR [eax+236], ecx
  00051	89 88 fc 00 00
	00		 mov	 DWORD PTR [eax+252], ecx
  00057	5e		 pop	 esi
  00058	8d 4c 0a ff	 lea	 ecx, DWORD PTR [edx+ecx-1]
  0005c	89 88 f8 00 00
	00		 mov	 DWORD PTR [eax+248], ecx

; 870  : 
; 871  :         SERIAL_CLEAR_REFERENCE(
; 872  :             extension->CurrentReadIrp,
; 873  :             SERIAL_REF_ISR
; 874  :             );

  00062	8b 80 c4 00 00
	00		 mov	 eax, DWORD PTR [eax+196]
  00068	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0006b	83 c0 10	 add	 eax, 16			; 00000010H
  0006e	83 20 fe	 and	 DWORD PTR [eax], -2	; fffffffeH
$L14950:

; 875  : 
; 876  :     }
; 877  : 
; 878  :     return FALSE;

  00071	32 c0		 xor	 al, al

; 879  : 
; 880  : }

  00073	c2 04 00	 ret	 4
_SerialGrabReadFromIsr@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialReadTimeout@16
; Function compile flags: /Ogsy
;	COMDAT _SerialReadTimeout@16
_TEXT	SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_SerialReadTimeout@16 PROC NEAR				; COMDAT

; 913  : {

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

; 914  : 
; 915  :     PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 916  :     KIRQL oldIrql;
; 917  : 
; 918  :     UNREFERENCED_PARAMETER(SystemContext1);
; 919  :     UNREFERENCED_PARAMETER(SystemContext2);
; 920  : 
; 921  : 
; 922  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialReadTimeout\n"));
; 923  : 
; 924  :     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

; 925  : 
; 926  :     //
; 927  :     // We set this to indicate to the interval timer
; 928  :     // that the read has completed due to total timeout.
; 929  :     //
; 930  :     // Recall that the interval timer dpc can be lurking in some
; 931  :     // DPC queue.
; 932  :     //
; 933  : 
; 934  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_TOTAL;

  0000f	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]

; 935  : 
; 936  :     SerialTryToCompleteCurrent(
; 937  :         extension,
; 938  :         SerialGrabReadFromIsr,
; 939  :         oldIrql,
; 940  :         STATUS_TIMEOUT,
; 941  :         &extension->CurrentReadIrp,
; 942  :         &extension->ReadQueue,
; 943  :         &extension->ReadRequestIntervalTimer,
; 944  :         &extension->ReadRequestTotalTimer,
; 945  :         SerialStartRead,
; 946  :         SerialGetNextIrp,
; 947  :         SERIAL_REF_TOTAL_TIMER
; 948  :         );

  00012	6a 04		 push	 4
  00014	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  00019	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  0001e	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00024	c7 86 2c 01 00
	00 fe ff ff ff	 mov	 DWORD PTR [esi+300], -2	; fffffffeH
  0002e	50		 push	 eax
  0002f	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  00035	50		 push	 eax
  00036	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0003c	50		 push	 eax
  0003d	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00043	50		 push	 eax
  00044	68 02 01 00 00	 push	 258			; 00000102H
  00049	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  0004c	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  00051	56		 push	 esi
  00052	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 949  : 
; 950  :     SerialDpcEpilogue(extension, Dpc);

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

; 951  : 
; 952  : }

  00061	c9		 leave
  00062	c2 10 00	 ret	 16			; 00000010H
_SerialReadTimeout@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialUpdateReadByIsr@4
; Function compile flags: /Ogsy
;	COMDAT _SerialUpdateReadByIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialUpdateReadByIsr@4 PROC NEAR			; COMDAT

; 982  : 
; 983  :     PSERIAL_DEVICE_EXTENSION extension = Context;
; 984  :     SERIAL_LOCKED_PAGED_CODE();
; 985  : 
; 986  :     extension->CountOnLastRead = extension->ReadByIsr;

  00000	8b 4c 24 04	 mov	 ecx, DWORD PTR _Context$[esp-4]
  00004	8d 81 30 01 00
	00		 lea	 eax, DWORD PTR [ecx+304]
  0000a	8b 10		 mov	 edx, DWORD PTR [eax]

; 987  :     extension->ReadByIsr = 0;

  0000c	83 20 00	 and	 DWORD PTR [eax], 0
  0000f	89 91 2c 01 00
	00		 mov	 DWORD PTR [ecx+300], edx

; 988  : 
; 989  :     return FALSE;

  00015	32 c0		 xor	 al, al

; 990  : 
; 991  : }

  00017	c2 04 00	 ret	 4
_SerialUpdateReadByIsr@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialIntervalReadTimeout@16
; Function compile flags: /Ogsy
;	COMDAT _SerialIntervalReadTimeout@16
_TEXT	SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_currentTime$15004 = -12
_SerialIntervalReadTimeout@16 PROC NEAR			; COMDAT

; 1031 : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 0c	 sub	 esp, 12			; 0000000cH

; 1032 : 
; 1033 :     PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 1034 :     KIRQL oldIrql;
; 1035 : 
; 1036 :     UNREFERENCED_PARAMETER(SystemContext1);
; 1037 :     UNREFERENCED_PARAMETER(SystemContext2);
; 1038 : 
; 1039 :     IoAcquireCancelSpinLock(&oldIrql);

  00006	8d 45 fc	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  00009	56		 push	 esi
  0000a	50		 push	 eax
  0000b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 1040 : 
; 1041 :     SerialDump(SERTRACECALLS, ("SERIAL: SerialIntervalReadTimeout\n"));
; 1042 : 
; 1043 :     if (extension->CountOnLastRead == SERIAL_COMPLETE_READ_TOTAL) {

  00011	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]
  00014	8b 86 2c 01 00
	00		 mov	 eax, DWORD PTR [esi+300]
  0001a	83 f8 fe	 cmp	 eax, -2			; fffffffeH
  0001d	75 40		 jne	 SHORT $L14989

⌨️ 快捷键说明

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