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

📄 registry.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 2 页
字号:
  002de	eb 06		 jmp	 SHORT $L14801
$L14887:
  002e0	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__RtlWriteRegistryValue@24
$L14801:

; 184  : 
; 185  :     }
; 186  : 
; 187  :     if (DriverDefaultsPtr->RxFIFODefault == notThereDefault) {

  002e6	8b 4d fc	 mov	 ecx, DWORD PTR _notThereDefault$[ebp]
  002e9	8d 43 14	 lea	 eax, DWORD PTR [ebx+20]
  002ec	39 08		 cmp	 DWORD PTR [eax], ecx
  002ee	75 15		 jne	 SHORT $L14804

; 188  :         DriverDefaultsPtr->RxFIFODefault = SERIAL_RX_FIFO_DEFAULT;
; 189  :         RtlWriteRegistryValue(
; 190  :             RTL_REGISTRY_ABSOLUTE,
; 191  :             path,
; 192  :             L"RxFIFO",
; 193  :             REG_DWORD,
; 194  :             &DriverDefaultsPtr->RxFIFODefault,
; 195  :             sizeof(ULONG)
; 196  :             );

  002f0	56		 push	 esi
  002f1	50		 push	 eax
  002f2	56		 push	 esi
  002f3	68 00 00 00 00	 push	 OFFSET FLAT:$SG14806
  002f8	ff 75 0c	 push	 DWORD PTR _path$[ebp]
  002fb	c7 00 08 00 00
	00		 mov	 DWORD PTR [eax], 8
  00301	6a 00		 push	 0
  00303	ff d7		 call	 edi
$L14804:

; 197  :     }
; 198  : 
; 199  :     if (DriverDefaultsPtr->TxFIFODefault == notThereDefault) {

  00305	8b 4d fc	 mov	 ecx, DWORD PTR _notThereDefault$[ebp]
  00308	8d 43 18	 lea	 eax, DWORD PTR [ebx+24]
  0030b	39 08		 cmp	 DWORD PTR [eax], ecx
  0030d	75 15		 jne	 SHORT $L14807

; 200  : 
; 201  :         DriverDefaultsPtr->TxFIFODefault = SERIAL_TX_FIFO_DEFAULT;
; 202  :         RtlWriteRegistryValue(
; 203  :             RTL_REGISTRY_ABSOLUTE,
; 204  :             path,
; 205  :             L"TxFIFO",
; 206  :             REG_DWORD,
; 207  :             &DriverDefaultsPtr->TxFIFODefault,
; 208  :             sizeof(ULONG)
; 209  :             );

  0030f	56		 push	 esi
  00310	50		 push	 eax
  00311	56		 push	 esi
  00312	68 00 00 00 00	 push	 OFFSET FLAT:$SG14809
  00317	ff 75 0c	 push	 DWORD PTR _path$[ebp]
  0031a	c7 00 0e 00 00
	00		 mov	 DWORD PTR [eax], 14	; 0000000eH
  00320	6a 00		 push	 0
  00322	ff d7		 call	 edi
$L14807:

; 210  :     }
; 211  : 
; 212  : 
; 213  :     if (DriverDefaultsPtr->PermitShareDefault == notThereDefault) {

  00324	8b 4d fc	 mov	 ecx, DWORD PTR _notThereDefault$[ebp]
  00327	8d 43 1c	 lea	 eax, DWORD PTR [ebx+28]
  0032a	39 08		 cmp	 DWORD PTR [eax], ecx
  0032c	75 12		 jne	 SHORT $L14810

; 214  : 
; 215  :         DriverDefaultsPtr->PermitShareDefault = SERIAL_PERMIT_SHARE_DEFAULT;
; 216  :         //
; 217  :         // Only share if the user actual changes switch.
; 218  :         //
; 219  : 
; 220  :         RtlWriteRegistryValue(
; 221  :             RTL_REGISTRY_ABSOLUTE,
; 222  :             path,
; 223  :             L"PermitShare",
; 224  :             REG_DWORD,
; 225  :             &DriverDefaultsPtr->PermitShareDefault,
; 226  :             sizeof(ULONG)
; 227  :             );

  0032e	56		 push	 esi
  0032f	83 20 00	 and	 DWORD PTR [eax], 0
  00332	50		 push	 eax
  00333	56		 push	 esi
  00334	68 00 00 00 00	 push	 OFFSET FLAT:$SG14812
  00339	ff 75 0c	 push	 DWORD PTR _path$[ebp]
  0033c	6a 00		 push	 0
  0033e	ff d7		 call	 edi
$L14810:

; 228  : 
; 229  :     }
; 230  : 
; 231  : 
; 232  :     if (DriverDefaultsPtr->LogFifoDefault == notThereDefault) {

  00340	8b 4d fc	 mov	 ecx, DWORD PTR _notThereDefault$[ebp]
  00343	8d 43 24	 lea	 eax, DWORD PTR [ebx+36]
  00346	39 08		 cmp	 DWORD PTR [eax], ecx
  00348	75 19		 jne	 SHORT $L14813

; 233  : 
; 234  :         //
; 235  :         // Wasn't there.  After this load don't log
; 236  :         // the message anymore.  However this first
; 237  :         // time log the message.
; 238  :         //
; 239  : 
; 240  :         DriverDefaultsPtr->LogFifoDefault = SERIAL_LOG_FIFO_DEFAULT;
; 241  : 
; 242  :         RtlWriteRegistryValue(
; 243  :             RTL_REGISTRY_ABSOLUTE,
; 244  :             path,
; 245  :             L"LogFifo",
; 246  :             REG_DWORD,
; 247  :             &DriverDefaultsPtr->LogFifoDefault,
; 248  :             sizeof(ULONG)
; 249  :             );

  0034a	56		 push	 esi
  0034b	83 20 00	 and	 DWORD PTR [eax], 0
  0034e	50		 push	 eax
  0034f	56		 push	 esi
  00350	68 00 00 00 00	 push	 OFFSET FLAT:$SG14815
  00355	ff 75 0c	 push	 DWORD PTR _path$[ebp]
  00358	6a 00		 push	 0
  0035a	ff d7		 call	 edi

; 250  : 
; 251  :         DriverDefaultsPtr->LogFifoDefault = 1;

  0035c	c7 43 24 01 00
	00 00		 mov	 DWORD PTR [ebx+36], 1
$L14813:

; 252  : 
; 253  :     }
; 254  : 
; 255  :     //
; 256  :     // We don't need that path anymore.
; 257  :     //
; 258  : 
; 259  :     if (path) {
; 260  :         ExFreePool(path);

  00363	ff 75 0c	 push	 DWORD PTR _path$[ebp]
  00366	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 261  :     }
