Skip to content

GetFinalPathNameByHandle fails with ERROR_FILE_NOT_FOUND #554

Closed

Description

@rustyx

For some reason Git isn't working with a repo mounted via encfs4win (I remember it did before, but don't know what/where changed).

I traced the issue down to the call to GetFinalPathNameByHandle which on my system fails with error 2, ERROR_FILE_NOT_FOUND.

Here's a test program to reproduce the issue.

#include <stdio.h>
#include <Windows.h>

int main(int argc, char**argv) {
    char buf[512];
    if (argc < 2) {
        fprintf(stderr, "Usage: %s <some path>\n", argv[0]);
        return 1;
    }
    HANDLE hnd = CreateFileA(
        argv[1], 0,
        FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
        NULL, OPEN_EXISTING, 0, NULL);
    if (hnd == INVALID_HANDLE_VALUE) {
        fprintf(stderr, "CreateFile(%s) failed, LastError %d\n", argv[1], GetLastError());
        return 1;
    }
    if (!GetFinalPathNameByHandleA(hnd, buf, sizeof(buf), 0)) {
        fprintf(stderr, "GetFinalPathNameByHandle(%s) failed, LastError %d\n", argv[1], GetLastError());
        return 1;
    }
    printf("OK: %s\n", buf);
}

It works for any path outside encfs4win and fail for any path inside encfs4win.
Any idea how to debug this further?

Activity

  1. rustyx commented on Jul 22, 2019

    @rustyx
    Author

    Never mind, wrong project (was planning to post on encfs4win).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions