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

📄 protocol.cod

📁 James Antognini和Tom Divine提供的PASSTHRU的编成实例。
💻 COD
📖 第 1 页 / 共 5 页
字号:
  004d8	83 c4 0c	 add	 esp, 12			; 0000000cH

; 255  :             break;

  004db	eb 0a		 jmp	 SHORT $L16044
$L16043:

; 256  :         }
; 257  : 
; 258  :     } while(FALSE);

  004dd	33 c0		 xor	 eax, eax
  004df	85 c0		 test	 eax, eax
  004e1	0f 85 c0 fd ff
	ff		 jne	 $L16042
$L16044:

; 259  : 
; 260  :     //
; 261  :     // Close the configuration handle now - see comments above with
; 262  :     // the call to NdisIMInitializeDeviceInstanceEx.
; 263  :     //
; 264  :     if (ConfigHandle != NULL)

  004e7	83 7d d4 00	 cmp	 DWORD PTR _ConfigHandle$[ebp], 0
  004eb	74 0a		 je	 SHORT $L16081

; 265  :     {
; 266  :         NdisCloseConfiguration(ConfigHandle);

  004ed	8b 4d d4	 mov	 ecx, DWORD PTR _ConfigHandle$[ebp]
  004f0	51		 push	 ecx
  004f1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisCloseConfiguration@4
$L16081:

; 267  :     }
; 268  : 
; 269  :     if (*Status != NDIS_STATUS_SUCCESS)

  004f7	8b 55 08	 mov	 edx, DWORD PTR _Status$[ebp]
  004fa	83 3a 00	 cmp	 DWORD PTR [edx], 0
  004fd	0f 84 bd 00 00
	00		 je	 $L16084

; 270  :     {
; 271  :         if (pAdapt != NULL)

  00503	83 7d f0 00	 cmp	 DWORD PTR _pAdapt$[ebp], 0
  00507	0f 84 b3 00 00
	00		 je	 $L16084

; 272  :         {
; 273  :             if (pAdapt->BindingHandle != NULL)

  0050d	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  00510	83 78 04 00	 cmp	 DWORD PTR [eax+4], 0
  00514	74 49		 je	 SHORT $L16088

; 274  :             {
; 275  :                 NDIS_STATUS    LocalStatus;
; 276  : 
; 277  :                 //
; 278  :                 // Close the binding we opened above.
; 279  :                 //
; 280  : 
; 281  :                 NdisResetEvent(&pAdapt->Event);

  00516	8b 4d f0	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00519	83 c1 18	 add	 ecx, 24			; 00000018H
  0051c	51		 push	 ecx
  0051d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisResetEvent@4

; 282  :                 
; 283  :                 NdisCloseAdapter(&LocalStatus, pAdapt->BindingHandle);

  00523	8b 55 f0	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00526	8b 42 04	 mov	 eax, DWORD PTR [edx+4]
  00529	50		 push	 eax
  0052a	8d 4d d0	 lea	 ecx, DWORD PTR _LocalStatus$16089[ebp]
  0052d	51		 push	 ecx
  0052e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisCloseAdapter@8

; 284  :                 pAdapt->BindingHandle = NULL;

  00534	8b 55 f0	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00537	c7 42 04 00 00
	00 00		 mov	 DWORD PTR [edx+4], 0

; 285  : 
; 286  :                 if (LocalStatus == NDIS_STATUS_PENDING)

  0053e	81 7d d0 03 01
	00 00		 cmp	 DWORD PTR _LocalStatus$16089[ebp], 259 ; 00000103H
  00545	75 18		 jne	 SHORT $L16088

; 287  :                 {
; 288  :                      NdisWaitEvent(&pAdapt->Event, 0);

  00547	6a 00		 push	 0
  00549	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0054c	83 c0 18	 add	 eax, 24			; 00000018H
  0054f	50		 push	 eax
  00550	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisWaitEvent@8

; 289  :                      LocalStatus = pAdapt->Status;

  00556	8b 4d f0	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00559	8b 51 14	 mov	 edx, DWORD PTR [ecx+20]
  0055c	89 55 d0	 mov	 DWORD PTR _LocalStatus$16089[ebp], edx
$L16088:

; 290  :                 }
; 291  :             }
; 292  : 
; 293  :             if (pAdapt->SendPacketPoolHandle != NULL)

  0055f	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  00562	83 78 0c 00	 cmp	 DWORD PTR [eax+12], 0
  00566	74 0d		 je	 SHORT $L16095

; 294  :             {
; 295  :                  NdisFreePacketPool(pAdapt->SendPacketPoolHandle);

  00568	8b 4d f0	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0056b	8b 51 0c	 mov	 edx, DWORD PTR [ecx+12]
  0056e	52		 push	 edx
  0056f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreePacketPool@4
$L16095:

; 296  :             }
; 297  : 
; 298  :             if (pAdapt->RecvPacketPoolHandle != NULL)

  00575	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  00578	83 78 10 00	 cmp	 DWORD PTR [eax+16], 0
  0057c	74 0d		 je	 SHORT $L16097

; 299  :             {
; 300  :                  NdisFreePacketPool(pAdapt->RecvPacketPoolHandle);

  0057e	8b 4d f0	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00581	8b 51 10	 mov	 edx, DWORD PTR [ecx+16]
  00584	52		 push	 edx
  00585	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreePacketPool@4
$L16097:

; 301  :             }
; 302  : 
; 303  :             if (NULL!=pAdapt->pIPAddrArray)           // Is there an IP-address filter array?  ja, 28.09.2003.       

  0058b	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0058e	83 b8 e0 02 00
	00 00		 cmp	 DWORD PTR [eax+736], 0
  00595	74 14		 je	 SHORT $L16099

; 304  :               NdisFreeMemory(pAdapt->pIPAddrArray, 0, 0);                                                            

  00597	6a 00		 push	 0
  00599	6a 00		 push	 0
  0059b	8b 4d f0	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0059e	8b 91 e0 02 00
	00		 mov	 edx, DWORD PTR [ecx+736]
  005a4	52		 push	 edx
  005a5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreeMemory@12
$L16099:

; 305  : 
; 306  :             NdisFreeMemory(pAdapt, 0, 0);

  005ab	6a 00		 push	 0
  005ad	6a 00		 push	 0
  005af	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  005b2	50		 push	 eax
  005b3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreeMemory@12

; 307  :             pAdapt = NULL;

  005b9	c7 45 f0 00 00
	00 00		 mov	 DWORD PTR _pAdapt$[ebp], 0
$L16084:

; 308  :         }
; 309  :     }
; 310  : 
; 311  : 
; 312  :     DBGPRINT(("<== Protocol BindAdapter: pAdapt %p, Status %x\n", pAdapt, *Status));

  005c0	68 00 00 00 00	 push	 OFFSET FLAT:$SG16101
  005c5	e8 00 00 00 00	 call	 _DbgPrint
  005ca	83 c4 04	 add	 esp, 4
  005cd	8b 4d 08	 mov	 ecx, DWORD PTR _Status$[ebp]
  005d0	8b 11		 mov	 edx, DWORD PTR [ecx]
  005d2	52		 push	 edx
  005d3	8b 45 f0	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  005d6	50		 push	 eax
  005d7	68 00 00 00 00	 push	 OFFSET FLAT:$SG16102
  005dc	e8 00 00 00 00	 call	 _DbgPrint
  005e1	83 c4 0c	 add	 esp, 12			; 0000000cH

; 313  : }

  005e4	5f		 pop	 edi
  005e5	5e		 pop	 esi
  005e6	8b e5		 mov	 esp, ebp
  005e8	5d		 pop	 ebp
  005e9	c2 14 00	 ret	 20			; 00000014H
_PtBindAdapter@20 ENDP
_TEXT	ENDS
PUBLIC	_PtOpenAdapterComplete@12
EXTRN	__imp__NdisSetEvent@4:NEAR
;	COMDAT _PtOpenAdapterComplete@12
_TEXT	SEGMENT
$SG16112 DB	'Passthru: ', 00H
	ORG $+1
$SG16113 DB	'==> PtOpenAdapterComplete: Adapt %p, Status %x', 0aH, 00H
; Function compile flags: /Odt
_pAdapt$ = -4
_ProtocolBindingContext$ = 8
_Status$ = 12
_OpenErrorStatus$ = 16
_PtOpenAdapterComplete@12 PROC NEAR			; COMDAT

; 340  : {

  0003c	55		 push	 ebp
  0003d	8b ec		 mov	 ebp, esp
  0003f	51		 push	 ecx

; 341  :     PADAPT      pAdapt =(PADAPT)ProtocolBindingContext;

  00040	8b 45 08	 mov	 eax, DWORD PTR _ProtocolBindingContext$[ebp]
  00043	89 45 fc	 mov	 DWORD PTR _pAdapt$[ebp], eax

; 342  :     
; 343  :     UNREFERENCED_PARAMETER(OpenErrorStatus);
; 344  :     
; 345  :     DBGPRINT(("==> PtOpenAdapterComplete: Adapt %p, Status %x\n", pAdapt, Status));

  00046	68 00 00 00 00	 push	 OFFSET FLAT:$SG16112
  0004b	e8 00 00 00 00	 call	 _DbgPrint
  00050	83 c4 04	 add	 esp, 4
  00053	8b 4d 0c	 mov	 ecx, DWORD PTR _Status$[ebp]
  00056	51		 push	 ecx
  00057	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  0005a	52		 push	 edx
  0005b	68 00 00 00 00	 push	 OFFSET FLAT:$SG16113
  00060	e8 00 00 00 00	 call	 _DbgPrint
  00065	83 c4 0c	 add	 esp, 12			; 0000000cH

; 346  :     pAdapt->Status = Status;

  00068	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0006b	8b 4d 0c	 mov	 ecx, DWORD PTR _Status$[ebp]
  0006e	89 48 14	 mov	 DWORD PTR [eax+20], ecx

; 347  :     NdisSetEvent(&pAdapt->Event);

  00071	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00074	83 c2 18	 add	 edx, 24			; 00000018H
  00077	52		 push	 edx
  00078	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisSetEvent@4

; 348  : }

  0007e	8b e5		 mov	 esp, ebp
  00080	5d		 pop	 ebp
  00081	c2 0c 00	 ret	 12			; 0000000cH
_PtOpenAdapterComplete@12 ENDP
_TEXT	ENDS
PUBLIC	_PtRequestComplete@12
PUBLIC	_PtUnbindAdapter@12
EXTRN	__imp__NdisAcquireSpinLock@4:NEAR
EXTRN	__imp__NdisReleaseSpinLock@4:NEAR
EXTRN	__imp__NdisIMCancelInitializeDeviceInstance@8:NEAR
EXTRN	__imp__NdisIMDeInitializeDeviceInstance@4:NEAR
EXTRN	__imp__RtlAssert@16:NEAR
;	COMDAT _PtUnbindAdapter@12
_TEXT	SEGMENT
$SG16124 DB	'Passthru: ', 00H
	ORG $+1
$SG16125 DB	'==> PtUnbindAdapter: Adapt %p', 0aH, 00H
	ORG $+1
$SG16136 DB	'g:\pcadev\ndisim\passthruex\part2\james\james\sys\protoc'
	DB	'ol.c', 00H
	ORG $+3
$SG16137 DB	'pAdapt->MiniportHandle == NULL', 00H
	ORG $+1
$SG16140 DB	'g:\pcadev\ndisim\passthruex\part2\james\james\sys\protoc'
	DB	'ol.c', 00H
	ORG $+3
