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. */
| 129 | * only at the Win32 file-API boundary, so remove it before widening callers |
| 130 | * compose adjacent runtime-asset paths. */ |
| 131 | static inline void cbm_module_path_unprefix(wchar_t *wide) { |
| 132 | if (!wide) { |
| 133 | return; |
| 134 | } |
| 135 | if (_wcsnicmp(wide, L"\\\\?\\UNC\\", 8U) == 0) { |
| 136 | size_t tail_length = wcslen(wide + 8U); |
| 137 | wmemmove(wide + 2U, wide + 8U, tail_length + 1U); |
| 138 | wide[0] = L'\\'; |
| 139 | wide[1] = L'\\'; |
| 140 | } else if (wcsncmp(wide, L"\\\\?\\", 4U) == 0) { |
| 141 | size_t tail_length = wcslen(wide + 4U); |
| 142 | wmemmove(wide, wide + 4U, tail_length + 1U); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | static inline char *cbm_wide_to_utf8(const wchar_t *wide) { |
| 147 | if (!wide) { |
no outgoing calls
no test coverage detected