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

📄 miniport.cod

📁 James Antognini和Tom Divine提供的PASSTHRU的编成实例。
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00055	c7 45 ec 00 00
	00 00		 mov	 DWORD PTR _MediaSpecificInfo$[ebp], 0

; 306  :     ULONG               MediaSpecificInfoSize = 0;

  0005c	c7 45 f8 00 00
	00 00		 mov	 DWORD PTR _MediaSpecificInfoSize$[ebp], 0

; 307  : 
; 308  :     //
; 309  :     // The driver should fail the send if the virtual miniport is in low 
; 310  :     // power state
; 311  :     //
; 312  :     if (pAdapt->MPDeviceState > NdisDeviceStateD0)

  00063	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00066	83 b9 a0 00 00
	00 01		 cmp	 DWORD PTR [ecx+160], 1
  0006d	7e 0a		 jle	 SHORT $L16095

; 313  :     {
; 314  :          return NDIS_STATUS_FAILURE;

  0006f	b8 01 00 00 c0	 mov	 eax, -1073741823	; c0000001H
  00074	e9 18 03 00 00	 jmp	 $L16087
$L16095:

; 315  :     }
; 316  : 
; 317  : #ifdef NDIS51
; 318  :     //
; 319  :     // Use NDIS 5.1 packet stacking:
; 320  :     //
; 321  :     {
; 322  :         PNDIS_PACKET_STACK        pStack;
; 323  :         BOOLEAN                   Remaining;
; 324  : 
; 325  :         //
; 326  :         // Packet stacks: Check if we can use the same packet for sending down.
; 327  :         //
; 328  : 
; 329  :         pStack = NdisIMGetCurrentPacketStack(Packet, &Remaining);

  00079	8d 55 e7	 lea	 edx, DWORD PTR _Remaining$16099[ebp]
  0007c	52		 push	 edx
  0007d	8b 45 0c	 mov	 eax, DWORD PTR _Packet$[ebp]
  00080	50		 push	 eax
  00081	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisIMGetCurrentPacketStack@8
  00087	89 45 e8	 mov	 DWORD PTR _pStack$16098[ebp], eax

; 330  :         if (Remaining)

  0008a	0f b6 4d e7	 movzx	 ecx, BYTE PTR _Remaining$16099[ebp]
  0008e	85 c9		 test	 ecx, ecx
  00090	0f 84 e2 00 00
	00		 je	 $L16100

; 331  :         {
; 332  :             //
; 333  :             // We can reuse "Packet".
; 334  :             //
; 335  :             // NOTE: if we needed to keep per-packet information in packets
; 336  :             // sent down, we can use pStack->IMReserved[].
; 337  :             //
; 338  :             ASSERT(pStack);

  00096	83 7d e8 00	 cmp	 DWORD PTR _pStack$16098[ebp], 0
  0009a	75 20		 jne	 SHORT $L16591
  0009c	6a 00		 push	 0
  0009e	68 52 01 00 00	 push	 338			; 00000152H
  000a3	68 00 00 00 00	 push	 OFFSET FLAT:$SG16102
  000a8	68 00 00 00 00	 push	 OFFSET FLAT:$SG16103
  000ad	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
  000b3	c7 45 dc 00 00
	00 00		 mov	 DWORD PTR tv76[ebp], 0
  000ba	eb 07		 jmp	 SHORT $L16592
$L16591:
  000bc	c7 45 dc 01 00
	00 00		 mov	 DWORD PTR tv76[ebp], 1
$L16592:

; 339  :             //
; 340  :             // If the below miniport is going to low power state, stop sending down any packet.
; 341  :             //
; 342  :             NdisAcquireSpinLock(&pAdapt->Lock);

  000c3	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  000c6	81 c2 98 00 00
	00		 add	 edx, 152		; 00000098H
  000cc	52		 push	 edx
  000cd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisAcquireSpinLock@4

; 343  :             if (pAdapt->PTDeviceState > NdisDeviceStateD0)

  000d3	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  000d6	83 b8 a4 00 00
	00 01		 cmp	 DWORD PTR [eax+164], 1
  000dd	7e 1a		 jle	 SHORT $L16104

; 344  :             {
; 345  :                 NdisReleaseSpinLock(&pAdapt->Lock);

  000df	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  000e2	81 c1 98 00 00
	00		 add	 ecx, 152		; 00000098H
  000e8	51		 push	 ecx
  000e9	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4

; 346  :                 return NDIS_STATUS_FAILURE;

  000ef	b8 01 00 00 c0	 mov	 eax, -1073741823	; c0000001H
  000f4	e9 98 02 00 00	 jmp	 $L16087
$L16104:

; 347  :             }
; 348  :             pAdapt->OutstandingSends++;

  000f9	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  000fc	8b 82 cc 00 00
	00		 mov	 eax, DWORD PTR [edx+204]
  00102	83 c0 01	 add	 eax, 1
  00105	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00108	89 81 cc 00 00
	00		 mov	 DWORD PTR [ecx+204], eax

; 349  :             NdisReleaseSpinLock(&pAdapt->Lock);

  0010e	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00111	81 c2 98 00 00
	00		 add	 edx, 152		; 00000098H
  00117	52		 push	 edx
  00118	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4

; 350  :             NdisSend(&Status,
; 351  :                      pAdapt->BindingHandle,
; 352  :                      Packet);

  0011e	8b 45 0c	 mov	 eax, DWORD PTR _Packet$[ebp]
  00121	50		 push	 eax
  00122	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00125	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  00128	52		 push	 edx
  00129	8d 45 f4	 lea	 eax, DWORD PTR _Status$[ebp]
  0012c	50		 push	 eax
  0012d	e8 00 00 00 00	 call	 _NdisSend@12

; 353  : 
; 354  :             if (Status != NDIS_STATUS_PENDING)

  00132	81 7d f4 03 01
	00 00		 cmp	 DWORD PTR _Status$[ebp], 259 ; 00000103H
  00139	74 35		 je	 SHORT $L16109

; 355  :             {
; 356  :                 ADAPT_DECR_PENDING_SENDS(pAdapt);

  0013b	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0013e	81 c1 98 00 00
	00		 add	 ecx, 152		; 00000098H
  00144	51		 push	 ecx
  00145	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisAcquireSpinLock@4
  0014b	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  0014e	8b 82 cc 00 00
	00		 mov	 eax, DWORD PTR [edx+204]
  00154	83 e8 01	 sub	 eax, 1
  00157	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0015a	89 81 cc 00 00
	00		 mov	 DWORD PTR [ecx+204], eax
  00160	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00163	81 c2 98 00 00
	00		 add	 edx, 152		; 00000098H
  00169	52		 push	 edx
  0016a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4
$L16109:

; 357  :             }
; 358  : 
; 359  :             return(Status);

  00170	8b 45 f4	 mov	 eax, DWORD PTR _Status$[ebp]
  00173	e9 19 02 00 00	 jmp	 $L16087
$L16100:

; 360  :         }
; 361  :     }
; 362  : #endif // NDIS51
; 363  : 
; 364  :     //
; 365  :     // We are either not using packet stacks, or there isn't stack space
; 366  :     // in the original packet passed down to us. Allocate a new packet
; 367  :     // to wrap the data with.
; 368  :     //
; 369  :     //
; 370  :     // If the below miniport is going to low power state, stop sending down any packet.
; 371  :     //
; 372  :     NdisAcquireSpinLock(&pAdapt->Lock);

  00178	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0017b	05 98 00 00 00	 add	 eax, 152		; 00000098H
  00180	50		 push	 eax
  00181	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisAcquireSpinLock@4

; 373  :     if (pAdapt->PTDeviceState > NdisDeviceStateD0)

  00187	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0018a	83 b9 a4 00 00
	00 01		 cmp	 DWORD PTR [ecx+164], 1
  00191	7e 1a		 jle	 SHORT $L16110

; 374  :     {
; 375  :         NdisReleaseSpinLock(&pAdapt->Lock);

  00193	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00196	81 c2 98 00 00
	00		 add	 edx, 152		; 00000098H
  0019c	52		 push	 edx
  0019d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4

; 376  :         return NDIS_STATUS_FAILURE;

  001a3	b8 01 00 00 c0	 mov	 eax, -1073741823	; c0000001H
  001a8	e9 e4 01 00 00	 jmp	 $L16087
$L16110:

; 377  :     
; 378  :     }
; 379  :     pAdapt->OutstandingSends++;

  001ad	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  001b0	8b 88 cc 00 00
	00		 mov	 ecx, DWORD PTR [eax+204]
  001b6	83 c1 01	 add	 ecx, 1
  001b9	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  001bc	89 8a cc 00 00
	00		 mov	 DWORD PTR [edx+204], ecx

; 380  :     NdisReleaseSpinLock(&pAdapt->Lock);

  001c2	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  001c5	05 98 00 00 00	 add	 eax, 152		; 00000098H
  001ca	50		 push	 eax
  001cb	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4

