Changeset 63079 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Aug 6, 2016 1:45:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.c
r63078 r63079 46 46 NTSTATUS Status = STATUS_SUCCESS; 47 47 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); 48 UCHAR MajorFunctionCode = IrpSp->MajorFunction;49 ULONG MinorFunctionCode = IrpSp->MinorFunction;50 48 51 49 Log(("VBOXSF: MRxFsdDispatch: major %d, minor %d: %s\n", 52 MajorFunctionCode, MinorFunctionCode, MajorFunctionString(MajorFunctionCode, MinorFunctionCode)));50 IrpSp->MajorFunction, IrpSp->MinorFunction, MajorFunctionString(IrpSp->MajorFunction, IrpSp->MinorFunction))); 53 51 54 52 if (DeviceObject != (PDEVICE_OBJECT)VBoxMRxDeviceObject) … … 1121 1119 } 1122 1120 1123 static HANDLE vbsfOpenConnectionHandle(PUNICODE_STRING ConnectionName )1121 static HANDLE vbsfOpenConnectionHandle(PUNICODE_STRING ConnectionName, NTSTATUS *prcNt) 1124 1122 { 1125 1123 NTSTATUS Status; … … 1159 1157 || Handle == INVALID_HANDLE_VALUE) 1160 1158 { 1161 Log(("VBOXSF: vbsfOpenConnectionHandle: ZwCreateFile failed status 0x%08X or invalid handle!\n", 1162 Status)); 1159 Log(("VBOXSF: vbsfOpenConnectionHandle: ZwCreateFile failed status 0x%08X or invalid handle!\n", Status)); 1160 if (prcNt) 1161 *prcNt = !NT_SUCCESS(Status) ? Status : STATUS_UNSUCCESSFUL; 1163 1162 Handle = INVALID_HANDLE_VALUE; 1164 1163 } … … 1214 1213 FileName.MaximumLength = (USHORT)cbConnectName; 1215 1214 1216 Handle = vbsfOpenConnectionHandle(&FileName );1215 Handle = vbsfOpenConnectionHandle(&FileName, NULL); 1217 1216 1218 1217 if (Handle != INVALID_HANDLE_VALUE) … … 1349 1348 FileName.MaximumLength = (USHORT)cbConnectName; 1350 1349 1351 Handle = vbsfOpenConnectionHandle(&FileName); 1352 1350 Handle = vbsfOpenConnectionHandle(&FileName, &Status); 1353 1351 if (Handle != INVALID_HANDLE_VALUE) 1354 1352 { … … 1380 1378 1381 1379 ZwClose(Handle); 1382 } 1383 1384 if (NT_SUCCESS(Status)) 1385 { 1386 PWCHAR pwc; 1387 ULONG i; 1388 1389 /* Skip the "\Device\VBoxMiniRdr\;X:" of the string "\Device\VBoxMiniRdr\;X:\vboxsrv\sf" */ 1390 pwc = pwcConnectName; 1391 for (i = 0; i < cbConnectName; i += sizeof(WCHAR)) 1380 1381 if (NT_SUCCESS(Status)) 1392 1382 { 1393 if (*pwc == L':') 1383 PWCHAR pwc; 1384 ULONG i; 1385 1386 /* Skip the "\Device\VBoxMiniRdr\;X:" of the string "\Device\VBoxMiniRdr\;X:\vboxsrv\sf" */ 1387 pwc = pwcConnectName; 1388 for (i = 0; i < cbConnectName; i += sizeof(WCHAR)) 1394 1389 { 1395 break; 1390 if (*pwc == L':') 1391 { 1392 break; 1393 } 1394 pwc++; 1396 1395 } 1397 pwc++; 1398 } 1399 1400 if (i >= sizeof(WCHAR) && i < cbConnectName) 1401 { 1402 pwc--; 1403 1404 if (*pwc >= L'A' && *pwc <= L'Z') 1396 1397 if (i >= sizeof(WCHAR) && i < cbConnectName) 1405 1398 { 1406 uint32_t idx = *pwc - L'A'; 1407 1408 if (idx >= RTL_NUMBER_OF(pDeviceExtension->cLocalConnections)) 1409 { 1410 Log(("VBOXSF: vbsfDeleteConnection: Index 0x%x is invalid!\n", 1411 idx)); 1412 Status = STATUS_BAD_NETWORK_NAME; 1413 } 1414 else 1415 { 1416 ExAcquireFastMutex(&pDeviceExtension->mtxLocalCon); 1417 fMutexAcquired = TRUE; 1418 1419 pDeviceExtension->cLocalConnections[idx] = FALSE; 1420 1421 /* Free saved name */ 1422 if (pDeviceExtension->wszLocalConnectionName[idx]) 1399 pwc--; 1400 1401 if (*pwc >= L'A' && *pwc <= L'Z') 1402 { 1403 uint32_t idx = *pwc - L'A'; 1404 1405 if (idx >= RTL_NUMBER_OF(pDeviceExtension->cLocalConnections)) 1423 1406 { 1424 vbsfFreeNonPagedMem(pDeviceExtension->wszLocalConnectionName[idx]); 1425 pDeviceExtension->wszLocalConnectionName[idx] = NULL; 1407 Log(("VBOXSF: vbsfDeleteConnection: Index 0x%x is invalid!\n", 1408 idx)); 1409 Status = STATUS_BAD_NETWORK_NAME; 1426 1410 } 1427 1428 ExReleaseFastMutex(&pDeviceExtension->mtxLocalCon); 1429 fMutexAcquired = FALSE; 1430 1431 Log(("VBOXSF: vbsfDeleteConnection: deleted index 0x%x\n", 1432 idx)); 1411 else 1412 { 1413 ExAcquireFastMutex(&pDeviceExtension->mtxLocalCon); 1414 fMutexAcquired = TRUE; 1415 1416 pDeviceExtension->cLocalConnections[idx] = FALSE; 1417 1418 /* Free saved name */ 1419 if (pDeviceExtension->wszLocalConnectionName[idx]) 1420 { 1421 vbsfFreeNonPagedMem(pDeviceExtension->wszLocalConnectionName[idx]); 1422 pDeviceExtension->wszLocalConnectionName[idx] = NULL; 1423 } 1424 1425 ExReleaseFastMutex(&pDeviceExtension->mtxLocalCon); 1426 fMutexAcquired = FALSE; 1427 1428 Log(("VBOXSF: vbsfDeleteConnection: deleted index 0x%x\n", 1429 idx)); 1430 } 1433 1431 } 1434 1432 } 1435 }1436 else1437 {1438 Log(("VBOXSF: vbsfCreateConnection: bad format\n"));1439 Status = STATUS_BAD_NETWORK_NAME;1433 else 1434 { 1435 Log(("VBOXSF: vbsfCreateConnection: bad format\n")); 1436 Status = STATUS_BAD_NETWORK_NAME; 1437 } 1440 1438 } 1441 1439 }
Note:
See TracChangeset
for help on using the changeset viewer.