MCPcopy Create free account
hub / github.com/qilingframework/qiling / __get_path_elements

Method __get_path_elements

qiling/loader/pe.py:103–125  ·  view source on GitHub ↗

Translate DLL virtual path into host path. Args: name: dll virtual path; either absolute or relative Returns: dll path on the host and dll basename in a canonicalized form

(self, name: str)

Source from the content-addressed store, hash-verified

101 self.ql = ql
102
103 def __get_path_elements(self, name: str) -> Tuple[str, str]:
104 """Translate DLL virtual path into host path.
105
106 Args:
107 name: dll virtual path; either absolute or relative
108
109 Returns: dll path on the host and dll basename in a canonicalized form
110 """
111
112 dirname, basename = ntpath.split(name)
113
114 if not has_lib_ext(basename):
115 basename = f'{basename}.dll'
116
117 # if only filename was specified assume it is located at the
118 # system32 folder to prevent potential dll hijacking
119 if not dirname:
120 dirname = self.ql.os.winsys
121
122 # reconstruct the dll virtual path
123 vpath = ntpath.join(dirname, basename)
124
125 return self.ql.os.path.virtual_to_host_path(vpath), basename.casefold()
126
127 def init_function_tables(self, pe: pefile.PE, image_base: int):
128 """Parse function table data for the given PE file.

Callers 1

load_dllMethod · 0.95

Calls 2

has_lib_extFunction · 0.90
virtual_to_host_pathMethod · 0.80

Tested by

no test coverage detected