; 262  : 
; 263  :     //
; 264  :     //  Set the defaults for other values
; 265  :     //
; 266  :     DriverDefaultsPtr->PermitSystemWideShare = FALSE;

  0036c	83 63 20 00	 and	 DWORD PTR [ebx+32], 0

; 267  : 
; 268  :     return (Status);

  00370	8b 45 08	 mov	 eax, DWORD PTR _Status$[ebp]
  00373	5f		 pop	 edi
  00374	5b		 pop	 ebx
$L14770:
  00375	5e		 pop	 esi

; 269  : }

  00376	c9		 leave
  00377	c2 08 00	 ret	 8
_SerialGetConfigDefaults@8 ENDP
INIT	ENDS
PUBLIC	_SerialGetRegistryKeyValue@20
EXTRN	__imp__ZwQueryValueKey@24:NEAR
EXTRN	__imp__RtlInitUnicodeString@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGetRegistryKeyValue@20
PAGESRP0	SEGMENT
_Handle$ = 8
_KeyNameString$ = 12
_KeyNameStringLength$ = 16
_Data$ = 20
_DataLength$ = 24
_keyName$ = -12
_length$ = 12
_ntStatus$ = -4
_SerialGetRegistryKeyValue@20 PROC NEAR			; COMDAT

; 304  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 0c	 sub	 esp, 12			; 0000000cH
  00006	53		 push	 ebx
  00007	56		 push	 esi

