📄 registry.cod
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.00.9044.0
TITLE F:\W2DDK\src\kernel\serial\registry.c
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS ENDS
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
$$TYPES ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
INIT SEGMENT PARA USE32 PUBLIC ''
INIT ENDS
; COMDAT _RtlConvertLongToLargeInteger@4
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _SerialGetConfigDefaults@8
INIT SEGMENT PARA USE32 PUBLIC ''
INIT ENDS
; COMDAT _SerialGetRegistryKeyValue@20
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialPutRegistryKeyValue@24
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
INCLUDELIB LIBC
INCLUDELIB OLDNAMES
PUBLIC _SerialGetConfigDefaults@8
EXTRN __imp__memmove:NEAR
EXTRN __imp__KeGetCurrentIrql@0:NEAR
EXTRN __imp__RtlAssert@16:NEAR
EXTRN __imp__RtlQueryRegistryValues@20:NEAR
EXTRN __imp__RtlWriteRegistryValue@24:NEAR
EXTRN __imp__ExAllocatePoolWithTag@12:NEAR
EXTRN __imp__ExFreePool@4:NEAR
EXTRN _DbgPrint:NEAR
; COMDAT _SerialGetConfigDefaults@8
; File f:\w2ddk\src\kernel\serial\registry.c
INIT SEGMENT
$SG14817 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG14820 DB 'f:\w2ddk\src\kernel\serial\registry.c', 00H
ORG $+2
$SG14821 DB 'FALSE', 00H
ORG $+2
$SG14827 DB 'B', 00H, 'r', 00H, 'e', 00H, 'a', 00H, 'k', 00H, 'O', 00H
DB 'n', 00H, 'E', 00H, 'n', 00H, 't', 00H, 'r', 00H, 'y', 00H, 00H
DB 00H
ORG $+2
$SG14829 DB 'D', 00H, 'e', 00H, 'b', 00H, 'u', 00H, 'g', 00H, 'L', 00H
DB 'e', 00H, 'v', 00H, 'e', 00H, 'l', 00H, 00H, 00H
ORG $+2
$SG14831 DB 'F', 00H, 'o', 00H, 'r', 00H, 'c', 00H, 'e', 00H, 'F', 00H
DB 'i', 00H, 'f', 00H, 'o', 00H, 'E', 00H, 'n', 00H, 'a', 00H, 'b'
DB 00H, 'l', 00H, 'e', 00H, 00H, 00H
$SG14833 DB 'R', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG14835 DB 'T', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG14837 DB 'P', 00H, 'e', 00H, 'r', 00H, 'm', 00H, 'i', 00H, 't', 00H
DB 'S', 00H, 'h', 00H, 'a', 00H, 'r', 00H, 'e', 00H, 00H, 00H
$SG14839 DB 'L', 00H, 'o', 00H, 'g', 00H, 'F', 00H, 'i', 00H, 'f', 00H
DB 'o', 00H, 00H, 00H
$SG14847 DB 'F', 00H, 'o', 00H, 'r', 00H, 'c', 00H, 'e', 00H, 'F', 00H
DB 'i', 00H, 'f', 00H, 'o', 00H, 'E', 00H, 'n', 00H, 'a', 00H, 'b'
DB 00H, 'l', 00H, 'e', 00H, 00H, 00H
$SG14850 DB 'R', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG14853 DB 'T', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG14856 DB 'P', 00H, 'e', 00H, 'r', 00H, 'm', 00H, 'i', 00H, 't', 00H
DB 'S', 00H, 'h', 00H, 'a', 00H, 'r', 00H, 'e', 00H, 00H, 00H
$SG14859 DB 'L', 00H, 'o', 00H, 'g', 00H, 'F', 00H, 'i', 00H, 'f', 00H
DB 'o', 00H, 00H, 00H
; Function compile flags: /Ogs
_DriverDefaultsPtr$ = 8
_RegistryPath$ = 12
_Status$ = 8
_paramTable$ = -236
_path$ = 12
_zero$ = -8
_DbgDefault$ = -12
_notThereDefault$ = -4
_SerialGetConfigDefaults@8 PROC NEAR ; COMDAT
; 67 : {
0015c 55 push ebp
0015d 8b ec mov ebp, esp
0015f 81 ec ec 00 00
00 sub esp, 236 ; 000000ecH
00165 56 push esi
; 68 :
; 69 : NTSTATUS Status = STATUS_SUCCESS; // return value
; 70 :
; 71 : //
; 72 : // We use this to query into the registry for defaults
; 73 : //
; 74 :
; 75 : RTL_QUERY_REGISTRY_TABLE paramTable[8];
; 76 :
; 77 : PWCHAR path;
; 78 : ULONG zero = 0;
; 79 : ULONG DbgDefault = 0;//SER_DBG_DEFAULT;
; 80 : ULONG notThereDefault = SERIAL_UNINITIALIZED_DEFAULT;
; 81 :
; 82 : PAGED_CODE();
00166 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__KeGetCurrentIrql@0
0016c 57 push edi
0016d 33 ff xor edi, edi
0016f 89 7d f8 mov DWORD PTR _zero$[ebp], edi
00172 89 7d f4 mov DWORD PTR _DbgDefault$[ebp], edi
00175 c7 45 fc 87 d6
12 00 mov DWORD PTR _notThereDefault$[ebp], 1234567 ; 0012d687H
0017c ff d6 call esi
0017e 3c 01 cmp al, 1
00180 76 25 jbe SHORT $L14818
00182 ff d6 call esi
00184 0f b6 c0 movzx eax, al
00187 50 push eax
00188 68 00 00 00 00 push OFFSET FLAT:$SG14817
0018d e8 00 00 00 00 call _DbgPrint
00192 59 pop ecx
00193 59 pop ecx
00194 57 push edi
00195 6a 52 push 82 ; 00000052H
00197 68 00 00 00 00 push OFFSET FLAT:$SG14820
0019c 68 00 00 00 00 push OFFSET FLAT:$SG14821
001a1 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14818:
; 83 :
; 84 : //
; 85 : // Since the registry path parameter is a "counted" UNICODE string, it
; 86 : // might not be zero terminated. For a very short time allocate memory
; 87 : // to hold the registry path zero terminated so that we can use it to
; 88 : // delve into the registry.
; 89 : //
; 90 : // NOTE NOTE!!!! This is not an architected way of breaking into
; 91 : // a driver. It happens to work for this driver because the author
; 92 : // likes to do things this way.
; 93 : //
; 94 :
; 95 : path = ExAllocatePool (PagedPool, RegistryPath->Length+sizeof(WCHAR));
001a7 8b 75 0c mov esi, DWORD PTR _RegistryPath$[ebp]
001aa 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
001af 0f b7 06 movzx eax, WORD PTR [esi]
001b2 40 inc eax
001b3 40 inc eax
001b4 50 push eax
001b5 6a 01 push 1
001b7 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 96 :
; 97 : if (!path) {
001bd 3b c7 cmp eax, edi
001bf 89 45 0c mov DWORD PTR _path$[ebp], eax
001c2 75 0a jne SHORT $L14823
; 98 : Status = STATUS_INSUFFICIENT_RESOURCES;
; 99 : return (Status);
001c4 b8 9a 00 00 c0 mov eax, -1073741670 ; c000009aH
001c9 e9 2f 02 00 00 jmp $L14808
$L14823:
001ce 53 push ebx
; 100 : }
; 101 :
; 102 : RtlZeroMemory (DriverDefaultsPtr, sizeof(SERIAL_FIRMWARE_DATA));
001cf 8b 5d 08 mov ebx, DWORD PTR _DriverDefaultsPtr$[ebp]
001d2 6a 13 push 19 ; 00000013H
001d4 33 c0 xor eax, eax
001d6 59 pop ecx
001d7 8b fb mov edi, ebx
001d9 f3 ab rep stosd
; 103 : RtlZeroMemory (¶mTable[0], sizeof(paramTable));
001db 6a 38 push 56 ; 00000038H
001dd 8d bd 14 ff ff
ff lea edi, DWORD PTR _paramTable$[ebp]
001e3 59 pop ecx
001e4 f3 ab rep stosd
; 104 : RtlZeroMemory (path, RegistryPath->Length+sizeof(WCHAR));
001e6 0f b7 0e movzx ecx, WORD PTR [esi]
001e9 8b 7d 0c mov edi, DWORD PTR _path$[ebp]
001ec 41 inc ecx
001ed 41 inc ecx
001ee 8b d1 mov edx, ecx
001f0 c1 e9 02 shr ecx, 2
001f3 f3 ab rep stosd
001f5 8b ca mov ecx, edx
001f7 83 e1 03 and ecx, 3
001fa f3 aa rep stosb
; 105 : RtlMoveMemory (path, RegistryPath->Buffer, RegistryPath->Length);
001fc 0f b7 06 movzx eax, WORD PTR [esi]
001ff 50 push eax
00200 ff 76 04 push DWORD PTR [esi+4]
00203 ff 75 0c push DWORD PTR _path$[ebp]
00206 ff 15 00 00 00
00 call DWORD PTR __imp__memmove
; 106 :
; 107 : paramTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 108 : paramTable[0].Name = L"BreakOnEntry";
; 109 : paramTable[0].EntryContext = &DriverDefaultsPtr->ShouldBreakOnEntry;
0020c 8d 4b 10 lea ecx, DWORD PTR [ebx+16]
0020f 83 c4 0c add esp, 12 ; 0000000cH
00212 89 8d 20 ff ff
ff mov DWORD PTR _paramTable$[ebp+12], ecx
; 110 : paramTable[0].DefaultType = REG_DWORD;
; 111 : paramTable[0].DefaultData = &zero;
00218 8d 4d f8 lea ecx, DWORD PTR _zero$[ebp]
0021b 89 8d 28 ff ff
ff mov DWORD PTR _paramTable$[ebp+20], ecx
; 112 : paramTable[0].DefaultLength = sizeof(ULONG);
; 113 :
; 114 : paramTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 115 : paramTable[1].Name = L"DebugLevel";
; 116 : paramTable[1].EntryContext = &DriverDefaultsPtr->DebugLevel;
00221 8d 4b 0c lea ecx, DWORD PTR [ebx+12]
00224 89 8d 3c ff ff
ff mov DWORD PTR _paramTable$[ebp+40], ecx
; 117 : paramTable[1].DefaultType = REG_DWORD;
; 118 : paramTable[1].DefaultData = &DbgDefault;
0022a 8d 4d f4 lea ecx, DWORD PTR _DbgDefault$[ebp]
0022d 89 8d 44 ff ff
ff mov DWORD PTR _paramTable$[ebp+48], ecx
; 119 : paramTable[1].DefaultLength = sizeof(ULONG);
; 120 :
; 121 : paramTable[2].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 122 : paramTable[2].Name = L"ForceFifoEnable";
; 123 : paramTable[2].EntryContext = &DriverDefaultsPtr->ForceFifoEnableDefault;
; 124 : paramTable[2].DefaultType = REG_DWORD;
; 125 : paramTable[2].DefaultData = ¬ThereDefault;
00233 8d 4d fc lea ecx, DWORD PTR _notThereDefault$[ebp]
00236 89 8d 60 ff ff
ff mov DWORD PTR _paramTable$[ebp+76], ecx
; 126 : paramTable[2].DefaultLength = sizeof(ULONG);
; 127 :
; 128 : paramTable[3].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 129 : paramTable[3].Name = L"RxFIFO";
; 130 : paramTable[3].EntryContext = &DriverDefaultsPtr->RxFIFODefault;
0023c 8d 4b 14 lea ecx, DWORD PTR [ebx+20]
0023f 89 8d 74 ff ff
ff mov DWORD PTR _paramTable$[ebp+96], ecx
; 131 : paramTable[3].DefaultType = REG_DWORD;
; 132 : paramTable[3].DefaultData = ¬ThereDefault;
00245 8d 4d fc lea ecx, DWORD PTR _notThereDefault$[ebp]
00248 89 8d 7c ff ff
ff mov DWORD PTR _paramTable$[ebp+104], ecx
; 133 : paramTable[3].DefaultLength = sizeof(ULONG);
; 134 :
; 135 : paramTable[4].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 136 : paramTable[4].Name = L"TxFIFO";
; 137 : paramTable[4].EntryContext = &DriverDefaultsPtr->TxFIFODefault;
0024e 8d 4b 18 lea ecx, DWORD PTR [ebx+24]
00251 89 4d 90 mov DWORD PTR _paramTable$[ebp+124], ecx
00254 6a 20 push 32 ; 00000020H
; 138 : paramTable[4].DefaultType = REG_DWORD;
; 139 : paramTable[4].DefaultData = ¬ThereDefault;
00256 8d 4d fc lea ecx, DWORD PTR _notThereDefault$[ebp]
00259 58 pop eax
0025a 89 4d 98 mov DWORD PTR _paramTable$[ebp+132], ecx
; 140 : paramTable[4].DefaultLength = sizeof(ULONG);
; 141 :
; 142 : paramTable[5].Flags = RTL_QUERY_REGISTRY_DIRECT;
; 143 : paramTable[5].Name = L"PermitShare";
; 144 : paramTable[5].EntryContext = &DriverDefaultsPtr->PermitShareDefault;
0025d 8d 4b 1c lea ecx, DWORD PTR [ebx+28]
00260 6a 04 push 4
00262 89 4d ac mov DWORD PTR _paramTable$[ebp+152], ecx
00265 5e pop esi
00266 8d 7b 08 lea edi, DWORD PTR [ebx+8]
; 145 : paramTable[5].DefaultType = REG_DWORD;
; 146 : paramTable[5].DefaultData = ¬ThereDefault;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -