/[winpt]/trunk/Src/wptW32API.cpp
ViewVC logotype

Diff of /trunk/Src/wptW32API.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 136 by twoaday, Fri Dec 30 13:56:10 2005 UTC revision 137 by twoaday, Mon Jan 9 14:01:51 2006 UTC
# Line 354  get_file_size (const char *fname) Line 354  get_file_size (const char *fname)
354  }  }
355    
356    
 int  
 init_file_lock( LOCK *ctx, const char *file )  
 {  
       
     ctx->size = get_file_size( file );  
     ctx->file = m_strdup( file );  
     ctx->fh = CreateFile( file, GENERIC_READ, FILE_SHARE_READ, NULL,  
                          OPEN_ALWAYS, 0, NULL );  
     if( ctx->fh == INVALID_HANDLE_VALUE )  
         return WPTERR_GENERAL;  
     if( LockFile( ctx->fh, 0, 0, ctx->size, 0 ) == FALSE ) {  
         CloseHandle( ctx->fh );  
         ctx->fh = INVALID_HANDLE_VALUE;  
         ctx->size = 0;  
         free( ctx->file );  
         return WPTERR_GENERAL;  
     }  
     return 0;  
 } /* init_file_lock */  
   
   
 void  
 release_file_lock( LOCK *ctx )  
 {  
     free_if_alloc( ctx->file );  
     ctx->file = NULL;  
     ctx->size = 0;  
     CloseHandle( ctx->fh );  
 } /* release_file_lock */  
   
   
357  /* Start a dialog with the exception that before it is checked that the  /* Start a dialog with the exception that before it is checked that the
358     dialog is not already openened. */     dialog is not already openened. */
359  int  int

Legend:
Removed from v.136  
changed lines
  Added in v.137

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26