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

📄 ioctl.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.00.9044.0 

	TITLE	F:\W2DDK\src\kernel\serial\ioctl.c
	.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
_DATA	SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST	ENDS
_BSS	SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS	ENDS
$$SYMBOLS	SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS	ENDS
$$TYPES	SEGMENT BYTE USE32 'DEBTYP'
$$TYPES	ENDS
_TLS	SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS	ENDS
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _RtlConvertLongToLargeInteger@4
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _SerialGetStats@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialClearStats@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetChars@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetBaud@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetLineControl@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialGetModemUpdate@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetMCRContents@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialGetMCRContents@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetFCRContents@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialGetCommStatus@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialSetEscapeChar@4
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialIoControl@8
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialGetProperties@8
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
;	COMDAT _SerialInternalIoControl@8
PAGESER	SEGMENT PARA USE32 PUBLIC ''
PAGESER	ENDS
FLAT	GROUP _DATA, CONST, _BSS
	ASSUME	CS: FLAT, DS: FLAT, SS: FLAT
endif

INCLUDELIB LIBC
INCLUDELIB OLDNAMES

PUBLIC	_SerialGetStats@4
EXTRN	__imp__KeGetCurrentIrql@0:NEAR
EXTRN	__imp__RtlAssert@16:NEAR
EXTRN	_DbgPrint:NEAR
EXTRN	_SerialGlobals:BYTE
;	COMDAT _SerialGetStats@4
; File f:\w2ddk\src\kernel\serial\ioctl.c
PAGESER	SEGMENT
$SG14825 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14828 DB	'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
	ORG $+1
$SG14829 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_sp$ = 8
_SerialGetStats@4 PROC NEAR				; COMDAT

; 93   : {

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

; 94   : 
; 95   :     PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation((PIRP)Context);
; 96   :     PSERIAL_DEVICE_EXTENSION extension = irpSp->DeviceObject->DeviceExtension;

  00065	8b 45 08	 mov	 eax, DWORD PTR _Context$[ebp]
  00068	53		 push	 ebx
  00069	56		 push	 esi

; 97   :     PSERIALPERF_STATS sp = ((PIRP)Context)->AssociatedIrp.SystemBuffer;
; 98   : 
; 99   :     SERIAL_LOCKED_PAGED_CODE();

  0006a	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  00070	8b 48 60	 mov	 ecx, DWORD PTR [eax+96]
  00073	8b 40 0c	 mov	 eax, DWORD PTR [eax+12]
  00076	57		 push	 edi
  00077	89 45 08	 mov	 DWORD PTR _sp$[ebp], eax
  0007a	8b 49 14	 mov	 ecx, DWORD PTR [ecx+20]
  0007d	8b 59 28	 mov	 ebx, DWORD PTR [ecx+40]
  00080	ff d6		 call	 esi
  00082	3c 01		 cmp	 al, 1
  00084	76 2f		 jbe	 SHORT $L14826
  00086	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  0008d	75 26		 jne	 SHORT $L14826
  0008f	ff d6		 call	 esi
  00091	0f b6 c0	 movzx	 eax, al
  00094	50		 push	 eax
  00095	68 00 00 00 00	 push	 OFFSET FLAT:$SG14825
  0009a	e8 00 00 00 00	 call	 _DbgPrint
  0009f	59		 pop	 ecx
  000a0	59		 pop	 ecx
  000a1	6a 00		 push	 0
  000a3	6a 63		 push	 99			; 00000063H
  000a5	68 00 00 00 00	 push	 OFFSET FLAT:$SG14828
  000aa	68 00 00 00 00	 push	 OFFSET FLAT:$SG14829
  000af	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14826:

; 100  : 
; 101  :     *sp = extension->PerfStats;

  000b5	8b 7d 08	 mov	 edi, DWORD PTR _sp$[ebp]
  000b8	6a 06		 push	 6
  000ba	8d b3 84 01 00
	00		 lea	 esi, DWORD PTR [ebx+388]
  000c0	59		 pop	 ecx
  000c1	f3 a5		 rep movsd
  000c3	5f		 pop	 edi
  000c4	5e		 pop	 esi

; 102  :     return FALSE;

  000c5	32 c0		 xor	 al, al
  000c7	5b		 pop	 ebx

; 103  : 
; 104  : }

  000c8	5d		 pop	 ebp
  000c9	c2 04 00	 ret	 4
_SerialGetStats@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialClearStats@4
;	COMDAT _SerialClearStats@4
PAGESER	SEGMENT
$SG14834 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14837 DB	'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
	ORG $+1
$SG14838 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialClearStats@4 PROC NEAR				; COMDAT

; 129  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp
  00065	56		 push	 esi

