📄 ioctl.cod
字号:
; 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
; Function compile flags: /Ogsy
; File f:\w2ddk\src\kernel\serial\ioctl.c
; COMDAT _SerialGetStats@4
PAGESER SEGMENT
_Context$ = 8
_SerialGetStats@4 PROC NEAR ; COMDAT
; 94 :
; 95 : PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation((PIRP)Context);
; 96 : PSERIAL_DEVICE_EXTENSION extension = irpSp->DeviceObject->DeviceExtension;
; 97 : PSERIALPERF_STATS sp = ((PIRP)Context)->AssociatedIrp.SystemBuffer;
; 98 :
; 99 : SERIAL_LOCKED_PAGED_CODE();
; 100 :
; 101 : *sp = extension->PerfStats;
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 56 push esi
00005 57 push edi
00006 6a 06 push 6
00008 8b 48 60 mov ecx, DWORD PTR [eax+96]
0000b 8b 78 0c mov edi, DWORD PTR [eax+12]
; 102 : return FALSE;
0000e 32 c0 xor al, al
00010 8b 49 14 mov ecx, DWORD PTR [ecx+20]
00013 8b 71 28 mov esi, DWORD PTR [ecx+40]
00016 59 pop ecx
00017 81 c6 84 01 00
00 add esi, 388 ; 00000184H
0001d f3 a5 rep movsd
0001f 5f pop edi
00020 5e pop esi
; 103 :
; 104 : }
00021 c2 04 00 ret 4
_SerialGetStats@4 ENDP
PAGESER ENDS
PUBLIC _SerialClearStats@4
; Function compile flags: /Ogsy
; COMDAT _SerialClearStats@4
PAGESER SEGMENT
_Context$ = 8
_SerialClearStats@4 PROC NEAR ; COMDAT
; 130 : SERIAL_LOCKED_PAGED_CODE();
; 131 :
; 132 : RtlZeroMemory(
; 133 : &((PSERIAL_DEVICE_EXTENSION)Context)->PerfStats,
; 134 : sizeof(SERIALPERF_STATS)
; 135 : );
00000 8b 54 24 04 mov edx, DWORD PTR _Context$[esp-4]
00004 57 push edi
00005 6a 06 push 6
00007 33 c0 xor eax, eax
00009 59 pop ecx
0000a 8d ba 84 01 00
00 lea edi, DWORD PTR [edx+388]
00010 f3 ab rep stosd
; 136 :
; 137 : RtlZeroMemory(&((PSERIAL_DEVICE_EXTENSION)Context)->WmiPerfData,
; 138 : sizeof(SERIAL_WMI_PERF_DATA));
00012 6a 06 push 6
00014 8d ba 18 06 00
00 lea edi, DWORD PTR [edx+1560]
0001a 59 pop ecx
0001b f3 ab rep stosd
; 139 : return FALSE;
0001d 32 c0 xor al, al
0001f 5f pop edi
; 140 :
; 141 : }
00020 c2 04 00 ret 4
_SerialClearStats@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetChars@4
; Function compile flags: /Ogsy
; COMDAT _SerialSetChars@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetChars@4 PROC NEAR ; COMDAT
; 169 :
; 170 : ((PSERIAL_IOCTL_SYNC)Context)->Extension->SpecialChars =
; 171 : *((PSERIAL_CHARS)(((PSERIAL_IOCTL_SYNC)Context)->Data));
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 56 push esi
00005 57 push edi
00006 8b 38 mov edi, DWORD PTR [eax]
00008 8b 70 04 mov esi, DWORD PTR [eax+4]
0000b 81 c7 6c 01 00
00 add edi, 364 ; 0000016cH
; 172 :
; 173 : SERIAL_LOCKED_PAGED_CODE();
; 174 :
; 175 : return FALSE;
00011 32 c0 xor al, al
00013 a5 movsd
00014 66 a5 movsw
00016 5f pop edi
00017 5e pop esi
; 176 :
; 177 : }
00018 c2 04 00 ret 4
_SerialSetChars@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetBaud@4
EXTRN __imp__READ_PORT_UCHAR@4:NEAR
EXTRN __imp__WRITE_PORT_UCHAR@8:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialSetBaud@4
PAGESER SEGMENT
_Context$ = 8
_LineControl$14813 = -4
_SerialSetBaud@4 PROC NEAR ; COMDAT
; 202 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 203 :
; 204 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
; 205 : USHORT Appropriate = PtrToUshort(((PSERIAL_IOCTL_SYNC)Context)->Data);
; 206 :
; 207 : SERIAL_LOCKED_PAGED_CODE();
; 208 :
; 209 :
; 210 : WRITE_DIVISOR_LATCH(
; 211 : Extension->Controller,
; 212 : Appropriate
; 213 : );
00004 8b 45 08 mov eax, DWORD PTR _Context$[ebp]
00007 53 push ebx
00008 56 push esi
00009 57 push edi
0000a 8b 08 mov ecx, DWORD PTR [eax]
0000c 66 8b 78 04 mov di, WORD PTR [eax+4]
00010 8b 99 98 00 00
00 mov ebx, DWORD PTR [ecx+152]
00016 8d 43 03 lea eax, DWORD PTR [ebx+3]
00019 50 push eax
0001a 89 45 08 mov DWORD PTR 8+[ebp], eax
0001d ff 15 00 00 00
00 call DWORD PTR __imp__READ_PORT_UCHAR@4
00023 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
00029 88 45 fc mov BYTE PTR _LineControl$14813[ebp], al
0002c 0c 80 or al, 128 ; 00000080H
0002e 50 push eax
0002f ff 75 08 push DWORD PTR 8+[ebp]
00032 ff d6 call esi
00034 57 push edi
00035 53 push ebx
00036 ff d6 call esi
00038 c1 ff 08 sar edi, 8
0003b 43 inc ebx
0003c 57 push edi
0003d 53 push ebx
0003e ff d6 call esi
00040 ff 75 fc push DWORD PTR _LineControl$14813[ebp]
00043 ff 75 08 push DWORD PTR 8+[ebp]
00046 ff d6 call esi
00048 5f pop edi
00049 5e pop esi
; 214 :
; 215 : return FALSE;
0004a 32 c0 xor al, al
0004c 5b pop ebx
; 216 :
; 217 : }
0004d c9 leave
0004e c2 04 00 ret 4
_SerialSetBaud@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetLineControl@4
; Function compile flags: /Ogsy
; COMDAT _SerialSetLineControl@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetLineControl@4 PROC NEAR ; COMDAT
; 241 :
; 242 : PSERIAL_DEVICE_EXTENSION Extension = Context;
; 243 :
; 244 : SERIAL_LOCKED_PAGED_CODE();
; 245 :
; 246 : WRITE_LINE_CONTROL(
; 247 : Extension->Controller,
; 248 : Extension->LineControl
; 249 : );
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 8a 88 9c 01 00
00 mov cl, BYTE PTR [eax+412]
0000a 8b 80 98 00 00
00 mov eax, DWORD PTR [eax+152]
00010 83 c0 03 add eax, 3
00013 51 push ecx
00014 50 push eax
00015 ff 15 00 00 00
00 call DWORD PTR __imp__WRITE_PORT_UCHAR@8
; 250 :
; 251 : return FALSE;
0001b 32 c0 xor al, al
; 252 :
; 253 : }
0001d c2 04 00 ret 4
_SerialSetLineControl@4 ENDP
PAGESER ENDS
PUBLIC _SerialGetModemUpdate@4
EXTRN _SerialHandleModemUpdate@8:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialGetModemUpdate@4
PAGESER SEGMENT
_Context$ = 8
_SerialGetModemUpdate@4 PROC NEAR ; COMDAT
; 279 :
; 280 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 56 push esi
; 281 : ULONG *Result = (ULONG *)(((PSERIAL_IOCTL_SYNC)Context)->Data);
; 282 :
; 283 : SERIAL_LOCKED_PAGED_CODE();
; 284 :
; 285 :
; 286 : *Result = SerialHandleModemUpdate(
; 287 : Extension,
; 288 : FALSE
; 289 : );
00005 6a 00 push 0
00007 8b 08 mov ecx, DWORD PTR [eax]
00009 8b 70 04 mov esi, DWORD PTR [eax+4]
0000c 51 push ecx
0000d e8 00 00 00 00 call _SerialHandleModemUpdate@8
00012 89 06 mov DWORD PTR [esi], eax
; 290 :
; 291 : return FALSE;
00014 32 c0 xor al, al
00016 5e pop esi
; 292 :
; 293 : }
00017 c2 04 00 ret 4
_SerialGetModemUpdate@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetMCRContents@4
; Function compile flags: /Ogsy
; COMDAT _SerialSetMCRContents@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetMCRContents@4 PROC NEAR ; COMDAT
; 315 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
; 316 : ULONG *Result = (ULONG *)(((PSERIAL_IOCTL_SYNC)Context)->Data);
; 317 :
; 318 : SERIAL_LOCKED_PAGED_CODE();
; 319 :
; 320 : //
; 321 : // This is severe casting abuse!!!
; 322 : //
; 323 :
; 324 : WRITE_MODEM_CONTROL(Extension->Controller, (UCHAR)PtrToUlong(Result));
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 8a 48 04 mov cl, BYTE PTR [eax+4]
00007 8b 00 mov eax, DWORD PTR [eax]
00009 51 push ecx
0000a 8b 80 98 00 00
00 mov eax, DWORD PTR [eax+152]
00010 83 c0 04 add eax, 4
00013 50 push eax
00014 ff 15 00 00 00
00 call DWORD PTR __imp__WRITE_PORT_UCHAR@8
; 325 : return FALSE;
0001a 32 c0 xor al, al
; 326 : }
0001c c2 04 00 ret 4
_SerialSetMCRContents@4 ENDP
PAGESER ENDS
PUBLIC _SerialGetMCRContents@4
; Function compile flags: /Ogsy
; COMDAT _SerialGetMCRContents@4
PAGESER SEGMENT
_Context$ = 8
_SerialGetMCRContents@4 PROC NEAR ; COMDAT
; 351 :
; 352 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 56 push esi
00005 8b 08 mov ecx, DWORD PTR [eax]
; 353 : ULONG *Result = (ULONG *)(((PSERIAL_IOCTL_SYNC)Context)->Data);
00007 8b 70 04 mov esi, DWORD PTR [eax+4]
; 354 :
; 355 : SERIAL_LOCKED_PAGED_CODE();
; 356 :
; 357 : *Result = READ_MODEM_CONTROL(Extension->Controller);
0000a 8b 81 98 00 00
00 mov eax, DWORD PTR [ecx+152]
00010 83 c0 04 add eax, 4
00013 50 push eax
00014 ff 15 00 00 00
00 call DWORD PTR __imp__READ_PORT_UCHAR@4
0001a 0f b6 c0 movzx eax, al
0001d 89 06 mov DWORD PTR [esi], eax
; 358 : return FALSE;
0001f 32 c0 xor al, al
00021 5e pop esi
; 359 :
; 360 : }
00022 c2 04 00 ret 4
_SerialGetMCRContents@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetFCRContents@4
; Function compile flags: /Ogsy
; COMDAT _SerialSetFCRContents@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetFCRContents@4 PROC NEAR ; COMDAT
; 383 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
; 384 : ULONG *Result = (ULONG *)(((PSERIAL_IOCTL_SYNC)Context)->Data);
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 8b 48 04 mov ecx, DWORD PTR [eax+4]
; 385 :
; 386 : SERIAL_LOCKED_PAGED_CODE();
; 387 :
; 388 : //
; 389 : // This is severe casting abuse!!!
; 390 : //
; 391 :
; 392 : WRITE_FIFO_CONTROL(Extension->Controller, (UCHAR)*Result);
00007 8b 00 mov eax, DWORD PTR [eax]
00009 8b 80 98 00 00
00 mov eax, DWORD PTR [eax+152]
0000f 8a 09 mov cl, BYTE PTR [ecx]
00011 40 inc eax
00012 51 push ecx
00013 40 inc eax
00014 50 push eax
00015 ff 15 00 00 00
00 call DWORD PTR __imp__WRITE_PORT_UCHAR@8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -