/// <summary> /// Sends a raw silo command to the silo object. This method is utilized to communicate with a silo which is not represented by a driver. /// </summary> /// <param name="silo">The silo interface instance.</param> /// <param name="command"> /// The silo command to be issued. 8 bits of this value are placed in the byte at position 3 of the CDB sent to the device; i.e. the /// second byte of the <c>SecurityProtocolSpecific</c> field. /// </param> /// <param name="commandBuffer">The command payload sent to the device in the send data phase of the command.</param> /// <param name="expectedResponseBufferSize">Contains the expected size of the response in bytes.</param> /// <returns>The response payload that is returned to the host from the device in the receive data phase of the command.</returns> /// <remarks> /// <para> /// This method is currently not supported by the IEEE 1667 certificate and password silos. It is recommended that the Enhanced /// Storage Portable Device Commands are used instead. /// </para> /// <para>The caller is responsible for sending correct parameters to the command.</para> /// </remarks> // https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-sendcommand HRESULT public static byte[] SendCommand(this IEnhancedStorageSilo silo, Byte command, Byte[] commandBuffer, UInt32 expectedResponseBufferSize) { // *** From SDK sample *** // 1. align command buffer to 512 bytes boundary UInt32 commandBufferLength = (UInt32)Macros.ALIGN_TO_MULTIPLE(commandBuffer.Length, 512); Byte[] commandBufferAlign = new Byte[commandBufferLength]; commandBuffer.CopyTo(commandBufferAlign, 0); // 2. create response buffer var responseBuffer = new Byte[expectedResponseBufferSize]; UInt32 responseBufferSize = (UInt32)responseBuffer.Length; // 3. send command to silo silo.SendCommand(command, commandBufferAlign, commandBufferLength, responseBuffer, ref responseBufferSize); return(responseBuffer); }
public StorageACTSilo(IEnhancedStorageSilo s) { _silo = s; }
public StorageACTSilo() { _silo = new EnhancedStorageSilo(); }
/// <summary>Returns an enumeration of all actions available to the silo object.</summary> /// <returns>Array of IEnhancedStorageAction interface objects that represent the actions available for the silo object.</returns> public static IEnhancedStorageSiloAction[] GetActions(this IEnhancedStorageSilo silo) => GetIntfArray <IEnhancedStorageSiloAction>(silo.GetActions);