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

📄 write.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  000f0	89 3a		 mov	 DWORD PTR [edx], edi

; 806  :             Extension->IrpMaskLocation = NULL;
; 807  :             Extension->HistoryMask = 0;

  000f2	89 18		 mov	 DWORD PTR [eax], ebx

; 808  : 
; 809  :             Extension->CurrentWaitIrp->IoStatus.Information = sizeof(ULONG);

  000f4	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  000fa	89 19		 mov	 DWORD PTR [ecx], ebx

; 810  :             SerialInsertQueueDpc(
; 811  :                 &Extension->CommWaitDpc,
; 812  :                 NULL,
; 813  :                 NULL,
; 814  :                 Extension
; 815  :                 );

  000fc	56		 push	 esi
  000fd	53		 push	 ebx
  000fe	c7 40 1c 04 00
	00 00		 mov	 DWORD PTR [eax+28], 4
  00105	8d 86 ac 02 00
	00		 lea	 eax, DWORD PTR [esi+684]
  0010b	53		 push	 ebx
  0010c	50		 push	 eax
  0010d	e8 00 00 00 00	 call	 _SerialInsertQueueDpc@16
$L15178:

; 816  : 
; 817  :         }
; 818  : 
; 819  :         Extension->CountOfTryingToLowerRTS++;

  00112	ff 86 3c 01 00
	00		 inc	 DWORD PTR [esi+316]

; 820  :         SerialPerhapsLowerRTS(Extension);

  00118	56		 push	 esi
  00119	e8 00 00 00 00	 call	 _SerialPerhapsLowerRTS@4
  0011e	5f		 pop	 edi
$L15177:
  0011f	5e		 pop	 esi

; 821  : 
; 822  :     }
; 823  : 
; 824  :     return FALSE;

  00120	32 c0		 xor	 al, al
  00122	5b		 pop	 ebx

; 825  : 
; 826  : }

  00123	5d		 pop	 ebp
  00124	c2 04 00	 ret	 4
_SerialProcessEmptyTransmit@4 ENDP
PAGESER	ENDS
EXTRN	__imp__WRITE_PORT_UCHAR@8:NEAR
EXTRN	_SerialSetRTS@4:NEAR
;	COMDAT _SerialGiveWriteToIsr@4
PAGESER	SEGMENT
$SG15189 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15192 DB	'f:\w2ddk\src\kernel\serial\write.c', 00H
	ORG $+1
$SG15193 DB	'FALSE', 00H
	ORG $+2
$SG15208 DB	'f:\w2ddk\src\kernel\serial\write.c', 00H
	ORG $+1
$SG15209 DB	'!(*_arg4 & _refType)', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialGiveWriteToIsr@4 PROC NEAR			; COMDAT

