How to format Ramdisk Microsoft sample source code

Dear all,

I used Microsoft sample source code to create Ramdisk

https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/ramdisk

But I cannot format Ramdisk after creating it.

I used format command to format created Ramdisk drive, the error “Error in IOCTL call” occur.

Does Microsoft sample source code support this function?

Does any additional IOCTL need to be implemented in source code to format created Ramdisk?

Thanh you very much.

The Ramdisk sample is missing a bunch of IOCTLs that make it compatible with
the standard format utility. You would need to set a breakpoint in the IOCTL
handler and start filling in the missing IOCTLs, the disk class driver would
be a reference:

https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/class/disk

If you truly want to be as compatible with Windows as a standard disk, the
better option is to write a Virtual StorPort miniport. In this model you
create a fake storage adapter and enumerate devices that are claimed by the
standard disk class driver. Then it deals with all the IOCTLs that you need
to support format (amongst other things). Sample here:

https://code.msdn.microsoft.com/windowshardware/WDKStorPortVirtualMiniport-973650f6

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntfsd…

Dear all,

I used Microsoft sample source code to create Ramdisk

https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/ramdisk

But I cannot format Ramdisk after creating it.

I used format command to format created Ramdisk drive, the error “Error in
IOCTL call” occur.

Does Microsoft sample source code support this function?

Does any additional IOCTL need to be implemented in source code to format
created Ramdisk?

Thanh you very much.

A virtual SCSI miniport is absolutely the way to go. It is documented, and
used the SCSI standard. Doing a RAM disk as a disk class driver is a good
exercise on how not to do thing :slight_smile:

On Wed, Feb 15, 2017 at 9:19 AM Scott Noone wrote:

> The Ramdisk sample is missing a bunch of IOCTLs that make it compatible
> with
> the standard format utility. You would need to set a breakpoint in the
> IOCTL
> handler and start filling in the missing IOCTLs, the disk class driver
> would
> be a reference:
>
>
> https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/class/disk
>
> If you truly want to be as compatible with Windows as a standard disk, the
> better option is to write a Virtual StorPort miniport. In this model you
> create a fake storage adapter and enumerate devices that are claimed by the
> standard disk class driver. Then it deals with all the IOCTLs that you need
> to support format (amongst other things). Sample here:
>
>
> https://code.msdn.microsoft.com/windowshardware/WDKStorPortVirtualMiniport-973650f6
>
> -scott
> OSR
> @OSRDrivers
>
> wrote in message news:xxxxx@ntfsd…
>
> Dear all,
>
> I used Microsoft sample source code to create Ramdisk
>
>
> https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/ramdisk
>
> But I cannot format Ramdisk after creating it.
>
> I used format command to format created Ramdisk drive, the error “Error in
> IOCTL call” occur.
>
> Does Microsoft sample source code support this function?
>
> Does any additional IOCTL need to be implemented in source code to format
> created Ramdisk?
>
> Thanh you very much.
>
>
> —
> NTFSD is sponsored by OSR
>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>

Dear Scott and Jamey,

Thank you very much for your useful advices.
I will try this way.

OSR has quite an elaborate virtual storport example. It is a good place to
start.

http://www.osronline.com/article.cfm?article=538

On Wed, Feb 15, 2017 at 10:04 PM wrote:

> Dear Scott and Jamey,
>
> Thank you very much for your useful advices.
> I will try this way.
>
> —
> NTFSD is sponsored by OSR
>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>