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

📄 pnp.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:

; 412  : 
; 413  : 
; 414  :    //
; 415  :    // No status. Do the best we can.
; 416  :    //
; 417  :    ASSERT(pLowerDevObj != NULL);

  00216	85 ff		 test	 edi, edi
  00218	75 16		 jne	 SHORT $L15066
  0021a	50		 push	 eax
  0021b	68 a1 01 00 00	 push	 417			; 000001a1H
  00220	68 00 00 00 00	 push	 OFFSET FLAT:$SG15068
  00225	68 00 00 00 00	 push	 OFFSET FLAT:$SG15069
  0022a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15066:

; 418  : 
; 419  : 
; 420  :    pDevExt = pNewDevObj->DeviceExtension;

  00230	8b 46 28	 mov	 eax, DWORD PTR [esi+40]

; 421  :    pDevExt->LowerDeviceObject = pLowerDevObj;

  00233	89 b8 a0 04 00
	00		 mov	 DWORD PTR [eax+1184], edi

; 422  :    pDevExt->Pdo = PPdo;

  00239	89 98 80 05 00
	00		 mov	 DWORD PTR [eax+1408], ebx

; 423  : 
; 424  : 
; 425  : 
; 426  :    //
; 427  :    // Specify that this driver only supports buffered IO.  This basically
; 428  :    // means that the IO system copies the users data to and from
; 429  :    // system supplied buffers.
; 430  :    //
; 431  :    // Also specify that we are power pagable.
; 432  :    //
; 433  : 
; 434  :    pNewDevObj->Flags |= DO_BUFFERED_IO | DO_POWER_PAGABLE;

  0023f	66 81 4e 1c 04
	20		 or	 WORD PTR [esi+28], 8196	; 00002004H
  00245	5f		 pop	 edi

; 435  : 
; 436  :    SerialDump(SERTRACECALLS, ("SERIAL: Leave SerialAddDevice\n"));

  00246	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0024d	74 0b		 je	 SHORT $L15071
  0024f	68 00 00 00 00	 push	 OFFSET FLAT:$SG15076
  00254	e8 00 00 00 00	 call	 _DbgPrint
  00259	59		 pop	 ecx
$L15071:

; 437  : 
; 438  :    return status;

  0025a	8b 45 0c	 mov	 eax, DWORD PTR _status$[ebp]
$L15008:
  0025d	5e		 pop	 esi
  0025e	5b		 pop	 ebx

; 439  : }

  0025f	c9		 leave
  00260	c2 08 00	 ret	 8
_SerialAddDevice@8 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialStartDevice@8
PUBLIC	_SerialPnpDispatch@8
EXTRN	__imp__MmLockPagableSectionByHandle@4:NEAR
EXTRN	__imp__MmUnlockPagableImageSection@4:NEAR
EXTRN	__imp_@InterlockedIncrement@4:NEAR
EXTRN	_SerialGetRegistryKeyValue@20:NEAR
EXTRN	__imp_@InterlockedDecrement@4:NEAR
EXTRN	__imp__KeWaitForSingleObject@20:NEAR
EXTRN	_SerialIRPPrologue@8:NEAR
EXTRN	_SerialIRPEpilogue@4:NEAR
EXTRN	__imp__wcslen:NEAR
EXTRN	_SerialIoCallDriver@12:NEAR
EXTRN	_SerialRemoveDevObj@4:NEAR
EXTRN	_SerialReleaseResources@4:NEAR
EXTRN	_SerialKillPendingIrps@4:NEAR
EXTRN	__imp__IoOpenDeviceRegistryKey@16:NEAR
EXTRN	_SerialGotoPowerState@12:NEAR
EXTRN	__imp_@ExAcquireFastMutex@4:NEAR
EXTRN	__imp_@ExReleaseFastMutex@4:NEAR
EXTRN	_SerialDisableInterfacesResources@8:NEAR
EXTRN	_SerialSetDeviceFlags@16:NEAR
EXTRN	_SerialGlobals:BYTE
EXTRN	__imp_@IofCallDriver@8:NEAR
EXTRN	__imp_@IofCompleteRequest@8:NEAR
EXTRN	__imp__ZwClose@4:NEAR
;	COMDAT _SerialPnpDispatch@8
PAGESRP0	SEGMENT
$SG15094 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15097 DB	'f:\w2ddk\src\kernel\serial\pnp.c', 00H
	ORG $+3
