Skip to content

Hook the CreateDirectory*() functions#122

Merged
thelink2012 merged 3 commits intothelink2012:masterfrom
TheComputerGuy96:createdirectory-hook
Apr 26, 2026
Merged

Hook the CreateDirectory*() functions#122
thelink2012 merged 3 commits intothelink2012:masterfrom
TheComputerGuy96:createdirectory-hook

Conversation

@TheComputerGuy96
Copy link
Copy Markdown
Contributor

ZMenu still doesn't fully work with modloader though (the strings for the Mod Configuration menu are all empty which doesn't happen when using a normal ASI loader)

Maybe that issue could be worked around by delaying the loading of the modloader strings (but the mod should probably be fixed itself with some memory patches?)

@thelink2012
Copy link
Copy Markdown
Owner

Hey @TheComputerGuy96. Thanks for your contribution. I'll merge both this and #120 and publish a new release soon.

Just worried that this may cause some side-effect somewhere it shouldn't. But so far I've not thought of a edge case.

@SandeMC
Copy link
Copy Markdown

SandeMC commented Feb 21, 2025

@thelink2012 hey, any news on that release?

@thelink2012
Copy link
Copy Markdown
Owner

Hey @SandeMC, a bit busy here so I'll probably not be able to merge this before May.

Copy link
Copy Markdown
Contributor

@CookiePLMonster CookiePLMonster left a comment

Choose a reason for hiding this comment

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

CreateDirectoryExA and CreateDirectoryExW also need shims.

ZMenu calls CreateDirectoryW() to create the ZMenu directory for
storing some .ini files (which currently ends up in the root game folder)
@thelink2012
Copy link
Copy Markdown
Owner

thelink2012 commented Apr 25, 2026

@TheComputerGuy96 thanks and sorry for the long delay.

Which mod is behaving badly because of the lack of CreateDirectory hooks? Can you provide more details? Is it ZMenu?

@TheComputerGuy96
Copy link
Copy Markdown
Contributor Author

@thelink2012 ZMenu creates its own folder in the GTA San Andreas root folder (or maybe the folder relative to the .asi?) to store a speedrun configuration file (but due to the missing hook, the directory gets created in the wrong place and thus that config file likely can't be created due to the missing folder)

Guards TranslatePathChar before IsAbsolutePath; optional API parameters may be NULL (e.g. CreateDirectoryEx template directory).
CreateDirectory/CreateDirectoryW and CreateDirectoryEx new-directory args use
IN; Ex lpTemplateDirectory uses INE when a template path is present.
@thelink2012 thelink2012 merged commit d9974aa into thelink2012:master Apr 26, 2026
@thelink2012
Copy link
Copy Markdown
Owner

Thanks @TheComputerGuy96!

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.

4 participants