MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / ResolveIncludePath

Function ResolveIncludePath

hyperdbg/script-engine/code/script_include.c:120–143  ·  view source on GitHub ↗

* @brief Resolves an include file path to a full absolute path * * @param IncludeFilePath the include file path (relative or absolute) * @param OutPath the buffer to receive the resolved path * @return VOID */

Source from the content-addressed store, hash-verified

118 * @return VOID
119 */
120VOID
121ResolveIncludePath(const char * IncludeFilePath, char * OutPath)
122{
123 if (IsAbsolutePath(IncludeFilePath))
124 {
125 strncpy(OutPath, IncludeFilePath, MAX_PATH_LEN - 1);
126 OutPath[MAX_PATH_LEN - 1] = '\0';
127 return;
128 }
129
130 CHAR ExeDir[MAX_PATH_LEN];
131 GetModuleFileNameA(NULL, ExeDir, MAX_PATH_LEN);
132
133 char * P = strrchr(ExeDir, '\\');
134 if (P)
135 *P = '\0';
136
137 snprintf(
138 OutPath,
139 MAX_PATH_LEN,
140 "%s\\%s",
141 ExeDir,
142 IncludeFilePath);
143}
144
145/**
146 * @brief Checks whether a file exists at the given path

Callers 1

CodeGenFunction · 0.85

Calls 1

IsAbsolutePathFunction · 0.85

Tested by

no test coverage detected