diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-07-17 20:12:37 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-07-17 20:45:21 +0200 |
commit | 3bf46bc2b2a041dcc278a881e5822643a9e4604d (patch) | |
tree | b8f1e8dbcb6b4cc51a1a63d43fb8e3b9ee73dead /vdagent | |
parent | 846a787c9f4049ca957b09e9a3f3b02ed771873b (diff) |
dos2unix
Diffstat (limited to 'vdagent')
-rw-r--r-- | vdagent/file_xfer.cpp | 32 | ||||
-rw-r--r-- | vdagent/vdagent.cpp | 38 |
2 files changed, 35 insertions, 35 deletions
diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp index 0550882..b7a480c 100644 --- a/vdagent/file_xfer.cpp +++ b/vdagent/file_xfer.cpp @@ -20,9 +20,9 @@ FileXfer::~FileXfer() { - FileXferTasks::iterator iter;
- FileXferTask* task;
-
+ FileXferTasks::iterator iter; + FileXferTask* task; + for (iter = _tasks.begin(); iter != _tasks.end(); iter++) { task = iter->second; CloseHandle(task->handle); @@ -36,10 +36,10 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, { char* file_meta = (char*)start->data; char file_path[MAX_PATH], file_name[MAX_PATH]; - ULARGE_INTEGER free_bytes;
- FileXferTask* task;
+ ULARGE_INTEGER free_bytes; + FileXferTask* task; uint64_t file_size; - HANDLE handle;
+ HANDLE handle; status->id = start->id; status->result = VD_AGENT_FILE_XFER_STATUS_ERROR; @@ -49,7 +49,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, return; } vd_printf("%u %s (%llu)", start->id, file_name, file_size); - if (FAILED(SHGetFolderPathA(NULL, CSIDL_COMMON_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL,
+ if (FAILED(SHGetFolderPathA(NULL, CSIDL_COMMON_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, file_path))) { vd_printf("failed getting desktop path"); return; @@ -64,21 +64,21 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, } strcat_s(file_path, MAX_PATH, "\\"); strcat_s(file_path, MAX_PATH, file_name); - handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
- if (handle == INVALID_HANDLE_VALUE) {
+ handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL); + if (handle == INVALID_HANDLE_VALUE) { vd_printf("failed creating %s %lu", file_path, GetLastError()); - return;
- }
+ return; + } task = new FileXferTask(handle, file_size, file_path); - _tasks[start->id] = task;
+ _tasks[start->id] = task; status->result = VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA; } bool FileXfer::handle_data(VDAgentFileXferDataMessage* data, VDAgentFileXferStatusMessage* status) { - FileXferTasks::iterator iter;
- FileXferTask* task;
+ FileXferTasks::iterator iter; + FileXferTask* task; DWORD written; status->id = data->id; @@ -116,8 +116,8 @@ fin: void FileXfer::handle_status(VDAgentFileXferStatusMessage* status) { - FileXferTasks::iterator iter;
- FileXferTask* task;
+ FileXferTasks::iterator iter; + FileXferTask* task; vd_printf("id %u result %u", status->id, status->result); if (status->result != VD_AGENT_FILE_XFER_STATUS_CANCELLED) { diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp index e5567f3..fd084a8 100644 --- a/vdagent/vdagent.cpp +++ b/vdagent/vdagent.cpp @@ -450,7 +450,7 @@ void VDAgent::input_desktop_message_loop() vd_printf("WTSRegisterSessionNotification() failed: %lu", GetLastError()); } if (_system_version == SYS_VER_WIN_7_CLASS) { - _add_clipboard_listener(_hwnd);
+ _add_clipboard_listener(_hwnd); } else { _hwnd_next_viewer = SetClipboardViewer(_hwnd); } @@ -463,7 +463,7 @@ void VDAgent::input_desktop_message_loop() _pending_input = false; } if (_system_version == SYS_VER_WIN_7_CLASS) { - _remove_clipboard_listener(_hwnd);
+ _remove_clipboard_listener(_hwnd); } else { ChangeClipboardChain(_hwnd, _hwnd_next_viewer); } @@ -948,9 +948,9 @@ void VDAgent::on_clipboard_grab() set_clipboard_owner(owner_guest); } else { UINT format = 0; - while (format = EnumClipboardFormats(format)) {
- vd_printf("Unsupported clipboard format %u", format);
- }
+ while (format = EnumClipboardFormats(format)) { + vd_printf("Unsupported clipboard format %u", format); + } } } @@ -1053,7 +1053,7 @@ bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_reques uint8_t* new_data = NULL; long new_size; size_t len = 0; - CxImage image;
+ CxImage image; if (_clipboard_owner != owner_guest) { vd_printf("Received clipboard request from client while clipboard is not owned by guest"); @@ -1087,19 +1087,19 @@ bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_reques DWORD cximage_format = get_cximage_format(clipboard_request->type); HPALETTE pal = 0; - ASSERT(cximage_format);
- if (IsClipboardFormatAvailable(CF_PALETTE)) {
+ ASSERT(cximage_format); + if (IsClipboardFormatAvailable(CF_PALETTE)) { pal = (HPALETTE)GetClipboardData(CF_PALETTE); } - if (!image.CreateFromHBITMAP((HBITMAP)clip_data, pal)) {
- vd_printf("Image create from handle failed");
- break;
- }
- if (!image.Encode(new_data, new_size, cximage_format)) {
- vd_printf("Image encode to type %u failed", clipboard_request->type);
- break;
- }
- vd_printf("Image encoded to %lu bytes", new_size);
+ if (!image.CreateFromHBITMAP((HBITMAP)clip_data, pal)) { + vd_printf("Image create from handle failed"); + break; + } + if (!image.Encode(new_data, new_size, cximage_format)) { + vd_printf("Image encode to type %u failed", clipboard_request->type); + break; + } + vd_printf("Image encoded to %lu bytes", new_size); break; } } @@ -1124,8 +1124,8 @@ bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_reques break; case VD_AGENT_CLIPBOARD_IMAGE_PNG: case VD_AGENT_CLIPBOARD_IMAGE_BMP: - memcpy(clipboard->data, new_data, new_size);
- image.FreeMemory(new_data);
+ memcpy(clipboard->data, new_data, new_size); + image.FreeMemory(new_data); break; } CloseClipboard(); |