--- sourceforge.net/trunk/rdesktop/rdpdr.c 2004/04/15 20:12:42 651 +++ sourceforge.net/trunk/rdesktop/rdpdr.c 2004/04/16 14:04:02 662 @@ -1,3 +1,38 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Copyright (C) Matthew Chapman 1999-2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + Here are some resources, for your IRP hacking pleasure: + + http://cvs.sourceforge.net/viewcvs.py/mingw/w32api/include/ddk/winddk.h?view=markup + + http://win32.mvps.org/ntfs/streams.cpp + + http://www.acc.umu.se/~bosse/ntifs.h + + http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/File/ + + http://us1.samba.org/samba/ftp/specs/smb-nt01.txt + + http://www.osronline.com/ +*/ + #include #include #include @@ -623,6 +658,25 @@ result = buffer_len = out.p - out.data; break; + + case IRP_MJ_LOCK_CONTROL: + + if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) + { + status = STATUS_INVALID_HANDLE; + break; + } + + in_uint32_le(s, info_level); + + out.data = out.p = buffer; + out.size = sizeof(buffer); + /* FIXME: Perhaps consider actually *do* + something here :-) */ + status = STATUS_SUCCESS; + result = buffer_len = out.p - out.data; + break; + default: unimpl("IRP major=0x%x minor=0x%x\n", major, minor); break; @@ -755,11 +809,13 @@ { uint32 select_timeout = 0; // Timeout value to be used for select() (in millisecons). struct async_iorequest *iorq; + char c; iorq = g_iorequest; while (iorq != NULL) { - if (iorq->fd != 0) + /* We need to test that the fd is still valid */ + if ((iorq->fd != 0) && (read(iorq->fd, &c, 0) == 0)) { switch (iorq->major) {