[ros-diffs] [apriyadarshi] 71987: Completed SCSIOP_READ_CAPACITY, SCSIOP_REPORT_LUNS, SCSIOP_READ Updated INQUIRY Fields Code Fixes Stable, Tested, AHCI-Detection and Read working

2016-07-23 Thread apriyadarshi
Author: apriyadarshi
Date: Sat Jul 23 22:53:15 2016
New Revision: 71987

URL: http://svn.reactos.org/svn/reactos?rev=71987&view=rev
Log:
Completed SCSIOP_READ_CAPACITY, SCSIOP_REPORT_LUNS, SCSIOP_READ
Updated INQUIRY Fields
Code Fixes
Stable, Tested, AHCI-Detection and Read working

Modified:
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h

Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c?rev=71987&r1=71986&r2=71987&view=diff
==
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] 
(original)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] 
Sat Jul 23 22:53:15 2016
@@ -29,7 +29,7 @@
 PAHCI_ADAPTER_EXTENSION adapterExtension;
 STOR_PHYSICAL_ADDRESS commandListPhysical, receivedFISPhysical;
 
-DebugPrint("AhciPortInitialize()\n");
+AhciDebugPrint("AhciPortInitialize()\n");
 
 adapterExtension = PortExtension->AdapterExtension;
 abar = adapterExtension->ABAR_Address;
@@ -47,7 +47,7 @@
 
 if ((mappedLength == 0) || ((commandListPhysical.LowPart % 1024) != 0))
 {
-DebugPrint("\tcommandListPhysical mappedLength:%d\n", mappedLength);
+AhciDebugPrint("\tcommandListPhysical mappedLength:%d\n", 
mappedLength);
 return FALSE;
 }
 
@@ -58,7 +58,7 @@
 
 if ((mappedLength == 0) || ((receivedFISPhysical.LowPart % 256) != 0))
 {
-DebugPrint("\treceivedFISPhysical mappedLength:%d\n", mappedLength);
+AhciDebugPrint("\treceivedFISPhysical mappedLength:%d\n", 
mappedLength);
 return FALSE;
 }
 
@@ -76,7 +76,7 @@
 cmd.Status = StorPortReadRegisterUlong(adapterExtension, 
&PortExtension->Port->CMD);
 if ((cmd.FR != 0) || (cmd.CR != 0) || (cmd.FRE != 0) || (cmd.ST != 0))
 {
-DebugPrint("\tPort is not idle: %x\n", cmd);
+AhciDebugPrint("\tPort is not idle: %x\n", cmd);
 }
 
 // 10.1.2 For each implemented port, system software shall allocate memory 
for and program:
@@ -134,7 +134,7 @@
 ULONG portCount, portImplemented, nonCachedExtensionSize;
 PAHCI_PORT_EXTENSION PortExtension;
 
-DebugPrint("AhciAllocateResourceForAdapter()\n");
+AhciDebugPrint("AhciAllocateResourceForAdapter()\n");
 
 NCS = AHCI_Global_Port_CAP_NCS(AdapterExtension->CAP);
 AlignedNCS = ROUND_UP(NCS, 8);
@@ -149,7 +149,7 @@
 break;
 
 portCount = index + 1;
-DebugPrint("\tPort Count: %d\n", portCount);
+AhciDebugPrint("\tPort Count: %d\n", portCount);
 
 AdapterExtension->PortCount = portCount;
 nonCachedExtensionSize =sizeof(AHCI_COMMAND_HEADER) * AlignedNCS + 
//should be 1K aligned
@@ -165,7 +165,7 @@
 
 if (AdapterExtension->NonCachedExtension == NULL)
 {
-DebugPrint("\tadapterExtension->NonCachedExtension == NULL\n");
+AhciDebugPrint("\tadapterExtension->NonCachedExtension == NULL\n");
 return FALSE;
 }
 
@@ -219,7 +219,7 @@
 AHCI_SERIAL_ATA_CONTROL sctl;
 PAHCI_ADAPTER_EXTENSION AdapterExtension;
 
