[ros-diffs] [jimtabor] 72194: - Fix Desktop hang if no windows open.

2016-08-10 Thread jimtabor
Author: jimtabor
Date: Thu Aug 11 00:29:26 2016
New Revision: 72194

URL: http://svn.reactos.org/svn/reactos?rev=72194=rev
Log:
- Fix Desktop hang if no windows open.

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

Modified: trunk/reactos/win32ss/user/user32/controls/appswitch.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/controls/appswitch.c?rev=72194=72193=72194=diff
==
--- trunk/reactos/win32ss/user/user32/controls/appswitch.c  [iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/user/user32/controls/appswitch.c  [iso-8859-1] 
Thu Aug 11 00:29:26 2016
@@ -312,7 +312,7 @@
ResizeAndCenter(switchdialog, totalW, totalH);
 }
 
-void ProcessHotKey(VOID)
+BOOL ProcessHotKey(VOID)
 {
if (!isOpen)
{
@@ -320,7 +320,7 @@
   EnumWindowsZOrder(EnumerateCallback, 0);
 
   if (windowCount < 2)
- return;
+ return FALSE;
 
   selectedWindow = 1;
 
@@ -335,6 +335,7 @@
   selectedWindow = (selectedWindow + 1)%windowCount;
   InvalidateRect(switchdialog, NULL, TRUE);
}
+   return TRUE;
 }
 
 LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam )
@@ -359,7 +360,7 @@
   case VK_TAB:
  if( !CreateSwitcherWindow(User32Instance) ) goto Exit;
  if( !GetDialogFont() ) goto Exit;
- ProcessHotKey();
+ if( !ProcessHotKey() ) goto Exit;
  break;
 
   case VK_ESCAPE:




[ros-diffs] [tfaber] 72193: [NTOS:FSRTL] - Use the correct parent node when replacing an identical cache entry in FsRtlAddToTunnelCache CORE-11819

2016-08-10 Thread tfaber
Author: tfaber
Date: Wed Aug 10 21:09:50 2016
New Revision: 72193

URL: http://svn.reactos.org/svn/reactos?rev=72193=rev
Log:
[NTOS:FSRTL]
- Use the correct parent node when replacing an identical cache entry in 
FsRtlAddToTunnelCache
CORE-11819

Modified:
trunk/reactos/ntoskrnl/fsrtl/tunnel.c

Modified: trunk/reactos/ntoskrnl/fsrtl/tunnel.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/tunnel.c?rev=72193=72192=72193=diff
==
--- trunk/reactos/ntoskrnl/fsrtl/tunnel.c   [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/tunnel.c   [iso-8859-1] Wed Aug 10 
21:09:50 2016
@@ -467,21 +467,21 @@
  else
  {
   /* update parent node */
-  if (LastEntry->LeftChild == CurEntry)
+  if (RtlIsLeftChild(CurEntry))
   {
-  RtlInsertAsLeftChild(LastEntry, NodeEntry);
+  RtlInsertAsLeftChild(RtlParent(CurEntry), NodeEntry);
   }
   else
   {
-  RtlInsertAsRightChild(LastEntry, NodeEntry);
+  RtlInsertAsRightChild(RtlParent(CurEntry), NodeEntry);
   }
  }
  
  /* remove entry */
- RemoveEntryList(&((PTUNNEL_NODE_ENTRY)LastEntry)->TimerQueueEntry);
+ RemoveEntryList(&((PTUNNEL_NODE_ENTRY)CurEntry)->TimerQueueEntry);
 
  /* free node entry */
- FsRtlFreeTunnelNode((PTUNNEL_NODE_ENTRY)LastEntry, );
+ FsRtlFreeTunnelNode((PTUNNEL_NODE_ENTRY)CurEntry, );
 
  /* decrement node count */
  Cache->NumEntries--;




[ros-diffs] [pschweitzer] 72192: [KMTESTS:FSRTL] Add a stress test for tunnel cache implementation, where we have fun adding duplicated entries. It doesn't seem to go well. These tests are also known

2016-08-10 Thread pschweitzer
Author: pschweitzer
Date: Wed Aug 10 20:50:36 2016
New Revision: 72192

URL: http://svn.reactos.org/svn/reactos?rev=72192=rev
Log:
[KMTESTS:FSRTL]
Add a stress test for tunnel cache implementation, where we have fun adding 
duplicated entries.
It doesn't seem to go well.
These tests are also known as "Learn your English ordinals", or as "Learn how 
to count in English". My pleasure.

CORE-11819

Modified:
trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c

Modified: trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c?rev=72192=72191=72192=diff
==
--- trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c [iso-8859-1] Wed Aug 10 
20:50:36 2016
@@ -121,6 +121,116 @@
 FsRtlDeleteKeyFromTunnelCache(T, a);
 }
 
+static
+void DuplicatesTest()
+{
+UNICODE_STRING ShortName, LongName, OutShort, OutLong, ShortName2, 
LongName2;
+ULONG First, Second, OutLength, OutData;
+PTUNNEL Tunnel;
+PVOID Buffer;
+
+First = 1;
+Second = 2;
+RtlInitUnicodeString(, L"LONGFI~1.TXT");
+RtlInitUnicodeString(, L"Longfilename.txt");
+RtlInitUnicodeString(, L"LONGFI~2.TXT");
+RtlInitUnicodeString(, L"Longfilenamr.txt");
+Tunnel = ExAllocatePool(NonPagedPool, sizeof(TUNNEL));
+RtlZeroMemory(Tunnel, sizeof(TUNNEL));
+OutShort.MaximumLength = 13 * sizeof(WCHAR);
+OutShort.Buffer = ExAllocatePool(PagedPool, OutShort.MaximumLength);
+OutLong.MaximumLength = 17 * sizeof(WCHAR);
+OutLong.Buffer = Buffer = ExAllocatePool(PagedPool, OutLong.MaximumLength);
+
+FsRtlInitializeTunnelCache(Tunnel);
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "First call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+ok_eq_pointer(OutLong.Buffer, Buffer);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Second call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+ok_eq_pointer(OutLong.Buffer, Buffer);
+
+OutLong.MaximumLength = 13 * sizeof(WCHAR);
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Third call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+ok(OutLong.Buffer != Buffer, "Buffer didn't get reallocated!\n");
+ok_eq_uint(OutLong.MaximumLength, 16 * sizeof(WCHAR));
+
+FsRtlDeleteKeyFromTunnelCache(Tunnel, 1);
+ok_bool_false(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Fourth call");
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Fifth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Sixth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Seventh call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Eighth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Ninth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Tenth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Eleventh call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+
+FsRtlDeleteKeyFromTunnelCache(Tunnel, 1);
+ok_bool_false(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Twelfth call");
+ok_bool_false(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Thirteenth call");
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Fourteenth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 1);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Fifteenth call");
+ok_eq_ulong(OutLength, sizeof(ULONG));
+ok_eq_ulong(OutData, 2);
+
+FsRtlAddToTunnelCache(Tunnel, 1, , , TRUE, 
sizeof(ULONG), );
+ok_bool_true(FsRtlFindInTunnelCache(Tunnel, 1, , , 
, , ), "Sixteenth call");
+ok_eq_ulong(OutLength, 

[ros-diffs] [mjansen] 72191: [ATL][ATL_APITEST] Partially implement CRegKey + add tests. CORE-11746

2016-08-10 Thread mjansen
Author: mjansen
Date: Wed Aug 10 19:34:38 2016
New Revision: 72191

URL: http://svn.reactos.org/svn/reactos?rev=72191=rev
Log:
[ATL][ATL_APITEST] Partially implement CRegKey + add tests. CORE-11746

Added:
trunk/rostests/apitests/atl/CRegKey.cpp   (with props)
Modified:
trunk/reactos/sdk/lib/atl/atlbase.cpp
trunk/reactos/sdk/lib/atl/atlbase.h
trunk/rostests/apitests/atl/CMakeLists.txt
trunk/rostests/apitests/atl/testlist.c

Modified: trunk/reactos/sdk/lib/atl/atlbase.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/atl/atlbase.cpp?rev=72191=72190=72191=diff
==
--- trunk/reactos/sdk/lib/atl/atlbase.cpp   [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/atl/atlbase.cpp   [iso-8859-1] Wed Aug 10 
19:34:38 2016
@@ -18,7 +18,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
  */
 
-#include 
 #include "atlbase.h"
 
 namespace ATL

Modified: trunk/reactos/sdk/lib/atl/atlbase.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/atl/atlbase.h?rev=72191=72190=72191=diff
==
--- trunk/reactos/sdk/lib/atl/atlbase.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/atl/atlbase.h [iso-8859-1] Wed Aug 10 19:34:38 2016
@@ -25,6 +25,7 @@
 #include "atlcomcli.h"
 #include "atlalloc.h"
 #include "comcat.h"
+#include "tchar.h"
 
 #ifdef _MSC_VER
 // It is common to use this in ATL constructors. They only store this for 
later use, so the usage is safe.
@@ -886,6 +887,218 @@
 }
 };
 
+class CRegKey
+{
+public:
+HKEY m_hKey;
+
+public:
+
+CRegKey() throw()
+: m_hKey(NULL)
+{
+}
+
+CRegKey(CRegKey& key) throw()
+{
+Attach(key.Detach());
+}
+
+explicit CRegKey(HKEY hKey) throw()
+:m_hKey(hKey)
+{
+}
+
+~CRegKey() throw()
+{
+}
+
+void Attach(HKEY hKey) throw()
+{
+m_hKey = hKey;
+}
+
+LONG Close() throw()
+{
+if (m_hKey)
+{
+HKEY hKey = Detach();
+return RegCloseKey(hKey);
+}
+return ERROR_SUCCESS;
+}
+
+HKEY Detach() throw()
+{
+HKEY hKey = m_hKey;
+m_hKey = NULL;
+return hKey;
+}
+
+LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired = 
KEY_READ | KEY_WRITE) throw()
+{
+HKEY hKey = NULL;
+
+LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, 
);
+if (lRes == ERROR_SUCCESS)
+{
+Close();
+m_hKey = hKey;
+}
+return lRes;
+}
+
+LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass = 
REG_NONE, DWORD dwOptions = REG_OPTION_NON_VOLATILE, REGSAM samDesired = 
KEY_READ | KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr = NULL, LPDWORD 
lpdwDisposition = NULL) throw()
+{
+HKEY hKey = NULL;
+
+LONG lRes = RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass, 
dwOptions, samDesired, lpSecAttr, , lpdwDisposition);
+if (lRes == ERROR_SUCCESS)
+{
+Close();
+m_hKey = hKey;
+}
+return lRes;
+}
+
+
+LONG QueryValue(LPCTSTR pszValueName, DWORD* pdwType, void* pData, ULONG* 
pnBytes) throw()
+{
+return RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, 
(LPBYTE)pData, pnBytes);
+}
+
+LONG QueryDWORDValue(LPCTSTR pszValueName, DWORD& dwValue) throw()
+{
+ULONG size = sizeof(DWORD);
+DWORD type = 0;
+LONG lRet = QueryValue(pszValueName, , , );
+
+if (lRet == ERROR_SUCCESS && type != REG_DWORD)
+lRet = ERROR_INVALID_DATA;
+
+return lRet;
+}
+
+LONG QueryBinaryValue(LPCTSTR pszValueName, void* pValue, ULONG* pnBytes) 
throw()
+{
+DWORD type = 0;
+LONG lRet = QueryValue(pszValueName, , pValue, pnBytes);
+
+if (lRet == ERROR_SUCCESS && type != REG_BINARY)
+lRet = ERROR_INVALID_DATA;
+
+return lRet;
+}
+
+LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* 
pnChars) throw()
+{
+ULONG size = (*pnChars) * sizeof(TCHAR);
+DWORD type = 0;
+LONG lRet = QueryValue(pszValueName, , pszValue, );
+
+if (lRet == ERROR_SUCCESS && type != REG_SZ)
+lRet = ERROR_INVALID_DATA;
+
+*pnChars = size / sizeof(TCHAR);
+return lRet;
+}
+
+LONG QueryGUIDValue(LPCTSTR pszValueName, GUID& guidValue) throw()
+{
+OLECHAR buf[40] = {0};
+ULONG nChars = 39;
+LONG lRet;
+
+#ifdef UNICODE
+lRet = QueryStringValue(pszValueName, buf, );
+#else
+CHAR bufA[40] = {0};
+lRet = QueryStringValue(pszValueName, bufA, );
+if (lRet != ERROR_SUCCESS)
+return lRet;
+if (!::MultiByteToWideChar(CP_THREAD_ACP, 0, bufA, -1, buf, 39))
+  

[ros-diffs] [dchapyshev] 72190: [SDK] - KLF_SHIFTLOCK is not equal 65535. Correct value is 0x00010000

2016-08-10 Thread dchapyshev
Author: dchapyshev
Date: Wed Aug 10 19:05:54 2016
New Revision: 72190

URL: http://svn.reactos.org/svn/reactos?rev=72190=rev
Log:
[SDK]
- KLF_SHIFTLOCK is not equal 65535. Correct value is 0x0001

Modified:
trunk/reactos/sdk/include/psdk/winuser.h

Modified: trunk/reactos/sdk/include/psdk/winuser.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/winuser.h?rev=72190=72189=72190=diff
==
--- trunk/reactos/sdk/include/psdk/winuser.h[iso-8859-1] (original)
+++ trunk/reactos/sdk/include/psdk/winuser.h[iso-8859-1] Wed Aug 10 
19:05:54 2016
@@ -116,7 +116,7 @@
 #define KLF_NOTELLSHELL128
 #define KLF_SETFORPROCESS  256
 #if (_WIN32_WINNT >= 0x0500)
-#define KLF_SHIFTLOCK  65535
+#define KLF_SHIFTLOCK  0x0001
 #define KLF_RESET 0x4000
 #endif  /*(_WIN32_WINNT >= 0x0500) */
 #define KL_NAMELENGTH 9




[ros-diffs] [dchapyshev] 72189: [INPUT] - Draw 0x2022 unicode symbol instead 0x25CF (marking default input method) - Fix incorrect logic in CapsLock parameters - Notice system of change CapsLock mode

2016-08-10 Thread dchapyshev
Author: dchapyshev
Date: Wed Aug 10 19:04:11 2016
New Revision: 72189

URL: http://svn.reactos.org/svn/reactos?rev=72189=rev
Log:
[INPUT]
- Draw 0x2022 unicode symbol instead 0x25CF (marking default input method)
- Fix incorrect logic in CapsLock parameters
- Notice system of change CapsLock mode parameters

Modified:
trunk/reactos/dll/cpl/input/input.h
trunk/reactos/dll/cpl/input/key_settings_dialog.c
trunk/reactos/dll/cpl/input/settings_page.c

Modified: trunk/reactos/dll/cpl/input/input.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.h?rev=72189=72188=72189=diff
==
--- trunk/reactos/dll/cpl/input/input.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input.h [iso-8859-1] Wed Aug 10 19:04:11 2016
@@ -67,6 +67,9 @@
 INT_PTR CALLBACK
 KeySettingsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
+DWORD
+ReadAttributes(VOID);
+
 /* key_sequence_dialog.c */
 INT_PTR CALLBACK
 ChangeKeySeqDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

Modified: trunk/reactos/dll/cpl/input/key_settings_dialog.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/key_settings_dialog.c?rev=72189=72188=72189=diff
==
--- trunk/reactos/dll/cpl/input/key_settings_dialog.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/key_settings_dialog.c   [iso-8859-1] Wed Aug 10 
19:04:11 2016
@@ -10,32 +10,40 @@
 static KEY_SETTINGS _KeySettings = { 0 };
 
 
+DWORD
+ReadAttributes(VOID)
+{
+DWORD dwAttributes = 0;
+HKEY hKey;
+
+if (RegOpenKeyExW(HKEY_CURRENT_USER,
+  L"Keyboard Layout",
+  0,
+  KEY_QUERY_VALUE,
+  ) == ERROR_SUCCESS)
+{
+DWORD dwSize;
+
+dwSize = sizeof(dwSize);
+
+RegQueryValueExW(hKey,
+ L"Attributes",
+ NULL, NULL,
+ (LPBYTE),
+ );
+
+RegCloseKey(hKey);
+}
+
+return dwAttributes;
+}
+
 static VOID
 ReadKeysSettings(VOID)
 {
 HKEY hKey;
 
-if (RegOpenKeyExW(HKEY_CURRENT_USER,
-  L"Keyboard Layout",
-  0,
-  KEY_QUERY_VALUE,
-  ) == ERROR_SUCCESS)
-{
-DWORD dwSize;
-
-dwSize = sizeof(dwSize);
-
-if (RegQueryValueExW(hKey,
- L"Attributes",
- NULL, NULL,
- (LPBYTE)&_KeySettings.dwAttributes,
- ) != ERROR_SUCCESS)
-{
-_KeySettings.dwAttributes = (DWORD) -1;
-}
-
-RegCloseKey(hKey);
-}
+_KeySettings.dwAttributes = ReadAttributes();
 
 if (RegOpenKeyExW(HKEY_CURRENT_USER,
   L"Keyboard Layout\\Toggle",
@@ -126,10 +134,13 @@
(wcslen(szBuffer) + 1) * sizeof(WCHAR));
 
 RegCloseKey(hKey);
-
-/* Notice system of change of parameters */
-SystemParametersInfoW(SPI_SETLANGTOGGLE, 0, NULL, 0);
-}
+}
+
+/* Notice system of change hotkeys parameters */
+SystemParametersInfoW(SPI_SETLANGTOGGLE, 0, NULL, 0);
+
+/* Notice system of change CapsLock mode parameters */
+ActivateKeyboardLayout(GetKeyboardLayout(0), KLF_RESET | 
_KeySettings.dwAttributes);
 }
 
 
