A friend of mine was illegally living in an european country for about 7 years. Does he have to provide police certificates from that country if he won the lottery? There aren't any official records of him in that european country.
His immigration status doesn't necessarily affect his ability to get a police certificate. Provided he has no criminal record, it should not be a problem for US immigration purposes. He should check the procedures for the specific country concerned. For some EU countries, the US embassy will obtain the certificate, while in most he would need to apply himself.