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

📄 power.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  0020e	59		 pop	 ecx
$L15222:

; 536  : 
; 537  :    ASSERT(pDevExt->LowerDeviceObject);

  0020f	8b 75 fc	 mov	 esi, DWORD PTR _pDevExt$[ebp]
  00212	83 be a0 04 00
	00 00		 cmp	 DWORD PTR [esi+1184], 0
  00219	75 17		 jne	 SHORT $L15234
  0021b	6a 00		 push	 0
  0021d	68 19 02 00 00	 push	 537			; 00000219H
  00222	68 00 00 00 00	 push	 OFFSET FLAT:$SG15236
  00227	68 00 00 00 00	 push	 OFFSET FLAT:$SG15237
  0022c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15234:

; 538  : 
; 539  :    //
; 540  :    // Set up completion to init device when it is on
; 541  :    //
; 542  : 
; 543  :    KeClearEvent(&pDevExt->PowerD0Event);

  00232	8d 86 1c 05 00
	00		 lea	 eax, DWORD PTR [esi+1308]
  00238	50		 push	 eax
  00239	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeClearEvent@4

; 544  : 
; 545  : 
; 546  :    IoCopyCurrentIrpStackLocationToNext(PIrp);

  0023f	8b 73 60	 mov	 esi, DWORD PTR [ebx+96]
  00242	6a 07		 push	 7
  00244	59		 pop	 ecx
  00245	8d 46 dc	 lea	 eax, DWORD PTR [esi-36]
  00248	8b f8		 mov	 edi, eax
  0024a	f3 a5		 rep movsd
  0024c	80 60 03 00	 and	 BYTE PTR [eax+3], 0

; 547  :    IoSetCompletionRoutine(PIrp, SerialSyncCompletion, &pDevExt->PowerD0Event,
; 548  :                           TRUE, TRUE, TRUE);

  00250	be 00 00 00 00	 mov	 esi, OFFSET FLAT:_SerialSyncCompletion@12
  00255	8b c6		 mov	 eax, esi
  00257	85 c0		 test	 eax, eax
  00259	75 16		 jne	 SHORT $L15245
  0025b	56		 push	 esi
  0025c	68 24 02 00 00	 push	 548			; 00000224H
  00261	68 00 00 00 00	 push	 OFFSET FLAT:$SG15247
  00266	68 00 00 00 00	 push	 OFFSET FLAT:$SG15248
  0026b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15245:
  00271	8b 43 60	 mov	 eax, DWORD PTR [ebx+96]
  00274	8b 4d fc	 mov	 ecx, DWORD PTR _pDevExt$[ebp]
  00277	83 e8 24	 sub	 eax, 36			; 00000024H
  0027a	89 70 1c	 mov	 DWORD PTR [eax+28], esi
  0027d	8d b1 1c 05 00
	00		 lea	 esi, DWORD PTR [ecx+1308]
  00283	89 70 20	 mov	 DWORD PTR [eax+32], esi
  00286	c6 40 03 e0	 mov	 BYTE PTR [eax+3], 224	; 000000e0H

; 549  : 
; 550  :    SerialDump(SERPNPPOWER, ("SERIAL: Calling next driver\n"));

  0028a	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  00291	74 0b		 je	 SHORT $L15253
  00293	68 00 00 00 00	 push	 OFFSET FLAT:$SG15258
  00298	e8 00 00 00 00	 call	 _DbgPrint
  0029d	59		 pop	 ecx
$L15253:

; 551  : 
; 552  :    status = PoCallDriver(pDevExt->LowerDeviceObject, PIrp);

  0029e	8b 7d fc	 mov	 edi, DWORD PTR _pDevExt$[ebp]
  002a1	53		 push	 ebx
  002a2	ff b7 a0 04 00
	00		 push	 DWORD PTR [edi+1184]
  002a8	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoCallDriver@8

; 553  : 
; 554  :    if (status == STATUS_PENDING) {

  002ae	3d 03 01 00 00	 cmp	 eax, 259		; 00000103H
  002b3	89 45 0c	 mov	 DWORD PTR _status$[ebp], eax
  002b6	75 43		 jne	 SHORT $L15266

; 555  :       SerialDump(SERPNPPOWER, ("SERIAL: Waiting for next driver\n"));

  002b8	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  002bf	74 0b		 je	 SHORT $L15268
  002c1	68 00 00 00 00	 push	 OFFSET FLAT:$SG15273
  002c6	e8 00 00 00 00	 call	 _DbgPrint
  002cb	59		 pop	 ecx
$L15268:

; 556  :       KeWaitForSingleObject (&pDevExt->PowerD0Event, Executive, KernelMode,
; 557  :                              FALSE, NULL);

  002cc	33 c0		 xor	 eax, eax
  002ce	50		 push	 eax
  002cf	50		 push	 eax
  002d0	50		 push	 eax
  002d1	50		 push	 eax
  002d2	56		 push	 esi
  002d3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeWaitForSingleObject@20
$L15283:

; 564  :       }
; 565  :    }
; 566  : 
; 567  :    if (!NT_SUCCESS(PIrp->IoStatus.Status)) {

  002d9	8b 73 18	 mov	 esi, DWORD PTR [ebx+24]
  002dc	85 f6		 test	 esi, esi
  002de	7d 3b		 jge	 SHORT $L15285

; 568  :       status = PIrp->IoStatus.Status;
; 569  :       PoStartNextPowerIrp(PIrp);

  002e0	53		 push	 ebx
  002e1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoStartNextPowerIrp@4

; 570  :       SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);

  002e7	32 d2		 xor	 dl, dl
  002e9	8b cb		 mov	 ecx, ebx
  002eb	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  002f1	57		 push	 edi
  002f2	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 571  :       return status;

  002f7	8b c6		 mov	 eax, esi
  002f9	eb 77		 jmp	 SHORT $L15198
$L15266:

; 558  :    } else {
; 559  :       if (!NT_SUCCESS(status)) {

  002fb	85 c0		 test	 eax, eax
  002fd	7d da		 jge	 SHORT $L15283

; 560  :          PIrp->IoStatus.Status = status;
; 561  :          PoStartNextPowerIrp(PIrp);

  002ff	53		 push	 ebx
  00300	89 43 18	 mov	 DWORD PTR [ebx+24], eax
  00303	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoStartNextPowerIrp@4

; 562  :          SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);

  00309	32 d2		 xor	 dl, dl
  0030b	8b cb		 mov	 ecx, ebx
  0030d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00313	57		 push	 edi
  00314	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 563  :          return status;

  00319	eb 54		 jmp	 SHORT $L15288
$L15285:

; 572  :    }
; 573  : 
; 574  :    //
; 575  :    // Restore the device
; 576  :    //
; 577  : 
; 578  :    pDevExt->PowerState = PowerDeviceD0;

  0031b	33 c0		 xor	 eax, eax
  0031d	40		 inc	 eax

; 579  : 
; 580  :    //
; 581  :    // Theoretically we could change states in the middle of processing
; 582  :    // the restore which would result in a bad PKINTERRUPT being used
; 583  :    // in SerialRestoreDeviceState().
; 584  :    //
; 585  : 
; 586  :    if (pDevExt->PNPState == SERIAL_PNP_STARTED) {

  0031e	39 87 e0 04 00
	00		 cmp	 DWORD PTR [edi+1248], eax
  00324	89 87 a4 04 00
	00		 mov	 DWORD PTR [edi+1188], eax
  0032a	75 06		 jne	 SHORT $L15286

; 587  :       SerialRestoreDeviceState(pDevExt);

  0032c	57		 push	 edi
  0032d	e8 00 00 00 00	 call	 _SerialRestoreDeviceState@4
$L15286:

; 588  :    }
; 589  : 
; 590  :    //
; 591  :    // Now that we are powered up, call PoSetPowerState
; 592  :    //
; 593  : 
; 594  :    PoSetPowerState(PDevObj, pIrpStack->Parameters.Power.Type,
; 595  :                    pIrpStack->Parameters.Power.State);

  00332	8b 45 f8	 mov	 eax, DWORD PTR _pIrpStack$[ebp]
  00335	ff 70 0c	 push	 DWORD PTR [eax+12]
  00338	ff 70 08	 push	 DWORD PTR [eax+8]
  0033b	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  0033e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoSetPowerState@12

; 596  : 
; 597  :    PoStartNextPowerIrp(PIrp);

  00344	53		 push	 ebx
  00345	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoStartNextPowerIrp@4

; 598  :    SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);

  0034b	32 d2		 xor	 dl, dl
  0034d	8b cb		 mov	 ecx, ebx
  0034f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00355	57		 push	 edi
  00356	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 599  : 
; 600  : 
; 601  :    SerialDump(SERTRACECALLS, ("SERIAL: Leaving SerialSetPowerD0\n"));

  0035b	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00362	74 0b		 je	 SHORT $L15288
  00364	68 00 00 00 00	 push	 OFFSET FLAT:$SG15293
  00369	e8 00 00 00 00	 call	 _DbgPrint
  0036e	59		 pop	 ecx
$L15288:

; 602  :    return status;

  0036f	8b 45 0c	 mov	 eax, DWORD PTR _status$[ebp]
$L15198:
  00372	5f		 pop	 edi
  00373	5e		 pop	 esi
  00374	5b		 pop	 ebx

; 603  : }

  00375	c9		 leave
  00376	c2 08 00	 ret	 8
_SerialSetPowerD0@8 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialGotoPowerState@12
EXTRN	__imp__KeInitializeEvent@12:NEAR
;	COMDAT _SerialGotoPowerState@12
PAGESRP0	SEGMENT
$SG15311 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15314 DB	'f:\w2ddk\src\kernel\serial\power.c', 00H
	ORG $+1
$SG15315 DB	'FALSE', 00H
	ORG $+2
$SG15322 DB	'SERIAL: In SerialGotoPowerState', 0aH, 00H
	ORG $+3
$SG15342 DB	'SERIAL: SerialGotoPowerState FAILED', 0aH, 00H
	ORG $+3
$SG15355 DB	'SERIAL: Leaving SerialGotoPowerState', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_DevPowerState$ = 16
_gotoPowEvent$ = -16
_SerialGotoPowerState@12 PROC NEAR			; COMDAT

; 631  : {

  000c6	55		 push	 ebp
  000c7	8b ec		 mov	 ebp, esp
  000c9	83 ec 10	 sub	 esp, 16			; 00000010H
  000cc	56		 push	 esi

; 632  :    KEVENT gotoPowEvent;
; 633  :    NTSTATUS status;
; 634  :    POWER_STATE powerState;
; 635  : 
; 636  :    PAGED_CODE();

  000cd	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000d3	57		 push	 edi
  000d4	ff d6		 call	 esi
  000d6	33 ff		 xor	 edi, edi
  000d8	3c 01		 cmp	 al, 1
  000da	76 28		 jbe	 SHORT $L15316
  000dc	ff d6		 call	 esi
  000de	0f b6 c0	 movzx	 eax, al
  000e1	50		 push	 eax
  000e2	68 00 00 00 00	 push	 OFFSET FLAT:$SG15311
  000e7	e8 00 00 00 00	 call	 _DbgPrint
  000ec	59		 pop	 ecx
  000ed	59		 pop	 ecx
  000ee	57		 push	 edi
  000ef	68 7c 02 00 00	 push	 636			; 0000027cH
  000f4	68 00 00 00 00	 push	 OFFSET FLAT:$SG15314
  000f9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15315
  000fe	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15316:

; 637  : 
; 638  :    SerialDump(SERTRACECALLS, ("SERIAL: In SerialGotoPowerState\n"));

  00104	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0010b	74 0b		 je	 SHORT $L15317
  0010d	68 00 00 00 00	 push	 OFFSET FLAT:$SG15322
  00112	e8 00 00 00 00	 call	 _DbgPrint
  00117	59		 pop	 ecx
$L15317:

; 639  : 
; 640  :    powerState.DeviceState = DevPowerState;
; 641  : 
; 642  :    KeInitializeEvent(&gotoPowEvent, SynchronizationEvent, FALSE);

  00118	57		 push	 edi
  00119	8d 45 f0	 lea	 eax, DWORD PTR _gotoPowEvent$[ebp]
  0011c	6a 01		 push	 1
  0011e	50		 push	 eax
  0011f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeInitializeEvent@12

; 643  : 
; 644  :    status = PoRequestPowerIrp(PDevObj, IRP_MN_SET_POWER, powerState,
; 645  :                               SerialSystemPowerCompletion, &gotoPowEvent,
; 646  :                               NULL);

  00125	8d 45 f0	 lea	 eax, DWORD PTR _gotoPowEvent$[ebp]
  00128	57		 push	 edi
  00129	50		 push	 eax
  0012a	68 00 00 00 00	 push	 OFFSET FLAT:_SerialSystemPowerCompletion@20
  0012f	ff 75 10	 push	 DWORD PTR _DevPowerState$[ebp]
  00132	6a 02		 push	 2
  00134	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  00137	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoRequestPowerIrp@24
  0013d	8b f0		 mov	 esi, eax

; 647  : 
; 648  :    if (status == STATUS_PENDING) {

  0013f	81 fe 03 01 00
	00		 cmp	 esi, 259		; 00000103H
  00145	75 10		 jne	 SHORT $L15331

; 649  :       KeWaitForSingleObject(&gotoPowEvent, Executive, KernelMode, FALSE, NULL);

  00147	57		 push	 edi
  00148	57		 push	 edi
  00149	57		 push	 edi
  0014a	8d 45 f0	 lea	 eax, DWORD PTR _gotoPowEvent$[ebp]
  0014d	57		 push	 edi
  0014e	50		 push	 eax
  0014f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeWaitForSingleObject@20

; 650  :       status = STATUS_SUCCESS;

  00155	33 f6		 xor	 esi, esi
$L15331:

; 651  :    }
; 652  : 
; 653  : #if DBG
; 654  :    if (!NT_SUCCESS(status)) {

  00157	3b f7		 cmp	 esi, edi
  00159	7d 14		 jge	 SHORT $L15338

; 655  :       SerialDump(SERPNPPOWER, ("SERIAL: SerialGotoPowerState FAILED\n"));

  0015b	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  00162	74 0b		 je	 SHORT $L15338
  00164	68 00 00 00 00	 push	 OFFSET FLAT:$SG15342
  00169	e8 00 00 00 00	 call	 _DbgPrint
  0016e	59		 pop	 ecx
$L15338:

; 656  :    }
; 657  : #endif
; 658  : 
; 659  :    SerialDump(SERTRACECALLS, ("SERIAL: Leaving SerialGotoPowerState\n"));

  0016f	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00176	74 0b		 je	 SHORT $L15350
  00178	68 00 00 00 00	 push	 OFFSET FLAT:$SG15355
  0017d	e8 00 00 00 00	 call	 _DbgPrint
  00182	59		 pop	 ecx
$L15350:

; 660  : 
; 661  :    return status;

  00183	8b c6		 mov	 eax, esi
  00185	5f		 pop	 edi
  00186	5e		 pop	 esi

; 662  : }

  00187	c9		 leave
  00188	c2 0c 00	 ret	 12			; 0000000cH
_SerialGotoPowerState@12 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialSendWaitWake@4
EXTRN	_SerialDisableUART@4:NEAR
EXTRN	_SerialDrainUART@8:NEAR
EXTRN	_SerialGetCharTime@4:NEAR
;	COMDAT _SerialSetPowerD3@8
PAGESRP0	SEGMENT
$SG15372 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15375 DB	'f:\w2ddk\src\kernel\serial\power.c', 00H
	ORG $+1
$SG15376 DB	'FALSE', 00H
	ORG $+2
$SG15383 DB	'SERIAL: In SerialSetPowerD3', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_PIrp$ = 12
_pIrpStack$ = 12
_charTime$15392 = -8
_SerialSetPowerD3@8 PROC NEAR				; COMDAT

; 687  : {

  00071	55		 push	 ebp
  00072	8b ec		 mov	 ebp, esp
  00074	51		 push	 ecx
  00075	51		 push	 ecx

; 688  :    NTSTATUS status = STATUS_SUCCESS;

⌨️ 快捷键说明

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