8000 Bindings/libgit2sharp/020 2 by grossvin22 · Pull Request #3337 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Bindings/libgit2sharp/020 2 #3337

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

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
checkout tests: cleanup realpath impl on Win32
  • Loading branch information
Edward Thomson committed Jan 19, 2015
commit aa521b6053570407c361de7eddcd78aa9a7df149
42 changes: 6 additions & 36 deletions tests/checkout/icase.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,51 +30,21 @@ void test_checkout_icase__cleanup(void)
cl_git_sandbox_cleanup();
}

static char *p_realpath(const char *in)
static char *test_realpath(const char *in)
{
#ifdef GIT_WIN32
/*

HANDLE fh, mh;
HINSTANCE psapi;
BY_HANDLE_FILE_INFORMATION fi;
void *map;
char *filename;
size_t filename_len = 1024;

typedef DWORD (__stdcall *getmappedfilename)(HANDLE, LPVOID, LPTSTR, DWORD);
getmappedfilename getfunc;

cl_assert(filename = malloc(filename_len));

cl_win32_pass(psapi = LoadLibrary("psapi.dll"));
cl_win32_pass(getfunc = (getmappedfilename)GetProcAddress(psapi, "GetMappedFileNameA"));

cl_win32_pass(fh = CreateFileA(in, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL));
cl_win32_pass(mh = CreateFileMapping(fh, NULL, PAGE_READONLY, 0, 1, NULL));

cl_win32_pass(map = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, 1));

cl_win32_pass(getfunc(GetCurrentProcess(), map, filename, filename_len));

UnmapViewOfFile(map);
CloseHandle(mh);
CloseHandle(fh);
*/

HANDLE fh;
HINSTANCE kerneldll;
HMODULE kerneldll;
char *filename;

typedef DWORD (__stdcall *getfinalpathname)(HANDLE, LPSTR, DWORD, DWORD);
getfinalpathname getfinalpathfn;

cl_assert(filename = malloc(MAX_PATH));
cl_win32_pass(kerneldll = LoadLibrary("kernel32.dll"));
cl_win32_pass(getfinalpathfn = (getfinalpathname)GetProcAddress(kerneldll, "GetFinalPathNameByHandleA"));
cl_assert(kerneldll = LoadLibrary("kernel32.dll"));
cl_assert(getfinalpathfn = (getfinalpathname)GetProcAddress(kerneldll, "GetFinalPathNameByHandleA"));

cl_win32_pass(fh = CreateFileA(in, FILE_READ_ATTRIBUTES | STANDARD_RIGHTS_READ, FILE_SHARE_READ,
cl_assert(fh = CreateFileA(in, FILE_READ_ATTRIBUTES | STANDARD_RIGHTS_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL));

cl_win32_pass(getfinalpathfn(fh, filename, MAX_PATH, VOLUME_NAME_DOS));
Expand All @@ -94,7 +64,7 @@ static void assert_name_is(const char *expected)
char *actual;
size_t actual_len, expected_len, start;

cl_assert(actual = p_realpath(expected));
cl_assert(actual = test_realpath(expected));

expected_len = strlen(expected);
actual_len = strlen(actual);
Expand Down
0