$SG16141 DB	'pAdapt->MiniportInitPending == FALSE', 00H
	ORG $+3
$SG16160 DB	'g:\pcadev\ndisim\passthruex\part2\james\james\sys\protoc'
	DB	'ol.c', 00H
	ORG $+3
$SG16161 DB	'0', 00H
	ORG $+2
$SG16164 DB	'Passthru: ', 00H
	ORG $+1
$SG16165 DB	'<== PtUnbindAdapter: Adapt %p', 0aH, 00H
; Function compile flags: /Odt
tv140 = -16
tv129 = -12
_LocalStatus$ = -8
_pAdapt$ = -4
_Status$ = 8
_ProtocolBindingContext$ = 12
_UnbindContext$ = 16
_PtUnbindAdapter@12 PROC NEAR				; COMDAT

; 377  : {

  00163	55		 push	 ebp
  00164	8b ec		 mov	 ebp, esp
  00166	83 ec 10	 sub	 esp, 16			; 00000010H

; 378  :     PADAPT         pAdapt =(PADAPT)ProtocolBindingContext;

  00169	8b 45 0c	 mov	 eax, DWORD PTR _ProtocolBindingContext$[ebp]
  0016c	89 45 fc	 mov	 DWORD PTR _pAdapt$[ebp], eax

; 379  :     NDIS_STATUS    LocalStatus;
; 380  : 
; 381  :     UNREFERENCED_PARAMETER(UnbindContext);
; 382  :     
; 383  :     DBGPRINT(("==> PtUnbindAdapter: Adapt %p\n", pAdapt));

  0016f	68 00 00 00 00	 push	 OFFSET FLAT:$SG16124
  00174	e8 00 00 00 00	 call	 _DbgPrint
  00179	83 c4 04	 add	 esp, 4
  0017c	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0017f	51		 push	 ecx
  00180	68 00 00 00 00	 push	 OFFSET FLAT:$SG16125
  00185	e8 00 00 00 00	 call	 _DbgPrint
  0018a	83 c4 08	 add	 esp, 8

; 384  : 
; 385  :     //
; 386  :     // Set the flag that the miniport below is unbinding, so the request handlers will
; 387  :     // fail any request comming later
; 388  :     // 
; 389  :     NdisAcquireSpinLock(&pAdapt->Lock);

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

; 390  :     pAdapt->UnbindingInProcess = TRUE;

  0019d	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  001a0	c6 80 94 00 00
	00 01		 mov	 BYTE PTR [eax+148], 1

; 391  :     if (pAdapt->QueuedRequest == TRUE)

  001a7	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  001aa	0f b6 91 92 00
	00 00		 movzx	 edx, BYTE PTR [ecx+146]
  001b1	83 fa 01	 cmp	 edx, 1
  001b4	75 31		 jne	 SHORT $L16126

; 392  :     {
; 393  :         pAdapt->QueuedRequest = FALSE;

  001b6	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  001b9	c6 80 92 00 00
	00 00		 mov	 BYTE PTR [eax+146], 0

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

  001c0	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  001c3	81 c1 98 00 00
	00		 add	 ecx, 152		; 00000098H
  001c9	51		 push	 ecx
  001ca	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4

; 395  : 
; 396  :         PtRequestComplete(pAdapt,
; 397  :                          &pAdapt->Request,
; 398  :                          NDIS_STATUS_FAILURE );

  001d0	68 01 00 00 c0	 push	 -1073741823		; c0000001H
  001d5	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  001d8	83 c2 2c	 add	 edx, 44			; 0000002cH
  001db	52		 push	 edx
  001dc	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  001df	50		 push	 eax
  001e0	e8 00 00 00 00	 call	 _PtRequestComplete@12

; 399  : 
; 400  :     }
; 401  :     else

  001e5	eb 10		 jmp	 SHORT $L16129
$L16126:

⌨️ 快捷键说明

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