Changeset 76121 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Dec 10, 2018 1:28:36 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSF.cpp
r76118 r76121 1452 1452 pszDir = pCdFsi->cdi_curdir; 1453 1453 1454 PVBOXSFFOLDER pFolder; 1455 PSHFLSTRING pStrFolderPath; 1456 rc = vboxSfOs2ResolvePath(pszDir, pCdFsd, offCurDirEnd, &pFolder, &pStrFolderPath); 1454 PVBOXSFFOLDER pFolder; 1455 VBOXSFCREATEREQ *pReq; 1456 rc = vboxSfOs2ResolvePathEx(pszDir, pCdFsd, offCurDirEnd, RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath), 1457 &pFolder, (void **)&pReq); 1457 1458 if (rc == NO_ERROR) 1458 1459 { 1459 SHFLCREATEPARMS *pParams = (SHFLCREATEPARMS *)VbglR0PhysHeapAlloc(sizeof(*pParams)); 1460 if (pParams) 1461 { 1462 RT_ZERO(*pParams); 1463 pParams->CreateFlags = SHFL_CF_LOOKUP; 1464 1465 int vrc = VbglR0SfCreate(&g_SfClient, &pFolder->hHostFolder, pStrFolderPath, pParams); 1466 LogFlow(("FS32_CHDIR: VbglR0SfCreate -> %Rrc Result=%d fMode=%#x\n", vrc, pParams->Result, pParams->Info.Attr.fMode)); 1467 if (RT_SUCCESS(vrc)) 1460 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP; 1461 1462 int vrc = vboxSfOs2HostReqCreate(pFolder, pReq); 1463 LogFlow(("FS32_CHDIR: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n", 1464 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 1465 if (RT_SUCCESS(vrc)) 1466 { 1467 switch (pReq->CreateParms.Result) 1468 1468 { 1469 switch (pParams->Result) 1470 { 1471 case SHFL_FILE_EXISTS: 1472 if (RTFS_IS_DIRECTORY(pParams->Info.Attr.fMode)) 1473 rc = NO_ERROR; 1474 else 1475 rc = ERROR_ACCESS_DENIED; 1476 break; 1477 1478 case SHFL_PATH_NOT_FOUND: 1479 rc = ERROR_PATH_NOT_FOUND; 1480 break; 1481 1482 default: 1483 case SHFL_FILE_NOT_FOUND: 1484 rc = ERROR_FILE_NOT_FOUND; 1485 break; 1486 } 1469 case SHFL_FILE_EXISTS: 1470 if (RTFS_IS_DIRECTORY(pReq->CreateParms.Info.Attr.fMode)) 1471 rc = NO_ERROR; 1472 else 1473 rc = ERROR_ACCESS_DENIED; 1474 break; 1475 1476 case SHFL_PATH_NOT_FOUND: 1477 rc = ERROR_PATH_NOT_FOUND; 1478 break; 1479 1480 default: 1481 case SHFL_FILE_NOT_FOUND: 1482 rc = ERROR_FILE_NOT_FOUND; 1483 break; 1487 1484 } 1488 else1489 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_PATH_NOT_FOUND);1490 VbglR0PhysHeapFree(pParams);1491 1485 } 1492 1486 else 1493 rc = ERROR_NOT_ENOUGH_MEMORY; 1494 vboxSfOs2ReleasePathAndFolder(pStrFolderPath, pFolder); 1495 } 1487 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_PATH_NOT_FOUND); 1488 } 1489 1490 VbglR0PhysHeapFree(pReq); 1491 vboxSfOs2ReleaseFolder(pFolder); 1496 1492 } 1497 1493 else if (fFlags == CD_FREE) … … 1525 1521 * Resolve the path. 1526 1522 */ 1527 PVBOXSFFOLDER pFolder; 1528 PSHFLSTRING pStrFolderPath; 1529 rc = vboxSfOs2ResolvePath(pszDir, pCdFsd, offCurDirEnd, &pFolder, &pStrFolderPath); 1523 PVBOXSFFOLDER pFolder; 1524 VBOXSFCREATEREQ *pReq; 1525 rc = vboxSfOs2ResolvePathEx(pszDir, pCdFsd, offCurDirEnd, RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath), 1526 &pFolder, (void **)&pReq); 1530 1527 if (rc == NO_ERROR) 1531 1528 { … … 1534 1531 * fails if it exists and we get a file handle back that needs closing. Sigh. 1535 1532 */ 1536 SHFLCREATEPARMS *pParams = (SHFLCREATEPARMS *)VbglR0PhysHeapAlloc(sizeof(*pParams)); 1537 if (pParams != NULL) 1538 { 1539 RT_ZERO(*pParams); 1540 pParams->CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_CREATE_IF_NEW | SHFL_CF_ACT_FAIL_IF_EXISTS 1541 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_DENYNONE; 1542 1543 int vrc = VbglR0SfCreate(&g_SfClient, &pFolder->hHostFolder, pStrFolderPath, pParams); 1544 LogFlow(("FS32_MKDIR: VbglR0SfCreate -> %Rrc Result=%d fMode=%#x\n", vrc, pParams->Result, pParams->Info.Attr.fMode)); 1545 if (RT_SUCCESS(vrc)) 1533 pReq->CreateParms.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_CREATE_IF_NEW | SHFL_CF_ACT_FAIL_IF_EXISTS 1534 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_DENYNONE; 1535 1536 int vrc = vboxSfOs2HostReqCreate(pFolder, pReq); 1537 LogFlow(("FS32_MKDIR: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n", 1538 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 1539 if (RT_SUCCESS(vrc)) 1540 { 1541 switch (pReq->CreateParms.Result) 1546 1542 { 1547 switch (pParams->Result) 1548 { 1549 case SHFL_FILE_CREATED: 1550 if (pParams->Handle != SHFL_HANDLE_NIL) 1551 { 1552 vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, pParams->Handle); 1553 AssertRC(vrc); 1554 } 1555 rc = NO_ERROR; 1556 break; 1557 1558 case SHFL_FILE_EXISTS: 1559 rc = ERROR_ACCESS_DENIED; 1560 break; 1561 1562 case SHFL_PATH_NOT_FOUND: 1563 rc = ERROR_PATH_NOT_FOUND; 1564 break; 1565 1566 default: 1567 case SHFL_FILE_NOT_FOUND: 1568 rc = ERROR_FILE_NOT_FOUND; 1569 break; 1570 } 1543 case SHFL_FILE_CREATED: 1544 if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL) 1545 { 1546 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 1547 vrc = vboxSfOs2HostReqClose(pFolder, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle); 1548 AssertRC(vrc); 1549 } 1550 rc = NO_ERROR; 1551 break; 1552 1553 case SHFL_FILE_EXISTS: 1554 rc = ERROR_ACCESS_DENIED; 1555 break; 1556 1557 case SHFL_PATH_NOT_FOUND: 1558 rc = ERROR_PATH_NOT_FOUND; 1559 break; 1560 1561 default: 1562 case SHFL_FILE_NOT_FOUND: 1563 rc = ERROR_FILE_NOT_FOUND; 1564 break; 1571 1565 } 1572 else if (vrc == VERR_ALREADY_EXISTS) 1573 rc = ERROR_ACCESS_DENIED; 1574 else 1575 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_FILE_NOT_FOUND); 1576 VbglR0PhysHeapFree(pParams); 1577 } 1566 } 1567 else if (vrc == VERR_ALREADY_EXISTS) 1568 rc = ERROR_ACCESS_DENIED; 1578 1569 else 1579 rc = ERROR_NOT_ENOUGH_MEMORY; 1580 vboxSfOs2ReleasePathAndFolder(pStrFolderPath, pFolder); 1570 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_FILE_NOT_FOUND); 1571 1572 VbglR0PhysHeapFree(pReq); 1573 vboxSfOs2ReleaseFolder(pFolder); 1581 1574 } 1582 1575 }
Note:
See TracChangeset
for help on using the changeset viewer.