Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

  1. #include <windows.h>
  2. //=========================================================================================
  3. // FileExists
  4. // pszFilename file to be checked
  5. //
  6. // Return
  7. // TRUE file exists.
  8. // FALSE file does not exist.
  9. //
  10. //=========================================================================================
  11. BOOL FileExists( PCSTR pszFilename )
  12. {
  13. DWORD attr;
  14. // No null filename
  15. attr = GetFileAttributes(pszFilename);
  16. if( attr == 0xFFFFFFFF )
  17. return FALSE;
  18. return !(attr & FILE_ATTRIBUTE_DIRECTORY);
  19. }
  20. //***************************************************************************
  21. //* *
  22. //* NAME: FileSize *
  23. //* *
  24. //* SYNOPSIS: *
  25. //* *
  26. //* REQUIRES: *
  27. //* *
  28. //* RETURNS: *
  29. //* *
  30. //***************************************************************************
  31. /*
  32. DWORD FileSize( PCSTR pszFile )
  33. {
  34. HFILE hFile;
  35. OFSTRUCT ofStru;
  36. DWORD dwSize = 0;
  37. if ( *pszFile == 0 )
  38. return 0;
  39. hFile = OpenFile( pszFile, &ofStru, OF_READ );
  40. if ( hFile != HFILE_ERROR )
  41. {
  42. dwSize = GetFileSize( (HANDLE)hFile, NULL );
  43. _lclose( hFile );
  44. }
  45. return dwSize;
  46. }
  47. */