SDPORT_GET_WRITE_PROTECT_STATE function

This callback routine determines whether the slot write protection is engaged.

Syntax

SDPORT_GET_WRITE_PROTECT_STATE GetWriteProtectState;

BOOLEAN GetWriteProtectState(
  _In_ PVOID PrivateExtension
)
{ ... }

Parameters

  • PrivateExtension [in]
    A pointer to a slot-specific device extension between the SD host driver (sdport.sys) and the miniport driver.

Return value

true if a card is write-protected; false if the slot is writable.

Remarks

Checking the write protection state of a device (which only applies to full size SD cards with a physical write protect switch) is done through the Present State register on standard PCI-based host controllers. However, on SoC-based SD host controllers, GPIO is used to allow the driver to query the write protect state even when the controller is powered off.

Examples

The following example demonstrates an implementation of the GetWriteProtectState callback. This example is an excerpt from the standard SD miniport driver, sdhc.sys. To see the source code for sdhc.sys, download the Standard SD Host Controller Miniport sample.

BOOLEAN
SdhcSlotGetWriteProtectState(
    _In_ PVOID PrivateExtension
    )

{

    PSDHC_EXTENSION SdhcExtension;

    SdhcExtension = (PSDHC_EXTENSION) PrivateExtension;
    return SdhcIsWriteProtected(SdhcExtension);
}

Requirements

Minimum supported client

Windows 10

Minimum supported server

Windows Server 2016 Technical Preview

Header

Sdport.h

IRQL

_IRQL_requires_max_(PASSIVE_LEVEL)

 

 

Send comments about this topic to Microsoft