VirtualBox

Ignore:
Timestamp:
Aug 27, 2008 10:21:47 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
35466
Message:

#3076: Merged in the branch with the alternate driver authentication method. (34468:HEAD)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp

    r10720 r11725  
    11/* $Id$ */
    22/** @file
    3  * SUPLib - Support Library, OS/2 backend.
     3 * VirtualBox Support Library - OS/2 specific parts.
    44 */
    55
     
    2929 */
    3030
    31 
    3231/*******************************************************************************
    3332*   Header Files                                                               *
     
    3736#include <os2.h>
    3837#undef RT_MAX
     38
     39#ifdef IN_SUP_HARDENED_R3
     40# undef DEBUG /* Warning: disables RT_STRICT */
     41# define LOG_DISABLED
     42  /** @todo RTLOGREL_DISABLED */
     43# include <iprt/log.h>
     44# undef LogRelIt
     45# define LogRelIt(pvInst, fFlags, iGroup, fmtargs) do { } while (0)
     46#endif
    3947
    4048#include <VBox/types.h>
     
    6270
    6371
    64 /*******************************************************************************
    65 *   Global Variables                                                           *
    66 *******************************************************************************/
    67 /** Handle to the open device. */
    68 static HFILE    g_hDevice = (HFILE)-1;
    69 
    70 
    71 /*******************************************************************************
    72 *   Internal Functions                                                         *
    73 *******************************************************************************/
    74 
    75 
    76 /**
    77  * Initialize the OS specific part of the library.
    78  * On Linux this involves:
    79  *      - loading the module.
    80  *      - open driver.
    81  *
    82  * @returns 0 on success.
    83  * @returns current -1 on failure but this must be changed to proper error codes.
    84  * @param   cbReserve   Ignored on OS/2.
    85  */
    86 int     suplibOsInit(size_t cbReserve)
     72int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited)
    8773{
    8874    /*
    89      * Check if already initialized.
     75     * Nothing to do if pre-inited.
    9076     */
    91     if (g_hDevice != (HFILE)-1)
    92         return 0;
     77    if (fPreInited)
     78        return VINF_SUCCESS;
    9379
    9480    /*
     
    117103        return vrc;
    118104    }
    119     g_hDevice = hDevice;
    120105
    121     NOREF(cbReserve);
     106    pThis->hDevice = (RTFILE)hDevice;
    122107    return VINF_SUCCESS;
    123108}
    124109
    125110
    126 int     suplibOsTerm(void)
     111#ifndef IN_SUP_HARDENED_R3
     112
     113int suplibOsTerm(PSUPLIBDATA pThis)
    127114{
    128115    /*
    129116     * Check if we're initited at all.
    130117     */
    131     if (g_hDevice != (HFILE)-1)
     118    if (pThis->hDevice != NIL_RTFILE)
    132119    {
    133         APIRET rc = DosClose(g_hDevice);
     120        APIRET rc = DosClose((HFILE)pThis->hDevice);
    134121        AssertMsg(rc == NO_ERROR, ("%d\n", rc)); NOREF(rc);
    135         g_hDevice = (HFILE)-1;
     122        pThis->hDevice = NIL_RTFILE;
    136123    }
    137124
     
    154141
    155142
    156 int suplibOsIOCtl(uintptr_t uFunction, void *pvReq, size_t cbReq)
     143int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq)
    157144{
    158     AssertMsg(g_hDevice != (HFILE)-1, ("SUPLIB not initiated successfully!\n"));
    159 
    160145    ULONG cbReturned = sizeof(SUPREQHDR);
    161     int rc = DosDevIOCtl(g_hDevice, SUP_CTL_CATEGORY, uFunction,
     146    int rc = DosDevIOCtl((HFILE)pThis->hDevice, SUP_CTL_CATEGORY, uFunction,
    162147                         pvReq, cbReturned, &cbReturned,
    163148                         NULL, 0, NULL);
     
    168153
    169154
    170 int suplibOsIOCtlFast(uintptr_t uFunction)
     155int suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction)
    171156{
    172157    int32_t rcRet = VERR_INTERNAL_ERROR;
    173     int rc = DosDevIOCtl(g_hDevice, SUP_CTL_CATEGORY_FAST, uFunction,
     158    int rc = DosDevIOCtl((HFILE)pThis->hDevice, SUP_CTL_CATEGORY_FAST, uFunction,
    174159                         NULL, 0, NULL,
    175160                         NULL, 0, NULL);
     
    182167
    183168
    184 int suplibOsPageAlloc(size_t cPages, void **ppvPages)
     169int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages)
    185170{
     171    NOREF(pThis);
    186172    *ppvPages = NULL;
    187173    int rc = DosAllocMem(ppvPages, cPages << PAGE_SHIFT, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT | OBJ_ANY);
     
    196182
    197183
    198 int suplibOsPageFree(void *pvPages, size_t /* cPages */)
     184int suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t /* cPages */)
    199185{
     186    NOREF(pThis);
    200187    if (pvPages)
    201188    {
     
    206193}
    207194
     195#endif /* !IN_SUP_HARDENED_R3 */
     196
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