-DebugPrint("AhciStartPort()\n");
+AhciDebugPrint("AhciStartPort()\n");
 
 AdapterExtension = PortExtension->AdapterExtension;
 cmd.Status = StorPortReadRegisterUlong(AdapterExtension, 
&PortExtension->Port->CMD);
@@ -236,7 +236,7 @@
 if (((cmd.FR == 1) && (cmd.FRE == 0)) ||
 ((cmd.CR == 1) && (cmd.ST == 0)))
 {
-DebugPrint("\tCOMRESET\n");
+AhciDebugPrint("\tCOMRESET\n");
 // perform COMRESET
 // section 10.4.2
 
@@ -313,7 +313,7 @@
 
 if ((tfd.STS.BSY) || (tfd.STS.DRQ))
 {
-DebugPrint("\tUnhandled Case BSY-DRQ\n");
+AhciDebugPrint("\tUnhandled Case BSY-DRQ\n");
 }
 
 // clear pending interrupts
@@ -375,7 +375,7 @@
 
 if (cmd.ST != 1)
 {
-DebugPrint("\tFailed to start Port\n");
+AhciDebugPrint("\tFailed to start Port\n");
 return FALSE;
 }
 
@@ -383,7 +383,7 @@
 }
 default:
 // unhandled case
-DebugPrint("\tDET == %x Unsupported\n", ssts.DET);
+AhciDebugPrint("\tDET == %x Unsupported\n", ssts.DET);
 return FALSE;
 }
 
