Lines Matching refs:hFile

60  * @param   hFile       Filehandle.
65 DECLINLINE(bool) MySetFilePointer(RTFILE hFile, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)
74 off.LowPart = SetFilePointer((HANDLE)RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
80 off.LowPart = SetFilePointer((HANDLE)RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
84 fRc = SetFilePointerEx((HANDLE)RTFileToNative(hFile), off, &off, uMethod);
97 * @param hFile Filehandle.
101 DECLINLINE(bool) IsBeyondLimit(RTFILE hFile, uint64_t offSeek, unsigned uMethod)
113 if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
115 if (!MySetFilePointer(hFile, offSeek, NULL, uMethod))
118 MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
140 RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE hFile)
142 AssertReturn(hFile != NIL_RTFILE, (RTHCINTPTR)INVALID_HANDLE_VALUE);
143 return (RTHCINTPTR)hFile;
285 HANDLE hFile = CreateFileW(pwszFilename,
292 if (hFile != INVALID_HANDLE_VALUE)
314 if (!SetEndOfFile(hFile))
319 *pFile = (RTFILE)hFile;
320 Assert((HANDLE)*pFile == hFile);
325 CloseHandle(hFile);
344 RTR3DECL(int) RTFileClose(RTFILE hFile)
346 if (hFile == NIL_RTFILE)
348 if (CloseHandle((HANDLE)RTFileToNative(hFile)))
371 RTFILE hFile = (RTFILE)(uintptr_t)hNative;
372 AssertReturn((HANDLE)(uintptr_t)hFile == hNative, NIL_RTFILE);
373 return hFile;
377 RTR3DECL(int) RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
398 if (MySetFilePointer(hFile, offSeek, poffActual, aulSeekRecode[uMethod]))
404 RTR3DECL(int) RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
412 if (ReadFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToReadAdj, &cbRead, NULL))
423 if (!ReadFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL))
451 if (!ReadFile((HANDLE)RTFileToNative(hFile), (char *)pvBuf + cbRead, cbToRead, &cbReadPart, NULL))
483 RTR3DECL(int) RTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
491 if (WriteFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToWriteAdj, &cbWritten, NULL))
502 if (!WriteFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbWritten,
507 && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT)
538 if (!WriteFile((HANDLE)RTFileToNative(hFile), (const char *)pvBuf + cbWritten, cbToWrite, &cbWrittenPart, NULL))
551 && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
572 && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
578 RTR3DECL(int) RTFileFlush(RTFILE hFile)
580 if (!FlushFileBuffers((HANDLE)RTFileToNative(hFile)))
590 RTR3DECL(int) RTFileSetSize(RTFILE hFile, uint64_t cbSize)
597 if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
602 if (MySetFilePointer(hFile, cbSize, NULL, FILE_BEGIN))
605 if (SetEndOfFile((HANDLE)RTFileToNative(hFile)))
611 if ( MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN)
620 MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
632 RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize)
638 Size.LowPart = GetFileSize((HANDLE)RTFileToNative(hFile), &Size.HighPart);
651 if (DeviceIoControl((HANDLE)RTFileToNative(hFile),
665 if (DeviceIoControl((HANDLE)RTFileToNative(hFile),
683 RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax)
695 RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
697 if (hFile != NIL_RTFILE)
699 DWORD dwType = GetFileType((HANDLE)RTFileToNative(hFile));
724 RTR3DECL(int) RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
749 if (LockFileEx((HANDLE)RTFileToNative(hFile), dwFlags, 0, LOW_DWORD(cbLock), HIGH_DWORD(cbLock), &Overlapped))
756 RTR3DECL(int) RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
768 int rc = RTFileUnlock(hFile, offLock, cbLock);
773 rc = RTFileLock(hFile, fLock, offLock, cbLock);
779 rc = RTFileLock(hFile, fLockOld, offLock, cbLock);
787 RTR3DECL(int) RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
791 if (UnlockFile((HANDLE)RTFileToNative(hFile),
801 RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
806 if (hFile == NIL_RTFILE)
808 AssertMsgFailed(("Invalid hFile=%RTfile\n", hFile));
827 if (!GetFileInformationByHandle((HANDLE)RTFileToNative(hFile), &Data))
898 RTR3DECL(int) RTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
920 if (!SetFileTime((HANDLE)RTFileToNative(hFile), pCreationTimeFT, pLastAccessTimeFT, pLastWriteTimeFT))
925 hFile, pAccessTime, pModificationTime, pChangeTime, pBirthTime, Err, rc));
937 RTR3DECL(int) RTFileSetMode(RTFILE hFile, RTFMODE fMode)
947 int Err = rtFileNativeSetAttributes((HANDLE)hFile, FileAttributes);
952 hFile, fMode, FileAttributes, Err, rc));
959 RTR3DECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree,
962 /** @todo implement this using NtQueryVolumeInformationFile(hFile,,,,