From 92642f211eb8b38488131559344cd2dd76019900 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Tue, 6 Feb 2024 11:23:46 -0500 Subject: [PATCH] debug windows build --- src/util/pm_string.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/pm_string.c b/src/util/pm_string.c index f9e96fdd0a..391593327c 100644 --- a/src/util/pm_string.c +++ b/src/util/pm_string.c @@ -65,12 +65,14 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { HANDLE file = CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file == INVALID_HANDLE_VALUE) { - return errno; + int e = rb_w32_map_errno(GetLastError()); + return e; } // Get the file size. DWORD file_size = GetFileSize(file, NULL); if (file_size == INVALID_FILE_SIZE) { + fprintf(stderr, "invalid file size\n"); CloseHandle(file); return errno; } @@ -79,6 +81,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { // the source to a constant empty string and return. if (file_size == 0) { CloseHandle(file); + fprintf(stderr, "close handle\n"); const uint8_t source[] = ""; *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 }; return 0; @@ -88,6 +91,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { HANDLE mapping = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL); if (mapping == NULL) { CloseHandle(file); + fprintf(stderr, "close handle, mapping is null\n"); return errno; } @@ -97,6 +101,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { CloseHandle(file); if (source == NULL) { + fprintf(stderr, "source was null\n"); return errno; }