📄 pnp.cod
字号:
; 252 :
; 253 : pDevExt->NtNameForPort.Buffer = ExAllocatePool(PagedPool,
; 254 : deviceObjName.MaximumLength);
004b8 0f b7 45 f2 movzx eax, WORD PTR _deviceObjName$[ebp+2]
004bc 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
004c1 50 push eax
004c2 53 push ebx
004c3 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 255 :
; 256 : if (pDevExt->NtNameForPort.Buffer == NULL) {
004c9 85 c0 test eax, eax
004cb 89 46 74 mov DWORD PTR [esi+116], eax
004ce 75 24 jne SHORT $L14939
; 257 : SerialDump(SERERRORS, ("SerialAddDevice: Cannot allocate memory for "
; 258 : "NtName\n"));
004d0 bb 00 00 00 40 mov ebx, 1073741824 ; 40000000H
004d5 85 1d 00 00 00
00 test DWORD PTR _SerialDebugLevel, ebx
004db 74 0b je SHORT $L14941
004dd 68 00 00 00 00 push OFFSET FLAT:$SG14946
004e2 e8 00 00 00 00 call _DbgPrint
004e7 59 pop ecx
$L14941:
; 259 : status = STATUS_INSUFFICIENT_RESOURCES;
004e8 c7 45 f8 9a 00
00 c0 mov DWORD PTR _status$[ebp], -1073741670 ; c000009aH
004ef e9 8c fe ff ff jmp $L17396
$L14939:
; 260 : goto SerialCreateDevObjError;
; 261 : }
; 262 :
; 263 : pDevExt->NtNameForPort.MaximumLength = deviceObjName.MaximumLength;
004f4 66 8b 45 f2 mov ax, WORD PTR _deviceObjName$[ebp+2]
004f8 66 89 46 72 mov WORD PTR [esi+114], ax
; 264 : RtlAppendUnicodeStringToString(&pDevExt->NtNameForPort,
; 265 : &deviceObjName);
004fc 8d 45 f0 lea eax, DWORD PTR _deviceObjName$[ebp]
004ff 50 push eax
00500 8d 46 70 lea eax, DWORD PTR [esi+112]
00503 50 push eax
00504 ff d7 call edi
; 266 :
; 267 :
; 268 :
; 269 : //
; 270 : // Set up the device extension.
; 271 : //
; 272 :
; 273 : pDevExt->DeviceIsOpened = FALSE;
00506 80 a6 9d 01 00
00 00 and BYTE PTR [esi+413], 0
; 274 : pDevExt->DeviceObject = deviceObject;
0050d 8b 4d fc mov ecx, DWORD PTR _deviceObject$[ebp]
00510 8d 86 8c 00 00
00 lea eax, DWORD PTR [esi+140]
; 275 : pDevExt->DriverObject = DriverObject;
; 276 : pDevExt->DeviceObject = deviceObject;
; 277 : pDevExt->PowerState = PowerDeviceD0;
; 278 :
; 279 : pDevExt->TxFifoAmount = driverDefaults.TxFIFODefault;
; 280 : pDevExt->CreatedSymbolicLink = TRUE;
; 281 : pDevExt->OwnsPowerPolicy = TRUE;
; 282 :
; 283 : InitializeListHead(&pDevExt->CommonInterruptObject);
; 284 : InitializeListHead(&pDevExt->TopLevelSharers);
; 285 : InitializeListHead(&pDevExt->MultiportSiblings);
; 286 : InitializeListHead(&pDevExt->AllDevObjs);
; 287 : InitializeListHead(&pDevExt->ReadQueue);
; 288 : InitializeListHead(&pDevExt->WriteQueue);
; 289 : InitializeListHead(&pDevExt->MaskQueue);
; 290 : InitializeListHead(&pDevExt->PurgeQueue);
; 291 : InitializeListHead(&pDevExt->StalledIrpQueue);
; 292 :
; 293 : ExInitializeFastMutex(&pDevExt->OpenMutex);
00516 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__KeInitializeEvent@12
0051c 89 08 mov DWORD PTR [eax], ecx
0051e 8b 4d 08 mov ecx, DWORD PTR _DriverObject$[ebp]
00521 89 8e a8 04 00
00 mov DWORD PTR [esi+1192], ecx
00527 8b 4d fc mov ecx, DWORD PTR _deviceObject$[ebp]
0052a 89 08 mov DWORD PTR [eax], ecx
0052c 89 9e a4 04 00
00 mov DWORD PTR [esi+1188], ebx
00532 a1 18 00 00 00 mov eax, DWORD PTR _driverDefaults+24
00537 88 9e e1 01 00
00 mov BYTE PTR [esi+481], bl
0053d 89 86 50 01 00
00 mov DWORD PTR [esi+336], eax
00543 8d 46 10 lea eax, DWORD PTR [esi+16]
00546 89 46 14 mov DWORD PTR [esi+20], eax
00549 88 9e 74 05 00
00 mov BYTE PTR [esi+1396], bl
0054f 89 00 mov DWORD PTR [eax], eax
00551 8d 46 08 lea eax, DWORD PTR [esi+8]
00554 89 46 0c mov DWORD PTR [esi+12], eax
00557 89 9e 34 05 00
00 mov DWORD PTR [esi+1332], ebx
0055d 89 00 mov DWORD PTR [eax], eax
0055f 8d 46 18 lea eax, DWORD PTR [esi+24]
00562 89 46 1c mov DWORD PTR [esi+28], eax
00565 89 00 mov DWORD PTR [eax], eax
00567 8d 46 20 lea eax, DWORD PTR [esi+32]
0056a 89 46 24 mov DWORD PTR [esi+36], eax
0056d 89 00 mov DWORD PTR [eax], eax
0056f 8d 86 a4 00 00
00 lea eax, DWORD PTR [esi+164]
00575 89 86 a8 00 00
00 mov DWORD PTR [esi+168], eax
0057b 89 00 mov DWORD PTR [eax], eax
0057d 8d 86 ac 00 00
00 lea eax, DWORD PTR [esi+172]
00583 89 86 b0 00 00
00 mov DWORD PTR [esi+176], eax
00589 89 00 mov DWORD PTR [eax], eax
0058b 8d 86 b4 00 00
00 lea eax, DWORD PTR [esi+180]
00591 89 86 b8 00 00
00 mov DWORD PTR [esi+184], eax
00597 89 00 mov DWORD PTR [eax], eax
00599 8d 86 bc 00 00
00 lea eax, DWORD PTR [esi+188]
0059f 89 86 c0 00 00
00 mov DWORD PTR [esi+192], eax
005a5 89 00 mov DWORD PTR [eax], eax
005a7 8d 86 2c 05 00
00 lea eax, DWORD PTR [esi+1324]
005ad 89 86 30 05 00
00 mov DWORD PTR [esi+1328], eax
005b3 89 00 mov DWORD PTR [eax], eax
005b5 33 c0 xor eax, eax
005b7 89 86 38 05 00
00 mov DWORD PTR [esi+1336], eax
005bd 89 86 3c 05 00
00 mov DWORD PTR [esi+1340], eax
005c3 50 push eax
005c4 8d 86 40 05 00
00 lea eax, DWORD PTR [esi+1344]
005ca 53 push ebx
005cb 50 push eax
005cc ff d7 call edi
; 294 : ExInitializeFastMutex(&pDevExt->CloseMutex);
005ce 33 c0 xor eax, eax
005d0 89 9e 54 05 00
00 mov DWORD PTR [esi+1364], ebx
005d6 89 86 58 05 00
00 mov DWORD PTR [esi+1368], eax
005dc 89 86 5c 05 00
00 mov DWORD PTR [esi+1372], eax
005e2 50 push eax
005e3 8d 86 60 05 00
00 lea eax, DWORD PTR [esi+1376]
005e9 53 push ebx
005ea 50 push eax
005eb ff d7 call edi
; 295 :
; 296 : KeInitializeEvent(&pDevExt->PendingIRPEvent, SynchronizationEvent, FALSE);
005ed 6a 00 push 0
005ef 8d 86 d0 04 00
00 lea eax, DWORD PTR [esi+1232]
005f5 53 push ebx
005f6 50 push eax
005f7 ff d7 call edi
; 297 : KeInitializeEvent(&pDevExt->PendingDpcEvent, SynchronizationEvent, FALSE);
005f9 6a 00 push 0
005fb 8d 86 34 06 00
00 lea eax, DWORD PTR [esi+1588]
00601 53 push ebx
00602 50 push eax
00603 ff d7 call edi
; 298 : KeInitializeEvent(&pDevExt->PowerD0Event, SynchronizationEvent, FALSE);
00605 6a 00 push 0
00607 81 c6 1c 05 00
00 add esi, 1308 ; 0000051cH
0060d 53 push ebx
0060e 56 push esi
0060f ff d7 call edi
; 299 :
; 300 :
; 301 : deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
00611 8b 45 fc mov eax, DWORD PTR _deviceObject$[ebp]
00614 80 60 1c 7f and BYTE PTR [eax+28], 127 ; 0000007fH
; 302 :
; 303 : *NewDeviceObject = deviceObject;
00618 8b 45 0c mov eax, DWORD PTR _NewDeviceObject$[ebp]
0061b 8b 4d fc mov ecx, DWORD PTR _deviceObject$[ebp]
; 304 :
; 305 : ExFreePool(deviceObjName.Buffer);
0061e ff 75 f4 push DWORD PTR _deviceObjName$[ebp+4]
00621 89 08 mov DWORD PTR [eax], ecx
00623 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 306 :
; 307 : SerialDump (SERTRACECALLS,("SERIAL: Leave SerialCreateDevObj\n") );
00629 f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
00630 74 0b je SHORT $L14957
00632 68 00 00 00 00 push OFFSET FLAT:$SG14962
00637 e8 00 00 00 00 call _DbgPrint
0063c 59 pop ecx
$L14957:
; 308 : return STATUS_SUCCESS;
0063d 33 c0 xor eax, eax
$L14836:
0063f 5f pop edi
00640 5e pop esi
00641 5b pop ebx
; 340 : }
00642 c9 leave
00643 c2 08 00 ret 8
_SerialCreateDevObj@8 ENDP
PAGESRP0 ENDS
PUBLIC _SerialAddDevice@8
EXTRN __imp__IoAttachDeviceToDeviceStack@8:NEAR
; COMDAT _SerialAddDevice@8
PAGESRP0 SEGMENT
$SG15016 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG15019 DB 'f:\w2ddk\src\kernel\serial\pnp.c', 00H
ORG $+3
$SG15020 DB 'FALSE', 00H
ORG $+2
$SG15027 DB 'SERIAL: Enter SerialAddDevice with PPdo 0x%x', 0aH, 00H
ORG $+6
$SG15042 DB 'SerialAddDevice: Enumeration request, returning NO_MORE_'
DB 'ENTRIES', 0aH, 00H
ORG $+3
$SG15058 DB 'SerialAddDevice - error creating new devobj [%#08lx]', 0aH
DB 00H
ORG $+2
$SG15068 DB 'f:\w2ddk\src\kernel\serial\pnp.c', 00H
ORG $+3
$SG15069 DB 'pLowerDevObj != NULL', 00H
ORG $+3
$SG15076 DB 'SERIAL: Leave SerialAddDevice', 0aH, 00H
; Function compile flags: /Ogs
_DriverObject$ = 8
_PPdo$ = 12
_pNewDevObj$ = -4
_status$ = 12
_SerialAddDevice@8 PROC NEAR ; COMDAT
; 366 : {
0015f 55 push ebp
00160 8b ec mov ebp, esp
00162 51 push ecx
; 367 : PDEVICE_OBJECT pNewDevObj = NULL;
00163 83 65 fc 00 and DWORD PTR _pNewDevObj$[ebp], 0
00167 53 push ebx
00168 56 push esi
; 368 : PDEVICE_OBJECT pLowerDevObj = NULL;
; 369 : NTSTATUS status;
; 370 : PSERIAL_DEVICE_EXTENSION pDevExt;
; 371 :
; 372 : PAGED_CODE();
00169 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__KeGetCurrentIrql@0
0016f ff d6 call esi
00171 3c 01 cmp al, 1
00173 76 29 jbe SHORT $L15021
00175 ff d6 call esi
00177 0f b6 c0 movzx eax, al
0017a 50 push eax
0017b 68 00 00 00 00 push OFFSET FLAT:$SG15016
00180 e8 00 00 00 00 call _DbgPrint
00185 59 pop ecx
00186 59 pop ecx
00187 6a 00 push 0
00189 68 74 01 00 00 push 372 ; 00000174H
0018e 68 00 00 00 00 push OFFSET FLAT:$SG15019
00193 68 00 00 00 00 push OFFSET FLAT:$SG15020
00198 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15021:
; 373 :
; 374 : SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialAddDevice with PPdo "
; 375 : "0x%x\n", PPdo));
0019e f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
001a5 8b 5d 0c mov ebx, DWORD PTR _PPdo$[ebp]
001a8 74 0d je SHORT $L15022
001aa 53 push ebx
001ab 68 00 00 00 00 push OFFSET FLAT:$SG15027
001b0 e8 00 00 00 00 call _DbgPrint
001b5 59 pop ecx
001b6 59 pop ecx
$L15022:
; 376 :
; 377 : if (PPdo == NULL) {
001b7 85 db test ebx, ebx
001b9 75 1e jne SHORT $L15035
; 378 : //
; 379 : // Return no more devices
; 380 : //
; 381 :
; 382 : SerialDump(SERERRORS, ("SerialAddDevice: Enumeration request, returning"
; 383 : " NO_MORE_ENTRIES\n"));
001bb f6 05 03 00 00
00 40 test BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
001c2 74 0b je SHORT $L15037
001c4 68 00 00 00 00 push OFFSET FLAT:$SG15042
001c9 e8 00 00 00 00 call _DbgPrint
001ce 59 pop ecx
$L15037:
; 384 :
; 385 : return (STATUS_NO_MORE_ENTRIES);
001cf b8 1a 00 00 80 mov eax, -2147483622 ; 8000001aH
001d4 e9 84 00 00 00 jmp $L15008
$L15035:
; 386 : }
; 387 :
; 388 :
; 389 :
; 390 : //
; 391 : // create and initialize the new device object
; 392 : //
; 393 :
; 394 : status = SerialCreateDevObj(DriverObject, &pNewDevObj);
001d9 8d 45 fc lea eax, DWORD PTR _pNewDevObj$[ebp]
001dc 50 push eax
001dd ff 75 08 push DWORD PTR _DriverObject$[ebp]
001e0 e8 00 00 00 00 call _SerialCreateDevObj@8
001e5 8b f0 mov esi, eax
; 395 :
; 396 : if (!NT_SUCCESS(status)) {
001e7 85 f6 test esi, esi
001e9 89 75 0c mov DWORD PTR _status$[ebp], esi
001ec 7d 1a jge SHORT $L15051
; 397 :
; 398 : SerialDump(SERERRORS,
; 399 : ("SerialAddDevice - error creating new devobj [%#08lx]\n",
; 400 : status));
001ee f6 05 03 00 00
00 40 test BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
001f5 74 0d je SHORT $L15053
001f7 56 push esi
001f8 68 00 00 00 00 push OFFSET FLAT:$SG15058
001fd e8 00 00 00 00 call _DbgPrint
00202 59 pop ecx
00203 59 pop ecx
$L15053:
; 401 : return status;
00204 8b c6 mov eax, esi
00206 eb 55 jmp SHORT $L15008
$L15051:
; 402 : }
; 403 :
; 404 :
; 405 : //
; 406 : // Layer our DO on top of the lower device object
; 407 : // The return value is a pointer to the device object to which the
; 408 : // DO is actually attached.
; 409 : //
; 410 :
; 411 : pLowerDevObj = IoAttachDeviceToDeviceStack(pNewDevObj, PPdo);
00208 8b 75 fc mov esi, DWORD PTR _pNewDevObj$[ebp]
0020b 57 push edi
0020c 53 push ebx
0020d 56 push esi
0020e ff 15 00 00 00
00 call DWORD PTR __imp__IoAttachDeviceToDeviceStack@8
00214 8b f8 mov edi, eax
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -