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

📄 protocol.cod

📁 James Antognini和Tom Divine提供的PASSTHRU的编成实例。
💻 COD
📖 第 1 页 / 共 5 页
字号:

; 402  :     {
; 403  :         NdisReleaseSpinLock(&pAdapt->Lock);

  001e7	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  001ea	81 c1 98 00 00
	00		 add	 ecx, 152		; 00000098H
  001f0	51		 push	 ecx
  001f1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisReleaseSpinLock@4
$L16129:

; 404  :     }
; 405  : #ifndef WIN9X
; 406  :     //
; 407  :     // Check if we had called NdisIMInitializeDeviceInstanceEx and
; 408  :     // we are awaiting a call to MiniportInitialize.
; 409  :     //
; 410  :     if (pAdapt->MiniportInitPending == TRUE)

  001f7	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  001fa	0f b6 82 c0 00
	00 00		 movzx	 eax, BYTE PTR [edx+192]
  00201	83 f8 01	 cmp	 eax, 1
  00204	0f 85 a3 00 00
	00		 jne	 $L16130

; 411  :     {
; 412  :         //
; 413  :         // Try to cancel the pending IMInit process.
; 414  :         //
; 415  :         LocalStatus = NdisIMCancelInitializeDeviceInstance(
; 416  :                         DriverHandle,
; 417  :                         &pAdapt->DeviceName);

  0020a	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  0020d	81 c1 a8 00 00
	00		 add	 ecx, 168		; 000000a8H
  00213	51		 push	 ecx
  00214	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR _DriverHandle
  0021a	52		 push	 edx
  0021b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisIMCancelInitializeDeviceInstance@8
  00221	89 45 f8	 mov	 DWORD PTR _LocalStatus$[ebp], eax

; 418  : 
; 419  :         if (LocalStatus == NDIS_STATUS_SUCCESS)

  00224	83 7d f8 00	 cmp	 DWORD PTR _LocalStatus$[ebp], 0
  00228	75 3c		 jne	 SHORT $L16133

; 420  :         {
; 421  :             //
; 422  :             // Successfully cancelled IM Initialization; our
; 423  :             // Miniport Initialize routine will not be called
; 424  :             // for this device.
; 425  :             //
; 426  :             pAdapt->MiniportInitPending = FALSE;

  0022a	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0022d	c6 80 c0 00 00
	00 00		 mov	 BYTE PTR [eax+192], 0

; 427  :             ASSERT(pAdapt->MiniportHandle == NULL);

  00234	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00237	83 79 08 00	 cmp	 DWORD PTR [ecx+8], 0
  0023b	74 20		 je	 SHORT $L16610
  0023d	6a 00		 push	 0
  0023f	68 ab 01 00 00	 push	 427			; 000001abH
  00244	68 00 00 00 00	 push	 OFFSET FLAT:$SG16136
  00249	68 00 00 00 00	 push	 OFFSET FLAT:$SG16137
  0024e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
  00254	c7 45 f4 00 00
	00 00		 mov	 DWORD PTR tv129[ebp], 0
  0025b	eb 07		 jmp	 SHORT $L16611
$L16610:
  0025d	c7 45 f4 01 00
	00 00		 mov	 DWORD PTR tv129[ebp], 1
$L16611:

; 428  :         }
; 429  :         else

  00264	eb 47		 jmp	 SHORT $L16130
$L16133:

; 430  :         {
; 431  :             //
; 432  :             // Our Miniport Initialize routine will be called
; 433  :             // (may be running on another thread at this time).
; 434  :             // Wait for it to finish.
; 435  :             //
; 436  :             NdisWaitEvent(&pAdapt->MiniportInitEvent, 0);

  00266	6a 00		 push	 0
  00268	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  0026b	81 c2 b0 00 00
	00		 add	 edx, 176		; 000000b0H
  00271	52		 push	 edx
  00272	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisWaitEvent@8

; 437  :             ASSERT(pAdapt->MiniportInitPending == FALSE);

  00278	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0027b	0f b6 88 c0 00
	00 00		 movzx	 ecx, BYTE PTR [eax+192]
  00282	85 c9		 test	 ecx, ecx
  00284	74 20		 je	 SHORT $L16612
  00286	6a 00		 push	 0
  00288	68 b5 01 00 00	 push	 437			; 000001b5H
  0028d	68 00 00 00 00	 push	 OFFSET FLAT:$SG16140
  00292	68 00 00 00 00	 push	 OFFSET FLAT:$SG16141
  00297	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
  0029d	c7 45 f0 00 00
	00 00		 mov	 DWORD PTR tv140[ebp], 0
  002a4	eb 07		 jmp	 SHORT $L16130
$L16612:
  002a6	c7 45 f0 01 00
	00 00		 mov	 DWORD PTR tv140[ebp], 1
$L16130:

; 438  :         }
; 439  : 
; 440  :     }
; 441  : #endif // !WIN9X
; 442  : 
; 443  :     //
; 444  :     // Call NDIS to remove our device-instance. We do most of the work
; 445  :     // inside the HaltHandler.
; 446  :     //
; 447  :     // The Handle will be NULL if our miniport Halt Handler has been called or
; 448  :     // if the IM device was never initialized
; 449  :     //
; 450  :     
; 451  :     if (pAdapt->MiniportHandle != NULL)

  002ad	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  002b0	83 7a 08 00	 cmp	 DWORD PTR [edx+8], 0
  002b4	74 28		 je	 SHORT $L16143

