mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
61 lines
1.6 KiB
C
61 lines
1.6 KiB
C
|
/*
|
||
|
* badblocks.c - Bad blocks checker
|
||
|
*
|
||
|
* Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr>
|
||
|
* Laboratoire MASI, Institut Blaise Pascal
|
||
|
* Universite Pierre et Marie Curie (Paris VI)
|
||
|
*
|
||
|
* Copyright 1995, 1996, 1997, 1998, 1999 by Theodore Ts'o
|
||
|
* Copyright 1999 by David Beattie
|
||
|
* Copyright 2011 by Pete Batard
|
||
|
*
|
||
|
* This file is based on the minix file system programs fsck and mkfs
|
||
|
* written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi>
|
||
|
*
|
||
|
* %Begin-Header%
|
||
|
* This file may be redistributed under the terms of the GNU Public
|
||
|
* License.
|
||
|
* %End-Header%
|
||
|
*/
|
||
|
|
||
|
#include <windows.h>
|
||
|
|
||
|
#ifndef __u32
|
||
|
#define __u32 UINT32
|
||
|
#endif
|
||
|
typedef UINT32 blk_t;
|
||
|
typedef struct ext2_struct_u32_list *ext2_badblocks_list;
|
||
|
typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
|
||
|
typedef struct ext2_struct_u32_list *ext2_u32_list;
|
||
|
typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
|
||
|
typedef long errcode_t;
|
||
|
|
||
|
#define EXT2_ET_NO_MEMORY (2133571398L)
|
||
|
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
|
||
|
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
|
||
|
|
||
|
#define EXT2_CHECK_MAGIC(struct, code) \
|
||
|
if ((struct)->magic != (code)) return (code)
|
||
|
|
||
|
/*
|
||
|
* Badblocks list
|
||
|
*/
|
||
|
struct ext2_struct_u32_list {
|
||
|
int magic;
|
||
|
int num;
|
||
|
int size;
|
||
|
__u32 *list;
|
||
|
int badblocks_flags;
|
||
|
};
|
||
|
|
||
|
struct ext2_struct_u32_iterate {
|
||
|
int magic;
|
||
|
ext2_u32_list bb;
|
||
|
int ptr;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
* Shared prototypes
|
||
|
*/
|
||
|
BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, int block_size);
|