diff --git a/lib/win32/dir.rb b/lib/win32/dir.rb index e3c9921..5e9c6f3 100644 --- a/lib/win32/dir.rb +++ b/lib/win32/dir.rb @@ -78,12 +78,12 @@ class Dir elsif SHGetFolderPathW(0, value, 0, 1, buf) == 0 # Default path path = buf.strip else - ptr = FFI::MemoryPointer.new(:long) + ptr = FFI::MemoryPointer.new(:uint64) info = SHFILEINFO.new flags = SHGFI_DISPLAYNAME | SHGFI_PIDL if SHGetFolderLocation(0, value, 0, 0, ptr) == 0 - if SHGetFileInfo(ptr.read_long, 0, info, info.size, flags) != 0 + if SHGetFileInfo(ptr.read_uint64, 0, info, info.size, flags) != 0 path = info[:szDisplayName].to_s path.force_encoding(Encoding.default_external) end diff --git a/lib/win32/dir/functions.rb b/lib/win32/dir/functions.rb index 094f4b1..ecb52c9 100644 --- a/lib/win32/dir/functions.rb +++ b/lib/win32/dir/functions.rb @@ -27,7 +27,7 @@ def attach_pfunc(*args) attach_pfunc :SHGetFolderPathW, %i{hwnd int handle dword buffer_out}, :dword attach_pfunc :SHGetFolderLocation, %i{hwnd int handle dword ptr}, :dword - attach_pfunc :SHGetFileInfo, %i{dword dword ptr uint uint}, :dword + attach_pfunc :SHGetFileInfo, %i{uint64 dword ptr uint uint}, :dword ffi_lib :shlwapi ffi_convention :stdcall