; 858  : {

  0009d	55		 push	 ebp
  0009e	8b ec		 mov	 ebp, esp
  000a0	53		 push	 ebx
  000a1	56		 push	 esi

; 859  : 
; 860  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 861  : 
; 862  :     //
; 863  :     // The current stack location.  This contains all of the
; 864  :     // information we need to process this particular request.
; 865  :     //
; 866  :     PIO_STACK_LOCATION IrpSp;
; 867  : 
; 868  :     SERIAL_LOCKED_PAGED_CODE();

  000a2	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000a8	57		 push	 edi
  000a9	ff d6		 call	 esi
  000ab	33 db		 xor	 ebx, ebx
  000ad	43		 inc	 ebx
  000ae	3a c3		 cmp	 al, bl
  000b0	76 32		 jbe	 SHORT $L15190
  000b2	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  000b9	75 29		 jne	 SHORT $L15190
  000bb	ff d6		 call	 esi
  000bd	0f b6 c0	 movzx	 eax, al
  000c0	50		 push	 eax
  000c1	68 00 00 00 00	 push	 OFFSET FLAT:$SG15189
  000c6	e8 00 00 00 00	 call	 _DbgPrint
  000cb	59		 pop	 ecx
  000cc	59		 pop	 ecx
  000cd	6a 00		 push	 0
  000cf	68 64 03 00 00	 push	 868			; 00000364H
  000d4	68 00 00 00 00	 push	 OFFSET FLAT:$SG15192
  000d9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15193
  000de	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15190:

; 869  : 
; 870  :     IrpSp = IoGetCurrentIrpStackLocation(Extension->CurrentWriteIrp);

  000e4	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  000e7	8b 86 c8 00 00
	00		 mov	 eax, DWORD PTR [esi+200]
  000ed	8b 48 60	 mov	 ecx, DWORD PTR [eax+96]

; 871  : 
; 872  :     //
; 873  :     // We might have a xoff counter request masquerading as a
; 874  :     // write.  The length of these requests will always be one
; 875  :     // and we can get a pointer to the actual character from
; 876  :     // the data supplied by the user.
; 877  :     //
; 878  : 
; 879  :     if (IrpSp->MajorFunction == IRP_MJ_WRITE) {

  000f0	80 39 04	 cmp	 BYTE PTR [ecx], 4
  000f3	75 0e		 jne	 SHORT $L15194

; 880  : 
; 881  :         Extension->WriteLength = IrpSp->Parameters.Write.Length;

  000f5	8b 49 04	 mov	 ecx, DWORD PTR [ecx+4]
  000f8	89 8e e0 00 00
	00		 mov	 DWORD PTR [esi+224], ecx

; 882  :         Extension->WriteCurrentChar =
; 883  :             Extension->CurrentWriteIrp->AssociatedIrp.SystemBuffer;

  000fe	8b 48 0c	 mov	 ecx, DWORD PTR [eax+12]

; 884  : 
; 885  :     } else {

  00101	eb 0c		 jmp	 SHORT $L15503
$L15194:

; 886  : 
; 887  :         Extension->WriteLength = 1;

  00103	89 9e e0 00 00
	00		 mov	 DWORD PTR [esi+224], ebx

; 888  :         Extension->WriteCurrentChar =
; 889  :             ((PUCHAR)Extension->CurrentWriteIrp->AssociatedIrp.SystemBuffer) +
; 890  :             FIELD_OFFSET(
; 891  :                 SERIAL_XOFF_COUNTER,
; 892  :                 XoffChar
; 893  :                 );

  00109	8b 48 0c	 mov	 ecx, DWORD PTR [eax+12]
  0010c	83 c1 08	 add	 ecx, 8
$L15503:
  0010f	89 8e e4 00 00
	00		 mov	 DWORD PTR [esi+228], ecx

; 894  : 
; 895  :     }
; 896  : 
; 897  :     //
; 898  :     // The isr now has a reference to the irp.
; 899  :     //
; 900  : 
; 901  :     SERIAL_SET_REFERENCE(
; 902  :         Extension->CurrentWriteIrp,
; 903  :         SERIAL_REF_ISR
; 904  :         );

  00115	8b 78 60	 mov	 edi, DWORD PTR [eax+96]
  00118	83 c7 10	 add	 edi, 16			; 00000010H
  0011b	84 1f		 test	 BYTE PTR [edi], bl
  0011d	74 17		 je	 SHORT $L15206
  0011f	6a 00		 push	 0
  00121	68 88 03 00 00	 push	 904			; 00000388H
  00126	68 00 00 00 00	 push	 OFFSET FLAT:$SG15208
  0012b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15209
  00130	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15206:
  00136	09 1f		 or	 DWORD PTR [edi], ebx

; 905  : 
; 906  :     //
; 907  :     // Check first to see if an immediate char is transmitting.
; 908  :     // If it is then we'll just slip in behind it when its
; 909  :     // done.
; 910  :     //
; 911  : 
; 912  :     if (!Extension->TransmitImmediate) {

  00138	80 be a1 01 00
	00 00		 cmp	 BYTE PTR [esi+417], 0
  0013f	75 25		 jne	 SHORT $L15221

; 913  : 
; 914  :         //
; 915  :         // If there is no immediate char transmitting then we
; 916  :         // will "re-enable" the transmit holding register empty
; 917  :         // interrupt.  The 8250 family of devices will always
; 918  :         // signal a transmit holding register empty interrupt
; 919  :         // *ANY* time this bit is set to one.  By doing things
; 920  :         // this way we can simply use the normal interrupt code
; 921  :         // to start off this write.
; 922  :         //
; 923  :         // We've been keeping track of whether the transmit holding
; 924  :         // register is empty so it we only need to do this
; 925  :         // if the register is empty.
; 926  :         //
; 927  : 
; 928  :         if (Extension->HoldingEmpty) {

  00141	80 be a0 01 00
	00 00		 cmp	 BYTE PTR [esi+416], 0
  00148	74 1c		 je	 SHORT $L15221

; 929  : 
; 930  :             DISABLE_ALL_INTERRUPTS(Extension->Controller);

  0014a	8b 1d 00 00 00
	00		 mov	 ebx, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  00150	8d be 98 00 00
	00		 lea	 edi, DWORD PTR [esi+152]
  00156	6a 00		 push	 0
  00158	8b 07		 mov	 eax, DWORD PTR [edi]
  0015a	40		 inc	 eax
  0015b	50		 push	 eax
  0015c	ff d3		 call	 ebx

; 931  :             ENABLE_ALL_INTERRUPTS(Extension->Controller);

  0015e	8b 07		 mov	 eax, DWORD PTR [edi]
  00160	6a 0f		 push	 15			; 0000000fH
  00162	40		 inc	 eax
  00163	50		 push	 eax
  00164	ff d3		 call	 ebx
$L15221:

; 932  : 
; 933  :         }
; 934  : 
; 935  :     }
; 936  : 
; 937  :     //
; 938  :     // The rts line may already be up from previous writes,
; 939  :     // however, it won't take much additional time to turn
; 940  :     // on the RTS line if we are doing transmit toggling.
; 941  :     //
; 942  : 
; 943  :     if ((Extension->HandFlow.FlowReplace & SERIAL_RTS_MASK) ==
; 944  :         SERIAL_TRANSMIT_TOGGLE) {

  00166	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  0016c	66 25 c0 00	 and	 ax, 192			; 000000c0H
  00170	3c c0		 cmp	 al, 192			; 000000c0H
  00172	75 06		 jne	 SHORT $L15229

; 945  : 
; 946  :         SerialSetRTS(Extension);

  00174	56		 push	 esi
  00175	e8 00 00 00 00	 call	 _SerialSetRTS@4
$L15229:
  0017a	5f		 pop	 edi
  0017b	5e		 pop	 esi

; 947  : 
; 948  :     }
; 949  : 
; 950  :     return FALSE;

  0017c	32 c0		 xor	 al, al
  0017e	5b		 pop	 ebx

; 951  : 
; 952  : }

  0017f	5d		 pop	 ebp
  00180	c2 04 00	 ret	 4