$SG15098 DB	'FALSE', 00H
	ORG $+2
$SG15114 DB	'SERIAL: Got IRP_MN_QUERY_DEVICE_CAPABILITIES IRP', 0aH, 00H
	ORG $+2
$SG15135 DB	'f:\w2ddk\src\kernel\serial\pnp.c', 00H
	ORG $+3
$SG15136 DB	'(1) | (1) | (1) ? (SerialSyncCompletion) != NULL : TRUE', 00H
$SG15152 DB	'SERIAL: Mapping power capabilities', 0aH, 00H
$SG15168 DB	'  SERIAL: %d: %s <--> %s', 0aH, 00H
	ORG $+2
$SG15182 DB	'SERIAL: Got IRP_MN_QUERY_DEVICE_RELATIONS Irp', 0aH, 00H
	ORG $+1
$SG15270 DB	'------- Unknown Query', 0aH, 00H
	ORG $+1
$SG15256 DB	'------- TargetDeviceRelation Query', 0aH, 00H
$SG15242 DB	'------- RemovalRelations Query', 0aH, 00H
$SG15228 DB	'------- PowerRelations Query', 0aH, 00H
	ORG $+2
$SG15214 DB	'------- EjectionRelations Query', 0aH, 00H
	ORG $+3
$SG15200 DB	'------- BusRelations Query', 0aH, 00H
$SG15284 DB	'SERIAL: Got IRP_MN_QUERY_INTERFACE Irp', 0aH, 00H
$SG15298 DB	'SERIAL: Got IRP_MN_QUERY_RESOURCE_REQUIREMENTS Irp', 0aH
	DB	00H
$SG15313 DB	'SERIAL: Got IRP_MN_START_DEVICE Irp', 0aH, 00H
	ORG $+3
$SG15328 DB	'SERIAL: Got IRP_MN_READ_CONFIG Irp', 0aH, 00H
$SG15342 DB	'SERIAL: Got IRP_MN_WRITE_CONFIG Irp', 0aH, 00H
	ORG $+3
$SG15356 DB	'SERIAL: Got IRP_MN_EJECT Irp', 0aH, 00H
	ORG $+2
$SG15370 DB	'SERIAL: Got IRP_MN_SET_LOCK Irp', 0aH, 00H
	ORG $+3
$SG15389 DB	'SERIAL: Got IRP_MN_QUERY_ID Irp', 0aH, 00H
	ORG $+3
$SG15402 DB	'M', 00H, 'u', 00H, 'l', 00H, 't', 00H, 'i', 00H, 'p', 00H
	DB	'o', 00H, 'r', 00H, 't', 00H, 'D', 00H, 'e', 00H, 'v', 00H, 'i'
	DB	00H, 'c', 00H, 'e', 00H, 00H, 00H
$SG15405 DB	'*', 00H, 'P', 00H, 'N', 00H, 'P', 00H, '0', 00H, '5', 00H
	DB	'0', 00H, '2', 00H, 00H, 00H
	ORG $+2
$SG15406 DB	'*', 00H, 'P', 00H, 'N', 00H, 'P', 00H, '0', 00H, '5', 00H
	DB	'0', 00H, '1', 00H, 00H, 00H
	ORG $+2
$SG15437 DB	'SERIAL: ID is sole ID', 0aH, 00H
	ORG $+1
$SG15477 DB	'SERIAL: Got IRP_MN_FILTER_RESOURCE_REQUIREMENTS Irp', 0aH
	DB	00H
	ORG $+3
$SG15490 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15511 DB	'f:\w2ddk\src\kernel\serial\pnp.c', 00H
	ORG $+3
$SG15512 DB	'(1) | (1) | (1) ? (SerialSyncCompletion) != NULL : TRUE', 00H
$SG15527 DB	'------- Can''t filter NULL resources!', 0aH, 00H
	ORG $+2
$SG15538 DB	'M', 00H, 'u', 00H, 'l', 00H, 't', 00H, 'i', 00H, 'p', 00H
	DB	'o', 00H, 'r', 00H, 't', 00H, 'D', 00H, 'e', 00H, 'v', 00H, 'i'
	DB	00H, 'c', 00H, 'e', 00H, 00H, 00H
$SG15546 DB	'------- List has %x lists (including alternatives)', 0aH
	DB	00H
$SG15562 DB	'------- List has %x resources in it', 0aH, 00H
	ORG $+3
$SG15601 DB	'------- Sharing interrupt for device %x', 0aH, 00H
	ORG $+3
$SG15615 DB	'------- Globally sharing  interrupt for device %x', 0aH, 00H
	ORG $+1
$SG15585 DB	'------- Sharing I/O port for device %x', 0aH, 00H
$SG15650 DB	'SERIAL: Got IRP_MN_STOP_DEVICE Irp', 0aH, 00H
$SG15663 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15672 DB	'f:\w2ddk\src\kernel\serial\pnp.c', 00H
	ORG $+3
$SG15673 DB	'!pDevExt->PortOnAMultiportCard', 00H
	ORG $+1
$SG15686 DB	'SERIAL: Got IRP_MN_QUERY_STOP_DEVICE Irp', 0aH, 00H
	ORG $+2
$SG15699 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15714 DB	'------- failing; multiport node', 0aH, 00H
	ORG $+3
$SG15731 DB	'------- failing; device open', 0aH, 00H
	ORG $+2
$SG15752 DB	'SERIAL: Got IRP_MN_CANCEL_STOP_DEVICE Irp', 0aH, 00H
	ORG $+1
$SG15765 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15786 DB	'SERIAL: Got IRP_MN_CANCEL_REMOVE_DEVICE Irp', 0aH, 00H
	ORG $+3
$SG15799 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15820 DB	'SERIAL: Got IRP_MN_QUERY_REMOVE_DEVICE Irp', 0aH, 00H
$SG15833 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15848 DB	'------- failing; device open', 0aH, 00H
	ORG $+2
$SG15871 DB	'SERIAL: Got IRP_MN_SURPRISE_REMOVAL Irp', 0aH, 00H
	ORG $+3
$SG15884 DB	'------- for device %x', 0aH, 00H
	ORG $+1
$SG15903 DB	'SERIAL: Got IRP_MN_REMOVE_DEVICE Irp', 0aH, 00H
	ORG $+2
$SG15916 DB	'------- for device %x', 0aH, 00H
; Function compile flags: /Ogs
_pIdBuf$15378 = -36
_pPnpIdStr$15379 = 12
_isMulti$15381 = -20
_pnpKey$15382 = -24
_curStr$15410 = 8
_pnpKey$15459 = -28
_pResFiltEvent$15460 = 8
_isMulti$15461 = -12
_pReqList$15462 = -32
_pResList$15463 = 8
_j$15466 = -20
_gotISR$15468 = -16
_gotInt$15469 = 12
_listNum$15470 = -24
_PDevObj$ = 8
_PIrp$ = 12
_pDevExt$ = -8
_pLowerDevObj$ = -4
_pIrpStack$ = 12
_status$ = -4
_pQueryCapsEvent$15106 = 8
_cap$15107 = 8
_SerialPnpDispatch@8 PROC NEAR				; COMDAT

; 465  : {

  007fb	55		 push	 ebp
  007fc	8b ec		 mov	 ebp, esp
  007fe	83 ec 24	 sub	 esp, 36			; 00000024H

; 466  :    PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;

  00801	8b 45 08	 mov	 eax, DWORD PTR _PDevObj$[ebp]
  00804	53		 push	 ebx

; 467  :    PDEVICE_OBJECT pLowerDevObj = pDevExt->LowerDeviceObject;
; 468  :    PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(PIrp);

  00805	8b 5d 0c	 mov	 ebx, DWORD PTR _PIrp$[ebp]
  00808	56		 push	 esi
  00809	57		 push	 edi
  0080a	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  0080d	89 7d f8	 mov	 DWORD PTR _pDevExt$[ebp], edi
  00810	8b 87 a0 04 00
	00		 mov	 eax, DWORD PTR [edi+1184]
  00816	89 45 fc	 mov	 DWORD PTR _pLowerDevObj$[ebp], eax
  00819	8b 43 60	 mov	 eax, DWORD PTR [ebx+96]
  0081c	89 45 0c	 mov	 DWORD PTR _pIrpStack$[ebp], eax

; 469  :    NTSTATUS status;
; 470  :    PDEVICE_CAPABILITIES pDevCaps;
; 471  : 
; 472  :    PAGED_CODE();

  0081f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00825	3c 01		 cmp	 al, 1
  00827	76 2d		 jbe	 SHORT $L15095
  00829	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  0082f	0f b6 c0	 movzx	 eax, al
  00832	50		 push	 eax
  00833	68 00 00 00 00	 push	 OFFSET FLAT:$SG15094
  00838	e8 00 00 00 00	 call	 _DbgPrint
  0083d	59		 pop	 ecx
  0083e	59		 pop	 ecx
  0083f	6a 00		 push	 0
  00841	68 d8 01 00 00	 push	 472			; 000001d8H
  00846	68 00 00 00 00	 push	 OFFSET FLAT:$SG15097
  0084b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15098
  00850	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15095:

; 473  : 
; 474  :    if ((status = SerialIRPPrologue(PIrp, pDevExt)) != STATUS_SUCCESS) {

  00856	57		 push	 edi
  00857	53		 push	 ebx
  00858	e8 00 00 00 00	 call	 _SerialIRPPrologue@8
  0085d	33 c9		 xor	 ecx, ecx
  0085f	3b c1		 cmp	 eax, ecx
  00861	74 07		 je	 SHORT $L15100
$L17503:

; 490  :          PIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;

  00863	8b f0		 mov	 esi, eax
  00865	e9 00 0a 00 00	 jmp	 $L15843
$L15100:

; 475  :       SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 476  :       return status;
; 477  :    }
; 478  : 
; 479  :    switch (pIrpStack->MinorFunction) {

  0086a	8b 45 0c	 mov	 eax, DWORD PTR _pIrpStack$[ebp]
  0086d	0f b6 40 01	 movzx	 eax, BYTE PTR [eax+1]
  00871	83 f8 17	 cmp	 eax, 23			; 00000017H
  00874	0f 87 e4 01 00
	00		 ja	 $L15932
  0087a	ff 24 85 00 00
	00 00		 jmp	 DWORD PTR $L17506[eax*4]
$L15108:

; 480  :    case IRP_MN_QUERY_CAPABILITIES: {
; 481  :       PKEVENT pQueryCapsEvent;
; 482  :       SYSTEM_POWER_STATE cap;
; 483  : 
; 484  :       SerialDump(SERPNPPOWER, ("SERIAL: Got IRP_MN_QUERY_DEVICE_CAPABILITIES "
; 485  :                                "IRP\n"));

  00881	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  00888	74 0b		 je	 SHORT $L15109
  0088a	68 00 00 00 00	 push	 OFFSET FLAT:$SG15114
  0088f	e8 00 00 00 00	 call	 _DbgPrint
  00894	59		 pop	 ecx
$L15109:

; 486  : 
; 487  :       pQueryCapsEvent = ExAllocatePool(NonPagedPool, sizeof(KEVENT));

  00895	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  0089a	6a 10		 push	 16			; 00000010H
  0089c	6a 00		 push	 0
  0089e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12

; 488  : 
; 489  :       if (pQueryCapsEvent == NULL) {

  008a4	85 c0		 test	 eax, eax
  008a6	89 45 08	 mov	 DWORD PTR _pQueryCapsEvent$15106[ebp], eax
  008a9	75 0d		 jne	 SHORT $L15123
$L17505:

; 490  :          PIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;

  008ab	be 9a 00 00 c0	 mov	 esi, -1073741670	; c000009aH
$L17502:
  008b0	89 73 18	 mov	 DWORD PTR [ebx+24], esi
  008b3	e9 b2 09 00 00	 jmp	 $L15843
$L15123:

; 491  :          SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 492  :          return STATUS_INSUFFICIENT_RESOURCES;
; 493  :       }
; 494  : 
; 495  :       KeInitializeEvent(pQueryCapsEvent, SynchronizationEvent, FALSE);

  008b8	6a 00		 push	 0
  008ba	6a 01		 push	 1
  008bc	ff 75 08	 push	 DWORD PTR _pQueryCapsEvent$15106[ebp]
  008bf	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeInitializeEvent@12

; 496  : 
; 497  :       IoCopyCurrentIrpStackLocationToNext(PIrp);

  008c5	8b 73 60	 mov	 esi, DWORD PTR [ebx+96]
  008c8	6a 07		 push	 7
  008ca	59		 pop	 ecx
  008cb	8d 46 dc	 lea	 eax, DWORD PTR [esi-36]
  008ce	8b f8		 mov	 edi, eax
  008d0	f3 a5		 rep movsd
  008d2	80 60 03 00	 and	 BYTE PTR [eax+3], 0

; 498  :       IoSetCompletionRoutine(PIrp, SerialSyncCompletion, pQueryCapsEvent,
; 499  :                              TRUE, TRUE, TRUE);

  008d6	be 00 00 00 00	 mov	 esi, OFFSET FLAT:_SerialSyncCompletion@12
  008db	8b c6		 mov	 eax, esi
  008dd	33 ff		 xor	 edi, edi
  008df	85 c0		 test	 eax, eax
  008e1	75 16		 jne	 SHORT $L15133
  008e3	57		 push	 edi
  008e4	68 f3 01 00 00	 push	 499			; 000001f3H
  008e9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15135
  008ee	68 00 00 00 00	 push	 OFFSET FLAT:$SG15136
  008f3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15133:
  008f9	8b 43 60	 mov	 eax, DWORD PTR [ebx+96]

; 500  : 
; 501  :       status = IoCallDriver(pLowerDevObj, PIrp);

  008fc	8b 4d fc	 mov	 ecx, DWORD PTR _pLowerDevObj$[ebp]
  008ff	83 e8 24	 sub	 eax, 36			; 00000024H
  00902	8b d3		 mov	 edx, ebx
  00904	89 70 1c	 mov	 DWORD PTR [eax+28], esi
  00907	8b 75 08	 mov	 esi, DWORD PTR _pQueryCapsEvent$15106[ebp]
  0090a	89 70 20	 mov	 DWORD PTR [eax+32], esi
  0090d	c6 40 03 e0	 mov	 BYTE PTR [eax+3], 224	; 000000e0H
  00911	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCallDriver@8

; 502  : 
; 503  : 
; 504  :       //
; 505  :       // Wait for lower drivers to be done with the Irp
; 506  :       //
; 507  : 
; 508  :       if (status == STATUS_PENDING) {

  00917	3d 03 01 00 00	 cmp	 eax, 259		; 00000103H
  0091c	75 0b		 jne	 SHORT $L15141

; 509  :          KeWaitForSingleObject(pQueryCapsEvent, Executive, KernelMode, FALSE,
; 510  :                                NULL);

⌨️ 快捷键说明

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