; 305  :    UNICODE_STRING              keyName;
; 306  :    ULONG                       length;
; 307  :    PKEY_VALUE_FULL_INFORMATION fullInfo;
; 308  : 
; 309  :    NTSTATUS                    ntStatus = STATUS_INSUFFICIENT_RESOURCES;
; 310  : 
; 311  :    PAGED_CODE();
; 312  : 
; 313  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialGetRegistryKeyValue\n"));
; 314  : 
; 315  : 
; 316  :    RtlInitUnicodeString (&keyName, KeyNameString);

  00008	ff 75 0c	 push	 DWORD PTR _KeyNameString$[ebp]
  0000b	8d 45 f4	 lea	 eax, DWORD PTR _keyName$[ebp]
  0000e	c7 45 fc 9a 00
	00 c0		 mov	 DWORD PTR _ntStatus$[ebp], -1073741670 ; c000009aH
  00015	50		 push	 eax
  00016	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlInitUnicodeString@8

; 317  : 
; 318  :    length = sizeof(KEY_VALUE_FULL_INFORMATION) + KeyNameStringLength
; 319  :       + DataLength;

  0001c	8b 75 18	 mov	 esi, DWORD PTR _DataLength$[ebp]
  0001f	8b 45 10	 mov	 eax, DWORD PTR _KeyNameStringLength$[ebp]

; 320  :    fullInfo = ExAllocatePool(PagedPool, length); 

  00022	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  00027	8d 44 30 18	 lea	 eax, DWORD PTR [eax+esi+24]
  0002b	50		 push	 eax
  0002c	6a 01		 push	 1
  0002e	89 45 0c	 mov	 DWORD PTR _length$[ebp], eax
  00031	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12
  00037	8b d8		 mov	 ebx, eax

; 321  : 
; 322  :    if (fullInfo) {

  00039	85 db		 test	 ebx, ebx
  0003b	74 44		 je	 SHORT $L14837

; 323  :       ntStatus = ZwQueryValueKey (Handle,
; 324  :                                   &keyName,
; 325  :                                   KeyValueFullInformation,
; 326  :                                   fullInfo,
; 327  :                                   length,
; 328  :                                   &length);

  0003d	8d 45 0c	 lea	 eax, DWORD PTR _length$[ebp]
  00040	50		 push	 eax
  00041	8d 45 f4	 lea	 eax, DWORD PTR _keyName$[ebp]
  00044	ff 75 0c	 push	 DWORD PTR _length$[ebp]
  00047	53		 push	 ebx
  00048	6a 01		 push	 1
  0004a	50		 push	 eax
  0004b	ff 75 08	 push	 DWORD PTR _Handle$[ebp]
  0004e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ZwQueryValueKey@24

; 329  : 
; 330  :       if (NT_SUCCESS(ntStatus)) {

  00054	85 c0		 test	 eax, eax
  00056	89 45 fc	 mov	 DWORD PTR _ntStatus$[ebp], eax
  00059	7c 1f		 jl	 SHORT $L14840

; 331  :          //
; 332  :          // If there is enough room in the data buffer, copy the output
; 333  :          //
; 334  : 
; 335  :          if (DataLength >= fullInfo->DataLength) {

  0005b	8b 4b 0c	 mov	 ecx, DWORD PTR [ebx+12]
  0005e	3b f1		 cmp	 esi, ecx
  00060	72 18		 jb	 SHORT $L14840

; 336  :             RtlCopyMemory (Data, 
; 337  :                            ((PUCHAR) fullInfo) + fullInfo->DataOffset, 
; 338  :                            fullInfo->DataLength);

  00062	8b 73 08	 mov	 esi, DWORD PTR [ebx+8]
  00065	8b c1		 mov	 eax, ecx
  00067	57		 push	 edi
  00068	8b 7d 14	 mov	 edi, DWORD PTR _Data$[ebp]
  0006b	03 f3		 add	 esi, ebx
  0006d	c1 e9 02	 shr	 ecx, 2
  00070	f3 a5		 rep movsd
  00072	8b c8		 mov	 ecx, eax
  00074	83 e1 03	 and	 ecx, 3
  00077	f3 a4		 rep movsb
  00079	5f		 pop	 edi
$L14840:

; 339  :          }
; 340  :       }
; 341  : 
; 342  :       ExFreePool(fullInfo);

  0007a	53		 push	 ebx
  0007b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4
$L14837:

; 343  :    }
; 344  : 
; 345  :    return ntStatus;

  00081	8b 45 fc	 mov	 eax, DWORD PTR _ntStatus$[ebp]
  00084	5e		 pop	 esi
  00085	5b		 pop	 ebx

; 346  : }

  00086	c9		 leave
  00087	c2 14 00	 ret	 20			; 00000014H
_SerialGetRegistryKeyValue@20 ENDP
PAGESRP0	ENDS
PUBLIC	_SerialPutRegistryKeyValue@24
EXTRN	__imp__ZwSetValueKey@24:NEAR
EXTRN	__imp__RtlAppendUnicodeToString@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialPutRegistryKeyValue@24
PAGESRP0	SEGMENT
_Handle$ = 8
_PKeyNameString$ = 12
_KeyNameStringLength$ = 16
_Dtype$ = 20
_PData$ = 24
_DataLength$ = 28
_keyname$ = -8
_SerialPutRegistryKeyValue@24 PROC NEAR			; COMDAT

; 380  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	51		 push	 ecx

; 381  :    NTSTATUS status;
; 382  :    UNICODE_STRING keyname;
; 383  : 
; 384  :    PAGED_CODE();
; 385  : 
; 386  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialPutRegistryKeyValue\n"));
; 387  : 
; 388  :    RtlInitUnicodeString(&keyname, NULL);

  00005	8d 45 f8	 lea	 eax, DWORD PTR _keyname$[ebp]
  00008	6a 00		 push	 0
  0000a	50		 push	 eax
  0000b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlInitUnicodeString@8

; 389  :    keyname.MaximumLength = (USHORT)(KeyNameStringLength + sizeof(WCHAR));

  00011	8b 45 10	 mov	 eax, DWORD PTR _KeyNameStringLength$[ebp]

; 390  :    keyname.Buffer = ExAllocatePool(PagedPool, keyname.MaximumLength);

  00014	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  00019	83 c0 02	 add	 eax, 2
  0001c	66 89 45 fa	 mov	 WORD PTR _keyname$[ebp+2], ax
  00020	0f b7 c0	 movzx	 eax, ax
  00023	50		 push	 eax
  00024	6a 01		 push	 1
  00026	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12

; 391  : 
; 392  :    if (keyname.Buffer == NULL) {

  0002c	85 c0		 test	 eax, eax
  0002e	89 45 fc	 mov	 DWORD PTR _keyname$[ebp+4], eax
  00031	75 07		 jne	 SHORT $L14864

; 393  :       return STATUS_INSUFFICIENT_RESOURCES;

  00033	b8 9a 00 00 c0	 mov	 eax, -1073741670	; c000009aH
  00038	eb 34		 jmp	 SHORT $L14854
$L14864:
  0003a	56		 push	 esi

; 394  :    }
; 395  : 
; 396  :    RtlAppendUnicodeToString(&keyname, PKeyNameString);

  0003b	8d 45 f8	 lea	 eax, DWORD PTR _keyname$[ebp]
  0003e	ff 75 0c	 push	 DWORD PTR _PKeyNameString$[ebp]
  00041	50		 push	 eax
  00042	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAppendUnicodeToString@8

; 397  : 
; 398  :    status = ZwSetValueKey(Handle, &keyname, 0, Dtype, PData, DataLength);

  00048	ff 75 1c	 push	 DWORD PTR _DataLength$[ebp]
  0004b	8d 45 f8	 lea	 eax, DWORD PTR _keyname$[ebp]
  0004e	ff 75 18	 push	 DWORD PTR _PData$[ebp]
  00051	ff 75 14	 push	 DWORD PTR _Dtype$[ebp]
  00054	6a 00		 push	 0
  00056	50		 push	 eax
  00057	ff 75 08	 push	 DWORD PTR _Handle$[ebp]
  0005a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ZwSetValueKey@24

; 399  : 
; 400  :    ExFreePool(keyname.Buffer);

  00060	ff 75 fc	 push	 DWORD PTR _keyname$[ebp+4]
  00063	8b f0		 mov	 esi, eax
  00065	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 401  :    
; 402  :    return status;

  0006b	8b c6		 mov	 eax, esi
  0006d	5e		 pop	 esi
$L14854:

; 403  : }

  0006e	c9		 leave
  0006f	c2 18 00	 ret	 24			; 00000018H
_SerialPutRegistryKeyValue@24 ENDP
PAGESRP0	ENDS
END

⌨️ 快捷键说明

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