Sergey,
It should return 122 and I suppose it is designed to return 122 so you can call it again with correct parameters but the point is that EnumForms is returning 0 for failure and GetLastError is returning 0 not 122 as it should. What is going on? In addition when EnumForms is called again vfp goes byebye.
A problem is a problem only as long as it has a possible solution. Lacking that, it becomes a FACT!