Ignore:
Timestamp:
Jan 22, 2001, 7:26:52 PM (25 years ago)
Author:
sandervl
Message:

memory map + handle manager fixes

File:
1 edited

Legend:

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

    r4950 r5011  
    1 /* $Id: HandleManager.cpp,v 1.59 2001-01-14 18:18:26 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.60 2001-01-22 18:26:49 sandervl Exp $ */
    22
    33/*
     
    253253                                                       /* free handle found ? */
    254254    if (INVALID_HANDLE_VALUE == TabWin32Handles[ulLoop].hmHandleData.hHMHandle) {
     255        //SvL: Mark handle as taken here. Doing it outside of this function
     256        //     isn't thread safe. (and not very smart)
     257        TabWin32Handles[ulLoop].hmHandleData.hHMHandle      = ulLoop;
    255258        TabWin32Handles[ulLoop].hmHandleData.dwUserData     = 0;
    256259        TabWin32Handles[ulLoop].hmHandleData.dwInternalType = HMTYPE_UNKNOWN;
     
    18911894                  while (pfnPeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
    18921895                  {
    1893                      if (msg.message == WM_QUIT)  return 1;
     1896                     if (msg.message == WM_QUIT) {
     1897                         dprintf(("ERROR: WaitForSingleObject call abandoned because WM_QUIT msg was received!!"));
     1898//                       teb->o.odin.fIgnoreMsgs = FALSE;
     1899                         FreeLibrary(hUser32);
     1900                         return WAIT_ABANDONED;
     1901                     }
    18941902   
    18951903                     /* otherwise dispatch it */
     
    26372645  PHMHANDLEDATA   pHMHandleData;
    26382646  DWORD           rc;                                     /* API return code */
    2639   HANDLE          hOldMemMap = -1;
    26402647
    26412648  pDeviceHandler = HMGlobals.pHMFileMapping;         /* device is predefined */
     
    26472654    return 0;                           /* signal error */
    26482655  }
    2649 
    26502656
    26512657                           /* initialize the complete HMHANDLEDATA structure */
     
    26582664  pHMHandleData->lpHandlerData = NULL;
    26592665
    2660 
    26612666      /* we've got to mark the handle as occupied here, since another device */
    26622667                   /* could be created within the device handler -> deadlock */
     
    26762681                                         dwMaximumSizeHigh,
    26772682                                         dwMaximumSizeLow,
    2678                                          lpName, &hOldMemMap);
    2679 
    2680   if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
    2681   {
    2682       TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    2683       SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2684     if(rc == ERROR_ALREADY_EXISTS) {
    2685     return hOldMemMap; //return handle of existing file mapping
    2686   }
    2687   else  return (NULL);                                           /* signal error */
     2683                                         lpName);
     2684
     2685  if(rc != NO_ERROR)     /* oops, creation failed within the device handler */
     2686  {
     2687      if(rc != ERROR_ALREADY_EXISTS) {
     2688          TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     2689          SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
     2690          return (NULL);                                           /* signal error */
     2691      }
     2692      SetLastError(ERROR_ALREADY_EXISTS);
     2693      return iIndexNew;                                   /* return valid handle */
    26882694  }
    26892695  else
     
    44584464  if (-1 == iIndexNewWrite)                         /* oops, no free handles ! */
    44594465  {
     4466    //free handle
     4467    TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    44604468    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    44614469    return 0;
Note: See TracChangeset for help on using the changeset viewer.