@@ -409,16 +409,14 @@
   )
 {
 PSCSI_REQUEST_BLOCK Srb;
-STOR_LOCK_HANDLE lockhandle;
 PAHCI_SRB_EXTENSION SrbExtension;
+STOR_LOCK_HANDLE lockhandle = {0};
 PAHCI_COMPLETION_ROUTINE CompletionRoutine;
 
 UNREFERENCED_PARAMETER(Dpc);
 UNREFERENCED_PARAMETER(SystemArgument2);
 
-DebugPrint("AhciCommandCompletionDpcRoutine()\n");
-
-AhciZeroMemory(&lockhandle, sizeof(lockhandle));
+AhciDebugPrint("AhciCommandCo

[ros-diffs] [akhaldi] 71986: [GDI32] Sync EMFDRV_PolyPolylinegon() with Wine Staging 1.9.14. CORE-11521

2016-07-23 Thread akhaldi
Author: akhaldi
Date: Sat Jul 23 21:33:40 2016
New Revision: 71986

URL: http://svn.reactos.org/svn/reactos?rev=71986&view=rev
Log:
[GDI32] Sync EMFDRV_PolyPolylinegon() with Wine Staging 1.9.14. CORE-11521

Modified:
trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/enhmetafiledrv.h
trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/graphics.c

Modified: trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/enhmetafiledrv.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/enhmetafiledrv.h?rev=71986&r1=71985&r2=71986&view=diff
==
--- trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/enhmetafiledrv.h  
[iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/enhmetafiledrv.h  
[iso-8859-1] Sat Jul 23 21:33:40 2016
@@ -42,8 +42,13 @@
 HDCref_dc; /* Reference device */
 HDCscreen_dc;  /* Screen DC if no reference device 
specified */
 INTrestoring;  /* RestoreDC counter */
+BOOL   path;
 } EMFDRV_PDEVICE;
 
+static inline EMFDRV_PDEVICE *get_emf_physdev( PHYSDEV dev )
+{
+return CONTAINING_RECORD( dev, EMFDRV_PDEVICE, dev );
+}
 
 extern BOOL EMFDRV_WriteRecord( PHYSDEV dev, EMR *emr ) DECLSPEC_HIDDEN;
 extern void EMFDRV_UpdateBBox( PHYSDEV dev, RECTL *rect ) DECLSPEC_HIDDEN;

Modified: trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/graphics.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/graphics.c?rev=71986&r1=71985&r2=71986&view=diff
==
--- trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/graphics.c[iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/gdi/gdi32/wine/enhmfdrv/graphics.c[iso-8859-1] 
Sat Jul 23 21:33:40 2016
@@ -33,6 +33,69 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
 
+static const RECTL empty_bounds = { 0, 0, -1, -1 };
+
+/* determine if we can use 16-bit points to store all the input points */
+static BOOL can_use_short_points( const POINT *pts, UINT count )
+{
+UINT i;
+
+for (i = 0; i < count; i++)
+if (((pts[i].x + 0x8000) & ~0x) || ((pts[i].y + 0x8000) & ~0x))
+return FALSE;
+return TRUE;
+}
+
+/* store points in either long or short format; return a pointer to the end of 
the stored data */
+static void *store_points( POINTL *dest, const POINT *pts, UINT count, BOOL 
short_points )
+{
+if (short_points)
+{
+UINT i;
+POINTS *dest_short = (POINTS *)dest;
+
+for (i = 0; i < count; i++)
+{
+dest_short[i].x = pts[i].x;
+dest_short[i].y = pts[i].y;
+}
+return dest_short + count;
+}
+else
+{
+memcpy( dest, pts, count * sizeof(*dest) );
+return dest + count;
+}
+}
+
+/* compute the bounds of an array of points, optionally including the current 
position */
+static void get_points_bounds( RECTL *bounds, const POINT *pts, UINT count, 
HDC hdc )
+{
+UINT i;
+
+if (hdc)
+{
+POINT cur_pt;
+GetCurrentPositionEx( hdc, &cur_pt );
+bounds->left = bounds->right = cur_pt.x;
+bounds->top = bounds->bottom = cur_pt.y;
+}
+else if (count)
+{
+bounds->left = bounds->right = pts[0].x;
+bounds->top = bounds->bottom = pts[0].y;
+}
+else *bounds = empty_bounds;
+
+for (i = 0; i < count; i++)
+{
+bounds->left   = min( bounds->left, pts[i].x );
+bounds->right  = max( bounds->right, pts[i].x );
+bounds->top= min( bounds->top, pts[i].y );
+bounds->bottom = max( bounds->bottom, pts[i].y );
+}
+}
+
 /**
  *  EMFDRV_MoveTo
  */
@@ -481,42 +544,50 @@
 EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT 
polys,
DWORD iType)
 {
+EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
 EMRPOLYPOLYLINE *emr;
 DWORD cptl = 0, poly, size;
-INT point;
-RECTL bounds;
-const POINT *pts;
-BOOL ret;
-
-bounds.left = bounds.right = pt[0].x;
-bounds.top = bounds.bottom = pt[0].y;
-
-pts = pt;
+BOOL ret, use_small_emr, bounds_valid = TRUE;
+
 for(poly = 0; poly < polys; poly++) {
 cptl += counts[poly];
-   for(point = 0; point < counts[poly]; point++) {
-   if(bounds.left > pts->x) bounds.left = pts->x;
-   else if(bounds.right < pts->x) bounds.right = pts->x;
-   if(bounds.top > pts->y) bounds.top = pts->y;
-   else if(bounds.bottom < pts->y) bounds.bottom = pts->y;
-   pts++;
-   }
-}
-
-size = sizeof(EMRPOLYPOLYLINE) + (polys - 1) * sizeof(DWORD) +
-  (cptl - 1) * sizeof(POINTL);
+if(counts[poly] < 2) bounds_valid = FALSE;
+}
+if(!cptl) bounds_valid = FALSE;
+use_small_emr = can_use_sho

[ros-diffs] [mjansen] 71985: [CRT][GDI32] Introduce atan2 library, use it for gdi32 to fix a crash. CORE-11521 As suggested by Thomas :)

2016-07-23 Thread mjansen
Author: mjansen
Date: Sat Jul 23 20:35:11 2016
New Revision: 71985

URL: http://svn.reactos.org/svn/reactos?rev=71985&view=rev
Log:
[CRT][GDI32] Introduce atan2 library, use it for gdi32 to fix a crash. 
CORE-11521
As suggested by Thomas :)

Modified:
trunk/reactos/sdk/lib/crt/CMakeLists.txt
trunk/reactos/win32ss/gdi/gdi32/CMakeLists.txt
trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c

Modified: trunk/reactos/sdk/lib/crt/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/crt/CMakeLists.txt?rev=71985&r1=71984&r2=71985&view=diff
==
--- trunk/reactos/sdk/lib/crt/CMakeLists.txt[iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/crt/CMakeLists.txt[iso-8859-1] Sat Jul 23 
20:35:11 2016
@@ -66,3 +66,19 @@
 string/wctype.c)
 add_target_compile_definitions(strtol _LIBCNT_)
 add_dependencies(strtol psdk)
+
+
+if(ARCH STREQUAL "i386")
+list(APPEND ATAN2_ASM_SOURCE math/i386/atan2_asm.s)
+elseif(ARCH STREQUAL "amd64")
+list(APPEND ATAN2_ASM_SOURCE math/amd64/atan2.S)
+elseif(ARCH STREQUAL "arm")
+list(APPEND ATAN2_ASM_SOURCE math/arm/atan2.s)
+endif()
+
+add_asm_files(atan2_asm ${ATAN2_ASM_SOURCE})
+add_library(atan2 ${atan2_asm})
+set_target_properties(atan2 PROPERTIES LINKER_LANGUAGE "C")
+add_dependencies(atan2 asm)
+
+

Modified: trunk/reactos/win32ss/gdi/gdi32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/CMakeLists.txt?rev=71985&r1=71984&r2=71985&view=diff
==
--- trunk/reactos/win32ss/gdi/gdi32/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/CMakeLists.txt  [iso-8859-1] Sat Jul 23 
20:35:11 2016
@@ -61,6 +61,7 @@
 win32ksys
 dxguid
 msvcrtex
+atan2
 ${PSEH_LIB})
 
 add_importlibs(gdi32 user32 advapi32 kernel32 ntdll)

Modified: trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c?rev=71985&r1=71984&r2=71985&view=diff
==
--- trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c  [iso-8859-1] Sat Jul 23 
20:35:11 2016
@@ -519,23 +519,6 @@
 {
 DbgRaiseAssertionFailure();
 }
-
-#if defined(_MSC_VER) && (DBG != 1)
-
-/* MSVC uses its own in this case. */
-#else
-
-double
-__cdecl
-atan2(
-double y,
-double x)
-{
-__debugbreak();
-return 0.;
-}
-
-#endif
 
 
/**/
 




[ros-diffs] [pschweitzer] 71984: [MPR] Provide ReactOS specific implementation for WNetGetConnection(), we cannot use Wine's due to Wine specific MountMgr calls.

2016-07-23 Thread pschweitzer
Author: pschweitzer
Date: Sat Jul 23 19:52:23 2016
New Revision: 71984

URL: http://svn.reactos.org/svn/reactos?rev=71984&view=rev
Log:
[MPR]
Provide ReactOS specific implementation for WNetGetConnection(), we cannot use 
Wine's due to Wine specific MountMgr calls.

Modified:
trunk/reactos/dll/win32/mpr/mpr_ros.diff
trunk/reactos/dll/win32/mpr/wnet.c

Modified: trunk/reactos/dll/win32/mpr/mpr_ros.diff
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mpr/mpr_ros.diff?rev=71984&r1=71983&r2=71984&view=diff
==
--- trunk/reactos/dll/win32/mpr/mpr_ros.diff[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mpr/mpr_ros.diff[iso-8859-1] Sat Jul 23 
19:52:23 2016
@@ -45,3 +45,68 @@
  22 stdcall @(long) MPR_Alloc
  23 stdcall @(ptr long) MPR_ReAlloc
  24 stdcall @(ptr) MPR_Free
+Index: wnet.c
+===
+--- wnet.c (revision 71983)
 wnet.c (working copy)
+@@ -48,6 +48,9 @@
+ PF_NPGetResourceInformation getResourceInformation;
+ PF_NPAddConnection addConnection;
+ PF_NPAddConnection3 addConnection3;
++#ifdef __REACTOS__
++PF_NPGetConnection getConnection;
++#endif
+ } WNetProvider, *PWNetProvider;
+ 
+ typedef struct _WNetProviderTable
+@@ -196,6 +199,9 @@
+ }
+ provider->addConnection = 
MPR_GETPROC(NPAddConnection);
+ provider->addConnection3 = 
MPR_GETPROC(NPAddConnection3);
++#ifdef __REACTOS__
++provider->getConnection = 
MPR_GETPROC(NPGetConnection);
++#endif
+ TRACE("NPAddConnection %p\n", 
provider->addConnection);
+ TRACE("NPAddConnection3 %p\n", 
provider->addConnection3);
+ providerTable->numProviders++;
+@@ -1949,6 +1955,7 @@
+ /* find the network connection for a given drive; helper for 
WNetGetConnection */
+ static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
+ {
++#ifndef __REACTOS__
+ char buffer[1024];
+ struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
+ HANDLE mgr;
+@@ -1991,6 +1998,32 @@
+ }
+ CloseHandle( mgr );
+ return ret;
++#else
++DWORD ret = WN_NO_NETWORK;
++DWORD index;
++WCHAR local[3] = {letter, ':', 0};
++
++if (providerTable != NULL)
++{
++for (index = 0; index < providerTable->numProviders; index++)
++{
++if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
++WNNC_CON_GETCONNECTIONS)
++{
++if (providerTable->table[index].getConnection)
++ret = providerTable->table[index].getConnection(
++local, remote, size);
++else
++ret = WN_NO_NETWORK;
++if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
++break;
++}
++}
++}
++if (ret)
++SetLastError(ret);
++return ret;
++#endif
+ }
+ 
+ /**

Modified: trunk/reactos/dll/win32/mpr/wnet.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mpr/wnet.c?rev=71984&r1=71983&r2=71984&view=diff
==
--- trunk/reactos/dll/win32/mpr/wnet.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mpr/wnet.c  [iso-8859-1] Sat Jul 23 19:52:23 2016
@@ -48,6 +48,9 @@
 PF_NPGetResourceInformation getResourceInformation;
 PF_NPAddConnection addConnection;
 PF_NPAddConnection3 addConnection3;
+#ifdef __REACTOS__
+PF_NPGetConnection getConnection;
+#endif
 } WNetProvider, *PWNetProvider;
 
 typedef struct _WNetProviderTable
@@ -196,6 +199,9 @@
 }
 provider->addConnection = MPR_GETPROC(NPAddConnection);
 provider->addConnection3 = 
MPR_GETPROC(NPAddConnection3);
+#ifdef __REACTOS__
+provider->getConnection = MPR_GETPROC(NPGetConnection);
+#endif
 TRACE("NPAddConnection %p\n", provider->addConnection);
 TRACE("NPAddConnection3 %p\n", 
provider->addConnection3);
 providerTable->numProviders++;
@@ -1949,6 +1955,7 @@
 /* find the network connection for a given drive; helper for WNetGetConnection 
*/
 static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
 {
+#ifndef __REACTOS__
 char buffer[1024];
 struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
 HANDLE mgr;
@@ -1991,6 +1998,32 @@
 }
 CloseHandle( mgr );
 return ret;