@@ -178,20 +189,20 @@
 
 if (_KeySettings.dwAttributes & KLF_SHIFTLOCK)
 {
+CheckDlgButton(hwndDlg, IDC_PRESS_SHIFT_KEY_RB, BST_CHECKED);
+CheckDlgButton(hwndDlg, IDC_PRESS_CL_KEY_RB, BST_UNCHECKED);
+}
+else
+{
 CheckDlgButton(hwndDlg, IDC_PRESS_SHIFT_KEY_RB, BST_UNCHECKED);
 CheckDlgButton(hwndDlg, IDC_PRESS_CL_KEY_RB, BST_CHECKED);
 }
-else
-{
-CheckDlgButton(hwndDlg, IDC_PRESS_SHIFT_KEY_RB, BST_CHECKED);
-CheckDlgButton(hwndDlg, IDC_PRESS_CL_KEY_RB, BST_UNCHECKED);
-}
 
 hwndList = GetDlgItem(hwndDlg, IDC_KEY_LISTVIEW);
 
 ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT);
 
-   ZeroMemory(, sizeof(column));
+ZeroMemory(, sizeof(column));
 
 column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
 
@@ -243,7 +254,7 @@
 
 case IDOK:
 {
-if (IsDlgButtonChecked(hwndDlg, IDC_PRESS_CL_KEY_RB) == 
BST_UNCHECKED)
+if (IsDlgButtonChecked(hwndDlg, IDC_PRESS_CL_KEY_RB) == 
BST_CHECKED)
 {
 _KeySettings.dwAttributes &= ~KLF_SHIFTLOCK;
 }

Modified: trunk/reactos/dll/cpl/input/settings_page.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/settings_page.c?rev=72189=72188=72189=diff
==
--- 

[ros-diffs] [gadamopoulos] 72188: [SHELL32] - Add CRegFolder using the guid item specific functions. So far it is only partly implemented with stuff like enumerating still missing. - Use CRegFolder in

2016-08-10 Thread gadamopoulos
Author: gadamopoulos
Date: Wed Aug 10 18:56:48 2016
New Revision: 72188

URL: http://svn.reactos.org/svn/reactos?rev=72188=rev
Log:
[SHELL32]
- Add CRegFolder using the guid item specific functions. So far it is only 
partly implemented with stuff like enumerating still missing.
- Use CRegFolder in CDesktopFolder, CDrivesFolder and CControlPanelFolder and 
stop using guid item specific functions.

Added:
trunk/reactos/dll/win32/shell32/folders/CRegFolder.cpp   (with props)
Modified:
trunk/reactos/dll/win32/shell32/CMakeLists.txt
trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.h
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.h
trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.h
trunk/reactos/dll/win32/shell32/precomp.h
trunk/reactos/dll/win32/shell32/shfldr.h

Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMakeLists.txt?rev=72188=72187=72188=diff
==
--- trunk/reactos/dll/win32/shell32/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CMakeLists.txt  [iso-8859-1] Wed Aug 10 
18:56:48 2016
@@ -4,7 +4,7 @@
 add_subdirectory(shellmenu)
 add_subdirectory(shellrecyclebin)
 
-set_cpp(WITH_RUNTIME)
+set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
 spec2def(shell32.dll shell32.spec ADD_IMPORTLIB)
 
 if(NOT MSVC)
@@ -53,6 +53,7 @@
 folders/CFontsFolder.cpp
 folders/CControlPanelFolder.cpp
 folders/CRecycleBin.cpp
+folders/CRegFolder.cpp
 droptargets/CexeDropHandler.cpp
 shlexec.cpp
 shlfileop.cpp

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=72188=72187=72188=diff
==
--- trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp 
[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp 
[iso-8859-1] Wed Aug 10 18:56:48 2016
@@ -129,9 +129,7 @@
 {
 PIDLCPanelStruct *pData = _ILGetCPanelPointer(pidl);
 if (!pData)
-{
-return CGuidItemExtractIcon_CreateInstance(psf, pidl, riid, ppvOut);
-}
+return E_FAIL;
 
 CComPtr initIcon;
 HRESULT hr = 
SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit, ));
@@ -305,7 +303,7 @@
 DWORD *pdwAttributes)
 {
 /* We only support parsing guid names */
-return SH_ParseGuidDisplayName(this, hwndOwner, pbc, lpszDisplayName, 
pchEaten, ppidl, pdwAttributes);
+return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, 
pchEaten, ppidl, pdwAttributes);
 }
 
 /**
@@ -325,7 +323,7 @@
 REFIID riid,
 LPVOID *ppvOut)
 {
-return SHELL32_BindToGuidItem(pidlRoot, pidl, pbcReserved, riid, ppvOut);
+return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
 }
 
 /**
@@ -435,7 +433,7 @@
 if (_ILIsCPanelStruct(*apidl))
 *rgfInOut &= SFGAO_CANLINK;
 else if (_ILIsSpecialFolder(*apidl))
-SHELL32_GetGuidItemAttributes(this, *apidl, rgfInOut);
+m_regFolder->GetAttributesOf(1, apidl, rgfInOut);
 else
 ERR("Got an unkown pidl here!\n");
 apidl++;
@@ -492,7 +490,10 @@
 } else if (IsEqualIID(riid, IID_IDataObject) && (cidl >= 1)) {
 hr = IDataObject_Constructor(hwndOwner, pidlRoot, apidl, cidl, 
(IDataObject **));
 } else if ((IsEqualIID(riid, IID_IExtractIconA) || IsEqualIID(riid, 
IID_IExtractIconW)) && (cidl == 1)) {
-hr = CCPLExtractIcon_CreateInstance(this, apidl[0], riid, );
+if (_ILGetCPanelPointer(apidl[0]))
+hr = CCPLExtractIcon_CreateInstance(this, apidl[0], riid, 
);
+else
+hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, 
prgfInOut, );
 } else {
 hr = E_NOINTERFACE;
 }
@@ -522,11 +523,10 @@
 }
 else if (_ILIsSpecialFolder(pidl))
 {
-static const WCHAR* pszCPanelPath = 
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}";
-return SHELL32_GetDisplayNameOfGUIDItem(this, pszCPanelPath, pidl, 
dwFlags, strRet);
-}
-
-return S_OK;
+return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
+}
+
+return E_FAIL;
 }
 
 /**
@@ -597,7 +597,7 @@
 }
 else if 

[ros-diffs] [akhaldi] 72187: [SHIMLIB] Improve header inclusions.

2016-08-10 Thread akhaldi
Author: akhaldi
Date: Wed Aug 10 13:37:22 2016
New Revision: 72187

URL: http://svn.reactos.org/svn/reactos?rev=72187=rev
Log:
[SHIMLIB] Improve header inclusions.

Modified:
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c

Modified: trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c?rev=72187=72186=72187=diff
==
--- trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c [iso-8859-1] Wed Aug 10 
13:37:22 2016
@@ -6,7 +6,8 @@
  * PROGRAMMER:  Mark Jansen
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
 




[ros-diffs] [pschweitzer] 72186: [NTOSKRNL] While attempting to read data from disk in CcReadVirtualAddress(), always align our read size by pages. That means that even on boundaries, we will read a c

2016-08-10 Thread pschweitzer
Author: pschweitzer
Date: Wed Aug 10 11:52:30 2016
New Revision: 72186

URL: http://svn.reactos.org/svn/reactos?rev=72186=rev
Log:
[NTOSKRNL]
While attempting to read data from disk in CcReadVirtualAddress(), always align 
our read size by pages.
That means that even on boundaries, we will read a complete page.
This fixes FSD relying on Cc to properly align reads and thus poorly failing in 
disk.sys because of unaligned reads.
Notably, it helps MS FastFAT loading a bit farther in ReactOS (but it still 
fails :-().
This also fixes a few kmtests.

CORE-11003
CORE-11819

Modified:
trunk/reactos/ntoskrnl/cc/copy.c

Modified: trunk/reactos/ntoskrnl/cc/copy.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/copy.c?rev=72186=72185=72186=diff
==
--- trunk/reactos/ntoskrnl/cc/copy.c[iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/copy.c[iso-8859-1] Wed Aug 10 11:52:30 2016
@@ -65,7 +65,7 @@
 CcReadVirtualAddress (
 PROS_VACB Vacb)
 {
-ULONG Size;
+ULONG Size, Pages;
 PMDL Mdl;
 NTSTATUS Status;
 IO_STATUS_BLOCK IoStatus;
@@ -77,7 +77,10 @@
 Size = VACB_MAPPING_GRANULARITY;
 }
 
-Mdl = IoAllocateMdl(Vacb->BaseAddress, Size, FALSE, FALSE, NULL);
+Pages = BYTES_TO_PAGES(Size);
+ASSERT(Pages * PAGE_SIZE <= VACB_MAPPING_GRANULARITY);
+
+Mdl = IoAllocateMdl(Vacb->BaseAddress, Pages * PAGE_SIZE, FALSE, FALSE, 
NULL);
 if (!Mdl)
 {
 return STATUS_INSUFFICIENT_RESOURCES;




[ros-diffs] [hbelusca] 72185: [INPUT] - Fix misspelling "Dublicate" -> "Duplicate". - Use ZeroMemory instead of memset(..., 0, ...). - Don't hardcode most of the variable types for sizeof.

2016-08-10 Thread hbelusca
Author: hbelusca
Date: Wed Aug 10 11:42:21 2016
New Revision: 72185

URL: http://svn.reactos.org/svn/reactos?rev=72185=rev
Log:
[INPUT]
- Fix misspelling "Dublicate" -> "Duplicate".
- Use ZeroMemory instead of memset(..., 0, ...).
- Don't hardcode most of the variable types for sizeof.

Modified:
trunk/reactos/dll/cpl/input/input.c
trunk/reactos/dll/cpl/input/input.h
trunk/reactos/dll/cpl/input/input_list.c
trunk/reactos/dll/cpl/input/key_settings_dialog.c
trunk/reactos/dll/cpl/input/layout_list.c
trunk/reactos/dll/cpl/input/locale_list.c
trunk/reactos/dll/cpl/input/settings_page.c

Modified: trunk/reactos/dll/cpl/input/input.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.c?rev=72185=72184=72185=diff
==
--- trunk/reactos/dll/cpl/input/input.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input.c [iso-8859-1] Wed Aug 10 11:42:21 2016
@@ -29,9 +29,9 @@
 static VOID
 InitPropSheetPage(PROPSHEETPAGEW *page, WORD idDlg, DLGPROC DlgProc)
 {
-memset(page, 0, sizeof(PROPSHEETPAGEW));
+ZeroMemory(page, sizeof(*page));
 
-page->dwSize  = sizeof(PROPSHEETPAGEW);
+page->dwSize  = sizeof(*page);
 page->dwFlags = PSP_DEFAULT;
 page->hInstance   = hApplet;
 page->pszTemplate = MAKEINTRESOURCEW(idDlg);
@@ -49,13 +49,13 @@
 
 LoadStringW(hApplet, IDS_CPLSYSTEMNAME, szCaption, ARRAYSIZE(szCaption));
 
-memset(, 0, sizeof(PROPSHEETHEADER));
+ZeroMemory(, sizeof(header));
 
-header.dwSize  = sizeof(PROPSHEETHEADER);
+header.dwSize  = sizeof(header);
 header.dwFlags = PSH_PROPSHEETPAGE;
 header.hwndParent  = hCPLWindow;
 header.hInstance   = hApplet;
-header.hIcon   = LoadIconW(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
+header.hIcon   = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
 header.pszCaption  = szCaption;
 header.nPages  = ARRAYSIZE(page);
 header.nStartPage  = 0;

Modified: trunk/reactos/dll/cpl/input/input.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.h?rev=72185=72184=72185=diff
==
--- trunk/reactos/dll/cpl/input/input.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input.h [iso-8859-1] Wed Aug 10 11:42:21 2016
@@ -73,20 +73,20 @@
 
 
 static inline WCHAR*
-DublicateString(const WCHAR *pszString)
+DuplicateString(const WCHAR *pszString)
 {
-WCHAR *pszDublicate;
+WCHAR *pszDuplicate;
 size_t size;
 
 size = (wcslen(pszString) + 1) * sizeof(WCHAR);
 
-pszDublicate = (WCHAR*) malloc(size);
-if (pszDublicate != NULL)
+pszDuplicate = (WCHAR*) malloc(size);
+if (pszDuplicate != NULL)
 {
-StringCbCopyW(pszDublicate, size, pszString);
+StringCbCopyW(pszDuplicate, size, pszString);
 }
 
-return pszDublicate;
+return pszDuplicate;
 }
 
 static inline DWORD

Modified: trunk/reactos/dll/cpl/input/input_list.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input_list.c?rev=72185=72184=72185=diff
==
--- trunk/reactos/dll/cpl/input/input_list.c[iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input_list.c[iso-8859-1] Wed Aug 10 
11:42:21 2016
@@ -23,7 +23,7 @@
 if (pNew == NULL)
 return NULL;
 
-memset(pNew, 0, sizeof(INPUT_LIST_NODE));
+ZeroMemory(pNew, sizeof(INPUT_LIST_NODE));
 
 if (pCurrent == NULL)
 {
@@ -318,7 +318,7 @@
 if (len > 0)
 {
 szIndicator[len - 1] = 0;
-pInput->pszIndicator = DublicateString(szIndicator);
+pInput->pszIndicator = DuplicateString(szIndicator);
 }
 }
 
@@ -447,7 +447,7 @@
 if (len > 0)
 {
 szIndicator[len - 1] = 0;
-pInput->pszIndicator = 
DublicateString(szIndicator);
+pInput->pszIndicator = 
DuplicateString(szIndicator);
 }
 }
 }

Modified: trunk/reactos/dll/cpl/input/key_settings_dialog.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/key_settings_dialog.c?rev=72185=72184=72185=diff
==
--- trunk/reactos/dll/cpl/input/key_settings_dialog.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/key_settings_dialog.c   [iso-8859-1] Wed Aug 10 
11:42:21 2016
@@ -23,7 +23,7 @@
 {
 DWORD dwSize;
 
-dwSize = sizeof(DWORD);
+dwSize = sizeof(dwSize);
 
 if (RegQueryValueExW(hKey,
  L"Attributes",
@@ -142,7 +142,7 @@
 
 ListView_DeleteAllItems(hwndList);
 
-memset(, 0, sizeof(LV_ITEM));
+ZeroMemory(, 

[ros-diffs] [tfaber] 72184: [TCPIP] - Use pool tagging

2016-08-10 Thread tfaber
Author: tfaber
Date: Wed Aug 10 11:19:59 2016
New Revision: 72184

URL: http://svn.reactos.org/svn/reactos?rev=72184=rev
Log:
[TCPIP]
- Use pool tagging

Modified:
trunk/reactos/drivers/network/tcpip/datalink/lan.c
trunk/reactos/drivers/network/tcpip/include/tags.h
trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c

Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/datalink/lan.c?rev=72184=72183=72184=diff
==
--- trunk/reactos/drivers/network/tcpip/datalink/lan.c  [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/datalink/lan.c  [iso-8859-1] Wed Aug 10 
11:19:59 2016
@@ -138,8 +138,9 @@
 ULONG BytesCopied;
 NDIS_STATUS Status;
 
-HeaderBuffer = ExAllocatePool(NonPagedPool,
-  Adapter->HeaderSize);
+HeaderBuffer = ExAllocatePoolWithTag(NonPagedPool,
+ Adapter->HeaderSize,
+ HEADER_TAG);
 if (!HeaderBuffer)
 return NDIS_STATUS_RESOURCES;
 
@@ -151,7 +152,7 @@
 if (BytesCopied != Adapter->HeaderSize)
 {
 /* Runt frame */
-ExFreePool(HeaderBuffer);
+ExFreePoolWithTag(HeaderBuffer, HEADER_TAG);
 TI_DbgPrint(DEBUG_DATALINK, ("Runt frame (size %d).\n", BytesCopied));
 return NDIS_STATUS_NOT_ACCEPTED;
 }
@@ -161,7 +162,7 @@
BytesCopied,
PacketType);
 
-ExFreePool(HeaderBuffer);
+ExFreePoolWithTag(HeaderBuffer, HEADER_TAG);
 
 return Status;
 }
@@ -607,7 +608,7 @@
 }
 else
 {
-KeyValueInfo = ExAllocatePool(PagedPool, 
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 16 * sizeof(WCHAR));
+KeyValueInfo = ExAllocatePoolWithTag(PagedPool, 
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 16 * sizeof(WCHAR), KEY_VALUE_TAG);
 if (!KeyValueInfo)
 {
 ZwClose(ParameterHandle);
@@ -696,6 +697,7 @@
 }
 }
 
+ExFreePoolWithTag(KeyValueInfo, KEY_VALUE_TAG);
 ZwClose(ParameterHandle);
 }
 
@@ -823,7 +825,7 @@
 if (!Adapter->Context)
 return;
 
-Context = ExAllocatePool(NonPagedPool, sizeof(RECONFIGURE_CONTEXT));
+Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(RECONFIGURE_CONTEXT), 
CONTEXT_TAG);
 if (!Context)
 return;
 
