aboutsummaryrefslogtreecommitdiff
path: root/src/3rdParty/efsw/WatcherWin32.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdParty/efsw/WatcherWin32.hpp')
-rwxr-xr-xsrc/3rdParty/efsw/WatcherWin32.hpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/3rdParty/efsw/WatcherWin32.hpp b/src/3rdParty/efsw/WatcherWin32.hpp
new file mode 100755
index 0000000..71e13be
--- /dev/null
+++ b/src/3rdParty/efsw/WatcherWin32.hpp
@@ -0,0 +1,74 @@
1#ifndef EFSW_WATCHERWIN32_HPP
2#define EFSW_WATCHERWIN32_HPP
3
4#include <efsw/FileInfo.hpp>
5#include <efsw/FileWatcherImpl.hpp>
6
7#if EFSW_PLATFORM == EFSW_PLATFORM_WIN32
8
9#include <windows.h>
10
11#ifdef EFSW_COMPILER_MSVC
12#pragma comment( lib, "comctl32.lib" )
13#pragma comment( lib, "user32.lib" )
14#pragma comment( lib, "ole32.lib" )
15
16// disable secure warnings
17#pragma warning( disable : 4996 )
18#endif
19
20namespace efsw {
21
22class WatcherWin32;
23
24/// Internal watch data
25struct WatcherStructWin32 {
26 OVERLAPPED Overlapped;
27 WatcherWin32* Watch;
28};
29
30struct sLastModifiedEvent {
31 FileInfo file;
32 std::string fileName;
33};
34
35bool RefreshWatch( WatcherStructWin32* pWatch );
36
37void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped );
38
39void DestroyWatch( WatcherStructWin32* pWatch );
40
41WatcherStructWin32* CreateWatch( LPCWSTR szDirectory, bool recursive, DWORD NotifyFilter,
42 HANDLE iocp );
43
44class WatcherWin32 : public Watcher {
45 public:
46 WatcherWin32() :
47 Struct( NULL ),
48 DirHandle( NULL ),
49 lParam( 0 ),
50 NotifyFilter( 0 ),
51 StopNow( false ),
52 Watch( NULL ),
53 DirName( NULL ) {}
54
55 WatcherStructWin32* Struct;
56 HANDLE DirHandle;
57 BYTE Buffer
58 [63 *
59 1024]; // do NOT make this bigger than 64K because it will fail if the folder being watched
60 // is on the network! (see
61 // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx)
62 LPARAM lParam;
63 DWORD NotifyFilter;
64 bool StopNow;
65 FileWatcherImpl* Watch;
66 char* DirName;
67 sLastModifiedEvent LastModifiedEvent;
68};
69
70} // namespace efsw
71
72#endif
73
74#endif