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

📄 initunlo.cod

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

  002bf	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  002c4	68 00 02 00 00	 push	 512			; 00000200H
  002c9	6a 01		 push	 1
  002cb	8b 46 18	 mov	 eax, DWORD PTR [esi+24]
  002ce	c7 46 34 00 00
	00 00		 mov	 DWORD PTR [esi+52], OFFSET FLAT:_SerialUnload@4
  002d5	c7 40 04 00 00
	00 00		 mov	 DWORD PTR [eax+4], OFFSET FLAT:_SerialAddDevice@8
  002dc	c7 46 5c 00 00
	00 00		 mov	 DWORD PTR [esi+92], OFFSET FLAT:_SerialFlush@8
  002e3	c7 46 48 00 00
	00 00		 mov	 DWORD PTR [esi+72], OFFSET FLAT:_SerialWrite@8
  002ea	c7 46 44 00 00
	00 00		 mov	 DWORD PTR [esi+68], OFFSET FLAT:_SerialRead@8
  002f1	c7 46 70 00 00
	00 00		 mov	 DWORD PTR [esi+112], OFFSET FLAT:_SerialIoControl@8
  002f8	c7 46 74 00 00
	00 00		 mov	 DWORD PTR [esi+116], OFFSET FLAT:_SerialInternalIoControl@8
  002ff	c7 46 38 00 00
	00 00		 mov	 DWORD PTR [esi+56], OFFSET FLAT:_SerialCreateOpen@8
  00306	c7 46 40 00 00
	00 00		 mov	 DWORD PTR [esi+64], OFFSET FLAT:_SerialClose@8
  0030d	c7 86 80 00 00
	00 00 00 00 00	 mov	 DWORD PTR [esi+128], OFFSET FLAT:_SerialCleanup@8
  00317	c7 86 a4 00 00
	00 00 00 00 00	 mov	 DWORD PTR [esi+164], OFFSET FLAT:_SerialPnpDispatch@8
  00321	c7 86 90 00 00
	00 00 00 00 00	 mov	 DWORD PTR [esi+144], OFFSET FLAT:_SerialPowerDispatch@8
  0032b	c7 46 4c 00 00
	00 00		 mov	 DWORD PTR [esi+76], OFFSET FLAT:_SerialQueryInformationFile@8
  00332	c7 46 50 00 00
	00 00		 mov	 DWORD PTR [esi+80], OFFSET FLAT:_SerialSetInformationFile@8
  00339	c7 86 94 00 00
	00 00 00 00 00	 mov	 DWORD PTR [esi+148], OFFSET FLAT:_SerialSystemControlDispatch@8
  00343	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12
  00349	8b f8		 mov	 edi, eax
  0034b	85 ff		 test	 edi, edi
  0034d	89 7d 08	 mov	 DWORD PTR _jensenBuffer$[ebp], edi
  00350	75 08		 jne	 SHORT $L14846

; 236  : 
; 237  :       //
; 238  :       // We couldn't allocate 512 bytes of paged pool.  If that's
; 239  :       // so, then it's likely that the least of this machine's problems
; 240  :       // is that it's a Jensen.
; 241  :       //
; 242  : 
; 243  :       jensenDetected = FALSE;

  00352	20 45 0f	 and	 BYTE PTR _jensenDetected$[ebp], al

