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

📄 initunlo.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  001f9	8d 45 f4	 lea	 eax, DWORD PTR _jensenData$[ebp]

; 263  : 
; 264  :       if (!NT_SUCCESS(RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE
; 265  :                                              | RTL_REGISTRY_OPTIONAL,
; 266  :                                              L"\\REGISTRY\\MACHINE\\HARDWARE"
; 267  :                                              L"\\DESCRIPTION\\SYSTEM",
; 268  :                                              &jensenTable[0], NULL, NULL))) {

  001fc	6a 00		 push	 0
  001fe	89 45 c0	 mov	 DWORD PTR _jensenTable$[ebp+12], eax
  00201	8d 45 b4	 lea	 eax, DWORD PTR _jensenTable$[ebp]
  00204	6a 00		 push	 0
  00206	50		 push	 eax
  00207	68 00 00 00 00	 push	 OFFSET FLAT:$SG14795
  0020c	68 00 00 00 80	 push	 -2147483648		; 80000000H
  00211	c7 45 b8 24 00
	00 00		 mov	 DWORD PTR _jensenTable$[ebp+4], 36 ; 00000024H
  00218	c7 45 bc 00 00
	00 00		 mov	 DWORD PTR _jensenTable$[ebp+8], OFFSET FLAT:$SG14790
  0021f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlQueryRegistryValues@20
  00225	85 c0		 test	 eax, eax
  00227	7d 06		 jge	 SHORT $L14794
$L15838:

; 269  : 
; 270  :          //
; 271  :          // How odd, no identifer string! We'll it's probably not a jensen.
; 272  :          //
; 273  : 
; 274  :          jensenDetected = FALSE;

  00229	80 65 0f 00	 and	 BYTE PTR _jensenDetected$[ebp], 0

; 275  : 
; 276  :       } else {

  0022d	eb 2f		 jmp	 SHORT $L14799
$L14794:

; 277  : 
; 278  :          //
; 279  :          // Skip past the DEC-XX Portion of the name string.
; 280  :          // Be carful and make sure we have at least that much data.
; 281  :          //
; 282  : 
; 283  :          if (jensenData.Length <= (sizeof(WCHAR)*6)) {

  0022f	66 83 7d f4 0c	 cmp	 WORD PTR _jensenData$[ebp], 12 ; 0000000cH

; 284  : 
; 285  :             jensenDetected = FALSE;
; 286  : 
; 287  :          } else {

  00234	76 f3		 jbe	 SHORT $L15838

; 288  : 
; 289  :             jensenData.Length -= (sizeof(WCHAR)*6);

  00236	66 81 45 f4 f4
	ff		 add	 WORD PTR _jensenData$[ebp], 65524 ; 0000fff4H

; 290  :             jensenData.MaximumLength -= (sizeof(WCHAR)*6);

  0023c	66 81 45 f6 f4
	ff		 add	 WORD PTR _jensenData$[ebp+2], 65524 ; 0000fff4H

; 291  :             jensenData.Buffer = (PWCHAR)&jensenBuffer[sizeof(WCHAR)*6];
; 292  :             jensenDetected = RtlEqualUnicodeString(
; 293  :                                                   &jensenData,
; 294  :                                                   &jensenValue,
; 295  :                                                   FALSE
; 296  :                                                   );

  00242	8d 45 ec	 lea	 eax, DWORD PTR _jensenValue$[ebp]
  00245	6a 00		 push	 0
  00247	50		 push	 eax
  00248	8d 45 f4	 lea	 eax, DWORD PTR _jensenData$[ebp]
  0024b	83 c7 0c	 add	 edi, 12			; 0000000cH
  0024e	50		 push	 eax
  0024f	89 7d f8	 mov	 DWORD PTR _jensenData$[ebp+4], edi
  00252	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlEqualUnicodeString@12
  00258	8b 7d 08	 mov	 edi, DWORD PTR _jensenBuffer$[ebp]
  0025b	88 45 0f	 mov	 BYTE PTR _jensenDetected$[ebp], al
$L14799:

; 297  :          }
; 298  : 
; 299  :       }
; 300  : 
; 301  :       ExFreePool(jensenBuffer);

  0025e	57		 push	 edi
  0025f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4
  00265	8a 45 0f	 mov	 al, BYTE PTR _jensenDetected$[ebp]
$L14807:

; 302  : 
; 303  :    }
; 304  : 
; 305  :    if (jensenDetected) {
; 306  : 
; 307  :       SerialDump(
; 308  :                 SERDIAG1,
; 309  :                 ("SERIAL: Jensen Detected\n")
; 310  :                 );
; 311  : 
; 312  :    }
; 313  : 
; 314  :    driverDefaults.JensenDetected = jensenDetected;
; 315  : 
; 316  : #if !defined(NO_LEGACY_DRIVERS)
; 317  : 
; 318  : #define SerialDoLegacyConversion() (~0)
; 319  : 
; 320  :    //
; 321  :    // Enumerate and Initialize legacy devices if necessary.  This should go away
; 322  :    // and be done by setup.
; 323  :    //
; 324  : 
; 325  :    if (SerialDoLegacyConversion()) {
; 326  : #if DBG
; 327  :       InterlockedIncrement(&SerialGlobals.PAGESER_Count);
; 328  : #endif
; 329  :       (void)SerialEnumerateLegacy(DriverObject, RegistryPath, &driverDefaults);

  00268	68 00 00 00 00	 push	 OFFSET FLAT:_driverDefaults
  0026d	53		 push	 ebx
  0026e	56		 push	 esi
  0026f	a2 48 00 00 00	 mov	 BYTE PTR _driverDefaults+72, al
  00274	e8 00 00 00 00	 call	 _SerialEnumerateLegacy@12
  00279	33 f6		 xor	 esi, esi
$L15837:

; 330  : #if DBG
; 331  :       InterlockedDecrement(&SerialGlobals.PAGESER_Count);
; 332  : #endif
; 333  :    }
; 334  : #endif // NO_LEGACY_DRIVERS
; 335  : 
; 336  :    //
; 337  :    // Unlock pageable text
; 338  :    //
; 339  :    MmUnlockPagableImageSection(lockPtr);

  0027b	ff 75 fc	 push	 DWORD PTR _lockPtr$[ebp]
  0027e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__MmUnlockPagableImageSection@4

; 340  : 
; 341  :    return STATUS_SUCCESS;

  00284	8b c6		 mov	 eax, esi
  00286	5f		 pop	 edi
  00287	5e		 pop	 esi
  00288	5b		 pop	 ebx

; 342  : }

  00289	c9		 leave
  0028a	c2 08 00	 ret	 8
_DriverEntry@8 ENDP
INIT	ENDS
PUBLIC	_SerialCleanLists@4
; Function compile flags: /Ogsy
;	COMDAT _SerialCleanLists@4
_TEXT	SEGMENT
_Context$ = 8
_SerialCleanLists@4 PROC NEAR				; COMDAT

; 367  :    PSERIAL_DEVICE_EXTENSION pDevExt = (PSERIAL_DEVICE_EXTENSION)Context;
; 368  : 
; 369  :     //
; 370  :     // If we are a multiport device, remove our entry
; 371  :     //
; 372  : 
; 373  :     if (pDevExt->PortOnAMultiportCard) {

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	53		 push	 ebx
  00005	33 db		 xor	 ebx, ebx
  00007	56		 push	 esi
  00008	38 98 a3 01 00
	00		 cmp	 BYTE PTR [eax+419], bl
  0000e	74 30		 je	 SHORT $L14825

; 374  :        PSERIAL_MULTIPORT_DISPATCH pDispatch
; 375  :           = (PSERIAL_MULTIPORT_DISPATCH)pDevExt->OurIsrContext;

  00010	8b b0 94 00 00
	00		 mov	 esi, DWORD PTR [eax+148]

; 376  : 
; 377  :        SerialDump(SERPNPPOWER,("SERIAL: CLEAN: removing multiport isr ext\n"));
; 378  : 
; 379  :        pDispatch->Extensions[pDevExt->PortIndex - 1] = NULL;

  00016	8d 88 c0 01 00
	00		 lea	 ecx, DWORD PTR [eax+448]
  0001c	8b 11		 mov	 edx, DWORD PTR [ecx]
  0001e	89 1c 96	 mov	 DWORD PTR [esi+edx*4], ebx

; 380  : 
; 381  :        if (pDevExt->Indexed == FALSE) {

  00021	38 98 c4 01 00
	00		 cmp	 BYTE PTR [eax+452], bl
  00027	75 17		 jne	 SHORT $L14825

; 382  :           pDispatch->UsablePortMask &= ~(1 << (pDevExt->PortIndex - 1));

  00029	8b 09		 mov	 ecx, DWORD PTR [ecx]
  0002b	b2 01		 mov	 dl, 1
  0002d	49		 dec	 ecx
  0002e	d2 e2		 shl	 dl, cl
  00030	f6 d2		 not	 dl
  00032	20 56 48	 and	 BYTE PTR [esi+72], dl

; 383  :           pDispatch->MaskInverted &= ~(pDevExt->NewMaskInverted);

  00035	8b 88 d0 01 00
	00		 mov	 ecx, DWORD PTR [eax+464]
  0003b	f7 d1		 not	 ecx
  0003d	21 4e 44	 and	 DWORD PTR [esi+68], ecx
$L14825:

; 384  :        }
; 385  :     }
; 386  : 
; 387  :    if (!IsListEmpty(&pDevExt->TopLevelSharers)) {

  00040	8d 48 08	 lea	 ecx, DWORD PTR [eax+8]
  00043	39 09		 cmp	 DWORD PTR [ecx], ecx
  00045	74 3d		 je	 SHORT $L14843

; 388  : 
; 389  :       SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Device is a sharer\n"));
; 390  : 
; 391  :       //
; 392  :       // If we have siblings, the first becomes the sharer
; 393  :       //
; 394  : 
; 395  :       if (!IsListEmpty(&pDevExt->MultiportSiblings)) {

  00047	8d 50 18	 lea	 edx, DWORD PTR [eax+24]
  0004a	57		 push	 edi
  0004b	8b 3a		 mov	 edi, DWORD PTR [edx]
  0004d	3b fa		 cmp	 edi, edx
  0004f	74 10		 je	 SHORT $L14830

; 396  :          PSERIAL_DEVICE_EXTENSION pNewRoot;
; 397  : 
; 398  :          SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Transferring to siblings\n"));
; 399  : 
; 400  :          pNewRoot = CONTAINING_RECORD(pDevExt->MultiportSiblings.Flink,
; 401  :                                       SERIAL_DEVICE_EXTENSION,
; 402  :                                       MultiportSiblings);
; 403  : 
; 404  :          //
; 405  :          // He should not be on there already
; 406  :          //
; 407  : 
; 408  :          ASSERT(IsListEmpty(&pNewRoot->TopLevelSharers));
; 409  :          InsertTailList(&pDevExt->TopLevelSharers, &pNewRoot->TopLevelSharers);

  00051	8b 71 04	 mov	 esi, DWORD PTR [ecx+4]
  00054	8d 57 f0	 lea	 edx, DWORD PTR [edi-16]
  00057	89 77 f4	 mov	 DWORD PTR [edi-12], esi
  0005a	89 0a		 mov	 DWORD PTR [edx], ecx
  0005c	89 16		 mov	 DWORD PTR [esi], edx
  0005e	89 51 04	 mov	 DWORD PTR [ecx+4], edx
$L14830:

; 410  : 
; 411  :       }
; 412  : 
; 413  :       //
; 414  :       // Remove ourselves
; 415  :       //
; 416  : 
; 417  :       RemoveEntryList(&pDevExt->TopLevelSharers);

  00061	8b 70 0c	 mov	 esi, DWORD PTR [eax+12]
  00064	8b 11		 mov	 edx, DWORD PTR [ecx]
  00066	5f		 pop	 edi
  00067	89 16		 mov	 DWORD PTR [esi], edx
  00069	89 72 04	 mov	 DWORD PTR [edx+4], esi

; 418  :       InitializeListHead(&pDevExt->TopLevelSharers);

  0006c	89 48 0c	 mov	 DWORD PTR [eax+12], ecx
  0006f	89 09		 mov	 DWORD PTR [ecx], ecx

; 419  : 
; 420  :       //
; 421  :       // Now check the master list to see if anyone is left...
; 422  :       //
; 423  : 
; 424  :       if (!IsListEmpty(&pDevExt->CIsrSw->SharerList)) {

  00071	8b 88 c4 04 00
	00		 mov	 ecx, DWORD PTR [eax+1220]
  00077	83 c1 08	 add	 ecx, 8
  0007a	39 09		 cmp	 DWORD PTR [ecx], ecx
  0007c	74 06		 je	 SHORT $L14843

; 425  :          //
; 426  :          // Others are chained on this interrupt, so we don't want to
; 427  :          // disconnect it.
; 428  :          //
; 429  : 
; 430  :          pDevExt->Interrupt = NULL;

  0007e	89 98 a0 00 00
	00		 mov	 DWORD PTR [eax+160], ebx
$L14843:

; 431  :       }
; 432  :    }
; 433  : 
; 434  :    //
; 435  :    // If this is part of a multiport board and we still have
; 436  :    // siblings, remove us from that list
; 437  :    //
; 438  : 
; 439  :    if (!IsListEmpty(&pDevExt->MultiportSiblings)) {

  00084	8d 48 18	 lea	 ecx, DWORD PTR [eax+24]
  00087	8b 31		 mov	 esi, DWORD PTR [ecx]
  00089	3b f1		 cmp	 esi, ecx
  0008b	74 0d		 je	 SHORT $L14845

; 440  :       SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Has multiport siblings\n"));
; 441  :       RemoveEntryList(&pDevExt->MultiportSiblings);

  0008d	8b 50 1c	 mov	 edx, DWORD PTR [eax+28]
  00090	89 32		 mov	 DWORD PTR [edx], esi
  00092	89 56 04	 mov	 DWORD PTR [esi+4], edx

; 442  :       InitializeListHead(&pDevExt->MultiportSiblings);

  00095	89 48 1c	 mov	 DWORD PTR [eax+28], ecx
  00098	89 09		 mov	 DWORD PTR [ecx], ecx
$L14845:

; 443  :    }
; 444  : 
; 445  : 
; 446  :    if (!IsListEmpty(&pDevExt->CommonInterruptObject)) {

  0009a	8d 48 10	 lea	 ecx, DWORD PTR [eax+16]
  0009d	8b 31		 mov	 esi, DWORD PTR [ecx]
  0009f	3b f1		 cmp	 esi, ecx
  000a1	74 13		 je	 SHORT $L14851

; 447  : 
; 448  :       SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Common intobj member\n"));
; 449  : 
; 450  :       RemoveEntryList(&pDevExt->CommonInterruptObject);

  000a3	8b 50 14	 mov	 edx, DWORD PTR [eax+20]
  000a6	89 32		 mov	 DWORD PTR [edx], esi
  000a8	89 56 04	 mov	 DWORD PTR [esi+4], edx

; 451  :       InitializeListHead(&pDevExt->CommonInterruptObject);

  000ab	89 48 14	 mov	 DWORD PTR [eax+20], ecx
  000ae	89 09		 mov	 DWORD PTR [ecx], ecx

; 452  : 
; 453  :       //
; 454  :       // Others are sharing this interrupt object so we detach ourselves
; 455  :       // from it this way instead of disconnecting.
; 456  :       //
; 457  : 
; 458  :       pDevExt->Interrupt = NULL;

  000b0	89 98 a0 00 00
	00		 mov	 DWORD PTR [eax+160], ebx
$L14851:

; 459  :    }
; 460  : 
; 461  :    //
; 462  :    // AllDevObjs should never be empty since we have a sentinal
; 463  :    //
; 464  : 
; 465  :    ASSERT(!IsListEmpty(&pDevExt->AllDevObjs));
; 466  : 
; 467  :    RemoveEntryList(&pDevExt->AllDevObjs);

  000b6	8b 70 24	 mov	 esi, DWORD PTR [eax+36]
  000b9	8d 48 20	 lea	 ecx, DWORD PTR [eax+32]
  000bc	8b 11		 mov	 edx, DWORD PTR [ecx]
  000be	89 16		 mov	 DWORD PTR [esi], edx
  000c0	89 72 04	 mov	 DWORD PTR [edx+4], esi

; 468  :    InitializeListHead(&pDevExt->AllDevObjs);

  000c3	89 48 24	 mov	 DWORD PTR [eax+36], ecx
  000c6	5e		 pop	 esi
  000c7	89 09		 mov	 DWORD PTR [ecx], ecx

; 469  : 
; 470  :    return TRUE;

  000c9	b0 01		 mov	 al, 1
  000cb	5b		 pop	 ebx

; 471  : }

  000cc	c2 04 00	 ret	 4
_SerialCleanLists@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialReleaseResources@4
EXTRN	__imp__KeRemoveQueueDpc@4:NEAR
EXTRN	__imp__MmUnmapIoSpace@8:NEAR
EXTRN	__imp__KeSynchronizeExecution@12:NEAR
EXTRN	__imp_@InterlockedDecrement@4:NEAR
EXTRN	_SerialCancelTimer@8:NEAR
EXTRN	__imp__IoDisconnectInterrupt@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialReleaseResources@4
PAGESRP0	SEGMENT
_PDevExt$ = 8
_SerialReleaseResources@4 PROC NEAR			; COMDAT

; 492  : {

  00000	56		 push	 esi

; 493  :    PAGED_CODE();
; 494  : 
; 495  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialReleaseResources\n"));
; 496  : 
; 497  :    //
; 498  :    // Remove us from any lists we may be on
; 499  :    //
; 500  : 
; 501  :    if (PDevExt->Interrupt != NULL) {

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _PDevExt$[esp]
  00005	57		 push	 edi
  00006	8b 86 a0 00 00
	00		 mov	 eax, DWORD PTR [esi+160]
  0000c	85 c0		 test	 eax, eax

⌨️ 快捷键说明

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