It's possible to query the physics system to get all the physical objects/entities contained into a specific box volume defined by a minimum and a maximum point.
For achieving this result you can use the function GetEntitiesInBox:
... as follows:
The function GetEntitiesInBox returns the number of entities found and receives the following parameters:
Minimum point in the space that defines the desired box volume.
Maximum point in the space that defines the desired box volume.
Pointer to a list of objects that will be filled by the function.
Types of objects that need to be considered in the query.
If specified it's the maximum number of objects contained by the pList array.
The possible object types are described into the header physinterface.h in the entity_query_flags enumerators. Some of the possibilities are:
Entity type flag
Sleeping rigid bodies
At this point you can easily iterate through the objects and perform the desired operations