Typedef'ed new structs in ntfsrecover the same way as in logfile.h
Prepare merging ntfsrecover.h into logfile.h by declaring new structs the same was as in logfile.hpull/2/head
parent
2ab8bb509a
commit
a6f4bae6d5
|
@ -1153,13 +1153,13 @@ void copy_attribute(struct ATTR *pa, const char *buf, int length)
|
|||
|
||||
if (pa) {
|
||||
switch (length) {
|
||||
case sizeof(struct ATTR_NEW) :
|
||||
panew = (const struct ATTR_NEW*)buf;
|
||||
case sizeof(ATTR_NEW) :
|
||||
panew = (const ATTR_NEW*)buf;
|
||||
pa->type = panew->type;
|
||||
pa->lsn = sle64_to_cpu(panew->lsn);
|
||||
pa->inode = MREF(le64_to_cpu(panew->inode));
|
||||
break;
|
||||
case sizeof(struct ATTR_OLD) :
|
||||
case sizeof(ATTR_OLD) :
|
||||
/* Badly aligned, first realign */
|
||||
memcpy(&old_aligned,buf,sizeof(old_aligned));
|
||||
pa->type = old_aligned.type;
|
||||
|
@ -1758,8 +1758,8 @@ static void fixup(CONTEXT *ctx, const LOG_RECORD *logr, const char *buf,
|
|||
* Changed from Win10, formerly we got step = 44.
|
||||
* The record layout has also changed
|
||||
*/
|
||||
if ((step != sizeof(struct ATTR_OLD))
|
||||
&& (step != sizeof(struct ATTR_NEW))) {
|
||||
if ((step != sizeof(ATTR_OLD))
|
||||
&& (step != sizeof(ATTR_NEW))) {
|
||||
printf(" ** Unexpected step %d\n",step);
|
||||
}
|
||||
more = 0;
|
||||
|
@ -4076,16 +4076,16 @@ static BOOL checkstructs(void)
|
|||
(int)sizeof(RESTART_AREA));
|
||||
ok = FALSE;
|
||||
}
|
||||
if (sizeof(struct ATTR_OLD) != 44) {
|
||||
if (sizeof(ATTR_OLD) != 44) {
|
||||
fprintf(stderr,
|
||||
"* error : bad sizeof(struct ATTR_OLD) %d\n",
|
||||
(int)sizeof(struct ATTR_OLD));
|
||||
"* error : bad sizeof(ATTR_OLD) %d\n",
|
||||
(int)sizeof(ATTR_OLD));
|
||||
ok = FALSE;
|
||||
}
|
||||
if (sizeof(struct ATTR_NEW) != 40) {
|
||||
if (sizeof(ATTR_NEW) != 40) {
|
||||
fprintf(stderr,
|
||||
"* error : bad sizeof(struct ATTR_NEW) %d\n",
|
||||
(int)sizeof(struct ATTR_NEW));
|
||||
"* error : bad sizeof(ATTR_NEW) %d\n",
|
||||
(int)sizeof(ATTR_NEW));
|
||||
ok = FALSE;
|
||||
}
|
||||
if (LastAction != 38) {
|
||||
|
|
|
@ -291,8 +291,16 @@ struct BITMAP_ACTION {
|
|||
le32 count;
|
||||
} ;
|
||||
|
||||
/* Danger in arrays : contains le64's though size is not a multiple of 8 */
|
||||
typedef struct ATTR_OLD { /* Format up to Win10 (44 bytes) */
|
||||
/**
|
||||
* struct ATTR - Attribute record.
|
||||
*
|
||||
* The format of an attribute record has changed from Windows 10.
|
||||
* The old format was 44 bytes long, despite having 8 bytes fields,
|
||||
* and this leads to alignment problems in arrays.
|
||||
* This problem does not occur in the new format, which is shorter.
|
||||
* The format being used can generally be determined from size.
|
||||
*/
|
||||
typedef struct { /* Format up to Win10 (44 bytes) */
|
||||
le64 unknown1;
|
||||
le64 unknown2;
|
||||
le64 inode;
|
||||
|
@ -302,7 +310,7 @@ typedef struct ATTR_OLD { /* Format up to Win10 (44 bytes) */
|
|||
le32 unknown4;
|
||||
} __attribute__((__packed__)) ATTR_OLD;
|
||||
|
||||
typedef struct ATTR_NEW { /* Format since Win10 (40 bytes) */
|
||||
typedef struct { /* Format since Win10 (40 bytes) */
|
||||
le64 unknown1;
|
||||
le64 unknown2;
|
||||
le32 type;
|
||||
|
|
|
@ -2309,8 +2309,8 @@ static int redo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||
{
|
||||
const char *data;
|
||||
struct ATTR *pa;
|
||||
const struct ATTR_OLD *attr_old;
|
||||
const struct ATTR_NEW *attr_new;
|
||||
const ATTR_OLD *attr_old;
|
||||
const ATTR_NEW *attr_new;
|
||||
const char *name;
|
||||
le64 inode;
|
||||
u32 namelen;
|
||||
|
@ -2349,15 +2349,15 @@ static int redo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||
* whether it matches what we have in store.
|
||||
*/
|
||||
switch (length) {
|
||||
case sizeof(struct ATTR_OLD) :
|
||||
attr_old = (const struct ATTR_OLD*)data;
|
||||
case sizeof(ATTR_OLD) :
|
||||
attr_old = (const ATTR_OLD*)data;
|
||||
/* Badly aligned */
|
||||
memcpy(&inode, &attr_old->inode, 8);
|
||||
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
||||
|| (attr_old->type != pa->type);
|
||||
break;
|
||||
case sizeof(struct ATTR_NEW) :
|
||||
attr_new = (const struct ATTR_NEW*)data;
|
||||
case sizeof(ATTR_NEW) :
|
||||
attr_new = (const ATTR_NEW*)data;
|
||||
err = (MREF(le64_to_cpu(attr_new->inode))
|
||||
!= pa->inode)
|
||||
|| (attr_new->type != pa->type);
|
||||
|
@ -3379,8 +3379,8 @@ static int undo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||
{
|
||||
const char *data;
|
||||
struct ATTR *pa;
|
||||
const struct ATTR_OLD *attr_old;
|
||||
const struct ATTR_NEW *attr_new;
|
||||
const ATTR_OLD *attr_old;
|
||||
const ATTR_NEW *attr_new;
|
||||
const char *name;
|
||||
le64 inode;
|
||||
u32 namelen;
|
||||
|
@ -3415,15 +3415,15 @@ static int undo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||
if (pa) {
|
||||
/* check whether the redo attr matches what we have in store */
|
||||
switch (length) {
|
||||
case sizeof(struct ATTR_OLD) :
|
||||
attr_old = (const struct ATTR_OLD*)data;
|
||||
case sizeof(ATTR_OLD) :
|
||||
attr_old = (const ATTR_OLD*)data;
|
||||
/* Badly aligned */
|
||||
memcpy(&inode, &attr_old->inode, 8);
|
||||
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
||||
|| (attr_old->type != pa->type);
|
||||
break;
|
||||
case sizeof(struct ATTR_NEW) :
|
||||
attr_new = (const struct ATTR_NEW*)data;
|
||||
case sizeof(ATTR_NEW) :
|
||||
attr_new = (const ATTR_NEW*)data;
|
||||
err = (MREF(le64_to_cpu(attr_new->inode))!= pa->inode)
|
||||
|| (attr_new->type != pa->type);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue