-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
On a mounted VHD without a drive letter: error: unable to find zig self exe path: FileNotFound
#19731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can't reproduce
What filesystem are you using? Is there anything interesting about the path you're running from (non-ASCII characters, symbols, etc)? |
Yes, the problem is in path. No spaces or non-ASCII letters present in it. But I have a |
If you could give some instructions on how to recreate your setup that'd be helpful. |
Mostly interested in how to do this:
EDIT: Nevermind, found the option in Disk Management's New Simple Wizard Volume (Mount in the following empty NTFS folder) |
Can reproduce now, thanks!
|
error: unable to find zig self exe path: FileNotFound
The error is coming from here in Line 1377 in a7e4d17
The final path gotten from EDIT: The mount point symlink is |
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH. Fixes ziglang#19731
Quick and dirty program written in C. seems to work correctly. Should be easy to port from C to Zig. #include <assert.h> /* assert */
#include <stdio.h> /* wprintf */
#include <windows.h>
#define count(x) (sizeof(x) / sizeof((x)[0]))
int wmain(int argc, wchar_t** argv)
{
if(argc != 2)
{
return __LINE__;
}
HANDLE file = CreateFileW(argv[1], FILE_GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL);
if(file == INVALID_HANDLE_VALUE)
{
return __LINE__;
}
wchar_t path[1 * 1024]; /* max len is 64kB, thus 32k wchars */
DWORD dw = GetFinalPathNameByHandleW(file, path, count(path), FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
assert(dw != count(path));
if(dw == 0 || dw > count(path))
{
return __LINE__;
}
wchar_t const* name;
size_t len;
if
(
dw >= 7 &&
path[0] == L'\\' &&
path[1] == L'\\' &&
path[2] == L'?' &&
path[3] == L'\\' &&
((path[4] >= L'a' && path[4] <= L'z') || (path[4] >= L'A' && path[4] <= L'Z')) &&
path[5] == L':' &&
path[6] == L'\\'
)
{
name = path + 4;
len = dw - 4;
}
else
{
name = path;
len = dw;
}
wprintf(L"Final Win32 name is: %s\n", name);
} |
Thank you for speedy response. That is great. But wow, depending on NTAPI in general purpose tool (programming language) is ... bold. |
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH. Fixes ziglang#19731
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH. Fixes ziglang#19731
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH. Fixes ziglang#19731
A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH. Fixes #19731
Fix cherry-picked into 0.12.x branch as e36bf2b. |
Zig Version
0.12.0
Steps to Reproduce and Observed Behavior
zig cc test.c
Actual Behavior:
error: unable to find zig self exe path: FileNotFound
[1]
Expected Behavior
No error message.
The text was updated successfully, but these errors were encountered: