Have you also initialised rgnMain? Somewhat counterintuitively (but as described in the documentation for CombineRgn()) the destination/output region must exist in order to receive the required combination of the two input regions, but it can be an entirely empty region:
rgnMain := CreateRectRgn(0, 0, 0, 0);
if CombineRgn(rgnMain, rgn1, rgn2, RGN_OR) ... then
// etc
If you wish to avoid having to create an entirely separate region then it is acceptable and possible to specify one of the input regions as the destination region (by definition an input region must be an existing, valid region so this avoids having to separately initialise a new destination region):
if CombineRgn(rgn1, rgn1, rgn2, RGN_OR) ... then
// etc