Some small fixes to enhmetafiles.
[wine/multimedia.git] / files / change.c
blob6e81b4e7f33da3357663ea42ecfe6233a8de98c5
1 /*
2 * Win32 file change notification functions
4 * Copyright 1998 Ulrich Weigand
5 */
7 #include <assert.h>
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <string.h>
11 #include <time.h>
12 #include "windows.h"
13 #include "winbase.h"
14 #include "winerror.h"
15 #include "process.h"
16 #include "thread.h"
17 #include "heap.h"
18 #include "server.h"
19 #include "debug.h"
21 /* The change notification object */
22 typedef struct
24 K32OBJ header;
25 } CHANGE_OBJECT;
28 /****************************************************************************
29 * FindFirstChangeNotification32A (KERNEL32.248)
31 HANDLE32 WINAPI FindFirstChangeNotification32A( LPCSTR lpPathName,
32 BOOL32 bWatchSubtree,
33 DWORD dwNotifyFilter )
35 CHANGE_OBJECT *change;
36 struct create_change_notification_request req;
37 struct create_change_notification_reply reply;
39 req.subtree = bWatchSubtree;
40 req.filter = dwNotifyFilter;
41 CLIENT_SendRequest( REQ_CREATE_CHANGE_NOTIFICATION, -1, 1, &req, sizeof(req) );
42 CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
43 if (reply.handle == -1) return INVALID_HANDLE_VALUE32;
45 change = HeapAlloc( SystemHeap, 0, sizeof(CHANGE_OBJECT) );
46 if (!change)
48 CLIENT_CloseHandle( reply.handle );
49 return INVALID_HANDLE_VALUE32;
51 change->header.type = K32OBJ_CHANGE;
52 change->header.refcount = 1;
53 return HANDLE_Alloc( PROCESS_Current(), &change->header,
54 STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE /*FIXME*/,
55 FALSE, reply.handle );
58 /****************************************************************************
59 * FindFirstChangeNotification32W (KERNEL32.249)
61 HANDLE32 WINAPI FindFirstChangeNotification32W( LPCWSTR lpPathName,
62 BOOL32 bWatchSubtree,
63 DWORD dwNotifyFilter)
65 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpPathName );
66 HANDLE32 ret = FindFirstChangeNotification32A( nameA, bWatchSubtree,
67 dwNotifyFilter );
68 if (nameA) HeapFree( GetProcessHeap(), 0, nameA );
69 return ret;
72 /****************************************************************************
73 * FindNextChangeNotification (KERNEL32.252)
75 BOOL32 WINAPI FindNextChangeNotification( HANDLE32 handle )
77 if (HANDLE_GetServerHandle( PROCESS_Current(), handle,
78 K32OBJ_FILE, 0 ) == -1)
79 return FALSE;
80 /* FIXME: do something */
81 return TRUE;
84 /****************************************************************************
85 * FindCloseChangeNotification (KERNEL32.247)
87 BOOL32 WINAPI FindCloseChangeNotification( HANDLE32 handle)
89 return CloseHandle( handle );