[ros-diffs] [pschweitzer] 71221: [KS] - Don't leak memory in KspValidateConnectRequest(), patch by Victor Martinez - Also compute connect medium ID string only twice (could be even computed once) inst

2016-05-01 Thread pschweitzer
Author: pschweitzer
Date: Sun May  1 08:25:22 2016
New Revision: 71221

URL: http://svn.reactos.org/svn/reactos?rev=71221&view=rev
Log:
[KS]
- Don't leak memory in KspValidateConnectRequest(), patch by Victor Martinez
- Also compute connect medium ID string only twice (could be even computed 
once) instead of doing so in each loop iteration

CORE-11099 #resolve #comment Committed in r71221 

Modified:
trunk/reactos/drivers/ksfilter/ks/connectivity.c

Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connectivity.c?rev=71221&r1=71220&r2=71221&view=diff
==
--- trunk/reactos/drivers/ksfilter/ks/connectivity.c[iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/connectivity.c[iso-8859-1] Sun May  1 
08:25:22 2016
@@ -73,6 +73,7 @@
 ULONG Count;
 BOOLEAN Found;
 PKSPIN_DESCRIPTOR Descriptor;
+UNICODE_STRING GuidString2;
 
 /* did the caller miss the connect parameter */
 if (!Connect)
@@ -93,7 +94,10 @@
 
 /* is pin id out of bounds */
 if (ConnectDetails->PinId >= DescriptorsCount)
+{
+FreeItem(ConnectDetails);
 return STATUS_INVALID_PARAMETER;
+}
 
 if (DescriptorSize == sizeof(KSPIN_DESCRIPTOR))
 {
@@ -124,14 +128,16 @@
 /* now check the interface */
 Found = FALSE;
 Index = 0;
+RtlStringFromGUID(&ConnectDetails->Interface.Set, &GuidString2);
 do
 {
-UNICODE_STRING GuidString, GuidString2;
+UNICODE_STRING GuidString;
 RtlStringFromGUID(&Interface[Index].Set, &GuidString);
-RtlStringFromGUID(&ConnectDetails->Interface.Set, &GuidString2);
 
 DPRINT("Driver Interface %S Id %u\n", GuidString.Buffer, 
Interface[Index].Id);
 DPRINT("Connect Interface %S Id %u\n", GuidString2.Buffer, 
ConnectDetails->Interface.Id);
+
+RtlFreeUnicodeString(&GuidString);
 
 if (IsEqualGUIDAligned(&Interface[Index].Set, 
&ConnectDetails->Interface.Set) &&
Interface[Index].Id == 
ConnectDetails->Interface.Id)
@@ -143,10 +149,12 @@
 /* iterate to next interface */
 Index++;
 }while(Index < Count);
+RtlFreeUnicodeString(&GuidString2);
 
 if (!Found)
 {
 /* pin doesnt support this interface */
+FreeItem(ConnectDetails);
 return STATUS_NO_MATCH;
 }
 
@@ -167,15 +175,16 @@
 /* now check the interface */
 Found = FALSE;
 Index = 0;
+RtlStringFromGUID(&ConnectDetails->Medium.Set, &GuidString2);
 do
 {
-UNICODE_STRING GuidString, GuidString2;
+UNICODE_STRING GuidString;
 RtlStringFromGUID(&Medium[Index].Set, &GuidString);
-RtlStringFromGUID(&ConnectDetails->Medium.Set, &GuidString2);
 
 DPRINT("Driver Medium %S Id %u\n", GuidString.Buffer, 
Medium[Index].Id);
 DPRINT("Connect Medium %S Id %u\n", GuidString2.Buffer, 
ConnectDetails->Medium.Id);
 
+RtlFreeUnicodeString(&GuidString);
 
 if (IsEqualGUIDAligned(&Medium[Index].Set, 
&ConnectDetails->Medium.Set) &&
Medium[Index].Id == ConnectDetails->Medium.Id)
@@ -185,15 +194,15 @@
 break;
 }
 
-
-
 /* iterate to next medium */
 Index++;
 }while(Index < Count);
+RtlFreeUnicodeString(&GuidString2);
 
 if (!Found)
 {
 /* pin doesnt support this medium */
+FreeItem(ConnectDetails);
 return STATUS_NO_MATCH;
 }
 




[ros-diffs] [pschweitzer] 71222: [SHELL32] Don't use uninit var

2016-05-01 Thread pschweitzer
Author: pschweitzer
Date: Sun May  1 13:27:11 2016
New Revision: 71222

URL: http://svn.reactos.org/svn/reactos?rev=71222&view=rev
Log:
[SHELL32]
Don't use uninit var

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

Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolder.cpp?rev=71222&r1=71221&r2=71222&view=diff
==
--- trunk/reactos/dll/win32/shell32/shlfolder.cpp   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlfolder.cpp   [iso-8859-1] Sun May  1 
13:27:11 2016
@@ -399,7 +399,7 @@
 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING && 
 GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL)
 {
-int bWantsForParsing;
+int bWantsForParsing = FALSE;
 
 /*
 * We can only get a filesystem path from a shellfolder if the




[ros-diffs] [pschweitzer] 71223: [DHCPCSVC] Properly end variadic args enumeration

2016-05-01 Thread pschweitzer
Author: pschweitzer
Date: Sun May  1 13:36:15 2016
New Revision: 71223

URL: http://svn.reactos.org/svn/reactos?rev=71223&view=rev
Log:
[DHCPCSVC]
Properly end variadic args enumeration

Modified:
trunk/reactos/dll/win32/dhcpcsvc/dhcp/util.c

Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/util.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcp/util.c?rev=71223&r1=71222&r2=71223&view=diff
==
--- trunk/reactos/dll/win32/dhcpcsvc/dhcp/util.c[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dhcpcsvc/dhcp/util.c[iso-8859-1] Sun May  1 
13:36:15 2016
@@ -17,7 +17,7 @@
 
 ret = _vsnprintf( buf, sizeof(buf), format, arg_begin );
 
-va_end( format );
+va_end( arg_begin );
 
 DPRINT("NOTE: %s\n", buf);
 
@@ -32,7 +32,7 @@
 
 ret = _vsnprintf( buf, sizeof(buf), format, arg_begin );
 
-va_end( format );
+va_end( arg_begin );
 
 DPRINT("DEBUG: %s\n", buf);
 
@@ -47,7 +47,7 @@
 
 ret = _vsnprintf( buf, sizeof(buf), format, arg_begin );
 
-va_end( format );
+va_end( arg_begin );
 
 DPRINT("WARN: %s\n", buf);
 
@@ -62,7 +62,7 @@
 
 ret = _vsnprintf( buf, sizeof(buf), format, arg_begin );
 
-va_end( format );
+va_end( arg_begin );
 
 DPRINT("WARNING: %s\n", buf);
 
@@ -76,7 +76,7 @@
 
 _vsnprintf( buf, sizeof(buf), format, arg_begin );
 
-va_end( format );
+va_end( arg_begin );
 
 DPRINT1("ERROR: %s\n", buf);
 }




[ros-diffs] [tthompson] 71224: [NTFS] Added minimal write support from CORE-10998 along with updates as suggested by CR-90.

2016-05-01 Thread tthompson
Author: tthompson
Date: Sun May  1 16:21:53 2016
New Revision: 71224

URL: http://svn.reactos.org/svn/reactos?rev=71224&view=rev
Log:
[NTFS]
Added minimal write support from CORE-10998 along with updates as suggested by 
CR-90.

Modified:
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/misc.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c

Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c?rev=71224&r1=71223&r2=71224&view=diff
==
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] 
(original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] 
Sun May  1 16:21:53 2016
@@ -20,7 +20,8 @@
  * PROJECT:  ReactOS kernel
  * FILE: drivers/filesystem/ntfs/blockdev.c
  * PURPOSE:  NTFS filesystem driver
- * PROGRAMMER:   Eric Kohl
+ * PROGRAMMERS:  Eric Kohl
+ *   Trevor Thompson
  */
 
 /* INCLUDES */
@@ -129,6 +130,180 @@
 return Status;
 }
 
