Skip to content

add GetTempFileNameW#134

Merged
encounter merged 3 commits into
decompals:mainfrom
miried:add-gettempfilenamew
Jul 11, 2026
Merged

add GetTempFileNameW#134
encounter merged 3 commits into
decompals:mainfrom
miried:add-gettempfilenamew

Conversation

@miried

@miried miried commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

needed by LINK.EXE in MSVC 4.2 when linking with a resource file

Comment thread dll/kernel32/fileapi.cpp Outdated
UINT WINAPI GetTempFileNameW(LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("GetTempFileNameW -> ");
if (!lpPathName || !lpPrefixString || !lpTempFileName) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Null lpPrefixString should be treated as empty, not invalid (your added test fails when run with wine)

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.

good point. the existing GetTempFileNameA was doing the same, but it was untested, so it was not obvious. I changed both also with a test for the A variant. I can't test against Wine on this machine but I'll do as soon as I have access to one.

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.

I managed to test with Wine, on an arm mac. test_gettempfilename was already failing on current main branch for me. I added a fix for one fail:

Only the lower 16 bits of the uUnique parameter are used.

see https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea#remarks

Note it's still failing on my test machine because of expected file path having .TMP in upper-case letters, while for me it is lower-case (test file line 27). I will look into this when I have time.

@miried miried force-pushed the add-gettempfilenamew branch from 54b10c1 to 2c331c0 Compare July 11, 2026 12:52
@encounter

Copy link
Copy Markdown
Member

Thanks!

@encounter encounter merged commit d7db13a into decompals:main Jul 11, 2026
12 checks passed
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.

2 participants