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

📄 ramdisk.cod

📁 利用系统内存建立虚拟磁盘
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 340  :             status = STATUS_SUCCESS;
; 341  :             information = sizeof( PARTITION_INFORMATION );
; 342  :         }
; 343  : 
; 344  :         break;

  0012e	e9 84 00 00 00	 jmp	 $L14425
$L14364:

; 345  :     }                                        
; 346  :     case IOCTL_DISK_GET_MEDIA_TYPES: {
; 347  : 
; 348  :         if ( irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof( DISK_GEOMETRY ) * FixedMedia )

  00133	81 78 04 20 01
	00 00		 cmp	 DWORD PTR [eax+4], 288	; 00000120H
  0013a	73 0c		 jae	 SHORT $L14366

; 349  :         {
; 350  :             //
; 351  :             // Instead of returning STATUS_INVALID_PARAMETER, we will return
; 352  :             // STATUS_BUFFER_TOO_SMALL and the required buffer size. 
; 353  :             // So that the called will send a bigger buffer
; 354  :             //
; 355  :             status = STATUS_BUFFER_TOO_SMALL;       // Inform the caller we need bigger buffer

  0013c	be 23 00 00 c0	 mov	 esi, -1073741789	; c0000023H

; 356  :             information = sizeof( DISK_GEOMETRY ) * ( FixedMedia + 1 ) ;

  00141	bf 38 01 00 00	 mov	 edi, 312		; 00000138H

; 357  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_GET_MEDIA_TYPES - buffer too small\n" ) );
; 358  :         }
; 359  :         else

  00146	eb 71		 jmp	 SHORT $L14345
$L14366:

; 360  :         {
; 361  :             PDISK_GEOMETRY outputBuffer;
; 362  : 
; 363  :             outputBuffer = ( PDISK_GEOMETRY ) ( (ULONGLONG)Irp->AssociatedIrp.SystemBuffer + sizeof(DISK_GEOMETRY) * ( FixedMedia - 1 ) ) ;

  00148	8b 7d 0c	 mov	 edi, DWORD PTR [ebp+12]

; 364  :             RtlCopyMemory( outputBuffer, &(devExt->DiskGeometry), sizeof(DISK_GEOMETRY) );

  0014b	83 c6 30	 add	 esi, 48			; 00000030H
  0014e	6a 06		 push	 6
  00150	81 c7 08 01 00
	00		 add	 edi, 264		; 00000108H
  00156	59		 pop	 ecx
  00157	f3 a5		 rep movsd

; 365  :             status = STATUS_SUCCESS;
; 366  :             information = sizeof( DISK_GEOMETRY ) * ( FixedMedia + 1 ) ;

  00159	bf 38 01 00 00	 mov	 edi, 312		; 00000138H

; 367  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_GET_MEDIA_TYPES - OK !\n" ) );
; 368  :         }
; 369  :         break;

  0015e	eb 57		 jmp	 SHORT $L14425
$L14379:

; 370  :     }
; 371  : 
; 372  :     case IOCTL_DISK_GET_DRIVE_GEOMETRY: {
; 373  : 
; 374  :         //
; 375  :         // Return the drive geometry for the ram disk. Note that
; 376  :         // we return values which were made up to suit the disk size.
; 377  :         //
; 378  : 
; 379  :         if ( irpStack->Parameters.DeviceIoControl.OutputBufferLength <
; 380  :             sizeof( DISK_GEOMETRY ) )

  00160	83 78 04 18	 cmp	 DWORD PTR [eax+4], 24	; 00000018H
  00164	73 04		 jae	 SHORT $L14381

; 381  :         {
; 382  :             //
; 383  :             // Instead of returning STATUS_INVALID_PARAMETER, we will return
; 384  :             // STATUS_BUFFER_TOO_SMALL and the required buffer size. 
; 385  :             // So that the called will send a bigger buffer
; 386  :             //
; 387  :             status = STATUS_BUFFER_TOO_SMALL;       // Inform the caller we need bigger buffer
; 388  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_GET_DRIVE_GEOMETRY - buffer too small\n" ) );
; 389  :             information = sizeof(DISK_GEOMETRY);

  00166	6a 18		 push	 24			; 00000018H

; 390  :         }
; 391  :         else

  00168	eb 2e		 jmp	 SHORT $L14615
$L14381:

; 392  :         {
; 393  :             PDISK_GEOMETRY outputBuffer;
; 394  : 
; 395  :             outputBuffer = ( PDISK_GEOMETRY ) Irp->AssociatedIrp.SystemBuffer;
; 396  :             RtlCopyMemory( outputBuffer, &(devExt->DiskGeometry), sizeof(DISK_GEOMETRY) );

  0016a	8b 7d 0c	 mov	 edi, DWORD PTR [ebp+12]
  0016d	6a 06		 push	 6
  0016f	59		 pop	 ecx
  00170	83 c6 30	 add	 esi, 48			; 00000030H
  00173	f3 a5		 rep movsd

; 397  :             status = STATUS_SUCCESS;
; 398  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_GET_DRIVE_GEOMETRY - OK ! \n" ) );
; 399  :             information = sizeof( DISK_GEOMETRY );

  00175	6a 18		 push	 24			; 00000018H

; 400  :         }
; 401  :         break;

  00177	eb 3d		 jmp	 SHORT $L14616
$L14605:

; 309  : 
; 310  :     DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_VERBOSE, ("IOCtl- IN : command = 0x%08lX\n" , command ) );
; 311  : 
; 312  :     switch ( command )
; 313  :     {

  00179	81 f9 18 c0 07
	00		 cmp	 ecx, 507928		; 0007c018H
  0017f	74 36		 je	 SHORT $L14425
  00181	81 f9 08 00 4d
	00		 cmp	 ecx, 5046280		; 004d0008H
  00187	74 07		 je	 SHORT $L14406
$L14428:

; 478  :         break;
; 479  :     }
; 480  :  
; 481  : 
; 482  : 
; 483  :     default: {
; 484  :         //
; 485  :         // Received not supported IOCTLs, fail them
; 486  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("Unknown IOCTL command %X\n", command ) );
; 487  :         status = STATUS_INVALID_DEVICE_REQUEST;

  00189	be 10 00 00 c0	 mov	 esi, -1073741808	; c0000010H

