FreeRDP
synthetic_file.c File Reference
#include <winpr/config.h>
#include <winpr/platform.h>
#include <errno.h>
#include <winpr/wtypes.h>
#include <winpr/crt.h>
#include <winpr/clipboard.h>
#include <winpr/collections.h>
#include <winpr/file.h>
#include <winpr/shell.h>
#include <winpr/string.h>
#include <winpr/wlog.h>
#include <winpr/path.h>
#include <winpr/print.h>
#include "clipboard.h"
#include "synthetic_file.h"
#include "../log.h"

Macros

#define _FILE_OFFSET_BITS   64
 
#define TAG   WINPR_TAG("clipboard.synthetic.file")
 

Functions

void free_synthetic_file (struct synthetic_file *file)
 
static struct synthetic_file * make_synthetic_file (const WCHAR *local_name, const WCHAR *remote_name)
 
static UINT synthetic_file_read_close (struct synthetic_file *file, BOOL force)
 
static WCHAR * convert_local_name_component_to_remote (wClipboard *clipboard, const WCHAR *local_name)
 
static WCHAR * concat_file_name (const WCHAR *dir, const WCHAR *file)
 
static BOOL add_file_to_list (wClipboard *clipboard, const WCHAR *local_name, const WCHAR *remote_name, wArrayList *files)
 
static BOOL add_directory_entry_to_list (wClipboard *clipboard, const WCHAR *local_dir_name, const WCHAR *remote_dir_name, const LPWIN32_FIND_DATAW pFileData, wArrayList *files)
 
static BOOL do_add_directory_contents_to_list (wClipboard *clipboard, const WCHAR *local_name, const WCHAR *remote_name, WCHAR *namebuf, wArrayList *files)
 
static BOOL add_directory_contents_to_list (wClipboard *clipboard, const WCHAR *local_name, const WCHAR *remote_name, wArrayList *files)
 
static const WCHAR * get_basename (const WCHAR *name)
 
static BOOL process_file_name (wClipboard *clipboard, const WCHAR *local_name, wArrayList *files)
 
static BOOL process_uri (wClipboard *clipboard, const char *uri, size_t uri_len)
 
static BOOL process_uri_list (wClipboard *clipboard, const char *data, size_t length)
 
static BOOL convert_local_file_to_filedescriptor (const struct synthetic_file *file, FILEDESCRIPTORW *descriptor)
 
static FILEDESCRIPTORWconvert_local_file_list_to_filedescriptors (wArrayList *files)
 
static void * convert_any_uri_list_to_filedescriptors (wClipboard *clipboard, UINT32 formatId, UINT32 *pSize)
 
