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

Open dialogs malfunction if .exe invoked with module in command line #74

Closed
nyanpasu64 opened this issue Aug 1, 2021 · 4 comments · Fixed by #76
Closed

Open dialogs malfunction if .exe invoked with module in command line #74

nyanpasu64 opened this issue Aug 1, 2021 · 4 comments · Fixed by #76

Comments

@nyanpasu64
Copy link
Collaborator

noticed Dn isn't a fan of opening the downloads folder if you opened the program with a module file (i.e: double clicked an associated FTM/0cc file to open)

I used to see this, no longer see it.

I've noticed FamiTracker versions in general change how the filesystem browses depending on whether you opened FamiTracker from a module or if you open it from the executable itself

Certain directories just kinda become inaccessible if you open from module

On my machine, if you call the dn-ft .exe and pass in a .0cc or .ftm file, then the Open dialog is missing "This PC".

This occurs regardless if you call it by a 8.3 .exe name or a long path, through either a file association or in a console. (Dn-FT sets itself as a file handler for .0cc files, using a 8.3 path for the EXE, but the module is passed in as a long path. This is not the bug.) It does not occur if you call Dn-FamiTracker.exe -console (a command line argument that's not a file to open).

@nyanpasu64
Copy link
Collaborator Author

Dn-FamiTracker_R2XoUjupwZ

@nyanpasu64
Copy link
Collaborator Author

AfxResolveShortcut is sufficient to reproduce the bug even with no file being opened.

devenv_ecvyQugqlK

@nyanpasu64
Copy link
Collaborator Author

nyanpasu64 commented Aug 2, 2021

ProcessShellCommand indirectly calls SHGetFileInfo.

turns out calling SHGetFileInfo (SHGetFileInfoA) on existing .0cc files within your user directory (didn't test non-.0cc files) causes the file dialog to break.

no breakage when calling it on existing .0cc files in C:\ (didn't test other users), or non-existent .0cc files within your user profile.

also this bug dates back to ft 0.4.6, but not mspaint or wordpad (first party microsoft mfc apps).

i ran procmon on this single function call. i did notice SHGetFileInfoA accessed a lot of registry HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions{guid}...

procmon records the call stack, it's SHGetFileInfoA -> SHGetFileInfoW -> SHParseDisplayName.

what happens when i function-breakpoint that name in visual studio?

  • first break is SHGetFileInfoA -> SHGetFileInfoW -> SHParseDisplayName.
  • subsequent breaks are shell32.dll!SHGetFileInfoW -> shell32.dll!_SHParseDisplayName -> windows.storage.dll -> windows.storage.dll!SHParseDisplayName.

are you supposed to call ProcessShellCommand within InitInstance? i assume so, microsoft says to.

@nyanpasu64
Copy link
Collaborator Author

RegOverridePredefKey is called because, uhh... something about windows vista.

if the first call to SHGetFileInfo occurs after the call to RegOverridePredefKey, but before the app finishes loading and the user opens a file dialog, then all file dialogs are fucked up.

a shitty workaround is to call SHGetFileInfo (or SHParseDisplayName?) before calling RegOverridePredefKey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant