I have found the problems with both CreateDevice and CreateSurface calls.
There are a couple of other bugs too, the terrain engine was trying to create bump map textures even if your card didn''t support it. Ex02 had MP3 playing code in it (mp3test started as ex02), but no MP3 file existed in that directory.
I''ll put the updated files on the FTP when they are ready.
You won''t have to download the entire archive again.