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

📄 waitmask.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 3 页
字号:
; 298  :                         // it as pending.
; 299  :                         //
; 300  : 
; 301  :                         IoMarkIrpPending(Extension->CurrentMaskIrp);

  0009f	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  000a2	c7 45 f8 03 01
	00 00		 mov	 DWORD PTR _FirstStatus$[ebp], 259 ; 00000103H
  000a9	c6 45 ff 01	 mov	 BYTE PTR _SetFirstStatus$[ebp], 1
  000ad	80 48 03 01	 or	 BYTE PTR [eax+3], 1
$L14837:

; 302  : 
; 303  :                     }
; 304  : 
; 305  :                     //
; 306  :                     // There should never be a mask location when
; 307  :                     // there isn't a current wait irp.  At this point
; 308  :                     // there shouldn't be a current wait irp also.
; 309  :                     //
; 310  : 
; 311  :                     ASSERT(!Extension->IrpMaskLocation);
; 312  :                     ASSERT(!Extension->CurrentWaitIrp);
; 313  : 
; 314  :                     Extension->CurrentWaitIrp = Extension->CurrentMaskIrp;

  000b1	8b 07		 mov	 eax, DWORD PTR [edi]

; 315  :                     SERIAL_INIT_REFERENCE(Extension->CurrentWaitIrp);
; 316  :                     IoSetCancelRoutine(
; 317  :                         Extension->CurrentWaitIrp,
; 318  :                         SerialCancelWait
; 319  :                         );

  000b3	ba 00 00 00 00	 mov	 edx, OFFSET FLAT:_SerialCancelWait@8
  000b8	89 86 d4 00 00
	00		 mov	 DWORD PTR [esi+212], eax
  000be	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  000c1	89 58 10	 mov	 DWORD PTR [eax+16], ebx
  000c4	8b 8e d4 00 00
	00		 mov	 ecx, DWORD PTR [esi+212]
  000ca	83 c1 38	 add	 ecx, 56			; 00000038H
  000cd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8

; 320  : 
; 321  :                     //
; 322  :                     // Since the cancel routine has a reference to
; 323  :                     // the irp we need to update the reference
; 324  :                     // count.
; 325  :                     //
; 326  : 
; 327  :                     SERIAL_SET_REFERENCE(
; 328  :                         Extension->CurrentWaitIrp,
; 329  :                         SERIAL_REF_CANCEL
; 330  :                         );

  000d3	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]

; 331  : 
; 332  :                     KeSynchronizeExecution(
; 333  :                         Extension->Interrupt,
; 334  :                         SerialGiveWaitToIsr,
; 335  :                         Extension
; 336  :                         );

  000d9	56		 push	 esi
  000da	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGiveWaitToIsr@4
  000df	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  000e2	83 c0 10	 add	 eax, 16			; 00000010H
  000e5	83 08 02	 or	 DWORD PTR [eax], 2
  000e8	ff b6 a0 00 00
	00		 push	 DWORD PTR [esi+160]
  000ee	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 337  : 
; 338  :                     //
; 339  :                     // Since it isn't really the mask irp anymore,
; 340  :                     // null out that pointer.
; 341  :                     //
; 342  : 
; 343  :                     Extension->CurrentMaskIrp = NULL;
; 344  : 
; 345  :                     //
; 346  :                     // This will release the cancel spinlock for us
; 347  :                     //
; 348  : 
; 349  :                     SerialGetNextIrpLocked(
; 350  :                         &Extension->CurrentMaskIrp,
; 351  :                         &Extension->MaskQueue,
; 352  :                         &NewIrp,
; 353  :                         FALSE,
; 354  :                         Extension,
; 355  :                         OldIrql
; 356  :                         );

  000f4	ff 75 f4	 push	 DWORD PTR _OldIrql$14819[ebp]
  000f7	8d 45 08	 lea	 eax, DWORD PTR _NewIrp$[ebp]
  000fa	89 1f		 mov	 DWORD PTR [edi], ebx
  000fc	56		 push	 esi
  000fd	53		 push	 ebx
  000fe	50		 push	 eax
  000ff	8d 86 b4 00 00
	00		 lea	 eax, DWORD PTR [esi+180]
  00105	50		 push	 eax
  00106	57		 push	 edi
  00107	e8 00 00 00 00	 call	 _SerialGetNextIrpLocked@24

; 357  :                     SerialDump(
; 358  :                         SERDIAG4,
; 359  :                         ("SERIAL: Perhaps another mask irp was found in the queue\n"
; 360  :                          "------- %x/%x <- values should be the same\n",
; 361  :                          Extension->CurrentMaskIrp,NewIrp)
; 362  :                         );

  0010c	eb 28		 jmp	 SHORT $L14858
$L14806:

; 185  : 
; 186  :                 SerialDump(
; 187  :                     SERDIAG4,
; 188  :                     ("SERIAL: WaitIrp is invalid\n"
; 189  :                      "------- IsrWaitMask: %x\n"
; 190  :                      "------- CurrentWaitIrp: %x\n",
; 191  :                      Extension->IsrWaitMask,
; 192  :                      Extension->CurrentWaitIrp)
; 193  :                     );
; 194  : 
; 195  :                 Extension->CurrentMaskIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;
; 196  : 
; 197  :                 if (!SetFirstStatus) {

  0010e	38 5d ff	 cmp	 BYTE PTR _SetFirstStatus$[ebp], bl
  00111	b9 0d 00 00 c0	 mov	 ecx, -1073741811	; c000000dH
  00116	89 48 18	 mov	 DWORD PTR [eax+24], ecx
  00119	75 07		 jne	 SHORT $L14810

; 198  : 
; 199  :                     SerialDump(
; 200  :                         SERDIAG4,
; 201  :                         ("SERIAL: %x was the first irp processed by this\n"
; 202  :                          "------- invocation of startmask\n",Extension->CurrentMaskIrp)
; 203  :                         );
; 204  :                     FirstStatus = STATUS_INVALID_PARAMETER;

  0011b	89 4d f8	 mov	 DWORD PTR _FirstStatus$[ebp], ecx
$L15008:

; 205  :                     SetFirstStatus = TRUE;

  0011e	c6 45 ff 01	 mov	 BYTE PTR _SetFirstStatus$[ebp], 1
$L14810:

; 206  : 
; 207  :                 }
; 208  : 
; 209  :                 SerialGetNextIrp(
; 210  :                     &Extension->CurrentMaskIrp,
; 211  :                     &Extension->MaskQueue,
; 212  :                     &NewIrp,
; 213  :                     TRUE,
; 214  :                     Extension
; 215  :                     );

  00122	56		 push	 esi
  00123	8d 45 08	 lea	 eax, DWORD PTR _NewIrp$[ebp]
  00126	6a 01		 push	 1
  00128	50		 push	 eax
  00129	8d 86 b4 00 00
	00		 lea	 eax, DWORD PTR [esi+180]
  0012f	50		 push	 eax
  00130	57		 push	 edi
  00131	e8 00 00 00 00	 call	 _SerialGetNextIrp@20
$L14858:

; 363  : 
; 364  :                 }
; 365  : 
; 366  :             }
; 367  : 
; 368  :         }
; 369  : 
; 370  :     } while (NewIrp);

  00136	39 5d 08	 cmp	 DWORD PTR _NewIrp$[ebp], ebx
  00139	0f 85 d8 fe ff
	ff		 jne	 $L14784

; 371  : 
; 372  :     return FirstStatus;

  0013f	8b 45 f8	 mov	 eax, DWORD PTR _FirstStatus$[ebp]
  00142	5f		 pop	 edi
  00143	5e		 pop	 esi
  00144	5b		 pop	 ebx

; 373  : 
; 374  : }

  00145	c9		 leave
  00146	c2 04 00	 ret	 4
_SerialStartMask@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialGrabWaitFromIsr@4
; Function compile flags: /Ogsy
;	COMDAT _SerialGrabWaitFromIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialGrabWaitFromIsr@4 PROC NEAR			; COMDAT

