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

📄 ioctl.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 831  :                 );
; 832  : 
; 833  :             break;

  00430	e9 29 08 00 00	 jmp	 $L15790
$L15098:

; 834  :         }
; 835  :         case IOCTL_SERIAL_SET_FIFO_CONTROL: {
; 836  :            SERIAL_IOCTL_SYNC S;
; 837  : 
; 838  :             if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
; 839  :                 sizeof(ULONG)) {

  00435	83 7e 08 04	 cmp	 DWORD PTR [esi+8], 4

; 840  : 
; 841  :                 Status = STATUS_BUFFER_TOO_SMALL;
; 842  :                 break;

  00439	0f 82 9d fe ff
	ff		 jb	 $L15793

; 843  : 
; 844  :             }
; 845  : 
; 846  :             S.Extension = Extension;

  0043f	89 5d ac	 mov	 DWORD PTR _S$15099[ebp], ebx

; 847  :             S.Data = Irp->AssociatedIrp.SystemBuffer;

  00442	8b 47 0c	 mov	 eax, DWORD PTR [edi+12]
  00445	89 45 b0	 mov	 DWORD PTR _S$15099[ebp+4], eax

; 848  : 
; 849  :             //
; 850  :             // Make sure we are at power D0
; 851  :             //
; 852  : 
; 853  :             if (Extension->PowerState != PowerDeviceD0) {

  00448	83 bb a4 04 00
	00 01		 cmp	 DWORD PTR [ebx+1188], 1
  0044f	74 19		 je	 SHORT $L15105

; 854  :                Status = SerialGotoPowerState(Extension->Pdo, Extension,
; 855  :                                              PowerDeviceD0);

  00451	6a 01		 push	 1
  00453	53		 push	 ebx
  00454	ff b3 80 05 00
	00		 push	 DWORD PTR [ebx+1408]
  0045a	e8 00 00 00 00	 call	 _SerialGotoPowerState@12
  0045f	89 45 dc	 mov	 DWORD PTR _Status$[ebp], eax

; 856  :                if (!NT_SUCCESS(Status)) {

  00462	85 c0		 test	 eax, eax
  00464	0f 8c bf 05 00
	00		 jl	 $DoneWithIoctl$15133
$L15105:

; 857  :                   break;
; 858  :                }
; 859  :             }
; 860  : 
; 861  :             KeAcquireSpinLock(
; 862  :                 &Extension->ControlLock,
; 863  :                 &OldIrql
; 864  :                 );

  0046a	8d 8b e4 01 00
	00		 lea	 ecx, DWORD PTR [ebx+484]
  00470	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KfAcquireSpinLock@4
  00476	88 45 d2	 mov	 BYTE PTR _OldIrql$[ebp], al

; 865  : 
; 866  :             KeSynchronizeExecution(
; 867  :                 Extension->Interrupt,
; 868  :                 SerialSetFCRContents,
; 869  :                 &S
; 870  :                 );

  00479	8d 45 ac	 lea	 eax, DWORD PTR _S$15099[ebp]
  0047c	50		 push	 eax
  0047d	68 00 00 00 00	 push	 OFFSET FLAT:_SerialSetFCRContents@4

; 871  : 
; 872  :             KeReleaseSpinLock(
; 873  :                 &Extension->ControlLock,
; 874  :                 OldIrql
; 875  :                 );
; 876  : 
; 877  :             break;

  00482	e9 d7 07 00 00	 jmp	 $L15790
$L15106:

; 878  :         }
; 879  :         case IOCTL_SERIAL_SET_LINE_CONTROL: {
; 880  : 
; 881  :             //
; 882  :             // Points to the line control record in the Irp.
; 883  :             //
; 884  :             PSERIAL_LINE_CONTROL Lc =
; 885  :                 ((PSERIAL_LINE_CONTROL)(Irp->AssociatedIrp.SystemBuffer));

  00487	8b 4f 0c	 mov	 ecx, DWORD PTR [edi+12]
  0048a	89 4d a8	 mov	 DWORD PTR _Lc$15107[ebp], ecx

; 886  : 
; 887  :             UCHAR LData;
; 888  :             UCHAR LStop;
; 889  :             UCHAR LParity;
; 890  :             UCHAR Mask = 0xff;

  0048d	80 4d a7 ff	 or	 BYTE PTR _Mask$15112[ebp], 255 ; 000000ffH

; 891  : 
; 892  :             if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
; 893  :                 sizeof(SERIAL_LINE_CONTROL)) {

  00491	83 7e 08 03	 cmp	 DWORD PTR [esi+8], 3

; 894  : 
; 895  :                 Status = STATUS_BUFFER_TOO_SMALL;
; 896  :                 break;

  00495	0f 82 41 fe ff
	ff		 jb	 $L15793

; 897  : 
; 898  :             }
; 899  : 
; 900  :             //
; 901  :             // Make sure we are at power D0
; 902  :             //
; 903  : 
; 904  :             if (Extension->PowerState != PowerDeviceD0) {

  0049b	33 d2		 xor	 edx, edx
  0049d	42		 inc	 edx
  0049e	39 93 a4 04 00
	00		 cmp	 DWORD PTR [ebx+1188], edx
  004a4	74 1e		 je	 SHORT $L15118

; 905  :                Status = SerialGotoPowerState(Extension->Pdo, Extension,
; 906  :                                              PowerDeviceD0);

  004a6	52		 push	 edx
  004a7	53		 push	 ebx
  004a8	ff b3 80 05 00
	00		 push	 DWORD PTR [ebx+1408]
  004ae	e8 00 00 00 00	 call	 _SerialGotoPowerState@12
  004b3	89 45 dc	 mov	 DWORD PTR _Status$[ebp], eax

; 907  :                if (!NT_SUCCESS(Status)) {

  004b6	85 c0		 test	 eax, eax
  004b8	0f 8c 6b 05 00
	00		 jl	 $DoneWithIoctl$15133
  004be	33 d2		 xor	 edx, edx
  004c0	42		 inc	 edx
  004c1	8b 4d a8	 mov	 ecx, DWORD PTR _Lc$15107[ebp]
$L15118:

; 908  :                   break;
; 909  :                }
; 910  :             }
; 911  : 
; 912  :             switch (Lc->WordLength) {

  004c4	0f b6 71 02	 movzx	 esi, BYTE PTR [ecx+2]
  004c8	8b c6		 mov	 eax, esi
  004ca	83 e8 05	 sub	 eax, 5
  004cd	74 27		 je	 SHORT $L15123
  004cf	48		 dec	 eax
  004d0	74 1a		 je	 SHORT $L15125
  004d2	48		 dec	 eax
  004d3	74 0d		 je	 SHORT $L15127
  004d5	48		 dec	 eax

; 938  : 
; 939  :                 }
; 940  :                 default: {
; 941  : 
; 942  :                     Status = STATUS_INVALID_PARAMETER;
; 943  :                     goto DoneWithIoctl;

  004d6	0f 85 46 05 00
	00		 jne	 $L15519

; 932  : 
; 933  :                 }
; 934  :                 case 8: {
; 935  : 
; 936  :                     LData = SERIAL_8_DATA;

  004dc	c6 45 a6 03	 mov	 BYTE PTR _LData$15109[ebp], 3

; 937  :                     break;

  004e0	eb 1c		 jmp	 SHORT $L15120
$L15127:

; 925  : 
; 926  :                 }
; 927  :                 case 7: {
; 928  : 
; 929  :                     LData = SERIAL_7_DATA;

  004e2	c6 45 a6 02	 mov	 BYTE PTR _LData$15109[ebp], 2

; 930  :                     Mask = 0x7f;

  004e6	c6 45 a7 7f	 mov	 BYTE PTR _Mask$15112[ebp], 127 ; 0000007fH

; 931  :                     break;

  004ea	eb 12		 jmp	 SHORT $L15120
$L15125:

; 917  :                     break;
; 918  : 
; 919  :                 }
; 920  :                 case 6: {
; 921  : 
; 922  :                     LData = SERIAL_6_DATA;

  004ec	c6 45 a6 01	 mov	 BYTE PTR _LData$15109[ebp], 1

; 923  :                     Mask = 0x3f;

  004f0	c6 45 a7 3f	 mov	 BYTE PTR _Mask$15112[ebp], 63 ; 0000003fH

; 924  :                     break;

  004f4	eb 08		 jmp	 SHORT $L15120
$L15123:

; 913  :                 case 5: {
; 914  : 
; 915  :                     LData = SERIAL_5_DATA;

  004f6	80 65 a6 00	 and	 BYTE PTR _LData$15109[ebp], 0

; 916  :                     Mask = 0x1f;

  004fa	c6 45 a7 1f	 mov	 BYTE PTR _Mask$15112[ebp], 31 ; 0000001fH
$L15120:

; 944  : 
; 945  :                 }
; 946  : 
; 947  :             }
; 948  : 
; 949  :             Extension->WmiCommData.BitsPerByte = Lc->WordLength;

  004fe	89 b3 b8 05 00
	00		 mov	 DWORD PTR [ebx+1464], esi

; 950  : 
; 951  :             switch (Lc->Parity) {

  00504	0f b6 41 01	 movzx	 eax, BYTE PTR [ecx+1]
  00508	83 e8 00	 sub	 eax, 0
  0050b	74 4c		 je	 SHORT $L15138
  0050d	48		 dec	 eax
  0050e	74 3d		 je	 SHORT $L15142
  00510	48		 dec	 eax
  00511	74 2a		 je	 SHORT $L15140
  00513	48		 dec	 eax
  00514	74 17		 je	 SHORT $L15146
  00516	48		 dec	 eax

; 981  : 
; 982  :                 }
; 983  :                 default: {
; 984  : 
; 985  :                     Status = STATUS_INVALID_PARAMETER;
; 986  :                     goto DoneWithIoctl;

  00517	0f 85 05 05 00
	00		 jne	 $L15519

; 969  : 
; 970  :                 }
; 971  :                 case SPACE_PARITY: {
; 972  :                     Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_SPACE;

  0051d	c7 83 bc 05 00
	00 03 00 00 00	 mov	 DWORD PTR [ebx+1468], 3

; 973  :                     LParity = SERIAL_SPACE_PARITY;

  00527	c6 45 a5 38	 mov	 BYTE PTR _LParity$15111[ebp], 56 ; 00000038H

; 974  :                     break;

  0052b	eb 37		 jmp	 SHORT $L15135
$L15146:

; 975  : 
; 976  :                 }
; 977  :                 case MARK_PARITY: {
; 978  :                     Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_MARK;

  0052d	c7 83 bc 05 00
	00 04 00 00 00	 mov	 DWORD PTR [ebx+1468], 4

; 979  :                     LParity = SERIAL_MARK_PARITY;

  00537	c6 45 a5 28	 mov	 BYTE PTR _LParity$15111[ebp], 40 ; 00000028H

; 980  :                     break;

  0053b	eb 27		 jmp	 SHORT $L15135
$L15140:

; 956  :                     break;
; 957  : 
; 958  :                 }
; 959  :                 case EVEN_PARITY: {
; 960  :                     Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_EVEN;

  0053d	c7 83 bc 05 00
	00 02 00 00 00	 mov	 DWORD PTR [ebx+1468], 2

; 961  :                     LParity = SERIAL_EVEN_PARITY;

  00547	c6 45 a5 18	 mov	 BYTE PTR _LParity$15111[ebp], 24 ; 00000018H

; 962  :                     break;

  0054b	eb 17		 jmp	 SHORT $L15135
$L15142:

; 963  : 
; 964  :                 }
; 965  :                 case ODD_PARITY: {
; 966  :                     Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_ODD;

  0054d	89 93 bc 05 00
	00		 mov	 DWORD PTR [ebx+1468], edx

; 967  :                     LParity = SERIAL_ODD_PARITY;

  00553	c6 45 a5 08	 mov	 BYTE PTR _LParity$15111[ebp], 8

; 968  :                     break;

  00557	eb 0b		 jmp	 SHORT $L15135
$L15138:

; 952  : 
; 953  :                 case NO_PARITY: {
; 954  :                     Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_NONE;

  00559	83 a3 bc 05 00
	00 00		 and	 DWORD PTR [ebx+1468], 0

; 955  :                     LParity = SERIAL_NONE_PARITY;

  00560	80 65 a5 00	 and	 BYTE PTR _LParity$15111[ebp], 0
$L15135:

; 987  :                     break;
; 988  :                 }
; 989  : 
; 990  :             }
; 991  : 
; 992  :             switch (Lc->StopBits) {

  00564	0f b6 01	 movzx	 eax, BYTE PTR [ecx]
  00567	83 e8 00	 sub	 eax, 0
  0056a	74 36		 je	 SHORT $L15154
  0056c	48		 dec	 eax
  0056d	74 21		 je	 SHORT $L15156
  0056f	48		 dec	 eax

; 1021 : 
; 1022 :                 }
; 1023 :                 default: {
; 1024 : 
; 1025 :                     Status = STATUS_INVALID_PARAMETER;
; 1026 :                     goto DoneWithIoctl;

  00570	0f 85 ac 04 00
	00		 jne	 $L15519

; 1009 : 
; 1010 :                 }
; 1011 :                 case STOP_BITS_2: {
; 1012 : 
; 1013 :                     if (LData == SERIAL_5_DATA) {

  00576	80 7d a6 00	 cmp	 BYTE PTR _LData$15109[ebp], 0

; 1014 : 
; 1015 :                         Status = STATUS_INVALID_PARAMETER;
; 1016 :                         goto DoneWithIoctl;

  0057a	0f 84 a2 04 00
	00		 je	 $L15519

; 1017 :                     }
; 1018 :                     Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_2;

  00580	c7 83 c4 05 00
	00 02 00 00 00	 mov	 DWORD PTR [ebx+1476], 2
$L15788:

; 1019 :                     LStop = SERIAL_2_STOP;

  0058a	c6 45 a4 04	 mov	 BYTE PTR _LStop$15110[ebp], 4

; 1020 :                     break;

  0058e	eb 1d		 jmp	 SHORT $L15151
$L15156:

; 997  :                     break;
; 998  :                 }
; 999  :                 case STOP_BITS_1_5: {
; 1000 : 
; 1001 :                     if (LData != SERIAL_5_DATA) {

  00590	80 7d a6 00	 cmp	 BYTE PTR _LData$15109[ebp], 0

; 1002 : 
; 1003 :                         Status = STATUS_INVALID_PARAMETER;
; 1004 :                         goto DoneWithIoctl;

  00594	0f 85 88 04 00
	00		 jne	 $L15519

; 1005 :                     }
; 1006 :                     Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_1_5;

  0059a	89 93 c4 05 00
	00		 mov	 DWORD PTR [ebx+1476], edx

; 1007 :                     LStop = SERIAL_1_5_STOP;
; 1008 :                     break;

  005a0	eb e8		 jmp	 SHORT $L15788
$L15154:

; 993  : 
; 994  :                 case STOP_BIT_1: {
; 995  :                     Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_1;

  005a2	83 a3 c4 05 00
	00 00		 and	 DWORD PTR [ebx+1476], 0

; 996  :                     LStop = SERIAL_1_STOP;

  005a9	80 65 a4 00	 and	 BYTE PTR _LStop$15110[ebp], 0
$L15151:

; 1027 :                 }
; 1028 : 
; 1029 :             }
; 1030 : 
; 1031 :             KeAcquireSpinLock(
; 1032 :                 &Ext

⌨️ 快捷键说明

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