RD_ prefix and win32 compatibility for core files

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1363 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2007-01-04 04:55:56 +00:00
parent 8446c24ebd
commit b670bdacfa
23 changed files with 353 additions and 340 deletions

22
cache.c
View File

@ -40,13 +40,13 @@ extern int g_pstcache_fd[];
struct bmpcache_entry
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
sint16 previous;
sint16 next;
};
static struct bmpcache_entry g_bmpcache[3][0xa00];
static HBITMAP g_volatile_bc[3];
static RD_HBITMAP g_volatile_bc[3];
static int g_bmpcache_lru[3] = { NOT_SET, NOT_SET, NOT_SET };
static int g_bmpcache_mru[3] = { NOT_SET, NOT_SET, NOT_SET };
@ -190,7 +190,7 @@ cache_evict_bitmap(uint8 id)
}
/* Retrieve a bitmap from the cache */
HBITMAP
RD_HBITMAP
cache_get_bitmap(uint8 id, uint16 idx)
{
if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
@ -214,9 +214,9 @@ cache_get_bitmap(uint8 id, uint16 idx)
/* Store a bitmap in the cache */
void
cache_put_bitmap(uint8 id, uint16 idx, HBITMAP bitmap)
cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
{
HBITMAP old;
RD_HBITMAP old;
if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
{
@ -293,7 +293,7 @@ cache_get_font(uint8 font, uint16 character)
/* Store a glyph in the font cache */
void
cache_put_font(uint8 font, uint16 character, uint16 offset,
uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap)
uint16 baseline, uint16 width, uint16 height, RD_HGLYPH pixmap)
{
FONTGLYPH *glyph;
@ -392,13 +392,13 @@ cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pix
/* CURSOR CACHE */
static HCURSOR g_cursorcache[0x20];
static RD_HCURSOR g_cursorcache[0x20];
/* Retrieve cursor from cache */
HCURSOR
RD_HCURSOR
cache_get_cursor(uint16 cache_idx)
{
HCURSOR cursor;
RD_HCURSOR cursor;
if (cache_idx < NUM_ELEMENTS(g_cursorcache))
{
@ -413,9 +413,9 @@ cache_get_cursor(uint16 cache_idx)
/* Store cursor in cache */
void
cache_put_cursor(uint16 cache_idx, HCURSOR cursor)
cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
{
HCURSOR old;
RD_HCURSOR old;
if (cache_idx < NUM_ELEMENTS(g_cursorcache))
{

View File

@ -312,8 +312,10 @@ enum RDP_INPUT_DEVICE
#define MASK_CHANGE_BIT(var, mask, active) (var = ((var & ~mask) | (active ? mask : 0)))
/* Clipboard constants, "borrowed" from GCC system headers in
the w32 cross compiler */
the w32 cross compiler
this is the CF_ set when WINVER is 0x0400 */
#ifndef CF_TEXT
#define CF_TEXT 1
#define CF_BITMAP 2
#define CF_METAFILEPICT 3
@ -340,6 +342,7 @@ enum RDP_INPUT_DEVICE
#define CF_PRIVATELAST 767
#define CF_GDIOBJFIRST 768
#define CF_GDIOBJLAST 1023
#endif
/* Sound format constants */
#define WAVE_FORMAT_PCM 1
@ -354,28 +357,28 @@ enum RDP_INPUT_DEVICE
#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
/* NT status codes for RDPDR */
#define STATUS_SUCCESS 0x00000000
#define STATUS_NOT_IMPLEMENTED 0x00000001
#define STATUS_PENDING 0x00000103
#define RD_STATUS_SUCCESS 0x00000000
#define RD_STATUS_NOT_IMPLEMENTED 0x00000001
#define RD_STATUS_PENDING 0x00000103
#define STATUS_NO_MORE_FILES 0x80000006
#define STATUS_DEVICE_PAPER_EMPTY 0x8000000e
#define STATUS_DEVICE_POWERED_OFF 0x8000000f
#define STATUS_DEVICE_OFF_LINE 0x80000010
#define STATUS_DEVICE_BUSY 0x80000011
#define RD_STATUS_NO_MORE_FILES 0x80000006
#define RD_STATUS_DEVICE_PAPER_EMPTY 0x8000000e
#define RD_STATUS_DEVICE_POWERED_OFF 0x8000000f
#define RD_STATUS_DEVICE_OFF_LINE 0x80000010
#define RD_STATUS_DEVICE_BUSY 0x80000011
#define STATUS_INVALID_HANDLE 0xc0000008
#define STATUS_INVALID_PARAMETER 0xc000000d
#define STATUS_NO_SUCH_FILE 0xc000000f
#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010
#define STATUS_ACCESS_DENIED 0xc0000022
#define STATUS_OBJECT_NAME_COLLISION 0xc0000035
#define STATUS_DISK_FULL 0xc000007f
#define STATUS_FILE_IS_A_DIRECTORY 0xc00000ba
#define STATUS_NOT_SUPPORTED 0xc00000bb
#define STATUS_TIMEOUT 0xc0000102
#define STATUS_NOTIFY_ENUM_DIR 0xc000010c
#define STATUS_CANCELLED 0xc0000120
#define RD_STATUS_INVALID_HANDLE 0xc0000008
#define RD_STATUS_INVALID_PARAMETER 0xc000000d
#define RD_STATUS_NO_SUCH_FILE 0xc000000f
#define RD_STATUS_INVALID_DEVICE_REQUEST 0xc0000010
#define RD_STATUS_ACCESS_DENIED 0xc0000022
#define RD_STATUS_OBJECT_NAME_COLLISION 0xc0000035
#define RD_STATUS_DISK_FULL 0xc000007f
#define RD_STATUS_FILE_IS_A_DIRECTORY 0xc00000ba
#define RD_STATUS_NOT_SUPPORTED 0xc00000bb
#define RD_STATUS_TIMEOUT 0xc0000102
#define RD_STATUS_NOTIFY_ENUM_DIR 0xc000010c
#define RD_STATUS_CANCELLED 0xc0000120
/* RDPDR constants */

160
disk.c
View File

@ -150,7 +150,7 @@ typedef struct
char type[PATH_MAX];
} FsInfoType;
static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p);
static RD_NTSTATUS NotifyInfo(RD_NTHANDLE handle, uint32 info_class, NOTIFY * p);
static time_t
get_create_time(struct stat *st)
@ -337,11 +337,11 @@ disk_enum_devices(uint32 * id, char *optarg)
}
/* Opens or creates a file or directory */
static NTSTATUS
static RD_NTSTATUS
disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition,
uint32 flags_and_attributes, char *filename, NTHANDLE * phandle)
uint32 flags_and_attributes, char *filename, RD_NTHANDLE * phandle)
{
NTHANDLE handle;
RD_NTHANDLE handle;
DIR *dirp;
int flags, mode;
char path[PATH_MAX];
@ -395,7 +395,7 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode)))
{
if (flags_and_attributes & FILE_NON_DIRECTORY_FILE)
return STATUS_FILE_IS_A_DIRECTORY;
return RD_STATUS_FILE_IS_A_DIRECTORY;
else
flags_and_attributes |= FILE_DIRECTORY_FILE;
}
@ -414,16 +414,16 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
{
case EACCES:
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
case ENOENT:
return STATUS_NO_SUCH_FILE;
return RD_STATUS_NO_SUCH_FILE;
default:
perror("opendir");
return STATUS_NO_SUCH_FILE;
return RD_STATUS_NO_SUCH_FILE;
}
}
handle = DIRFD(dirp);
@ -452,22 +452,22 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
{
case EISDIR:
return STATUS_FILE_IS_A_DIRECTORY;
return RD_STATUS_FILE_IS_A_DIRECTORY;
case EACCES:
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
case ENOENT:
return STATUS_NO_SUCH_FILE;
return RD_STATUS_NO_SUCH_FILE;
case EEXIST:
return STATUS_OBJECT_NAME_COLLISION;
return RD_STATUS_OBJECT_NAME_COLLISION;
default:
perror("open");
return STATUS_NO_SUCH_FILE;
return RD_STATUS_NO_SUCH_FILE;
}
}
@ -496,11 +496,11 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
g_notify_stamp = True;
*phandle = handle;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
disk_close(NTHANDLE handle)
static RD_NTSTATUS
disk_close(RD_NTHANDLE handle)
{
struct fileinfo *pfinfo;
@ -508,21 +508,21 @@ disk_close(NTHANDLE handle)
g_notify_stamp = True;
rdpdr_abort_io(handle, 0, STATUS_CANCELLED);
rdpdr_abort_io(handle, 0, RD_STATUS_CANCELLED);
if (pfinfo->pdir)
{
if (closedir(pfinfo->pdir) < 0)
{
perror("closedir");
return STATUS_INVALID_HANDLE;
return RD_STATUS_INVALID_HANDLE;
}
if (pfinfo->delete_on_close)
if (rmdir(pfinfo->path) < 0)
{
perror(pfinfo->path);
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
pfinfo->delete_on_close = False;
}
@ -531,23 +531,23 @@ disk_close(NTHANDLE handle)
if (close(handle) < 0)
{
perror("close");
return STATUS_INVALID_HANDLE;
return RD_STATUS_INVALID_HANDLE;
}
if (pfinfo->delete_on_close)
if (unlink(pfinfo->path) < 0)
{
perror(pfinfo->path);
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
pfinfo->delete_on_close = False;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
disk_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
disk_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
int n;
@ -574,20 +574,20 @@ disk_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 *
/* Implement 24 Byte directory read ??
with STATUS_NOT_IMPLEMENTED server doesn't read again */
/* return STATUS_FILE_IS_A_DIRECTORY; */
return STATUS_NOT_IMPLEMENTED;
return RD_STATUS_NOT_IMPLEMENTED;
default:
perror("read");
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
}
*result = n;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
disk_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
disk_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
int n;
@ -602,19 +602,19 @@ disk_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 *
switch (errno)
{
case ENOSPC:
return STATUS_DISK_FULL;
return RD_STATUS_DISK_FULL;
default:
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
}
*result = n;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
NTSTATUS
disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out)
RD_NTSTATUS
disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
{
uint32 file_attributes, ft_high, ft_low;
struct stat filestat;
@ -627,7 +627,7 @@ disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out)
{
perror("stat");
out_uint8(out, 0);
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
/* Set file attributes */
@ -689,13 +689,13 @@ disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out)
default:
unimpl("IRP Query (File) Information class: 0x%x\n", info_class);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
NTSTATUS
disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
RD_NTSTATUS
disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
{
uint32 length, file_attributes, ft_high, ft_low, delete_on_close;
char newname[PATH_MAX], fullpath[PATH_MAX];
@ -742,7 +742,7 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
in_uint32_le(in, file_attributes);
if (fstat(handle, &filestat))
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
tvs.modtime = filestat.st_mtime;
tvs.actime = filestat.st_atime;
@ -768,7 +768,7 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
ctime(&tvs.modtime));
#endif
if (utime(pfinfo->path, &tvs) && errno != EPERM)
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
if (!file_attributes)
@ -787,7 +787,7 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
#endif
if (fchmod(handle, mode))
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
break;
@ -804,7 +804,7 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
}
else
{
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
sprintf(fullpath, "%s%s", g_rdpdr_device[pfinfo->device_id].local_path,
@ -813,7 +813,7 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
if (rename(pfinfo->path, fullpath) != 0)
{
perror("rename");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
break;
@ -852,46 +852,46 @@ disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
/* prevents start of writing if not enough space left on device */
if (STATFS_FN(g_rdpdr_device[pfinfo->device_id].local_path, &stat_fs) == 0)
if (stat_fs.f_bfree * stat_fs.f_bsize < length)
return STATUS_DISK_FULL;
return RD_STATUS_DISK_FULL;
if (ftruncate_growable(handle, length) != 0)
{
return STATUS_DISK_FULL;
return RD_STATUS_DISK_FULL;
}
break;
default:
unimpl("IRP Set File Information class: 0x%x\n", info_class);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
NTSTATUS
disk_check_notify(NTHANDLE handle)
RD_NTSTATUS
disk_check_notify(RD_NTHANDLE handle)
{
struct fileinfo *pfinfo;
NTSTATUS status = STATUS_PENDING;
RD_NTSTATUS status = RD_STATUS_PENDING;
NOTIFY notify;
pfinfo = &(g_fileinfo[handle]);
if (!pfinfo->pdir)
return STATUS_INVALID_DEVICE_REQUEST;
return RD_STATUS_INVALID_DEVICE_REQUEST;
status = NotifyInfo(handle, pfinfo->info_class, &notify);
if (status != STATUS_PENDING)
if (status != RD_STATUS_PENDING)
return status;
if (memcmp(&pfinfo->notify, &notify, sizeof(NOTIFY)))
{
/*printf("disk_check_notify found changed event\n"); */
memcpy(&pfinfo->notify, &notify, sizeof(NOTIFY));
status = STATUS_NOTIFY_ENUM_DIR;
status = RD_STATUS_NOTIFY_ENUM_DIR;
}
return status;
@ -899,12 +899,12 @@ disk_check_notify(NTHANDLE handle)
}
NTSTATUS
disk_create_notify(NTHANDLE handle, uint32 info_class)
RD_NTSTATUS
disk_create_notify(RD_NTHANDLE handle, uint32 info_class)
{
struct fileinfo *pfinfo;
NTSTATUS ret = STATUS_PENDING;
RD_NTSTATUS ret = RD_STATUS_PENDING;
/* printf("start disk_create_notify info_class %X\n", info_class); */
@ -915,8 +915,8 @@ disk_create_notify(NTHANDLE handle, uint32 info_class)
if (info_class & 0x1000)
{ /* ???? */
if (ret == STATUS_PENDING)
return STATUS_SUCCESS;
if (ret == RD_STATUS_PENDING)
return RD_STATUS_SUCCESS;
}
/* printf("disk_create_notify: num_entries %d\n", pfinfo->notify.num_entries); */
@ -926,8 +926,8 @@ disk_create_notify(NTHANDLE handle, uint32 info_class)
}
static NTSTATUS
NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p)
static RD_NTSTATUS
NotifyInfo(RD_NTHANDLE handle, uint32 info_class, NOTIFY * p)
{
struct fileinfo *pfinfo;
struct stat buf;
@ -939,7 +939,7 @@ NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p)
if (fstat(handle, &buf) < 0)
{
perror("NotifyInfo");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
p->modify_time = buf.st_mtime;
p->status_time = buf.st_ctime;
@ -951,7 +951,7 @@ NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p)
if (!dpr)
{
perror("NotifyInfo");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
@ -972,7 +972,7 @@ NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p)
}
closedir(dpr);
return STATUS_PENDING;
return RD_STATUS_PENDING;
}
static FsInfoType *
@ -1043,8 +1043,8 @@ FsVolumeInfo(char *fpath)
}
NTSTATUS
disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out)
RD_NTSTATUS
disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
{
struct STATFS_T stat_fs;
struct fileinfo *pfinfo;
@ -1055,7 +1055,7 @@ disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out)
if (STATFS_FN(pfinfo->path, &stat_fs) != 0)
{
perror("statfs");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
fsinfo = FsVolumeInfo(pfinfo->path);
@ -1103,13 +1103,13 @@ disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out)
default:
unimpl("IRP Query Volume Information class: 0x%x\n", info_class);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
NTSTATUS
disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
RD_NTSTATUS
disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
{
uint32 file_attributes, ft_low, ft_high;
char *dirname, fullpath[PATH_MAX];
@ -1140,7 +1140,7 @@ disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM o
pdirent = readdir(pdir);
if (pdirent == NULL)
return STATUS_NO_MORE_FILES;
return RD_STATUS_NO_MORE_FILES;
/* Get information for directory entry */
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name);
@ -1160,7 +1160,7 @@ disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM o
the directory list operation will be aborted */
perror(fullpath);
out_uint8(out, 0);
return STATUS_NO_SUCH_FILE;
return RD_STATUS_NO_SUCH_FILE;
}
}
@ -1210,19 +1210,19 @@ disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM o
FileNamesInformation */
unimpl("IRP Query Directory sub: 0x%x\n", info_class);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
disk_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
static RD_NTSTATUS
disk_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out)
{
if (((request >> 16) != 20) || ((request >> 16) != 9))
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
/* extract operation */
request >>= 2;
@ -1236,10 +1236,10 @@ disk_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
case 42: /* ? */
default:
unimpl("DISK IOCTL %d\n", request);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
DEVICE_FNS disk_fns = {

View File

@ -379,7 +379,7 @@ process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta)
static void
process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta)
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
if (present & 0x0001)
{
@ -425,7 +425,7 @@ process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta)
static void
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta)
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
if (present & 0x000001)
{
@ -486,7 +486,7 @@ process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta)
{
int index, data, next;
uint8 flags = 0;
POINT *points;
RD_POINT *points;
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
@ -528,8 +528,8 @@ process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta)
return;
}
points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT));
memset(points, 0, (os->npoints + 1) * sizeof(POINT));
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
points[0].x = os->x;
points[0].y = os->y;
@ -565,7 +565,7 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)
{
int index, data, next;
uint8 flags = 0;
POINT *points;
RD_POINT *points;
if (present & 0x0001)
rdp_in_coord(s, &os->x, delta);
@ -613,8 +613,8 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)
return;
}
points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT));
memset(points, 0, (os->npoints + 1) * sizeof(POINT));
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
points[0].x = os->x;
points[0].y = os->y;
@ -651,7 +651,7 @@ process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
int index, next, data;
uint8 flags = 0;
PEN pen;
POINT *points;
RD_POINT *points;
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
@ -690,8 +690,8 @@ process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
return;
}
points = (POINT *) xmalloc((os->lines + 1) * sizeof(POINT));
memset(points, 0, (os->lines + 1) * sizeof(POINT));
points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT));
memset(points, 0, (os->lines + 1) * sizeof(RD_POINT));
points[0].x = os->x;
points[0].y = os->y;
@ -874,7 +874,7 @@ process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta)
static void
process_raw_bmpcache(STREAM s)
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
uint16 cache_idx, bufsize;
uint8 cache_id, width, height, bpp, Bpp;
uint8 *data, *inverted;
@ -907,7 +907,7 @@ process_raw_bmpcache(STREAM s)
static void
process_bmpcache(STREAM s)
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
uint16 cache_idx, size;
uint8 cache_id, width, height, bpp, Bpp;
uint8 *data, *bmpdata;
@ -963,7 +963,7 @@ process_bmpcache(STREAM s)
static void
process_bmpcache2(STREAM s, uint16 flags, BOOL compressed)
{
HBITMAP bitmap;
RD_HBITMAP bitmap;
int y;
uint8 cache_id, cache_idx_low, width, height, Bpp;
uint16 cache_idx, bufsize;
@ -1045,7 +1045,7 @@ process_colcache(STREAM s)
{
COLOURENTRY *entry;
COLOURMAP map;
HCOLOURMAP hmap;
RD_HCOLOURMAP hmap;
uint8 cache_id;
int i;
@ -1077,7 +1077,7 @@ process_colcache(STREAM s)
static void
process_fontcache(STREAM s)
{
HGLYPH bitmap;
RD_HGLYPH bitmap;
uint8 font, nglyphs;
uint16 character, offset, baseline, width, height;
int i, datasize;

View File

@ -1,7 +1,7 @@
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Copyright (C) Matthew Chapman 1999-2005
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
@ -11,7 +11,7 @@
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.
@ -75,9 +75,9 @@ parallel_enum_devices(uint32 * id, char *optarg)
return count;
}
static NTSTATUS
static RD_NTSTATUS
parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,
uint32 flags, char *filename, NTHANDLE * handle)
uint32 flags, char *filename, RD_NTHANDLE * handle)
{
int parallel_fd;
@ -85,7 +85,7 @@ parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 dispo
if (parallel_fd == -1)
{
perror("open");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
/* all read and writes should be non blocking */
@ -101,30 +101,30 @@ parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 dispo
*handle = parallel_fd;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
parallel_close(NTHANDLE handle)
static RD_NTSTATUS
parallel_close(RD_NTHANDLE handle)
{
int i = get_device_index(handle);
if (i >= 0)
g_rdpdr_device[i].handle = 0;
close(handle);
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
parallel_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
parallel_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
*result = read(handle, data, length);
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
parallel_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
parallel_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
int rc = STATUS_SUCCESS;
int rc = RD_STATUS_SUCCESS;
int n = write(handle, data, length);
if (n < 0)
@ -137,13 +137,13 @@ parallel_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint
switch (errno)
{
case EAGAIN:
rc = STATUS_DEVICE_OFF_LINE;
rc = RD_STATUS_DEVICE_OFF_LINE;
case ENOSPC:
rc = STATUS_DEVICE_PAPER_EMPTY;
rc = RD_STATUS_DEVICE_PAPER_EMPTY;
case EIO:
rc = STATUS_DEVICE_OFF_LINE;
rc = RD_STATUS_DEVICE_OFF_LINE;
default:
rc = STATUS_DEVICE_POWERED_OFF;
rc = RD_STATUS_DEVICE_POWERED_OFF;
}
#if defined(LPGETSTATUS)
if (ioctl(handle, LPGETSTATUS, &status) == 0)
@ -157,11 +157,11 @@ parallel_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint
return rc;
}
static NTSTATUS
parallel_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
static RD_NTSTATUS
parallel_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out)
{
if ((request >> 16) != FILE_DEVICE_PARALLEL)
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
/* extract operation */
request >>= 2;
@ -178,7 +178,7 @@ parallel_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
printf("\n");
unimpl("UNKNOWN IOCTL %d\n", request);
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
DEVICE_FNS parallel_fns = {

View File

@ -22,7 +22,7 @@
extern RDPDR_DEVICE g_rdpdr_device[];
static PRINTER *
get_printer_data(NTHANDLE handle)
get_printer_data(RD_NTHANDLE handle)
{
int index;
@ -100,9 +100,9 @@ printer_enum_devices(uint32 * id, char *optarg)
return count;
}
static NTSTATUS
static RD_NTSTATUS
printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags,
char *filename, NTHANDLE * handle)
char *filename, RD_NTHANDLE * handle)
{
char cmd[256];
PRINTER *pprinter_data;
@ -122,11 +122,11 @@ printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 dispos
g_rdpdr_device[device_id].handle = fileno(pprinter_data->printer_fp);
*handle = g_rdpdr_device[device_id].handle;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
printer_close(NTHANDLE handle)
static RD_NTSTATUS
printer_close(RD_NTHANDLE handle)
{
int i = get_device_index(handle);
if (i >= 0)
@ -136,11 +136,11 @@ printer_close(NTHANDLE handle)
pclose(pprinter_data->printer_fp);
g_rdpdr_device[i].handle = 0;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
printer_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
printer_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
PRINTER *pprinter_data;
@ -150,9 +150,9 @@ printer_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint3
if (ferror(pprinter_data->printer_fp))
{
*result = 0;
return STATUS_INVALID_HANDLE;
return RD_STATUS_INVALID_HANDLE;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
DEVICE_FNS printer_fns = {

62
proto.h
View File

@ -31,19 +31,19 @@ BOOL bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int
void cache_rebuild_bmpcache_linked_list(uint8 id, sint16 * idx, int count);
void cache_bump_bitmap(uint8 id, uint16 idx, int bump);
void cache_evict_bitmap(uint8 id);
HBITMAP cache_get_bitmap(uint8 id, uint16 idx);
void cache_put_bitmap(uint8 id, uint16 idx, HBITMAP bitmap);
RD_HBITMAP cache_get_bitmap(uint8 id, uint16 idx);
void cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap);
void cache_save_state(void);
FONTGLYPH *cache_get_font(uint8 font, uint16 character);
void cache_put_font(uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width,
uint16 height, HGLYPH pixmap);
uint16 height, RD_HGLYPH pixmap);
DATABLOB *cache_get_text(uint8 cache_id);
void cache_put_text(uint8 cache_id, void *data, int length);
uint8 *cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel);
void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel,
uint8 * data);
HCURSOR cache_get_cursor(uint16 cache_idx);
void cache_put_cursor(uint16 cache_idx, HCURSOR cursor);
RD_HCURSOR cache_get_cursor(uint16 cache_idx);
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor);
/* channels.c */
VCHANNEL *channel_register(char *name, uint32 flags, void (*callback) (STREAM));
STREAM channel_init(VCHANNEL * channel, uint32 length);
@ -58,12 +58,12 @@ void cliprdr_set_mode(const char *optarg);
BOOL cliprdr_init(void);
/* disk.c */
int disk_enum_devices(uint32 * id, char *optarg);
NTSTATUS disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out);
NTSTATUS disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out);
NTSTATUS disk_check_notify(NTHANDLE handle);
NTSTATUS disk_create_notify(NTHANDLE handle, uint32 info_class);
NTSTATUS disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out);
NTSTATUS disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out);
RD_NTSTATUS disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out);
RD_NTSTATUS disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out);
RD_NTSTATUS disk_check_notify(RD_NTHANDLE handle);
RD_NTSTATUS disk_create_notify(RD_NTHANDLE handle, uint32 info_class);
RD_NTSTATUS disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out);
RD_NTSTATUS disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out);
/* mppc.c */
int mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen);
/* ewmhints.c */
@ -155,7 +155,7 @@ BOOL rdp_reconnect(char *server, uint32 flags, char *domain, char *password, cha
void rdp_reset_state(void);
void rdp_disconnect(void);
/* rdpdr.c */
int get_device_index(NTHANDLE handle);
int get_device_index(RD_NTHANDLE handle);
void convert_to_unix_filename(char *filename);
void rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer,
uint32 length);
@ -164,7 +164,7 @@ void rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOO
struct async_iorequest *rdpdr_remove_iorequest(struct async_iorequest *prev,
struct async_iorequest *iorq);
void rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out);
BOOL rdpdr_abort_io(uint32 fd, uint32 major, NTSTATUS status);
BOOL rdpdr_abort_io(uint32 fd, uint32 major, RD_NTSTATUS status);
/* rdpsnd.c */
void rdpsnd_record(const void *data, unsigned int size);
BOOL rdpsnd_init(char *optarg);
@ -193,8 +193,8 @@ void sec_disconnect(void);
void sec_reset_state(void);
/* serial.c */
int serial_enum_devices(uint32 * id, char *optarg);
BOOL serial_get_event(NTHANDLE handle, uint32 * result);
BOOL serial_get_timeout(NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout);
BOOL serial_get_event(RD_NTHANDLE handle, uint32 * result);
BOOL serial_get_timeout(RD_NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout);
/* tcp.c */
STREAM tcp_init(uint32 maxlen);
void tcp_send(STREAM s);
@ -239,19 +239,19 @@ void ui_destroy_window(void);
void xwin_toggle_fullscreen(void);
int ui_select(int rdp_socket);
void ui_move_pointer(int x, int y);
HBITMAP ui_create_bitmap(int width, int height, uint8 * data);
RD_HBITMAP ui_create_bitmap(int width, int height, uint8 * data);
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data);
void ui_destroy_bitmap(HBITMAP bmp);
HGLYPH ui_create_glyph(int width, int height, uint8 * data);
void ui_destroy_glyph(HGLYPH glyph);
HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask,
uint8 * xormask);
void ui_set_cursor(HCURSOR cursor);
void ui_destroy_cursor(HCURSOR cursor);
void ui_destroy_bitmap(RD_HBITMAP bmp);
RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data);
void ui_destroy_glyph(RD_HGLYPH glyph);
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask,
uint8 * xormask);
void ui_set_cursor(RD_HCURSOR cursor);
void ui_destroy_cursor(RD_HCURSOR cursor);
void ui_set_null_cursor(void);
HCOLOURMAP ui_create_colourmap(COLOURMAP * colours);
void ui_destroy_colourmap(HCOLOURMAP map);
void ui_set_colourmap(HCOLOURMAP map);
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP * colours);
void ui_destroy_colourmap(RD_HCOLOURMAP map);
void ui_set_colourmap(RD_HCOLOURMAP map);
void ui_set_clip(int x, int y, int cx, int cy);
void ui_reset_clip(void);
void ui_bell(void);
@ -259,17 +259,17 @@ void ui_destblt(uint8 opcode, int x, int y, int cx, int cy);
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush, int bgcolour,
int fgcolour);
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy);
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy);
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy,
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy);
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy,
BRUSH * brush, int bgcolour, int fgcolour);
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN * pen);
void ui_rect(int x, int y, int cx, int cy, int colour);
void ui_polygon(uint8 opcode, uint8 fillmode, POINT * point, int npoints, BRUSH * brush,
void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, BRUSH * brush,
int bgcolour, int fgcolour);
void ui_polyline(uint8 opcode, POINT * points, int npoints, PEN * pen);
void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen);
void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH * brush,
int bgcolour, int fgcolour);
void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy,
void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, RD_HGLYPH glyph, int srcx, int srcy,
int bgcolour, int fgcolour);
void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx,
int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy,

View File

@ -56,7 +56,7 @@ pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
uint8 *celldata;
int fd;
CELLHEADER cellhdr;
HBITMAP bitmap;
RD_HBITMAP bitmap;
if (!g_bitmap_cache_persist_enable)
return False;

View File

@ -2,17 +2,17 @@
rdesktop: A Remote Desktop Protocol client.
Master include file
Copyright (C) Matthew Chapman 1999-2005
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.
@ -21,6 +21,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#define WINVER 0x0400
#include <windows.h>
#include <winsock.h>
#include <time.h>
#define DIR int
#else
#include <dirent.h>
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
@ -29,6 +36,7 @@
#include <sys/types.h>
#include <unistd.h>
#endif
#endif
#include <limits.h> /* PATH_MAX */
#define VERSION "1.5.0"

6
rdp.c
View File

@ -19,8 +19,10 @@
*/
#include <time.h>
#ifndef _WIN32
#include <errno.h>
#include <unistd.h>
#endif
#include "rdesktop.h"
#ifdef HAVE_ICONV
@ -996,7 +998,7 @@ process_colour_pointer_pdu(STREAM s)
{
uint16 x, y, width, height, cache_idx, masklen, datalen;
uint8 *mask, *data;
HCURSOR cursor;
RD_HCURSOR cursor;
in_uint16_le(s, cache_idx);
in_uint16_le(s, x);
@ -1153,7 +1155,7 @@ process_palette(STREAM s)
{
COLOURENTRY *entry;
COLOURMAP map;
HCOLOURMAP hmap;
RD_HCOLOURMAP hmap;
int i;
in_uint8s(s, 2); /* pad */

74
rdpdr.c
View File

@ -69,7 +69,7 @@ extern BOOL g_notify_stamp;
static VCHANNEL *rdpdr_channel;
/* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */
NTHANDLE g_min_timeout_fd;
RD_NTHANDLE g_min_timeout_fd;
uint32 g_num_devices;
/* Table with information about rdpdr devices */
@ -94,7 +94,7 @@ struct async_iorequest *g_iorequest;
/* Return device_id for a given handle */
int
get_device_index(NTHANDLE handle)
get_device_index(RD_NTHANDLE handle)
{
int i;
for (i = 0; i < RDPDR_MAX_DEVICES; i++)
@ -366,7 +366,7 @@ rdpdr_process_irp(STREAM s)
struct stream out;
DEVICE_FNS *fns;
BOOL rw_blocking = True;
NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
RD_NTSTATUS status = RD_STATUS_INVALID_DEVICE_REQUEST;
in_uint32_le(s, device);
in_uint32_le(s, file);
@ -439,7 +439,7 @@ rdpdr_process_irp(STREAM s)
if (!fns->create)
{
status = STATUS_NOT_SUPPORTED;
status = RD_STATUS_NOT_SUPPORTED;
break;
}
@ -451,7 +451,7 @@ rdpdr_process_irp(STREAM s)
case IRP_MJ_CLOSE:
if (!fns->close)
{
status = STATUS_NOT_SUPPORTED;
status = RD_STATUS_NOT_SUPPORTED;
break;
}
@ -462,7 +462,7 @@ rdpdr_process_irp(STREAM s)
if (!fns->read)
{
status = STATUS_NOT_SUPPORTED;
status = RD_STATUS_NOT_SUPPORTED;
break;
}
@ -473,7 +473,7 @@ rdpdr_process_irp(STREAM s)
#endif
if (!rdpdr_handle_ok(device, file))
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -482,7 +482,7 @@ rdpdr_process_irp(STREAM s)
buffer = (uint8 *) xrealloc((void *) buffer, length);
if (!buffer)
{
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
}
status = fns->read(file, buffer, length, offset, &result);
@ -494,7 +494,7 @@ rdpdr_process_irp(STREAM s)
pst_buf = (uint8 *) xmalloc(length);
if (!pst_buf)
{
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
}
serial_get_timeout(file, length, &total_timeout, &interval_timeout);
@ -502,11 +502,11 @@ rdpdr_process_irp(STREAM s)
(device, file, id, major, length, fns, total_timeout, interval_timeout,
pst_buf, offset))
{
status = STATUS_PENDING;
status = RD_STATUS_PENDING;
break;
}
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
case IRP_MJ_WRITE:
@ -514,7 +514,7 @@ rdpdr_process_irp(STREAM s)
if (!fns->write)
{
status = STATUS_NOT_SUPPORTED;
status = RD_STATUS_NOT_SUPPORTED;
break;
}
@ -526,7 +526,7 @@ rdpdr_process_irp(STREAM s)
#endif
if (!rdpdr_handle_ok(device, file))
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -540,7 +540,7 @@ rdpdr_process_irp(STREAM s)
pst_buf = (uint8 *) xmalloc(length);
if (!pst_buf)
{
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
}
@ -549,18 +549,18 @@ rdpdr_process_irp(STREAM s)
if (add_async_iorequest
(device, file, id, major, length, fns, 0, 0, pst_buf, offset))
{
status = STATUS_PENDING;
status = RD_STATUS_PENDING;
break;
}
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
case IRP_MJ_QUERY_INFORMATION:
if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK)
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
in_uint32_le(s, info_level);
@ -576,7 +576,7 @@ rdpdr_process_irp(STREAM s)
if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK)
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -592,7 +592,7 @@ rdpdr_process_irp(STREAM s)
if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK)
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -608,7 +608,7 @@ rdpdr_process_irp(STREAM s)
if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK)
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -650,14 +650,14 @@ rdpdr_process_irp(STREAM s)
status = disk_create_notify(file, info_level);
result = 0;
if (status == STATUS_PENDING)
if (status == RD_STATUS_PENDING)
add_async_iorequest(device, file, id, major, length,
fns, 0, 0, NULL, 0);
break;
default:
status = STATUS_INVALID_PARAMETER;
status = RD_STATUS_INVALID_PARAMETER;
/* JIF */
unimpl("IRP major=0x%x minor=0x%x\n", major, minor);
}
@ -667,7 +667,7 @@ rdpdr_process_irp(STREAM s)
if (!fns->device_control)
{
status = STATUS_NOT_SUPPORTED;
status = RD_STATUS_NOT_SUPPORTED;
break;
}
@ -679,7 +679,7 @@ rdpdr_process_irp(STREAM s)
buffer = (uint8 *) xrealloc((void *) buffer, bytes_out + 0x14);
if (!buffer)
{
status = STATUS_CANCELLED;
status = RD_STATUS_CANCELLED;
break;
}
@ -699,18 +699,18 @@ rdpdr_process_irp(STREAM s)
DEBUG_SCARD(("[SMART-CARD TRACE] OUT 0x%.8x\n", status));
/* Serial SERIAL_WAIT_ON_MASK */
if (status == STATUS_PENDING)
if (status == RD_STATUS_PENDING)
{
if (add_async_iorequest
(device, file, id, major, length, fns, 0, 0, NULL, 0))
{
status = STATUS_PENDING;
status = RD_STATUS_PENDING;
break;
}
}
#ifdef WITH_SCARD
else if (status == (STATUS_PENDING | 0xC0000000))
status = STATUS_PENDING;
else if (status == (RD_STATUS_PENDING | 0xC0000000))
status = RD_STATUS_PENDING;
#endif
break;
@ -719,7 +719,7 @@ rdpdr_process_irp(STREAM s)
if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK)
{
status = STATUS_INVALID_HANDLE;
status = RD_STATUS_INVALID_HANDLE;
break;
}
@ -729,7 +729,7 @@ rdpdr_process_irp(STREAM s)
out.size = sizeof(buffer);
/* FIXME: Perhaps consider actually *do*
something here :-) */
status = STATUS_SUCCESS;
status = RD_STATUS_SUCCESS;
result = buffer_len = out.p - out.data;
break;
@ -738,7 +738,7 @@ rdpdr_process_irp(STREAM s)
break;
}
if (status != STATUS_PENDING)
if (status != RD_STATUS_PENDING)
{
rdpdr_send_completion(device, id, status, result, buffer, buffer_len);
}
@ -960,7 +960,7 @@ rdpdr_remove_iorequest(struct async_iorequest *prev, struct async_iorequest *ior
static void
_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
{
NTSTATUS status;
RD_NTSTATUS status;
uint32 result = 0;
DEVICE_FNS *fns;
struct async_iorequest *iorq;
@ -989,7 +989,7 @@ _rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
/* iv_timeout between 2 chars, send partial_len */
/*printf("RDPDR: IVT total %u bytes read of %u\n", iorq->partial_len, iorq->length); */
rdpdr_send_completion(iorq->device,
iorq->id, STATUS_SUCCESS,
iorq->id, RD_STATUS_SUCCESS,
iorq->partial_len,
iorq->buffer, iorq->partial_len);
iorq = rdpdr_remove_iorequest(prev, iorq);
@ -1013,7 +1013,7 @@ _rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
}
rdpdr_abort_io(g_min_timeout_fd, 0, STATUS_TIMEOUT);
rdpdr_abort_io(g_min_timeout_fd, 0, RD_STATUS_TIMEOUT);
return;
}
@ -1117,7 +1117,7 @@ _rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
out.size = sizeof(buffer);
out_uint32_le(&out, result);
result = buffer_len = out.p - out.data;
status = STATUS_SUCCESS;
status = RD_STATUS_SUCCESS;
rdpdr_send_completion(iorq->device, iorq->id,
status, result, buffer,
buffer_len);
@ -1153,7 +1153,7 @@ _rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
{
g_notify_stamp = False;
status = disk_check_notify(iorq->fd);
if (status != STATUS_PENDING)
if (status != RD_STATUS_PENDING)
{
rdpdr_send_completion(iorq->device,
iorq->id,
@ -1198,7 +1198,7 @@ rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out)
/* Abort a pending io request for a given handle and major */
BOOL
rdpdr_abort_io(uint32 fd, uint32 major, NTSTATUS status)
rdpdr_abort_io(uint32 fd, uint32 major, RD_NTSTATUS status)
{
uint32 result;
struct async_iorequest *iorq;

View File

@ -53,11 +53,11 @@ struct audio_driver *current_driver = NULL;
static BOOL device_open;
static BOOL rec_device_open;
static WAVEFORMATEX formats[MAX_FORMATS];
static RD_WAVEFORMATEX formats[MAX_FORMATS];
static unsigned int format_count;
static unsigned int current_format;
static WAVEFORMATEX rec_formats[MAX_FORMATS];
static RD_WAVEFORMATEX rec_formats[MAX_FORMATS];
static unsigned int rec_format_count;
unsigned int queue_hi, queue_lo, queue_pending;
@ -212,7 +212,7 @@ rdpsnd_process_negotiate(STREAM in)
uint16 in_format_count, i;
uint8 pad;
uint16 version;
WAVEFORMATEX *format;
RD_WAVEFORMATEX *format;
STREAM out;
BOOL device_available = False;
int readcnt;
@ -326,7 +326,7 @@ rdpsnd_process_rec_negotiate(STREAM in)
{
uint16 in_format_count, i;
uint16 version;
WAVEFORMATEX *format;
RD_WAVEFORMATEX *format;
STREAM out;
BOOL device_available = False;
int readcnt;

View File

@ -35,14 +35,14 @@ struct audio_driver
BOOL(*wave_out_open) (void);
void (*wave_out_close) (void);
BOOL(*wave_out_format_supported) (WAVEFORMATEX * pwfx);
BOOL(*wave_out_set_format) (WAVEFORMATEX * pwfx);
BOOL(*wave_out_format_supported) (RD_WAVEFORMATEX * pwfx);
BOOL(*wave_out_set_format) (RD_WAVEFORMATEX * pwfx);
void (*wave_out_volume) (uint16 left, uint16 right);
BOOL(*wave_in_open) (void);
void (*wave_in_close) (void);
BOOL(*wave_in_format_supported) (WAVEFORMATEX * pwfx);
BOOL(*wave_in_set_format) (WAVEFORMATEX * pwfx);
BOOL(*wave_in_format_supported) (RD_WAVEFORMATEX * pwfx);
BOOL(*wave_in_set_format) (RD_WAVEFORMATEX * pwfx);
void (*wave_in_volume) (uint16 left, uint16 right);
char *name;

View File

@ -164,7 +164,7 @@ alsa_check_fds(fd_set * rfds, fd_set * wfds)
}
static BOOL
alsa_set_format(snd_pcm_t * pcm, WAVEFORMATEX * pwfx)
alsa_set_format(snd_pcm_t * pcm, RD_WAVEFORMATEX * pwfx)
{
snd_pcm_hw_params_t *hwparams = NULL;
int err;

View File

@ -50,7 +50,7 @@ rdpsnd_dsp_softvol_set(uint16 left, uint16 right)
}
void
rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, WAVEFORMATEX * format)
rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format)
{
unsigned int factor_left, factor_right;
unsigned char *posin = buffer;
@ -111,7 +111,7 @@ rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, WAVEFORMATEX * form
}
void
rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, WAVEFORMATEX * format)
rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format)
{
int i;
uint8 swap;
@ -159,7 +159,7 @@ rdpsnd_dsp_resample_set(uint32 device_srate, uint16 device_bitspersample, uint16
}
BOOL
rdpsnd_dsp_resample_supported(WAVEFORMATEX * format)
rdpsnd_dsp_resample_supported(RD_WAVEFORMATEX * format)
{
if (format->wFormatTag != WAVE_FORMAT_PCM)
return False;
@ -173,7 +173,7 @@ rdpsnd_dsp_resample_supported(WAVEFORMATEX * format)
uint32
rdpsnd_dsp_resample(unsigned char **out, unsigned char *in, unsigned int size,
WAVEFORMATEX * format, BOOL stream_be)
RD_WAVEFORMATEX * format, BOOL stream_be)
{
#ifdef HAVE_LIBSAMPLERATE
SRC_DATA resample_data;
@ -385,7 +385,7 @@ rdpsnd_dsp_resample(unsigned char **out, unsigned char *in, unsigned int size,
STREAM
rdpsnd_dsp_process(unsigned char *data, unsigned int size, struct audio_driver * current_driver,
WAVEFORMATEX * format)
RD_WAVEFORMATEX * format)
{
static struct stream out;
BOOL stream_be = False;

View File

@ -24,7 +24,7 @@ void rdpsnd_dsp_softvol_set(uint16 left, uint16 right);
/* Resample control */
BOOL rdpsnd_dsp_resample_set(uint32 device_srate, uint16 device_bitspersample,
uint16 device_channels);
BOOL rdpsnd_dsp_resample_supported(WAVEFORMATEX * pwfx);
BOOL rdpsnd_dsp_resample_supported(RD_WAVEFORMATEX * pwfx);
STREAM rdpsnd_dsp_process(unsigned char *data, unsigned int size,
struct audio_driver *current_driver, WAVEFORMATEX * format);
struct audio_driver *current_driver, RD_WAVEFORMATEX * format);

View File

@ -106,7 +106,7 @@ libao_close(void)
}
BOOL
libao_set_format(WAVEFORMATEX * pwfx)
libao_set_format(RD_WAVEFORMATEX * pwfx)
{
ao_sample_format format;

View File

@ -219,7 +219,7 @@ oss_close_in(void)
}
BOOL
oss_format_supported(WAVEFORMATEX * pwfx)
oss_format_supported(RD_WAVEFORMATEX * pwfx)
{
if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
return False;
@ -232,7 +232,7 @@ oss_format_supported(WAVEFORMATEX * pwfx)
}
BOOL
oss_set_format(WAVEFORMATEX * pwfx)
oss_set_format(RD_WAVEFORMATEX * pwfx)
{
int fragments;
static BOOL driver_broken = False;

View File

@ -128,7 +128,7 @@ sgi_close(void)
}
BOOL
sgi_format_supported(WAVEFORMATEX * pwfx)
sgi_format_supported(RD_WAVEFORMATEX * pwfx)
{
if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
return False;
@ -141,7 +141,7 @@ sgi_format_supported(WAVEFORMATEX * pwfx)
}
BOOL
sgi_set_format(WAVEFORMATEX * pwfx)
sgi_set_format(RD_WAVEFORMATEX * pwfx)
{
int channels;
int frameSize, channelCount;

View File

@ -100,7 +100,7 @@ sun_close(void)
}
BOOL
sun_format_supported(WAVEFORMATEX * pwfx)
sun_format_supported(RD_WAVEFORMATEX * pwfx)
{
if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
return False;
@ -113,7 +113,7 @@ sun_format_supported(WAVEFORMATEX * pwfx)
}
BOOL
sun_set_format(WAVEFORMATEX * pwfx)
sun_set_format(RD_WAVEFORMATEX * pwfx)
{
audio_info_t info;

View File

@ -2,12 +2,12 @@
rdesktop: A Remote Desktop Protocol client.
Copyright (C) Matthew Chapman 1999-2005
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
@ -150,7 +150,7 @@
extern RDPDR_DEVICE g_rdpdr_device[];
static SERIAL_DEVICE *
get_serial_info(NTHANDLE handle)
get_serial_info(RD_NTHANDLE handle)
{
int index;
@ -163,7 +163,7 @@ get_serial_info(NTHANDLE handle)
}
static BOOL
get_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd)
get_termios(SERIAL_DEVICE * pser_inf, RD_NTHANDLE serial_fd)
{
speed_t speed;
struct termios *ptermios;
@ -316,7 +316,7 @@ get_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd)
}
static void
set_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd)
set_termios(SERIAL_DEVICE * pser_inf, RD_NTHANDLE serial_fd)
{
speed_t speed;
@ -553,11 +553,11 @@ serial_enum_devices(uint32 * id, char *optarg)
return count;
}
static NTSTATUS
static RD_NTSTATUS
serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,
uint32 flags_and_attributes, char *filename, NTHANDLE * handle)
uint32 flags_and_attributes, char *filename, RD_NTHANDLE * handle)
{
NTHANDLE serial_fd;
RD_NTHANDLE serial_fd;
SERIAL_DEVICE *pser_inf;
struct termios *ptermios;
@ -568,14 +568,14 @@ serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposi
if (serial_fd == -1)
{
perror("open");
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
if (!get_termios(pser_inf, serial_fd))
{
printf("INFO: SERIAL %s access denied\n", g_rdpdr_device[device_id].name);
fflush(stdout);
return STATUS_ACCESS_DENIED;
return RD_STATUS_ACCESS_DENIED;
}
/* Store handle for later use */
@ -607,23 +607,23 @@ serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposi
pser_inf->read_total_timeout_constant = 5;
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
serial_close(NTHANDLE handle)
static RD_NTSTATUS
serial_close(RD_NTHANDLE handle)
{
int i = get_device_index(handle);
if (i >= 0)
g_rdpdr_device[i].handle = 0;
rdpdr_abort_io(handle, 0, STATUS_TIMEOUT);
rdpdr_abort_io(handle, 0, RD_STATUS_TIMEOUT);
close(handle);
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
serial_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
serial_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
long timeout;
SERIAL_DEVICE *pser_inf;
@ -678,11 +678,11 @@ serial_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32
hexdump(data, *result);
#endif
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
serial_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
static RD_NTSTATUS
serial_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
{
SERIAL_DEVICE *pser_inf;
@ -695,11 +695,11 @@ serial_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32
DEBUG_SERIAL(("serial_write length %d, offset %d result %d\n", length, offset, *result));
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
static NTSTATUS
serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
static RD_NTSTATUS
serial_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out)
{
int flush_mask, purge_mask;
uint32 result, modemstate;
@ -708,7 +708,7 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
struct termios *ptermios;
if ((request >> 16) != FILE_DEVICE_SERIAL_PORT)
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
pser_inf = get_serial_info(handle);
ptermios = pser_inf->ptermios;
@ -904,9 +904,9 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
if (flush_mask != 0)
tcflush(handle, flush_mask);
if (purge_mask & SERIAL_PURGE_TXABORT)
rdpdr_abort_io(handle, 4, STATUS_CANCELLED);
rdpdr_abort_io(handle, 4, RD_STATUS_CANCELLED);
if (purge_mask & SERIAL_PURGE_RXABORT)
rdpdr_abort_io(handle, 3, STATUS_CANCELLED);
rdpdr_abort_io(handle, 3, RD_STATUS_CANCELLED);
break;
case SERIAL_WAIT_ON_MASK:
DEBUG_SERIAL(("serial_ioctl -> SERIAL_WAIT_ON_MASK %X\n",
@ -918,7 +918,7 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
out_uint32_le(out, result);
break;
}
return STATUS_PENDING;
return RD_STATUS_PENDING;
break;
case SERIAL_SET_BREAK_ON:
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_BREAK_ON\n"));
@ -939,14 +939,14 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
break;
default:
unimpl("SERIAL IOCTL %d\n", request);
return STATUS_INVALID_PARAMETER;
return RD_STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
return RD_STATUS_SUCCESS;
}
BOOL
serial_get_event(NTHANDLE handle, uint32 * result)
serial_get_event(RD_NTHANDLE handle, uint32 * result)
{
int index;
SERIAL_DEVICE *pser_inf;
@ -1044,7 +1044,7 @@ serial_get_event(NTHANDLE handle, uint32 * result)
/* Read timeout for a given file descripter (device) when adding fd's to select() */
BOOL
serial_get_timeout(NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout)
serial_get_timeout(RD_NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout)
{
int index;
SERIAL_DEVICE *pser_inf;

46
types.h
View File

@ -2,7 +2,7 @@
rdesktop: A Remote Desktop Protocol client.
Common data types
Copyright (C) Matthew Chapman 1999-2005
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
@ -12,7 +12,7 @@
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.
@ -40,16 +40,16 @@ typedef signed short sint16;
typedef unsigned int uint32;
typedef signed int sint32;
typedef void *HBITMAP;
typedef void *HGLYPH;
typedef void *HCOLOURMAP;
typedef void *HCURSOR;
typedef void *RD_HBITMAP;
typedef void *RD_HGLYPH;
typedef void *RD_HCOLOURMAP;
typedef void *RD_HCURSOR;
typedef struct _POINT
typedef struct _RD_POINT
{
sint16 x, y;
}
POINT;
RD_POINT;
typedef struct _COLOURENTRY
{
@ -103,7 +103,7 @@ typedef struct _FONTGLYPH
sint16 baseline;
uint16 width;
uint16 height;
HBITMAP pixmap;
RD_HBITMAP pixmap;
}
FONTGLYPH;
@ -153,7 +153,7 @@ CELLHEADER;
#define MAX_CBSIZE 256
/* RDPSND */
typedef struct
typedef struct _RD_WAVEFORMATEX
{
uint16 wFormatTag;
uint16 nChannels;
@ -163,7 +163,7 @@ typedef struct
uint16 wBitsPerSample;
uint16 cbSize;
uint8 cb[MAX_CBSIZE];
} WAVEFORMATEX;
} RD_WAVEFORMATEX;
typedef struct _RDPCOMP
{
@ -174,20 +174,20 @@ typedef struct _RDPCOMP
RDPCOMP;
/* RDPDR */
typedef uint32 NTSTATUS;
typedef uint32 NTHANDLE;
typedef uint32 RD_NTSTATUS;
typedef uint32 RD_NTHANDLE;
typedef struct _DEVICE_FNS
{
NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode,
uint32 create_disposition, uint32 flags_and_attributes, char *filename,
NTHANDLE * handle);
NTSTATUS(*close) (NTHANDLE handle);
NTSTATUS(*read) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
uint32 * result);
NTSTATUS(*write) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
uint32 * result);
NTSTATUS(*device_control) (NTHANDLE handle, uint32 request, STREAM in, STREAM out);
RD_NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode,
uint32 create_disposition, uint32 flags_and_attributes,
char *filename, RD_NTHANDLE * handle);
RD_NTSTATUS(*close) (RD_NTHANDLE handle);
RD_NTSTATUS(*read) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
uint32 * result);
RD_NTSTATUS(*write) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
uint32 * result);
RD_NTSTATUS(*device_control) (RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out);
}
DEVICE_FNS;
@ -195,7 +195,7 @@ DEVICE_FNS;
typedef struct rdpdr_device_info
{
uint32 device_type;
NTHANDLE handle;
RD_NTHANDLE handle;
char name[8];
char *local_path;
void *pdevice_data;

54
xwin.c
View File

@ -105,7 +105,7 @@ static XIM g_IM;
static XIC g_IC;
static XModifierKeymap *g_mod_map;
static Cursor g_current_cursor;
static HCURSOR g_null_cursor = NULL;
static RD_HCURSOR g_null_cursor = NULL;
static Atom g_protocol_atom, g_kill_atom;
extern Atom g_net_wm_state_atom;
extern Atom g_net_wm_desktop_atom;
@ -2314,7 +2314,7 @@ ui_move_pointer(int x, int y)
XWarpPointer(g_display, g_wnd, g_wnd, 0, 0, 0, 0, x, y);
}
HBITMAP
RD_HBITMAP
ui_create_bitmap(int width, int height, uint8 * data)
{
XImage *image;
@ -2344,7 +2344,7 @@ ui_create_bitmap(int width, int height, uint8 * data)
XFree(image);
if (tdata != data)
xfree(tdata);
return (HBITMAP) bitmap;
return (RD_HBITMAP) bitmap;
}
void
@ -2392,12 +2392,12 @@ ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * dat
}
void
ui_destroy_bitmap(HBITMAP bmp)
ui_destroy_bitmap(RD_HBITMAP bmp)
{
XFreePixmap(g_display, (Pixmap) bmp);
}
HGLYPH
RD_HGLYPH
ui_create_glyph(int width, int height, uint8 * data)
{
XImage *image;
@ -2419,20 +2419,20 @@ ui_create_glyph(int width, int height, uint8 * data)
XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height);
XFree(image);
return (HGLYPH) bitmap;
return (RD_HGLYPH) bitmap;
}
void
ui_destroy_glyph(HGLYPH glyph)
ui_destroy_glyph(RD_HGLYPH glyph)
{
XFreePixmap(g_display, (Pixmap) glyph);
}
HCURSOR
RD_HCURSOR
ui_create_cursor(unsigned int x, unsigned int y, int width, int height,
uint8 * andmask, uint8 * xormask)
{
HGLYPH maskglyph, cursorglyph;
RD_HGLYPH maskglyph, cursorglyph;
XColor bg, fg;
Cursor xcursor;
uint8 *cursor, *pcursor;
@ -2496,11 +2496,11 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height,
ui_destroy_glyph(cursorglyph);
xfree(mask);
xfree(cursor);
return (HCURSOR) xcursor;
return (RD_HCURSOR) xcursor;
}
void
ui_set_cursor(HCURSOR cursor)
ui_set_cursor(RD_HCURSOR cursor)
{
g_current_cursor = (Cursor) cursor;
XDefineCursor(g_display, g_wnd, g_current_cursor);
@ -2508,7 +2508,7 @@ ui_set_cursor(HCURSOR cursor)
}
void
ui_destroy_cursor(HCURSOR cursor)
ui_destroy_cursor(RD_HCURSOR cursor)
{
XFreeCursor(g_display, (Cursor) cursor);
}
@ -2526,7 +2526,7 @@ ui_set_null_cursor(void)
(xc)->flags = DoRed | DoGreen | DoBlue;
HCOLOURMAP
RD_HCOLOURMAP
ui_create_colourmap(COLOURMAP * colours)
{
COLOURENTRY *entry;
@ -2622,12 +2622,12 @@ ui_create_colourmap(COLOURMAP * colours)
XStoreColors(g_display, map, xcolours, ncolours);
xfree(xcolours);
return (HCOLOURMAP) map;
return (RD_HCOLOURMAP) map;
}
}
void
ui_destroy_colourmap(HCOLOURMAP map)
ui_destroy_colourmap(RD_HCOLOURMAP map)
{
if (!g_owncolmap)
xfree(map);
@ -2636,7 +2636,7 @@ ui_destroy_colourmap(HCOLOURMAP map)
}
void
ui_set_colourmap(HCOLOURMAP map)
ui_set_colourmap(RD_HCOLOURMAP map)
{
if (!g_owncolmap)
{
@ -2724,7 +2724,7 @@ ui_patblt(uint8 opcode,
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
case 3: /* Pattern */
@ -2739,7 +2739,7 @@ ui_patblt(uint8 opcode,
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
default:
@ -2782,7 +2782,7 @@ ui_screenblt(uint8 opcode,
void
ui_memblt(uint8 opcode,
/* dest */ int x, int y, int cx, int cy,
/* src */ HBITMAP src, int srcx, int srcy)
/* src */ RD_HBITMAP src, int srcx, int srcy)
{
SET_FUNCTION(opcode);
XCopyArea(g_display, (Pixmap) src, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
@ -2797,7 +2797,7 @@ ui_memblt(uint8 opcode,
void
ui_triblt(uint8 opcode,
/* dest */ int x, int y, int cx, int cy,
/* src */ HBITMAP src, int srcx, int srcy,
/* src */ RD_HBITMAP src, int srcx, int srcy,
/* brush */ BRUSH * brush, int bgcolour, int fgcolour)
{
/* This is potentially difficult to do in general. Until someone
@ -2855,7 +2855,7 @@ ui_rect(
void
ui_polygon(uint8 opcode,
/* mode */ uint8 fillmode,
/* dest */ POINT * point, int npoints,
/* dest */ RD_POINT * point, int npoints,
/* brush */ BRUSH * brush, int bgcolour, int fgcolour)
{
uint8 style, i, ipattern[8];
@ -2898,7 +2898,7 @@ ui_polygon(uint8 opcode,
FILL_POLYGON((XPoint *) point, npoints);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
case 3: /* Pattern */
@ -2913,7 +2913,7 @@ ui_polygon(uint8 opcode,
FILL_POLYGON((XPoint *) point, npoints);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
default:
@ -2925,7 +2925,7 @@ ui_polygon(uint8 opcode,
void
ui_polyline(uint8 opcode,
/* dest */ POINT * points, int npoints,
/* dest */ RD_POINT * points, int npoints,
/* pen */ PEN * pen)
{
/* TODO: set join style */
@ -2976,7 +2976,7 @@ ui_ellipse(uint8 opcode,
DRAW_ELLIPSE(x, y, cx, cy, fillmode);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
case 3: /* Pattern */
@ -2991,7 +2991,7 @@ ui_ellipse(uint8 opcode,
DRAW_ELLIPSE(x, y, cx, cy, fillmode);
XSetFillStyle(g_display, g_gc, FillSolid);
XSetTSOrigin(g_display, g_gc, 0, 0);
ui_destroy_glyph((HGLYPH) fill);
ui_destroy_glyph((RD_HGLYPH) fill);
break;
default:
@ -3005,7 +3005,7 @@ ui_ellipse(uint8 opcode,
void
ui_draw_glyph(int mixmode,
/* dest */ int x, int y, int cx, int cy,
/* src */ HGLYPH glyph, int srcx, int srcy,
/* src */ RD_HGLYPH glyph, int srcx, int srcy,
int bgcolour, int fgcolour)
{
SET_FOREGROUND(fgcolour);