+/**
+* @name NtfsWriteDisk
+* @implemented
+*
+* Writes data from the given buffer to the given DeviceObject.
+*
+* @param DeviceObject
+* Device to write to
+*
+* @param StartingOffset
+* Offset, in bytes, from the start of the device object where the data will be 
written
+*
+* @param Length
+* How much data will be written, in bytes
+*
+* @param SectorSize
+* Size of the sector on the disk that the write must be aligned to
+*
+* @param Buffer
+* The data that's being written to the device
+*
+* @return
+* STATUS_SUCCESS in case of success, STATUS_INSUFFICIENT_RESOURCES if a memory 
allocation failed,
+* or whatever status IoCallDriver() sets.
+*
+* @remarks Called by NtfsWriteFile(). May perform a read-modify-write 
operation if the
+* requested write is not sector-aligned.
+*
+*/
+NTSTATUS
+NtfsWriteDisk(IN PDEVICE_OBJECT DeviceObject,
+  IN LONGLONG StartingOffset,
+  IN ULONG Length,
+  IN ULONG SectorSize,
+  IN const PUCHAR Buffer)
+{
+IO_STATUS_BLOCK IoStatus;
+LARGE_INTEGER Offset;
+KEVENT Event;
+PIRP Irp;
+NTSTATUS Status;
+ULONGLONG RealWriteOffset;
+ULONG RealLength;
+BOOLEAN AllocatedBuffer = FALSE;
+PUCHAR TempBuffer = NULL;
+
+DPRINT("NtfsWriteDisk(%p, %I64x, %u, %u, %p)\n", DeviceObject, 
StartingOffset, Length, SectorSize, Buffer);
+
+if (Length == 0)
+return STATUS_SUCCESS;
+
+RealWriteOffset = (ULONGLONG)StartingOffset;
+RealLength = Length;
+
+// Does the write need to be adjusted to be sector-aligned?
+if ((RealWriteOffset % SectorSize) != 0 || (RealLength % SectorSize) != 0)
+{
+ULONGLONG relativeOffset;
+
+// We need to do a read-modify-write. We'll start be copying the 
entire 
+// contents of every sector that will be overwritten. 
+// TODO: Optimize (read no more than necessary)
+
+RealWriteOffset = ROUND_DOWN(StartingOffset, SectorSize);
+RealLength = ROUND_UP(Length, SectorSize);
+
+// Would the end of our sector-aligned write fall short of the 
requested write?
+if (RealWriteOffset + RealLength < StartingOffset + Length)
+{
+RealLength += SectorSize;
+}
+
+// Did we underestimate the memory required somehow?
+if (RealLength + RealWriteOffset < StartingOffset + Length)
+{
+DPRINT1("\a\t\t\t\t\tFIXME: calculated less memory than 
needed!\n");
+DPRINT1("StartingOffset: %lu\tLength: %lu\tRealWriteOffset: 
%lu\tRealLength: %lu\n",
+StartingOffset, Length, RealWriteOffset, RealLength);
+
+RealLength += SectorSize;
+}
+
+// Allocate a buffer to copy the existing data to
+TempBuffer = ExAllocatePoolWithTag(NonPagedPool, RealLength, TAG_NTFS);
+
+// Did we fail to allocate it?
+if (TempBuffer == NULL)
+{
+DPRINT1("Not enough memory!\n");
+
+return STATUS_INSUFFICIENT_RESOURCES;
+}
+
+// Read the sectors we'll be overwriting into TempBuffer
+Status = NtfsReadDisk(DeviceObject, RealWriteOffset, RealLength, 
SectorSize, TempBuffer, FALSE);
+
+// Did we fail the read?
+if (!NT_SUCCESS(Status))
+{
+RtlSecureZeroMemory(TempBuffer, RealLength);
+ExFreePoolWithTag(TempBuffer, TAG_NTFS);
+return Status;
+}
+
+// Calculate where the new data should be written to, relative to the 
start of Te

[ros-diffs] [gadamopoulos] 71225: [SHELL32] - Disentangle icon extraction for control panel. Add CCPLExtractIcon_CreateInstance and isolate control panel handling in CControlPanelFolder.cpp.

2016-05-01 Thread gadamopoulos
Author: gadamopoulos
Date: Sun May  1 19:05:32 2016
New Revision: 71225

URL: http://svn.reactos.org/svn/reactos?rev=71225&view=rev
Log:
[SHELL32]
- Disentangle icon extraction for control panel. Add 
CCPLExtractIcon_CreateInstance and isolate control panel handling in 
CControlPanelFolder.cpp.

Modified:
trunk/reactos/dll/win32/shell32/folders.cpp
trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
trunk/reactos/dll/win32/shell32/wine/shell32_main.h

Modified: trunk/reactos/dll/win32/shell32/folders.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders.cpp?rev=71225&r1=71224&r2=71225&view=diff
==
--- trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] Sun May  1 
19:05:32 2016
@@ -358,12 +358,7 @@
 {
 BOOL found = FALSE;
 
-if (_ILIsCPanelStruct(pSimplePidl))
-{
-if (SUCCEEDED(CPanel_GetIconLocationW(pSimplePidl, wTemp, 
MAX_PATH, &icon_idx)))
-found = TRUE;
-}
-else if (_ILGetExtension(pSimplePidl, sTemp, MAX_PATH))
+if (_ILGetExtension(pSimplePidl, sTemp, MAX_PATH))
 {
 if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
 && HCR_GetIconA(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))

Modified: trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp?rev=71225&r1=71224&r2=71225&view=diff
==
--- trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp 
[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp 
[iso-8859-1] Sun May  1 19:05:32 2016
@@ -125,6 +125,31 @@
 return NULL;
 }
 
+HRESULT CCPLExtractIcon_CreateInstance(LPCITEMIDLIST pidlRoot, LPCITEMIDLIST 
pidl, REFIID riid, LPVOID * ppvOut)
+{
+PIDLCPanelStruct *pData = _ILGetCPanelPointer(pidl);
+if (!pData)
+{
+LPITEMIDLIST pidlComplete = ILCombine(pidlRoot, pidl);
+if (!pidlComplete)
+return E_OUTOFMEMORY;
+
+*ppvOut = IExtractIconW_Constructor(pidlComplete);
+
+SHFree(pidlComplete);
+return *ppvOut ? S_OK : E_FAIL;
+}
+
+CComPtr initIcon;
+HRESULT hr = 
SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit, &initIcon));
+if (FAILED(hr))
+return NULL;
+
+initIcon->SetNormalIcon(pData->szName, (int)pData->iconIdx != -1 ? 
pData->iconIdx : 0);
+
+return initIcon->QueryInterface(riid, ppvOut);
+}
+
 BOOL CControlPanelEnum::RegisterCPanelApp(LPCWSTR wpath)
 {
 CPlApplet* applet = Control_LoadApplet(0, wpath, NULL);
@@ -455,7 +480,7 @@
 UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, 
LPVOID * ppvOut)
 {
 LPITEMIDLIST pidl;
-IUnknown *pObj = NULL;
+LPVOID pObj = NULL;
 HRESULT hr = E_INVALIDARG;
 
 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
@@ -482,16 +507,9 @@
 hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, 
(IShellFolder*)this, NULL, 0, NULL, (IContextMenu**)&pObj);
 } else if (IsEqualIID(riid, IID_IDataObject) && (cidl >= 1)) {
 hr = IDataObject_Constructor(hwndOwner, pidlRoot, apidl, cidl, 
(IDataObject **)&pObj);
-} else if (IsEqualIID(riid, IID_IExtractIconA) && (cidl == 1)) {
-pidl = ILCombine(pidlRoot, apidl[0]);
-pObj = IExtractIconA_Constructor(pidl);
-SHFree(pidl);
-hr = S_OK;
-} else if (IsEqualIID(riid, IID_IExtractIconW) && (cidl == 1)) {
-pidl = ILCombine(pidlRoot, apidl[0]);
-pObj = IExtractIconW_Constructor(pidl);
-SHFree(pidl);
-hr = S_OK;
+} else if ((IsEqualIID(riid, IID_IExtractIconA) || IsEqualIID(riid, 
IID_IExtractIconW)) && (cidl == 1)) {
+hr = CCPLExtractIcon_CreateInstance(pidlRoot, apidl[0], riid, 
&pObj);
+
 } else if ((IsEqualIID(riid, IID_IShellLinkW) || IsEqualIID(riid, 
IID_IShellLinkA))
&& (cidl == 1)) {
 pidl = ILCombine(pidlRoot, apidl[0]);
@@ -669,20 +687,6 @@
 return S_OK;
 }
 
-HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST pidl, LPWSTR szIconFile, UINT 
cchMax, int* piIndex)
-{
-PIDLCPanelStruct* pcpanel = _ILGetCPanelPointer(pidl);
-
-if (!pcpanel)
-return E_INVALIDARG;
-
-wcsncpy(szIconFile, pcpanel->szName, cchMax);
-*piIndex = (int)pcpanel->iconIdx != -1 ? pcpanel->iconIdx : 0;
-
-return S_OK;
-}
-
-
 CCPLItemMenu::CCPLItemMenu()
 {
 m_apidl = NULL;

Modified: trunk/reactos/dll/win32/shell32/wine/shell32_main.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/shell32_main.h?rev=71225&r1=71224&r2=71225&view=diff

[ros-diffs] [mjansen] 71226: [APPHELP][APPHELP_APITEST] Add SdbGetFileAttributes + tests, based on the work of Mislav Blažević CORE-10367 - Implement SdbGetFileAttributes (based on the work of Mislav

2016-05-01 Thread mjansen
Author: mjansen
Date: Sun May  1 19:12:06 2016
New Revision: 71226

URL: http://svn.reactos.org/svn/reactos?rev=71226&view=rev
Log:
[APPHELP][APPHELP_APITEST] Add SdbGetFileAttributes + tests, based on the work 
of Mislav Blažević CORE-10367
- Implement SdbGetFileAttributes (based on the work of Mislav Blažević)
- Add tests for SdbGetFileAttributes

Added:
trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c   (with props)
trunk/rostests/apitests/apphelp/data.c   (with props)
Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/rostests/apitests/apphelp/CMakeLists.txt
trunk/rostests/apitests/apphelp/apphelp.c

Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt?rev=71226&r1=71225&r2=71226&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] Sun May  1 
19:12:06 2016
@@ -3,8 +3,9 @@
 
 list(APPEND SOURCE
 apphelp.c
+layer.c
 sdbapi.c
-layer.c
+sdbfileattr.c
 apphelp.spec
 apphelp.h
 ${CMAKE_CURRENT_BINARY_DIR}/apphelp_stubs.c)
@@ -15,6 +16,7 @@
 
 set_module_type(apphelp win32dll)
 target_link_libraries(apphelp wine)
-#add_delay_importlibs(apphelp version imagehlp user32)
-add_importlibs(apphelp msvcrt kernel32 ntdll)
+# When binutils is fixed, we should move imagehlp to delay! CORE-6504
+add_delay_importlibs(apphelp version)
+add_importlibs(apphelp msvcrt imagehlp kernel32 ntdll)
 add_cd_file(TARGET apphelp DESTINATION reactos/system32 FOR all)

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=71226&r1=71225&r2=71226&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Sun May  1 
19:12:06 2016
@@ -32,6 +32,16 @@
 #define TAGREF_NULL (0)
 #define TAGREF_ROOT (0)
 
+typedef struct tagATTRINFO {
+  TAG   type;
+  DWORD flags;
+  union {
+QWORD qwattr;
+DWORD dwattr;
+WCHAR *lpattr;
+  };
+} ATTRINFO, *PATTRINFO;
+
 typedef enum _SHIM_LOG_LEVEL {
 SHIM_ERR = 1,
 SHIM_WARN = 2,
@@ -72,12 +82,28 @@
 
 #endif
 
+typedef struct tagMEMMAPPED {
+HANDLE file;
+HANDLE section;
+PBYTE view;
+SIZE_T size;
+SIZE_T mapped_size;
+} MEMMAPPED, *PMEMMAPPED;
+
+BOOL WINAPI SdbpOpenMemMappedFile(LPCWSTR path, PMEMMAPPED mapping);
+void WINAPI SdbpCloseMemMappedFile(PMEMMAPPED mapping);
+DWORD SdbpStrlen(LPCWSTR string);
+PWSTR SdbpStrDup(LPCWSTR string);
+
 
 /* layer.c */
 BOOL WINAPI AllowPermLayer(PCWSTR path);
 BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD 
pdwBytes, DWORD dwFlags);
 BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, 
BOOL bMachine, BOOL bEnable);
 
+
+#define ATTRIBUTE_AVAILABLE 0x1
+#define ATTRIBUTE_FAILED 0x2
 
 #define TAGID_NULL 0x0
 #define TAGID_ROOT 0x0

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.spec?rev=71226&r1=71225&r2=71226&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] Sun May  1 
19:12:06 2016
@@ -48,7 +48,7 @@
 @ stub SdbFindNextTag
 @ stub SdbFindNextTagRef
 @ stub SdbFreeDatabaseInformation
-@ stub SdbFreeFileAttributes
+@ stdcall SdbFreeFileAttributes(ptr)
 @ stub SdbFreeFileInfo
 @ stub SdbFreeFlagInfo
 @ stub SdbGetAppCompatDataSize
@@ -61,7 +61,7 @@
 @ stub SdbGetDatabaseVersion
 @ stub SdbGetDllPath
 @ stub SdbGetEntryFlags
-@ stub SdbGetFileAttributes
+@ stdcall SdbGetFileAttributes(wstr ptr ptr)
 @ stub SdbGetFileImageType
 @ stub SdbGetFileImageTypeEx
 @ stub SdbGetFileInfo

Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbapi.c?rev=71226&r1=71225&r2=71226&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/sdbapi.c[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c[iso-8859-1] Sun May  1 
19:12:06 2016
@@ -155,52 +155,135 @@
 HeapDestroy(g_Heap);
 }
 
