Ignore:
Timestamp:
Jun 1, 2000, 1:28:48 PM (25 years ago)
Author:
sandervl
Message:

Rewrote file io apis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/Fileio.cpp

    r3588 r3642  
    1 /* $Id: Fileio.cpp,v 1.33 2000-05-22 19:07:53 sandervl Exp $ */
     1/* $Id: Fileio.cpp,v 1.34 2000-06-01 11:28:45 sandervl Exp $ */
    22
    33/*
     
    234234//******************************************************************************
    235235ODINFUNCTION2(INT, CompareFileTime,
    236               FILETIME *, arg1,
    237               FILETIME *, arg2)
    238 {
    239   return O32_CompareFileTime(arg1, arg2);
     236              FILETIME *, lpft1,
     237              FILETIME *, lpft2)
     238{
     239   if (lpft1 == NULL || lpft2 == NULL) {
     240        SetLastError(ERROR_INVALID_PARAMETER);
     241        return -1;
     242   }     
     243
     244   if(lpft1->dwHighDateTime > lpft2->dwHighDateTime)
     245        return 1;
     246
     247   if(lpft1->dwHighDateTime < lpft2->dwHighDateTime)
     248        return -1;
     249
     250   if(lpft1->dwLowDateTime > lpft2->dwLowDateTime)
     251        return 1;
     252
     253   if(lpft1->dwLowDateTime < lpft2->dwLowDateTime)
     254        return -1;
     255
     256   return 0; //equal
    240257}
    241258//******************************************************************************
     
    288305 BOOL rc;
    289306
    290   rc = O32_DeleteFile(lpszFile);
     307#if 0
     308  return 1;
     309#else
     310  rc = OSLibDosDelete((LPSTR)lpszFile);
    291311  if(!rc) {
    292312        dprintf(("DeleteFileA %s returned FALSE; last error %x", lpszFile, GetLastError()));
     
    298318
    299319  return rc;
     320#endif
    300321}
    301322//******************************************************************************
     
    382403//******************************************************************************
    383404//******************************************************************************
    384 ODINFUNCTION4(DWORD, SetFilePointer,
    385               HANDLE, hFile,
    386               LONG, lDistanceToMove,
    387               PLONG, lpDistanceToMoveHigh,
    388               DWORD, dwMoveMethod)
    389 {
    390   dprintf(("KERNEL32: SetFilePointer(%08xh,%08xh,%08xh,%08xh)\n",
    391            hFile,
    392            lDistanceToMove,
    393            lpDistanceToMoveHigh,
    394            dwMoveMethod));
    395 
    396   return(HMSetFilePointer(hFile,
    397                          lDistanceToMove,
    398                          lpDistanceToMoveHigh,
    399                          dwMoveMethod));
     405ODINFUNCTION5(BOOL,         ReadFileEx,
     406              HANDLE,       hFile,
     407              LPVOID,       lpBuffer,
     408              DWORD,        nNumberOfBytesToRead,
     409              LPOVERLAPPED, lpOverlapped,
     410              LPOVERLAPPED_COMPLETION_ROUTINE,  lpCompletionRoutine)
     411{
     412  return (HMReadFileEx(hFile,
     413                       lpBuffer,
     414                       nNumberOfBytesToRead,
     415                       lpOverlapped, lpCompletionRoutine));
    400416}
    401417//******************************************************************************
     
    408424              LPOVERLAPPED, lpOverlapped)
    409425{
    410   dprintf(("KERNEL32: WriteFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
    411            hFile,
    412            buffer,
    413            nrbytes,
    414            nrbyteswritten,
    415            lpOverlapped));
    416 
    417426  return (HMWriteFile(hFile,
    418427                      buffer,
     
    420429                      nrbyteswritten,
    421430                      lpOverlapped));
     431}
     432/*****************************************************************************
     433 * Name      : BOOL WriteFileEx
     434 * Purpose   : The WriteFileEx function writes data to a file. It is designed
     435 *             solely for asynchronous operation, unlike WriteFile, which is
     436 *             designed for both synchronous and asynchronous operation.
     437 *             WriteFileEx reports its completion status asynchronously,
     438 *             calling a specified completion routine when writing is completed
     439 *             and the calling thread is in an alertable wait state.
     440 * Parameters: HANDLE       hFile                handle of file to write
     441 *             LPVOID       lpBuffer             address of buffer
     442 *             DWORD        nNumberOfBytesToRead number of bytes to write
     443 *             LPOVERLAPPED lpOverlapped         address of offset
     444 *             LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine address of completion routine
     445 * Variables :
     446 * Result    : TRUE / FALSE
     447 * Remark    :
     448 * Status    : UNTESTED STUB
     449 *
     450 * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
     451 *****************************************************************************/
     452
     453ODINFUNCTION5(BOOL,         WriteFileEx,
     454              HANDLE,       hFile,
     455              LPVOID,       lpBuffer,
     456              DWORD,        nNumberOfBytesToWrite,
     457              LPOVERLAPPED, lpOverlapped,
     458              LPOVERLAPPED_COMPLETION_ROUTINE,  lpCompletionRoutine)
     459{
     460  return (HMWriteFileEx(hFile,
     461                        lpBuffer,
     462                        nNumberOfBytesToWrite,
     463                        lpOverlapped, lpCompletionRoutine));
     464}
     465//******************************************************************************
     466//******************************************************************************
     467ODINFUNCTION4(DWORD, SetFilePointer,
     468              HANDLE, hFile,
     469              LONG, lDistanceToMove,
     470              PLONG, lpDistanceToMoveHigh,
     471              DWORD, dwMoveMethod)
     472{
     473  dprintf(("KERNEL32: SetFilePointer(%08xh,%08xh,%08xh,%08xh)\n",
     474           hFile,
     475           lDistanceToMove,
     476           lpDistanceToMoveHigh,
     477           dwMoveMethod));
     478
     479  return(HMSetFilePointer(hFile,
     480                         lDistanceToMove,
     481                         lpDistanceToMoveHigh,
     482                         dwMoveMethod));
    422483}
    423484//******************************************************************************
     
    751812           lpOverlapped));
    752813
    753   return(HMUnlockFile(hFile,
    754                       lpOverlapped->Offset,
    755                       lpOverlapped->OffsetHigh,
    756                       nNumberOfBytesToLockLow,
    757                       nNumberOfBytesToLockHigh));
     814  return(HMUnlockFileEx(hFile, dwReserved,
     815                        nNumberOfBytesToLockLow,
     816                        nNumberOfBytesToLockHigh,
     817                        lpOverlapped));
    758818}
    759819//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.