diff --git a/system_dll.py b/system_dll.py index f3970f0..e9395f4 100644 --- a/system_dll.py +++ b/system_dll.py @@ -92,8 +92,9 @@ def __init__ (self, handle, base): if file_ptr: # query for the filename of the mapped file. filename = create_string_buffer(2048) - psapi.GetMappedFileNameA(kernel32.GetCurrentProcess(), file_ptr, byref(filename), 2048) - + filename_length = psapi.GetMappedFileNameA(kernel32.GetCurrentProcess(), file_ptr, byref(filename), 2048) + if filename_length == 0: + return # store the full path. this is kind of ghetto, but i didn't want to mess with QueryDosDevice() etc ... self.path = os.sep + filename.value.split(os.sep, 3)[3] @@ -115,4 +116,4 @@ def __del__ (self): Close the handle. ''' - kernel32.CloseHandle(self.handle) \ No newline at end of file + kernel32.CloseHandle(self.handle)