; 244  : 
; 245  :    } else {

  00355	e9 a3 00 00 00	 jmp	 $L14867
$L14846:

; 246  : 
; 247  :       //
; 248  :       // Check to see if this is a Jensen alpha.  If it is, then
; 249  :       // we'll have to change the way we enable and disable interrupts
; 250  :       //
; 251  : 
; 252  :       jensenData.Length = 0;

  0035a	66 83 65 f4 00	 and	 WORD PTR _jensenData$[ebp], 0

; 253  :       jensenData.MaximumLength = 512;
; 254  :       jensenData.Buffer = (PWCHAR)&jensenBuffer[0];
; 255  :       RtlInitUnicodeString(
; 256  :                           &jensenValue,
; 257  :                           L"Jensen"
; 258  :                           );

  0035f	8d 45 ec	 lea	 eax, DWORD PTR _jensenValue$[ebp]
  00362	68 00 00 00 00	 push	 OFFSET FLAT:$SG14849
  00367	50		 push	 eax
  00368	66 c7 45 f6 00
	02		 mov	 WORD PTR _jensenData$[ebp+2], 512 ; 00000200H
  0036e	89 7d f8	 mov	 DWORD PTR _jensenData$[ebp+4], edi
  00371	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlInitUnicodeString@8

; 259  :       jensenTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT
; 260  :                              | RTL_QUERY_REGISTRY_REQUIRED;
; 261  :       jensenTable[0].Name = L"Identifier";
; 262  :       jensenTable[0].EntryContext = &jensenData;

  00377	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))) {

  0037a	6a 00		 push	 0
  0037c	89 45 c0	 mov	 DWORD PTR _jensenTable$[ebp+12], eax
  0037f	8d 45 b4	 lea	 eax, DWORD PTR _jensenTable$[ebp]
  00382	6a 00		 push	 0
  00384	50		 push	 eax
  00385	68 00 00 00 00	 push	 OFFSET FLAT:$SG14855
  0038a	68 00 00 00 80	 push	 -2147483648		; 80000000H
  0038f	c7 45 b8 24 00
	00 00		 mov	 DWORD PTR _jensenTable$[ebp+4], 36 ; 00000024H
  00396	c7 45 bc 00 00
	00 00		 mov	 DWORD PTR _jensenTable$[ebp+8], OFFSET FLAT:$SG14850
  0039d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlQueryRegistryValues@20
  003a3	85 c0		 test	 eax, eax
  003a5	7d 06		 jge	 SHORT $L14854
$L16517:

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

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

; 275  : 
; 276  :       } else {

  003ab	eb 2f		 jmp	 SHORT $L14859
$L14854:

; 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)) {

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

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

  003b2	76 f3		 jbe	 SHORT $L16517

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

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

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

  003ba	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  :                                                   );

  003c0	8d 45 ec	 lea	 eax, DWORD PTR _jensenValue$[ebp]
  003c3	6a 00		 push	 0
  003c5	50		 push	 eax
  003c6	8d 45 f4	 lea	 eax, DWORD PTR _jensenData$[ebp]
  003c9	83 c7 0c	 add	 edi, 12			; 0000000cH
  003cc	50		 push	 eax
  003cd	89 7d f8	 mov	 DWORD PTR _jensenData$[ebp+4], edi
  003d0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlEqualUnicodeString@12
  003d6	8b 7d 08	 mov	 edi, DWORD PTR _jensenBuffer$[ebp]
  003d9	88 45 0f	 mov	 BYTE PTR _jensenDetected$[ebp], al
$L14859:

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

  003dc	57		 push	 edi
  003dd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 302  : 
; 303  :    }
; 304  : 
; 305  :    if (jensenDetected) {

  003e3	80 7d 0f 00	 cmp	 BYTE PTR _jensenDetected$[ebp], 0
  003e7	74 14		 je	 SHORT $L14867

; 306  : 
; 307  :       SerialDump(
; 308  :                 SERDIAG1,
; 309  :                 ("SERIAL: Jensen Detected\n")
; 310  :                 );

  003e9	f6 05 00 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel, 1
  003f0	74 0b		 je	 SHORT $L14867
  003f2	68 00 00 00 00	 push	 OFFSET FLAT:$SG14871
  003f7	e8 00 00 00 00	 call	 _DbgPrint
  003fc	59		 pop	 ecx
$L14867:

; 311  : 
; 312  :    }
; 313  : 
; 314  :    driverDefaults.JensenDetected = jensenDetected;

  003fd	8a 45 0f	 mov	 al, BYTE PTR _jensenDetected$[ebp]

