Controlling injection and propagation of domain walls in magnetic nanowires