The Windows API was very easy to find. Generally if he can call an executable that can fetch that MDM status, it is almost certain that executable calls some function in some library to get it.
I was curious so I checked, it uses CPProfileManager and CP_GetManagementStatus, a private undocumented MacOS API. That's one hostile OS, at least Microsoft was forced by court to open its APIs