35 #if (defined(HAVE_DIRFD) || (HAVE_DECL_DIRFD == 1)) 36 #define DIRFD(a) (dirfd(a)) 38 #define DIRFD(a) ((a)->DIR_FD_MEMBER_NAME) 43 #if (defined(HAVE_MNTENT_H) && defined(HAVE_SETMNTENT)) 45 #define MNTENT_PATH "/etc/mtab" 53 #ifdef HAVE_SYS_STATVFS_H 54 #include <sys/statvfs.h> 57 #ifdef HAVE_SYS_STATFS_H 58 #include <sys/statfs.h> 61 #ifdef HAVE_SYS_PARAM_H 65 #ifdef HAVE_SYS_MOUNT_H 66 #include <sys/mount.h> 71 #ifdef STAT_STATFS3_OSF1 72 #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf))) 73 #define STATFS_T statfs 78 #define STATFS_FN(path, buf) (statvfs(path,buf)) 79 #define STATFS_T statvfs 84 #define STATFS_FN(path, buf) (statvfs64(path,buf)) 85 #define STATFS_T statvfs64 89 #if (defined(STAT_STATFS2_FS_DATA) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS2_FSIZE)) 90 #define STATFS_FN(path, buf) (statfs(path,buf)) 91 #define STATFS_T statfs 96 #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf),0)) 97 #define STATFS_T statfs 101 #if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMEMAX)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMEMAX))) 102 #define F_NAMELEN(buf) ((buf).f_namemax) 105 #if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMELEN)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMELEN))) 106 #define F_NAMELEN(buf) ((buf).f_namelen) 110 #define F_NAMELEN(buf) (255) 127 buf->f_blocks = 262144;
128 buf->f_bfree = 131072;
130 buf->f_namelen = 255;
131 buf->f_namemax = 255;
136 #define STATFS_T dummy_statfs_t 137 #define STATFS_FN(path,buf) (dummy_statfs(buf)) 168 unsigned long long ticks;
170 ticks = (seconds + 11644473600
LL) * 10000000;
172 *high = (
uint32) (ticks >> 32);
179 unsigned long long ticks;
182 ticks = low + (((
unsigned long long) high) << 32);
184 ticks -= 11644473600
LL;
199 static const char zero = 0;
321 This->rdpdr_device[*
id].name);
324 strcpy(
This->rdpdr_device[*
id].local_path, pos2);
343 struct stat filestat;
354 switch (create_disposition)
474 if (
handle >= MAX_OPEN_FILES)
476 error(
"Maximum number of open files (%s) reached. Increase MAX_OPEN_FILES!\n",
487 This->fileinfo[
handle].flags_and_attributes = flags_and_attributes;
488 This->fileinfo[
handle].accessmask = accessmask;
614 uint32 file_attributes, ft_high, ft_low;
615 struct stat filestat;
637 if (!file_attributes)
695 uint32 length, file_attributes, ft_high, ft_low, delete_on_close;
699 struct stat filestat;
700 time_t write_time, change_time, access_time, mod_time;
710 write_time = change_time = access_time = 0;
722 if (ft_low || ft_high)
728 if (ft_low || ft_high)
734 if (ft_low || ft_high)
748 if (write_time || change_time)
749 mod_time =
MIN(write_time, change_time);
751 mod_time = write_time ? write_time : change_time;
757 if (access_time || write_time || change_time)
760 printf(
"FileBasicInformation access time %s",
762 printf(
"FileBasicInformation modification time %s",
769 if (!file_attributes)
781 printf(
"FileBasicInformation set access mode 0%o",
mode);
805 sprintf(fullpath,
"%s%s",
This->rdpdr_device[pfinfo->device_id].local_path,
808 if (
rename(pfinfo->path, fullpath) != 0)
827 if (delete_on_close ||
831 pfinfo->delete_on_close =
True;
848 if (
STATFS_FN(
This->rdpdr_device[pfinfo->device_id].local_path, &stat_fs) == 0)
849 if (stat_fs.f_bfree * stat_fs.f_bsize <
length)
939 p->modify_time =
buf.st_mtime;
940 p->status_time =
buf.st_ctime;
963 p->total_time += (
buf.st_mtime +
buf.st_ctime);
989 fdfs = setmntent(MNTENT_PATH,
"r");
993 while ((
e = getmntent(fdfs)))
999 if (
strstr(
e->mnt_opts,
"vfat") ||
strstr(
e->mnt_opts,
"iso9660"))
1004 unsigned char buf[512];
1006 if (
strstr(
e->mnt_opts,
"vfat"))
1012 (
buf[42] << 24) + (
buf[41] << 16) +
1013 (
buf[40] << 8) +
buf[39];
1015 info.label[10] =
'\0';
1021 info.label[32] =
'\0';
1109 uint32 file_attributes, ft_low, ft_high;
1119 file_attributes = 0;
1164 if (
pdirent->d_name[0] ==
'.')
1166 if (!file_attributes)
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
#define STATUS_OBJECT_NAME_COLLISION
static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
void __cdecl rewinddir(DIR *)
RD_BOOL str_startswith(const char *s, const char *prefix)
#define STATUS_FILE_IS_A_DIRECTORY
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
RD_BOOL rdpdr_abort_io(uint32 fd, uint32 major, RD_NTSTATUS status)
void convert_to_unix_filename(char *filename)
ACPI_SIZE strlen(const char *String)
#define STATUS_INVALID_PARAMETER
GLsizei const GLchar ** path
char * strstr(char *String1, char *String2)
#define FILE_DIRECTORY_FILE
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
GLuint GLuint GLsizei count
#define FileFsFullSizeInformation
NTSTATUS disk_query_directory(RDPCLIENT *This, NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
NTSTATUS disk_query_information(RDPCLIENT *This, NTHANDLE handle, uint32 info_class, STREAM out)
#define out_uint32_le(s, v)
__cdecl __MINGW_NOTHROW char * dirname(char *)
#define STATUS_INVALID_DEVICE_REQUEST
static NTSTATUS disk_close(RDPCLIENT *This, NTHANDLE handle)
_Check_return_opt_ _CRTIMP long __cdecl lseek(_In_ int _FileHandle, _In_ long _Offset, _In_ int _Origin)
static NTSTATUS disk_device_control(RDPCLIENT *This, NTHANDLE handle, uint32 request, STREAM in, STREAM out)
NTSTATUS disk_query_volume_information(RDPCLIENT *This, NTHANDLE handle, uint32 info_class, STREAM out)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define STATUS_INVALID_HANDLE
__CRT_INLINE int __cdecl utime(const char *_Filename, struct utimbuf *_Utimbuf)
#define sprintf(buf, format,...)
DIR *__cdecl opendir(const char *)
GLenum GLuint GLenum GLsizei const GLchar * buf
return STATUS_NOT_IMPLEMENTED
static int open_weak_exclusive(const char *pathname, int flags, mode_t mode)
NTSTATUS disk_create_notify(RDPCLIENT *This, NTHANDLE handle, uint32 info_class)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
#define RDPDR_MAX_DEVICES
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int ftruncate(int, off_t)
static NTSTATUS disk_write(RDPCLIENT *This, NTHANDLE handle, uint8 *data, uint32 length, uint32 offset, uint32 *result)
GLenum GLuint GLenum GLsizei length
static time_t get_create_time(struct stat *st)
static FsInfoType * FsVolumeInfo(char *fpath)
NTSTATUS disk_check_notify(RDPCLIENT *This, NTHANDLE handle)
#define FS_CASE_SENSITIVE
#define STATUS_NOTIFY_ENUM_DIR
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_DELETE_ON_CLOSE
static NTSTATUS disk_create(RDPCLIENT *This, uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, uint32 flags_and_attributes, char *filename, NTHANDLE *phandle)
#define FileFsObjectIdInformation
#define STATUS_NO_MORE_FILES
int disk_enum_devices(RDPCLIENT *This, uint32 *id, char *optarg)
#define FILE_ATTRIBUTE_READONLY
#define STATUS_ACCESS_DENIED
NTSTATUS disk_set_information(RDPCLIENT *This, NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
char * next_arg(char *src, char needle)
#define FILE_ATTRIBUTE_NORMAL
#define FILE_NON_DIRECTORY_FILE
static NTSTATUS disk_read(RDPCLIENT *This, NTHANDLE handle, uint8 *data, uint32 length, uint32 offset, uint32 *result)
#define memcpy(s1, s2, n)
int __cdecl closedir(DIR *)
#define FS_CASE_IS_PRESERVED
struct dirent *__cdecl readdir(DIR *)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
void rdp_out_unistr(STREAM s, char *string, int len)
#define STATUS_NO_SUCH_FILE
#define FILE_ATTRIBUTE_HIDDEN
static time_t convert_1970_to_filetime(uint32 high, uint32 low)
static void seconds_since_1970_to_filetime(time_t seconds, uint32 *high, uint32 *low)
#define FileStandardInformation
static NTSTATUS NotifyInfo(RDPCLIENT *This, NTHANDLE handle, uint32 info_class, NOTIFY *p)
static int ftruncate_growable(int fd, off_t length)
_CRTIMP int __cdecl fstat(int _Desc, struct stat *_Stat)
char * strcpy(char *DstString, const char *SrcString)
static int dummy_statfs(struct dummy_statfs_t *buf)
int strcmp(const char *String1, const char *String2)
void unimpl(char *format,...)
#define TRUNCATE_EXISTING
GLuint GLuint GLsizei GLenum type
#define in_uint32_le(s, v)
static SERVICE_STATUS status
int fnmatch(char *pattern, const char *string, int flags) const
#define STATFS_FN(path, buf)
#define FILE_COMPLETE_IF_OPLOCKED
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)