--- sourceforge.net/trunk/rdesktop/rdpdr.c 2004/03/04 08:24:40 627 +++ sourceforge.net/trunk/rdesktop/rdpdr.c 2004/04/16 11:28:34 657 @@ -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 @@ -5,12 +40,6 @@ #include #include "rdesktop.h" -#define IRP_MJ_CREATE 0x00 -#define IRP_MJ_CLOSE 0x02 -#define IRP_MJ_READ 0x03 -#define IRP_MJ_WRITE 0x04 -#define IRP_MJ_DEVICE_CONTROL 0x0e - #define IRP_MJ_CREATE 0x00 #define IRP_MJ_CLOSE 0x02 #define IRP_MJ_READ 0x03 @@ -20,6 +49,7 @@ #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a #define IRP_MJ_DIRECTORY_CONTROL 0x0c #define IRP_MJ_DEVICE_CONTROL 0x0e +#define IRP_MJ_LOCK_CONTROL 0x11 #define IRP_MN_QUERY_DIRECTORY 0x01 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 @@ -39,6 +69,7 @@ /* Table with information about rdpdr devices */ RDPDR_DEVICE g_rdpdr_device[RDPDR_MAX_DEVICES]; +char *g_rdpdr_clientname = NULL; /* Used to store incoming io request, until they are ready to be completed */ /* using a linked list ensures that they are processed in the right order, */ @@ -168,8 +199,14 @@ rdpdr_send_name(void) { uint8 magic[4] = "rDNC"; - uint32 hostlen = (strlen(hostname) + 1) * 2; STREAM s; + uint32 hostlen; + + if (NULL == g_rdpdr_clientname) + { + g_rdpdr_clientname = hostname; + } + hostlen = (strlen(g_rdpdr_clientname) + 1) * 2; s = channel_init(rdpdr_channel, 16 + hostlen); out_uint8a(s, magic, 4); @@ -177,7 +214,7 @@ out_uint16_le(s, 0x72); out_uint32(s, 0); out_uint32_le(s, hostlen); - rdp_out_unistr(s, hostname, hostlen - 2); + rdp_out_unistr(s, g_rdpdr_clientname, hostlen - 2); s_mark_end(s); channel_send(s, rdpdr_channel); }