aboutsummaryrefslogtreecommitdiffstats
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 8fd00831a6..02ec9c9f74 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1819,21 +1819,27 @@ w32_cmdvector(const WCHAR *cmd, char ***vec, UINT cp, rb_encoding *enc)
// UNIX compatible directory access functions for NT
//
-static DWORD
-get_final_path(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
-{
- typedef DWORD (WINAPI *get_final_path_func)(HANDLE, WCHAR*, DWORD, DWORD);
- static get_final_path_func func = (get_final_path_func)-1;
+typedef DWORD (WINAPI *get_final_path_func)(HANDLE, WCHAR*, DWORD, DWORD);
+static get_final_path_func get_final_path;
- if (func == (get_final_path_func)-1) {
- func = (get_final_path_func)
- get_proc_address("kernel32", "GetFinalPathNameByHandleW", NULL);
- }
+static DWORD WINAPI
+get_final_path_fail(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
+{
+ return 0;
+}
- if (!func) return 0;
+static DWORD WINAPI
+get_final_path_unknown(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
+{
+ get_final_path_func func = (get_final_path_func)
+ get_proc_address("kernel32", "GetFinalPathNameByHandleW", NULL);
+ if (!func) func = get_final_path_fail;
+ get_final_path = func;
return func(f, buf, len, flag);
}
+static get_final_path_func get_final_path = get_final_path_unknown;
+
/* License: Ruby's */
/* TODO: better name */
static HANDLE