I need to know how Windows detects what resolutions the user can select for their monitor / graphics card. I'm pretty sure it's an API call, but does anyone know what it is?

I already have code to change it (courtesy of this thread here), and I was wondering if it was possible to get a list of valid and allowable resolutions.