; 404  : 
; 405  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 406  :     SERIAL_LOCKED_PAGED_CODE();
; 407  : 
; 408  :     SerialDump(
; 409  :         SERDIAG3,
; 410  :         ("SERIAL: In SerialGrabWaitFromIsr\n")
; 411  :         );
; 412  : 
; 413  :     if (Extension->IrpMaskLocation) {

  00000	8b 54 24 04	 mov	 edx, DWORD PTR _Context$[esp-4]
  00004	8d 82 18 01 00
	00		 lea	 eax, DWORD PTR [edx+280]
  0000a	8b 08		 mov	 ecx, DWORD PTR [eax]
  0000c	85 c9		 test	 ecx, ecx
  0000e	74 20		 je	 SHORT $L14874

; 414  : 
; 415  :         SerialDump(
; 416  :             SERDIAG4,
; 417  :             ("SERIAL: The isr still owns the irp %x, mask location is %x\n"
; 418  :              "------- and system buffer is %x\n",
; 419  :              Extension->CurrentWaitIrp,Extension->IrpMaskLocation,
; 420  :              Extension->CurrentWaitIrp->AssociatedIrp.SystemBuffer)
; 421  :             );
; 422  : 
; 423  :         //
; 424  :         // The isr still "owns" the irp.
; 425  :         //
; 426  : 
; 427  :         *Extension->IrpMaskLocation = 0;

  00010	83 21 00	 and	 DWORD PTR [ecx], 0

; 428  :         Extension->IrpMaskLocation = NULL;

  00013	83 20 00	 and	 DWORD PTR [eax], 0

; 429  : 
; 430  :         Extension->CurrentWaitIrp->IoStatus.Information = sizeof(ULONG);

  00016	8d 82 d4 00 00
	00		 lea	 eax, DWORD PTR [edx+212]
  0001c	8b 08		 mov	 ecx, DWORD PTR [eax]
  0001e	c7 41 1c 04 00
	00 00		 mov	 DWORD PTR [ecx+28], 4

; 431  : 
; 432  :         //
; 433  :         // Since the isr no longer references the irp we need to
; 434  :         // decrement the reference count.
; 435  :         //
; 436  : 
; 437  :         SERIAL_CLEAR_REFERENCE(
; 438  :             Extension->CurrentWaitIrp,
; 439  :             SERIAL_REF_ISR
; 440  :             );

  00025	8b 00		 mov	 eax, DWORD PTR [eax]
  00027	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0002a	83 c0 10	 add	 eax, 16			; 00000010H
  0002d	83 20 fe	 and	 DWORD PTR [eax], -2	; fffffffeH
$L14874:

; 441  : 
; 442  :     }
; 443  : 
; 444  :     return FALSE;

  00030	32 c0		 xor	 al, al

; 445  : }

  00032	c2 04 00	 ret	 4
_SerialGrabWaitFromIsr@4 ENDP
PAGESER	ENDS
EXTRN	_SerialInsertQueueDpc@16:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGiveWaitToIsr@4
PAGESER	SEGMENT
_Context$ = 8
_SerialGiveWaitToIsr@4 PROC NEAR			; COMDAT

; 475  : 
; 476  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 477  :     SERIAL_LOCKED_PAGED_CODE();
; 478  : 
; 479  :     SerialDump(
; 480  :         SERDIAG3,
; 481  :         ("SERIAL: In SerialGiveWaitToIsr\n")
; 482  :         );
; 483  :     //
; 484  :     // There certainly shouldn't be a current mask location at
; 485  :     // this point since we have a new current wait irp.
; 486  :     //
; 487  : 
; 488  :     ASSERT(!Extension->IrpMaskLocation);
; 489  : 
; 490  :     //
; 491  :     // The isr may or may not actually reference this irp.  It
; 492  :     // won't if the wait can be satisfied immediately.  However,
; 493  :     // since it will then go through the normal completion sequence,
; 494  :     // we need to have an incremented reference count anyway.
; 495  :     //
; 496  : 
; 497  :     SERIAL_SET_REFERENCE(
; 498  :         Extension->CurrentWaitIrp,
; 499  :         SERIAL_REF_ISR
; 500  :         );

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]

; 501  : 
; 502  :     if (!Extension->HistoryMask) {

  00004	33 d2		 xor	 edx, edx
  00006	8b 88 d4 00 00
	00		 mov	 ecx, DWORD PTR [eax+212]
  0000c	8b 49 60	 mov	 ecx, DWORD PTR [ecx+96]
  0000f	83 c1 10	 add	 ecx, 16			; 00000010H
  00012	83 09 01	 or	 DWORD PTR [ecx], 1
  00015	8b 88 14 01 00
	00		 mov	 ecx, DWORD PTR [eax+276]
  0001b	3b ca		 cmp	 ecx, edx
  0001d	75 17		 jne	 SHORT $L14899

; 503  : 
; 504  :         SerialDump(
; 505  :             SERDIAG4,
; 506  :             ("SERIAL: No events occured prior to the wait call\n")
; 507  :             );
; 508  : 
; 509  :         //
; 510  :         // Although this wait might not be for empty transmit
; 511  :         // queue, it doesn't hurt anything to set it to false.
; 512  :         //
; 513  : 
; 514  :         Extension->EmptiedTransmit = FALSE;
; 515  : 
; 516  :         //
; 517  :         // Record where the "completion mask" should be set.
; 518  :         //

⌨️ 快捷键说明

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