#drive stuff, probably should be moved
import ctypes

import wine

def get_drives():
    length = ctypes.windll.kernel32.GetLogicalDriveStringsA(ctypes.c_uint32(0), ctypes.c_uint32(0))
    result = ctypes.create_string_buffer(length+1)
    length = ctypes.windll.kernel32.GetLogicalDriveStringsA(length, result)
    result = result.raw[0:length].strip('\0').split('\0')
    
    #wine-specific: check for mounted filesystems that maybe weren't mapped by wine
    
    try:
        for line in wine.unix_cmd('mount').splitlines():
            words = line.split(' ')
            if words[1] != 'on':
                continue
            path = wine.unix_to_windows(words[2])
            if path not in result:
                result.append(path)
    except:
        pass
    return result
