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

📄 qsfile.cod

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

	TITLE	F:\W2DDK\src\kernel\serial\qsfile.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
PAGESRP0	SEGMENT PARA USE32 PUBLIC ''
PAGESRP0	ENDS
;	COMDAT _RtlConvertLongToLargeInteger@4
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _SerialQueryInformationFile@8
PAGESRP0	SEGMENT PARA USE32 PUBLIC ''
PAGESRP0	ENDS
;	COMDAT _SerialSetInformationFile@8
PAGESRP0	SEGMENT PARA USE32 PUBLIC ''
PAGESRP0	ENDS
FLAT	GROUP _DATA, CONST, _BSS
	ASSUME	CS: FLAT, DS: FLAT, SS: FLAT
endif

INCLUDELIB LIBC
INCLUDELIB OLDNAMES

PUBLIC	_SerialQueryInformationFile@8
EXTRN	_SerialDebugLevel:DWORD
EXTRN	__imp__KeGetCurrentIrql@0:NEAR
EXTRN	__imp__RtlAssert@16:NEAR
EXTRN	_SerialIRPPrologue@8:NEAR
EXTRN	_SerialIRPEpilogue@4:NEAR
EXTRN	_DbgPrint:NEAR
EXTRN	__imp_@IofCompleteRequest@8:NEAR
EXTRN	_SerialCompleteIfError@8:NEAR
;	COMDAT _SerialQueryInformationFile@8
; File f:\w2ddk\src\kernel\serial\qsfile.c
PAGESRP0	SEGMENT
$SG14812 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG14815 DB	'f:\w2ddk\src\kernel\serial\qsfile.c', 00H
$SG14816 DB	'FALSE', 00H
	ORG $+2
$SG14827 DB	'SERIAL: Dispatch entry for: %x', 0aH, 00H
$SG14854 DB	'SERIAL: Complete Irp: %x', 0aH, 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_SerialQueryInformationFile@8 PROC NEAR			; COMDAT

; 60   : {

  0008e	55		 push	 ebp
  0008f	8b ec		 mov	 ebp, esp
  00091	53		 push	 ebx
  00092	56		 push	 esi

; 61   :     //
; 62   :     // The status that gets returned to the caller and
; 63   :     // set in the Irp.
; 64   :     //
; 65   :     NTSTATUS Status;
; 66   : 
; 67   :     //
; 68   :     // The current stack location.  This contains all of the
; 69   :     // information we need to process this particular request.
; 70   :     //
; 71   :     PIO_STACK_LOCATION IrpSp;
; 72   : 
; 73   :     NTSTATUS status;
; 74   : 
; 75   :     UNREFERENCED_PARAMETER(DeviceObject);
; 76   : 
; 77   :     PAGED_CODE();

  00093	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  00099	57		 push	 edi
  0009a	ff d6		 call	 esi
  0009c	33 db		 xor	 ebx, ebx
  0009e	3c 01		 cmp	 al, 1
  000a0	76 25		 jbe	 SHORT $L14813
  000a2	ff d6		 call	 esi
  000a4	0f b6 c0	 movzx	 eax, al
  000a7	50		 push	 eax
  000a8	68 00 00 00 00	 push	 OFFSET FLAT:$SG14812
  000ad	e8 00 00 00 00	 call	 _DbgPrint
  000b2	59		 pop	 ecx
  000b3	59		 pop	 ecx
  000b4	53		 push	 ebx
  000b5	6a 4d		 push	 77			; 0000004dH
  000b7	68 00 00 00 00	 push	 OFFSET FLAT:$SG14815
  000bc	68 00 00 00 00	 push	 OFFSET FLAT:$SG14816
  000c1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14813:

; 78   : 
; 79   :     if ((status = SerialIRPPrologue(Irp,
; 80   :                                     (PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 81   :                                     DeviceExtension)) != STATUS_SUCCESS) {

  000c7	8b 7d 08	 mov	 edi, DWORD PTR _DeviceObject$[ebp]
  000ca	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  000cd	ff 77 28	 push	 DWORD PTR [edi+40]
  000d0	56		 push	 esi
  000d1	e8 00 00 00 00	 call	 _SerialIRPPrologue@8
  000d6	3b c3		 cmp	 eax, ebx
  000d8	74 07		 je	 SHORT $L14821
  000da	8b d8		 mov	 ebx, eax
  000dc	e9 8e 00 00 00	 jmp	 $L14929
$L14821:

; 82   :       SerialCompleteRequest((PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 83   :                             DeviceExtension, Irp, IO_NO_INCREMENT);
; 84   :       return status;
; 85   :    }
; 86   : 
; 87   :     SerialDump(
; 88   :         SERIRPPATH,
; 89   :         ("SERIAL: Dispatch entry for: %x\n",Irp)
; 90   :         );

  000e1	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  000e8	74 0d		 je	 SHORT $L14822
  000ea	56		 push	 esi
  000eb	68 00 00 00 00	 push	 OFFSET FLAT:$SG14827
  000f0	e8 00 00 00 00	 call	 _DbgPrint
  000f5	59		 pop	 ecx
  000f6	59		 pop	 ecx
$L14822:

; 91   :     if (SerialCompleteIfError(
; 92   :             DeviceObject,
; 93   :             Irp
; 94   :             ) != STATUS_SUCCESS) {

  000f7	56		 push	 esi
  000f8	57		 push	 edi
  000f9	e8 00 00 00 00	 call	 _SerialCompleteIfError@8
  000fe	85 c0		 test	 eax, eax
  00100	74 07		 je	 SHORT $L14835

; 95   : 
; 96   :         return STATUS_CANCELLED;

  00102	b8 20 01 00 c0	 mov	 eax, -1073741536	; c0000120H
  00107	eb 7a		 jmp	 SHORT $L14807
$L14835:

; 97   : 
; 98   :     }
; 99   :     IrpSp = IoGetCurrentIrpStackLocation(Irp);

  00109	8b 46 60	 mov	 eax, DWORD PTR [esi+96]

; 100  :     Irp->IoStatus.Information = 0L;

  0010c	89 5e 1c	 mov	 DWORD PTR [esi+28], ebx

; 101  :     Status = STATUS_SUCCESS;
; 102  :     if (IrpSp->Parameters.QueryFile.FileInformationClass ==
; 103  :         FileStandardInformation) {

  0010f	8b 40 08	 mov	 eax, DWORD PTR [eax+8]
  00112	83 f8 05	 cmp	 eax, 5
  00115	75 22		 jne	 SHORT $L14838

; 104  : 
; 105  :         PFILE_STANDARD_INFORMATION Buf = Irp->AssociatedIrp.SystemBuffer;

  00117	8b 46 0c	 mov	 eax, DWORD PTR [esi+12]

; 106  : 
; 107  :         Buf->AllocationSize.QuadPart = 0;
; 108  :         Buf->EndOfFile = Buf->AllocationSize;

  0011a	8b cb		 mov	 ecx, ebx
  0011c	89 18		 mov	 DWORD PTR [eax], ebx
  0011e	89 58 04	 mov	 DWORD PTR [eax+4], ebx
  00121	89 48 08	 mov	 DWORD PTR [eax+8], ecx
  00124	89 48 0c	 mov	 DWORD PTR [eax+12], ecx

; 109  :         Buf->NumberOfLinks = 0;

  00127	89 58 10	 mov	 DWORD PTR [eax+16], ebx

; 110  :         Buf->DeletePending = FALSE;

  0012a	88 58 14	 mov	 BYTE PTR [eax+20], bl

; 111  :         Buf->Directory = FALSE;

  0012d	88 58 15	 mov	 BYTE PTR [eax+21], bl

; 112  :         Irp->IoStatus.Information = sizeof(FILE_STANDARD_INFORMATION);

  00130	c7 46 1c 18 00
	00 00		 mov	 DWORD PTR [esi+28], 24	; 00000018H

; 113  : 
; 114  :     } else if (IrpSp->Parameters.QueryFile.FileInformationClass ==

  00137	eb 20		 jmp	 SHORT $L14848
$L14838:

; 115  :                FilePositionInformation) {

  00139	83 f8 0e	 cmp	 eax, 14			; 0000000eH
  0013c	75 11		 jne	 SHORT $L14842

; 116  : 
; 117  :         ((PFILE_POSITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer)->
; 118  :             CurrentByteOffset.QuadPart = 0;

  0013e	8b 46 0c	 mov	 eax, DWORD PTR [esi+12]
  00141	89 18		 mov	 DWORD PTR [eax], ebx
  00143	89 58 04	 mov	 DWORD PTR [eax+4], ebx

; 119  :         Irp->IoStatus.Information = sizeof(FILE_POSITION_INFORMATION);

  00146	c7 46 1c 08 00
	00 00		 mov	 DWORD PTR [esi+28], 8

; 120  : 
; 121  :     } else {

  0014d	eb 0a		 jmp	 SHORT $L14848
$L14842:

; 122  :         Status = STATUS_INVALID_PARAMETER;

  0014f	b8 0d 00 00 c0	 mov	 eax, -1073741811	; c000000dH
  00154	8b d8		 mov	 ebx, eax

; 123  :         Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;

  00156	89 46 18	 mov	 DWORD PTR [esi+24], eax
$L14848:

; 124  :     }
; 125  : 
; 126  :     SerialDump(
; 127  :         SERIRPPATH,
; 128  :         ("SERIAL: Complete Irp: %x\n",Irp)
; 129  :         );

  00159	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  00160	74 0d		 je	 SHORT $L14929
  00162	56		 push	 esi
  00163	68 00 00 00 00	 push	 OFFSET FLAT:$SG14854
  00168	e8 00 00 00 00	 call	 _DbgPrint
  0016d	59		 pop	 ecx
  0016e	59		 pop	 ecx
$L14929:

; 130  :     SerialCompleteRequest((PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 131  :                           DeviceExtension, Irp, 0);

  0016f	32 d2		 xor	 dl, dl
  00171	8b ce		 mov	 ecx, esi
  00173	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00179	ff 77 28	 push	 DWORD PTR [edi+40]
  0017c	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 132  :     return Status;

  00181	8b c3		 mov	 eax, ebx
$L14807:
  00183	5f		 pop	 edi
  00184	5e		 pop	 esi
  00185	5b		 pop	 ebx

; 133  : 
; 134  : }

  00186	5d		 pop	 ebp
  00187	c2 08 00	 ret	 8
_SerialQueryInformationFile@8 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialSetInformationFile@8
;	COMDAT _SerialSetInformationFile@8
PAGESRP0	SEGMENT
$SG14869 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG14872 DB	'f:\w2ddk\src\kernel\serial\qsfile.c', 00H
$SG14873 DB	'FALSE', 00H
	ORG $+2
$SG14884 DB	'SERIAL: Dispatch entry for: %x', 0aH, 00H
$SG14905 DB	'SERIAL: Complete Irp: %x', 0aH, 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_SerialSetInformationFile@8 PROC NEAR			; COMDAT

; 165  : {

  0008e	55		 push	 ebp
  0008f	8b ec		 mov	 ebp, esp
  00091	53		 push	 ebx
  00092	56		 push	 esi

; 166  :     //
; 167  :     // The status that gets returned to the caller and
; 168  :     // set in the Irp.
; 169  :     //
; 170  :     NTSTATUS Status;
; 171  : 
; 172  :     UNREFERENCED_PARAMETER(DeviceObject);
; 173  : 
; 174  :     PAGED_CODE();

  00093	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  00099	57		 push	 edi
  0009a	ff d6		 call	 esi
  0009c	3c 01		 cmp	 al, 1
  0009e	76 29		 jbe	 SHORT $L14870
  000a0	ff d6		 call	 esi
  000a2	0f b6 c0	 movzx	 eax, al
  000a5	50		 push	 eax
  000a6	68 00 00 00 00	 push	 OFFSET FLAT:$SG14869
  000ab	e8 00 00 00 00	 call	 _DbgPrint
  000b0	59		 pop	 ecx
  000b1	59		 pop	 ecx
  000b2	6a 00		 push	 0
  000b4	68 ae 00 00 00	 push	 174			; 000000aeH
  000b9	68 00 00 00 00	 push	 OFFSET FLAT:$SG14872
  000be	68 00 00 00 00	 push	 OFFSET FLAT:$SG14873
  000c3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14870:

; 175  : 
; 176  :     if ((Status = SerialIRPPrologue(Irp,
; 177  :                                     (PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 178  :                                     DeviceExtension)) != STATUS_SUCCESS) {

  000c9	8b 7d 08	 mov	 edi, DWORD PTR _DeviceObject$[ebp]
  000cc	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  000cf	ff 77 28	 push	 DWORD PTR [edi+40]
  000d2	56		 push	 esi
  000d3	e8 00 00 00 00	 call	 _SerialIRPPrologue@8
  000d8	8b d8		 mov	 ebx, eax
  000da	85 db		 test	 ebx, ebx

; 179  :       SerialCompleteRequest((PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 180  :                             DeviceExtension, Irp, IO_NO_INCREMENT);
; 181  :       return Status;

  000dc	75 5b		 jne	 SHORT $L14900

; 182  :    }
; 183  : 
; 184  :     SerialDump(
; 185  :         SERIRPPATH,
; 186  :         ("SERIAL: Dispatch entry for: %x\n",Irp)
; 187  :         );

  000de	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  000e5	74 0d		 je	 SHORT $L14879
  000e7	56		 push	 esi
  000e8	68 00 00 00 00	 push	 OFFSET FLAT:$SG14884
  000ed	e8 00 00 00 00	 call	 _DbgPrint
  000f2	59		 pop	 ecx
  000f3	59		 pop	 ecx
$L14879:

; 188  :     if (SerialCompleteIfError(
; 189  :             DeviceObject,
; 190  :             Irp
; 191  :             ) != STATUS_SUCCESS) {

  000f4	56		 push	 esi
  000f5	57		 push	 edi
  000f6	e8 00 00 00 00	 call	 _SerialCompleteIfError@8
  000fb	85 c0		 test	 eax, eax
  000fd	74 07		 je	 SHORT $L14892

; 192  : 
; 193  :         return STATUS_CANCELLED;

  000ff	b8 20 01 00 c0	 mov	 eax, -1073741536	; c0000120H
  00104	eb 47		 jmp	 SHORT $L14866
$L14892:

; 194  : 
; 195  :     }
; 196  :     Irp->IoStatus.Information = 0L;
; 197  :     if ((IoGetCurrentIrpStackLocation(Irp)->
; 198  :             Parameters.SetFile.FileInformationClass ==
; 199  :          FileEndOfFileInformation) ||
; 200  :         (IoGetCurrentIrpStackLocation(Irp)->
; 201  :             Parameters.SetFile.FileInformationClass ==
; 202  :          FileAllocationInformation)) {

  00106	8b 46 60	 mov	 eax, DWORD PTR [esi+96]
  00109	33 db		 xor	 ebx, ebx
  0010b	89 5e 1c	 mov	 DWORD PTR [esi+28], ebx
  0010e	8b 40 08	 mov	 eax, DWORD PTR [eax+8]
  00111	83 f8 14	 cmp	 eax, 20			; 00000014H
  00114	74 0a		 je	 SHORT $L14897
  00116	83 f8 13	 cmp	 eax, 19			; 00000013H
  00119	74 05		 je	 SHORT $L14897

; 203  : 
; 204  :         Status = STATUS_SUCCESS;
; 205  : 
; 206  :     } else {
; 207  : 
; 208  :         Status = STATUS_INVALID_PARAMETER;

  0011b	bb 0d 00 00 c0	 mov	 ebx, -1073741811	; c000000dH
$L14897:

; 209  : 
; 210  :     }
; 211  : 
; 212  :     Irp->IoStatus.Status = Status;

  00120	89 5e 18	 mov	 DWORD PTR [esi+24], ebx

; 213  : 
; 214  :     SerialDump(
; 215  :         SERIRPPATH,
; 216  :         ("SERIAL: Complete Irp: %x\n",Irp)
; 217  :         );

  00123	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  0012a	74 0d		 je	 SHORT $L14900
  0012c	56		 push	 esi
  0012d	68 00 00 00 00	 push	 OFFSET FLAT:$SG14905
  00132	e8 00 00 00 00	 call	 _DbgPrint
  00137	59		 pop	 ecx
  00138	59		 pop	 ecx
$L14900:

; 218  :     SerialCompleteRequest((PSERIAL_DEVICE_EXTENSION)DeviceObject->
; 219  :                           DeviceExtension, Irp, 0);

  00139	8b ce		 mov	 ecx, esi
  0013b	32 d2		 xor	 dl, dl
  0013d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00143	ff 77 28	 push	 DWORD PTR [edi+40]
  00146	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 220  : 
; 221  :     return Status;

  0014b	8b c3		 mov	 eax, ebx
$L14866:
  0014d	5f		 pop	 edi
  0014e	5e		 pop	 esi
  0014f	5b		 pop	 ebx

; 222  : 
; 223  : }

  00150	5d		 pop	 ebp
  00151	c2 08 00	 ret	 8
_SerialSetInformationFile@8 ENDP
PAGESRP0	ENDS
END

⌨️ 快捷键说明

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