Changeset 70419 in vbox
- Timestamp:
- Jan 2, 2018 11:17:06 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120024
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp
r69753 r70419 43 43 #include "internal/dir.h" 44 44 #include "internal/path.h" 45 #include "../win/internal-r3-win.h" 45 46 46 47 … … 200 201 static int rtDirNtCheckRecord(PRTDIRINTERNAL pThis) 201 202 { 202 #if def RTDIR_NT_STRICT203 #if defined(RTDIR_NT_STRICT) || defined(RT_ARCH_X86) 203 204 # ifdef IPRT_WITH_NT_PATH_PASSTHRU 204 205 if (pThis->enmInfoClass != FileMaximumInformation) … … 210 211 else 211 212 uEndAddr = (uintptr_t)&pThis->uCurData.pBoth->FileName[0]; 213 214 # ifdef RT_ARCH_X86 215 /* Workaround for NT 3.1 bug where FAT returns a too short buffer length. 216 Including all NT 3.x versions in case it bug was fixed till NT 4. */ 217 uintptr_t const uEndBuffer = (uintptr_t)&pThis->pabBuffer[pThis->cbBuffer]; 218 if ( uEndAddr < uEndBuffer 219 && uEndAddr + pThis->uCurData.pBoth->FileNameLength <= uEndBuffer) 220 { /* likely */ } 221 else if ( ( g_enmWinVer == kRTWinOSType_NT310 222 || g_enmWinVer == kRTWinOSType_NT350 // not sure when it was fixed... 223 || g_enmWinVer == kRTWinOSType_NT351) 224 && pThis->enmInfoClass == FileBothDirectoryInformation) 225 { 226 size_t cbLeft = (uintptr_t)&pThis->pabBuffer[pThis->cbBufferAlloc] - (uintptr_t)pThis->uCurData.pBoth; 227 if ( cbLeft >= RT_UOFFSETOF(FILE_BOTH_DIR_INFORMATION, FileName) 228 && pThis->uCurData.pBoth->FileNameLength > 0 229 && cbLeft >= RT_UOFFSETOF(FILE_BOTH_DIR_INFORMATION, FileName) + pThis->uCurData.pBoth->FileNameLength) 230 { 231 pThis->cbBuffer = ((uintptr_t)&pThis->uCurData.pBoth->FileName[0] + pThis->uCurData.pBoth->FileNameLength) 232 - (uintptr_t)&pThis->pabBuffer[0]; 233 } 234 } 235 # endif 236 237 # ifdef RTDIR_NT_STRICT 212 238 AssertReturn(uEndAddr < (uintptr_t)&pThis->pabBuffer[pThis->cbBuffer], VERR_IO_GEN_FAILURE); 213 214 239 AssertReturn(pThis->uCurData.pBoth->FileNameLength < _64K, VERR_FILENAME_TOO_LONG); 215 240 AssertReturn((pThis->uCurData.pBoth->FileNameLength & 1) == 0, VERR_IO_GEN_FAILURE); … … 220 245 AssertReturn((unsigned)pThis->uCurData.pBoth->ShortNameLength <= sizeof(pThis->uCurData.pBoth->ShortName), 221 246 VERR_IO_GEN_FAILURE); 247 # endif 222 248 } 223 249 #else … … 472 498 return RTErrConvertFromNtStatus(rcNt); 473 499 } 474 Assert(Ios.Information > sizeof(*pThis->uCurData.pBoth)); 500 AssertMsg( Ios.Information 501 > (pThis->enmInfoClass == FileMaximumInformation ? sizeof(*pThis->uCurData.pObjDir) : sizeof(*pThis->uCurData.pBoth)), 502 ("Ios.Information=%#x\n", Ios.Information)); 475 503 476 504 /*
Note:
See TracChangeset
for help on using the changeset viewer.