The problem is in EnumResTypeProc. You cannot assume that lpszType is a string, it might be INT_RESOURCE.
INT_RESOURCE is an integer disguised inside a string pointer - ugly but there you have it.
...