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.h
This commit is contained in:
@@ -1153,13 +1153,13 @@ void copy_attribute(struct ATTR *pa, const char *buf, int length)
|
|||||||
|
|
||||||
if (pa) {
|
if (pa) {
|
||||||
switch (length) {
|
switch (length) {
|
||||||
case sizeof(struct ATTR_NEW) :
|
case sizeof(ATTR_NEW) :
|
||||||
panew = (const struct ATTR_NEW*)buf;
|
panew = (const ATTR_NEW*)buf;
|
||||||
pa->type = panew->type;
|
pa->type = panew->type;
|
||||||
pa->lsn = sle64_to_cpu(panew->lsn);
|
pa->lsn = sle64_to_cpu(panew->lsn);
|
||||||
pa->inode = MREF(le64_to_cpu(panew->inode));
|
pa->inode = MREF(le64_to_cpu(panew->inode));
|
||||||
break;
|
break;
|
||||||
case sizeof(struct ATTR_OLD) :
|
case sizeof(ATTR_OLD) :
|
||||||
/* Badly aligned, first realign */
|
/* Badly aligned, first realign */
|
||||||
memcpy(&old_aligned,buf,sizeof(old_aligned));
|
memcpy(&old_aligned,buf,sizeof(old_aligned));
|
||||||
pa->type = old_aligned.type;
|
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.
|
* Changed from Win10, formerly we got step = 44.
|
||||||
* The record layout has also changed
|
* The record layout has also changed
|
||||||
*/
|
*/
|
||||||
if ((step != sizeof(struct ATTR_OLD))
|
if ((step != sizeof(ATTR_OLD))
|
||||||
&& (step != sizeof(struct ATTR_NEW))) {
|
&& (step != sizeof(ATTR_NEW))) {
|
||||||
printf(" ** Unexpected step %d\n",step);
|
printf(" ** Unexpected step %d\n",step);
|
||||||
}
|
}
|
||||||
more = 0;
|
more = 0;
|
||||||
@@ -4076,16 +4076,16 @@ static BOOL checkstructs(void)
|
|||||||
(int)sizeof(RESTART_AREA));
|
(int)sizeof(RESTART_AREA));
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
}
|
}
|
||||||
if (sizeof(struct ATTR_OLD) != 44) {
|
if (sizeof(ATTR_OLD) != 44) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"* error : bad sizeof(struct ATTR_OLD) %d\n",
|
"* error : bad sizeof(ATTR_OLD) %d\n",
|
||||||
(int)sizeof(struct ATTR_OLD));
|
(int)sizeof(ATTR_OLD));
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
}
|
}
|
||||||
if (sizeof(struct ATTR_NEW) != 40) {
|
if (sizeof(ATTR_NEW) != 40) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"* error : bad sizeof(struct ATTR_NEW) %d\n",
|
"* error : bad sizeof(ATTR_NEW) %d\n",
|
||||||
(int)sizeof(struct ATTR_NEW));
|
(int)sizeof(ATTR_NEW));
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
}
|
}
|
||||||
if (LastAction != 38) {
|
if (LastAction != 38) {
|
||||||
|
|||||||
@@ -291,8 +291,16 @@ struct BITMAP_ACTION {
|
|||||||
le32 count;
|
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 unknown1;
|
||||||
le64 unknown2;
|
le64 unknown2;
|
||||||
le64 inode;
|
le64 inode;
|
||||||
@@ -302,7 +310,7 @@ typedef struct ATTR_OLD { /* Format up to Win10 (44 bytes) */
|
|||||||
le32 unknown4;
|
le32 unknown4;
|
||||||
} __attribute__((__packed__)) ATTR_OLD;
|
} __attribute__((__packed__)) ATTR_OLD;
|
||||||
|
|
||||||
typedef struct ATTR_NEW { /* Format since Win10 (40 bytes) */
|
typedef struct { /* Format since Win10 (40 bytes) */
|
||||||
le64 unknown1;
|
le64 unknown1;
|
||||||
le64 unknown2;
|
le64 unknown2;
|
||||||
le32 type;
|
le32 type;
|
||||||
|
|||||||
@@ -2309,8 +2309,8 @@ static int redo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
const char *data;
|
const char *data;
|
||||||
struct ATTR *pa;
|
struct ATTR *pa;
|
||||||
const struct ATTR_OLD *attr_old;
|
const ATTR_OLD *attr_old;
|
||||||
const struct ATTR_NEW *attr_new;
|
const ATTR_NEW *attr_new;
|
||||||
const char *name;
|
const char *name;
|
||||||
le64 inode;
|
le64 inode;
|
||||||
u32 namelen;
|
u32 namelen;
|
||||||
@@ -2349,15 +2349,15 @@ static int redo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||||||
* whether it matches what we have in store.
|
* whether it matches what we have in store.
|
||||||
*/
|
*/
|
||||||
switch (length) {
|
switch (length) {
|
||||||
case sizeof(struct ATTR_OLD) :
|
case sizeof(ATTR_OLD) :
|
||||||
attr_old = (const struct ATTR_OLD*)data;
|
attr_old = (const ATTR_OLD*)data;
|
||||||
/* Badly aligned */
|
/* Badly aligned */
|
||||||
memcpy(&inode, &attr_old->inode, 8);
|
memcpy(&inode, &attr_old->inode, 8);
|
||||||
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
||||||
|| (attr_old->type != pa->type);
|
|| (attr_old->type != pa->type);
|
||||||
break;
|
break;
|
||||||
case sizeof(struct ATTR_NEW) :
|
case sizeof(ATTR_NEW) :
|
||||||
attr_new = (const struct ATTR_NEW*)data;
|
attr_new = (const ATTR_NEW*)data;
|
||||||
err = (MREF(le64_to_cpu(attr_new->inode))
|
err = (MREF(le64_to_cpu(attr_new->inode))
|
||||||
!= pa->inode)
|
!= pa->inode)
|
||||||
|| (attr_new->type != pa->type);
|
|| (attr_new->type != pa->type);
|
||||||
@@ -3379,8 +3379,8 @@ static int undo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
const char *data;
|
const char *data;
|
||||||
struct ATTR *pa;
|
struct ATTR *pa;
|
||||||
const struct ATTR_OLD *attr_old;
|
const ATTR_OLD *attr_old;
|
||||||
const struct ATTR_NEW *attr_new;
|
const ATTR_NEW *attr_new;
|
||||||
const char *name;
|
const char *name;
|
||||||
le64 inode;
|
le64 inode;
|
||||||
u32 namelen;
|
u32 namelen;
|
||||||
@@ -3415,15 +3415,15 @@ static int undo_open_attribute(ntfs_volume *vol __attribute__((unused)),
|
|||||||
if (pa) {
|
if (pa) {
|
||||||
/* check whether the redo attr matches what we have in store */
|
/* check whether the redo attr matches what we have in store */
|
||||||
switch (length) {
|
switch (length) {
|
||||||
case sizeof(struct ATTR_OLD) :
|
case sizeof(ATTR_OLD) :
|
||||||
attr_old = (const struct ATTR_OLD*)data;
|
attr_old = (const ATTR_OLD*)data;
|
||||||
/* Badly aligned */
|
/* Badly aligned */
|
||||||
memcpy(&inode, &attr_old->inode, 8);
|
memcpy(&inode, &attr_old->inode, 8);
|
||||||
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
err = (MREF(le64_to_cpu(inode)) != pa->inode)
|
||||||
|| (attr_old->type != pa->type);
|
|| (attr_old->type != pa->type);
|
||||||
break;
|
break;
|
||||||
case sizeof(struct ATTR_NEW) :
|
case sizeof(ATTR_NEW) :
|
||||||
attr_new = (const struct ATTR_NEW*)data;
|
attr_new = (const ATTR_NEW*)data;
|
||||||
err = (MREF(le64_to_cpu(attr_new->inode))!= pa->inode)
|
err = (MREF(le64_to_cpu(attr_new->inode))!= pa->inode)
|
||||||
|| (attr_new->type != pa->type);
|
|| (attr_new->type != pa->type);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user