I had a problem with Phyton uprog32 (eprom programmer). This program first scans available parports by opening them (from LPT1 to LPT4) and then uses direct port access. While latter is ok with ppdev, open(LPT) fails with (LPT1 fo example): fixme:dosfs:DOSFS_OpenDevice device open L"LPT1" not supported (yet) err:file:CreateFileW Couldn't open device L"LPT1"! so here is my patch. i doubt it's correct, but at least it works (now i can use my ChipProg+ under Linux!!!) Changelog: Kirill Smelkov <kirr@xxxxxxxxxxxxxxxxxxx> semi-stub for CreateFile("LPT")
Index: files/dos_fs.c =================================================================== RCS file: /home/wine/wine/files/dos_fs.c,v retrieving revision 1.143 diff -u -r1.143 dos_fs.c --- files/dos_fs.c 27 Nov 2003 00:59:36 -0000 1.143 +++ files/dos_fs.c 2 Dec 2003 20:38:55 -0000 @@ -65,6 +65,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dosfs); WINE_DECLARE_DEBUG_CHANNEL(file); +WINE_DECLARE_DEBUG_CHANNEL(lpt); /* Define the VFAT ioctl to get both short and long file names */ /* FIXME: is it possible to get this to work on other systems? */ @@ -917,6 +918,73 @@ return ret; } +/************************************************************************** + * DOSFS_CreateParPort + */ +static HANDLE DOSFS_CreateParPort(LPCWSTR name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa) +{ + HANDLE ret; + HKEY hkey; + DWORD dummy; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW; + WCHAR *devnameW; + char tmp[128]; + char devname[40]; + + static const WCHAR parportsW[] = {'M','a','c','h','i','n','e','\\', + 'S','o','f','t','w','a','r','e','\\', + 'W','i','n','e','\\','W','i','n','e','\\', + 'C','o','n','f','i','g','\\', + 'P','a','r','a','l','l','e','l','P','o','r','t','s',0}; + + TRACE_(lpt)("%s %lx %lx\n", debugstr_w(name), access, attributes); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &nameW; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &nameW, parportsW ); + + if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return 0; + + RtlInitUnicodeString( &nameW, name ); + if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy )) + devnameW = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data; + else + devnameW = NULL; + + NtClose( hkey ); + if (!devnameW) return 0; + WideCharToMultiByte(CP_ACP, 0, devnameW, -1, devname, sizeof(devname), NULL, NULL); + + TRACE_(lpt)("opening %s as %s\n", devname, debugstr_w(name)); + + SERVER_START_REQ( create_file ) + { + req->access = access; + req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); + req->attrs = attributes; + req->sharing = FILE_SHARE_READ|FILE_SHARE_WRITE; + req->create = OPEN_EXISTING; + req->removable = 0; + wine_server_add_data( req, devname, strlen(devname) ); + SetLastError(0); + wine_server_call_err( req ); + ret = reply->handle; + } + SERVER_END_REQ; + + if(!ret) + ERR("Couldn't open device '%s' ! (check permissions)\n",devname); + else + TRACE("return %p\n", ret ); + + return ret; +} + /*********************************************************************** * DOSFS_OpenDevice * @@ -977,6 +1045,8 @@ } if( (handle=DOSFS_CreateCommPort(DOSFS_Devices[i].name,access,attributes,sa)) ) + return handle; + if( (handle=DOSFS_CreateParPort(DOSFS_Devices[i].name,access,attributes,sa)) ) return handle; FIXME("device open %s not supported (yet)\n", debugstr_w(DOSFS_Devices[i].name)); return 0;