Changeset 21302 for trunk/src/kernel32/Fileio.cpp
- Timestamp:
- Jun 18, 2009, 11:53:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/Fileio.cpp
r9892 r21302 253 253 { 254 254 HANDLE hFind; 255 char *filename;256 int namelen;257 255 258 256 if(lpFileName == NULL || lpFindFileData == NULL || lpSearchFilter != NULL) … … 285 283 { 286 284 case FindExInfoStandard: 285 { 286 char *filename; 287 int namelen; 288 289 //Strip the backslash if 'x:\'. This function is supposed 290 //to work in that case, but fail with 'x:\directory\' 287 291 namelen = strlen(lpFileName); 288 if( lpFileName[namelen-1] == '\\')292 if(namelen == 3 && lpFileName[1] == ':' && lpFileName[2] == '\\') 289 293 { 290 294 filename = (char *)alloca(namelen+1); … … 296 300 297 301 return (HANDLE)OSLibDosFindFirst(filename, (WIN32_FIND_DATAA *)lpFindFileData); 302 } 298 303 299 304 default: //should never happen … … 445 450 //****************************************************************************** 446 451 //****************************************************************************** 447 DWORD WIN32API GetFileType(HANDLE hFile)448 {449 return(HMGetFileType(hFile));450 }451 //******************************************************************************452 //******************************************************************************453 DWORD WIN32API GetFileInformationByHandle(HANDLE arg1, BY_HANDLE_FILE_INFORMATION * arg2)454 {455 return(HMGetFileInformationByHandle(arg1,arg2));456 }457 //******************************************************************************458 //******************************************************************************459 BOOL WIN32API SetEndOfFile(HANDLE arg1)460 {461 return HMSetEndOfFile(arg1);462 }463 //******************************************************************************464 //******************************************************************************465 BOOL WIN32API SetFileTime(HANDLE arg1, const FILETIME * arg2,466 const FILETIME * arg3,467 const FILETIME * arg4)468 {469 return HMSetFileTime(arg1,470 arg2,471 arg3,472 arg4);473 }474 //******************************************************************************475 //******************************************************************************476 452 INT WIN32API CompareFileTime(FILETIME * lpft1, FILETIME * lpft2) 477 453 { … … 497 473 //****************************************************************************** 498 474 //****************************************************************************** 499 BOOL WIN32API GetFileTime(HANDLE hFile, LPFILETIME arg2, LPFILETIME arg3, LPFILETIME arg4)500 {501 return HMGetFileTime(hFile, arg2, arg3, arg4);502 }503 //******************************************************************************504 //******************************************************************************505 475 BOOL WIN32API CopyFileA(LPCSTR arg1, LPCSTR arg2, BOOL arg3) 506 476 { 477 dprintf(("CopyFileA %s %s %d", arg1, arg2, arg3)); 507 478 return OSLibDosCopyFile(arg1, arg2, arg3); 508 479 } … … 622 593 //****************************************************************************** 623 594 //****************************************************************************** 624 DWORD WIN32API GetFileSize(HANDLE arg1, PDWORD arg2)625 {626 return HMGetFileSize(arg1,627 arg2);628 }629 //******************************************************************************630 //******************************************************************************631 595 BOOL WIN32API DeleteFileA(LPCSTR lpszFile) 632 596 { … … 678 642 { 679 643 dprintf(("GetTempFileNameA %s %s", lpPathName, lpPrefixString)); 680 return O32_GetTempFileName(lpPathName, lpPrefixString, uUnique, lpTempFileName); 644 UINT rc = O32_GetTempFileName(lpPathName, lpPrefixString, uUnique, lpTempFileName); 645 dprintf(("GetTempFileNameA: returns %d (%s)\n", rc, rc > 0 && lpTempFileName ? lpTempFileName : "<nothing>")); 646 return rc; 681 647 } 682 648 //****************************************************************************** … … 812 778 //****************************************************************************** 813 779 //****************************************************************************** 814 DWORD WIN32API SetFilePointer(HANDLE hFile, LONG lDistanceToMove,815 PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)816 {817 return(HMSetFilePointer(hFile,818 lDistanceToMove,819 lpDistanceToMoveHigh,820 dwMoveMethod));821 }822 //******************************************************************************823 //******************************************************************************824 780 DWORD WIN32API GetFileAttributesA(LPCSTR lpszFileName) 825 781 { 826 782 DWORD rc, error; 827 783 784 //Disable error popus. 785 ULONG oldmode = SetErrorMode(SEM_FAILCRITICALERRORS); 786 828 787 rc = OSLibGetFileAttributes((LPSTR)lpszFileName); 788 789 SetErrorMode(oldmode); 829 790 830 791 //SvL: Open32 returns FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_NORMAL for … … 855 816 856 817 astring = UnicodeToAsciiString((LPWSTR)arg1); 818 dprintf(("GetFileAttributesW %s", astring)); 857 819 rc = GetFileAttributesA(astring); 858 820 FreeAsciiString(astring); … … 919 881 asciibuffer, asciipart)); 920 882 921 if(rc && asciibuffer)883 if(rc>0 && rc<nBufferLength && asciibuffer) 922 884 AsciiToUnicode(asciibuffer, 923 885 lpBuffer); … … 933 895 if(asciibuffer) free(asciibuffer); 934 896 return(rc); 935 }936 //******************************************************************************937 //******************************************************************************938 BOOL WIN32API LockFile(HANDLE arg1, DWORD arg2,939 DWORD arg3, DWORD arg4,940 DWORD arg5)941 {942 return HMLockFile(arg1,943 arg2,944 arg3,945 arg4,946 arg5);947 }948 949 950 /*****************************************************************************951 * Name : BOOL LockFileEx952 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.953 * Parameters: HANDLE hFile handle of file to lock954 * DWORD dwFlags functional behavior modification flags955 * DWORD dwReserved reserved, must be set to zero956 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock957 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock958 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset959 * Variables :960 * Result : TRUE / FALSE961 * Remark :962 * Status : UNTESTED STUB963 *964 * Author : Patrick Haller [Mon, 1998/06/15 08:00]965 *****************************************************************************/966 967 BOOL LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved,968 DWORD nNumberOfBytesToLockLow,969 DWORD nNumberOfBytesToLockHigh,970 LPOVERLAPPED lpOverlapped)971 {972 return(HMLockFile(hFile,973 lpOverlapped->Offset,974 lpOverlapped->OffsetHigh,975 nNumberOfBytesToLockLow,976 nNumberOfBytesToLockHigh));977 897 } 978 898 //****************************************************************************** … … 1104 1024 1105 1025 return(rc); 1106 }1107 //******************************************************************************1108 /*****************************************************************************1109 ODINFUNCTION3(*, :,1110 HFILE, WIN32API,1111 OpenFile *, Purpose,1112 :, forwardOpenFile to Open321113 * Parameters:1114 * Variables :1115 * Result : API returncode1116 * Remark : modified for handle translation support1117 * Status : @@@PH verify if 0 is a valid "invalid handle" :)1118 *1119 * Author : Patrick Haller [Fri, 1998/06/12 02:53]1120 *****************************************************************************/1121 1122 HFILE WIN32API OpenFile(LPCSTR lpszFile, OFSTRUCT *lpOpenBuff,1123 UINT fuMode)1124 {1125 HFILE hFile;1126 1127 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",1128 lpszFile,1129 lpOpenBuff,1130 fuMode));1131 1132 hFile = HMOpenFile(lpszFile, /* call open32 */1133 lpOpenBuff,1134 fuMode);1135 1136 return (hFile);1137 }1138 //******************************************************************************1139 //******************************************************************************1140 BOOL WIN32API UnlockFile(HANDLE arg1, DWORD arg2, DWORD arg3,1141 DWORD arg4, DWORD arg5)1142 {1143 return HMUnlockFile(arg1,1144 arg2,1145 arg3,1146 arg4,1147 arg5);1148 }1149 1150 1151 /*****************************************************************************1152 * Name : BOOL UnlockFileEx1153 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.1154 * Parameters: HANDLE hFile handle of file to lock1155 * DWORD dwReserved reserved, must be set to zero1156 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock1157 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock1158 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset1159 * Variables :1160 * Result : TRUE / FALSE1161 * Remark :1162 * Status : UNTESTED STUB1163 *1164 * Author : Patrick Haller [Mon, 1998/06/15 08:00]1165 *****************************************************************************/1166 1167 BOOL WIN32API UnlockFileEx(HANDLE hFile, DWORD dwReserved,1168 DWORD nNumberOfBytesToLockLow,1169 DWORD nNumberOfBytesToLockHigh,1170 LPOVERLAPPED lpOverlapped)1171 {1172 return(HMUnlockFileEx(hFile, dwReserved,1173 nNumberOfBytesToLockLow,1174 nNumberOfBytesToLockHigh,1175 lpOverlapped));1176 1026 } 1177 1027 //****************************************************************************** … … 1675 1525 return hChange; 1676 1526 } 1677 //******************************************************************************1678 //******************************************************************************1679 BOOL WIN32API DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,1680 LPVOID lpInBuffer, DWORD nInBufferSize,1681 LPVOID lpOutBuffer, DWORD nOutBufferSize,1682 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)1683 {1684 return HMDeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize,1685 lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);1686 }1687 /*****************************************************************************1688 * Name : BOOL WIN32API CancelIo1689 * Purpose : The CancelIO function cancels all pending input and output1690 * (I/O) operations that were issued by the calling thread for1691 * the specified file handle. The function does not cancel1692 * I/O operations issued for the file handle by other threads.1693 * Parameters: HANDLE hFile file handle for which to cancel I/O1694 * Variables :1695 * Result : If the function succeeds, the return value is nonzero All pending1696 * I/O operations issued by the calling thread for the file handle1697 * were successfully canceled.1698 * If the function fails, the return value is zero.1699 * To get extended error information, call GetLastError.1700 * Remark : If there are any I/O operations in progress for the specified1701 * file HANDLE and they were issued by the calling thread, the1702 * CancelIO function cancels them.1703 * Note that the I/O operations must have been issued as1704 * overlapped I/O. If they were not, the I/O operations would not1705 * have returned to allow the thread to call the CancelIO function.1706 * Calling the CancelIO function with a file handle that was not1707 * opened with FILE_FLAG_OVERLAPPED does nothing.1708 * All I/O operations that are canceled will complete with the1709 * error ERROR_OPERATION_ABORTED. All completion notifications1710 * for the I/O operations will occur normally.1711 * Status :1712 *1713 * Author : Markus Montkowski [Thu, 1998/05/19 11:46]1714 *****************************************************************************/1715 BOOL WIN32API CancelIo(HANDLE hFile)1716 {1717 return HMCancelIo(hFile);1718 }1719 1527 /***************************************************************************** 1720 1528 * Name : BOOL GetOverlappedResult
Note:
See TracChangeset
for help on using the changeset viewer.