vbsfhlp.c revision 78a072e1b56619e3230735ae073668311232ec94
/** @file
*
* VirtualBox Windows Guest Shared Folders
*
* File System Driver system helpers
*
* Copyright (C) 2006-2007 Oracle Corporation
*
* Oracle Corporation confidential
* All rights reserved
*/
#include <ntifs.h>
#include <ntdddisk.h>
#include "vbsfhdrs.h"
#include "vbsfhlp.h"
#ifdef DEBUG
static int s_iAllocRefCount = 0;
#endif
{
}
/**
* Convert VBox IRT file attributes to NT file attributes
*
* @returns NT file attributes
* @param fMode IRT file attributes
*
*/
{
uint32_t FileAttributes = 0;
if (fMode & RTFS_DOS_READONLY)
if (fMode & RTFS_DOS_HIDDEN)
if (fMode & RTFS_DOS_SYSTEM)
if (fMode & RTFS_DOS_DIRECTORY)
if (fMode & RTFS_DOS_ARCHIVED)
if (fMode & RTFS_DOS_NT_TEMPORARY)
if (fMode & RTFS_DOS_NT_SPARSE_FILE)
if (fMode & RTFS_DOS_NT_REPARSE_POINT)
if (fMode & RTFS_DOS_NT_COMPRESSED)
// if (fMode & RTFS_DOS_NT_OFFLINE)
if (fMode & RTFS_DOS_NT_ENCRYPTED)
if (fMode & RTFS_DOS_NT_NORMAL)
{
}
return FileAttributes;
}
/**
* Convert VBox IRT file attributes to NT file attributes
*
* @returns NT file attributes
* @param fMode IRT file attributes
*
*/
{
uint32_t FileAttributes = 0;
if (fMode & FILE_ATTRIBUTE_READONLY)
if (fMode & FILE_ATTRIBUTE_HIDDEN)
if (fMode & FILE_ATTRIBUTE_SYSTEM)
if (fMode & FILE_ATTRIBUTE_DIRECTORY)
if (fMode & FILE_ATTRIBUTE_ARCHIVE)
if (fMode & FILE_ATTRIBUTE_TEMPORARY)
if (fMode & FILE_ATTRIBUTE_SPARSE_FILE)
if (fMode & FILE_ATTRIBUTE_COMPRESSED)
if (fMode & FILE_ATTRIBUTE_ENCRYPTED)
if (fMode & FILE_ATTRIBUTE_NORMAL)
{
}
return FileAttributes;
}
{
/* Replace '_' with actual drive letter */
}
{
/* Replace '_' with actual drive letter */
return IoDeleteSymbolicLink (&driveName);
}
/**
* Convert VBox error code to NT status code
*
* @returns NT status code
* @param vboxRC VBox error code
*
*/
{
switch (vboxRC)
{
case VINF_SUCCESS:
break;
case VERR_ACCESS_DENIED:
break;
case VERR_NO_MORE_FILES:
break;
case VERR_PATH_NOT_FOUND:
break;
case VERR_FILE_NOT_FOUND:
break;
case VERR_DIR_NOT_EMPTY:
break;
case VERR_SHARING_VIOLATION:
break;
case VERR_FILE_LOCK_VIOLATION:
break;
case VERR_FILE_LOCK_FAILED:
break;
case VINF_BUFFER_OVERFLOW:
break;
case VERR_EOF:
case VINF_EOF:
break;
case VERR_READ_ERROR:
case VERR_WRITE_ERROR:
case VERR_FILE_IO_ERROR:
break;
case VERR_WRITE_PROTECT:
break;
case VERR_ALREADY_EXISTS:
break;
case VERR_NOT_A_DIRECTORY:
break;
case VERR_SEEK:
break;
case VERR_INVALID_PARAMETER:
break;
case VERR_NOT_SUPPORTED:
break;
default:
/* @todo error handling */
break;
}
return Status;
}
{
#ifdef DEBUG
#endif
/* Tag is reversed (a.k.a "SHFL") to display correctly in debuggers, so search for "SHFL" */
{
#ifdef DEBUG
#endif
}
else
{
#ifdef DEBUG
#endif
}
return pMemory;
}
{
#ifdef DEBUG
#endif
/* MSDN: The ExFreePoolWithTag routine issues a bug check if the specified value for Tag does not match the tag value passed
to the routine that originally allocated the memory block. Otherwise, the behavior of this routine is identical to ExFreePool. */
}
{
if (winVersion != UNKNOWN_WINVERSION)
return winVersion;
Log(("VBoxVideo::vboxQueryWinVersion: running on Windows NT version %d.%d, build %d\n", majorVersion, minorVersion, buildNumber));
if (majorVersion >= 5)
{
if (minorVersion >= 1)
{
winVersion = WINXP;
}
else
{
winVersion = WIN2K;
}
}
else if (majorVersion == 4)
{
winVersion = WINNT4;
}
else
{
Log(("VBoxVideo::vboxQueryWinVersion: NT4 required!\n"));
}
return winVersion;
}
#if 0 //def DEBUG
/**
* Callback for RTLogFormatV which writes to the backdoor.
* See PFNLOGOUTPUT() for details.
*/
{
return cbChars;
}
int RTLogBackdoorPrintf1(const char *pszFormat, ...)
{
return 0;
}
#endif