Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/clang/unittests/HLSLExec/ExecutionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,10 @@ class ExecutionTest {
return false;
}

if (GetModuleHandle("d3d10warp.dll") != NULL) {
CHAR szFullModuleFilePath[MAX_PATH] = "";
GetModuleFileName(GetModuleHandle("d3d10warp.dll"),
szFullModuleFilePath, sizeof(szFullModuleFilePath));
if (GetModuleHandleW(L"d3d10warp.dll") != NULL) {
Copy link
Copy Markdown
Collaborator

@farzonl farzonl Mar 20, 2025

Choose a reason for hiding this comment

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

This change looks good. However, I've seen projects where the use of the W api function vs the char one was controlled via a compile time flag. Would there be any reason to do that here?

Copy link
Copy Markdown
Contributor

@tex3d tex3d Mar 20, 2025

Choose a reason for hiding this comment

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

Yes, there have been projects that do this. However, our char strings are not ASCII or based on some current global character set, they are utf-8. The char APIs are not Unicode. Therefore, we should always use the Unicode wide string APIs. We have no reason to ever build for the non-Unicode APIs.

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.

By the way, this is the reason for all the forced conversions in the DXC API. The only Unicode API style for Windows (and thus COM APIs) is the wide string APIs, yet we internally use char strings representing Unicode in UTF-8 encoding.

WCHAR szFullModuleFilePath[MAX_PATH] = L"";
GetModuleFileNameW(GetModuleHandleW(L"d3d10warp.dll"),
szFullModuleFilePath, sizeof(szFullModuleFilePath));
WEX::Logging::Log::Comment(WEX::Common::String().Format(
L"WARP driver loaded from: %S", szFullModuleFilePath));
}
Expand Down