; 452  :     {
; 453  :         *Status = NdisIMDeInitializeDeviceInstance(pAdapt->MiniportHandle);

  002b6	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  002b9	8b 48 08	 mov	 ecx, DWORD PTR [eax+8]
  002bc	51		 push	 ecx
  002bd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisIMDeInitializeDeviceInstance@4
  002c3	8b 55 08	 mov	 edx, DWORD PTR _Status$[ebp]
  002c6	89 02		 mov	 DWORD PTR [edx], eax

; 454  : 
; 455  :         if (*Status != NDIS_STATUS_SUCCESS)

  002c8	8b 45 08	 mov	 eax, DWORD PTR _Status$[ebp]
  002cb	83 38 00	 cmp	 DWORD PTR [eax], 0
  002ce	74 09		 je	 SHORT $L16146

; 456  :         {
; 457  :             *Status = NDIS_STATUS_FAILURE;

  002d0	8b 4d 08	 mov	 ecx, DWORD PTR _Status$[ebp]
  002d3	c7 01 01 00 00
	c0		 mov	 DWORD PTR [ecx], -1073741823 ; c0000001H
$L16146:

; 458  :         }
; 459  :     }
; 460  :     else

  002d9	e9 a6 00 00 00	 jmp	 $L16149
$L16143:

; 461  :     {
; 462  :         //
; 463  :         // We need to do some work here. 
; 464  :         // Close the binding below us 
; 465  :         // and release the memory allocated.
; 466  :         //
; 467  :         if(pAdapt->BindingHandle != NULL)

  002de	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  002e1	83 7a 04 00	 cmp	 DWORD PTR [edx+4], 0
  002e5	74 4f		 je	 SHORT $L16151

; 468  :         {
; 469  :             NdisResetEvent(&pAdapt->Event);

  002e7	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  002ea	83 c0 18	 add	 eax, 24			; 00000018H
  002ed	50		 push	 eax
  002ee	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisResetEvent@4

; 470  : 
; 471  :             NdisCloseAdapter(Status, pAdapt->BindingHandle);

  002f4	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  002f7	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  002fa	52		 push	 edx
  002fb	8b 45 08	 mov	 eax, DWORD PTR _Status$[ebp]
  002fe	50		 push	 eax
  002ff	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisCloseAdapter@8

; 472  : 
; 473  :             //
; 474  :             // Wait for it to complete
; 475  :             //
; 476  :             if(*Status == NDIS_STATUS_PENDING)

  00305	8b 4d 08	 mov	 ecx, DWORD PTR _Status$[ebp]
  00308	81 39 03 01 00
	00		 cmp	 DWORD PTR [ecx], 259	; 00000103H
  0030e	75 1a		 jne	 SHORT $L16154

; 477  :             {
; 478  :                  NdisWaitEvent(&pAdapt->Event, 0);

  00310	6a 00		 push	 0
  00312	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00315	83 c2 18	 add	 edx, 24			; 00000018H
  00318	52		 push	 edx
  00319	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisWaitEvent@8

; 479  :                  *Status = pAdapt->Status;

  0031f	8b 45 08	 mov	 eax, DWORD PTR _Status$[ebp]
  00322	8b 4d fc	 mov	 ecx, DWORD PTR _pAdapt$[ebp]
  00325	8b 51 14	 mov	 edx, DWORD PTR [ecx+20]
  00328	89 10		 mov	 DWORD PTR [eax], edx
$L16154:

; 480  :             }
; 481  :             pAdapt->BindingHandle = NULL;

  0032a	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  0032d	c7 40 04 00 00
	00 00		 mov	 DWORD PTR [eax+4], 0

; 482  :         }
; 483  :         else

  00334	eb 20		 jmp	 SHORT $L16156
$L16151:

; 484  :         {
; 485  :             //
; 486  :             // Both Our MiniportHandle and Binding Handle  should not be NULL.
; 487  :             //
; 488  :             *Status = NDIS_STATUS_FAILURE;

  00336	8b 4d 08	 mov	 ecx, DWORD PTR _Status$[ebp]
  00339	c7 01 01 00 00
	c0		 mov	 DWORD PTR [ecx], -1073741823 ; c0000001H

; 489  :             ASSERT(0);

  0033f	6a 00		 push	 0
  00341	68 e9 01 00 00	 push	 489			; 000001e9H
  00346	68 00 00 00 00	 push	 OFFSET FLAT:$SG16160
  0034b	68 00 00 00 00	 push	 OFFSET FLAT:$SG16161
  00350	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L16156:

; 490  :         }
; 491  : 
; 492  :         if (NULL!=pAdapt->pIPAddrArray)              // Is there an IP-address filter array?  ja, 28.09.2003

  00356	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  00359	83 ba e0 02 00
	00 00		 cmp	 DWORD PTR [edx+736], 0
  00360	74 14		 je	 SHORT $L16163

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

  00362	6a 00		 push	 0
  00364	6a 00		 push	 0
  00366	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  00369	8b 88 e0 02 00
	00		 mov	 ecx, DWORD PTR [eax+736]
  0036f	51		 push	 ecx
  00370	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreeMemory@12
$L16163:

; 494  : 
; 495  :         //
; 496  :         //    Free the memory here, if was not released earlier(by calling the HaltHandler)
; 497  :         //
; 498  :         NdisFreeMemory(pAdapt, 0, 0);

  00376	6a 00		 push	 0
  00378	6a 00		 push	 0
  0037a	8b 55 fc	 mov	 edx, DWORD PTR _pAdapt$[ebp]
  0037d	52		 push	 edx
  0037e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisFreeMemory@12
$L16149:

; 499  :     }
; 500  : 
; 501  :     DBGPRINT(("<== PtUnbindAdapter: Adapt %p\n", pAdapt));

  00384	68 00 00 00 00	 push	 OFFSET FLAT:$SG16164
  00389	e8 00 00 00 00	 call	 _DbgPrint
  0038e	83 c4 04	 add	 esp, 4
  00391	8b 45 fc	 mov	 eax, DWORD PTR _pAdapt$[ebp]
  00394	50		 push	 eax
  00395	68 00 00 00 00	 push	 OFFSET FLAT:$SG16165
  0039a	e8 00 00 00 00	 call	 _DbgPrint
  0039f	83 c4 08	 add	 esp, 8

; 502  : }

  003a2	8b e5		 mov	 esp, ebp
  003a4	5d		 pop	 ebp
  003a5	c2 0c 00	 ret	 12			; 0000000cH
_PtUnbindAdapter@12 ENDP
_TEXT	ENDS
PUBLIC	_PtUnloadProtocol@0
EXTRN	__imp__NdisDeregisterProtocol@8:NEAR
;	COMDAT _PtUnloadProtocol@0
_TEXT	SEGMENT
$SG16172 DB	'Passthru: ', 00H
	ORG $+1
$SG16173 DB	'PtUnloadProtocol: done!', 0aH, 00H
; Function compile flags: /Odt
_Status$ = -4
_PtUnloadProtocol@0 PROC NEAR				; COMDAT

; 508  : {

  00025	55		 push	 ebp
  00026	8b ec		 mov	 ebp, esp
  00028	51		 push	 ecx

; 509  :     NDIS_STATUS Status;
; 510  : 
; 511  :     if (ProtHandle != NULL)

  00029	83 3d 00 00 00
	00 00		 cmp	 DWORD PTR _ProtHandle, 0
  00030	74 1a		 je	 SHORT $L16170

; 512  :     {
; 513  :         NdisDeregisterProtocol(&Status, ProtHandle);

  00032	a1 00 00 00 00	 mov	 eax, DWORD PTR _ProtHandle
  00037	50		 push	 eax
  00038	8d 4d fc	 lea	 ecx, DWORD PTR _Status$[ebp]
  0003b	51		 push	 ecx
  0003c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__NdisDeregisterProtocol@8

; 514  :         ProtHandle = NULL;

  00042	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR _ProtHandle, 0
$L16170:

; 515  :     }
; 516  : 
; 517  :     DBGPRINT(("PtUnloadProtocol: done!\n"));

  0004c	68 00 00 00 00	 push	 OFFSET FLAT:$SG16172
  00051	e8 00 00 00 00	 call	 _DbgPrint
  00056	83 c4 04	 add	 esp, 4
  00059	68 00 00 00 00	 push	 OFFSET FLAT:$SG16173
  0005e	e8 00 00 00 00	 call	 _DbgPrint
  00063	83 c4 04	 add	 esp, 4

; 518  : }

  00066	8b e5		 mov	 esp, ebp
  00068	5d		 pop	 ebp
  00069	c3		 ret	 0
_PtUnloadProtocol@0 ENDP
_TEXT	ENDS
PUBLIC	_PtCloseAdapterComplete@8
;	COMDAT _PtCloseAdapterComplete@8
_TEXT	SEGMENT
$SG16181 DB	'Passthru: ', 00H
	ORG $+1
$SG16182 DB	'CloseAdapterComplete: Adapt %p, Status %x', 0aH, 00H
; Function compile flags: /Odt
_pAdapt$ = -4
_ProtocolBindingContext$ = 8
_Status$ = 12
_PtCloseAdapterComplete@8 PROC NEAR			; COMDAT

; 543  : {

  00037	55		 push	 ebp
  00038	8b ec		 mov	 ebp, esp
  0003a	51		 push	 ecx

; 544  :     PADAPT      pAdapt =(PADAPT)ProtocolBindingContext;

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

⌨️ 快捷键说明

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