[ros-diffs] [janderwald] 37081: - Fix a potential buffer overflow in SH_ShowDriveProperties (CID 589) - Fix a possible null dereference (CID 495) - Fix initializing Recycle Bin Property dialog - Add LVS_EX_FULLROWSELECT style

janderwald at svn.reactos.org janderwald at svn.reactos.org
Thu Oct 30 08:59:55 CET 2008


Author: janderwald
Date: Thu Oct 30 02:59:55 2008
New Revision: 37081

URL: http://svn.reactos.org/svn/reactos?rev=37081&view=rev
Log:
- Fix a potential buffer overflow in SH_ShowDriveProperties (CID 589)
- Fix a possible null dereference (CID 495)
- Fix initializing Recycle Bin Property dialog
- Add LVS_EX_FULLROWSELECT style

Modified:
    trunk/reactos/dll/win32/shell32/drive.c
    trunk/reactos/dll/win32/shell32/enumidlist.c
    trunk/reactos/dll/win32/shell32/shfldr_recyclebin.c

Modified: trunk/reactos/dll/win32/shell32/drive.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/drive.c?rev=37081&r1=37080&r2=37081&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/drive.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/drive.c [iso-8859-1] Thu Oct 30 02:59:55 2008
@@ -678,7 +678,7 @@
    PROPSHEETHEADERW psh;
    BOOL ret;
    UINT i;
-   WCHAR szName[MAX_PATH];
+   WCHAR szName[MAX_PATH+6];
    DWORD dwMaxComponent, dwFileSysFlags;
    IDataObject * pDataObj = NULL;
 
@@ -700,8 +700,8 @@
           /* FIXME
            * check if disk is a really a local hdd 
            */
-          i = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, szName, sizeof(szName)/sizeof(WCHAR));
-          if (i > 0 && i < (sizeof(szName)/sizeof(WCHAR)) + 6)
+          i = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, szName, sizeof(szName)/sizeof(WCHAR)-6);
+          if (i > 0 && i < (sizeof(szName)/sizeof(WCHAR)) - 6)
           {
               szName[i] = L' ';
               szName[i+1] = L'(';
@@ -929,6 +929,8 @@
     HWND hDlgCtrl;
 
     Length = GetWindowTextW(hwndDlg, szText, sizeof(szText)/sizeof(WCHAR));
+    if (Length < 0)
+        Length = 0;
     szDrive[0] = pContext->Drive + L'A';
     if (GetVolumeInformationW(szDrive, &szText[Length+1], (sizeof(szText)/sizeof(WCHAR))- Length - 2, &dwSerial, &dwMaxComp, &dwFileSys, szFs, sizeof(szFs)/sizeof(WCHAR)))
     {

Modified: trunk/reactos/dll/win32/shell32/enumidlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/enumidlist.c?rev=37081&r1=37080&r2=37081&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/enumidlist.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/enumidlist.c [iso-8859-1] Thu Oct 30 02:59:55 2008
@@ -97,8 +97,8 @@
 
     while(pCur)
     {
-        REFIID curid = _ILGetGUIDPointer(pCur->pidl);
-        if (IsEqualIID(curid, refid))
+        LPGUID curid = _ILGetGUIDPointer(pCur->pidl);
+        if (curid && IsEqualGUID(curid, refid))
         {
             return TRUE;
         }

Modified: trunk/reactos/dll/win32/shell32/shfldr_recyclebin.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr_recyclebin.c?rev=37081&r1=37080&r2=37081&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/shfldr_recyclebin.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shfldr_recyclebin.c [iso-8859-1] Thu Oct 30 02:59:55 2008
@@ -1218,7 +1218,7 @@
             li.iSubItem = 0;
             li.pszText = szVolume;
             li.iItem = itemCount;
-            (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMN, 0, (LPARAM)&li);
+            (void)SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
             if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailable , &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
             {
                 if (StrFormatByteSizeW(TotalNumberOfFreeBytes.QuadPart, szVolume, sizeof(szVolume) / sizeof(WCHAR)))
@@ -1383,11 +1383,17 @@
     PDRIVE_ITEM_CONTEXT pItem;
     BOOL bSuccess;
     UINT uResult;
+    PROPSHEETPAGE * page;
+    DWORD dwStyle;
 
     switch(uMsg)
     {
-    case WM_INITDIALOG:
-        InitializeBitBucketDlg(hwndDlg, (WCHAR)lParam);
+    case WM_INITDIALOG:	
+        page = (PROPSHEETPAGE*)lParam;
+        InitializeBitBucketDlg(hwndDlg, (WCHAR)page->lParam);
+        dwStyle = (DWORD) SendDlgItemMessage(hwndDlg, 14000, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
+        dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
+        SendDlgItemMessage(hwndDlg, 14000, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
         if (GetDlgCtrlID((HWND)wParam) != 14000)
         {
             SetFocus(GetDlgItem(hwndDlg, 14000));



More information about the Ros-diffs mailing list