+#else
+DWORD ret = WN_NO_NETWORK;
+DWORD index;
+WCHAR local[3] = {letter, ':', 0};
+
+if (providerTable != NULL)
+{
+for (index = 0; index < providerTabl

[ros-diffs] [cwittich] 71983: [SHELL32] close hKey in error case

2016-07-23 Thread cwittich
Author: cwittich
Date: Sat Jul 23 19:39:16 2016
New Revision: 71983

URL: http://svn.reactos.org/svn/reactos?rev=71983&view=rev
Log:
[SHELL32] close hKey in error case

Modified:
trunk/reactos/dll/win32/shell32/CNewMenu.cpp

Modified: trunk/reactos/dll/win32/shell32/CNewMenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CNewMenu.cpp?rev=71983&r1=71982&r2=71983&view=diff
==
--- trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] Sat Jul 23 
19:39:16 2016
@@ -203,8 +203,8 @@
 }
 }
 
-   dwSize++;
-   
+dwSize++;
+
 lpValues = (LPWSTR) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize * 
sizeof(WCHAR));
 if (!lpValues)
 return FALSE;
@@ -227,6 +227,7 @@
 if (RegSetValueExW(hKey, L"Classes", NULL, REG_MULTI_SZ, (LPBYTE)lpValues, 
dwSize * sizeof(WCHAR)) != ERROR_SUCCESS)
 {
 HeapFree(GetProcessHeap(), 0, lpValues);
+RegCloseKey(hKey);
 return FALSE;
 }
 




[ros-diffs] [tfaber] 71982: [NTOS:IO] - Avoid infinite loop in IopMountVolume. Brought to you by Vadim Galyant. CORE-11663 #resolve

2016-07-23 Thread tfaber
Author: tfaber
Date: Sat Jul 23 18:18:11 2016
New Revision: 71982

URL: http://svn.reactos.org/svn/reactos?rev=71982&view=rev
Log:
[NTOS:IO]
- Avoid infinite loop in IopMountVolume. Brought to you by Vadim Galyant.
CORE-11663 #resolve

Modified:
trunk/reactos/ntoskrnl/io/iomgr/volume.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/volume.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c?rev=71982&r1=71981&r2=71982&view=diff
==
--- trunk/reactos/ntoskrnl/io/iomgr/volume.c[iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/volume.c[iso-8859-1] Sat Jul 23 
18:18:11 2016
@@ -554,6 +554,7 @@
 (ListEntry->Flink != FsList))
 {
 /* Then skip this entry */
+ListEntry = ListEntry->Flink;
 continue;
 }
 




[ros-diffs] [mjansen] 71981: [SHELL32] Addendum to r71980, RegSetValueEx expects a size in bytes, not chars. CORE-10439

2016-07-23 Thread mjansen
Author: mjansen
Date: Sat Jul 23 13:15:19 2016
New Revision: 71981

URL: http://svn.reactos.org/svn/reactos?rev=71981&view=rev
Log:
[SHELL32] Addendum to r71980, RegSetValueEx expects a size in bytes, not chars. 
CORE-10439

Modified:
trunk/reactos/dll/win32/shell32/CNewMenu.cpp

Modified: trunk/reactos/dll/win32/shell32/CNewMenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CNewMenu.cpp?rev=71981&r1=71980&r2=71981&view=diff
==
--- trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] Sat Jul 23 
13:15:19 2016
@@ -224,7 +224,7 @@
 return FALSE;
 }
 
-if (RegSetValueExW(hKey, L"Classes", NULL, REG_MULTI_SZ, (LPBYTE)lpValues, 
dwSize) != ERROR_SUCCESS)
+if (RegSetValueExW(hKey, L"Classes", NULL, REG_MULTI_SZ, (LPBYTE)lpValues, 
dwSize * sizeof(WCHAR)) != ERROR_SUCCESS)
 {
 HeapFree(GetProcessHeap(), 0, lpValues);
 return FALSE;




[ros-diffs] [cwittich] 71980: [SHELL32] cache entries of "New" menu CORE-10439

2016-07-23 Thread cwittich
Author: cwittich
Date: Sat Jul 23 12:31:30 2016
New Revision: 71980

URL: http://svn.reactos.org/svn/reactos?rev=71980&view=rev
Log:
[SHELL32] cache entries of "New" menu 
CORE-10439 

Modified:
trunk/reactos/dll/win32/shell32/CNewMenu.cpp
trunk/reactos/dll/win32/shell32/CNewMenu.h

Modified: trunk/reactos/dll/win32/shell32/CNewMenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CNewMenu.cpp?rev=71980&r1=71979&r2=71980&view=diff
==
--- trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CNewMenu.cpp[iso-8859-1] Sat Jul 23 
12:31:30 2016
@@ -163,17 +163,18 @@
 }
 
 BOOL
-CNewMenu::LoadAllItems()
-{
+CNewMenu::CacheItems()
+{
+HKEY hKey;
+DWORD dwSize = 0;
 DWORD dwIndex = 0;
+LPWSTR lpValue;
+LPWSTR lpValues;
 WCHAR wszName[MAX_PATH];
 SHELLNEW_ITEM *pNewItem;
 SHELLNEW_ITEM *pCurItem = NULL;
 
-/* If there are any unload them */
-UnloadAllItems();
-
-/* Enumerate all extesions */
+/* Enumerate all extensions */
 while (RegEnumKeyW(HKEY_CLASSES_ROOT, dwIndex++, wszName, 
_countof(wszName)) == ERROR_SUCCESS)
 {
 if (wszName[0] != L'.')
@@ -182,6 +183,7 @@
 pNewItem = LoadItem(wszName);
 if (pNewItem)
 {
+dwSize += wcslen(wszName) + 1;
 if (wcsicmp(pNewItem->pwszExt, L".lnk") == 0)
 {
 /* Link handler */
@@ -200,7 +202,109 @@
 }
 }
 }
-
+
+   dwSize++;
+   
+lpValues = (LPWSTR) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize * 
sizeof(WCHAR));
+if (!lpValues)
+return FALSE;
+
+lpValue = lpValues;
+pCurItem = m_pItems;
+while (pCurItem)
+{
+memcpy(lpValue, pCurItem->pwszExt, (wcslen(pCurItem->pwszExt) + 1) * 
sizeof(WCHAR));
+lpValue += wcslen(pCurItem->pwszExt) + 1;
+pCurItem = pCurItem->pNext;
+}
+
+if (RegCreateKeyEx(HKEY_CURRENT_USER, ShellNewKey, 0, NULL, 
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
+{
+HeapFree(GetProcessHeap(), 0, lpValues);
+return FALSE;
+}
+
+if (RegSetValueExW(hKey, L"Classes", NULL, REG_MULTI_SZ, (LPBYTE)lpValues, 
dwSize) != ERROR_SUCCESS)
+{
+HeapFree(GetProcessHeap(), 0, lpValues);
+return FALSE;
+}
+
+HeapFree(GetProcessHeap(), 0, lpValues);
+RegCloseKey(hKey);
+
+return TRUE;
+}
+
+BOOL
+CNewMenu::LoadCachedItems()
+{
+LPWSTR wszName;
+LPWSTR lpValues;
+DWORD dwSize;
+HKEY hKey;
+SHELLNEW_ITEM *pNewItem;
+SHELLNEW_ITEM *pCurItem = NULL;
+
+if (RegOpenKeyExW(HKEY_CURRENT_USER, ShellNewKey, 0, KEY_READ, &hKey) != 
ERROR_SUCCESS) 
+return FALSE;
+
+if (RegQueryValueExW(hKey, L"Classes", NULL, NULL, NULL, &dwSize) != 
ERROR_SUCCESS)
+return FALSE;
+
+lpValues = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, dwSize);
+if (!lpValues)
+return FALSE;
+
+if (RegQueryValueExW(hKey, L"Classes", NULL, NULL, (LPBYTE)lpValues, 
&dwSize) != ERROR_SUCCESS)
+{
+HeapFree(GetProcessHeap(), 0, lpValues);
+return FALSE;
+}
+
+wszName = lpValues;
+
+for (; '\0' != *wszName; wszName += wcslen(wszName) + 1)
+{
+pNewItem = LoadItem(wszName);
+if (pNewItem)
+{
+if (wcsicmp(pNewItem->pwszExt, L".lnk") == 0)
+{
+/* Link handler */
+m_pLinkItem = pNewItem;
+}
+else
+{
+/* Add at the end of list */
+if (pCurItem)
+{
+pCurItem->pNext = pNewItem;
+pCurItem = pNewItem;
+}
+else
+pCurItem = m_pItems = pNewItem;
+}
+}
+}
+
+HeapFree(GetProcessHeap(), 0, lpValues);
+RegCloseKey(hKey);
+
+return TRUE;
+}
+
+BOOL
+CNewMenu::LoadAllItems()
+{
+/* If there are any unload them */
+UnloadAllItems();
+
+if (!LoadCachedItems())
+{
+CacheItems();
+}
+
 if (!m_pLinkItem)
 {
 m_pLinkItem = static_cast(HeapAlloc(GetProcessHeap(), 
HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));

Modified: trunk/reactos/dll/win32/shell32/CNewMenu.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CNewMenu.h?rev=71980&r1=71979&r2=71980&view=diff
==
--- trunk/reactos/dll/win32/shell32/CNewMenu.h  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CNewMenu.h  [iso-8859-1] Sat Jul 23 
12:31:30 2016
@@ -23,33 +23,35 @@
 #ifndef _SHV_ITEM_NEW_H_
 #define _SHV_ITEM_NEW_H_
 
+const WCHAR ShellNewKey[] = 
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discarda

[ros-diffs] [gadamopoulos] 71979: [SHELL32] - CDefView: Add the skeleton check that should be used to implement moving items in the CDefView. Nothing more is implemented because GetKeyState is complet

2016-07-23 Thread gadamopoulos
Author: gadamopoulos
Date: Sat Jul 23 08:42:38 2016
New Revision: 71979

URL: http://svn.reactos.org/svn/reactos?rev=71979&view=rev
Log:
[SHELL32]
- CDefView: Add the skeleton check that should be used to implement moving 
items in the CDefView. Nothing more is implemented because GetKeyState is 
completely unreliable.

Modified:
trunk/reactos/dll/win32/shell32/CDefView.cpp

Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefView.cpp?rev=71979&r1=71978&r2=71979&view=diff
==
--- trunk/reactos/dll/win32/shell32/CDefView.cpp[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefView.cpp[iso-8859-1] Sat Jul 23 
08:42:38 2016
@@ -97,6 +97,7 @@
 DWORD m_dwAdvf;
 CComPtr  m_pAdvSink;
 // for drag and drop
+CComPtr  m_pSourceDataObject;
 CComPtr  m_pCurDropTarget; /* The sub-item, which 
is currently dragged over */
 CComPtr  m_pCurDataObject; /* The dragged 
data-object */
 LONG  m_iDragOverItem;  /* Dragged over item's 
index, iff m_pCurDropTarget != NULL */
@@ -1786,7 +1787,12 @@
 }
 
 DWORD dwEffect2;
+
+m_pSourceDataObject = pda;
+
 DoDragDrop(pda, this, dwEffect, &dwEffect2);
+
+m_pSourceDataObject.Release();
 }
 }
 break;
@@ -2937,7 +2943,23 @@
 
 HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, 
POINTL pt, DWORD *pdwEffect)
 {
-if (m_pCurDropTarget)
+ERR("GetKeyState(VK_LBUTTON): %d\n", GetKeyState(VK_LBUTTON));
+
+if ((m_iDragOverItem == -1) && 
+(*pdwEffect & DROPEFFECT_MOVE) && 
+(GetKeyState(VK_LBUTTON) != 0) &&
+(m_pSourceDataObject.p) && 
+(SHIsSameObject(pDataObject, m_pSourceDataObject)))
+{
+ERR("Should implement moving items here!\n");
+
+if (m_pCurDropTarget)
+{
+m_pCurDropTarget->DragLeave();
+m_pCurDropTarget.Release();
+}
+}
+else if (m_pCurDropTarget)
 {
 m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
 m_pCurDropTarget.Release();