VirtualBox

Changeset 44732 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Feb 18, 2013 1:20:55 PM (12 years ago)
Author:
vboxsync
Message:

WINNT/VBoxTray: Fixed code error in rev 83832 .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp

    r44729 r44732  
    13621362    ULONG dwStatus;
    13631363
    1364     pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements);
    1365     pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements);
    1366     if (!pPathInfoArray || !pModeInfoArray ) {
    1367         return ERROR_OUTOFMEMORY;
    1368     }
    13691364    dwStatus = gCtx.pfnGetDisplayConfigBufferSizes(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements,&NumModeInfoArrayElements);
    13701365    if (dwStatus != ERROR_SUCCESS)
    13711366    {
    13721367        LogFlow(("VBoxTray: (WDDM) Failed GetDisplayConfigBufferSizes \n"));
    1373         if (pPathInfoArray)
    1374             free(pPathInfoArray);
    1375         if (pModeInfoArray)
    1376             free(pModeInfoArray);
    13771368        return dwStatus;
    13781369    }
    1379     dwStatus = gCtx.pfnQueryDisplayConfig(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, &pPathInfoArray[0],&NumModeInfoArrayElements, &pModeInfoArray[0],NULL);
     1370    pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements * sizeof(DISPLAYCONFIG_PATH_INFO));
     1371    pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements * sizeof(DISPLAYCONFIG_MODE_INFO));
     1372    if (!pPathInfoArray || !pModeInfoArray )
     1373    {
     1374        return ERROR_OUTOFMEMORY;
     1375    }
     1376    dwStatus = gCtx.pfnQueryDisplayConfig(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, pPathInfoArray,&NumModeInfoArrayElements, pModeInfoArray,NULL);
    13801377    if (dwStatus != ERROR_SUCCESS)
    13811378    {
     
    14061403        }
    14071404    }
    1408     dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, &pPathInfoArray[0],NumModeInfoArrayElements, &pModeInfoArray[0],(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
     1405    dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, pPathInfoArray, NumModeInfoArrayElements, pModeInfoArray, (SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
    14091406    if (dwStatus != ERROR_SUCCESS)
    14101407    {
     
    14161413        return dwStatus;
    14171414    }
     1415    if (pPathInfoArray)
     1416        free(pPathInfoArray);
     1417    if (pModeInfoArray)
     1418        free(pModeInfoArray);
    14181419    return ERROR_SUCCESS;
    14191420}
     
    14271428    ULONG dwStatus;
    14281429
    1429     pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements);
    1430     pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements);
    1431     if (!pPathInfoArray || !pModeInfoArray ) {
    1432         return ERROR_OUTOFMEMORY;
    1433     }
    14341430    dwStatus = gCtx.pfnGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements,&NumModeInfoArrayElements);
    14351431    if (dwStatus != ERROR_SUCCESS)
    14361432    {
    14371433        LogFlow(("VBoxTray: (WDDM) Failed GetDisplayConfigBufferSizes \n"));
    1438         if (pPathInfoArray)
    1439             free(pPathInfoArray);
    1440         if (pModeInfoArray)
    1441             free(pModeInfoArray);
    14421434        return dwStatus;
    14431435    }
    1444     dwStatus = gCtx.pfnQueryDisplayConfig( QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, &pPathInfoArray[0],&NumModeInfoArrayElements, &pModeInfoArray[0],NULL);
     1436    pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements * sizeof(DISPLAYCONFIG_PATH_INFO));
     1437    pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements * sizeof(DISPLAYCONFIG_MODE_INFO));
     1438    if (!pPathInfoArray || !pModeInfoArray )
     1439    {
     1440        return ERROR_OUTOFMEMORY;
     1441    }
     1442    dwStatus = gCtx.pfnQueryDisplayConfig( QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, pPathInfoArray,&NumModeInfoArrayElements, pModeInfoArray,NULL);
    14451443    if (dwStatus != ERROR_SUCCESS)
    14461444    {
     
    14661464        }
    14671465    }
    1468     dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, &pPathInfoArray[0],NumModeInfoArrayElements, &pModeInfoArray[0],(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
     1466    dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, pPathInfoArray, NumModeInfoArrayElements, pModeInfoArray,(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
    14691467    if (dwStatus != ERROR_SUCCESS) {
    14701468        if (pPathInfoArray)
Note: See TracChangeset for help on using the changeset viewer.

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