📄 utilrtns.cod
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 13.00.9178
TITLE .\utilrtns.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
; COMDAT _GetPktPayload@16
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _DumpLine@16
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _DumpMem@16
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _e100DumpPkt@4
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _GetTCPChecksum@16
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _GetIPChecksum@8
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
INCLUDELIB LIBC
INCLUDELIB OLDNAMES
_DATA SEGMENT
_home3 DB 00H
DB 0c0H
DB 0a8H
DB 082H
DB 050H
DB 07bH
ORG $+2
_home2_2 DB 00H
DB 020H
DB 078H
DB 00H
DB 0e9H
DB 0cdH
ORG $+2
_home2_4 DB 00H
DB 04H
DB 05aH
DB 07dH
DB 04dH
DB 00H
ORG $+2
_home3IPAddr DD 0c0a80105H
_home2_2IPAddr DD 0c0a80102H
_home2_4IPAddr DD 0c0a80104H
_DATA ENDS
PUBLIC _GetPktPayload@16
EXTRN __imp__NdisQueryBuffer@12:NEAR
EXTRN __imp__NdisQueryBufferOffset@12:NEAR
EXTRN __imp__NDIS_BUFFER_TO_SPAN_PAGES@4:NEAR
; Function compile flags: /Odt
; File g:\pcadev\ndisim\passthruex\part2\james\james\sys\utilrtns.c
; COMDAT _GetPktPayload@16
_TEXT SEGMENT
___TotalPacketLength$16051 = -64
___BufferCount$16048 = -60
___PhysicalBufferCount$16044 = -56
_TmpBuffer$16030 = -52
_PacketLength$16034 = -48
_PAddedCount$16033 = -44
_PPhysicalCount$16032 = -40
_PTotalLength$16031 = -36
_Offset$16035 = -32
___FirstBuffer$16024 = -28
_pNdisBfr$ = -24
_ulCurrBfr$ = -16
_ulAmtToMove$ = -12
_ulTotPktLen$ = -8
_pCurrBfr$ = -4
_pPacket$ = 8
_pOutBfr$ = 12
_ulOutBfrAvail$ = 16
_pUlBytesCopied$ = 20
_GetPktPayload@16 PROC NEAR ; COMDAT
; 28 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 83 ec 40 sub esp, 64 ; 00000040H
00006 56 push esi
00007 57 push edi
; 29 : PNDIS_BUFFER pNdisBfr;
; 30 : ULONG ulBfrCnt,
; 31 : ulTotPktLen,
; 32 : ulCurrBfr,
; 33 : ulAmtToMove;
; 34 : PUCHAR pCurrBfr;
; 35 :
; 36 : *pUlBytesCopied = 0; // Set 0 bytes copied.
00008 8b 45 14 mov eax, DWORD PTR _pUlBytesCopied$[ebp]
0000b c7 00 00 00 00
00 mov DWORD PTR [eax], 0
; 37 :
; 38 : if (0==ulOutBfrAvail) // Is output buffer 0 bytes in length?
00011 83 7d 10 00 cmp DWORD PTR _ulOutBfrAvail$[ebp], 0
00015 75 05 jne SHORT $L16020
; 39 : goto Done;
00017 e9 a8 01 00 00 jmp $Done$16021
$L16020:
; 40 :
; 41 : NdisQueryPacket(pPacket, // Get information from packet descriptor.
; 42 : NULL,
; 43 : NULL,
; 44 : &pNdisBfr, // Output variable for address of first buffer descriptor.
; 45 : &ulTotPktLen // Output variable for number of bytes in packet payload.
; 46 : );
0001c 8d 4d e8 lea ecx, DWORD PTR _pNdisBfr$[ebp]
0001f 85 c9 test ecx, ecx
00021 74 11 je SHORT $L16023
00023 8d 55 e8 lea edx, DWORD PTR _pNdisBfr$[ebp]
00026 89 55 e4 mov DWORD PTR ___FirstBuffer$16024[ebp], edx
00029 8b 45 e4 mov eax, DWORD PTR ___FirstBuffer$16024[ebp]
0002c 8b 4d 08 mov ecx, DWORD PTR _pPacket$[ebp]
0002f 8b 51 08 mov edx, DWORD PTR [ecx+8]
00032 89 10 mov DWORD PTR [eax], edx
$L16023:
00034 8d 45 f8 lea eax, DWORD PTR _ulTotPktLen$[ebp]
00037 85 c0 test eax, eax
00039 75 10 jne SHORT $L16028
0003b 33 c9 xor ecx, ecx
0003d 85 c9 test ecx, ecx
0003f 75 0a jne SHORT $L16028
00041 33 d2 xor edx, edx
00043 85 d2 test edx, edx
00045 0f 84 db 00 00
00 je $L16027
$L16028:
0004b 8b 45 08 mov eax, DWORD PTR _pPacket$[ebp]
0004e 0f b6 48 1c movzx ecx, BYTE PTR [eax+28]
00052 85 c9 test ecx, ecx
00054 0f 85 85 00 00
00 jne $L16029
0005a 8b 55 08 mov edx, DWORD PTR _pPacket$[ebp]
0005d 8b 42 08 mov eax, DWORD PTR [edx+8]
00060 89 45 cc mov DWORD PTR _TmpBuffer$16030[ebp], eax
00063 c7 45 dc 00 00
00 00 mov DWORD PTR _PTotalLength$16031[ebp], 0
0006a c7 45 d8 00 00
00 00 mov DWORD PTR _PPhysicalCount$16032[ebp], 0
00071 c7 45 d4 00 00
00 00 mov DWORD PTR _PAddedCount$16033[ebp], 0
$L16039:
00078 83 7d cc 00 cmp DWORD PTR _TmpBuffer$16030[ebp], 0
0007c 74 40 je SHORT $L16040
0007e 8d 4d d0 lea ecx, DWORD PTR _PacketLength$16034[ebp]
00081 51 push ecx
00082 8d 55 e0 lea edx, DWORD PTR _Offset$16035[ebp]
00085 52 push edx
00086 8b 45 cc mov eax, DWORD PTR _TmpBuffer$16030[ebp]
00089 50 push eax
0008a ff 15 00 00 00
00 call DWORD PTR __imp__NdisQueryBufferOffset@12
00090 8b 4d dc mov ecx, DWORD PTR _PTotalLength$16031[ebp]
00093 03 4d d0 add ecx, DWORD PTR _PacketLength$16034[ebp]
00096 89 4d dc mov DWORD PTR _PTotalLength$16031[ebp], ecx
00099 8b 55 cc mov edx, DWORD PTR _TmpBuffer$16030[ebp]
0009c 52 push edx
0009d ff 15 00 00 00
00 call DWORD PTR __imp__NDIS_BUFFER_TO_SPAN_PAGES@4
000a3 8b 4d d8 mov ecx, DWORD PTR _PPhysicalCount$16032[ebp]
000a6 03 c8 add ecx, eax
000a8 89 4d d8 mov DWORD PTR _PPhysicalCount$16032[ebp], ecx
000ab 8b 55 d4 mov edx, DWORD PTR _PAddedCount$16033[ebp]
000ae 83 c2 01 add edx, 1
000b1 89 55 d4 mov DWORD PTR _PAddedCount$16033[ebp], edx
000b4 8b 45 cc mov eax, DWORD PTR _TmpBuffer$16030[ebp]
000b7 8b 08 mov ecx, DWORD PTR [eax]
000b9 89 4d cc mov DWORD PTR _TmpBuffer$16030[ebp], ecx
000bc eb ba jmp SHORT $L16039
$L16040:
000be 8b 55 08 mov edx, DWORD PTR _pPacket$[ebp]
000c1 8b 45 d4 mov eax, DWORD PTR _PAddedCount$16033[ebp]
000c4 89 42 14 mov DWORD PTR [edx+20], eax
000c7 8b 4d 08 mov ecx, DWORD PTR _pPacket$[ebp]
000ca 8b 55 dc mov edx, DWORD PTR _PTotalLength$16031[ebp]
000cd 89 51 04 mov DWORD PTR [ecx+4], edx
000d0 8b 45 08 mov eax, DWORD PTR _pPacket$[ebp]
000d3 8b 4d d8 mov ecx, DWORD PTR _PPhysicalCount$16032[ebp]
000d6 89 08 mov DWORD PTR [eax], ecx
000d8 8b 55 08 mov edx, DWORD PTR _pPacket$[ebp]
000db c6 42 1c 01 mov BYTE PTR [edx+28], 1
$L16029:
000df 33 c0 xor eax, eax
000e1 85 c0 test eax, eax
000e3 74 11 je SHORT $L16043
000e5 c7 45 c8 00 00
00 00 mov DWORD PTR ___PhysicalBufferCount$16044[ebp], 0
000ec 8b 4d c8 mov ecx, DWORD PTR ___PhysicalBufferCount$16044[ebp]
000ef 8b 55 08 mov edx, DWORD PTR _pPacket$[ebp]
000f2 8b 02 mov eax, DWORD PTR [edx]
000f4 89 01 mov DWORD PTR [ecx], eax
$L16043:
000f6 33 c9 xor ecx, ecx
000f8 85 c9 test ecx, ecx
000fa 74 12 je SHORT $L16047
000fc c7 45 c4 00 00
00 00 mov DWORD PTR ___BufferCount$16048[ebp], 0
00103 8b 55 c4 mov edx, DWORD PTR ___BufferCount$16048[ebp]
00106 8b 45 08 mov eax, DWORD PTR _pPacket$[ebp]
00109 8b 48 14 mov ecx, DWORD PTR [eax+20]
0010c 89 0a mov DWORD PTR [edx], ecx
$L16047:
0010e 8d 55 f8 lea edx, DWORD PTR _ulTotPktLen$[ebp]
00111 85 d2 test edx, edx
00113 74 11 je SHORT $L16027
00115 8d 45 f8 lea eax, DWORD PTR _ulTotPktLen$[ebp]
00118 89 45 c0 mov DWORD PTR ___TotalPacketLength$16051[ebp], eax
0011b 8b 4d c0 mov ecx, DWORD PTR ___TotalPacketLength$16051[ebp]
0011e 8b 55 08 mov edx, DWORD PTR _pPacket$[ebp]
00121 8b 42 04 mov eax, DWORD PTR [edx+4]
00124 89 01 mov DWORD PTR [ecx], eax
$L16027:
; 47 :
; 48 : NdisQueryBuffer(pNdisBfr, // Get information from first buffer descriptor.
; 49 : &pCurrBfr, // Output variable for address of described virtual area.
; 50 : &ulCurrBfr // Output variable for size of virtual area.
; 51 : );
00126 8d 4d f0 lea ecx, DWORD PTR _ulCurrBfr$[ebp]
00129 51 push ecx
0012a 8d 55 fc lea edx, DWORD PTR _pCurrBfr$[ebp]
0012d 52 push edx
0012e 8b 45 e8 mov eax, DWORD PTR _pNdisBfr$[ebp]
00131 50 push eax
00132 ff 15 00 00 00
00 call DWORD PTR __imp__NdisQueryBuffer@12
$L16053:
; 52 :
; 53 : while (ulOutBfrAvail>0) // Space remaining in output buffer?
00138 83 7d 10 00 cmp DWORD PTR _ulOutBfrAvail$[ebp], 0
0013c 0f 86 82 00 00
00 jbe $Done$16021
$L16056:
; 54 : {
; 55 : while (0==ulCurrBfr) // While the current buffer has zero length.
00142 83 7d f0 00 cmp DWORD PTR _ulCurrBfr$[ebp], 0
00146 75 24 jne SHORT $L16057
; 56 : {
; 57 : NdisGetNextBuffer(pNdisBfr, // Get next buffer descriptor.
; 58 : &pNdisBfr
; 59 : );
00148 8b 4d e8 mov ecx, DWORD PTR _pNdisBfr$[ebp]
0014b 8b 11 mov edx, DWORD PTR [ecx]
0014d 89 55 e8 mov DWORD PTR _pNdisBfr$[ebp], edx
; 60 :
; 61 : if (NULL==pNdisBfr) // None?
00150 83 7d e8 00 cmp DWORD PTR _pNdisBfr$[ebp], 0
00154 75 02 jne SHORT $L16059
; 62 : goto Done;
00156 eb 6c jmp SHORT $Done$16021
$L16059:
; 63 :
; 64 : NdisQueryBuffer(pNdisBfr, // Get information from next buffer descriptor.
; 65 : &pCurrBfr, // Output variable for address of current buffer.
; 66 : &ulCurrBfr // Output variable for size of current buffer.
; 67 : );
00158 8d 45 f0 lea eax, DWORD PTR _ulCurrBfr$[ebp]
0015b 50 push eax
0015c 8d 4d fc lea ecx, DWORD PTR _pCurrBfr$[ebp]
0015f 51 push ecx
00160 8b 55 e8 mov edx, DWORD PTR _pNdisBfr$[ebp]
00163 52 push edx
00164 ff 15 00 00 00
00 call DWORD PTR __imp__NdisQueryBuffer@12
; 68 : }
0016a eb d6 jmp SHORT $L16056
$L16057:
; 69 :
; 70 : if (ulCurrBfr>ulOutBfrAvail) // Does current buffer's usable size exceed space remaining in output buffer?
0016c 8b 45 f0 mov eax, DWORD PTR _ulCurrBfr$[ebp]
0016f 3b 45 10 cmp eax, DWORD PTR _ulOutBfrAvail$[ebp]
00172 76 08 jbe SHORT $L16060
; 71 : ulAmtToMove = ulOutBfrAvail; // Use only amount remaining in output buffer.
00174 8b 4d 10 mov ecx, DWORD PTR _ulOutBfrAvail$[ebp]
00177 89 4d f4 mov DWORD PTR _ulAmtToMove$[ebp], ecx
; 72 : else
0017a eb 06 jmp SHORT $L16061
$L16060:
; 73 : ulAmtToMove = ulCurrBfr; // Use full size of current buffer.
0017c 8b 55 f0 mov edx, DWORD PTR _ulCurrBfr$[ebp]
0017f 89 55 f4 mov DWORD PTR _ulAmtToMove$[ebp], edx
$L16061:
; 74 :
; 75 : NdisMoveMemory(pOutBfr, // Copy packet data to output buffer.
; 76 : pCurrBfr,
; 77 : ulAmtToMove
; 78 : );
00182 8b 4d f4 mov ecx, DWORD PTR _ulAmtToMove$[ebp]
00185 8b 75 fc mov esi, DWORD PTR _pCurrBfr$[ebp]
00188 8b 7d 0c mov edi, DWORD PTR _pOutBfr$[ebp]
0018b 8b c1 mov eax, ecx
0018d c1 e9 02 shr ecx, 2
00190 f3 a5 rep movsd
00192 8b c8 mov ecx, eax
00194 83 e1 03 and ecx, 3
00197 f3 a4 rep movsb
; 79 :
; 80 : *pUlBytesCopied += ulAmtToMove; // Update output variable of bytes copied.
00199 8b 4d 14 mov ecx, DWORD PTR _pUlBytesCopied$[ebp]
0019c 8b 11 mov edx, DWORD PTR [ecx]
0019e 03 55 f4 add edx, DWORD PTR _ulAmtToMove$[ebp]
001a1 8b 45 14 mov eax, DWORD PTR _pUlBytesCopied$[ebp]
001a4 89 10 mov DWORD PTR [eax], edx
; 81 : pOutBfr += ulAmtToMove; // Update pointer to output buffer.
001a6 8b 4d 0c mov ecx, DWORD PTR _pOutBfr$[ebp]
001a9 03 4d f4 add ecx, DWORD PTR _ulAmtToMove$[ebp]
001ac 89 4d 0c mov DWORD PTR _pOutBfr$[ebp], ecx
; 82 : ulOutBfrAvail -= ulAmtToMove; // Update number of bytes available in output buffer.
001af 8b 55 10 mov edx, DWORD PTR _ulOutBfrAvail$[ebp]
001b2 2b 55 f4 sub edx, DWORD PTR _ulAmtToMove$[ebp]
001b5 89 55 10 mov DWORD PTR _ulOutBfrAvail$[ebp], edx
; 83 :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -