ng
   
   ' Validation
   If (lSize &gt; m_lBufferSize) Then
      errHandler "WriteBufferToFile", 3
      Exit Function
   End If
   If (m_hFile = 0) Or (m_ptrMem = 0) Then
      errHandler "WriteBufferToFile", 4
      Exit Function
   End If
   
   ' Write
   lR = WriteFile( _
      m_hFile, ByVal m_ptrMem, _
      lSize, lBytesWritten, ByVal 0&amp;)
   
   ' Check what we wrote
   If (lR = 0) Or Not (lSize = lBytesWritten) Then
      errHandler "WriteBufferToFile", 5
   End If
   
   WriteBufferToFile = 