Start using the exported TEB structure from winternl.h where
[wine/hacks.git] / dlls / kernel / change.c
blob3cb2291b8ea7783081a8be2a8e1d7d8cc2ad60ba
1 /*
2 * Win32 file change notification functions
4 * Copyright 1998 Ulrich Weigand
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.
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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <stdlib.h>
24 #include <string.h>
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "wine/windef16.h"
29 #include "wine/server.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(file);
34 /****************************************************************************
35 * FindFirstChangeNotificationA (KERNEL32.@)
37 HANDLE WINAPI FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree,
38 DWORD dwNotifyFilter )
40 HANDLE file, ret = INVALID_HANDLE_VALUE;
42 TRACE( "%s %d %lx\n", debugstr_a(lpPathName), bWatchSubtree, dwNotifyFilter );
44 if ((file = CreateFileA( lpPathName, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
45 OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 )) == INVALID_HANDLE_VALUE)
46 return INVALID_HANDLE_VALUE;
48 SERVER_START_REQ( create_change_notification )
50 req->handle = file;
51 req->subtree = bWatchSubtree;
52 req->filter = dwNotifyFilter;
53 if (!wine_server_call_err( req )) ret = reply->handle;
55 SERVER_END_REQ;
56 CloseHandle( file );
57 return ret;
60 /****************************************************************************
61 * FindFirstChangeNotificationW (KERNEL32.@)
63 HANDLE WINAPI FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree,
64 DWORD dwNotifyFilter)
66 HANDLE file, ret = INVALID_HANDLE_VALUE;
68 TRACE( "%s %d %lx\n", debugstr_w(lpPathName), bWatchSubtree, dwNotifyFilter );
70 if ((file = CreateFileW( lpPathName, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
71 OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 )) == INVALID_HANDLE_VALUE)
72 return INVALID_HANDLE_VALUE;
74 SERVER_START_REQ( create_change_notification )
76 req->handle = file;
77 req->subtree = bWatchSubtree;
78 req->filter = dwNotifyFilter;
79 if (!wine_server_call_err( req )) ret = reply->handle;
81 SERVER_END_REQ;
82 CloseHandle( file );
83 return ret;
86 /****************************************************************************
87 * FindNextChangeNotification (KERNEL32.@)
89 BOOL WINAPI FindNextChangeNotification( HANDLE handle )
91 BOOL ret;
93 TRACE("%p\n",handle);
95 SERVER_START_REQ( next_change_notification )
97 req->handle = handle;
98 ret = !wine_server_call_err( req );
100 SERVER_END_REQ;
101 return ret;
104 /****************************************************************************
105 * FindCloseChangeNotification (KERNEL32.@)
107 BOOL WINAPI FindCloseChangeNotification( HANDLE handle )
109 return CloseHandle( handle );
112 /***********************************************************************
113 * FileCDR (KERNEL.130)
115 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
117 FIXME("(0x%8x): stub\n", (int) x);
118 return (FARPROC16)TRUE;