* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
#include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/main-loop.h"
+#include "qemu/module.h"
#include "qapi/error.h"
-#include "char-win.h"
+#include "chardev/char-win.h"
static void win_chr_read(Chardev *chr, DWORD len)
{
Chardev *chr = CHARDEV(obj);
WinChardev *s = WIN_CHARDEV(chr);
- if (s->skip_free) {
- return;
- }
-
if (s->hsend) {
CloseHandle(s->hsend);
}
if (s->hrecv) {
CloseHandle(s->hrecv);
}
- if (s->file) {
+ if (!s->keep_open && s->file) {
CloseHandle(s->file);
}
if (s->fpipe) {
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
}
-void qemu_chr_open_win_file(Chardev *chr, HANDLE fd_out)
+void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open)
{
WinChardev *s = WIN_CHARDEV(chr);
- s->skip_free = true;
- s->file = fd_out;
+ s->keep_open = keep_open;
+ s->file = file;
}
static void char_win_class_init(ObjectClass *oc, void *data)