; 488  :         break;

  0018e	eb 29		 jmp	 SHORT $L14345
$L14406:

; 412  :     }                                        
; 413  : 
; 414  :     case IOCTL_DISK_IS_WRITABLE: {
; 415  : 
; 416  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_IS_WRITABLE \n" ) );
; 417  :         //
; 418  :         // Return status success
; 419  :         //
; 420  :         status = STATUS_SUCCESS;
; 421  :         break;
; 422  :     }                                        
; 423  : 
; 424  :     case IOCTL_DISK_SET_PARTITION_INFO: {
; 425  : 
; 426  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_SET_PARTITION_INFO\n" ) );
; 427  :         // cannot handle this ....
; 428  :         status = STATUS_INVALID_DEVICE_REQUEST;
; 429  :         break;
; 430  :     }
; 431  : 
; 432  :     case IOCTL_MOUNTMGR_QUERY_POINTS: {
; 433  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_MOUNTMGR_QUERY_POINTS\n" ) );
; 434  :         // cannot handle this ....
; 435  :         status = STATUS_INVALID_DEVICE_REQUEST;
; 436  :         break;
; 437  :        }
; 438  : 
; 439  :     case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME: {
; 440  : 
; 441  :         if ( irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(L"RAMDisk") + sizeof(MOUNTDEV_NAME) )

  00190	83 78 04 14	 cmp	 DWORD PTR [eax+4], 20	; 00000014H

; 449  :             information = sizeof(L"RAMDisk") + sizeof(MOUNTDEV_NAME);

  00194	6a 14		 push	 20			; 00000014H
  00196	73 08		 jae	 SHORT $L14408
$L14615:

; 442  :         {
; 443  :             //
; 444  :             // Instead of returning STATUS_INVALID_PARAMETER, we will return
; 445  :             // STATUS_BUFFER_TOO_SMALL and the required buffer size. 
; 446  :             // So that the called will send a bigger buffer
; 447  :             //
; 448  :             status = STATUS_BUFFER_TOO_SMALL;       // Inform the caller we need bigger buffer

  00198	be 23 00 00 c0	 mov	 esi, -1073741789	; c0000023H

; 449  :             information = sizeof(L"RAMDisk") + sizeof(MOUNTDEV_NAME);

  0019d	5f		 pop	 edi

; 450  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_MOUNTDEV_QUERY_DEVICE_NAME - buffer too small\n" ) );
; 451  :         }
; 452  :         else

  0019e	eb 19		 jmp	 SHORT $L14345
$L14408:

; 453  :         {
; 454  :             PMOUNTDEV_NAME outputBuffer;
; 455  : 
; 456  :             outputBuffer = ( PMOUNTDEV_NAME ) Irp->AssociatedIrp.SystemBuffer;

  001a0	8b 45 0c	 mov	 eax, DWORD PTR [ebp+12]

; 457  :             outputBuffer->NameLength = sizeof(L"RAMDisk") ;

  001a3	66 c7 00 10 00	 mov	 WORD PTR [eax], 16	; 00000010H

; 458  :             RtlCopyMemory( &outputBuffer->Name[0] , L"RAMDisk" , outputBuffer->NameLength + sizeof(WCHAR) );

  001a8	be 00 00 00 00	 mov	 esi, OFFSET FLAT:$SG14416
  001ad	8d 78 02	 lea	 edi, DWORD PTR [eax+2]
  001b0	a5		 movsd
  001b1	a5		 movsd
  001b2	a5		 movsd
  001b3	a5		 movsd
  001b4	66 a5		 movsw
$L14616:

; 459  :             status = STATUS_SUCCESS;
; 460  :             information = sizeof(L"RAMDisk") + sizeof(MOUNTDEV_NAME) ;

  001b6	5f		 pop	 edi
$L14425:

; 461  :             DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_MOUNTDEV_QUERY_DEVICE_NAME - OK !\n" ) );
; 462  :         }
; 463  :         break;
; 464  :     }
; 465  : 
; 466  :     case FT_BALANCED_READ_MODE: {
; 467  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("FT_BALANCED_READ_MODE\n" ) );
; 468  :         // cannot handle this ....
; 469  :         status = STATUS_SUCCESS ;
; 470  :         status = STATUS_INVALID_DEVICE_REQUEST;
; 471  :         break;
; 472  :     }
; 473  : 
; 474  :     case IOCTL_DISK_FORMAT_TRACKS: {
; 475  :         DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_INFO, ("IOCTL_DISK_FORMAT_TRACKS\n" ) );
; 476  :         // cannot handle this ....
; 477  :         status = STATUS_SUCCESS ;

  001b7	33 f6		 xor	 esi, esi
$L14345:

; 489  :     }
; 490  : 
; 491  :     }   // end switch
; 492  : 
; 493  :     COMPLETE_REQUEST( Irp, status, information );

  001b9	32 d2		 xor	 dl, dl
  001bb	8b cd		 mov	 ecx, ebp
  001bd	89 75 18	 mov	 DWORD PTR [ebp+24], esi
  001c0	89 7d 1c	 mov	 DWORD PTR [ebp+28], edi
  001c3	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8

; 494  :     IoReleaseRemoveLock(&devExt->RemoveLock, Irp);

  001c9	6a 18		 push	 24			; 00000018H
  001cb	55		 push	 ebp
  001cc	ff 74 24 1c	 push	 DWORD PTR tv227[esp+20]
  001d0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseRemoveLockEx@12

; 495  : 
; 496  :     DBGPRINT( DBG_COMP_IOCTL, DBG_LEVEL_VERBOSE, ("IOCtl- OUT \n" ) );
; 497  :     return status;

  001d6	8b c6		 mov	 eax, esi
$L14329:
  001d8	5f		 pop	 edi
  001d9	5e		 pop	 esi
  001da	5d		 pop	 ebp
  001db	5b		 pop	 ebx

; 498  : }   // End of RamDiskIOCtl()

  001dc	c2 08 00	 ret	 8
