# HG changeset patch # User ib # Date 1325337923 0 # Node ID e195ad9bdc59891f9010c4b438f7162c2114adeb # Parent 6b558b00939a73b6a1c6276e63848065c5f29894 Allow Windows style devices for Wine port. Determine the Linux style device by asking Wine's mount manager. diff -r 6b558b00939a -r e195ad9bdc59 gui/win32/interface.c --- a/gui/win32/interface.c Sat Dec 31 13:20:29 2011 +0000 +++ b/gui/win32/interface.c Sat Dec 31 13:25:23 2011 +0000 @@ -25,6 +25,11 @@ #if defined(__CYGWIN__) || defined(__WINE__) #define _beginthreadex CreateThread +#ifdef __WINE__ +#include +#define WINE_MOUNTMGR_EXTENSIONS +#include +#endif #else #include #endif @@ -76,6 +81,53 @@ const vo_functions_t *video_out = NULL; mixer_t *mixer = NULL; +#ifdef __WINE__ +/** + * @brief Convert a Windows style device name into an Unix style one. + * + * @param device pointer to the device name to be converted + * + * @return pointer to the converted device name + */ +static char *unix_device (char *device) +{ + static char *unix_devname; + HANDLE mgr; + DWORD size = 1024; + + mgr = CreateFileW(MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + + if (mgr != INVALID_HANDLE_VALUE) + { + struct mountmgr_unix_drive input; + struct mountmgr_unix_drive *data; + + data = HeapAlloc(GetProcessHeap(), 0, size); + + if (data) + { + memset(&input, 0, sizeof(input)); + input.letter = *device; + + if (DeviceIoControl(mgr, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, &input, sizeof(input), data, size, NULL, NULL)) + { + if (data->device_offset) + { + setdup(&unix_devname, (char *) data + data->device_offset); + device = unix_devname; + } + } + + HeapFree(GetProcessHeap(), 0, data); + } + + CloseHandle(mgr); + } + + return device; +} +#endif + /* test for playlist files, no need to specify -playlist on the commandline. * add any conceivable playlist extensions here. * - Erik @@ -119,6 +171,12 @@ guiInfo.Angle = 1; guiInfo.NewPlay = GUI_FILE_SAME; +#ifdef __WINE__ + // dvd_device is in the Windows style (D:\), which needs to be + // converted for MPlayer, so that it will find the device in the + // Linux filesystem. + dvd_device = unix_device(dvd_device); +#endif uiSetFileName(NULL, dvd_device, STREAMTYPE_DVD); dvdname[0] = 0; strcat(dvdname, "DVD Movie");