; 381  :     
; 382  :     NdisAllocatePacket(&Status,
; 383  :                        &MyPacket,
; 384  :                        pAdapt->SendPacketPoolHandle);

  001d1	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  001d4	8b 51 0c	 mov	 edx, DWORD PTR [ecx+12]
  001d7	52		 push	 edx
  001d8	8d 45 f0	 lea	 eax, DWORD PTR _MyPacket$[ebp]
  001db	50		 push	 eax
  001dc	8d 4d f4	 lea	 ecx, DWORD PTR _Status$[ebp]
  001df	51		 push	 ecx
  001e0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisAllocatePacket@12

; 385  : 
; 386  :     if (Status == NDIS_STATUS_SUCCESS)

  001e6	83 7d f4 00	 cmp	 DWORD PTR _Status$[ebp], 0
  001ea	0f 85 6a 01 00
	00		 jne	 $L16115

; 387  :     {
; 388  :         PSEND_RSVD            SendRsvd;
; 389  : 
; 390  :         //
; 391  :         // Save a pointer to the original packet in our reserved
; 392  :         // area in the new packet. This is needed so that we can
; 393  :         // get back to the original packet when the new packet's send
; 394  :         // is completed.
; 395  :         //
; 396  :         SendRsvd = (PSEND_RSVD)(MyPacket->ProtocolReserved);

  001f0	8b 55 f0	 mov	 edx, DWORD PTR _MyPacket$[ebp]
  001f3	83 c2 38	 add	 edx, 56			; 00000038H
  001f6	89 55 e0	 mov	 DWORD PTR _SendRsvd$16116[ebp], edx

; 397  :         SendRsvd->OriginalPkt = Packet;

  001f9	8b 45 e0	 mov	 eax, DWORD PTR _SendRsvd$16116[ebp]
  001fc	8b 4d 0c	 mov	 ecx, DWORD PTR _Packet$[ebp]
  001ff	89 08		 mov	 DWORD PTR [eax], ecx

; 398  : 
; 399  :         MyPacket->Private.Flags = Flags;

  00201	8b 55 f0	 mov	 edx, DWORD PTR _MyPacket$[ebp]
  00204	8b 45 10	 mov	 eax, DWORD PTR _Flags$[ebp]
  00207	89 42 18	 mov	 DWORD PTR [edx+24], eax

; 400  : 
; 401  :         //
; 402  :         // Set up the new packet so that it describes the same
; 403  :         // data as the original packet.
; 404  :         //
; 405  :         MyPacket->Private.Head = Packet->Private.Head;

  0020a	8b 4d f0	 mov	 ecx, DWORD PTR _MyPacket$[ebp]
  0020d	8b 55 0c	 mov	 edx, DWORD PTR _Packet$[ebp]
  00210	8b 42 08	 mov	 eax, DWORD PTR [edx+8]
  00213	89 41 08	 mov	 DWORD PTR [ecx+8], eax

; 406  :         MyPacket->Private.Tail = Packet->Private.Tail;

  00216	8b 4d f0	 mov	 ecx, DWORD PTR _MyPacket$[ebp]
  00219	8b 55 0c	 mov	 edx, DWORD PTR _Packet$[ebp]
  0021c	8b 42 0c	 mov	 eax, DWORD PTR [edx+12]
  0021f	89 41 0c	 mov	 DWORD PTR [ecx+12], eax

; 407  : #ifdef WIN9X
; 408  :         //
; 409  :         // Work around the fact that NDIS does not initialize this
; 410  :         // to FALSE on Win9x.
; 411  :         //
; 412  :         MyPacket->Private.ValidCounts = FALSE;
; 413  : #endif
; 414  : 
; 415  :         //
; 416  :         // Copy the OOB Offset from the original packet to the new
; 417  :         // packet.
; 418  :         //
; 419  :         NdisMoveMemory(NDIS_OOB_DATA_FROM_PACKET(MyPacket),
; 420  :                        NDIS_OOB_DATA_FROM_PACKET(Packet),
; 421  :                        sizeof(NDIS_PACKET_OOB_DATA));

  00222	8b 4d 0c	 mov	 ecx, DWORD PTR _Packet$[ebp]
  00225	0f b7 51 1e	 movzx	 edx, WORD PTR [ecx+30]
  00229	8b 75 0c	 mov	 esi, DWORD PTR _Packet$[ebp]
  0022c	03 f2		 add	 esi, edx
  0022e	8b 45 f0	 mov	 eax, DWORD PTR _MyPacket$[ebp]
  00231	0f b7 48 1e	 movzx	 ecx, WORD PTR [eax+30]
  00235	8b 7d f0	 mov	 edi, DWORD PTR _MyPacket$[ebp]
  00238	03 f9		 add	 edi, ecx
  0023a	b9 08 00 00 00	 mov	 ecx, 8
  0023f	f3 a5		 rep movsd

; 422  : 
; 423  : #ifndef WIN9X
; 424  :         //
; 425  :         // Copy the right parts of per packet info into the new packet.
; 426  :         // This API is not available on Win9x since task offload is
; 427  :         // not supported on that platform.
; 428  :         //
; 429  :         NdisIMCopySendPerPacketInfo(MyPacket, Packet);

  00241	8b 55 0c	 mov	 edx, DWORD PTR _Packet$[ebp]
  00244	52		 push	 edx
  00245	8b 45 f0	 mov	 eax, DWORD PTR _MyPacket$[ebp]
  00248	50		 push	 eax
  00249	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisIMCopySendPerPacketInfo@8

; 430  : #endif
; 431  :         
; 432  :         //
; 433  :         // Copy the Media specific information
; 434  :         //
; 435  :         NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(Packet,
; 436  :                                             &MediaSpecificInfo,
; 437  :                                             &MediaSpecificInfoSize);

  0024f	8b 4d 0c	 mov	 ecx, DWORD PTR _Packet$[ebp]
  00252	0f b6 51 1d	 movzx	 edx, BYTE PTR [ecx+29]
  00256	81 e2 80 00 00
	00		 and	 edx, 128		; 00000080H
  0025c	85 d2		 test	 edx, edx
  0025e	74 0e		 je	 SHORT $L16124
  00260	8b 45 0c	 mov	 eax, DWORD PTR _Packet$[ebp]
  00263	0f b6 48 1d	 movzx	 ecx, BYTE PTR [eax+29]
  00267	83 e1 40	 and	 ecx, 64			; 00000040H
  0026a	85 c9		 test	 ecx, ecx
  0026c	75 10		 jne	 SHORT $L16123
$L16124:
  0026e	c7 45 ec 00 00
	00 00		 mov	 DWORD PTR _MediaSpecificInfo$[ebp], 0
  00275	c7 45 f8 00 00
	00 00		 mov	 DWORD PTR _MediaSpecificInfoSize$[ebp], 0
  0027c	eb 22		 jmp	 SHORT $L16126
$L16123:

⌨️ 快捷键说明

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