Skip to content

Filesystem/Win32: Recreate hardlinks on fs::pending_file - #16256

Merged
elad335 merged 4 commits into
RPCS3:masterfrom
elad335:lv2
Oct 29, 2024
Merged

elad335 merged 4 commits into
RPCS3:masterfrom
elad335:lv2

Conversation

@elad335

@elad335 elad335 commented Oct 27, 2024 •

Copy link
Copy Markdown
Contributor

Attempting to address #16255
Also fixes #16260

@elad335
elad335 force-pushed the lv2 branch 3 times, most recently from 8f58b56 to a3ff474 Compare October 27, 2024 13:09
@elad335
elad335 marked this pull request as draft October 27, 2024 13:22
Comment thread Utilities/File.cpp Outdated
ensure(SetFileInformationByHandle(file.get_handle(), FileDispositionInfo, &disp, sizeof(disp)));
}

std::vector<std::wstring> hardlinkPaths;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scnakecase

Comment thread Utilities/File.cpp Outdated

const auto ws1 = to_wchar(m_path);

const HANDLE fileHandle = CreateFileW(ws1.get(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snakecase

Comment thread Utilities/File.cpp Outdated
while (fileHandle != INVALID_HANDLE_VALUE)
{
// Get file ID (used to check for hardlinks)
BY_HANDLE_FILE_INFORMATION fileInfo;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snakecase

Comment thread Utilities/File.cpp Outdated

// Buffer for holding link name
WCHAR linkNameBuffer[MAX_PATH];
HANDLE findHandle = FindFirstFileNameW(ws1.get(), 0, nullptr, linkNameBuffer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:
-Limiting to MAX_PATH on windows has been a problem in the past if I recall, we should avoid that if possible
-Is nullptr for StringLength even valid, documentation doesn't mention it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@elad335
elad335 force-pushed the lv2 branch 3 times, most recently from 307c02c to a896624 Compare October 28, 2024 05:15
@elad335
elad335 marked this pull request as ready for review October 28, 2024 10:19
@digant73

Copy link
Copy Markdown
Contributor

maybe the fix for #16245 (reported in that PR) could be also provided in this PR

Comment thread Utilities/File.cpp Outdated
while (true)
{
buffer_size = link_name_buffer.size() - 1;
findHandle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
findHandle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data());
find_handle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data());

@elad335
elad335 force-pushed the lv2 branch 11 times, most recently from 411b52d to db4a7ca Compare October 29, 2024 15:06
@elad335
elad335 force-pushed the lv2 branch 2 times, most recently from fd8df8d to cca8138 Compare October 29, 2024 15:16
@elad335
elad335 force-pushed the lv2 branch 2 times, most recently from 4808c47 to 0b7a9f8 Compare October 29, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] RPCS3 Doesn't Boot Correctly For Some Systems

4 participants