Laminar-turbulent transition is crucially influenced by wall roughness. This paper develops a numerical approach based on the harmonic linearized Navier-Stokes (HLNS) equations to accommodate the scattering effect of the rapidly distorted mean flow induced by a two-dimensional hump or indentation at the wall on the oncoming instability modes (including the Mack first and second modes) in a hypersonic boundary layer. Due to the ellipticity of the scattering system when the roughness width is comparable with the instability wavelength, the traditional linear stability theory and the linear parabolized stability equation do not apply, and therefore, the HLNS approach has advantages in both accuracy and efficiency. The impact of a roughness is characterized by a transmission coefficient, which is the ratio of the asymptotic amplitude downstream of the roughness to that upstream. At a Mach number of 5.92, the dependence of the transmission coefficient on the frequency and the oblique angle of the oncoming mode and the size and location of the hump/indentation is studied systematically. It is confirmed that the synchronization frequency appears as a critical frequency, above and below which the oncoming instability modes are suppressed and enhanced by the roughness, respectively, which provides fundamental basis to the laminar-flow control in hypersonic boundary layers.