Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trailing periods support to FindFirstFileA #75

Merged
merged 5 commits into from
May 28, 2024

Conversation

AngheloAlf
Copy link
Contributor

Adds support to handle directories with trailing periods (ie include/.) passed to FindFirstFileA and family.

I couldn't find docs on how the function should behave in this case (https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilea), but assuming it means "find anything on the passed directory" makes the program happy.

This was needed by "GCC 2.95.3 SN 1.14's cpp.exe"

I also added an assert in FindFirstFileA to check for wildcards and a few other unrelated logs. I can remove them if preferred.

@AngheloAlf
Copy link
Contributor Author

Removed the wildcard assert since the CI test passes a wildcard to FindFirstFileA

@@ -1368,17 +1379,19 @@ namespace kernel32 {
}

unsigned int WIN_FUNC GetCurrentDirectoryA(unsigned int uSize, char *lpBuffer) {
DEBUG_LOG("GetCurrentDirectoryA(%u, %p)\n", uSize, lpBuffer);
DEBUG_LOG("GetCurrentDirectoryA(%u, %p)", uSize, lpBuffer);
Copy link
Member

Choose a reason for hiding this comment

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

Why remove the \n?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the debug logs I added get printed in the same line

@@ -32,7 +32,6 @@ namespace files {
return path;
}

path = path.lexically_normal();
Copy link
Member

Choose a reason for hiding this comment

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

this is important

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is duplicated, there's another lexically_normal call above. Unless calling it twice is required?

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, definitely shouldn’t be required twice. Wonder how it got that way 🤔

@encounter encounter merged commit ca9364a into decompals:main May 28, 2024
1 check passed
@AngheloAlf AngheloAlf deleted the idk branch May 28, 2024 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants