Foreign students who want to apply for acceptance at a German university need, like the German applicants, a Certificate of Qualification for higher education (Hochschulzugangsberechtigung). If the Certificate of Qualification for higher education from your home country is comparable to the German Abitur you will have direct access to german universities. If you are only allowed to study certain subjects in your country due to your school degree, then this is the same case in Germany.
You can figure out how your degree is classified in Germany on this website: www.anabin.kmk.org
If your Certificate of Qualification for higher education is not comparable to a German Abitur, then you must pass an assessment test (Feststellungsprüfung) to be able to apply for the desired subjects. You will be prepared for this test through a one-year course at the Studienkolleg.