+static HANDLE SdbpHeap(void)
+{
+return g_Heap;
+}
+
+LPVOID SdbpAlloc(SIZE_T size
+#if SDBAPI_DEBUG_ALLOC
+, int line, const char* file
+#endif
+)
+{
+LPVOID mem = 

[ros-diffs] [gadamopoulos] 71227: [SHELL32] - Remove IExtractIconA_Constructor and rename IExtractIconW_Constructor to GenericExtractIcon_CreateInstance which will handle both A and W. - Make GenericE

2016-05-01 Thread gadamopoulos
Author: gadamopoulos
Date: Sun May  1 19:54:23 2016
New Revision: 71227

URL: http://svn.reactos.org/svn/reactos?rev=71227&view=rev
Log:
[SHELL32]
- Remove IExtractIconA_Constructor and rename IExtractIconW_Constructor to 
GenericExtractIcon_CreateInstance which will handle both A and W.
- Make GenericExtractIcon_CreateInstance accept a pointer to a IShellFolder and 
a simple pidl.
- Avoid using SHGetPathFromIDListW. Use ILGetDisplayNameExW instead. May make 
loading icons for folders and exe files slightly faster as it does fewer I/O 
and less allocations.

Modified:
trunk/reactos/dll/win32/shell32/folders.cpp
trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
trunk/reactos/dll/win32/shell32/wine/shell32_main.h

Modified: trunk/reactos/dll/win32/shell32/folders.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders.cpp?rev=71227&r1=71226&r2=71227&view=diff
==
--- trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] Sun May  1 
19:54:23 2016
@@ -24,7 +24,7 @@
 DWORD NumIconOverlayHandlers = 0;
 IShellIconOverlayIdentifier ** Handlers = NULL;
 
-static HRESULT getIconLocationForFolder(LPCITEMIDLIST pidl, UINT uFlags,
+static HRESULT getIconLocationForFolder(IShellFolder * psf, LPCITEMIDLIST 
pidl, UINT uFlags,
 LPWSTR szIconFile, UINT cchMax, int 
*piIndex, UINT *pwFlags)
 {
 static const WCHAR shellClassInfo[] = { '.', 'S', 'h', 'e', 'l', 'l', 'C', 
'l', 'a', 's', 's', 'I', 'n', 'f', 'o', 0 };
@@ -39,7 +39,7 @@
 {
 WCHAR wszFolderPath[MAX_PATH];
 
-if (!SHGetPathFromIDListW(pidl, wszFolderPath))
+if (!ILGetDisplayNameExW(psf, pidl, wszFolderPath, 0))
 return FALSE;
 
 PathAppendW(wszFolderPath, wszDesktopIni);
@@ -192,28 +192,20 @@
 return FALSE;
 }
 
-/**
-*  IExtractIconW_Constructor
-*/
-IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl)
+HRESULT GenericExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST 
pidl, REFIID iid, LPVOID * ppvOut)
 {
 CComPtrinitIcon;
-CComPtr extractIcon;
 GUID const * riid;
 int icon_idx;
 UINT flags;
 CHAR sTemp[MAX_PATH];
 WCHAR wTemp[MAX_PATH];
-LPITEMIDLIST pSimplePidl = ILFindLastID(pidl);
+LPCITEMIDLIST pSimplePidl = pidl;
 HRESULT hr;
 
 hr = 
SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon));
 if (FAILED(hr))