static void * convert_uri_list_to_filedescriptors (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static BOOL process_files (wClipboard *clipboard, const char *data, UINT32 pSize, const char *prefix)
 
static BOOL process_gnome_copied_files (wClipboard *clipboard, const char *data, UINT32 pSize)
 
static BOOL process_mate_copied_files (wClipboard *clipboard, const char *data, UINT32 pSize)
 
static BOOL process_nautilus_clipboard (wClipboard *clipboard, const char *data, UINT32 pSize)
 
static void * convert_nautilus_clipboard_to_filedescriptors (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void * convert_gnome_copied_files_to_filedescriptors (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void * convert_mate_copied_files_to_filedescriptors (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static size_t count_special_chars (const WCHAR *str)
 
static const char * stop_at_special_chars (const char *str)
 
static void * convert_filedescriptors_to_file_list (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize, const char *header, const char *lineprefix, const char *lineending, BOOL skip_last_lineending)
 
static void * convert_filedescriptors_to_uri_list (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void * convert_filedescriptors_to_gnome_copied_files (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void * convert_filedescriptors_to_nautilus_clipboard (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void * convert_filedescriptors_to_mate_copied_files (wClipboard *clipboard, UINT32 formatId, const void *data, UINT32 *pSize)
 
static void array_free_synthetic_file (void *the_file)
 
static BOOL register_file_formats_and_synthesizers (wClipboard *clipboard)
 
static UINT file_get_size (const struct synthetic_file *file, UINT64 *size)
 
static UINT delegate_file_request_size (wClipboardDelegate *delegate, const wClipboardFileSizeRequest *request)
 
static UINT file_get_range (struct synthetic_file *file, UINT64 offset, UINT32 size, BYTE **actual_data, UINT32 *actual_size)
 
static UINT delegate_file_request_range (wClipboardDelegate *delegate, const wClipboardFileRangeRequest *request)
 
static UINT dummy_file_size_success (wClipboardDelegate *delegate, const wClipboardFileSizeRequest *request, UINT64 fileSize)
 
static UINT dummy_file_size_failure (wClipboardDelegate *delegate, const wClipboardFileSizeRequest *request, UINT errorCode)
 
static UINT dummy_file_range_success (wClipboardDelegate *delegate, const wClipboardFileRangeRequest *request, const BYTE *data, UINT32 size)
 
static UINT dummy_file_range_failure (wClipboardDelegate *delegate, const wClipboardFileRangeRequest *request, UINT errorCode)
 
static void setup_delegate (wClipboardDelegate *delegate)
 
BOOL ClipboardInitSyntheticFileSubsystem (wClipboard *clipboard)
 

Variables

static const char * mime_uri_list = "text/uri-list"
 
static const char * mime_FileGroupDescriptorW = "FileGroupDescriptorW"
 
static const char * mime_gnome_copied_files = "x-special/gnome-copied-files"
 
static const char * mime_mate_copied_files = "x-special/mate-copied-files"
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

WinPR: Windows Portable Runtime Clipboard Functions: POSIX file handling

Copyright 2017 Alexei Lozovsky a.loz.nosp@m.ovsk.nosp@m.y@gma.nosp@m.il.c.nosp@m.om

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ TAG

#define TAG   WINPR_TAG("clipboard.synthetic.file")

Function Documentation

◆ add_directory_contents_to_list()

static BOOL add_directory_contents_to_list ( wClipboard *  clipboard,
const WCHAR *  local_name,
const WCHAR *  remote_name,
wArrayList *  files 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_directory_entry_to_list()

static BOOL add_directory_entry_to_list ( wClipboard *  clipboard,
const WCHAR *  local_dir_name,
const WCHAR *  remote_dir_name,
const LPWIN32_FIND_DATAW  pFileData,
wArrayList *  files 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_file_to_list()

static BOOL add_file_to_list ( wClipboard *  clipboard,
const WCHAR *  local_name,
const WCHAR *  remote_name,
wArrayList *  files 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ array_free_synthetic_file()

static void array_free_synthetic_file ( void *  the_file)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClipboardInitSyntheticFileSubsystem()

BOOL ClipboardInitSyntheticFileSubsystem ( wClipboard *  clipboard)

WinPR: Windows Portable Runtime Clipboard Functions: POSIX file handling

Copyright 2017 Alexei Lozovsky a.loz.nosp@m.ovsk.nosp@m.y@gma.nosp@m.il.c.nosp@m.om

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ concat_file_name()

static WCHAR* concat_file_name ( const WCHAR *  dir,
const WCHAR *  file 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_any_uri_list_to_filedescriptors()

static void* convert_any_uri_list_to_filedescriptors ( wClipboard *  clipboard,
UINT32  formatId,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_filedescriptors_to_file_list()

static void* convert_filedescriptors_to_file_list ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize,
const char *  header,
const char *  lineprefix,
const char *  lineending,
BOOL  skip_last_lineending 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_filedescriptors_to_gnome_copied_files()

static void* convert_filedescriptors_to_gnome_copied_files ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_filedescriptors_to_mate_copied_files()

static void* convert_filedescriptors_to_mate_copied_files ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_filedescriptors_to_nautilus_clipboard()

static void* convert_filedescriptors_to_nautilus_clipboard ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:

◆ convert_filedescriptors_to_uri_list()

static void* convert_filedescriptors_to_uri_list ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_gnome_copied_files_to_filedescriptors()

static void* convert_gnome_copied_files_to_filedescriptors ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_local_file_list_to_filedescriptors()

static FILEDESCRIPTORW* convert_local_file_list_to_filedescriptors ( wArrayList *  files)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_local_file_to_filedescriptor()

static BOOL convert_local_file_to_filedescriptor ( const struct synthetic_file *  file,
FILEDESCRIPTORW descriptor 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_local_name_component_to_remote()

static WCHAR* convert_local_name_component_to_remote ( wClipboard *  clipboard,
const WCHAR *  local_name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_mate_copied_files_to_filedescriptors()

static void* convert_mate_copied_files_to_filedescriptors ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_nautilus_clipboard_to_filedescriptors()

static void* convert_nautilus_clipboard_to_filedescriptors ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:

◆ convert_uri_list_to_filedescriptors()

static void* convert_uri_list_to_filedescriptors ( wClipboard *  clipboard,
UINT32  formatId,
const void *  data,
UINT32 *  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_special_chars()

static size_t count_special_chars ( const WCHAR *  str)
static
Here is the caller graph for this function:

◆ delegate_file_request_range()

static UINT delegate_file_request_range ( wClipboardDelegate *  delegate,
const wClipboardFileRangeRequest request 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delegate_file_request_size()

static UINT delegate_file_request_size ( wClipboardDelegate *  delegate,
const wClipboardFileSizeRequest request 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_add_directory_contents_to_list()

static BOOL do_add_directory_contents_to_list ( wClipboard *  clipboard,
const WCHAR *  local_name,
const WCHAR *  remote_name,
WCHAR *  namebuf,
wArrayList *  files 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dummy_file_range_failure()

static UINT dummy_file_range_failure ( wClipboardDelegate *  delegate,
const wClipboardFileRangeRequest request,
UINT  errorCode 
)
static
Here is the caller graph for this function:

◆ dummy_file_range_success()

static UINT dummy_file_range_success ( wClipboardDelegate *  delegate,
const wClipboardFileRangeRequest request,
const BYTE data,
UINT32  size 
)
static
Here is the caller graph for this function:

◆ dummy_file_size_failure()

static UINT dummy_file_size_failure ( wClipboardDelegate *  delegate,
const wClipboardFileSizeRequest request,
UINT  errorCode 
)
static
Here is the caller graph for this function:

◆ dummy_file_size_success()

static UINT dummy_file_size_success ( wClipboardDelegate *  delegate,
const wClipboardFileSizeRequest request,
UINT64  fileSize 
)
static
Here is the caller graph for this function:

◆ file_get_range()

static UINT file_get_range ( struct synthetic_file *  file,
UINT64  offset,
UINT32  size,
BYTE **  actual_data,
UINT32 *  actual_size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_get_size()

static UINT file_get_size ( const struct synthetic_file *  file,
UINT64 *  size 
)
static
Here is the caller graph for this function:

◆ free_synthetic_file()

void free_synthetic_file ( struct synthetic_file *  file)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_basename()

static const WCHAR* get_basename ( const WCHAR *  name)
static
Here is the caller graph for this function:

◆ make_synthetic_file()

static struct synthetic_file* make_synthetic_file ( const WCHAR *  local_name,
const WCHAR *  remote_name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_file_name()

static BOOL process_file_name ( wClipboard *  clipboard,
const WCHAR *  local_name,
wArrayList *  files 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_files()

static BOOL process_files ( wClipboard *  clipboard,
const char *  data,
UINT32  pSize,
const char *  prefix 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_gnome_copied_files()

static BOOL process_gnome_copied_files ( wClipboard *  clipboard,
const char *  data,
UINT32  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_mate_copied_files()

static BOOL process_mate_copied_files ( wClipboard *  clipboard,
const char *  data,
UINT32  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_nautilus_clipboard()

static BOOL process_nautilus_clipboard ( wClipboard *  clipboard,
const char *  data,
UINT32  pSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_uri()

static BOOL process_uri ( wClipboard *  clipboard,
const char *  uri,
size_t  uri_len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_uri_list()

static BOOL process_uri_list ( wClipboard *  clipboard,
const char *  data,
size_t  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_file_formats_and_synthesizers()

static BOOL register_file_formats_and_synthesizers ( wClipboard *  clipboard)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_delegate()

static void setup_delegate ( wClipboardDelegate *  delegate)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_at_special_chars()

static const char* stop_at_special_chars ( const char *  str)
static
Here is the caller graph for this function:

◆ synthetic_file_read_close()

UINT synthetic_file_read_close ( struct synthetic_file *  file,
BOOL  force 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mime_FileGroupDescriptorW

const char* mime_FileGroupDescriptorW = "FileGroupDescriptorW"
static

◆ mime_gnome_copied_files

const char* mime_gnome_copied_files = "x-special/gnome-copied-files"
static

◆ mime_mate_copied_files

const char* mime_mate_copied_files = "x-special/mate-copied-files"
static

◆ mime_uri_list

const char* mime_uri_list = "text/uri-list"
static