GetModuleFileNameW can preserve the \\?\ spelling used to launch a process. * Internal UTF-8 paths use conventional DOS/UNC spelling and add the prefix * only at the Win32 file-API boundary, so remove it before widening callers * compose adjacent runtime-asset paths. */
| 186 | * only at the Win32 file-API boundary, so remove it before widening callers |
| 187 | * compose adjacent runtime-asset paths. */ |
| 188 | static inline void cbm_module_path_unprefix(wchar_t *wide) { |
| 189 | if (!wide) { |
| 190 | return; |
| 191 | } |
| 192 | if (_wcsnicmp(wide, L"\\\\?\\UNC\\", 8U) == 0) { |
| 193 | size_t tail_length = wcslen(wide + 8U); |
| 194 | wmemmove(wide + 2U, wide + 8U, tail_length + 1U); |
| 195 | wide[0] = L'\\'; |
| 196 | wide[1] = L'\\'; |
| 197 | } else if (wcsncmp(wide, L"\\\\?\\", 4U) == 0) { |
| 198 | size_t tail_length = wcslen(wide + 4U); |
| 199 | wmemmove(wide, wide + 4U, tail_length + 1U); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | static inline char *cbm_wide_to_utf8(const wchar_t *wide) { |
| 204 | if (!wide) { |
no outgoing calls
no test coverage detected