-return NULL;
-
-hr = initIcon->QueryInterface(IID_PPV_ARG(IExtractIconW,&extractIcon));
-if (FAILED(hr))
-return NULL;
+return hr;
 
 if (_ILIsDesktop(pSimplePidl))
 {
@@ -321,7 +313,7 @@
 
 else if (_ILIsFolder (pSimplePidl))
 {
-if (SUCCEEDED(getIconLocationForFolder(
+if (SUCCEEDED(getIconLocationForFolder(psf, 
   pidl, 0, wTemp, MAX_PATH,
   &icon_idx,
   &flags)))
@@ -332,21 +324,21 @@
 //the following line removed.
 initIcon->SetShortcutIcon(wTemp, icon_idx);
 }
-if (SUCCEEDED(getIconLocationForFolder(
+if (SUCCEEDED(getIconLocationForFolder(psf, 
   pidl, GIL_DEFAULTICON, wTemp, MAX_PATH,
   &icon_idx,
   &flags)))
 {
 initIcon->SetDefaultIcon(wTemp, icon_idx);
 }
-// if (SUCCEEDED(getIconLocationForFolder(
+// if (SUCCEEDED(getIconLocationForFolder(psf, 
 //   pidl, GIL_FORSHORTCUT, wTemp, MAX_PATH,
 //   &icon_idx,
 //   &flags)))
 // {
 // initIcon->SetShortcutIcon(wTemp, icon_idx);
 // }
-if (SUCCEEDED(getIconLocationForFolder(
+if (SUCCEEDED(getIconLocationForFolder(psf, 
   pidl, GIL_OPENICON, wTemp, MAX_PATH,
   &icon_idx,
   &flags)))
@@ -365,7 +357,7 @@
 {
 if (!lstrcmpA("%1", sTemp)) /* icon is in the file */
 {
-SHGetPathFromIDListW(pidl, wTemp);
+ILGetDisplayNameExW(psf, pidl, wTemp, 0);
 icon_idx = 0;
 }
 else
@@ -383,7 +375,7 @@
 
 if (SUCCEEDED(SHGetDesktopFolder(&dsf)))
 {
-HRESULT hr = dsf->GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*) 
&pidl, IID_NULL_PPV_ARG(IShellLinkW, &psl));
+HRESULT hr = dsf->GetUIObj

[ros-diffs] [pschweitzer] 71228: [NTFS] This has nothing to do in a NTFS driver

2016-05-01 Thread pschweitzer
Author: pschweitzer
Date: Sun May  1 20:13:26 2016
New Revision: 71228

URL: http://svn.reactos.org/svn/reactos?rev=71228&view=rev
Log:
[NTFS]
This has nothing to do in a NTFS driver

Modified:
trunk/reactos/drivers/filesystems/ntfs/ntfs.h

Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/ntfs.h?rev=71228&r1=71227&r2=71228&view=diff
==
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h   [iso-8859-1] Sun May  1 
20:13:26 2016
@@ -817,16 +817,6 @@
 NtfsGetUserBuffer(PIRP Irp,
   BOOLEAN Paging);
 
-#if 0
-BOOLEAN
-wstrcmpjoki(PWSTR s1, PWSTR s2);
-
-VOID
-CdfsSwapString(PWCHAR Out,
-  PUCHAR In,
-  ULONG Count);
-#endif
-
 VOID
 NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
   PULONG FileAttributes);




[ros-diffs] [pschweitzer] 71229: [NTFS] Cherry pick a change from r71224 by Trevor: - Don't fail too early in NtfsCreateFile() when requesting write/supersede operation. This allows already setting ap

2016-05-01 Thread pschweitzer
Author: pschweitzer
Date: Sun May  1 20:16:08 2016
New Revision: 71229

URL: http://svn.reactos.org/svn/reactos?rev=71229&view=rev
Log:
[NTFS]
Cherry pick a change from r71224 by Trevor:
- Don't fail too early in NtfsCreateFile() when requesting write/supersede 
operation. This allows already setting appropriate error in certain cases and 
making the driver more consistent

Modified:
trunk/reactos/drivers/filesystems/ntfs/create.c

Modified: trunk/reactos/drivers/filesystems/ntfs/create.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/create.c?rev=71229&r1=71228&r2=71229&view=diff
==
--- trunk/reactos/drivers/filesystems/ntfs/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/create.c [iso-8859-1] Sun May  1 
20:16:08 2016
@@ -359,13 +359,6 @@
 
 FileObject = Stack->FileObject;
 
-if (RequestedDisposition == FILE_CREATE ||
-RequestedDisposition == FILE_OVERWRITE_IF ||
-RequestedDisposition == FILE_SUPERSEDE)
-{
-return STATUS_ACCESS_DENIED;
-}
-
 if ((RequestedOptions & FILE_OPEN_BY_FILE_ID) == FILE_OPEN_BY_FILE_ID)
 {
 ULONGLONG MFTId;




[ros-diffs] [mjansen] 71230: [APPHELP][APPHELP_APITEST] Add some apphelp GUID helper functions + tests to be used later on. CORE-10367 - SdbGetStandardDatabaseGUID - SdbGUIDFromString - SdbGUIDToStrin

2016-05-01 Thread mjansen
Author: mjansen
Date: Sun May  1 21:43:30 2016
New Revision: 71230

URL: http://svn.reactos.org/svn/reactos?rev=71230&view=rev
Log:
[APPHELP][APPHELP_APITEST] Add some apphelp GUID helper functions + tests to be 
used later on. CORE-10367
- SdbGetStandardDatabaseGUID
- SdbGUIDFromString
- SdbGUIDToString
- SdbIsNullGUID

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/rostests/apitests/apphelp/apphelp.c

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=71230&r1=71229&r2=71230&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Sun May  1 
21:43:30 2016
@@ -31,6 +31,11 @@
 
 #define TAGREF_NULL (0)
 #define TAGREF_ROOT (0)
+
+#define HID_DATABASE_TYPE_MASK 0xF00F
+#define SDB_DATABASE_MAIN_MSI 0x8002
+#define SDB_DATABASE_MAIN_SHIM 0x8003
+#define SDB_DATABASE_MAIN_DRIVERS 0x8004
 
 typedef struct tagATTRINFO {
   TAG   type;

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.spec?rev=71230&r1=71229&r2=71230&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] Sun May  1 
21:43:30 2016
@@ -79,17 +79,17 @@
 @ stdcall SdbGetPermLayerKeys(wstr wstr ptr long)
 @ stub SdbGetShowDebugInfoOption
 @ stub SdbGetShowDebugInfoOptionValue
-@ stub SdbGetStandardDatabaseGUID
+@ stdcall SdbGetStandardDatabaseGUID(long ptr)
 @ stub SdbGetStringTagPtr
 @ stub SdbGetTagDataSize
 @ stub SdbGetTagFromTagID
 @ stub SdbGrabMatchingInfo
 @ stub SdbGrabMatchingInfoEx
-@ stub SdbGUIDFromString
-@ stub SdbGUIDToString
+@ stdcall SdbGUIDFromString(wstr ptr)
+@ stdcall SdbGUIDToString(ptr wstr long)
 @ stub SdbInitDatabase
 @ stub SdbInitDatabaseEx
-@ stub SdbIsNullGUID
+@ stdcall SdbIsNullGUID(ptr)
 @ stub SdbIsStandardDatabase
 @ stub SdbIsTagrefFromLocalDB
 @ stub SdbIsTagrefFromMainDB

Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbapi.c?rev=71230&r1=71229&r2=71230&view=diff
==
--- trunk/reactos/dll/appcompat/apphelp/sdbapi.c[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c[iso-8859-1] Sun May  1 
21:43:30 2016
@@ -26,6 +26,10 @@
 
 #include "wine/unicode.h"
 
+
+static const GUID GUID_DATABASE_MSI = {0xd8ff6d16,0x6a3a,0x468a, 
{0x8b,0x44,0x01,0x71,0x4d,0xdc,0x49,0xea}};
+static const GUID GUID_DATABASE_SHIM = {0x,0x,0x, 
{0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}};
+static const GUID GUID_DATABASE_DRIVERS = {0xf9ab2228,0x3312,0x4a73, 
{0xb6,0xf9,0x93,0x6d,0x70,0xe1,0x12,0xef}};
 
 static HANDLE SdbpHeap(void);
 
@@ -284,6 +288,88 @@
 NtClose(mapping->section);
 NtClose(mapping->file);
 RtlZeroMemory(mapping, sizeof(*mapping));
+}
+
+/**
+ * Parses a string to retrieve a GUID.
+ *
+ * @param [in]  GuidString  The string to parse.
+ * @param [out] GuidThe resulting GUID.
+ *
+ * @return  TRUE if it succeeds, FALSE if it fails.
+ */
+BOOL WINAPI SdbGUIDFromString(PCWSTR GuidString, GUID *Guid)
+{
+UNICODE_STRING GuidString_u;
+RtlInitUnicodeString(&GuidString_u, GuidString);
+return NT_SUCCESS(RtlGUIDFromString(&GuidString_u, Guid));
+}
+
+/**
+ * Converts a GUID to a string.
+ *
+ * @param [in]  GuidThe GUID to convert.
+ * @param [out] GuidString  The resulting string representation of Guid.
+ * @param [in]  Length  The length of GuidString.
+ *
+ * @return  TRUE if it succeeds, FALSE if it fails.
+ */
+BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length)
+{
+UNICODE_STRING GuidString_u;
+if(NT_SUCCESS(RtlStringFromGUID(Guid, &GuidString_u)))
+{
+HRESULT hr = StringCchCopyNW(GuidString, Length, GuidString_u.Buffer, 
GuidString_u.Length / 2);
+RtlFreeUnicodeString(&GuidString_u);
+return SUCCEEDED(hr);
+}
+return FALSE;
+}
+
+/**
+ * Checks if the specified GUID is a NULL GUID
+ *
+ * @param [in]  GuidThe GUID to check.
+ *
+ * @return  TRUE if it is a NULL GUID.
+ */
+BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid)
+{
+static GUID NullGuid = { 0 };
+return !Guid || IsEqualGUID(&NullGuid, Guid);
+}
+
+/**
+ * Get the GUID from one of the standard databases.
+ *
+ * @param [in]  Flags   The ID to retrieve the guid from. (See 
SDB_DATABASE_MAIN_[xxx])
+ * @param [out] GuidThe resulting GUID.
+ *
+ * @return

[ros-diffs] [jimtabor] 71231: [User32] - Patch by Herschel Ralston : Fix scroll bar glitch. See CORE-3923 and CORE-11155.

2016-05-01 Thread jimtabor
Author: jimtabor
Date: Mon May  2 02:46:03 2016
New Revision: 71231

URL: http://svn.reactos.org/svn/reactos?rev=71231&view=rev
Log:
[User32]
- Patch by Herschel Ralston : Fix scroll bar glitch. See CORE-3923 and 
CORE-11155.

Modified:
trunk/reactos/win32ss/user/user32/controls/scrollbar.c

Modified: trunk/reactos/win32ss/user/user32/controls/scrollbar.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/controls/scrollbar.c?rev=71231&r1=71230&r2=71231&view=diff
==
--- trunk/reactos/win32ss/user/user32/controls/scrollbar.c  [iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/user/user32/controls/scrollbar.c  [iso-8859-1] 
Mon May  2 02:46:03 2016
@@ -855,6 +855,7 @@
 NewInfo.rgstate[ScrollTrackHitTest] = 
ScrollBarInfo.rgstate[ScrollTrackHitTest];
 NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo);
 
+IntDrawScrollInterior(Wnd,Dc,SBType,Vertical,&ScrollBarInfo);
 IntDrawScrollArrows(Dc, &ScrollBarInfo, Vertical);
 
 break;