@@ -836,7 +838,7 @@
 
 if (Adapter->State == LAN_STATE_STARTED)
 {
-ExFreePool(Context);
+ExFreePoolWithTag(Context, CONTEXT_TAG);
 return;
 }
 
@@ -848,7 +850,7 @@
 
 if (Adapter->State == LAN_STATE_STOPPED)
 {
-ExFreePool(Context);
+ExFreePoolWithTag(Context, CONTEXT_TAG);
 return;
 }
 
@@ -859,7 +861,7 @@
 Adapter->OldState = Adapter->State;
 Adapter->State = LAN_STATE_RESETTING;
 /* Nothing else to do here */
-ExFreePool(Context);
+ExFreePoolWithTag(Context, CONTEXT_TAG);
 return;
 
 case NDIS_STATUS_RESET_END:
@@ -869,13 +871,13 @@
 
 default:
 DbgPrint("Unhandled status: %x", GeneralStatus);
-ExFreePool(Context);
+ExFreePoolWithTag(Context, CONTEXT_TAG);
 return;
 }
 
 /* Queue the work item */
 if (!ChewCreate(ReconfigureAdapterWorker, Context))
-ExFreePool(Context);
+ExFreePoolWithTag(Context, CONTEXT_TAG);
 }
 
 VOID NTAPI ProtocolStatusComplete(NDIS_HANDLE NdisBindingContext)
@@ -1108,8 +1110,8 @@
 UnicodeString.MaximumLength = Information->DataLength;
 
 String->Buffer =
-   (PWCHAR)ExAllocatePool( NonPagedPool,
-   UnicodeString.MaximumLength + sizeof(WCHAR) );
+   (PWCHAR)ExAllocatePoolWithTag( NonPagedPool,
+   UnicodeString.MaximumLength + sizeof(WCHAR), 
REG_STR_TAG );
 
 if( !String->Buffer ) return STATUS_NO_MEMORY;
 
@@ -1135,9 +1137,9 @@
   BOOLEAN Deallocate) {
 NTSTATUS Status;
 UNICODE_STRING Ustr = *ResultFirst;
-PWSTR new_string = ExAllocatePool
+PWSTR new_string = ExAllocatePoolWithTag
 (PagedPool,
- (ResultFirst->Length + Second->Length + sizeof(WCHAR)));
+ (ResultFirst->Length + Second->Length + sizeof(WCHAR)), 
TEMP_STRING_TAG);
 if( !new_string ) {
return STATUS_NO_MEMORY;
 }
@@ -1150,7 +1152,7 @@
 new_string[ResultFirst->Length / sizeof(WCHAR)] = 0;
 Status = RtlCreateUnicodeString(ResultFirst,new_string) ?
STATUS_SUCCESS : STATUS_NO_MEMORY;
-ExFreePool(new_string);
+

[ros-diffs] [tfaber] 72183: [IP] - Only accept an incoming connection on one listening socket, not all. Fixes use after free when multiple connection endpoints are assigned the same PCB. CORE-11649 #r

2016-08-10 Thread tfaber
Author: tfaber
Date: Wed Aug 10 10:28:28 2016
New Revision: 72183

URL: http://svn.reactos.org/svn/reactos?rev=72183=rev
Log:
[IP]
- Only accept an incoming connection on one listening socket, not all. Fixes 
use after free when multiple connection endpoints are assigned the same PCB.
CORE-11649 #resolve

Modified:
trunk/reactos/sdk/lib/drivers/ip/transport/tcp/event.c

Modified: trunk/reactos/sdk/lib/drivers/ip/transport/tcp/event.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/ip/transport/tcp/event.c?rev=72183=72182=72183=diff
==
--- trunk/reactos/sdk/lib/drivers/ip/transport/tcp/event.c  [iso-8859-1] 
(original)
+++ trunk/reactos/sdk/lib/drivers/ip/transport/tcp/event.c  [iso-8859-1] 
Wed Aug 10 10:28:28 2016
@@ -345,6 +345,11 @@
 DereferenceObject(Bucket->AssociatedEndpoint);
 
 CompleteBucket(Connection, Bucket, FALSE);