_RamDiskIOCtl@8 ENDP
_TEXT	ENDS
PUBLIC	_RamDiskReadWrite@8
EXTRN	__imp__memmove:NEAR
EXTRN	__imp__MmMapLockedPagesSpecifyCache@24:NEAR
;	COMDAT _RamDiskReadWrite@8
; File f:\winddk\2600\inc\ddk\wxp\ntddk.h
_TEXT	SEGMENT
$SG14452 DB	'f:\winddk\2600\src\storage\ramdisk\sys\ramdisk.c', 00H
; Function compile flags: /Ogsy
; File f:\winddk\2600\src\storage\ramdisk\sys\ramdisk.c
$T14625 = -16
$T14624 = -16
$T14622 = -16
$T14621 = -16
$T14623 = -8
$T14620 = -8
_devExt$ = 8
_information$ = 8
_DeviceObject$ = 8
tv267 = 12
_Irp$ = 12
_RamDiskReadWrite@8 PROC NEAR				; COMDAT

; 527  : {

  00031	55		 push	 ebp
  00032	8b ec		 mov	 ebp, esp
  00034	83 ec 10	 sub	 esp, 16			; 00000010H

; 528  :     PIO_STACK_LOCATION  irpStack;
; 529  :     NTSTATUS            status;
; 530  :     ULONG               information = 0;
; 531  :     PUCHAR              currentAddress;
; 532  : 
; 533  :     PDEVICE_EXTENSION   devExt = DeviceObject->DeviceExtension;

  00037	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  0003a	53		 push	 ebx
  0003b	8b 58 28	 mov	 ebx, DWORD PTR [eax+40]

; 534  :     DBGPRINT( DBG_COMP_READ, DBG_LEVEL_VERBOSE, ("ReadWrite - IN \n" ) );
; 535  : 
; 536  :     if ( devExt->DevState != WORKING ) {

  0003e	83 7b 0c 01	 cmp	 DWORD PTR [ebx+12], 1
  00042	56		 push	 esi
  00043	57		 push	 edi
  00044	8b 7d 0c	 mov	 edi, DWORD PTR _Irp$[ebp]
  00047	89 5d 08	 mov	 DWORD PTR _devExt$[ebp], ebx
  0004a	74 15		 je	 SHORT $L14666

; 537  :         //
; 538  :         // Device is not yet started or being removed, reject any IO request
; 539  :         // TODO: Queue the IRPs
; 540  : 
; 541  :         DBGPRINT( DBG_COMP_READ, DBG_LEVEL_WARN, ("Device not ready\n" ) );
; 542  :         status = STATUS_INVALID_DEVICE_STATE;
; 543  :         COMPLETE_REQUEST( Irp, status, information );

  0004c	83 67 1c 00	 and	 DWORD PTR [edi+28], 0
  00050	32 d2		 xor	 dl, dl
  00052	8b cf		 mov	 ecx, edi
  00054	c7 47 18 84 01
	00 c0		 mov	 DWORD PTR [edi+24], -1073741436 ; c0000184H
  0005b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
$L14666:

; 544  :     }
; 545  :     status = IoAcquireRemoveLock(&devExt->RemoveLock, Irp);

  00061	6a 18		 push	 24			; 00000018H
  00063	68 21 02 00 00	 push	 545			; 00000221H
  00068	68 00 00 00 00	 push	 OFFSET FLAT:$SG14452
  0006d	8d 43 10	 lea	 eax, DWORD PTR [ebx+16]
  00070	57		 push	 edi
  00071	50		 push	 eax
  00072	89 45 0c	 mov	 DWORD PTR tv267[ebp], eax
  00075	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireRemoveLockEx@20

⌨️ 快捷键说明

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