src/taesooLib/BaseLib/utility/FileEx.cpp
DWORD CFileEx::Read( BYTE* pBuffer, DWORD dwSize )
{
	DWORD		dwRead	= 0;
	BOOL		bRet	= FALSE;
	OVERLAPPED	ov;

	ZeroMemory( &ov, sizeof( OVERLAPPED ) );
	IsOpenThrows();
	
	if( pBuffer ) {
		//bRet = ::ReadFile( m_hFile, pBuffer, dwSize, &dwRead, &ov );
		bRet = ::ReadFile( m_hFile, pBuffer, dwSize, &dwRead, 0);
		if( ! bRet && ::GetLastError() == ERROR_IO_PENDING ) {
			::GetOverlappedResult( m_hFile, &ov, &dwRead, TRUE );
		}else{
				// some API call failed. To Determine reason throw error
				// back to user with the API call's error from GetLastError
			if( ! bRet ) {
				dwRead = 0;
				ThrowErr( ::GetLastError(), FALSE );
			}
		}
	}else{
		ThrowErr( FILEEX_ERR_INVALIDPARAM, TRUE );
	}

	return dwRead;
}
///////////////////////////////////////////////////////////////////////////////
//	Desc:
//		Reads raw data in from the file if this file is opened.  While
//		the file is always opened as available for overlapped I/O this function
//		proceeds to read the function and just wait for the result.  Mimics
//		behaviour of CFile::Read
///////////////////////////////////////////////////////////////////////////////
Reads raw data in from the file if this file is opened.  While
the file is always opened as available for overlapped I/O this function
proceeds to read the function and just wait for the result.  Mimics
behaviour of CFile::Read
Reads raw data in from the file if this file is opened . While the file is always opened as available for overlapped I / O this function proceeds to read the function and just wait for the result . Mimics behaviour of CFile :: Read
DWORD CFileEx::Read( BYTE* pBuffer, DWORD dwSize )
{
	DWORD		dwRead	= 0;
	BOOL		bRet	= FALSE;
	OVERLAPPED	ov;
	ZeroMemory( &ov, sizeof( OVERLAPPED ) );
	IsOpenThrows();
	if( pBuffer ) {
		bRet = ::ReadFile( m_hFile, pBuffer, dwSize, &dwRead, 0);
		if( ! bRet && ::GetLastError() == ERROR_IO_PENDING ) {
			::GetOverlappedResult( m_hFile, &ov, &dwRead, TRUE );
		}else{
			if( ! bRet ) {
				dwRead = 0;
				ThrowErr( ::GetLastError(), FALSE );
			}
		}
	}else{
		ThrowErr( FILEEX_ERR_INVALIDPARAM, TRUE );
	}
	return dwRead;
}
DWORD CFileEx :: Read ( BYTE * pBuffer , DWORD dwSize ) { DWORD dwRead = 0 ; BOOL bRet = FALSE ; OVERLAPPED ov ; ZeroMemory ( & ov , sizeof ( OVERLAPPED ) ) ; IsOpenThrows ( ) ; if ( pBuffer ) { bRet = :: ReadFile ( m_hFile , pBuffer , dwSize , & dwRead , 0 ) ; if ( ! bRet && :: GetLastError ( ) == ERROR_IO_PENDING ) { :: GetOverlappedResult ( m_hFile , & ov , & dwRead , TRUE ) ; } else { if ( ! bRet ) { dwRead = 0 ; ThrowErr ( :: GetLastError ( ) , FALSE ) ; } } } else { ThrowErr ( FILEEX_ERR_INVALIDPARAM , TRUE ) ; } return dwRead ; }
Desc:
Reads raw data in from the file if this file is opened.
Desc : Reads raw data in from the file if this file is opened .
//bRet = ::ReadFile( m_hFile, pBuffer, dwSize, &dwRead, &ov ); // some API call failed. To Determine reason throw error // back to user with the API call's error from GetLastError