If you are rejected, you will have 90 days from the date of the refusal to restore your status. At that point, you can apply for restoration AND to change status to visitor OR apply for restoration AND new work permit(if you have corrected the issue that caused rejection or you now have a LMO).
Once you apply to restore status, you can stay in Canada until a decision is made. If they reject it again and it's been more than 90 days since your last refusal, you would have to leave Canada immediately and apply from your home country.