00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_ntfs.h"
00010
00011 void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
00012 {
00013 DWORD dwTemp;
00014 int err;
00015 #ifndef PRINT_ERR_MSG
00016 static char myname[] = "ADIOI_NTFS_RESIZE";
00017 #endif
00018
00019 dwTemp = DWORDHIGH(size);
00020 err = SetFilePointer(fd->fd_sys, DWORDLOW(size), &dwTemp, FILE_BEGIN);
00021 err = SetEndOfFile(fd->fd_sys);
00022 #ifdef PRINT_ERR_MSG
00023 *error_code = (err == TRUE) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
00024 #else
00025 if (err == FALSE) {
00026 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00027 myname, "I/O Error", "%s", strerror(errno));
00028 ADIOI_Error(fd, *error_code, myname);
00029 }
00030 else *error_code = MPI_SUCCESS;
00031 #endif
00032 }