Ignore:
Timestamp:
Aug 25, 1999, 10:57:14 AM (26 years ago)
Author:
phaller
Message:

Add: HMDeviceMemMapClass fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/HandleManager.cpp

    r664 r673  
    1 /* $Id: HandleManager.cpp,v 1.13 1999-08-24 18:46:38 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.14 1999-08-25 08:55:17 phaller Exp $ */
    22
    33/*
     
    22792279                                                  /* call the device handler */
    22802280  rc = pDeviceHandler->OpenFileMapping(&TabWin32Handles[iIndexNew].hmHandleData,
    2281                                        fdwAccess,
     2281                                       fdwAccess,
    22822282                                       fInherit,
    22832283                                       lpName);
     
    22902290
    22912291  return iIndexNew;                                   /* return valid handle */
     2292}
     2293
     2294
     2295/*****************************************************************************
     2296 * Name      : HMMapViewOfFile
     2297 * Purpose   : router function for MapViewOfFile
     2298 * Parameters:
     2299 * Variables :
     2300 * Result    :
     2301 * Remark    :
     2302 * Status    :
     2303 *
     2304 * Author    : Patrick Haller [Wed, 1999/06/17 20:44]
     2305 *****************************************************************************/
     2306
     2307LPVOID HMMapViewOfFile(HANDLE hFileMappingObject,
     2308                       DWORD  dwDesiredAccess,
     2309                       DWORD  dwFileOffsetHigh,
     2310                       DWORD  dwFileOffsetLow,
     2311                       DWORD  dwNumberOfBytesToMap)
     2312{
     2313  int       iIndex;                           /* index into the handle table */
     2314  LPVOID    lpResult;                /* result from the device handler's API */
     2315  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     2316
     2317                                                          /* validate handle */
     2318  iIndex = _HMHandleQuery(hFileMappingObject);              /* get the index */
     2319  if (-1 == iIndex)                                               /* error ? */
     2320  {
     2321    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     2322    return (NULL);                                         /* signal failure */
     2323  }
     2324
     2325  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2326  lpResult = pHMHandle->pDeviceHandler->MapViewOfFile(&pHMHandle->hmHandleData,
     2327                                                      dwDesiredAccess,
     2328                                                      dwFileOffsetHigh,
     2329                                                      dwFileOffsetLow,
     2330                                                      dwNumberOfBytesToMap);
     2331
     2332  return (lpResult);                                  /* deliver return code */
    22922333}
    22932334
     
    23352376}
    23362377
     2378
     2379/*****************************************************************************
     2380 * Name      : HMUnmapViewOfFile
     2381 * Purpose   : router function for UnmapViewOfFile
     2382 * Parameters:
     2383 * Variables :
     2384 * Result    :
     2385 * Remark    :
     2386 * Status    :
     2387 *
     2388 * Author    : Patrick Haller [Wed, 1999/06/17 20:44]
     2389 *****************************************************************************/
     2390
     2391BOOL HMUnmapViewOfFile(LPVOID lpBaseAddress)
     2392{
     2393  int       iIndex;                           /* index into the handle table */
     2394  BOOL      bResult;                 /* result from the device handler's API */
     2395  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     2396
     2397                                                          /* validate handle */
     2398  iIndex = HMDeviceMemMapClass::findByBaseAddress(lpBaseAddress);
     2399  if (-1 == iIndex)                                               /* error ? */
     2400  {
     2401    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     2402    return (NULL);                                         /* signal failure */
     2403  }
     2404
     2405  bResult = pHMHandle->pDeviceHandler->UnmapViewOfFile(&pHMHandle->hmHandleData,
     2406                                                       lpBaseAddress);
     2407
     2408  return (bResult);                                   /* deliver return code */
     2409}
     2410
     2411
     2412/*****************************************************************************
     2413 * Name      : HMFlushViewOfFile
     2414 * Purpose   : router function for FlushViewOfFile
     2415 * Parameters:
     2416 * Variables :
     2417 * Result    :
     2418 * Remark    :
     2419 * Status    :
     2420 *
     2421 * Author    : Patrick Haller [Wed, 1999/06/17 20:44]
     2422 *****************************************************************************/
     2423
     2424BOOL HMFlushViewOfFile(LPVOID lpBaseAddress,
     2425                       DWORD  dwNumberOfBytesToFlush)
     2426{
     2427  int       iIndex;                           /* index into the handle table */
     2428  BOOL      bResult;                 /* result from the device handler's API */
     2429  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     2430
     2431                                                          /* validate handle */
     2432  iIndex = HMDeviceMemMapClass::findByBaseAddress(lpBaseAddress);
     2433  if (-1 == iIndex)                                               /* error ? */
     2434  {
     2435    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     2436    return (NULL);                                         /* signal failure */
     2437  }
     2438
     2439  bResult = pHMHandle->pDeviceHandler->FlushViewOfFile(&pHMHandle->hmHandleData,
     2440                                                       lpBaseAddress,
     2441                                                       dwNumberOfBytesToFlush);
     2442
     2443  return (bResult);                                  /* deliver return code */
     2444}
     2445
     2446
     2447
    23372448/*****************************************************************************
    23382449 * Name      : HMWaitForMultipleObjects
Note: See TracChangeset for help on using the changeset viewer.