char-win.c (ef0f272f38e1e534dd05a5a611aa0eb15dc60cc1) | char-win.c (541815ff7f54f45a60d058b1c499c4affff094e0) |
---|---|
1/* 2 * QEMU System Emulator 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 178 unchanged lines hidden (view full) --- 187 return len1 - len; 188} 189 190static void char_win_finalize(Object *obj) 191{ 192 Chardev *chr = CHARDEV(obj); 193 WinChardev *s = WIN_CHARDEV(chr); 194 | 1/* 2 * QEMU System Emulator 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 178 unchanged lines hidden (view full) --- 187 return len1 - len; 188} 189 190static void char_win_finalize(Object *obj) 191{ 192 Chardev *chr = CHARDEV(obj); 193 WinChardev *s = WIN_CHARDEV(chr); 194 |
195 if (s->skip_free) { 196 return; 197 } 198 | |
199 if (s->hsend) { 200 CloseHandle(s->hsend); 201 } 202 if (s->hrecv) { 203 CloseHandle(s->hrecv); 204 } | 195 if (s->hsend) { 196 CloseHandle(s->hsend); 197 } 198 if (s->hrecv) { 199 CloseHandle(s->hrecv); 200 } |
205 if (s->file) { | 201 if (!s->keep_open && s->file) { |
206 CloseHandle(s->file); 207 } 208 if (s->fpipe) { 209 qemu_del_polling_cb(win_chr_pipe_poll, chr); 210 } else { 211 qemu_del_polling_cb(win_chr_serial_poll, chr); 212 } 213 214 qemu_chr_be_event(chr, CHR_EVENT_CLOSED); 215} 216 | 202 CloseHandle(s->file); 203 } 204 if (s->fpipe) { 205 qemu_del_polling_cb(win_chr_pipe_poll, chr); 206 } else { 207 qemu_del_polling_cb(win_chr_serial_poll, chr); 208 } 209 210 qemu_chr_be_event(chr, CHR_EVENT_CLOSED); 211} 212 |
217void qemu_chr_open_win_file(Chardev *chr, HANDLE fd_out) | 213void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open) |
218{ 219 WinChardev *s = WIN_CHARDEV(chr); 220 | 214{ 215 WinChardev *s = WIN_CHARDEV(chr); 216 |
221 s->skip_free = true; 222 s->file = fd_out; | 217 s->keep_open = keep_open; 218 s->file = file; |
223} 224 225static void char_win_class_init(ObjectClass *oc, void *data) 226{ 227 ChardevClass *cc = CHARDEV_CLASS(oc); 228 229 cc->chr_write = win_chr_write; 230} --- 16 unchanged lines hidden --- | 219} 220 221static void char_win_class_init(ObjectClass *oc, void *data) 222{ 223 ChardevClass *cc = CHARDEV_CLASS(oc); 224 225 cc->chr_write = win_chr_write; 226} --- 16 unchanged lines hidden --- |