1 /*++ 2 3 Copyright (C) 2006 VorontSOFT 4 5 Module Name: 6 badblock.h 7 8 Abstract: 9 This is the artificial badblock simulation part of the 10 miniport driver for ATA/ATAPI IDE controllers 11 with Busmaster DMA support 12 13 Author: 14 Nikolai Vorontsov (NickViz) 15 16 Environment: 17 kernel mode only 18 19 Notes: 20 21 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 32 Revision History: 33 2006/08/03 Initial implementation. 34 2006/08/06 Added registry work. 35 36 --*/ 37 38 39 #ifndef _BADBLOCK_H_INCLUDED_ 40 #define _BADBLOCK_H_INCLUDED_ 41 42 #pragma pack(push, 4) 43 typedef struct _SBadBlockRange 44 { 45 // ULONG m_ldev; 46 ULONGLONG m_lbaStart; 47 ULONGLONG m_lbaEnd; 48 } SBadBlockRange, *PSBadBlockRange; 49 50 typedef struct _SBadBlockListItem { 51 LIST_ENTRY List; 52 PHW_LU_EXTENSION LunExt; 53 WCHAR SerNumStr[128]; 54 SBadBlockRange* arrBadBlocks; 55 ULONG nBadBlocks; 56 } SBadBlockListItem, *PSBadBlockListItem; 57 58 #pragma pack(pop) 59 60 void 61 NTAPI 62 InitBadBlocks( 63 IN PHW_LU_EXTENSION LunExt 64 ); 65 66 void 67 NTAPI 68 ForgetBadBlocks( 69 IN PHW_LU_EXTENSION LunExt 70 ); 71 72 bool 73 NTAPI 74 CheckIfBadBlock( 75 IN PHW_LU_EXTENSION LunExt, 76 // IN UCHAR command, 77 IN ULONGLONG lba, 78 IN ULONG count 79 ); 80 81 #endif // _BADBLOCK_H_INCLUDED_