; 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);

  00400	bf 14 00 00 00	 mov	 edi, OFFSET FLAT:_SerialGlobals+20
  00405	8b cf		 mov	 ecx, edi
  00407	a2 48 00 00 00	 mov	 BYTE PTR _driverDefaults+72, al
  0040c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedIncrement@4

; 328  : #endif
; 329  :       (void)SerialEnumerateLegacy(DriverObject, RegistryPath, &driverDefaults);

  00412	68 00 00 00 00	 push	 OFFSET FLAT:_driverDefaults
  00417	53		 push	 ebx
  00418	56		 push	 esi
  00419	e8 00 00 00 00	 call	 _SerialEnumerateLegacy@12

; 330  : #if DBG
; 331  :       InterlockedDecrement(&SerialGlobals.PAGESER_Count);

  0041e	8b cf		 mov	 ecx, edi
  00420	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4
  00426	33 f6		 xor	 esi, esi
$L16515:

; 332  : #endif
; 333  :    }
; 334  : #endif // NO_LEGACY_DRIVERS
; 335  : 
; 336  :    //
; 337  :    // Unlock pageable text
; 338  :    //
; 339  :    MmUnlockPagableImageSection(lockPtr);

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

; 340  : 
; 341  :    return STATUS_SUCCESS;

  00431	8b c6		 mov	 eax, esi
  00433	5f		 pop	 edi
  00434	5e		 pop	 esi
  00435	5b		 pop	 ebx

; 342  : }

  00436	c9		 leave
  00437	c2 08 00	 ret	 8
_DriverEntry@8 ENDP
INIT	ENDS
PUBLIC	_SerialCleanLists@4
;	COMDAT _SerialCleanLists@4
_TEXT	SEGMENT
$SG14897 DB	'SERIAL: CLEAN: removing multiport isr ext', 0aH, 00H
	ORG $+1
$SG14913 DB	'SERIAL: CLEAN: Device is a sharer', 0aH, 00H
	ORG $+1
$SG14928 DB	'SERIAL: CLEAN: Transferring to siblings', 0aH, 00H
	ORG $+3
$SG14941 DB	'f:\w2ddk\src\kernel\serial\initunlo.c', 00H
	ORG $+2
$SG14942 DB	'IsListEmpty(&pNewRoot->TopLevelSharers)', 00H
$SG14956 DB	'SERIAL: CLEAN: Has multiport siblings', 0aH, 00H
	ORG $+1
$SG14972 DB	'SERIAL: CLEAN: Common intobj member', 0aH, 00H
	ORG $+3
$SG14984 DB	'f:\w2ddk\src\kernel\serial\initunlo.c', 00H
	ORG $+2
$SG14985 DB	'!IsListEmpty(&pDevExt->AllDevObjs)', 00H
; Function compile flags: /Ogs
_Context$ = 8
_pNewRoot$14921 = 8
_SerialCleanLists@4 PROC NEAR				; COMDAT

; 366  : {

  00167	55		 push	 ebp
  00168	8b ec		 mov	 ebp, esp
  0016a	56		 push	 esi

; 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) {

  0016b	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  0016e	57		 push	 edi
  0016f	80 be a3 01 00
	00 00		 cmp	 BYTE PTR [esi+419], 0
  00176	74 46		 je	 SHORT $L14905

; 374  :        PSERIAL_MULTIPORT_DISPATCH pDispatch
; 375  :           = (PSERIAL_MULTIPORT_DISPATCH)pDevExt->OurIsrContext;
; 376  : 
; 377  :        SerialDump(SERPNPPOWER,("SERIAL: CLEAN: removing multiport isr ext\n"));

  00178	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  0017f	8b be 94 00 00
	00		 mov	 edi, DWORD PTR [esi+148]
  00185	74 0b		 je	 SHORT $L14892
  00187	68 00 00 00 00	 push	 OFFSET FLAT:$SG14897
  0018c	e8 00 00 00 00	 call	 _DbgPrint
  00191	59		 pop	 ecx
$L14892:

; 378  : 
; 379  :        pDispatch->Extensions[pDevExt->PortIndex - 1] = NULL;

  00192	8d 86 c0 01 00
	00		 lea	 eax, DWORD PTR [esi+448]
  00198	8b 08		 mov	 ecx, DWORD PTR [eax]
  0019a	83 24 8f 00	 and	 DWORD PTR [edi+ecx*4], 0

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

  0019e	80 be c4 01 00
	00 00		 cmp	 BYTE PTR [esi+452], 0
  001a5	75 17		 jne	 SHORT $L14905

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

  001a7	8b 08		 mov	 ecx, DWORD PTR [eax]
  001a9	b0 01		 mov	 al, 1
  001ab	49		 dec	 ecx
  001ac	d2 e0		 shl	 al, cl
  001ae	f6 d0		 not	 al
  001b0	20 47 48	 and	 BYTE PTR [edi+72], al

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

  001b3	8b 86 d0 01 00
	00		 mov	 eax, DWORD PTR [esi+464]
  001b9	f7 d0		 not	 eax
  001bb	21 47 44	 and	 DWORD PTR [edi+68], eax
$L14905:

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

  001be	8d 7e 08	 lea	 edi, DWORD PTR [esi+8]
  001c1	39 3f		 cmp	 DWORD PTR [edi], edi
  001c3	0f 84 8a 00 00
	00		 je	 $L14947

; 388  : 
; 389  :       SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Device is a sharer\n"));

  001c9	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  001d0	74 0b		 je	 SHORT $L14908
  001d2	68 00 00 00 00	 push	 OFFSET FLAT:$SG14913
  001d7	e8 00 00 00 00	 call	 _DbgPrint
  001dc	59		 pop	 ecx
$L14908:
  001dd	53		 push	 ebx

; 390  : 
; 391  :       //
; 392  :       // If we have siblings, the first becomes the sharer
; 393  :       //
; 394  : 
; 395  :       if (!IsListEmpty(&pDevExt->MultiportSiblings)) {

  001de	8d 5e 18	 lea	 ebx, DWORD PTR [esi+24]
  001e1	39 1b		 cmp	 DWORD PTR [ebx], ebx
  001e3	74 4a		 je	 SHORT $L14920

; 396  :          PSERIAL_DEVICE_EXTENSION pNewRoot;
; 397  : 
; 398  :          SerialDump(SERPNPPOWER,("SERIAL: CLEAN: Transferring to siblings\n"));

  001e5	f6 05 01 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel+1, 1
  001ec	74 0b		 je	 SHORT $L14923
  001ee	68 00 00 00 00	 push	 OFFSET FLAT:$SG14928
  001f3	e8 00 00 00 00	 call	 _DbgPrint
  001f8	59		 pop	 ecx
$L14923:

; 399  : 
; 400  :          pNewRoot = CONTAINING_RECORD(pDevExt->MultiportSiblings.Flink,
; 401  :                                       SERIAL_DEVICE_EXTENSION,
; 402  :                                       MultiportSiblings);

  001f9	8b 03		 mov	 eax, DWORD PTR [ebx]
  001fb	83 e8 18	 sub	 eax, 24			; 00000018H
  001fe	89 45 08	 mov	 DWORD PTR _pNewRoot$14921[ebp], eax

; 403  : 
; 404  :          //
; 405  :          // He should not be on there already
; 406  :          //
; 407  : 
; 408  :          ASSERT(IsListEmpty(&pNewRoot->TopLevelSharers));

  00201	8d 58 08	 lea	 ebx, DWORD PTR [eax+8]
  00204	39 1b		 cmp	 DWORD PTR [ebx], ebx
  00206	74 1a		 je	 SHORT $L14939
  00208	6a 00		 push	 0
  0020a	68 98 01 00 00	 push	 408			; 00000198H
  0020f	68 00 00 00 00	 push	 OFFSET FLAT:$SG14941
  00214	68 00 00 00 00	 push	 OFFSET FLAT:$SG14942
  00219	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
  0021f	8b 45 08	 mov	 eax, DWORD PTR _pNewRoot$14921[ebp]

⌨️ 快捷键说明

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