Ignore:
Timestamp:
Aug 14, 2009, 5:18:10 PM (16 years ago)
Author:
vladest
Message:
  1. Attempt to add support for DosAllocMem at specific address
  2. Fixed crashes in Handle manager when its tries to access non initialized pointer
File:
1 edited

Legend:

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

    r21332 r21339  
    8585// this is the size of our currently static handle table
    8686#define MAX_OS2_HMHANDLES       (4*1024)
    87 
     87#define ERROR_SYS_INTERNAL      328
    8888
    8989/*****************************************************************************
     
    589589  if (HMGlobals.fIsInitialized != TRUE)
    590590  {
    591  
    592 #ifdef RAS 
    593     RasRegisterObjectTracking(&rthHandles, "KERNEL32 handles", 
    594                               0, RAS_TRACK_FLAG_LOGOBJECTCONTENT, 
     591
     592#ifdef RAS
     593    RasRegisterObjectTracking(&rthHandles, "KERNEL32 handles",
     594                              0, RAS_TRACK_FLAG_LOGOBJECTCONTENT,
    595595                              LogObjectContent_Handle, NULL);
    596596#endif
     
    15041504
    15051505  /*
    1506    * Based on testcase (5) and MSDN: 
     1506   * Based on testcase (5) and MSDN:
    15071507   *      "OF_PARSE   Fills the OFSTRUCT structure but carries out no other action."
    15081508   */
     
    17781778
    17791779  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1780
     1781  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     1782      return ERROR_SYS_INTERNAL;
     1783
    17801784  fResult = pHMHandle->pDeviceHandler->ReadFile(&pHMHandle->hmHandleData,
    17811785                                                lpBuffer,
     
    18291833
    18301834  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1835
     1836  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     1837      return ERROR_SYS_INTERNAL;
     1838
    18311839  fResult = pHMHandle->pDeviceHandler->WriteFile(&pHMHandle->hmHandleData,
    18321840                                                 lpBuffer,
     
    18661874
    18671875  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1876
     1877  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     1878      return ERROR_SYS_INTERNAL;
     1879
    18681880  dwResult = pHMHandle->pDeviceHandler->GetFileType(&pHMHandle->hmHandleData);
    18691881
     
    19061918
    19071919  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1920
     1921  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     1922      return ERROR_SYS_INTERNAL;
     1923
    19081924  dwResult = pHMHandle->pDeviceHandler->_DeviceRequest(&pHMHandle->hmHandleData,
    19091925                                                       ulRequestCode,
     
    19121928                                                       arg3,
    19131929                                                       arg4);
    1914 
    19151930  return (dwResult);                                  /* deliver return code */
    19161931}
     
    19451960
    19461961  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1962
     1963  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     1964      return ERROR_SYS_INTERNAL;
     1965
    19471966  dwResult = pHMHandle->pDeviceHandler->GetFileInformationByHandle(&pHMHandle->hmHandleData,
    19481967                                                       pHFI);
     
    19791998
    19801999  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2000
     2001  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2002      return ERROR_SYS_INTERNAL;
     2003
    19812004  bResult = pHMHandle->pDeviceHandler->SetEndOfFile(&pHMHandle->hmHandleData);
    19822005
     
    20152038
    20162039  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2040
     2041  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2042      return ERROR_SYS_INTERNAL;
     2043
    20172044  bResult = pHMHandle->pDeviceHandler->SetFileTime(&pHMHandle->hmHandleData,
    20182045                                                   (LPFILETIME)pFT1,
     
    20512078
    20522079  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2080
     2081  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2082      return ERROR_SYS_INTERNAL;
     2083
    20532084  bResult = pHMHandle->pDeviceHandler->GetFileTime(&pHMHandle->hmHandleData,
    20542085                                                   (LPFILETIME)pFT1,
     
    20872118
    20882119  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2120
     2121  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2122      return ERROR_SYS_INTERNAL;
     2123
    20892124  dwResult = pHMHandle->pDeviceHandler->GetFileSize(&pHMHandle->hmHandleData,
    20902125                                                    pSize);
     
    21332168
    21342169  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2170
     2171  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2172      return ERROR_SYS_INTERNAL;
     2173
    21352174  dwResult = pHMHandle->pDeviceHandler->SetFilePointer(&pHMHandle->hmHandleData,
    21362175                                                       lDistanceToMove,
     
    21952234
    21962235  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2236
     2237  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2238      return ERROR_SYS_INTERNAL;
     2239
    21972240  dwResult = pHMHandle->pDeviceHandler->LockFile(&pHMHandle->hmHandleData,
    21982241                                                 arg2,
     
    22422285
    22432286  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2287
     2288  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2289      return ERROR_SYS_INTERNAL;
     2290
    22442291  dwResult = pHMHandle->pDeviceHandler->LockFileEx(&pHMHandle->hmHandleData,
    22452292                                                   dwFlags,
     
    22852332
    22862333  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2334
     2335  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2336      return ERROR_SYS_INTERNAL;
     2337
    22872338  dwResult = pHMHandle->pDeviceHandler->UnlockFile(&pHMHandle->hmHandleData,
    22882339                                                   arg2,
     
    23302381
    23312382  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2383
     2384  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2385      return ERROR_SYS_INTERNAL;
     2386
    23322387  dwResult = pHMHandle->pDeviceHandler->UnlockFileEx(&pHMHandle->hmHandleData,
    23332388                                                     dwReserved,
     
    24302485  }
    24312486  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2487
     2488  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2489      return ERROR_SYS_INTERNAL;
     2490
    24322491  dwResult = pHMHandle->pDeviceHandler->WaitForSingleObject(&pHMHandle->hmHandleData,
    24332492                                                            dwTimeout);
     
    24662525
    24672526  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2527
     2528  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2529      return ERROR_SYS_INTERNAL;
     2530
    24682531  dwResult = pHMHandle->pDeviceHandler->WaitForSingleObjectEx(&pHMHandle->hmHandleData,
    24692532                                                              dwTimeout,
     
    25012564
    25022565  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2566
     2567  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2568      return ERROR_SYS_INTERNAL;
     2569
    25032570  dwResult = pHMHandle->pDeviceHandler->FlushFileBuffers(&pHMHandle->hmHandleData);
    25042571
     
    25372604
    25382605  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2606
     2607  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2608      return ERROR_SYS_INTERNAL;
     2609
    25392610  dwResult = pHMHandle->pDeviceHandler->GetOverlappedResult(&pHMHandle->hmHandleData,
    25402611                                                            lpOverlapped,
     
    25732644
    25742645  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2646
     2647  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2648      return ERROR_SYS_INTERNAL;
     2649
    25752650  dwResult = pHMHandle->pDeviceHandler->ReleaseMutex(&pHMHandle->hmHandleData);
    25762651
     
    29202995
    29212996  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     2997
     2998  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     2999      return ERROR_SYS_INTERNAL;
     3000
    29223001  dwResult = pHMHandle->pDeviceHandler->ReleaseSemaphore(&pHMHandle->hmHandleData,
    29233002                                                         cReleaseCount,
     
    31083187
    31093188  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3189
     3190  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     3191      return NULL;
     3192
    31103193  lpResult = pHMHandle->pDeviceHandler->MapViewOfFileEx(&pHMHandle->hmHandleData,
    31113194                                                      dwDesiredAccess,
     
    33203403
    33213404  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3405
     3406  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     3407      return ERROR_SYS_INTERNAL;
     3408
    33223409  fResult = pHMHandle->pDeviceHandler->DeviceIoControl(&pHMHandle->hmHandleData,
    33233410                                                dwIoControlCode,
     
    33713458
    33723459  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3460
     3461  if (!pHMHandle || !pHMHandle->pDeviceHandler)
     3462      return ERROR_SYS_INTERNAL;
     3463
    33733464  fResult = pHMHandle->pDeviceHandler->CancelIo(&pHMHandle->hmHandleData);
    33743465
Note: See TracChangeset for help on using the changeset viewer.