; 130  :    SERIAL_LOCKED_PAGED_CODE();

  00066	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0006c	57		 push	 edi
  0006d	ff d6		 call	 esi
  0006f	3c 01		 cmp	 al, 1
  00071	76 32		 jbe	 SHORT $L14835
  00073	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  0007a	75 29		 jne	 SHORT $L14835
  0007c	ff d6		 call	 esi
  0007e	0f b6 c0	 movzx	 eax, al
  00081	50		 push	 eax
  00082	68 00 00 00 00	 push	 OFFSET FLAT:$SG14834
  00087	e8 00 00 00 00	 call	 _DbgPrint
  0008c	59		 pop	 ecx
  0008d	59		 pop	 ecx
  0008e	6a 00		 push	 0
  00090	68 82 00 00 00	 push	 130			; 00000082H
  00095	68 00 00 00 00	 push	 OFFSET FLAT:$SG14837
  0009a	68 00 00 00 00	 push	 OFFSET FLAT:$SG14838
  0009f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14835:

; 131  : 
; 132  :     RtlZeroMemory(
; 133  :         &((PSERIAL_DEVICE_EXTENSION)Context)->PerfStats,
; 134  :         sizeof(SERIALPERF_STATS)
; 135  :         );

  000a5	8b 55 08	 mov	 edx, DWORD PTR _Context$[ebp]
  000a8	6a 06		 push	 6
  000aa	59		 pop	 ecx
  000ab	33 c0		 xor	 eax, eax
  000ad	8d ba 84 01 00
	00		 lea	 edi, DWORD PTR [edx+388]

; 136  : 
; 137  :     RtlZeroMemory(&((PSERIAL_DEVICE_EXTENSION)Context)->WmiPerfData,
; 138  :                  sizeof(SERIAL_WMI_PERF_DATA));

  000b3	6a 06		 push	 6
  000b5	f3 ab		 rep stosd
  000b7	59		 pop	 ecx
  000b8	8d ba 18 06 00
	00		 lea	 edi, DWORD PTR [edx+1560]
  000be	f3 ab		 rep stosd
  000c0	5f		 pop	 edi

; 139  :     return FALSE;

  000c1	32 c0		 xor	 al, al
  000c3	5e		 pop	 esi

; 140  : 
; 141  : }

  000c4	5d		 pop	 ebp
  000c5	c2 04 00	 ret	 4
_SerialClearStats@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialSetChars@4
;	COMDAT _SerialSetChars@4
PAGESER	SEGMENT
$SG14850 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14853 DB	'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
	ORG $+1
$SG14854 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialSetChars@4 PROC NEAR				; COMDAT

; 168  : {

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

; 169  : 
; 170  :     ((PSERIAL_IOCTL_SYNC)Context)->Extension->SpecialChars =
; 171  :         *((PSERIAL_CHARS)(((PSERIAL_IOCTL_SYNC)Context)->Data));

  00065	8b 45 08	 mov	 eax, DWORD PTR _Context$[ebp]
  00068	56		 push	 esi
  00069	57		 push	 edi
  0006a	8b 38		 mov	 edi, DWORD PTR [eax]
  0006c	8b 70 04	 mov	 esi, DWORD PTR [eax+4]
  0006f	81 c7 6c 01 00
	00		 add	 edi, 364		; 0000016cH
  00075	a5		 movsd
  00076	66 a5		 movsw

; 172  : 
; 173  :     SERIAL_LOCKED_PAGED_CODE();

  00078	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0007e	ff d6		 call	 esi
  00080	3c 01		 cmp	 al, 1
  00082	76 32		 jbe	 SHORT $L14851
  00084	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  0008b	75 29		 jne	 SHORT $L14851
  0008d	ff d6		 call	 esi
  0008f	0f b6 c0	 movzx	 eax, al
  00092	50		 push	 eax
  00093	68 00 00 00 00	 push	 OFFSET FLAT:$SG14850
  00098	e8 00 00 00 00	 call	 _DbgPrint
  0009d	59		 pop	 ecx
  0009e	59		 pop	 ecx
  0009f	6a 00		 push	 0
  000a1	68 ad 00 00 00	 push	 173			; 000000adH
  000a6	68 00 00 00 00	 push	 OFFSET FLAT:$SG14853
  000ab	68 00 00 00 00	 push	 OFFSET FLAT:$SG14854
  000b0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14851:
  000b6	5f		 pop	 edi

; 174  : 
; 175  :     return FALSE;

  000b7	32 c0		 xor	 al, al
  000b9	5e		 pop	 esi

; 176  : 
; 177  : }

  000ba	5d		 pop	 ebp
  000bb	c2 04 00	 ret	 4
_SerialSetChars@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialSetBaud@4
EXTRN	__imp__WRITE_PORT_UCHAR@8:NEAR
EXTRN	__imp__READ_PORT_UCHAR@4:NEAR
;	COMDAT _SerialSetBaud@4
PAGESER	SEGMENT
$SG14865 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14868 DB	'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
	ORG $+1
$SG14869 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_LineControl$14875 = -4
_SerialSetBaud@4 PROC NEAR				; COMDAT

; 202  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp
  00065	51		 push	 ecx

; 203  : 
; 204  :     PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;

  00066	8b 45 08	 mov	 eax, DWORD PTR _Context$[ebp]
  00069	53		 push	 ebx
  0006a	56		 push	 esi
  0006b	57		 push	 edi
  0006c	8b 30		 mov	 esi, DWORD PTR [eax]

; 205  :     USHORT Appropriate = PtrToUshort(((PSERIAL_IOCTL_SYNC)Context)->Data);

  0006e	66 8b 58 04	 mov	 bx, WORD PTR [eax+4]

; 206  : 
; 207  :     SERIAL_LOCKED_PAGED_CODE();

  00072	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00078	3c 01		 cmp	 al, 1
  0007a	76 36		 jbe	 SHORT $L14870
  0007c	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  00083	75 2d		 jne	 SHORT $L14870
  00085	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  0008b	0f b6 c0	 movzx	 eax, al
  0008e	50		 push	 eax
  0008f	68 00 00 00 00	 push	 OFFSET FLAT:$SG14865
  00094	e8 00 00 00 00	 call	 _DbgPrint
  00099	59		 pop	 ecx
  0009a	59		 pop	 ecx
  0009b	6a 00		 push	 0
  0009d	68 cf 00 00 00	 push	 207			; 000000cfH
  000a2	68 00 00 00 00	 push	 OFFSET FLAT:$SG14868
  000a7	68 00 00 00 00	 push	 OFFSET FLAT:$SG14869
  000ac	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14870:

; 208  : 
; 209  : 
; 210  :     WRITE_DIVISOR_LATCH(
; 211  :         Extension->Controller,
; 212  :         Appropriate
; 213  :         );

  000b2	8b be 98 00 00
	00		 mov	 edi, DWORD PTR [esi+152]
  000b8	8d 47 03	 lea	 eax, DWORD PTR [edi+3]
  000bb	50		 push	 eax
  000bc	89 45 08	 mov	 DWORD PTR 8+[ebp], eax
  000bf	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__READ_PORT_UCHAR@4
  000c5	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  000cb	88 45 fc	 mov	 BYTE PTR _LineControl$14875[ebp], al
  000ce	0c 80		 or	 al, 128			; 00000080H
  000d0	50		 push	 eax
  000d1	ff 75 08	 push	 DWORD PTR 8+[ebp]
  000d4	ff d6		 call	 esi
  000d6	53		 push	 ebx
  000d7	57		 push	 edi
  000d8	ff d6		 call	 esi
  000da	c1 fb 08	 sar	 ebx, 8
  000dd	47		 inc	 edi
  000de	53		 push	 ebx
  000df	57		 push	 edi
  000e0	ff d6		 call	 esi
  000e2	ff 75 fc	 push	 DWORD PTR _LineControl$14875[ebp]
  000e5	ff 75 08	 push	 DWORD PTR 8+[ebp]
  000e8	ff d6		 call	 esi
  000ea	5f		 pop	 edi
  000eb	5e		 pop	 esi

; 214  : 
; 215  :     return FALSE;

  000ec	32 c0		 xor	 al, al
  000ee	5b		 pop	 ebx

; 216  : 
; 217  : }

  000ef	c9		 leave
  000f0	c2 04 00	 ret	 4
_SerialSetBaud@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialSetLineControl@4
;	COMDAT _SerialSetLineControl@4
PAGESER	SEGMENT
$SG14889 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG14892 DB	'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
	ORG $+1
$SG14893 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialSetLineControl@4 PROC NEAR			; COMDAT

; 240  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp
  00065	56		 push	 esi

; 241  : 
; 242  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 243  : 
; 244  :     SERIAL_LOCKED_PAGED_CODE();

  00066	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0006c	ff d6		 call	 esi
  0006e	3c 01		 cmp	 al, 1
  00070	76 32		 jbe	 SHORT $L14894
  00072	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  00079	75 29		 jne	 SHORT $L14894
  0007b	ff d6		 call	 esi
  0007d	0f b6 c0	 movzx	 eax, al
  00080	50		 push	 eax
  00081	68 00 00 00 00	 push	 OFFSET FLAT:$SG14889
  00086	e8 00 00 00 00	 call	 _DbgPrint
  0008b	59		 pop	 ecx
  0008c	59		 pop	 ecx
  0008d	6a 00		 push	 0

⌨️ 快捷键说明

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