FreeBASIC  0.91.0
file_hlock.c
Go to the documentation of this file.
1 /* low-level lock and unlock functions */
2 
3 #include "../fb.h"
4 #include <io.h>
5 #include <windows.h>
6 
7 #ifdef HOST_MINGW
8  #define fileno _fileno
9  #define get_osfhandle _get_osfhandle
10 #endif
11 
12 int fb_hFileLock( FILE *f, fb_off_t inipos, fb_off_t size )
13 {
14  return fb_ErrorSetNum( LockFile( (HANDLE)get_osfhandle( fileno( f ) ), inipos, 0, size, 0 ) == TRUE ?
16 }
17 
18 int fb_hFileUnlock( FILE *f, fb_off_t inipos, fb_off_t size )
19 {
20  return fb_ErrorSetNum( UnlockFile( (HANDLE)get_osfhandle( fileno( f ) ), inipos, 0, size, 0 ) == TRUE ?
22 }