_SerialGiveWriteToIsr@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialGrabWriteFromIsr@4
;	COMDAT _SerialCancelCurrentWrite@8
PAGESER	SEGMENT
$SG15237 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15240 DB	'f:\w2ddk\src\kernel\serial\write.c', 00H
	ORG $+1
$SG15241 DB	'FALSE', 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelCurrentWrite@8 PROC NEAR			; COMDAT

; 978  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp

; 979  : 
; 980  :     PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;

  00065	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  00068	56		 push	 esi
  00069	57		 push	 edi

; 981  :     SERIAL_LOCKED_PAGED_CODE();

  0006a	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__KeGetCurrentIrql@0
  00070	8b 70 28	 mov	 esi, DWORD PTR [eax+40]
  00073	ff d7		 call	 edi
  00075	3c 01		 cmp	 al, 1
  00077	76 32		 jbe	 SHORT $L15238
  00079	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  00080	75 29		 jne	 SHORT $L15238
  00082	ff d7		 call	 edi
  00084	0f b6 c0	 movzx	 eax, al
  00087	50		 push	 eax
  00088	68 00 00 00 00	 push	 OFFSET FLAT:$SG15237
  0008d	e8 00 00 00 00	 call	 _DbgPrint
  00092	59		 pop	 ecx
  00093	59		 pop	 ecx
  00094	6a 00		 push	 0
  00096	68 d5 03 00 00	 push	 981			; 000003d5H
  0009b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15240
  000a0	68 00 00 00 00	 push	 OFFSET FLAT:$SG15241
  000a5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15238:

; 982  : 
; 983  :     SerialTryToCompleteCurrent(
; 984  :         Extension,
; 985  :         SerialGrabWriteFromIsr,
; 986  :         Irp->CancelIrql,
; 987  :         STATUS_CANCELLED,
; 988  :         &Extension->CurrentWriteIrp,
; 989  :         &Extension->WriteQueue,
; 990  :         NULL,
; 991  :         &Extension->WriteRequestTotalTimer,
; 992  :         SerialStartWrite,
; 993  :         SerialGetNextWrite,
; 994  :         SERIAL_REF_CANCEL
; 995  :         );

  000ab	6a 02		 push	 2
  000ad	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextWrite@20
  000b2	8d 86 00 04 00
	00		 lea	 eax, DWORD PTR [esi+1024]
  000b8	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartWrite@4
  000bd	50		 push	 eax
  000be	8d 86 ac 00 00
	00		 lea	 eax, DWORD PTR [esi+172]
  000c4	6a 00		 push	 0
  000c6	50		 push	 eax
  000c7	8d 86 c8 00 00
	00		 lea	 eax, DWORD PTR [esi+200]
  000cd	50		 push	 eax
  000ce	8b 45 0c	 mov	 eax, DWORD PTR _Irp$[ebp]
  000d1	68 20 01 00 c0	 push	 -1073741536		; c0000120H
  000d6	8a 40 25	 mov	 al, BYTE PTR [eax+37]
  000d9	50		 push	 eax
  000da	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabWriteFromIsr@4
  000df	56		 push	 esi
  000e0	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44
  000e5	5f		 pop	 edi
  000e6	5e		 pop	 esi

; 996  : 
; 997  : }

  000e7	5d		 pop	 ebp
  000e8	c2 08 00	 ret	 8
_SerialCancelCurrentWrite@8 ENDP
PAGESER	ENDS
PUBLIC	_SerialWriteTimeout@16
;	COMDAT _SerialWriteTimeout@16
_TEXT	SEGMENT
$SG15261 DB	'SERIAL: SerialWriteTimeout', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialWriteTimeout@16 PROC NEAR			; COMDAT

; 1029 : {

  0001c	55		 push	 ebp
  0001d	8b ec		 mov	 ebp, esp
  0001f	51		 push	 ecx

; 1030 : 
; 1031 :     PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 1032 :     KIRQL OldIrql;
; 1033 : 
; 1034 :     UNREFERENCED_PARAMETER(SystemContext1);
; 1035 :     UNREFERENCED_PARAMETER(SystemContext2);
; 1036 : 
; 1037 : SerialDump(SERTRAC

⌨️ 快捷键说明

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