Piotr Caban : msvcrt: Added _lock_file/_unlock_file implementation.
Alexandre Julliard
julliard at winehq.org
Thu May 19 13:32:12 CDT 2011
Module: wine
Branch: master
Commit: 249917beac273a2959202722b89f34d53b694c91
URL: http://source.winehq.org/git/wine.git/?a=commit;h=249917beac273a2959202722b89f34d53b694c91
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu May 19 15:31:42 2011 +0200
msvcrt: Added _lock_file/_unlock_file implementation.
---
dlls/msvcrt/file.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 07c31ba..ee95c28 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -380,6 +380,9 @@ static int msvcrt_init_fp(MSVCRT_FILE* file, int fd, unsigned stream_flags)
file->_file = fd;
file->_flag = stream_flags;
+ if(file<MSVCRT__iob || file>=MSVCRT__iob+_IOB_ENTRIES)
+ InitializeCriticalSection(&((file_crit*)file)->crit);
+
TRACE(":got FILE* (%p)\n",file);
return 0;
}
@@ -1034,7 +1037,10 @@ LONG CDECL MSVCRT__lseek(int fd, LONG offset, int whence)
*/
void CDECL MSVCRT__lock_file(MSVCRT_FILE *file)
{
- FIXME("(%p) stub\n",file);
+ if(file>=MSVCRT__iob && file<MSVCRT__iob+_IOB_ENTRIES)
+ _lock(_STREAM_LOCKS+(file-MSVCRT__iob));
+ else
+ EnterCriticalSection(&((file_crit*)file)->crit);
}
/*********************************************************************
@@ -1042,7 +1048,10 @@ void CDECL MSVCRT__lock_file(MSVCRT_FILE *file)
*/
void CDECL MSVCRT__unlock_file(MSVCRT_FILE *file)
{
- FIXME("(%p) stub\n",file);
+ if(file>=MSVCRT__iob && file<MSVCRT__iob+_IOB_ENTRIES)
+ _unlock(_STREAM_LOCKS+(file-MSVCRT__iob));
+ else
+ LeaveCriticalSection(&((file_crit*)file)->crit);
}
/*********************************************************************
@@ -2555,6 +2564,8 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* file)
r=MSVCRT__close(file->_file);
file->_flag = 0;
+ if(file<MSVCRT__iob || file>=MSVCRT__iob+_IOB_ENTRIES)
+ DeleteCriticalSection(&((file_crit*)file)->crit);
if(file == msvcrt_get_file(MSVCRT_stream_idx-1)) {
while(MSVCRT_stream_idx>3 && !file->_flag) {
More information about the wine-cvs
mailing list