thrownewFileNotFoundException(DLLName+", unable to find the specified file.");
}
}
elseif(hModule==IntPtr.Zero)
{
thrownewDllNotFoundException(DLLName+", Dll was not found.");
}
returnhModule;
}
/// <summary>
/// Helper for getting the pointer to a function from a DLL loaded by the process.
/// </summary>
/// <author>Ruben Boonen (@FuzzySec)</author>
/// <param name="DLLName">The name of the DLL (e.g. "ntdll.dll" or "C:\Windows\System32\ntdll.dll").</param>
/// <param name="FunctionName">Name of the exported procedure.</param>
/// <param name="CanLoadFromDisk">Optional, indicates if the function can try to load the DLL from disk if it is not found in the loaded module list.</param>
/// <returns>IntPtr for the desired function.</returns>
thrownewFileNotFoundException(DLLName+", unable to find the specified file.");
}
}
elseif(hModule==IntPtr.Zero)
{
thrownewDllNotFoundException(DLLName+", Dll was not found.");
}
returnGetExportAddress(hModule,FunctionName);
}
/// <summary>
/// Helper for getting the base address of a module loaded by the current process. This base address could be passed to GetProcAddress/LdrGetProcedureAddress or it could be used for manual export parsing.
/// </summary>
/// <author>Ruben Boonen (@FuzzySec)</author>
/// <param name="DLLName">The name of the DLL (e.g. "ntdll.dll").</param>
/// <returns>IntPtr base address of the loaded module or IntPtr.Zero if the module is not found.</returns>