Typical techniques for this are either using stubs/drivers or execution from a debugger environment.