📄 pcidpprotect.cod
字号:
000d7 c6 00 03 mov BYTE PTR [eax], 3
000da c6 40 01 03 mov BYTE PTR [eax+1], 3
000de 66 89 58 02 mov WORD PTR [eax+2], bx
000e2 8b 89 88 00 00
00 mov ecx, DWORD PTR [ecx+136]
; 116 : PartialResource->u.Memory.Start = PhysicalAddress;
000e8 89 48 04 mov DWORD PTR [eax+4], ecx
000eb 89 58 08 mov DWORD PTR [eax+8], ebx
; 117 : PartialResource->u.Memory.Length = DMASize;
000ee c7 40 0c 00 40
00 00 mov DWORD PTR [eax+12], 16384 ; 00004000H
; 118 :
; 119 : // Fill the partial resource with device specific data.
; 120 : //PartialResource++;
; 121 : //PartialResource->Type = CmResourceTypeDeviceSpecific;
; 122 : //PartialResource->ShareDisposition = CmResourceShareUndetermined;
; 123 : //PartialResource->u.DeviceSpecificData.DataSize = 20;
; 124 : //PartialResource++;
; 125 : //DataPointer = (ULONG*)PartialResource;
; 126 : //*DataPointer = CardInfo->u.type0.BaseAddresses[0] & 0xFFFFFFFE;
; 127 : //DataPointer++;
; 128 : //*DataPointer = CardInfo->u.type0.BaseAddresses[1];
; 129 : //DataPointer++;
; 130 : //*DataPointer = CardInfo->u.type0.BaseAddresses[2];
; 131 : //DataPointer++;
; 132 : //*DataPointer = CardInfo->u.type0.BaseAddresses[3];
; 133 : //DataPointer++;
; 134 : //*DataPointer = (ULONG)CardInfo->u.type0.InterruptLine;
; 135 :
; 136 : // Now report all of this stuff.
; 137 : NTStatus = IoReportResourceUsage(
; 138 : NULL,
; 139 : DeviceObject->DriverObject,
; 140 : NULL,
; 141 : 0,
; 142 : DeviceObject,
; 143 : ResourceList,
; 144 : SizeOfResourceList,
; 145 : FALSE, // override conflict
; 146 : &ConflictDetected
; 147 : );
000f5 8d 45 ff lea eax, DWORD PTR _ConflictDetected$[ebp]
000f8 50 push eax
000f9 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
000fc 53 push ebx
000fd 68 b8 00 00 00 push 184 ; 000000b8H
00102 56 push esi
00103 50 push eax
00104 53 push ebx
00105 53 push ebx
00106 ff 70 08 push DWORD PTR [eax+8]
00109 53 push ebx
0010a ff 15 00 00 00
00 call DWORD PTR __imp__IoReportResourceUsage@36
00110 8b f8 mov edi, eax
; 148 : if(NTStatus == STATUS_SUCCESS)
00112 3b fb cmp edi, ebx
00114 75 0b jne SHORT $L5924
; 149 : if(ConflictDetected == TRUE)
00116 80 7d ff 01 cmp BYTE PTR _ConflictDetected$[ebp], 1
0011a 75 05 jne SHORT $L5924
; 150 : NTStatus = STATUS_INSUFFICIENT_RESOURCES;
0011c bf 9a 00 00 c0 mov edi, -1073741670 ; c000009aH
$L5924:
; 151 :
; 152 : ExFreePool(ResourceList);
00121 56 push esi
00122 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 153 : }
; 154 :
; 155 : else
00128 eb 05 jmp SHORT $L5926
$L5912:
; 156 : NTStatus = STATUS_NO_MEMORY;
0012a bf 17 00 00 c0 mov edi, -1073741801 ; c0000017H
$L5926:
; 157 :
; 158 : return NTStatus;
0012f 8b c7 mov eax, edi
00131 5f pop edi
00132 5e pop esi
00133 5b pop ebx
; 159 : }
00134 c9 leave
00135 c2 08 00 ret 8
_ReportResources@8 ENDP
_TEXT ENDS
PUBLIC _UnReportResources@4
; COMDAT _UnReportResources@4
_TEXT SEGMENT
_DeviceObject$ = 8
_ConflictDetected$ = -1
_UnReportResources@4 PROC NEAR ; COMDAT
; 168 : ){
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
00004 53 push ebx
00005 56 push esi
00006 57 push edi
; 169 :
; 170 : NTSTATUS NTStatus;
; 171 : BOOLEAN ConflictDetected;
; 172 : ULONG SizeOfResourceList;
; 173 : PCM_RESOURCE_LIST ResourceList;
; 174 :
; 175 : // The size of the resource list is going to be one full resource
; 176 : // list which already has one full resource descriptor included
; 177 : // which already has one partial list included which already has
; 178 : // one partial descriptor included.
; 179 : SizeOfResourceList = sizeof(CM_RESOURCE_LIST);
; 180 :
; 181 : // Now allocate memory pool for the structure.
; 182 : ResourceList = ExAllocatePool(
; 183 : PagedPool,
; 184 : SizeOfResourceList
; 185 : );
00007 68 44 64 6b 20 push 543908932 ; 206b6444H
0000c 6a 24 push 36 ; 00000024H
0000e 6a 01 push 1
00010 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
00016 8b f0 mov esi, eax
; 186 :
; 187 : // Initialize the structure prior to calling IoReportResourceUsage.
; 188 : if(ResourceList){
00018 33 db xor ebx, ebx
0001a 3b f3 cmp esi, ebx
0001c 74 3a je SHORT $L5936
; 189 : RtlZeroMemory(ResourceList, SizeOfResourceList);
0001e 6a 09 push 9
00020 33 c0 xor eax, eax
00022 59 pop ecx
00023 8b fe mov edi, esi
00025 f3 ab rep stosd
; 190 :
; 191 : // Having the resource list "empty" is equilvalent to deallocating the
; 192 : // driver's assigned resources.
; 193 : NTStatus = IoReportResourceUsage(
; 194 : NULL,
; 195 : DeviceObject->DriverObject,
; 196 : NULL,
; 197 : 0,
; 198 : DeviceObject,
; 199 : ResourceList,
; 200 : SizeOfResourceList,
; 201 : FALSE,
; 202 : &ConflictDetected
; 203 : );
00027 8d 45 ff lea eax, DWORD PTR _ConflictDetected$[ebp]
0002a 50 push eax
0002b 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
0002e 53 push ebx
0002f 6a 24 push 36 ; 00000024H
00031 56 push esi
00032 50 push eax
00033 53 push ebx
00034 53 push ebx
00035 ff 70 08 push DWORD PTR [eax+8]
00038 53 push ebx
00039 ff 15 00 00 00
00 call DWORD PTR __imp__IoReportResourceUsage@36
; 204 : if(ConflictDetected == FALSE && NTStatus == STATUS_SUCCESS)
0003f 38 5d ff cmp BYTE PTR _ConflictDetected$[ebp], bl
00042 8b f8 mov edi, eax
00044 75 04 jne SHORT $L5940
00046 3b fb cmp edi, ebx
00048 74 05 je SHORT $L5941
$L5940:
; 205 : ;
; 206 : else
; 207 : NTStatus = STATUS_INSUFFICIENT_RESOURCES;
0004a bf 9a 00 00 c0 mov edi, -1073741670 ; c000009aH
$L5941:
; 208 :
; 209 : ExFreePool(ResourceList);
0004f 56 push esi
00050 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 210 : }
; 211 :
; 212 : else
00056 eb 05 jmp SHORT $L5943
$L5936:
; 213 : NTStatus = STATUS_NO_MEMORY;
00058 bf 17 00 00 c0 mov edi, -1073741801 ; c0000017H
$L5943:
; 214 :
; 215 : return NTStatus;
0005d 8b c7 mov eax, edi
0005f 5f pop edi
00060 5e pop esi
00061 5b pop ebx
; 216 : }
00062 c9 leave
00063 c2 04 00 ret 4
_UnReportResources@4 ENDP
_TEXT ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -