1 /* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 * Copyright (C) 2014 Chun-wei Fan
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Vlad Grecescu <b100dian@gmail.com>
20 * Author: Chun-wei Fan <fanc999@yahoo.com.tw>
21 *
22 */
23
24 #ifndef __G_WIN32_FS_MONITOR_UTILS_H__
25 #define __G_WIN32_FS_MONITOR_UTILS_H__
26
27 #include <windows.h>
28
29 #include "gio/glocalfilemonitor.h"
30
31 #include "gio/gfilemonitor.h"
32
33 G_BEGIN_DECLS
34
35 typedef struct _GWin32FSMonitorPrivate GWin32FSMonitorPrivate;
36
37 struct _GWin32FSMonitorPrivate
38 {
39 OVERLAPPED overlapped;
40 DWORD buffer_allocated_bytes;
41 PFILE_NOTIFY_INFORMATION file_notify_buffer;
42 DWORD buffer_filled_bytes;
43 HANDLE hDirectory;
44 gboolean isfile;
45 wchar_t *wfullpath_with_long_prefix;
46 wchar_t *wfilename_short;
47 wchar_t *wfilename_long;
48 DWORD file_attribs;
49 PFILE_NOTIFY_INFORMATION pfni_prev;
50 /* Needed in the APC where we only have this private struct */
51 GFileMonitor *self;
52 GFileMonitorSource *fms;
53 };
54
55 enum GWin32FileMonitorFileAlias
56 {
57 G_WIN32_FILE_MONITOR_NO_ALIAS = 0,
58 G_WIN32_FILE_MONITOR_LONG_FILENAME,
59 G_WIN32_FILE_MONITOR_SHORT_FILENAME,
60 G_WIN32_FILE_MONITOR_NO_MATCH_FOUND
61 };
62
63 GWin32FSMonitorPrivate* g_win32_fs_monitor_create (gboolean isfile);
64
65 void g_win32_fs_monitor_init (GWin32FSMonitorPrivate *monitor,
66 const gchar *dirname,
67 const gchar *filename,
68 gboolean isfile);
69
70 void g_win32_fs_monitor_finalize (GWin32FSMonitorPrivate *monitor);
71
72 void g_win32_fs_monitor_close_handle (GWin32FSMonitorPrivate *monitor);
73
74 G_END_DECLS
75
76 #endif