+
+if (Status == STATUS_SUCCESS)
+{
+break;
+}
 }
 
 DereferenceObject(Connection);




[ros-diffs] [pschweitzer] 72182: [KMTESTS:CC] New test case which is matching the MS FastFAT CcCopyRead (minus the offset) and shows clearly the issue in our Cc. It also shows that my hack is utterly

2016-08-10 Thread pschweitzer
Author: pschweitzer
Date: Wed Aug 10 07:39:20 2016
New Revision: 72182

URL: http://svn.reactos.org/svn/reactos?rev=72182=rev
Log:
[KMTESTS:CC]
New test case which is matching the MS FastFAT CcCopyRead (minus the offset) 
and shows clearly the issue in our Cc.
It also shows that my hack is utterly broken :-).

CORE-11003
CORE-11819

Modified:
trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c

Modified: trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c?rev=72182=72181=72182=diff
==
--- trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c [iso-8859-1] Wed Aug 10 
07:39:20 2016
@@ -194,6 +194,13 @@
 Fcb->Header.AllocationSize.QuadPart = 1004;
 Fcb->Header.FileSize.QuadPart = 1004;
 Fcb->Header.ValidDataLength.QuadPart = 1004;
+}
+else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
+ IoStack->FileObject->FileName.Buffer[1] == 'R')
+{
+Fcb->Header.AllocationSize.QuadPart = 62;
+Fcb->Header.FileSize.QuadPart = 62;
+Fcb->Header.ValidDataLength.QuadPart = 62;
 }
 else
 {
@@ -262,7 +269,7 @@
 }
 else
 {
-ok(Offset.QuadPart % PAGE_SIZE == 0, "Offset is not aligned: 
%I64i\n", Offset.QuadPart);
+ok((Offset.QuadPart % PAGE_SIZE == 0 || Offset.QuadPart == 0), 
"Offset is not aligned: %I64i\n", Offset.QuadPart);
 ok(Length % PAGE_SIZE == 0, "Length is not aligned: %I64i\n", 
Length);
 
 ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was 
allocated!\n");

Modified: trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c?rev=72182=72181=72182=diff
==
--- trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c[iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c[iso-8859-1] Wed Aug 10 
07:39:20 2016
@@ -17,6 +17,7 @@
 PVOID Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, 1024);
 UNICODE_STRING BigAlignmentTest = 
RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\BigAlignmentTest");
 UNICODE_STRING SmallAlignmentTest = 
RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\SmallAlignmentTest");
+UNICODE_STRING ReallySmallAlignmentTest = 
RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\ReallySmallAlignmentTest");
 
 KmtLoadDriver(L"CcCopyRead", FALSE);
 KmtOpenDriver();
@@ -77,6 +78,17 @@
 
 NtClose(Handle);
 
+InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
+Status = NtOpenFile(, FILE_ALL_ACCESS, , 
, 0, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
+ok_eq_hex(Status, STATUS_SUCCESS);
+
+ByteOffset.QuadPart = 1;
+Status = NtReadFile(Handle, NULL, NULL, NULL, , Buffer, 61, 
, NULL);
+ok_eq_hex(Status, STATUS_SUCCESS);
+ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
+
+NtClose(Handle);
+
 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
 KmtCloseDriver();
 KmtUnloadDriver();