📄 openclos.cod
字号:
; 927 : //
; 928 : // Prepare for the opening by re-enabling interrupts.
; 929 : //
; 930 : // We do this my modifying the OUT2 line in the modem control.
; 931 : // In PC's this bit is "anded" with the interrupt line.
; 932 : //
; 933 : // For the Jensen, we will ALWAYS leave the line high. That's
; 934 : // the way the hardware engineers want it.
; 935 : //
; 936 :
; 937 : WRITE_MODEM_CONTROL(
; 938 : extension->Controller,
; 939 : (UCHAR)(READ_MODEM_CONTROL(extension->Controller) | SERIAL_MCR_OUT2)
; 940 : );
0000c 8d be 98 00 00
00 lea edi, DWORD PTR [esi+152]
00012 8b 07 mov eax, DWORD PTR [edi]
00014 83 c0 04 add eax, 4
00017 50 push eax
00018 ff 15 00 00 00
00 call DWORD PTR __imp__READ_PORT_UCHAR@4
0001e 0c 08 or al, 8
00020 50 push eax
00021 8b 07 mov eax, DWORD PTR [edi]
00023 83 c0 04 add eax, 4
00026 50 push eax
00027 ff 15 00 00 00
00 call DWORD PTR __imp__WRITE_PORT_UCHAR@8
; 941 :
; 942 : extension->DeviceIsOpened = TRUE;
; 943 : extension->ErrorWord = 0;
0002d 83 a6 24 01 00
00 00 and DWORD PTR [esi+292], 0
00034 c6 86 9d 01 00
00 01 mov BYTE PTR [esi+413], 1
0003b 5f pop edi
; 944 :
; 945 : return FALSE;
0003c 32 c0 xor al, al
0003e 5e pop esi
; 946 :
; 947 : }
0003f c2 04 00 ret 4
_SerialMarkOpen@4 ENDP
PAGESER ENDS
PUBLIC _SerialDisableUART@4
; Function compile flags: /Ogsy
; COMDAT _SerialDisableUART@4
_TEXT SEGMENT
_Context$ = 8
_SerialDisableUART@4 PROC NEAR ; COMDAT
; 970 : {
00000 53 push ebx
; 971 : PSERIAL_DEVICE_EXTENSION extension = Context;
; 972 :
; 973 : //
; 974 : // Prepare for the closing by stopping interrupts.
; 975 : //
; 976 : // We do this by adjusting the OUT2 line in the modem control.
; 977 : // In PC's this bit is "anded" with the interrupt line.
; 978 : //
; 979 : // The line should stay high on the Jensen because that's the
; 980 : // way the hardware engineers did it.
; 981 : //
; 982 :
; 983 : if (!extension->Jensen) {
00001 8b 1d 00 00 00
00 mov ebx, DWORD PTR __imp__WRITE_PORT_UCHAR@8
00007 57 push edi
00008 8b 7c 24 0c mov edi, DWORD PTR _Context$[esp+4]
0000c 80 bf de 01 00
00 00 cmp BYTE PTR [edi+478], 0
00013 75 1f jne SHORT $L14985
00015 56 push esi
; 984 : WRITE_MODEM_CONTROL(extension->Controller,
; 985 : (UCHAR)(READ_MODEM_CONTROL(extension->Controller)
; 986 : & ~SERIAL_MCR_OUT2));
00016 8d b7 98 00 00
00 lea esi, DWORD PTR [edi+152]
0001c 8b 06 mov eax, DWORD PTR [esi]
0001e 83 c0 04 add eax, 4
00021 50 push eax
00022 ff 15 00 00 00
00 call DWORD PTR __imp__READ_PORT_UCHAR@4
00028 24 f7 and al, 247 ; 000000f7H
0002a 50 push eax
0002b 8b 06 mov eax, DWORD PTR [esi]
0002d 83 c0 04 add eax, 4
00030 50 push eax
00031 ff d3 call ebx
00033 5e pop esi
$L14985:
; 987 : }
; 988 :
; 989 : if (extension->FifoPresent) {
00034 80 bf dd 01 00
00 00 cmp BYTE PTR [edi+477], 0
0003b 74 0d je SHORT $L14992
; 990 : WRITE_FIFO_CONTROL(extension->Controller, (UCHAR)0);
0003d 8b 87 98 00 00
00 mov eax, DWORD PTR [edi+152]
00043 6a 00 push 0
00045 40 inc eax
00046 40 inc eax
00047 50 push eax
00048 ff d3 call ebx
$L14992:
0004a 5f pop edi
0004b 5b pop ebx
; 991 : }
; 992 : }
0004c c2 04 00 ret 4
_SerialDisableUART@4 ENDP
; Function compile flags: /Ogsy
_TEXT ENDS
; COMDAT _SerialMarkClose@4
_TEXT SEGMENT
_Context$ = 8
_SerialMarkClose@4 PROC NEAR ; COMDAT
; 1018 : {
00000 56 push esi
; 1019 :
; 1020 : PSERIAL_DEVICE_EXTENSION extension = Context;
; 1021 :
; 1022 : SerialDisableUART(Context);
00001 8b 74 24 08 mov esi, DWORD PTR _Context$[esp]
00005 56 push esi
00006 e8 00 00 00 00 call _SerialDisableUART@4
; 1023 : extension->DeviceIsOpened = FALSE;
0000b 80 a6 9d 01 00
00 00 and BYTE PTR [esi+413], 0
; 1024 :
; 1025 : return FALSE;
00012 32 c0 xor al, al
00014 5e pop esi
; 1026 :
; 1027 : }
00015 c2 04 00 ret 4
_SerialMarkClose@4 ENDP
_TEXT ENDS
PUBLIC _SerialCleanup@8
EXTRN _SerialKillPendingIrps@4:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialCleanup@8
PAGESER SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCleanup@8 PROC NEAR ; COMDAT
; 1054 : {
00000 53 push ebx
00001 56 push esi
; 1055 :
; 1056 : PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;
; 1057 : NTSTATUS status;
; 1058 :
; 1059 :
; 1060 : PAGED_CODE();
; 1061 :
; 1062 : //
; 1063 : // We succeed a cleanup on a removing device
; 1064 : //
; 1065 :
; 1066 : if ((status = SerialIRPPrologue(Irp, extension)) != STATUS_SUCCESS) {
00002 8b 74 24 10 mov esi, DWORD PTR _Irp$[esp+4]
00006 57 push edi
00007 8b 7c 24 10 mov edi, DWORD PTR _DeviceObject$[esp+8]
0000b 8b 5f 28 mov ebx, DWORD PTR [edi+40]
0000e 53 push ebx
0000f 56 push esi
00010 e8 00 00 00 00 call _SerialIRPPrologue@8
00015 85 c0 test eax, eax
00017 74 11 je SHORT $L15011
; 1067 : if (status == STATUS_DELETE_PENDING) {
00019 3d 56 00 00 c0 cmp eax, -1073741738 ; c0000056H
0001e 75 06 jne SHORT $L15009
; 1068 : status = Irp->IoStatus.Status = STATUS_SUCCESS;
00020 83 66 18 00 and DWORD PTR [esi+24], 0
00024 33 c0 xor eax, eax
$L15009:
00026 8b f8 mov edi, eax
00028 eb 0e jmp SHORT $L15155
$L15011:
; 1069 : }
; 1070 : SerialCompleteRequest(extension, Irp, IO_NO_INCREMENT);
; 1071 : return status;
; 1072 : }
; 1073 :
; 1074 : SerialDump(
; 1075 : SERIRPPATH,
; 1076 : ("SERIAL: Dispatch entry for: %x\n",Irp)
; 1077 : );
; 1078 :
; 1079 : SerialKillPendingIrps(DeviceObject);
0002a 57 push edi
0002b e8 00 00 00 00 call _SerialKillPendingIrps@4
; 1080 :
; 1081 : Irp->IoStatus.Status = STATUS_SUCCESS;
00030 33 ff xor edi, edi
00032 89 7e 18 mov DWORD PTR [esi+24], edi
; 1082 : Irp->IoStatus.Information=0L;
00035 89 7e 1c mov DWORD PTR [esi+28], edi
$L15155:
; 1083 :
; 1084 : SerialDump(
; 1085 : SERIRPPATH,
; 1086 : ("SERIAL: Complete Irp: %x\n",Irp)
; 1087 : );
; 1088 : SerialCompleteRequest(extension, Irp, IO_NO_INCREMENT);
00038 32 d2 xor dl, dl
0003a 8b ce mov ecx, esi
0003c ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
00042 53 push ebx
00043 e8 00 00 00 00 call _SerialIRPEpilogue@4
; 1089 :
; 1090 : return STATUS_SUCCESS;
00048 8b c7 mov eax, edi
0004a 5f pop edi
0004b 5e pop esi
0004c 5b pop ebx
; 1091 :
; 1092 : }
0004d c2 08 00 ret 8
_SerialCleanup@8 ENDP
; Function compile flags: /Ogsy
PAGESER ENDS
; COMDAT _SerialGetCharTime@4
PAGESER SEGMENT
_Extension$ = 8
_dataSize$ = 8
_SerialGetCharTime@4 PROC NEAR ; COMDAT
; 1117 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
; 1118 :
; 1119 : ULONG dataSize;
; 1120 : ULONG paritySize;
; 1121 : ULONG stopSize;
; 1122 : ULONG charTime;
; 1123 : ULONG bitTime;
; 1124 : LARGE_INTEGER tmp;
; 1125 :
; 1126 :
; 1127 : if ((Extension->LineControl & SERIAL_DATA_MASK) == SERIAL_5_DATA) {
00003 8b 45 08 mov eax, DWORD PTR _Extension$[ebp]
00006 53 push ebx
00007 56 push esi
00008 57 push edi
00009 8a 88 9c 01 00
00 mov cl, BYTE PTR [eax+412]
0000f 8a d1 mov dl, cl
00011 80 e2 03 and dl, 3
00014 75 04 jne SHORT $L15030
; 1128 : dataSize = 5;
00016 6a 05 push 5
; 1129 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
00018 eb 19 jmp SHORT $L15160
$L15030:
; 1130 : == SERIAL_6_DATA) {
0001a 80 fa 01 cmp dl, 1
0001d 75 04 jne SHORT $L15034
; 1131 : dataSize = 6;
0001f 6a 06 push 6
; 1132 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
00021 eb 10 jmp SHORT $L15160
$L15034:
; 1133 : == SERIAL_7_DATA) {
00023 80 fa 02 cmp dl, 2
00026 75 04 jne SHORT $L15038
; 1134 : dataSize = 7;
00028 6a 07 push 7
; 1135 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
0002a eb 07 jmp SHORT $L15160
$L15038:
; 1136 : == SERIAL_8_DATA) {
0002c 80 fa 03 cmp dl, 3
0002f 75 05 jne SHORT $L15159
; 1137 : dataSize = 8;
00031 6a 08 push 8
$L15160:
00033 5b pop ebx
00034 eb 03 jmp SHORT $L15042
$L15159:
00036 8b 5d 08 mov ebx, DWORD PTR _dataSize$[ebp]
$L15042:
; 1138 : }
; 1139 :
; 1140 : paritySize = 1;
00039 33 ff xor edi, edi
0003b 47 inc edi
; 1141 : if ((Extension->LineControl & SERIAL_PARITY_MASK)
; 1142 : == SERIAL_NONE_PARITY) {
0003c f6 c1 38 test cl, 56 ; 00000038H
0003f 75 02 jne SHORT $L15045
; 1143 :
; 1144 : paritySize = 0;
00041 33 ff xor edi, edi
$L15045:
; 1145 :
; 1146 : }
; 1147 :
; 1148 : if (Extension->LineControl & SERIAL_2_STOP) {
00043 6a 00 push 0
00045 f6 c1 04 test cl, 4
00048 59 pop ecx
00049 0f 95 c1 setne cl
0004c 41 inc ecx
; 1149 :
; 1150 : //
; 1151 : // Even if it is 1.5, for sanities sake were going
; 1152 : // to say 2.
; 1153 : //
; 1154 :
; 1155 : stopSize = 2;
; 1156 :
; 1157 : } else {
; 1158 :
; 1159 : stopSize = 1;
; 1160 :
; 1161 : }
; 1162 :
; 1163 : //
; 1164 : // First we calculate the number of 100 nanosecond intervals
; 1165 : // are in a single bit time (Approximately).
; 1166 : //
; 1167 :
; 1168 : bitTime = (10000000+(Extension->CurrentBaud-1))/Extension->CurrentBaud;
0004d 33 d2 xor edx, edx
0004f 8b f1 mov esi, ecx
00051 8b 88 34 01 00
00 mov ecx, DWORD PTR [eax+308]
; 1169 : charTime = bitTime + ((dataSize+paritySize+stopSize)*bitTime);
; 1170 :
; 1171 : tmp.QuadPart = charTime;
; 1172 : return tmp;
00057 03 f7 add esi, edi
00059 5f pop edi
0005a 8d 81 7f 96 98
00 lea eax, DWORD PTR [ecx+9999999]
00060 f7 f1 div ecx
00062 8d 4c 1e 01 lea ecx, DWORD PTR [esi+ebx+1]
00066 5e pop esi
00067 5b pop ebx
00068 0f af c1 imul eax, ecx
0006b 33 d2 xor edx, edx
; 1173 :
; 1174 : }
0006d 5d pop ebp
0006e c2 04 00 ret 4
_SerialGetCharTime@4 ENDP
PAGESER ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -