VirtualBox

Changeset 49150 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Oct 17, 2013 7:22:02 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90010
Message:

SUPR3: Use NtDeviceIoControlFile instead of DeviceIoControl to avoid wasting precious ticks on silly API conversions.

Location:
trunk/include/iprt/nt
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/nt/nt.h

    r49147 r49150  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Internal Header for the Native NT code.
     3 * IPRT - Header for code using the Native NT API.
    44 */
    55
    66/*
    7  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525 */
    2626
     27#ifndef ___iprt_nt_nt_h___
     28#define ___iprt_nt_nt_h___
    2729
    28 #ifndef ___internal_r3_nt_h___
    29 #define ___internal_r3_nt_h___
    30 
    31 
    32 /*******************************************************************************
    33 *   Header Files                                                               *
    34 *******************************************************************************/
    3530#include <ntstatus.h>
    3631#ifdef IPRT_NT_USE_WINTERNL
     
    3934# include <winnt.h>
    4035# include <winternl.h>
     36# undef WIN32_NO_STATUS
     37# include <ntstatus.h>
    4138# define IPRT_NT_NEED_API_GROUP_1
    4239
     
    4845# include <ntifs.h>
    4946#endif
    50 #include "internal/iprt.h"
     47#include <iprt/types.h>
    5148
    5249
    53 /*******************************************************************************
    54 *   Defined Constants And Macros                                               *
    55 *******************************************************************************/
     50/** @name Useful macros
     51 * @{ */
    5652/** Indicates that we're targetting native NT in the current source. */
    57 #define RT_USE_NATIVE_NT                1
     53#define RTNT_USE_NATIVE_NT              1
    5854/** Initializes a IO_STATUS_BLOCK. */
    59 #define MY_IO_STATUS_BLOCK_INITIALIZER  { STATUS_FAILED_DRIVER_ENTRY, ~(uintptr_t)42 }
     55#define RTNT_IO_STATUS_BLOCK_INITIALIZER  { STATUS_FAILED_DRIVER_ENTRY, ~(uintptr_t)42 }
    6056/** Similar to INVALID_HANDLE_VALUE in the Windows environment. */
    61 #define MY_INVALID_HANDLE_VALUE         ( (HANDLE)~(uintptr_t)0 )
    62 
    63 #ifdef DEBUG_bird
    64 /** Enables the "\\!\" NT path pass thru as well as hacks for listing NT object
    65  * directories. */
    66 # define IPRT_WITH_NT_PATH_PASSTHRU 1
    67 #endif
     57#define RTNT_INVALID_HANDLE_VALUE         ( (HANDLE)~(uintptr_t)0 )
     58/** @}  */
    6859
    6960
    70 /*******************************************************************************
    71 *   Internal Functions                                                         *
    72 *******************************************************************************/
    73 int  rtNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,
    74                   ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs,
    75                   PHANDLE phHandle, PULONG_PTR puDisposition);
    76 int  rtNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,
     61/** @name IPRT helper functions for NT
     62 * @{ */
     63RT_C_DECLS_BEGIN
     64
     65RTDECL(int) RTNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,
     66                          ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs,
     67                          PHANDLE phHandle, PULONG_PTR puDisposition);
     68RTDECL(int) RTNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,
    7769                     ULONG fObjAttribs, PHANDLE phHandle, bool *pfObjDir);
    78 int  rtNtPathClose(HANDLE hHandle);
     70RTDECL(int) RTNtPathClose(HANDLE hHandle);
     71
     72RT_C_DECLS_END
     73/** @} */
    7974
    8075
    81 /**
    82  * Internal helper for comparing a WCHAR string with a char string.
    83  *
    84  * @returns @c true if equal, @c false if not.
    85  * @param   pwsz1               The first string.
    86  * @param   cb1                 The length of the first string, in bytes.
    87  * @param   psz2                The second string.
    88  * @param   cch2                The length of the second string.
    89  */
    90 DECLINLINE(bool) rtNtCompWideStrAndAscii(WCHAR const *pwsz1, size_t cch1, const char *psz2, size_t cch2)
    91 {
    92     if (cch1 != cch2 * 2)
    93         return false;
    94     while (cch2-- > 0)
    95     {
    96         unsigned ch1 = *pwsz1++;
    97         unsigned ch2 = (unsigned char)*psz2++;
    98         if (ch1 != ch2)
    99             return false;
    100     }
    101     return true;
    102 }
    103 
    104 
    105 /*******************************************************************************
    106 *   NT APIs                                                                    *
    107 *******************************************************************************/
    108 
     76/** @name NT API delcarations.
     77 * @{ */
    10978RT_C_DECLS_BEGIN
    11079
     
    11988} FILE_FS_ATTRIBUTE_INFORMATION;
    12089typedef FILE_FS_ATTRIBUTE_INFORMATION *PFILE_FS_ATTRIBUTE_INFORMATION;
     90
     91typedef enum
     92{
     93    FileFsVolumeInformation = 1,
     94    FileFsLabelInformation,
     95    FileFsSizeInformation,
     96    FileFsDeviceInformation,
     97    FileFsAttributeInformation,
     98    FileFsControlInformation,
     99    FileFsFullSizeInformation,
     100    FileFsObjectIdInformation,
     101    FileFsMaximumInformation
     102} FS_INFORMATION_CLASS;
     103typedef FS_INFORMATION_CLASS *PFS_INFORMATION_CLASS;
    121104extern "C" NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FS_INFORMATION_CLASS);
    122105
     
    134117NTSTATUS NTAPI NtQueryDirectoryObject(HANDLE, PVOID, ULONG, BOOLEAN, BOOLEAN, PULONG, PULONG);
    135118
    136 
    137119RT_C_DECLS_END
     120/** @} */
    138121
    139122#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette