On Thu, Oct 18, 2001 at 05:57:22PM -0700, Alexandre Julliard wrote:
Ove Kaaven ovehk@ping.uio.no writes:
But since to do this, MapViewOfFile needs to know the media type, and the file name is only known in CreateFile, I apparently need to store the media type in the wineserver object to accomplish this.
Would changing the wineserver protocol in this way be a good idea?
It's certainly a possibility. It would be nice to be able to tell directly from the file descriptor, so that we wouldn't depend on the user getting the drive specifications right. But I can't think of a Unix function that would allow doing this cleanly.
Well, nearly clean would be this code:
The defines are Linux specific, but could be handled by ifdef/autoconf checks. Solaris has fstatvfs() and probably similar magic constants.
BOOL is_on_cdrom(int fd) { struct statfs buf;
if (-1==fstatfs(fd,&buf)) return FALSE; return ((buf.f_type == ISOFS_SUPER_MAGIC)||(buf.f_type == UDF_SUPER_MAGIC)); }
Ciao, Marcus