Skip to content

Commit

Permalink
rename structs to avoid collisions with Windows headers
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Jan 5, 2021
1 parent 3646703 commit 3524609
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ntfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ typedef struct {
typedef struct {
uint32_t Version;
uint32_t Provider;
} WOF_EXTERNAL_INFO;
} wof_external_info; // WOF_EXTERNAL_INFO in winioctl.h

#define FILE_PROVIDER_CURRENT_VERSION 1

Expand All @@ -362,7 +362,7 @@ typedef struct {
typedef struct {
uint32_t Version;
uint32_t Algorithm;
} FILE_PROVIDER_EXTERNAL_INFO_V0;
} file_provider_external_info_v0; // FILE_PROVIDER_EXTERNAL_INFO_V0 in winioctl.h

#pragma pack(pop)

Expand Down
12 changes: 6 additions & 6 deletions src/ntfs2btrfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,12 +2035,12 @@ static void add_inode(root& r, uint64_t inode, uint64_t ntfs_inode, bool& is_dir
reparse_point.length(), offsetof(reparse_point_header, DataBuffer) + rph->ReparseDataLength);
}

if (rph->ReparseDataLength < sizeof(WOF_EXTERNAL_INFO)) {
if (rph->ReparseDataLength < sizeof(wof_external_info)) {
throw formatted_error(FMT_STRING("rph->ReparseDataLength was {} bytes, expected at least {}."),
rph->ReparseDataLength, sizeof(WOF_EXTERNAL_INFO));
rph->ReparseDataLength, sizeof(wof_external_info));
}

auto wofei = (WOF_EXTERNAL_INFO*)rph->DataBuffer;
auto wofei = (wof_external_info*)rph->DataBuffer;

if (wofei->Version != WOF_CURRENT_VERSION)
throw formatted_error(FMT_STRING("Unsupported WOF version {}."), wofei->Version);
Expand All @@ -2050,12 +2050,12 @@ static void add_inode(root& r, uint64_t inode, uint64_t ntfs_inode, bool& is_dir
else if (wofei->Provider != WOF_PROVIDER_FILE)
throw formatted_error(FMT_STRING("Unsupported WOF provider {}."), wofei->Provider);

if (rph->ReparseDataLength < sizeof(WOF_EXTERNAL_INFO) + sizeof(FILE_PROVIDER_EXTERNAL_INFO_V0)) {
if (rph->ReparseDataLength < sizeof(wof_external_info) + sizeof(file_provider_external_info_v0)) {
throw formatted_error(FMT_STRING("rph->ReparseDataLength was {} bytes, expected {}."),
rph->ReparseDataLength, sizeof(WOF_EXTERNAL_INFO) + sizeof(FILE_PROVIDER_EXTERNAL_INFO_V0));
rph->ReparseDataLength, sizeof(wof_external_info) + sizeof(file_provider_external_info_v0));
}

auto fpei = *(FILE_PROVIDER_EXTERNAL_INFO_V0*)&wofei[1];
auto fpei = *(file_provider_external_info_v0*)&wofei[1];

if (fpei.Version != FILE_PROVIDER_CURRENT_VERSION) {
throw formatted_error(FMT_STRING("rph->FILE_PROVIDER_EXTERNAL_INFO_V0 Version was {}, expected {}."),
Expand Down

0 comments on commit 3524609

Please sign in to comment.