[ros-diffs] [mjansen] 75965: [WINED3D] Silence a noisy DPRINT that makes Test KVM AHK abort. CORE-13829

2017-09-24 Thread mjansen
Author: mjansen
Date: Sun Sep 24 21:32:18 2017
New Revision: 75965

URL: http://svn.reactos.org/svn/reactos?rev=75965=rev
Log:
[WINED3D] Silence a noisy DPRINT that makes Test KVM AHK abort.
CORE-13829

Modified:
trunk/reactos/dll/directx/wine/wined3d/palette.c

Modified: trunk/reactos/dll/directx/wine/wined3d/palette.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/wined3d/palette.c?rev=75965=75964=75965=diff
==
--- trunk/reactos/dll/directx/wine/wined3d/palette.c[iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/wined3d/palette.c[iso-8859-1] Sun Sep 24 
21:32:18 2017
@@ -85,7 +85,15 @@
 void CDECL wined3d_palette_apply_to_dc(const struct wined3d_palette *palette, 
HDC dc)
 {
 if (SetDIBColorTable(dc, 0, 256, palette->colors) != 256)
+#ifdef __REACTOS__
+{
+static int warn_once;
+if (!warn_once++)
+ERR("Failed to set DIB color table. (Only printing once)\n");
+}
+#else
 ERR("Failed to set DIB color table.\n");
+#endif
 }
 
 HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette,




[ros-diffs] [mjansen] 75928: [USER32][WIN32K] Make antialiased disabled font readable. Patch by Katayama Hirofumi MZ. CORE-7721

2017-09-22 Thread mjansen
Author: mjansen
Date: Fri Sep 22 19:47:34 2017
New Revision: 75928

URL: http://svn.reactos.org/svn/reactos?rev=75928=rev
Log:
[USER32][WIN32K] Make antialiased disabled font readable. Patch by Katayama 
Hirofumi MZ. CORE-7721

Modified:
trunk/reactos/win32ss/gdi/ntgdi/font.h
trunk/reactos/win32ss/gdi/ntgdi/freetype.c
trunk/reactos/win32ss/user/user32/windows/draw.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/font.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/font.h?rev=75928=75927=75928=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/font.h  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/font.h  [iso-8859-1] Fri Sep 22 
19:47:34 2017
@@ -29,6 +29,7 @@
 FT_Face Face;
 FT_BitmapGlyph BitmapGlyph;
 int Height;
+FT_Render_Mode RenderMode;
 MATRIX mxWorldToDevice;
 } FONT_CACHE_ENTRY, *PFONT_CACHE_ENTRY;
 

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=75928=75927=75928=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Fri Sep 22 
19:47:34 2017
@@ -1392,6 +1392,7 @@
 switch (logfont->lfQuality)
 {
 case ANTIALIASED_QUALITY:
+break;
 case NONANTIALIASED_QUALITY:
 return FT_RENDER_MODE_MONO;
 case DRAFT_QUALITY:
@@ -2608,6 +2609,7 @@
 FT_Face Face,
 INT GlyphIndex,
 INT Height,
+FT_Render_Mode RenderMode,
 PMATRIX pmx)
 {
 PLIST_ENTRY CurrentEntry;
@@ -2622,6 +2624,7 @@
 if ((FontEntry->Face == Face) &&
 (FontEntry->GlyphIndex == GlyphIndex) &&
 (FontEntry->Height == Height) &&
+(FontEntry->RenderMode == RenderMode) &&
 (SameScaleMatrix(>mxWorldToDevice, pmx)))
 break;
 CurrentEntry = CurrentEntry->Flink;
@@ -2737,6 +2740,7 @@
 NewEntry->Face = Face;
 NewEntry->BitmapGlyph = BitmapGlyph;
 NewEntry->Height = Height;
+NewEntry->RenderMode = RenderMode;
 NewEntry->mxWorldToDevice = *pmx;
 
 InsertHeadList(, >ListEntry);
@@ -3589,7 +3593,6 @@
 else
 RenderMode = FT_RENDER_MODE_MONO;
 
-
 /* Get the DC's world-to-device transformation matrix */
 pmxWorldToDevice = DC_pmxWorldToDevice(dc);
 FtSetCoordinateTransform(face, pmxWorldToDevice);
@@ -3607,8 +3610,8 @@
 if (EmuBold || EmuItalic)
 realglyph = NULL;
 else
-realglyph = ftGdiGlyphCacheGet(face, glyph_index,
-   plf->lfHeight, pmxWorldToDevice);
+realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
+   RenderMode, pmxWorldToDevice);
 
 if (EmuBold || EmuItalic || !realglyph)
 {
@@ -5320,8 +5323,8 @@
 if (EmuBold || EmuItalic)
 realglyph = NULL;
 else
-realglyph = ftGdiGlyphCacheGet(face, glyph_index,
-   plf->lfHeight, 
pmxWorldToDevice);
+realglyph = ftGdiGlyphCacheGet(face, glyph_index, 
plf->lfHeight,
+   RenderMode, pmxWorldToDevice);
 if (!realglyph)
 {
 error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
@@ -5543,8 +5546,8 @@
 if (EmuBold || EmuItalic)
 realglyph = NULL;
 else
-realglyph = ftGdiGlyphCacheGet(face, glyph_index,
-   plf->lfHeight, pmxWorldToDevice);
+realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
+   RenderMode, pmxWorldToDevice);
 if (!realglyph)
 {
 error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);

Modified: trunk/reactos/win32ss/user/user32/windows/draw.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows/draw.c?rev=75928=75927=75928=diff
==
--- trunk/reactos/win32ss/user/user32/windows/draw.c[iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/draw.c[iso-8859-1] Fri Sep 22 
19:47:34 2017
@@ -6,6 +6,7 @@
  * Copyright 2003 Andrew Greenwood
  * Copyright 2003 Filip Navara
  * Copyright 2009 Matthias Kupfer
+ * Copyright 2017 Katayama Hirofumi MZ
  *
  * Based on Wine code.
  *
@@ -1242,6 +1243,8 @@
 UINT opcode = flags & 0xf;
 INT len = wp;
 BOOL retval, tmp;
+LOGFONTW lf;
+HFONT hFontOriginal, hNaaFont = NULL;
 
 if((opcode == DST_TEXT || opcode =

[ros-diffs] [mjansen] 75927: [ACPPAGE] Work around a crash with BSTR's. CORE-13800 #resolve

2017-09-22 Thread mjansen
Author: mjansen
Date: Fri Sep 22 19:42:08 2017
New Revision: 75927

URL: http://svn.reactos.org/svn/reactos?rev=75927=rev
Log:
[ACPPAGE] Work around a crash with BSTR's. CORE-13800 #resolve

Modified:
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp

Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp?rev=75927=75926=75927=diff
==
--- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
Fri Sep 22 19:42:08 2017
@@ -494,7 +494,7 @@
 
 while (TRUE)
 {
-CComBSTR str;
+CComHeapPtr str;
 HRESULT hr = pList.Next(1, , NULL);
 if (hr != S_OK)
 break;




[ros-diffs] [mjansen] 75839: [LIBTIRPC] Do not add makefiles in the CMakeLists.txt

2017-09-14 Thread mjansen
Author: mjansen
Date: Thu Sep 14 20:31:53 2017
New Revision: 75839

URL: http://svn.reactos.org/svn/reactos?rev=75839=rev
Log:
[LIBTIRPC] Do not add makefiles in the CMakeLists.txt

Modified:
trunk/reactos/dll/3rdparty/libtirpc/CMakeLists.txt

Modified: trunk/reactos/dll/3rdparty/libtirpc/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libtirpc/CMakeLists.txt?rev=75839=75838=75839=diff
==
--- trunk/reactos/dll/3rdparty/libtirpc/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/3rdparty/libtirpc/CMakeLists.txt  [iso-8859-1] Thu Sep 14 
20:31:53 2017
@@ -40,8 +40,8 @@
 src/key_call.c
 src/key_prot_xdr.c
 src/libtirpc.def
-src/makefile
-src/Makefile.am
+#src/makefile
+#src/Makefile.am
 src/mt_misc.c
 src/netname.c
 src/netnamer.c




[ros-diffs] [mjansen] 75803: [APPHELP_APITEST][APPSHIM_APITEST] Update the license headers

2017-09-08 Thread mjansen
Author: mjansen
Date: Fri Sep  8 20:33:40 2017
New Revision: 75803

URL: http://svn.reactos.org/svn/reactos?rev=75803=rev
Log:
[APPHELP_APITEST][APPSHIM_APITEST] Update the license headers

Modified:
trunk/rostests/apitests/apphelp/apphelp.c
trunk/rostests/apitests/apphelp/data.c
trunk/rostests/apitests/apphelp/db.cpp
trunk/rostests/apitests/apphelp/env.c
trunk/rostests/apitests/apphelp/layerapi.c
trunk/rostests/apitests/appshim/dispmode.c
trunk/rostests/apitests/appshim/versionlie.c

Modified: trunk/rostests/apitests/apphelp/apphelp.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp.c?rev=75803=75802=75803=diff
==
--- trunk/rostests/apitests/apphelp/apphelp.c   [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/apphelp.c   [iso-8859-1] Fri Sep  8 
20:33:40 2017
@@ -1,23 +1,11 @@
 /*
- * Copyright 2012 Detlef Riekenberg
- * Copyright 2013 Mislav Blažević
- * Copyright 2015,2016 Mark Jansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ * PROJECT: apphelp_apitest
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Misc apphelp tests
+ * COPYRIGHT:   Copyright 2012 Detlef Riekenberg
+ *  Copyright 2013 Mislav Blažević
+ *  Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  */
-
 
 #include 
 #define WIN32_NO_STATUS

Modified: trunk/rostests/apitests/apphelp/data.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/data.c?rev=75803=75802=75803=diff
==
--- trunk/rostests/apitests/apphelp/data.c  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/data.c  [iso-8859-1] Fri Sep  8 
20:33:40 2017
@@ -1,19 +1,8 @@
 /*
- * Copyright 2015,2016 Mark Jansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ * PROJECT: apphelp_apitest
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Common data / functions for apphelp_apitest
+ * COPYRIGHT:   Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
 #include 

Modified: trunk/rostests/apitests/apphelp/db.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.cpp?rev=75803=75802=75803=diff
==
--- trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] Fri Sep  8 
20:33:40 2017
@@ -1,23 +1,11 @@
 /*
- * Copyright 2012 Detlef Riekenberg
- * Copyright 2013 Mislav Blažević
- * Copyright 2015-2017 Mark Jansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ * PROJECT: apphelp_apitest
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE

[ros-diffs] [mjansen] 75802: [XML2SDB][SHIMDBG] Update license headers

2017-09-08 Thread mjansen
Author: mjansen
Date: Fri Sep  8 20:31:28 2017
New Revision: 75802

URL: http://svn.reactos.org/svn/reactos?rev=75802=rev
Log:
[XML2SDB][SHIMDBG] Update license headers

Modified:
trunk/reactos/sdk/tools/xml2sdb/main.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
trunk/rosapps/applications/devutils/shimdbg/shimdbg.c

Modified: trunk/reactos/sdk/tools/xml2sdb/main.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/main.cpp?rev=75802=75801=75802=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] Fri Sep  8 
20:31:28 2017
@@ -1,10 +1,8 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS xml to sdb converter
- * FILE:sdk/tools/xml2sdb/main.cpp
- * PURPOSE: Implement platform agnostic read / write / allocation 
functions, parse commandline
- * PROGRAMMERS: Mark Jansen (mark.jan...@reactos.org)
- *
+ * PROJECT: xml2sdb
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Implement platform agnostic read / write / allocation 
functions, parse commandline
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
 #include "xml2sdb.h"

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp?rev=75802=75801=75802=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] Fri Sep  8 
20:31:28 2017
@@ -1,10 +1,8 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS xml to sdb converter
- * FILE:sdk/tools/xml2sdb/xml2sdb.cpp
- * PURPOSE: Conversion functions from xml -> db
- * PROGRAMMERS: Mark Jansen (mark.jan...@reactos.org)
- *
+ * PROJECT: xml2sdb
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Conversion functions from xml -> db
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
 #include "xml2sdb.h"

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h?rev=75802=75801=75802=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] Fri Sep  8 
20:31:28 2017
@@ -1,3 +1,10 @@
+/*
+ * PROJECT: xml2sdb
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: .
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
+ */
+
 #pragma once
 
 #include 

Modified: trunk/rosapps/applications/devutils/shimdbg/shimdbg.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/shimdbg/shimdbg.c?rev=75802=75801=75802=diff
==
--- trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
(original)
+++ trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
Fri Sep  8 20:31:28 2017
@@ -1,8 +1,8 @@
 /*
- * PROJECT: shimdbg utility for WINE and ReactOS
- * LICENSE: BSD - See COPYING.ARM in the top level directory
- * PURPOSE: Test tool for SHIM engine caching.
- * PROGRAMMER:  Mark Jansen
+ * PROJECT: shimdbg
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Test tool for SHIM engine caching
+ * COPYRIGHT:   Copyright 2016-2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
 #include 




[ros-diffs] [mjansen] 75801: [ACLAYERS][ACGENRAL] Update license headers + include cleanup.

2017-09-08 Thread mjansen
Author: mjansen
Date: Fri Sep  8 20:29:16 2017
New Revision: 75801

URL: http://svn.reactos.org/svn/reactos?rev=75801=rev
Log:
[ACLAYERS][ACGENRAL] Update license headers + include cleanup.

Modified:
trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c
trunk/reactos/dll/appcompat/shims/genral/main.c
trunk/reactos/dll/appcompat/shims/genral/themes.c
trunk/reactos/dll/appcompat/shims/layer/dispmode.c
trunk/reactos/dll/appcompat/shims/layer/main.c
trunk/reactos/dll/appcompat/shims/layer/versionlie.c
trunk/reactos/dll/appcompat/shims/layer/versionlie.inl
trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c

Modified: trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c?rev=75801=75800=75801=diff
==
--- trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c [iso-8859-1] 
(original)
+++ trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c [iso-8859-1] 
Fri Sep  8 20:29:16 2017
@@ -1,12 +1,13 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS Shim library
- * FILE:dll/appcompat/shims/genral/ignoredbgout.c
- * PURPOSE: Ignore debug output shim
- * PROGRAMMER:  Mark Jansen
+ * PROJECT: ReactOS 'General' Shim library
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Ignore debug output shim
+ * COPYRIGHT:   Copyright 2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
-#include 
+#define WIN32_NO_STATUS
+#include 
+#include 
 #include 
 #include 
 

Modified: trunk/reactos/dll/appcompat/shims/genral/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral/main.c?rev=75801=75800=75801=diff
==
--- trunk/reactos/dll/appcompat/shims/genral/main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/genral/main.c [iso-8859-1] Fri Sep  8 
20:29:16 2017
@@ -1,12 +1,13 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS Shim library
- * FILE:dll/appcompat/shims/genral/main.c
- * PURPOSE: Shim entrypoint
- * PROGRAMMER:  Mark Jansen
+ * PROJECT: ReactOS 'General' Shim library
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Shim entrypoint
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
-#include 
+#define WIN32_NO_STATUS
+#include 
+#include 
 #include 
 #include 
 

Modified: trunk/reactos/dll/appcompat/shims/genral/themes.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral/themes.c?rev=75801=75800=75801=diff
==
--- trunk/reactos/dll/appcompat/shims/genral/themes.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/genral/themes.c   [iso-8859-1] Fri Sep  8 
20:29:16 2017
@@ -1,12 +1,15 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS Shim library
- * FILE:dll/appcompat/shims/genral/themes.c
- * PURPOSE: Theme related shims
- * PROGRAMMER:  Mark Jansen (mark.jan...@reactos.org)
+ * PROJECT: ReactOS 'General' Shim library
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Theme related shims
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
-#include 
+#define WIN32_NO_STATUS
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 

Modified: trunk/reactos/dll/appcompat/shims/layer/dispmode.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/layer/dispmode.c?rev=75801=75800=75801=diff
==
--- trunk/reactos/dll/appcompat/shims/layer/dispmode.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/layer/dispmode.c  [iso-8859-1] Fri Sep  8 
20:29:16 2017
@@ -1,14 +1,16 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS Shim library
- * FILE:dll/appcompat/shims/layer/dispmode.c
- * PURPOSE: Display settings related shims
- * PROGRAMMER:  Mark Jansen
+ * PROJECT: ReactOS 'Layers' Shim library
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Display settings related shims
+ * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
-#include 
+#define WIN32_NO_STATUS
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
 
 
 #define SHIM_NS Force8BitColor

Modified: trunk/reactos/dll/appcompat/shims/layer/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/layer/main.c?rev=75801=75800=75801=diff

[ros-diffs] [mjansen] 75799: [APPHELP][ACPPAGE][SHIMLIB] Update license headers

2017-09-08 Thread mjansen
Author: mjansen
Date: Fri Sep  8 20:19:51 2017
New Revision: 75799

URL: http://svn.reactos.org/svn/reactos?rev=75799=rev
Log:
[APPHELP][ACPPAGE][SHIMLIB] Update license headers

Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/apphelp.c
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/dbgheap.c
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/layer.c
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c
trunk/reactos/dll/appcompat/apphelp/sdbpapi.h
trunk/reactos/dll/appcompat/apphelp/sdbread.c
trunk/reactos/dll/appcompat/apphelp/sdbstringtable.c
trunk/reactos/dll/appcompat/apphelp/sdbstringtable.h
trunk/reactos/dll/appcompat/apphelp/sdbtagid.h
trunk/reactos/dll/appcompat/apphelp/sdbtypes.h
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
trunk/reactos/dll/appcompat/apphelp/sdbwrite.h
trunk/reactos/dll/appcompat/apphelp/shimeng.c
trunk/reactos/dll/appcompat/apphelp/shimeng.h
trunk/reactos/dll/appcompat/shims/shimlib/implement_shim.inl
trunk/reactos/dll/appcompat/shims/shimlib/setup_shim.inl
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h
trunk/reactos/dll/shellext/acppage/ACPPage.cpp
trunk/reactos/dll/shellext/acppage/CLayerStringList.hpp
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.hpp

Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt?rev=75799=75798=75799=diff
==
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] Fri Sep  8 
20:19:51 2017
@@ -19,11 +19,20 @@
 sdbwrite.c
 shimeng.c
 apphelp.spec
+${CMAKE_CURRENT_BINARY_DIR}/apphelp_stubs.c)
+
+list(APPEND HEADERS
 apphelp.h
-${CMAKE_CURRENT_BINARY_DIR}/apphelp_stubs.c)
+sdbpapi.h
+sdbstringtable.h
+sdbtagid.h
+sdbtypes.h
+sdbwrite.h
+shimeng.h)
 
 add_library(apphelp SHARED
 ${SOURCE}
+${HEADERS}
 apphelp.rc
 ${CMAKE_CURRENT_BINARY_DIR}/apphelp.def)
 

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.c?rev=75799=75798=75799=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.c   [iso-8859-1] Fri Sep  8 
20:19:51 2017
@@ -1,21 +1,10 @@
 /*
- * Copyright 2011 André Hentschel
- * Copyright 2013 Mislav Blažević
- * Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ * PROJECT: ReactOS Application compatibility module
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: apphelp entrypoint / generic interface functions
+ * COPYRIGHT:   Copyright 2011 André Hentschel
+ *  Copyright 2013 Mislav Blaževic
+ *  Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  */
 
 #define WIN32_NO_STATUS

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=75799=75798=75799=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Fri Sep  8 
20:19:51 2017
@@ -1,20 +1,9 @@
 /*
- * Copyright 2013 Mislav Blažević
- * Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version

[ros-diffs] [mjansen] 75781: [SDK] Allow version lie shims to be applied to msi.dll

2017-09-07 Thread mjansen
Author: mjansen
Date: Thu Sep  7 16:46:33 2017
New Revision: 75781

URL: http://svn.reactos.org/svn/reactos?rev=75781=rev
Log:
[SDK] Allow version lie shims to be applied to msi.dll

Modified:
trunk/reactos/media/sdb/sysmain.xml

Modified: trunk/reactos/media/sdb/sysmain.xml
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/sdb/sysmain.xml?rev=75781=75780=75781=diff
==
--- trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] (original)
+++ trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] Thu Sep  7 16:46:33 2017
@@ -13,6 +13,7 @@
 
 
 
+
 
 
 
@@ -21,6 +22,7 @@
 
 
 
+
 
 
 
@@ -29,6 +31,7 @@
 
 
 
+
 
 
 
@@ -37,6 +40,7 @@
 
 
 
+
 
 
 
@@ -45,6 +49,7 @@
 
 
 
+
 
 
 
@@ -53,6 +58,7 @@
 
 
 
+
 
 
 
@@ -61,6 +67,7 @@
 
 
 
+
 
 
 
@@ -69,6 +76,7 @@
 
 
 
+
 
 
 
@@ -77,6 +85,7 @@
 
 
 
+
 
 
 
@@ -85,6 +94,7 @@
 
 
 
+
 
 
 
@@ -93,6 +103,7 @@
 
 
 
+
 
 
 
@@ -101,6 +112,7 @@
 
 
 
+
 
 
 
@@ -109,6 +121,7 @@
 
 
 
+
 
 
 
@@ -117,6 +130,7 @@
 
 
 
+
 
 
 
@@ -125,6 +139,7 @@
 
 
 
+
 
 
 
@@ -133,6 +148,7 @@
 
 
 
+
 
 
 
@@ -141,6 +157,7 @@
 
 
 
+
 
 
 
@@ -149,6 +166,7 @@
 
 
 
+
 
 
 




[ros-diffs] [mjansen] 75731: [SHIMENG] Fix logging when handling ordinal ordinal functions.

2017-09-01 Thread mjansen
Author: mjansen
Date: Fri Sep  1 19:06:04 2017
New Revision: 75731

URL: http://svn.reactos.org/svn/reactos?rev=75731=rev
Log:
[SHIMENG] Fix logging when handling ordinal ordinal functions.

Modified:
trunk/reactos/dll/appcompat/apphelp/shimeng.c

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75731=75730=75731=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Fri Sep  1 
19:06:04 2017
@@ -580,7 +580,7 @@
 return proc;
 }
 
-SHIMENG_MSG("(GetProcAddress(%p!%s) => %p\n", hModule, lpProcName, 
lpPrintName);
+SHIMENG_MSG("(GetProcAddress(%p!%s) => %p\n", hModule, lpPrintName, proc);
 
 HookModuleInfo = SeiFindHookModuleInfo(NULL, hModule);
 




[ros-diffs] [mjansen] 75730: [SERVICES] Allow CreateService to create an interactive service under the LocalSystem account. MSDN stated that this is allowed, and this fixes VMWare Horizon setup not wo

2017-09-01 Thread mjansen
Author: mjansen
Date: Fri Sep  1 18:27:40 2017
New Revision: 75730

URL: http://svn.reactos.org/svn/reactos?rev=75730=rev
Log:
[SERVICES] Allow CreateService to create an interactive service under the 
LocalSystem account.
MSDN stated that this is allowed, and this fixes VMWare Horizon setup not 
working.
CORE-13434

Modified:
trunk/reactos/base/system/services/rpcserver.c

Modified: trunk/reactos/base/system/services/rpcserver.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcserver.c?rev=75730=75729=75730=diff
==
--- trunk/reactos/base/system/services/rpcserver.c  [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c  [iso-8859-1] Fri Sep  1 
18:27:40 2017
@@ -2192,7 +2192,11 @@
 if ((dwServiceType == (SERVICE_WIN32_OWN_PROCESS | 
SERVICE_INTERACTIVE_PROCESS)) &&
 (lpServiceStartName))
 {
-return ERROR_INVALID_PARAMETER;
+/* We allow LocalSystem to run interactive. */
+if (wcsicmp(lpServiceStartName, L"LocalSystem"))
+{
+return ERROR_INVALID_PARAMETER;
+}
 }
 
 if (lpdwTagId && (!lpLoadOrderGroup || !*lpLoadOrderGroup))




[ros-diffs] [mjansen] 75621: [WINED3D] Dereference context slightly later, as seen in wine. This prevents some crashes while applications are starting up. (f.e. ANNO1602)

2017-08-19 Thread mjansen
Author: mjansen
Date: Sat Aug 19 09:51:17 2017
New Revision: 75621

URL: http://svn.reactos.org/svn/reactos?rev=75621=rev
Log:
[WINED3D] Dereference context slightly later, as seen in wine. This prevents 
some crashes while applications are starting up. (f.e. ANNO1602)

Modified:
trunk/reactos/dll/directx/wine/wined3d/context.c

Modified: trunk/reactos/dll/directx/wine/wined3d/context.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/wined3d/context.c?rev=75621=75620=75621=diff
==
--- trunk/reactos/dll/directx/wine/wined3d/context.c[iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/wined3d/context.c[iso-8859-1] Sat Aug 19 
09:51:17 2017
@@ -2714,12 +2714,14 @@
 void *context_map_bo_address(struct wined3d_context *context,
 const struct wined3d_bo_address *data, size_t size, GLenum binding, 
DWORD flags)
 {
-const struct wined3d_gl_info *gl_info = context->gl_info;
+const struct wined3d_gl_info *gl_info;
 BYTE *memory;
 
 if (!data->buffer_object)
 return data->addr;
 
+gl_info = context->gl_info;
+
 context_bind_bo(context, binding, data->buffer_object);
 
 if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
@@ -2742,10 +2744,12 @@
 void context_unmap_bo_address(struct wined3d_context *context,
 const struct wined3d_bo_address *data, GLenum binding)
 {
-const struct wined3d_gl_info *gl_info = context->gl_info;
+const struct wined3d_gl_info *gl_info;
 
 if (!data->buffer_object)
 return;
+
+gl_info = context->gl_info;
 
 context_bind_bo(context, binding, data->buffer_object);
 GL_EXTCALL(glUnmapBuffer(binding));




[ros-diffs] [mjansen] 75617: [OLE32] Do not crash on an invalid / empty clipboard. CORE-12302

2017-08-18 Thread mjansen
Author: mjansen
Date: Fri Aug 18 17:18:46 2017
New Revision: 75617

URL: http://svn.reactos.org/svn/reactos?rev=75617=rev
Log:
[OLE32] Do not crash on an invalid / empty clipboard.
CORE-12302

Modified:
trunk/reactos/dll/win32/ole32/clipboard.c

Modified: trunk/reactos/dll/win32/ole32/clipboard.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.c?rev=75617=75616=75617=diff
==
--- trunk/reactos/dll/win32/ole32/clipboard.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ole32/clipboard.c   [iso-8859-1] Fri Aug 18 
17:18:46 2017
@@ -2018,6 +2018,10 @@
 {
 case WM_RENDERFORMAT:
 {
+#ifdef __REACTOS__
+if (clipbrd->cached_enum)
+{
+#endif
 UINT cf = wparam;
 ole_priv_data_entry *entry;
 
@@ -2026,7 +2030,9 @@
 
 if(entry)
 render_format(clipbrd->src_data, >fmtetc);
-
+#ifdef __REACTOS__
+}
+#endif
 break;
 }
 




[ros-diffs] [mjansen] 75596: [SHIMENG] Enable the Application Compatibility framework by default. - Also add disabled keys to configure the logging - Demote a noisy print used in the shim engine. At t

2017-08-17 Thread mjansen
Author: mjansen
Date: Thu Aug 17 16:42:29 2017
New Revision: 75596

URL: http://svn.reactos.org/svn/reactos?rev=75596=rev
Log:
[SHIMENG] Enable the Application Compatibility framework by default.
- Also add disabled keys to configure the logging
- Demote a noisy print used in the shim engine.
At this point the shim engine should be functional enough to be used.
One thing that remains is creating more shims(fixes) to use, and implement more 
features for the already existing ones.
CORE-13284

Modified:
trunk/reactos/boot/bootdata/hivesft.inf
trunk/reactos/boot/bootdata/hivesys.inf
trunk/reactos/dll/appcompat/apphelp/shimeng.c

Modified: trunk/reactos/boot/bootdata/hivesft.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?rev=75596=75595=75596=diff
==
--- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Thu Aug 17 
16:42:29 2017
@@ -1667,8 +1667,8 @@
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows","TransmissionRetryTimeout",0x,"90"
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows","USERProcessHandleQuota",0x00010001,0x2710
 
-; App Compat -- Disable on ReactOS
-HKLM,"SOFTWARE\Policies\Microsoft\Windows\AppCompat","DisableEngine",0x00010003,
 0x0001
+; App Compat -- Enable on ReactOS
+;HKLM,"SOFTWARE\Policies\Microsoft\Windows\AppCompat","DisableEngine",0x00010003,
 0x0001
 
 ; STRINGS ---
 

Modified: trunk/reactos/boot/bootdata/hivesys.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?rev=75596=75595=75596=diff
==
--- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Thu Aug 17 
16:42:29 2017
@@ -1417,6 +1417,8 @@
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment","TEMP",0x00020002,"%SystemRoot%\TEMP"
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment","TMP",0x00020002,"%SystemRoot%\TEMP"
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment","windir",0x00020002,"%SystemRoot%"
+;HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment","SHIMENG_DEBUG_LEVEL",0x,"4"
+;HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment","SHIM_DEBUG_LEVEL",0x,"4"
 
 
 ; Known DLLs

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75596=75595=75596=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Thu Aug 17 
16:42:29 2017
@@ -1201,13 +1201,13 @@
 
 VOID WINAPI SE_DllUnloaded(PLDR_DATA_TABLE_ENTRY LdrEntry)
 {
-SHIMENG_MSG("(%p)\n", LdrEntry);
+SHIMENG_INFO("(%p)\n", LdrEntry);
 NotifyShims(SHIM_REASON_DLL_UNLOAD, LdrEntry);
 }
 
 BOOL WINAPI SE_IsShimDll(PVOID BaseAddress)
 {
-SHIMENG_MSG("(%p)\n", BaseAddress);
+SHIMENG_INFO("(%p)\n", BaseAddress);
 
 return SeiGetShimModuleInfo(BaseAddress) != NULL;
 }




[ros-diffs] [mjansen] 75594: [ACLAYERS] Add a compatibility shim + layer for the VMWare Horizon setup. This fixes the setup trying to print some debug strings. For now the shim has to be applied manua

2017-08-17 Thread mjansen
Author: mjansen
Date: Thu Aug 17 16:27:56 2017
New Revision: 75594

URL: http://svn.reactos.org/svn/reactos?rev=75594=rev
Log:
[ACLAYERS] Add a compatibility shim + layer for the VMWare Horizon setup.
This fixes the setup trying to print some debug strings.
For now the shim has to be applied manually, however the setup does not 
complete yet.
Patch bits & fixes by Thomas.
CORE-13434

Added:
trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c   (with props)
Modified:
trunk/reactos/dll/appcompat/shims/layer/CMakeLists.txt
trunk/reactos/media/sdb/sysmain.xml

Modified: trunk/reactos/dll/appcompat/shims/layer/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/layer/CMakeLists.txt?rev=75594=75593=75594=diff
==
--- trunk/reactos/dll/appcompat/shims/layer/CMakeLists.txt  [iso-8859-1] 
(original)
+++ trunk/reactos/dll/appcompat/shims/layer/CMakeLists.txt  [iso-8859-1] 
Thu Aug 17 16:27:56 2017
@@ -6,6 +6,7 @@
 list(APPEND SOURCE
 dispmode.c
 versionlie.c
+vmhorizon.c
 main.c
 layer.spec)
 

Added: trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c?rev=75594
==
--- trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c (added)
+++ trunk/reactos/dll/appcompat/shims/layer/vmhorizon.c [iso-8859-1] Thu Aug 17 
16:27:56 2017
@@ -0,0 +1,142 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT: ReactOS Shim library
+ * FILE:dll/appcompat/shims/layer/vmhorizon.c
+ * PURPOSE: Shim for VMWare Horizon setup
+ * PROGRAMMER:  Thomas Faber (thomas.fa...@reactos.org)
+ *  Mark Jansen (mark.jan...@reactos.org)
+ */
+
+#define WIN32_NO_STATUS
+#include 
+#include 
+#include "ntndk.h"
+
+static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
+{
+PVOID BaseAddress = Address;
+SIZE_T RegionSize = Size;
+ULONG OldProtection;
+NTSTATUS Status = NtProtectVirtualMemory(NtCurrentProcess(), , 
, PAGE_EXECUTE_READWRITE, );
+if (NT_SUCCESS(Status))
+{
+SIZE_T Bytes;
+Status = NtWriteVirtualMemory(NtCurrentProcess(), Address, Data, Size, 
);
+if (NT_SUCCESS(Status) && Bytes != Size)
+Status = STATUS_MEMORY_NOT_ALLOCATED;
+NtProtectVirtualMemory(NtCurrentProcess(), , , 
OldProtection, );
+}
+return NT_SUCCESS(Status);
+}
+
+static void FixupDll(PLDR_DATA_TABLE_ENTRY LdrEntry)
+{
+static const UCHAR Match1[5] = { 0x0C, 0x8B, 0xFC, 0xF3, 0xA5 };
+static const UCHAR Match2[5] = { 0x0C, 0x8B, 0xFC, 0xF3, 0xA5 };
+static const UCHAR Match3[5] = { 0xB0, 0x8B, 0xFC, 0xF3, 0xA5 };
+UCHAR Replacement1[5] = { 0x10, 0x89, 0x34, 0x24, 0x90 };
+UCHAR Replacement2[5] = { 0x10, 0x89, 0x34, 0x24, 0x90 };
+UCHAR Replacement3[5] = { 0xB4, 0x89, 0x34, 0x24, 0x90 };
+#define OFFSET_10x21A6E
+#define OFFSET_20x21B04
+#define OFFSET_30x21C3C
+
+
+UCHAR Buffer[5];
+PBYTE Base = LdrEntry->DllBase;
+SIZE_T Bytes;
+
+/*
+00020E6E: 0C 8B FC F3 A5 --> 10 89 34 24 90 F11A6E - ef = 21A6E
+00020F04: 0C 8B FC F3 A5 --> 10 89 34 24 90 F11B04 - ef = 21B04
+00021C3C: B0 8B FC F3 A5 --> B4 89 34 24 90 F11C3C - ef = 21C3C
+*/
+do {
+DbgPrint("Module %wZ Loaded at 0x%p, we should patch!\n", 
>BaseDllName, LdrEntry->DllBase);
+if (!NT_SUCCESS(NtReadVirtualMemory(NtCurrentProcess(), Base + 
OFFSET_1, Buffer, 5, )) || Bytes != 5)
+break;
+if (memcmp(Buffer, Match1, sizeof(Match1)))
+break;
+
+if (!NT_SUCCESS(NtReadVirtualMemory(NtCurrentProcess(), Base + 
OFFSET_2, Buffer, 5, )) || Bytes != 5)
+break;
+if (memcmp(Buffer, Match2, sizeof(Match2)))
+break;
+
+if (!NT_SUCCESS(NtReadVirtualMemory(NtCurrentProcess(), Base + 
OFFSET_3, Buffer, 5, )) || Bytes != 5)
+break;
+if (memcmp(Buffer, Match3, sizeof(Match3)))
+break;
+
+DbgPrint("Module %wZ Loaded at 0x%p, OK to patch!\n", 
>BaseDllName, LdrEntry->DllBase);
+if (!Write(Base + OFFSET_1, Replacement1, sizeof(Replacement1)))
+break;
+if (!Write(Base + OFFSET_2, Replacement2, sizeof(Replacement2)))
+break;
+if (!Write(Base + OFFSET_3, Replacement3, sizeof(Replacement3)))
+break;
+
+NtFlushInstructionCache(NtCurrentProcess(), Base, 0x22000);
+
+DbgPrint("Module %wZ Loaded at 0x%p, patched!\n", 
>BaseDllName, LdrEntry->DllBase);
+} while (0);
+}
+
+static BOOLEAN PostfixUnicodeString(const UNICODE_STRING* String1, const 
UNICODE_STRING* String2)
+{
+PWCHAR pc1;
+PWCHAR pc2;
+

[ros-diffs] [mjansen] 75588: [NTDLL_APITEST] Test unaligned pointers for NtOpenKey CORE-13689

2017-08-17 Thread mjansen
Author: mjansen
Date: Thu Aug 17 11:42:13 2017
New Revision: 75588

URL: http://svn.reactos.org/svn/reactos?rev=75588=rev
Log:
[NTDLL_APITEST] Test unaligned pointers for NtOpenKey
CORE-13689

Added:
trunk/rostests/apitests/ntdll/NtOpenKey.c   (with props)
Modified:
trunk/rostests/apitests/ntdll/CMakeLists.txt
trunk/rostests/apitests/ntdll/testlist.c

Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/CMakeLists.txt?rev=75588=75587=75588=diff
==
--- trunk/rostests/apitests/ntdll/CMakeLists.txt[iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/CMakeLists.txt[iso-8859-1] Thu Aug 17 
11:42:13 2017
@@ -13,6 +13,7 @@
 NtLoadUnloadKey.c
 NtMapViewOfSection.c
 NtMutant.c
+NtOpenKey.c
 NtOpenProcessToken.c
 NtOpenThreadToken.c
 NtProtectVirtualMemory.c

Added: trunk/rostests/apitests/ntdll/NtOpenKey.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/NtOpenKey.c?rev=75588
==
--- trunk/rostests/apitests/ntdll/NtOpenKey.c   (added)
+++ trunk/rostests/apitests/ntdll/NtOpenKey.c   [iso-8859-1] Thu Aug 17 
11:42:13 2017
@@ -0,0 +1,58 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for NtOpenKey data alignment
+ * PROGRAMMER:  Mark Jansen (mark.jan...@reactos.org)
+ */
+
+#include 
+
+#include 
+
+
+#define TEST_STRL"\\Registry\\Machine\\SOFTWARE"
+
+
+
+START_TEST(NtOpenKey)
+{
+OBJECT_ATTRIBUTES Object;
+UNICODE_STRING String;
+char GccShouldNotAlignThis[40 * 2];
+char GccShouldNotAlignThis2[20];
+PVOID Alias = GccShouldNotAlignThis + 1;
+PVOID UnalignedKey = GccShouldNotAlignThis2 + 1;
+
+HANDLE KeyHandle;
+NTSTATUS Status;
+
+memcpy(Alias, TEST_STR, sizeof(TEST_STR));
+
+
+RtlInitUnicodeString(, TEST_STR);
+InitializeObjectAttributes(, , OBJ_CASE_INSENSITIVE, NULL, 
NULL);
+
+Status = NtOpenKey(, KEY_QUERY_VALUE, );
+ok_ntstatus(Status, STATUS_SUCCESS);
+
+if (!NT_SUCCESS(Status))
+return;
+
+NtClose(KeyHandle);
+
+String.Buffer = Alias;
+ok_hex(((ULONG_PTR)String.Buffer) % 2, 1);
+Status = NtOpenKey(, KEY_QUERY_VALUE, );
+ok_ntstatus(Status, STATUS_DATATYPE_MISALIGNMENT);  // FIXME: 
Later windows versions succeed here.
+if (NT_SUCCESS(Status))
+NtClose(KeyHandle);
+
+RtlInitUnicodeString(, TEST_STR);
+ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1);
+Status = NtOpenKey(UnalignedKey, KEY_QUERY_VALUE, );
+ok_ntstatus(Status, STATUS_SUCCESS);
+if (NT_SUCCESS(Status))
+{
+NtClose(*(HANDLE*)(UnalignedKey));
+}
+}

Propchange: trunk/rostests/apitests/ntdll/NtOpenKey.c
--
svn:eol-style = native

Modified: trunk/rostests/apitests/ntdll/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/testlist.c?rev=75588=75587=75588=diff
==
--- trunk/rostests/apitests/ntdll/testlist.c[iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/testlist.c[iso-8859-1] Thu Aug 17 
11:42:13 2017
@@ -16,6 +16,7 @@
 extern void func_NtLoadUnloadKey(void);
 extern void func_NtMapViewOfSection(void);
 extern void func_NtMutant(void);
+extern void func_NtOpenKey(void);
 extern void func_NtOpenProcessToken(void);
 extern void func_NtOpenThreadToken(void);
 extern void func_NtProtectVirtualMemory(void);
@@ -72,6 +73,7 @@
 { "NtLoadUnloadKey",func_NtLoadUnloadKey },
 { "NtMapViewOfSection", func_NtMapViewOfSection },
 { "NtMutant",   func_NtMutant },
+{ "NtOpenKey",  func_NtOpenKey },
 { "NtOpenProcessToken", func_NtOpenProcessToken },
 { "NtOpenThreadToken",  func_NtOpenThreadToken },
 { "NtProtectVirtualMemory", func_NtProtectVirtualMemory },




[ros-diffs] [mjansen] 75587: [ADVAPI32_APITEST] Addendum to 75585, use void pointers to work around gcc ignoring pshpack1.

2017-08-17 Thread mjansen
Author: mjansen
Date: Thu Aug 17 11:06:46 2017
New Revision: 75587

URL: http://svn.reactos.org/svn/reactos?rev=75587=rev
Log:
[ADVAPI32_APITEST] Addendum to 75585, use void pointers to work around gcc 
ignoring pshpack1.

Modified:
trunk/rostests/apitests/advapi32/RegOpenKeyExW.c

Modified: trunk/rostests/apitests/advapi32/RegOpenKeyExW.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RegOpenKeyExW.c?rev=75587=75586=75587=diff
==
--- trunk/rostests/apitests/advapi32/RegOpenKeyExW.c[iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/RegOpenKeyExW.c[iso-8859-1] Thu Aug 17 
11:06:46 2017
@@ -2,25 +2,12 @@
  * PROJECT: ReactOS api tests
  * LICENSE: GPLv2+ - See COPYING in the top level directory
  * PURPOSE: Test for the RegOpenKeyExW alignment
- * PROGRAMMER:  Mark Jansen <mark.jan...@reactos.org>
+ * PROGRAMMER:  Mark Jansen (mark.jan...@reactos.org)
  */
 #include 
 
 #define WIN32_NO_STATUS
 #include 
-
-#include 
-struct Unalignment1
-{
-char dum;
-WCHAR buffer[20];
-} Unalignment1;
-struct Unalignment2
-{
-char dum;
-HKEY hk;
-} Unalignment2;
-#include 
 
 
 #define TEST_STRL".exe"
@@ -28,13 +15,14 @@
 
 START_TEST(RegOpenKeyExW)
 {
-struct Unalignment1 un;
-struct Unalignment2 un2;
+char GccShouldNotAlignThis[20 * 2];
+char GccShouldNotAlignThis2[20];
+PVOID Alias = GccShouldNotAlignThis + 1;
+PVOID UnalignedKey = GccShouldNotAlignThis2 + 1;
 HKEY hk;
 LONG lRes;
 
-memcpy(un.buffer, TEST_STR, sizeof(TEST_STR));
-un2.hk = 0;
+memcpy(Alias, TEST_STR, sizeof(TEST_STR));
 
 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, );
 ok_int(lRes, ERROR_SUCCESS);
@@ -42,18 +30,17 @@
 return;
 RegCloseKey(hk);
 
-ok_hex(((ULONG_PTR)un.buffer) % 2, 1);
-lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, un.buffer, 0, KEY_READ, );
+ok_hex(((ULONG_PTR)Alias) % 2, 1);
+lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, Alias, 0, KEY_READ, );
 ok_int(lRes, ERROR_SUCCESS);
 if (!lRes)
 RegCloseKey(hk);
 
-ok_hex(((ULONG_PTR)) % 2, 1);
-lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, );
+ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1);
+lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, 
UnalignedKey);
 ok_int(lRes, ERROR_SUCCESS);
 if (!lRes)
 {
-hk = un2.hk;
-RegCloseKey(hk);
+RegCloseKey(*(HKEY*)(UnalignedKey));
 }
 }




[ros-diffs] [mjansen] 75585: [ADVAPI32_APITEST] Test unaligned pointers for RegOpenKeyExW.

2017-08-17 Thread mjansen
Author: mjansen
Date: Thu Aug 17 10:30:10 2017
New Revision: 75585

URL: http://svn.reactos.org/svn/reactos?rev=75585=rev
Log:
[ADVAPI32_APITEST] Test unaligned pointers for RegOpenKeyExW.

Added:
trunk/rostests/apitests/advapi32/RegOpenKeyExW.c   (with props)
Modified:
trunk/rostests/apitests/advapi32/CMakeLists.txt
trunk/rostests/apitests/advapi32/testlist.c

Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLists.txt?rev=75585=75584=75585=diff
==
--- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Thu Aug 17 
10:30:10 2017
@@ -9,6 +9,7 @@
 QueryServiceConfig2.c
 RegEnumKey.c
 RegEnumValueW.c
+RegOpenKeyExW.c
 RegQueryInfoKey.c
 RegQueryValueExW.c
 RtlEncryptMemory.c

Added: trunk/rostests/apitests/advapi32/RegOpenKeyExW.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RegOpenKeyExW.c?rev=75585
==
--- trunk/rostests/apitests/advapi32/RegOpenKeyExW.c(added)
+++ trunk/rostests/apitests/advapi32/RegOpenKeyExW.c[iso-8859-1] Thu Aug 17 
10:30:10 2017
@@ -0,0 +1,59 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for the RegOpenKeyExW alignment
+ * PROGRAMMER:  Mark Jansen <mark.jan...@reactos.org>
+ */
+#include 
+
+#define WIN32_NO_STATUS
+#include 
+
+#include 
+struct Unalignment1
+{
+char dum;
+WCHAR buffer[20];
+} Unalignment1;
+struct Unalignment2
+{
+char dum;
+HKEY hk;
+} Unalignment2;
+#include 
+
+
+#define TEST_STRL".exe"
+
+
+START_TEST(RegOpenKeyExW)
+{
+struct Unalignment1 un;
+struct Unalignment2 un2;
+HKEY hk;
+LONG lRes;
+
+memcpy(un.buffer, TEST_STR, sizeof(TEST_STR));
+un2.hk = 0;
+
+lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, );
+ok_int(lRes, ERROR_SUCCESS);
+if (lRes)
+return;
+RegCloseKey(hk);
+
+ok_hex(((ULONG_PTR)un.buffer) % 2, 1);
+lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, un.buffer, 0, KEY_READ, );
+ok_int(lRes, ERROR_SUCCESS);
+if (!lRes)
+RegCloseKey(hk);
+
+ok_hex(((ULONG_PTR)) % 2, 1);
+lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, );
+ok_int(lRes, ERROR_SUCCESS);
+if (!lRes)
+{
+hk = un2.hk;
+RegCloseKey(hk);
+}
+}

Propchange: trunk/rostests/apitests/advapi32/RegOpenKeyExW.c
--
svn:eol-style = native

Modified: trunk/rostests/apitests/advapi32/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlist.c?rev=75585=75584=75585=diff
==
--- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Thu Aug 17 
10:30:10 2017
@@ -12,6 +12,7 @@
 extern void func_QueryServiceConfig2(void);
 extern void func_RegEnumKey(void);
 extern void func_RegEnumValueW(void);
+extern void func_RegOpenKeyExW(void);
 extern void func_RegQueryInfoKey(void);
 extern void func_RegQueryValueExW(void);
 extern void func_RtlEncryptMemory(void);
@@ -31,6 +32,7 @@
 { "RegEnumKey", func_RegEnumKey },
 { "RegEnumValueW", func_RegEnumValueW },
 { "RegQueryInfoKey", func_RegQueryInfoKey },
+{ "RegOpenKeyExW", func_RegOpenKeyExW },
 { "RegQueryValueExW", func_RegQueryValueExW },
 { "RtlEncryptMemory", func_RtlEncryptMemory },
 { "SaferIdentifyLevel", func_SaferIdentifyLevel },




[ros-diffs] [mjansen] 75552: [ACPPAGE] Do not allow shims to be applied to files in System32/WinSxs. CORE-13618

2017-08-15 Thread mjansen
Author: mjansen
Date: Tue Aug 15 12:37:25 2017
New Revision: 75552

URL: http://svn.reactos.org/svn/reactos?rev=75552=rev
Log:
[ACPPAGE] Do not allow shims to be applied to files in System32/WinSxs.
CORE-13618

Modified:
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp

Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp?rev=75552=75551=75552=diff
==
--- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
Tue Aug 15 12:37:25 2017
@@ -158,6 +158,27 @@
 }
 return InitFile(Buffer);
 }
+
+CString tmp;
+if (tmp.GetEnvironmentVariable(L"SystemRoot"))
+{
+tmp += L"\\System32";
+if (ExpandedFilename.GetLength() >= tmp.GetLength() &&
+ExpandedFilename.Left(tmp.GetLength()).MakeLower() == 
tmp.MakeLower())
+{
+ACDBG(L"Ignoring System32: %s\r\n", (PCWSTR)ExpandedFilename);
+return E_FAIL;
+}
+tmp.GetEnvironmentVariable(L"SystemRoot");
+tmp += L"\\WinSxs";
+if (ExpandedFilename.GetLength() >= tmp.GetLength() &&
+ExpandedFilename.Left(tmp.GetLength()).MakeLower() == 
tmp.MakeLower())
+{
+ACDBG(L"Ignoring WinSxs: %s\r\n", (PCWSTR)ExpandedFilename);
+return E_FAIL;
+}
+}
+
 for (size_t n = 0; g_AllowedExtensions[n]; ++n)
 {
 if (!wcsicmp(g_AllowedExtensions[n], pwszExt))




[ros-diffs] [mjansen] 75549: [ATL] Use the AtlThrow helper so we can disable exceptions by defining _ATL_NO_EXCEPTIONS

2017-08-15 Thread mjansen
Author: mjansen
Date: Tue Aug 15 09:02:17 2017
New Revision: 75549

URL: http://svn.reactos.org/svn/reactos?rev=75549=rev
Log:
[ATL] Use the AtlThrow helper so we can disable exceptions by defining 
_ATL_NO_EXCEPTIONS

Modified:
trunk/reactos/sdk/lib/atl/atlsimpstr.h

Modified: trunk/reactos/sdk/lib/atl/atlsimpstr.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/atl/atlsimpstr.h?rev=75549=75548=75549=diff
==
--- trunk/reactos/sdk/lib/atl/atlsimpstr.h  [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/atl/atlsimpstr.h  [iso-8859-1] Tue Aug 15 
09:02:17 2017
@@ -162,9 +162,8 @@
 int nLength = StringLength(pszSrc);
 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
 if (pData == NULL)
-{
-throw; // ThrowMemoryException();
-}
+ThrowMemoryException();
+
 Attach(pData);
 SetLength(nLength);
 CopyChars(m_pszData, nLength, pszSrc, nLength);
@@ -176,12 +175,12 @@
 _Inout_ IAtlStringMgr* pStringMgr)
 {
 if (pchSrc == NULL && nLength != 0)
-throw;
+ThrowInvalidArgException();
 
 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
 if (pData == NULL)
 {
-throw; // ThrowMemoryException();
+ThrowMemoryException();
 }
 Attach(pData);
 SetLength(nLength);
@@ -615,6 +614,11 @@
 AtlThrow(E_OUTOFMEMORY);
 }
 
+static void ThrowInvalidArgException()
+{
+AtlThrow(E_INVALIDARG);
+}
+
 };
 
 #ifdef UNICODE




[ros-diffs] [mjansen] 75541: [SHIMENG] Filter shims based on the include/exclude node specified, as well as their presence in certain directories. - Shims are not allowed on files from System32 / WinS

2017-08-14 Thread mjansen
Author: mjansen
Date: Mon Aug 14 16:34:56 2017
New Revision: 75541

URL: http://svn.reactos.org/svn/reactos?rev=75541=rev
Log:
[SHIMENG] Filter shims based on the include/exclude node specified, as well as 
their presence in certain directories.
- Shims are not allowed on files from System32 / WinSxs.
- Individual shims can override this per module with includes/excludes.
- Shims can specify additional dlls to ignore or include.
- Specify a default list of dlls to be included from system32.
CORE-13618

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/shimeng.c
trunk/reactos/dll/appcompat/apphelp/shimeng.h
trunk/reactos/media/sdb/sysmain.xml

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=75541=75540=75541=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Mon Aug 14 
16:34:56 2017
@@ -89,6 +89,7 @@
 
 /* sdbapi.c */
 PWSTR SdbpStrDup(LPCWSTR string);
+DWORD SdbpStrsize(PCWSTR string);
 HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR);
 void WINAPI SdbReleaseDatabase(HSDB);
 BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length);

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75541=75540=75541=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Mon Aug 14 
16:34:56 2017
@@ -27,21 +27,24 @@
 #include "shimeng.h"
 
 
-typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HINSTANCE, LPCSTR);
-
 
 FARPROC WINAPI StubGetProcAddress(HINSTANCE hModule, LPCSTR lpProcName);
 BOOL WINAPI SE_IsShimDll(PVOID BaseAddress);
 
 
 extern HMODULE g_hInstance;
+static UNICODE_STRING g_WindowsDirectory;
+static UNICODE_STRING g_System32Directory;
+static UNICODE_STRING g_SxsDirectory;
 ULONG g_ShimEngDebugLevel = 0x;
 BOOL g_bComPlusImage = FALSE;
 BOOL g_bShimDuringInit = FALSE;
 BOOL g_bInternalHooksUsed = FALSE;
-static ARRAY g_pShimInfo;  /* PSHIMMODULE */
-static ARRAY g_pHookArray; /* HOOKMODULEINFO */
-
+static ARRAY g_pShimInfo;   /* PSHIMMODULE */
+static ARRAY g_pHookArray;  /* HOOKMODULEINFO */
+static ARRAY g_InExclude;   /* INEXCLUDE */
+
+/* If we have setup a hook for a function, we should also redirect 
GetProcAddress for this function */
 HOOKAPIEX g_IntHookEx[] =
 {
 {
@@ -132,7 +135,7 @@
 static const UNICODE_STRING DebugKey = 
RTL_CONSTANT_STRING(L"SHIMENG_DEBUG_LEVEL");
 UNICODE_STRING DebugValue;
 NTSTATUS Status;
-ULONG NewLevel = 0;
+ULONG NewLevel = SEI_MSG;   /* Show some basic info in the logs, unless 
configured different */
 WCHAR Buffer[40];
 
 RtlInitEmptyUnicodeString(, Buffer, sizeof(Buffer));
@@ -294,20 +297,29 @@
 return Data;
 }
 
-VOID SeiAppendHookInfo(PSHIMMODULE pShimModuleInfo, PHOOKAPIEX pHookApi, DWORD 
dwHookCount)
+PSHIMINFO SeiAppendHookInfo(PSHIMMODULE pShimModuleInfo, PHOOKAPIEX pHookApi, 
DWORD dwHookCount, PCWSTR ShimName)
 {
 PSHIMINFO* pData, Data;
 
 pData = ARRAY_Append(>EnabledShims, PSHIMINFO);
 if (!pData)
-return;
+return NULL;
 
 *pData = SeiAlloc(sizeof(SHIMINFO));
 Data = *pData;
+
+if (!Data)
+return NULL;
+
+Data->ShimName = SdbpStrDup(ShimName);
+if (!Data->ShimName)
+return NULL;
 
 Data->pHookApi = pHookApi;
 Data->dwHookCount = dwHookCount;
 Data->pShimModule = pShimModuleInfo;
+ARRAY_Init(>InExclude, INEXCLUDE);
+return Data;
 }
 
 PHOOKMODULEINFO SeiFindHookModuleInfo(PUNICODE_STRING ModuleName, PVOID 
BaseAddress)
@@ -382,6 +394,7 @@
 *Data = trShimRef;
 }
 
+/* Propagate layers to child processes */
 static VOID SeiSetLayerEnvVar(LPCWSTR wszLayer)
 {
 NTSTATUS Status;
@@ -399,6 +412,7 @@
 
 #define MAX_LAYER_LENGTH256
 
+/* Translate all Exe and Layer entries to Shims, and propagate all layers */
 static VOID SeiBuildShimRefArray(HSDB hsdb, SDBQUERYRESULT* pQuery, PARRAY 
pShimRef)
 {
 WCHAR wszLayerEnvVar[MAX_LAYER_LENGTH] = { 0 };
@@ -468,7 +482,7 @@
 SeiSetLayerEnvVar(wszLayerEnvVar);
 }
 
-
+/* Given the hooks from one shim, find the relevant modules and store the 
combination of module + hook */
 VOID SeiAddHooks(PHOOKAPIEX hooks, DWORD dwHookCount, PSHIMINFO pShim)
 {
 DWORD n, j;
@@ -542,7 +556,9 @@
 }
 }
 
-
+typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HINSTANCE, LPCSTR);
+
+/* Check if we should fake the return from GetProcAddress (because we also 
redirected the iat for this module) */
 FARPROC WINAPI StubGetProcAdd

[ros-diffs] [mjansen] 75521: [RAPPS] Delete uTorrent until CORE-13666 is cleared up.

2017-08-10 Thread mjansen
Author: mjansen
Date: Thu Aug 10 17:09:58 2017
New Revision: 75521

URL: http://svn.reactos.org/svn/reactos?rev=75521=rev
Log:
[RAPPS] Delete uTorrent until CORE-13666 is cleared up.

Removed:
trunk/reactos/media/rapps/utorrent.txt

Removed: trunk/reactos/media/rapps/utorrent.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/rapps/utorrent.txt?rev=75520
==
--- trunk/reactos/media/rapps/utorrent.txt  [iso-8859-1] (original)
+++ trunk/reactos/media/rapps/utorrent.txt  (removed)
@@ -1,64 +0,0 @@
-[Section]
-Name = µTorrent
-Version = CURRENT
-License = Freeware for non-commercial uses
-Description = Small and fast BitTorrent Client.
-Size = 1.7 MiB
-Category = 5
-URLSite = http://www.utorrent.com/
-URLDownload = 
http://download-new.utorrent.com/endpoint/utorrent/os/windows/track/stable/utorrent.exe
-CDPath = none
-
-[Section.0407]
-License = Freeware für nichtkommerzielle Nutzung
-Description = Kleiner und schneller BitTorrent Client.
-Size = 1,7 MiB
-
-[Section.0a]
-License = Gratuito para uso no comercial
-Description = Un cliente BitTorrent pequeño y rápido.
-
-[Section.040c]
-License = Gratuit pour une utilisation non-commerciale
-Description = Client BitTorrent petit et rapide.
-Size = 1,7 Mio
-
-[Section.0410]
-License = Gratuita per un uso non-commerciale
-Description = Piccolo e rapido Client BitTorrent.
-
-[Section.0413]
-License = Freeware voor niet-commerciëel gebruik
-Description = Kleine en snelle BitTorrent afnemer.
-
-[Section.0415]
-License = Freeware (do użytku domowego)
-Description = Mały i szybki klient BitTorrent.
-
-[Section.0418]
-License = Gratuită pentru uz necomercial
-Description = Client BitTorrent, mic și rapid.
-Size = 1,7 Mio
-
-[Section.0419]
-License = Бесплатная для некоммерческого 
использования
-Description = Маленький и быстрый клиент BitTorrent.
-Size = 1,7 МиБ
-
-[Section.041f]
-License = Tecimlik olmayan kullanımlar için ücretsiz.
-Description = Küçük ve hızlı BitTorrent istemcisi.
-Size = 1,7 MiB
-
-[Section.0422]
-License = Безплатна для некомерційного 
використання
-Description = Маленький і швидкий клієнт BitTorrent.
-
-[Section.0804]
-License = 非商业用途的免费软件
-Description = 小而快的 BitTorrent 客户端。
-
-[Section.0813]
-License = Freeware voor niet-commerciëel gebruik
-Description = Kleine en snelle BitTorrent afnemer.
-




[ros-diffs] [mjansen] 75510: [UNATTEND] Show how to enable the lautus theme in unattended mode.

2017-08-08 Thread mjansen
Author: mjansen
Date: Tue Aug  8 19:43:49 2017
New Revision: 75510

URL: http://svn.reactos.org/svn/reactos?rev=75510=rev
Log:
[UNATTEND] Show how to enable the lautus theme in unattended mode.

Modified:
trunk/reactos/boot/bootdata/bootcd/unattend.inf

Modified: trunk/reactos/boot/bootdata/bootcd/unattend.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/bootcd/unattend.inf?rev=75510=75509=75510=diff
==
--- trunk/reactos/boot/bootdata/bootcd/unattend.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/bootcd/unattend.inf [iso-8859-1] Tue Aug  8 
19:43:49 2017
@@ -54,6 +54,8 @@
 ;
 ; [GuiRunOnce]
 ; %SystemRoot%\system32\cmd.exe
+; Enable the next line (+ the GuiRunOnce section) to enable the lautus theme
+; "rundll32.exe shell32.dll,Control_RunDLL desk.cpl desk,@Appearance 
/Action:ActivateMSTheme 
/file:%SYSTEMROOT%\Resources\themes\lautus\lautus.msstyles"
 
 
 ; enable this section to change resolution / bpp




[ros-diffs] [mjansen] 75492: [FONTSUB] Russian translation by Sergey Stopkin. ROSAPPS-339 #resolve #comment Thanks!

2017-08-05 Thread mjansen
Author: mjansen
Date: Sat Aug  5 20:08:00 2017
New Revision: 75492

URL: http://svn.reactos.org/svn/reactos?rev=75492=rev
Log:
[FONTSUB] Russian translation by Sergey Stopkin.
ROSAPPS-339 #resolve #comment Thanks!

Added:
trunk/rosapps/applications/sysutils/fontsub/lang/ru-RU.rc   (with props)
Modified:
trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc

Modified: trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc?rev=75492=75491=75492=diff
==
--- trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc  [iso-8859-1] 
(original)
+++ trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc  [iso-8859-1] 
Sat Aug  5 20:08:00 2017
@@ -38,6 +38,9 @@
 #ifdef LANGUAGE_JA_JP
 #include "lang/ja-JP.rc"
 #endif
+#ifdef LANGUAGE_RU_RU
+#include "lang/ru-RU.rc"
+#endif
 
 1 ACCELERATORS
 BEGIN

Added: trunk/rosapps/applications/sysutils/fontsub/lang/ru-RU.rc
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/fontsub/lang/ru-RU.rc?rev=75492
==
--- trunk/rosapps/applications/sysutils/fontsub/lang/ru-RU.rc   (added)
+++ trunk/rosapps/applications/sysutils/fontsub/lang/ru-RU.rc   [iso-8859-1] 
Sat Aug  5 20:08:00 2017
@@ -0,0 +1,106 @@
+/* FontSub by Katayama Hirofumi MZ
+ *
+ * To the extent possible under law, the person who associated CC0 with
+ * FontSub has waived all copyright and related or neighboring rights
+ * to FontSub.
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work.  If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+/* UTF-8 */
+#pragma code_page(65001)
+
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+
+1 MENU
+BEGIN
+POPUP "&Файл"
+BEGIN
+MENUITEM "&Импорт из...\tCtrl+O", ID_IMPORT
+MENUITEM "&Экспорт в...\tCtrl+S", ID_EXPORT
+MENUITEM SEPARATOR
+MENUITEM "За&грузить из реестра\tCtrl+L", ID_RELOAD
+MENUITEM "Записать в &реестр\tCtrl+U", 
ID_UPDATE_REGISTRY
+MENUITEM SEPARATOR
+MENUITEM "Открыть в Reg", ID_OPEN_REGKEY
+MENUITEM SEPARATOR
+MENUITEM "В&ыход\tAlt+F4", ID_EXIT
+END
+POPUP "&Правка"
+BEGIN
+MENUITEM "&Создать\tCtrl+N", ID_NEW
+MENUITEM SEPARATOR
+MENUITEM "&Редактировать\tEnter", ID_EDIT
+MENUITEM SEPARATOR
+MENUITEM "&Удалить\tDel", ID_DELETE
+END
+POPUP "&Справка"
+BEGIN
+MENUITEM "О программ&е", ID_ABOUT
+END
+END
+
+2 MENU
+BEGIN
+POPUP "Popup"
+BEGIN
+MENUITEM "&Добавить\tCtrl+N", ID_NEW
+MENUITEM SEPARATOR
+MENUITEM "&Редактировать\tEnter", ID_EDIT
+MENUITEM SEPARATOR
+MENUITEM "&Удалить\tDel", ID_DELETE
+END
+END
+
+STRINGTABLE
+BEGIN
+IDS_TITLE,  "Редактор таблицы 
соответствия шрифтов"
+IDS_FONTNAME,   "Шрифт"
+IDS_SUBSTITUTE, "Замена"
+IDS_ENTERNAME,  "(Пожалуйста, выберите 
шрифт...)"
+IDS_IMPORT, "Импорт"
+IDS_EXPORT, "Экспорт"
+IDS_CANTIMPORT, "Не удалось импортировать."
+IDS_CANTEXPORT, "Не удалось экспортировать."
+IDS_INPFILTER,  "Файлы реестра (*.reg)|*.reg|Все 
файлы (*.*)|*.*|"
+IDS_OUTFILTER,  "Файлы реестра (*.reg)|*.reg|"
+IDS_QUERYUPDATE,"Информация о соответствии 
шрифтов была обновлена.\r\nОбновить 
значения реестра сейчас?"
+IDS_ALREADYEXISTS,  "Шрифт с таким именем уже 
используется."
+IDS_ENTERNAME2, "Введите имя шрифта."
+IDS_QUERYDELETE,"Вы действительно хотите 
удалить этот элемент?"
+IDS_CANTOPENKEY,"Не удалось открыть ключ 
реестра."
+IDS_REBOOTNOW,  "Реестр был обновлен. 
Перезагрузить систему сейчас?"
+IDS_ABOUT,  "FontSub (Редактор таблицы 
соответствия шрифтов) Версия 0.5

[ros-diffs] [mjansen] 75491: [WIN32SS] Improve GetFontResourceInfoW. Patch by Katayama Hirofumi MZ & Doug Lyons. CORE-13365 #resolve #comment Thanks!

2017-08-05 Thread mjansen
Author: mjansen
Date: Sat Aug  5 20:04:24 2017
New Revision: 75491

URL: http://svn.reactos.org/svn/reactos?rev=75491=rev
Log:
[WIN32SS] Improve GetFontResourceInfoW. Patch by Katayama Hirofumi MZ & Doug 
Lyons.
CORE-13365 #resolve #comment Thanks!

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=75491=75490=75491=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Sat Aug  5 
20:04:24 2017
@@ -2450,53 +2450,84 @@
 return FindFaceNameInInfo(FaceName, Info, InfoEntries) < 0;
 }
 
+static BOOL FASTCALL
+FontFamilyFound(PFONTFAMILYINFO InfoEntry,
+PFONTFAMILYINFO Info, DWORD InfoCount)
+{
+LPLOGFONTW plf1 = >EnumLogFontEx.elfLogFont;
+LPWSTR pFullName1 = InfoEntry->EnumLogFontEx.elfFullName;
+LPWSTR pFullName2;
+DWORD i;
+
+for (i = 0; i < InfoCount; ++i)
+{
+LPLOGFONTW plf2 = [i].EnumLogFontEx.elfLogFont;
+if (plf1->lfCharSet != plf2->lfCharSet)
+continue;
+
+pFullName2 = Info[i].EnumLogFontEx.elfFullName;
+if (_wcsicmp(pFullName1, pFullName2) != 0)
+continue;
+
+return TRUE;
+}
+return FALSE;
+}
+
 static BOOLEAN FASTCALL
 GetFontFamilyInfoForList(LPLOGFONTW LogFont,
  PFONTFAMILYINFO Info,
- DWORD *Count,
- DWORD Size,
+ DWORD *pCount,
+ DWORD MaxCount,
  PLIST_ENTRY Head)
 {
 PLIST_ENTRY Entry;
 PFONT_ENTRY CurrentEntry;
-ANSI_STRING EntryFaceNameA;
-UNICODE_STRING EntryFaceNameW;
 FONTGDI *FontGDI;
-NTSTATUS status;
-
-Entry = Head->Flink;
-while (Entry != Head)
-{
-CurrentEntry = (PFONT_ENTRY) CONTAINING_RECORD(Entry, FONT_ENTRY, 
ListEntry);
-
+FONTFAMILYINFO InfoEntry;
+DWORD Count = *pCount;
+
+for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
+{
+CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
 FontGDI = CurrentEntry->Font;
 ASSERT(FontGDI);
 
-RtlInitAnsiString(, 
FontGDI->SharedFace->Face->family_name);
-status = RtlAnsiStringToUnicodeString(, 
, TRUE);
-if (!NT_SUCCESS(status))
-{
-return FALSE;
-}
-
-if ((LF_FACESIZE - 1) * sizeof(WCHAR) < EntryFaceNameW.Length)
-{
-EntryFaceNameW.Length = (LF_FACESIZE - 1) * sizeof(WCHAR);
-EntryFaceNameW.Buffer[LF_FACESIZE - 1] = L'\0';
-}
-
-if (FontFamilyInclude(LogFont, , Info, min(*Count, 
Size)))
-{
-if (*Count < Size)
-{
-FontFamilyFillInfo(Info + *Count, EntryFaceNameW.Buffer,
-   NULL, FontGDI);
-}
-(*Count)++;
-}
-RtlFreeUnicodeString();
-Entry = Entry->Flink;
-}
+if (LogFont->lfCharSet != DEFAULT_CHARSET &&
+LogFont->lfCharSet != FontGDI->CharSet)
+{
+continue;
+}
+
+if (LogFont->lfFaceName[0] == UNICODE_NULL)
+{
+if (Count < MaxCount)
+{
+FontFamilyFillInfo([Count], NULL, NULL, FontGDI);
+}
+Count++;
+continue;
+}
+
+FontFamilyFillInfo(, NULL, NULL, FontGDI);
+
+if (_wcsicmp(LogFont->lfFaceName, 
InfoEntry.EnumLogFontEx.elfLogFont.lfFaceName) != 0 &&
+_wcsicmp(LogFont->lfFaceName, InfoEntry.EnumLogFontEx.elfFullName) 
!= 0)
+{
+continue;
+}
+
+if (!FontFamilyFound(, Info, min(Count, MaxCount)))
+{
+if (Count < MaxCount)
+{
+RtlCopyMemory([Count], , sizeof(InfoEntry));
+}
+Count++;
+}
+}
+
+*pCount = Count;
 
 return TRUE;
 }




[ros-diffs] [mjansen] 75489: [APPHELP][XML2SDB] Code cleanup + add assertions - Always used pdb or hsdb, no more 'db' - Add property to an PDB that describes if it's opened for read/write, and assert

2017-08-05 Thread mjansen
Author: mjansen
Date: Sat Aug  5 12:05:06 2017
New Revision: 75489

URL: http://svn.reactos.org/svn/reactos?rev=75489=rev
Log:
[APPHELP][XML2SDB] Code cleanup + add assertions
- Always used pdb or hsdb, no more 'db'
- Add property to an PDB that describes if it's opened for read/write, and 
assert on this
- Add comments

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/layer.c
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/dll/appcompat/apphelp/sdbpapi.h
trunk/reactos/dll/appcompat/apphelp/sdbread.c
trunk/reactos/dll/appcompat/apphelp/sdbtypes.h
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
trunk/reactos/dll/appcompat/shims/genral/themes.c
trunk/reactos/sdk/tools/xml2sdb/main.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=75489=75488=75489=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Sat Aug  5 
12:05:06 2017
@@ -1,6 +1,6 @@
 /*
  * Copyright 2013 Mislav Blažević
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@
 #define SDB_DATABASE_MAIN_DRIVERS 0x8004
 
 typedef struct _SDB {
-PDB db;
+PDB pdb;
 BOOL auto_loaded;
 } SDB, *HSDB;
 
@@ -98,19 +98,19 @@
 void WINAPI SdbCloseDatabase(PDB);
 BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid);
 BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size);
-LPWSTR WINAPI SdbGetStringTagPtr(PDB db, TAGID tagid);
-TAGID WINAPI SdbFindFirstNamedTag(PDB db, TAGID root, TAGID find, TAGID 
nametag, LPCWSTR find_name);
+LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid);
+TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID 
nametag, LPCWSTR find_name);
 
 /* sdbread.c */
-BOOL WINAPI SdbpReadData(PDB db, PVOID dest, DWORD offset, DWORD num);
-TAG WINAPI SdbGetTagFromTagID(PDB db, TAGID tagid);
-TAGID WINAPI SdbFindFirstTag(PDB db, TAGID parent, TAG tag);
-TAGID WINAPI SdbFindNextTag(PDB db, TAGID parent, TAGID prev_child);
-BOOL WINAPI SdbGetDatabaseID(PDB db, GUID* Guid);
-DWORD WINAPI SdbReadDWORDTag(PDB db, TAGID tagid, DWORD ret);
-QWORD WINAPI SdbReadQWORDTag(PDB db, TAGID tagid, QWORD ret);
-TAGID WINAPI SdbGetFirstChild(PDB db, TAGID parent);
-TAGID WINAPI SdbGetNextChild(PDB db, TAGID parent, TAGID prev_child);
+BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num);
+TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid);
+TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag);
+TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child);
+BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID* Guid);
+DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret);
+QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret);
+TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent);
+TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child);
 
 /* sdbfileattr.c*/
 BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, 
LPDWORD attr_count);

Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb.c?rev=75489=75488=75489=diff
==
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] Sat Aug  5 
12:05:06 2017
@@ -48,6 +48,8 @@
 return (attr != INVALID_FILE_ATTRIBUTES && !(attr & 
FILE_ATTRIBUTE_DIRECTORY));
 }
 
+/* Given a 'MATCHING_FILE' tag and an ATTRINFO array,
+   check all tags defined in the MATCHING_FILE against the ATTRINFO */
 static BOOL SdbpMatchFileAttributes(PDB pdb, TAGID matching_file, PATTRINFO 
attribs, DWORD attr_count)
 {
 TAGID child;
@@ -107,6 +109,8 @@
 return TRUE;
 }
 
+/* Given an 'exe' tag and an ATTRINFO array (for the main file),
+   verify that the main file and any additional files match */
 static BOOL WINAPI SdbpMatchExe(PDB pdb, TAGID exe, const WCHAR* dir, 
PATTRINFO main_attribs, DWORD main_attr_count)
 {
 RTL_UNICODE_STRING_BUFFER FullPathName = { { 0 } };
@@ -132,8 +136,10 @@
 if (!Name.Buffer)
 goto Cleanup;
 
+/* An '*' here means use the main executable' */
 if (!wcscmp(Name.Buffer, L"*"))
 {
+/* We already have these attributes, so we do not need to retrieve 
them */
 if (!SdbpMatchFileAttribu

[ros-diffs] [mjansen] 75475: [RAPPS] Remove Burnaware free. CORE-12194 #resolve

2017-08-03 Thread mjansen
Author: mjansen
Date: Thu Aug  3 20:52:01 2017
New Revision: 75475

URL: http://svn.reactos.org/svn/reactos?rev=75475=rev
Log:
[RAPPS] Remove Burnaware free. CORE-12194 #resolve

Removed:
trunk/reactos/media/rapps/burnawarefree.txt

Removed: trunk/reactos/media/rapps/burnawarefree.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/rapps/burnawarefree.txt?rev=75474
==
--- trunk/reactos/media/rapps/burnawarefree.txt [iso-8859-1] (original)
+++ trunk/reactos/media/rapps/burnawarefree.txt (removed)
@@ -1,39 +0,0 @@
-[Section]
-Name = BurnAware Free
-Version = 9.3
-License = Freeware for non-commercial uses
-Description = Full-featured and free burning software to create CD, DVD and 
Blu-ray discs of all types.
-Size = 3.1 KiB
-Category = 12
-URLSite = http://www.burnaware.com/
-URLDownload = http://www.burnaware.com/downloads/burnaware_free_9.3.exe
-SHA1 = b79dcfb18441abd79dd858535fb33a0a119e4855
-CDPath = none
-
-[Section.0407]
-Description = Freie Brennsoftware mit vollem Funktionsumfang, um CDs, DVDs und 
Blu-Ray Disks aller Arten zu erstellen.
-Size = 3,1 KiB
-
-[Section.0a]
-Description = Completa suite de grabación gratuita con la que crear CDs, DVDs 
y BluRay de todo tipo.
-
-[Section.0418]
-Name = BurnAware Gratuit
-License = Gratuit pentru uz necomercial
-Description = Program de inscripționare gratuit, complet, pentru discuri CD, 
DVD și Blue-ray de toate tipurile.
-Size = 3,1 Kio
-
-[Section.0419]
-License = Бесплатно для не коммерческого 
использования
-Description = Полнофункциональная и бесплатная 
программа записи CD, DVD и Blu-ray дисков всех 
типов.
-Size = 3,1 КиБ
-
-[Section.041f]
-Name = BurnAware Ücretsiz
-License = Tecimlik olmayan kullanımlar için ücretsiz
-Description = CD, DVD ve Blu-ray disklerinin tüm türlerini oluşturmak için 
eksiksiz husûsiyetli ve ücretsiz bir CD, DVD ve Blu-ray yazma yazılımıdır.
-Size = 3,1 KiB
-
-[Section.0804]
-Description = BurnAware 是全功能和免费的刻录软件来创建 CD、 
DVD 和蓝光光盘的所有类型。
-




[ros-diffs] [mjansen] 75458: [REGEDIT] Fix the search dialog not opening when the root node is selected. Patch by Joachim Henze (reactosfanboy). Small changes by me. CORE-13071 #resolve #comment Thank

2017-07-30 Thread mjansen
Author: mjansen
Date: Sun Jul 30 14:04:44 2017
New Revision: 75458

URL: http://svn.reactos.org/svn/reactos?rev=75458=rev
Log:
[REGEDIT] Fix the search dialog not opening when the root node is selected. 
Patch by Joachim Henze (reactosfanboy).
Small changes by me.
CORE-13071 #resolve #comment Thanks!

Modified:
trunk/reactos/base/applications/regedit/CMakeLists.txt
trunk/reactos/base/applications/regedit/framewnd.c
trunk/reactos/base/applications/regedit/settings.c

Modified: trunk/reactos/base/applications/regedit/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/CMakeLists.txt?rev=75458=75457=75458=diff
==
--- trunk/reactos/base/applications/regedit/CMakeLists.txt  [iso-8859-1] 
(original)
+++ trunk/reactos/base/applications/regedit/CMakeLists.txt  [iso-8859-1] 
Sun Jul 30 14:04:44 2017
@@ -23,7 +23,7 @@
 add_executable(regedit ${SOURCE} regedit.rc)
 set_module_type(regedit win32gui UNICODE)
 target_link_libraries(regedit uuid)
-add_importlibs(regedit user32 gdi32 advapi32 ole32 shell32 comctl32 comdlg32 
shlwapi msvcrt kernel32)
+add_importlibs(regedit user32 gdi32 advapi32 ole32 shell32 comctl32 comdlg32 
shlwapi msvcrt kernel32 ntdll)
 add_pch(regedit regedit.h SOURCE)
 add_cd_file(TARGET regedit DESTINATION reactos FOR all)
 #add_subdirectory(clb)

Modified: trunk/reactos/base/applications/regedit/framewnd.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/framewnd.c?rev=75458=75457=75458=diff
==
--- trunk/reactos/base/applications/regedit/framewnd.c  [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/framewnd.c  [iso-8859-1] Sun Jul 30 
14:04:44 2017
@@ -1033,7 +1033,6 @@
 LPCWSTR valueName;
 BOOL result = TRUE;
 REGSAM regsam = KEY_READ;
-LONG lRet;
 int item;
 
 UNREFERENCED_PARAMETER(lParam);
@@ -1125,13 +1124,11 @@
 
 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, );
 valueName = GetValueName(g_pChildWnd->hListWnd, -1);
-
-if (!keyPath)
-return TRUE;
-
-lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, regsam, );
-if (lRet != ERROR_SUCCESS)
-hKey = 0;
+if (keyPath)
+{
+if (RegOpenKeyExW(hKeyRoot, keyPath, 0, regsam, ) != 
ERROR_SUCCESS)
+hKey = 0;
+}
 
 switch (LOWORD(wParam))
 {
@@ -1165,7 +1162,7 @@
 break;
 case ID_EDIT_DELETE:
 {
-if (GetFocus() == g_pChildWnd->hListWnd)
+if (GetFocus() == g_pChildWnd->hListWnd && hKey)
 {
 UINT nSelected = ListView_GetSelectedCount(g_pChildWnd->hListWnd);
 if(nSelected >= 1)
@@ -1201,7 +1198,7 @@
 }
 else if (GetFocus() == g_pChildWnd->hTreeWnd)
 {
-if (keyPath == 0 || *keyPath == 0)
+if (keyPath == NULL || *keyPath == UNICODE_NULL)
 {
 MessageBeep(MB_ICONHAND);
 }

Modified: trunk/reactos/base/applications/regedit/settings.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/settings.c?rev=75458=75457=75458=diff
==
--- trunk/reactos/base/applications/regedit/settings.c  [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/settings.c  [iso-8859-1] Sun Jul 30 
14:04:44 2017
@@ -23,6 +23,7 @@
 #include 
 
 const WCHAR g_szGeneralRegKey[] = 
L"Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit";
+DECLSPEC_IMPORT ULONG WINAPIV DbgPrint(PCH Format,...);
 
 /* 
 VV,VV,VV,VV,WA,WA,WA,WA,WB,WB,WB,WB,R1,R1,R1,R1
@@ -122,25 +123,31 @@
 {
 RegistryBinaryConfig tConfig;
 DWORD iBufferSize = sizeof(tConfig);
-WCHAR szBuffer[MAX_PATH];
+WCHAR szBuffer[MAX_PATH]; /* FIXME: a complete registry path can be 
longer than that */
 LPCWSTR keyPath, rootName;
 HKEY hRootKey;
 
 /* Save key position */
 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, );
-if (keyPath)
+rootName = get_root_key_name(hRootKey);
+
+/* Load "My Computer" string and complete it */
+if (LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer)) 
&&
+SUCCEEDED(StringCbCatW(szBuffer, sizeof(szBuffer), L"\\")) &&
+SUCCEEDED(StringCbCatW(szBuffer, sizeof(szBuffer), rootName)) &&
+SUCCEEDED(StringCbCatW(szBuffer, sizeof(szBuffer), L"\\")))
 {
-rootName = get_root_key_name(hRootKey);
-
-/* Load "My Computer" string and complete it */
-if (LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, 
COUNT_OF(szBuffer)) &&
-SUCCEEDED(StringCbCatW(szBuffer, sizeof(szBuffer), L"

[ros-diffs] [mjansen] 75457: [SDK][XML2SDB] Simplify include / exclude node specification.

2017-07-30 Thread mjansen
Author: mjansen
Date: Sun Jul 30 13:37:35 2017
New Revision: 75457

URL: http://svn.reactos.org/svn/reactos?rev=75457=rev
Log:
[SDK][XML2SDB] Simplify include / exclude node specification.

Modified:
trunk/reactos/media/sdb/sysmain.xml
trunk/reactos/sdk/tools/xml2sdb/main.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h

Modified: trunk/reactos/media/sdb/sysmain.xml
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/sdb/sysmain.xml?rev=75457=75456=75457=diff
==
--- trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] (original)
+++ trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] Sun Jul 30 13:37:35 2017
@@ -8,57 +8,147 @@
 
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 
+
+
+
+
+
 aclayers.dll
 
 

Modified: trunk/reactos/sdk/tools/xml2sdb/main.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/main.cpp?rev=75457=75456=75457=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] Sun Jul 30 
13:37:35 2017
@@ -1,9 +1,9 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT: ReactOS xml to sdb converter
- * FILE:sdk/tools/xml2sdb/main.cpp
- * PURPOSE: Implement platform agnostic read / write / allocation 
functions, parse commandline
- * PROGRAMMERS: Mark Jansen
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT: ReactOS xml to sdb converter
+ * FILE:sdk/tools/xml2sdb/main.cpp
+ * PURPOSE: Implement platform agnostic read / write / allocation 
functions, parse commandline
+ * PROGRAMMERS: Mark Jansen (mark.jan...@reactos.org)
  *
  */
 
@@ -201,7 +201,6 @@
 g_ShimDebugLevel = strtoul(value.c_str(), NULL, 10);
 }
 
-// -i R:\src\apphelp\reactos\media\sdb\sysmain.xml 
-oR:\build\apphelp\devenv_msvc\media\sdb\ros2.sdb
 int main(int argc, char * argv[])
 {
 std::string input, output;

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp?rev=75457=75456=75457=diff
==
--- trunk

[ros-diffs] [mjansen] 75455: [SHIMENG] Partial rewrite to make the code easier to maintain. - Protect ARRAY access with macro's / helper functions. - Do not store objects in the ARRAY data, but store

2017-07-30 Thread mjansen
Author: mjansen
Date: Sun Jul 30 12:47:57 2017
New Revision: 75455

URL: http://svn.reactos.org/svn/reactos?rev=75455=rev
Log:
[SHIMENG] Partial rewrite to make the code easier to maintain.
- Protect ARRAY access with macro's / helper functions.
- Do not store objects in the ARRAY data, but store pointers to the objects.
- Rewrite import hooking to use an ARRAY instead of single linked lists.

Modified:
trunk/reactos/dll/appcompat/apphelp/shimeng.c
trunk/reactos/dll/appcompat/apphelp/shimeng.h

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75455=75454=75455=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sun Jul 30 
12:47:57 2017
@@ -17,7 +17,6 @@
  */
 
 #define WIN32_NO_STATUS
-#include "windows.h"
 #include "ntndk.h"
 #define IN_APPHELP
 #include "shimlib.h"
@@ -40,7 +39,7 @@
 BOOL g_bComPlusImage = FALSE;
 BOOL g_bShimDuringInit = FALSE;
 BOOL g_bInternalHooksUsed = FALSE;
-static ARRAY g_pShimInfo;  /* SHIMMODULE */
+static ARRAY g_pShimInfo;  /* PSHIMMODULE */
 static ARRAY g_pHookArray; /* HOOKMODULEINFO */
 
 HOOKAPIEX g_IntHookEx[] =
@@ -50,23 +49,32 @@
 "GetProcAddress",   /* FunctionName */
 StubGetProcAddress, /* ReplacementFunction*/
 NULL,   /* OriginalFunction */
-{ NULL },   /* ModuleLink */
-{ NULL }/* ApiLink */
+NULL,   /* pShimInfo */
+NULL/* Unused */
 },
 };
 
-
-
-
-static BOOL ARRAY_EnsureSize(PARRAY Array, DWORD ItemSize, DWORD GrowWith)
+static inline BOOL ARRAY_InitWorker(PARRAY Array, DWORD ItemSize)
+{
+Array->Data__ = NULL;
+Array->Size__ = Array->MaxSize__ = 0;
+Array->ItemSize__ = ItemSize;
+
+return TRUE;
+}
+
+static inline BOOL ARRAY_EnsureSize(PARRAY Array, DWORD ItemSize, DWORD 
GrowWith)
 {
 PVOID pNewData;
 DWORD Count;
 
-if (Array->MaxSize > Array->Size)
+ASSERT(Array);
+ASSERT(ItemSize == Array->ItemSize__);
+
+if (Array->MaxSize__ > Array->Size__)
 return TRUE;
 
-Count = Array->Size + GrowWith;
+Count = Array->Size__ + GrowWith;
 pNewData = SeiAlloc(Count * ItemSize);
 
 if (!pNewData)
@@ -74,18 +82,49 @@
 SHIMENG_FAIL("Failed to allocate %d bytes\n", Count * ItemSize);
 return FALSE;
 }
-Array->MaxSize = Count;
-
-if (Array->Data)
-{
-memcpy(pNewData, Array->Data, Array->Size * ItemSize);
-SeiFree(Array->Data);
-}
-Array->Data = pNewData;
+Array->MaxSize__ = Count;
+
+if (Array->Data__)
+{
+memcpy(pNewData, Array->Data__, Array->Size__ * ItemSize);
+SeiFree(Array->Data__);
+}
+Array->Data__ = pNewData;
 
 return TRUE;
 }
 
+static inline PVOID ARRAY_AppendWorker(PARRAY Array, DWORD ItemSize, DWORD 
GrowWith)
+{
+PBYTE pData;
+
+if (!ARRAY_EnsureSize(Array, ItemSize, GrowWith))
+return NULL;
+
+pData = Array->Data__;
+pData += (Array->Size__ * ItemSize);
+Array->Size__++;
+
+return pData;
+}
+
+static inline PVOID ARRAY_AtWorker(PARRAY Array, DWORD ItemSize, DWORD n)
+{
+PBYTE pData;
+
+ASSERT(Array);
+ASSERT(ItemSize == Array->ItemSize__);
+ASSERT(n < Array->Size__);
+
+pData = Array->Data__;
+return pData + (n * ItemSize);
+}
+
+
+#define ARRAY_Init(Array, TypeOfArray)  ARRAY_InitWorker((Array), 
sizeof(TypeOfArray))
+#define ARRAY_Append(Array, TypeOfArray)
(TypeOfArray*)ARRAY_AppendWorker((Array), sizeof(TypeOfArray), 5)
+#define ARRAY_At(Array, TypeOfArray, at)
(TypeOfArray*)ARRAY_AtWorker((Array), sizeof(TypeOfArray), at)
+#define ARRAY_Size(Array)   (Array)->Size__
 
 
 VOID SeiInitDebugSupport(VOID)
@@ -185,16 +224,15 @@
 /* TODO: Guard against recursive calling / calling init multiple times! */
 VOID NotifyShims(DWORD dwReason, PVOID Info)
 {
-PSHIMMODULE Data;
 DWORD n;
 
-Data = g_pShimInfo.Data;
-for (n = 0; n < g_pShimInfo.Size; ++n)
-{
-if (!Data[n].pNotifyShims)
+for (n = 0; n < ARRAY_Size(_pShimInfo); ++n)
+{
+PSHIMMODULE pShimModule = *ARRAY_At(_pShimInfo, PSHIMMODULE, n);
+if (!pShimModule->pNotifyShims)
 continue;
 
-Data[n].pNotifyShims(dwReason, Info);
+pShimModule->pNotifyShims(dwReason, Info);
 }
 }
 
@@ -209,25 +247,25 @@
 }
 
 
-PSHIMMODULE SeiGetShimInfo(PVOID BaseAddress)
-{
-PSHIMMODULE Data;
+PSHIMMODULE SeiGetShimModuleInfo(PVOID BaseAddress)
+{
 DWORD n;
 
-Data = g_pShimInfo.Data;
-for (n = 0; n < g_pShimInfo.Size; ++n)
-{

[ros-diffs] [mjansen] 75432: [APPHELP] Various cleanup tasks - Move debug heap functionality to a separate file - Clean includes - Remove msvcrt dependency - Clean up string usage - Remove some higher

2017-07-28 Thread mjansen
Author: mjansen
Date: Fri Jul 28 19:00:27 2017
New Revision: 75432

URL: http://svn.reactos.org/svn/reactos?rev=75432=rev
Log:
[APPHELP] Various cleanup tasks
- Move debug heap functionality to a separate file
- Clean includes
- Remove msvcrt dependency
- Clean up string usage
- Remove some higher level functions in favor of their ntdll counterparts (wip).

Added:
trunk/reactos/dll/appcompat/apphelp/dbgheap.c   (with props)
Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/layer.c
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c
trunk/reactos/dll/appcompat/apphelp/sdbread.c
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c

Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt?rev=75432=75431=75432=diff
==
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] Fri Jul 28 
19:00:27 2017
@@ -9,6 +9,7 @@
 
 list(APPEND SOURCE
 apphelp.c
+dbgheap.c
 hsdb.c
 layer.c
 sdbapi.c
@@ -26,8 +27,7 @@
 apphelp.rc
 ${CMAKE_CURRENT_BINARY_DIR}/apphelp.def)
 
-set_module_type(apphelp win32dll)
-target_link_libraries(apphelp wine)
+set_module_type(apphelp win32dll UNICODE ENTRYPOINT DllMain 12)
 add_delay_importlibs(apphelp version)
-add_importlibs(apphelp msvcrt kernel32 ntdll)
+add_importlibs(apphelp kernel32 ntdll)
 add_cd_file(TARGET apphelp DESTINATION reactos/system32 FOR all)

Added: trunk/reactos/dll/appcompat/apphelp/dbgheap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/dbgheap.c?rev=75432
==
--- trunk/reactos/dll/appcompat/apphelp/dbgheap.c   (added)
+++ trunk/reactos/dll/appcompat/apphelp/dbgheap.c   [iso-8859-1] Fri Jul 28 
19:00:27 2017
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2017 Mark Jansen (mark.jan...@reactos.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_NO_STATUS
+#include "ntndk.h"
+
+
+#if SDBAPI_DEBUG_ALLOC
+
+#define TRACE_ALL_FREE_CALLS1
+
+typedef struct SHIM_ALLOC_ENTRY
+{
+PVOID Address;
+SIZE_T Size;
+int Line;
+const char* File;
+PVOID Next;
+PVOID Prev;
+} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY;
+
+static RTL_CRITICAL_SECTION g_SdbpAllocationLock;
+static RTL_AVL_TABLE g_SdbpAllocationTable;
+static HANDLE g_PrivAllocationHeap;
+
+static RTL_GENERIC_COMPARE_RESULTS
+NTAPI ShimAllocCompareRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID 
FirstStruct, _In_ PVOID SecondStruct)
+{
+PVOID First = ((PSHIM_ALLOC_ENTRY)FirstStruct)->Address;
+PVOID Second = ((PSHIM_ALLOC_ENTRY)SecondStruct)->Address;
+
+if (First < Second)
+return GenericLessThan;
+else if (First == Second)
+return GenericEqual;
+return GenericGreaterThan;
+}
+
+static PVOID NTAPI ShimAllocAllocateRoutine(_In_ PRTL_AVL_TABLE Table, _In_ 
CLONG ByteSize)
+{
+return RtlAllocateHeap(g_PrivAllocationHeap, HEAP_ZERO_MEMORY, ByteSize);
+}
+
+static VOID NTAPI ShimAllocFreeRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID 
Buffer)
+{
+RtlFreeHeap(g_PrivAllocationHeap, 0, Buffer);
+}
+
+void SdbpInsertAllocation(PVOID address, SIZE_T size, int line, const char* 
file)
+{
+SHIM_ALLOC_ENTRY Entry = {0};
+
+Entry.Address = address;
+Entry.Size = size;
+Entry.Line = line;
+Entry.File = file;
+
+RtlEnterCriticalSection(_SdbpAllocationLock);
+RtlInsertElementGenericTableAvl(_SdbpAllocationTable, , 
sizeof(Entry), NULL);
+RtlLeaveCriticalSection(_SdbpAllocationLock);
+}
+
+void SdbpUpdateAllocation(PVOID address, PVOID newaddress, SIZE_T size, int 
line, const char* file)
+{
+SHIM_ALLOC_ENTRY Lookup = {0};
+PSHIM_ALLOC_ENTRY Entry;
+Lookup.Address = address;
+
+RtlEnterCriticalSection(_SdbpAllocationLock);
+Entry = RtlLookupElementGenericTableAvl(_SdbpAllocationTable, );
+
+if (address == newaddress)
+{
+   

[ros-diffs] [mjansen] 75391: [SHORTCUTS.INF] Move the shortcut creation for screenshot.exe to the new rosapps_shortcuts.inf. Patch by Joachim Henze (reactosfanboy) CORE-13426 #resolve #comment Thanks!

2017-07-22 Thread mjansen
Author: mjansen
Date: Sat Jul 22 20:23:33 2017
New Revision: 75391

URL: http://svn.reactos.org/svn/reactos?rev=75391=rev
Log:
[SHORTCUTS.INF] Move the shortcut creation for screenshot.exe to the new 
rosapps_shortcuts.inf. Patch by Joachim Henze (reactosfanboy)
CORE-13426 #resolve #comment Thanks!

Modified:
trunk/reactos/media/inf/shortcuts.inf
trunk/rosapps/rosapps_shortcuts.inf

Modified: trunk/reactos/media/inf/shortcuts.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/shortcuts.inf?rev=75391=75390=75391=diff
==
--- trunk/reactos/media/inf/shortcuts.inf   [iso-8859-1] (original)
+++ trunk/reactos/media/inf/shortcuts.inf   [iso-8859-1] Sat Jul 22 
20:23:33 2017
@@ -35,7 +35,6 @@
 %SystemRoot%\system32\calc.exe, %CALC_TITLE%, %CALC_DESC%, 0, 
%HOMEDRIVE%%HOMEPATH%
 %SystemRoot%\system32\cmd.exe, %CMD_TITLE%, %CMD_DESC%, 0, 
%HOMEDRIVE%%HOMEPATH%
 %SystemRoot%\system32\notepad.exe, %NOTEPAD_TITLE%, %NOTEPAD_DESC%, 0, 
%HOMEDRIVE%%HOMEPATH%
-%SystemRoot%\system32\screenshot.exe, %SCREENSHOT_TITLE%, %SCREENSHOT_DESC%, 
0, %HOMEDRIVE%%HOMEPATH%
 %SystemRoot%\system32\wordpad.exe, %WORDPAD_TITLE%, %WORDPAD_DESC%, 0, 
%HOMEDRIVE%%HOMEPATH%
 %SystemRoot%\system32\mspaint.exe, %MSPAINT_TITLE%, %MSPAINT_DESC%, 0, 
%HOMEDRIVE%%HOMEPATH%
 
@@ -96,8 +95,6 @@
 NOTEPAD_DESC=Launch Text Editor
 MSTSC_TITLE=Remote Desktop Connection
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Take screenshot
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Launch Document Editor
 MSPAINT_TITLE=Paint
@@ -161,8 +158,6 @@
 NOTEPAD_DESC=Пускане на текстообратващата
 MSTSC_TITLE=Далечна работна площ
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=Снимка
-SCREENSHOT_DESC=Заснемане на екрана
 WORDPAD_TITLE=Тетрадка
 WORDPAD_DESC=Пускане на документната 
обработваща
 MSPAINT_TITLE=Рисунък
@@ -224,8 +219,6 @@
 NOTEPAD_DESC=Spustit Poznámkový blok
 MSTSC_TITLE=Vzdálená plocha
 MSTSC_DESC=Spustit Vzdálenou plochu
-SCREENSHOT_TITLE=Sejmout obrazovku
-SCREENSHOT_DESC=Sejmout obrazovku
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Spustit WordPad
 MSPAINT_TITLE=Malování
@@ -290,8 +283,6 @@
 NOTEPAD_DESC=Starte Texteditor
 MSTSC_TITLE=Remote Desktop
 MSTSC_DESC=Remote Desktop Verbindung starten
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Screenshot erstellen
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Starte Dokumenteneditor
 MSPAINT_TITLE=Paint
@@ -353,8 +344,6 @@
 NOTEPAD_DESC=Σημειωματάριο
 MSTSC_TITLE=Σύνδεση απομακρυσμένης επιφάνειας 
εργασίας
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Take screenshot
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Launch Document Editor
 MSPAINT_TITLE=Paint
@@ -419,8 +408,6 @@
 NOTEPAD_DESC=Ejecuta un editor de texto simple.
 MSTSC_TITLE=Escritorio remoto
 MSTSC_DESC=Ejecuta una conexión de escritorio remoto.
-SCREENSHOT_TITLE=Captura de pantalla
-SCREENSHOT_DESC=Guarda secciones de la pantalla como un archivo de imagen.
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Ejecuta un editor de documentos de texto enriquecido.
 MSPAINT_TITLE=Paint
@@ -482,8 +469,6 @@
 NOTEPAD_DESC=Ava Tekstiredaktor
 MSTSC_TITLE=Remote Desktop
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Tee ekraanitõmmis
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Ava Dokumendiredaktor
 MSPAINT_TITLE=Paint
@@ -548,8 +533,6 @@
 NOTEPAD_DESC=Lancer l'Éditeur de Texte
 MSTSC_TITLE=Bureau Distant
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=Capture d'écran
-SCREENSHOT_DESC=Faire une capture d'écran
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Lancer l'Éditeur de Documents
 MSPAINT_TITLE=Paint
@@ -613,8 +596,6 @@
 NOTEPAD_DESC=עורך טקסט
 MSTSC_TITLE=שולחן עבודה מרוחק
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=צילום מסך
 WORDPAD_TITLE=כתבן
 WORDPAD_DESC=עורך המסמכים
 MSPAINT_TITLE=צייר
@@ -676,8 +657,6 @@
 NOTEPAD_DESC=Launch Text Editor
 MSTSC_TITLE=Remote Desktop
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Take screenshot
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Launch Document Editor
 MSPAINT_TITLE=Paint
@@ -739,8 +718,6 @@
 NOTEPAD_DESC=Jalankan Editor Teks
 MSTSC_TITLE=Remote Desktop
 MSTSC_DESC=Launch Remote Desktop Connection
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Ambil foto layar
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Jalankan Editor Dokumen
 MSPAINT_TITLE=Paint
@@ -805,8 +782,6 @@
 NOTEPAD_DESC=Lancia l'editor dei testi
 MSTSC_TITLE=Connessione desktop remoto
 MSTSC_DESC=Avva la connessione a desktop remoto
-SCREENSHOT_TITLE=SnapShot
-SCREENSHOT_DESC=Salva una schermata
 WORDPAD_TITLE=WordPad
 WORDPAD_DESC=Lancia l'editor

[ros-diffs] [mjansen] 75390: [WIN32SS][SHELL32] Fix the location and repaint of the version info shown on the desktop. Patch by Katayama Hirofumi MZ. CORE-13567 #resolve #comment Thanks!

2017-07-22 Thread mjansen
Author: mjansen
Date: Sat Jul 22 18:27:32 2017
New Revision: 75390

URL: http://svn.reactos.org/svn/reactos?rev=75390=rev
Log:
[WIN32SS][SHELL32] Fix the location and repaint of the version info shown on 
the desktop. Patch by Katayama Hirofumi MZ.
CORE-13567 #resolve #comment Thanks!

Modified:
trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp
trunk/reactos/win32ss/user/ntuser/desktop.c

Modified: trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp?rev=75390=75389=75390=diff
==
--- trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp
[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp
[iso-8859-1] Sat Jul 22 18:27:32 2017
@@ -383,6 +383,8 @@
 ::ShowWindow(m_hWnd, SW_RESTORE);
 }
 
+::InvalidateRect(m_hWndShellView, NULL, TRUE);
+
 return 0;
 }
 

Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/desktop.c?rev=75390=75389=75390=diff
==
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Sat Jul 22 
18:27:32 2017
@@ -1346,8 +1346,13 @@
 
 if (!UserSystemParametersInfo(SPI_GETWORKAREA, 0, , 0))
 {
+Rect.left = Rect.top = 0;
 Rect.right  = UserGetSystemMetrics(SM_CXSCREEN);
 Rect.bottom = UserGetSystemMetrics(SM_CYSCREEN);
+}
+else
+{
+RECTL_vOffsetRect(, -Rect.left, -Rect.top);
 }
 
 /*




[ros-diffs] [mjansen] 75388: [SYSSETUP][SHORTCUTS.INF] Add FontSub program shortcut to Start Menu. Patch by Katayama Hirofumi MZ. CORE-13428 #resolve #comment Thanks!

2017-07-22 Thread mjansen
Author: mjansen
Date: Sat Jul 22 16:55:08 2017
New Revision: 75388

URL: http://svn.reactos.org/svn/reactos?rev=75388=rev
Log:
[SYSSETUP][SHORTCUTS.INF] Add FontSub program shortcut to Start Menu. Patch by 
Katayama Hirofumi MZ.
CORE-13428 #resolve #comment Thanks!

Added:
trunk/rosapps/rosapps_shortcuts.inf
Modified:
trunk/reactos/dll/win32/syssetup/install.c
trunk/rosapps/CMakeLists.txt

Modified: trunk/reactos/dll/win32/syssetup/install.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install.c?rev=75388=75387=75388=diff
==
--- trunk/reactos/dll/win32/syssetup/install.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/install.c  [iso-8859-1] Sat Jul 22 
16:55:08 2017
@@ -1273,6 +1273,20 @@
 
 SetupCloseInfFile(hShortcutsInf);
 
+hShortcutsInf = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
+   NULL,
+   INF_STYLE_WIN4,
+   NULL);
+if (hShortcutsInf != INVALID_HANDLE_VALUE)
+{
+if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
+{
+FatalError("CreateShortcuts(rosapps) failed");
+return 0;
+}
+SetupCloseInfFile(hShortcutsInf);
+}
+
 SetupCloseInfFile(hSysSetupInf);
 SetSetupType(0);
 

Modified: trunk/rosapps/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/CMakeLists.txt?rev=75388=75387=75388=diff
==
--- trunk/rosapps/CMakeLists.txt[iso-8859-1] (original)
+++ trunk/rosapps/CMakeLists.txt[iso-8859-1] Sat Jul 22 16:55:08 2017
@@ -3,3 +3,16 @@
 add_subdirectory(drivers)
 add_subdirectory(lib)
 add_subdirectory(templates)
+
+list(APPEND ROSAPPS_INF_FILES rosapps_shortcuts.inf)
+
+foreach(item ${ROSAPPS_INF_FILES})
+set(_rosapps_converted_item ${CMAKE_CURRENT_BINARY_DIR}/${item})
+set(_rosapps_source_item ${CMAKE_CURRENT_SOURCE_DIR}/${item})
+add_custom_command(OUTPUT "${_rosapps_converted_item}"
+   COMMAND native-utf16le "${_rosapps_source_item}" 
"${_rosapps_converted_item}"
+   DEPENDS native-utf16le "${_rosapps_source_item}")
+add_cd_file(TARGET converted_inf_files2 FILE ${_rosapps_converted_item} 
DESTINATION reactos/inf FOR all)
+list(APPEND rosapps_converted_item ${_rosapps_converted_item})
+endforeach(item)
+add_custom_target(converted_inf_files2 DEPENDS ${rosapps_converted_item})

Added: trunk/rosapps/rosapps_shortcuts.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/rosapps_shortcuts.inf?rev=75388
==
--- trunk/rosapps/rosapps_shortcuts.inf (added)
+++ trunk/rosapps/rosapps_shortcuts.inf [iso-8859-1] Sat Jul 22 16:55:08 2017
@@ -0,0 +1,294 @@
+[Version]
+Signature = $Windows NT$
+ClassGUID = {----}
+
+[ShortcutFolders]
+DesktopShortcuts=0,
+ProgramShortcuts=2,
+AdminToolsShortcuts=47,
+AccessoriesShortcuts=2, %ACCESSORIES%
+SystemToolsShortcuts=2, %ACCESSORIES%\%SYSTOOLS%
+AccessibilityShortcuts=2, %ACCESSORIES%\%ACCESSIBILITY%
+EntertainmentShortcuts=2, %ACCESSORIES%\%ENTERTAINMENT%
+CommunicationsShortcuts=2, %ACCESSORIES%\%COMMUNICATIONS%
+GamesShortcuts=2, %GAMES%
+
+[SystemToolsShortcuts]
+%SystemRoot%\system32\fontsub.exe, %FONTSUB_TITLE%, %FONTSUB_DESC%, 0
+
+; STRINGS ---
+
+[Strings]
+ACCESSORIES=Accessories
+SYSTOOLS=System Tools
+ACCESSIBILITY=Accessibility
+ENTERTAINMENT=Entertainment
+COMMUNICATIONS=Communications
+GAMES=Games
+
+FONTSUB_TITLE=FontSub
+FONTSUB_DESC=Font Substitutes Editor
+
+; Bulgarian
+[Strings.0402]
+ACCESSORIES=Принадлежности
+SYSTOOLS=Системни средства
+ACCESSIBILITY=Достъпност
+ENTERTAINMENT=Забавление
+COMMUNICATIONS=Communications
+GAMES=Игри
+
+FONTSUB_TITLE=FontSub
+FONTSUB_DESC=Font Substitutes Editor
+
+; Czech
+[Strings.0405]
+ACCESSORIES=Příslušenství
+SYSTOOLS=Systémové nástroje
+ACCESSIBILITY=Usnadnění
+ENTERTAINMENT=Zábava
+COMMUNICATIONS=Communications
+GAMES=Hry
+
+FONTSUB_TITLE=FontSub
+FONTSUB_DESC=Font Substitutes Editor
+
+; German
+[Strings.0407]
+ACCESSORIES=Zubehör
+SYSTOOLS=Systemprogramme
+ACCESSIBILITY=Eingabehilfen
+ENTERTAINMENT=Unterhaltung
+COMMUNICATIONS=Kommunikation
+GAMES=Spiele
+
+FONTSUB_TITLE=FontSub
+FONTSUB_DESC=Font Substitutes Editor
+
+; Greek
+[Strings.0408]
+ACCESSORIES=Βοηθήματα
+SYSTOOLS=Εργαλεία Συστήματος
+ACCESSIBILITY=Για άτομα με ειδικές ανάγκες
+ENTERTAINMENT=Διασκέδαση
+COMMUNICATIONS=Communications
+GAMES=Παιχνίδια
+
+FONTSUB_TITLE=FontSub
+FONTSU

[ros-diffs] [mjansen] 75359: [SHIMENG] Pass shim commandline to shims. CORE-11329

2017-07-16 Thread mjansen
Author: mjansen
Date: Sun Jul 16 13:56:08 2017
New Revision: 75359

URL: http://svn.reactos.org/svn/reactos?rev=75359=rev
Log:
[SHIMENG] Pass shim commandline to shims. CORE-11329

Modified:
trunk/reactos/dll/appcompat/apphelp/shimeng.c

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75359=75358=75359=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sun Jul 16 
13:56:08 2017
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -790,13 +790,13 @@
 TAGID ShimRef;
 if (SdbTagRefToTagID(hsdb, Data[n], , ))
 {
-LPCWSTR ShimName, DllName;
+LPCWSTR ShimName, DllName, CommandLine = NULL;
 TAGID ShimTag;
 WCHAR FullNameBuffer[MAX_PATH];
 UNICODE_STRING UnicodeDllName;
 PVOID BaseAddress;
 PSHIMMODULE pShimInfo = NULL;
-const char* szCommandLine = "";
+ANSI_STRING AnsiCommandLine = RTL_CONSTANT_STRING("");
 PHOOKAPIEX pHookApi;
 DWORD dwHookCount;
 
@@ -805,6 +805,21 @@
 {
 SHIMENG_FAIL("Failed to retrieve the name for 0x%x\n", 
Data[n]);
 continue;
+}
+
+CommandLine = SeiGetStringPtr(pdb, ShimRef, TAG_COMMAND_LINE);
+if (CommandLine && *CommandLine)
+{
+RtlInitUnicodeString(, CommandLine);
+if (NT_SUCCESS(RtlUnicodeStringToAnsiString(, 
, TRUE)))
+{
+SHIMENG_INFO("COMMAND LINE %s for %S", 
AnsiCommandLine.Buffer, ShimName);
+}
+else
+{
+AnsiCommandLine.Buffer = "";
+CommandLine = NULL;
+}
 }
 
 ShimTag = SeiGetDWORD(pdb, ShimRef, TAG_SHIM_TAGID);
@@ -828,11 +843,6 @@
 SHIMENG_WARN("Failed to build a full path for %S\n", ShimName);
 continue;
 }
-
-/* TODO:
-SeiGetShimCommandLine();
-[SeiInit] COMMAND_LINE VirtualRegistry(WINNT;VistaRTMLie) from 
AcLayers.DLL
-*/
 
 RtlInitUnicodeString(, FullNameBuffer);
 if (NT_SUCCESS(LdrGetDllHandle(NULL, NULL, , 
)))
@@ -857,11 +867,13 @@
 SHIMENG_INFO("Shim DLL 0x%p \"%wZ\" loaded\n", BaseAddress, 
);
 SHIMENG_INFO("Using SHIM \"%S!%S\"\n", DllName, ShimName);
 
-
-pHookApi = pShimInfo->pGetHookAPIs(szCommandLine, ShimName, 
);
+pHookApi = pShimInfo->pGetHookAPIs(AnsiCommandLine.Buffer, 
ShimName, );
 SHIMENG_INFO("GetHookAPIs returns %d hooks for DLL \"%wZ\" SHIM 
\"%S\"\n", dwHookCount, , ShimName);
 if (dwHookCount)
 SeiAppendHookInfo(pShimInfo, pHookApi, dwHookCount);
+
+if (CommandLine && *CommandLine)
+RtlFreeAnsiString();
 
 dwTotalHooks += dwHookCount;
 /*SeiBuildInclExclList*/




[ros-diffs] [mjansen] 75358: [SHIMLIB] Add debug print functionality for shims. CORE-11329

2017-07-16 Thread mjansen
Author: mjansen
Date: Sun Jul 16 13:50:23 2017
New Revision: 75358

URL: http://svn.reactos.org/svn/reactos?rev=75358=rev
Log:
[SHIMLIB] Add debug print functionality for shims. CORE-11329

Modified:
trunk/reactos/dll/appcompat/apphelp/shimeng.c
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75358=75357=75358=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sun Jul 16 
13:50:23 2017
@@ -19,6 +19,7 @@
 #define WIN32_NO_STATUS
 #include "windows.h"
 #include "ntndk.h"
+#define IN_APPHELP
 #include "shimlib.h"
 #include 
 /* Make sure we don't include apphelp logging */

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=75358=75357=75358=diff
==
--- trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/shimlib/shimlib.c [iso-8859-1] Sun Jul 16 
13:50:23 2017
@@ -3,13 +3,15 @@
  * PROJECT: ReactOS Shim library
  * FILE:dll/appcompat/shims/shimlib/shimlib.c
  * PURPOSE: Shim helper functions
- * PROGRAMMER:  Mark Jansen
+ * PROGRAMMER:  Mark Jansen (mark.jan...@reactos.org)
  */
 
+#define WIN32_NO_STATUS
 #include 
 #include 
 #include 
 #include 
+#include 
 
 typedef struct UsedShim
 {
@@ -21,6 +23,7 @@
 } UsedShim, *pUsedShim;
 
 
+ULONG g_ShimEngDebugLevel = 0x;
 static HANDLE g_ShimLib_Heap;
 static PSLIST_HEADER g_UsedShims;
 
@@ -146,3 +149,89 @@
 
 return TRUE;
 }
+
+
+VOID SeiInitDebugSupport(VOID)
+{
+static const UNICODE_STRING DebugKey = 
RTL_CONSTANT_STRING(L"SHIM_DEBUG_LEVEL");
+UNICODE_STRING DebugValue;
+NTSTATUS Status;
+ULONG NewLevel = 0;
+WCHAR Buffer[40];
+
+RtlInitEmptyUnicodeString(, Buffer, sizeof(Buffer));
+
+Status = RtlQueryEnvironmentVariable_U(NULL, , );
+
+if (NT_SUCCESS(Status))
+{
+if (!NT_SUCCESS(RtlUnicodeStringToInteger(, 10, )))
+NewLevel = 0;
+}
+g_ShimEngDebugLevel = NewLevel;
+}
+
+
+/**
+* Outputs diagnostic info.
+*
+* @param [in]  Level   The level to log this message with, choose any 
of [SHIM_ERR,
+*  SHIM_WARN, SHIM_INFO].
+* @param [in]  FunctionNameThe function this log should be attributed to.
+* @param [in]  Format  The format string.
+* @param   ... Variable arguments providing additional 
information.
+*
+* @return  Success: TRUE Failure: FALSE.
+*/
+BOOL WINAPIV SeiDbgPrint(SEI_LOG_LEVEL Level, PCSTR Function, PCSTR Format, 
...)
+{
+char Buffer[512];
+char* Current = Buffer;
+const char* LevelStr;
+size_t Length = sizeof(Buffer);
+va_list ArgList;
+HRESULT hr;
+
+if (g_ShimEngDebugLevel == 0x)
+SeiInitDebugSupport();
+
+if (Level > g_ShimEngDebugLevel)
+return FALSE;
+
+switch (Level)
+{
+case SEI_MSG:
+LevelStr = "MSG ";
+break;
+case SEI_FAIL:
+LevelStr = "FAIL";
+break;
+case SEI_WARN:
+LevelStr = "WARN";
+break;
+case SEI_INFO:
+LevelStr = "INFO";
+break;
+default:
+LevelStr = "USER";
+break;
+}
+
+if (Function)
+hr = StringCchPrintfExA(Current, Length, , , 
STRSAFE_NULL_ON_FAILURE, "[%s] [%s] ", LevelStr, Function);
+else
+hr = StringCchPrintfExA(Current, Length, , , 
STRSAFE_NULL_ON_FAILURE, "[%s] ", LevelStr);
+
+if (!SUCCEEDED(hr))
+return FALSE;
+
+va_start(ArgList, Format);
+hr = StringCchVPrintfExA(Current, Length, , , 
STRSAFE_NULL_ON_FAILURE, Format, ArgList);
+va_end(ArgList);
+if (!SUCCEEDED(hr))
+return FALSE;
+
+DbgPrint("%s", Buffer);
+return TRUE;
+}
+

Modified: trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h?rev=75358=75357=75358=diff
==
--- trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h [iso-8859-1] Sun Jul 16 
13:50:23 2017
@@ -3,7 +3,7 @@
  * PROJECT: ReactOS Shim Engine
  * FILE:dll/appcompat/shims/shimlib/shimlib.h
  * PURPOSE: ReactOS Shim Engine
- * PROGRAMMER:  Mark Jansen
+ 

[ros-diffs] [mjansen] 75357: [ACPPAGE] Usability: Convert the edit box to a combobox, ask the user if they want to add the layer when closing the dialog.

2017-07-16 Thread mjansen
Author: mjansen
Date: Sun Jul 16 13:47:16 2017
New Revision: 75357

URL: http://svn.reactos.org/svn/reactos?rev=75357=rev
Log:
[ACPPAGE] Usability: Convert the edit box to a combobox, ask the user if they 
want to add the layer when closing the dialog.

Modified:
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
trunk/reactos/dll/shellext/acppage/lang/bg-BG.rc
trunk/reactos/dll/shellext/acppage/lang/cs-CZ.rc
trunk/reactos/dll/shellext/acppage/lang/de-DE.rc
trunk/reactos/dll/shellext/acppage/lang/en-US.rc
trunk/reactos/dll/shellext/acppage/lang/es-ES.rc
trunk/reactos/dll/shellext/acppage/lang/eu-ES.rc
trunk/reactos/dll/shellext/acppage/lang/fr-FR.rc
trunk/reactos/dll/shellext/acppage/lang/he-IL.rc
trunk/reactos/dll/shellext/acppage/lang/hu-HU.rc
trunk/reactos/dll/shellext/acppage/lang/id-ID.rc
trunk/reactos/dll/shellext/acppage/lang/it-IT.rc
trunk/reactos/dll/shellext/acppage/lang/nl-NL.rc
trunk/reactos/dll/shellext/acppage/lang/no-NO.rc
trunk/reactos/dll/shellext/acppage/lang/pl-PL.rc
trunk/reactos/dll/shellext/acppage/lang/ro-RO.rc
trunk/reactos/dll/shellext/acppage/lang/ru-RU.rc
trunk/reactos/dll/shellext/acppage/lang/sk-SK.rc
trunk/reactos/dll/shellext/acppage/lang/sq-AL.rc
trunk/reactos/dll/shellext/acppage/lang/sv-SE.rc
trunk/reactos/dll/shellext/acppage/lang/tr-TR.rc
trunk/reactos/dll/shellext/acppage/lang/uk-UA.rc
trunk/reactos/dll/shellext/acppage/lang/zh-CN.rc
trunk/reactos/dll/shellext/acppage/lang/zh-TW.rc
trunk/reactos/dll/shellext/acppage/resource.h

Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp?rev=75357=75356=75357=diff
==
--- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
Sun Jul 16 13:47:16 2017
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jan...@reactos.org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -442,9 +442,36 @@
 EnableWindow(GetDlgItem(hWnd, IDC_DELETE), Sel >= 0);
 }
 
+static void OnAdd(HWND hWnd)
+{
+HWND Combo = GetDlgItem(hWnd, IDC_NEWCOMPATIBILITYMODE);
+
+int Length = ComboBox_GetTextLength(Combo);
+CComBSTR Str(Length);
+ComboBox_GetText(Combo, Str, Length+1);
+HWND List = GetDlgItem(hWnd, IDC_COMPATIBILITYMODE);
+int Index = ListBox_FindStringExact(List, -1, Str);
+if (Index == LB_ERR)
+Index = ListBox_AddString(List, Str);
+ListBox_SetCurSel(List, Index);
+ListboxChanged(hWnd);
+ComboBox_SetText(Combo, TEXT(""));
+SetFocus(Combo);
+}
+
+static BOOL ComboHasData(HWND hWnd)
+{
+HWND Combo = GetDlgItem(hWnd, IDC_NEWCOMPATIBILITYMODE);
+if (ComboBox_GetCurSel(Combo) >= 0)
+return TRUE;
+ULONG Len = ComboBox_GetTextLength(Combo);
+return Len > 0;
+}
+
 INT_PTR CALLBACK CLayerUIPropPage::EditModesProc(HWND hWnd, UINT uMsg, WPARAM 
wParam, LPARAM lParam)
 {
 CLayerUIPropPage* page = NULL;
+
 switch (uMsg)
 {
 case WM_INITDIALOG:
@@ -452,19 +479,16 @@
 page->AddRef();
 SetProp(hWnd, ACP_WNDPROP, page);
 {
-CComPtr autoComplete;
-HRESULT hr = CoCreateInstance(CLSID_AutoComplete, NULL, 
CLSCTX_INPROC_SERVER, IID_PPV_ARG(IAutoComplete, ));
-if (SUCCEEDED(hr))
-{
-CComPtr autoComplete2;
-hr = autoComplete->QueryInterface(IID_PPV_ARG(IAutoComplete2, 
));
-if (SUCCEEDED(hr))
-{
-autoComplete2->SetOptions(ACO_AUTOSUGGEST | 
ACO_UPDOWNKEYDROPSLIST);
-HWND Edit = GetDlgItem(hWnd, IDC_NEWCOMPATIBILITYMODE);
-CComObject* pList = new 
CComObject();
-hr = autoComplete2->Init(Edit, pList, NULL, NULL);
-}
+HWND Combo = GetDlgItem(hWnd, IDC_NEWCOMPATIBILITYMODE);
+CComObject pList;
+
+while (TRUE)
+{
+CComBSTR str;
+HRESULT hr = pList.Next(1, , NULL);
+if (hr != S_OK)
+break;
+ComboBox_AddString(Combo, str);
 }
 
 HWND List = GetDlgItem(hWnd, IDC_COMPATIBILITYMODE);
@@ -483,24 +507,12 @@
 RemoveProp(hWnd, ACP_WNDPROP);
 page->Release();
 break;
+
 case WM_COMMAND:
 switch(LOWORD(wParam))
 {
 case IDC_ADD:
-{
-HWND Edit = GetDlgItem(hWnd, IDC_NEWCOMPATIBILITYMODE);
-int Length = GetWindowTextLengthW(Edit);
-CComBSTR Str(Length);
-  

[ros-diffs] [mjansen] 75356: [SHELL32] Do not dereference a nullpointer for logging. CORE-13552

2017-07-16 Thread mjansen
Author: mjansen
Date: Sun Jul 16 13:44:18 2017
New Revision: 75356

URL: http://svn.reactos.org/svn/reactos?rev=75356=rev
Log:
[SHELL32] Do not dereference a nullpointer for logging. CORE-13552

Modified:
trunk/reactos/dll/win32/shell32/wine/shell32_main.c

Modified: trunk/reactos/dll/win32/shell32/wine/shell32_main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/shell32_main.c?rev=75356=75355=75356=diff
==
--- trunk/reactos/dll/win32/shell32/wine/shell32_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/wine/shell32_main.c [iso-8859-1] Sun Jul 16 
13:44:18 2017
@@ -423,7 +423,7 @@
 
 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
   (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
-  psfi, psfi->dwAttributes, sizeofpsfi, flags);
+  psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
 
 if (!path)
 return FALSE;




[ros-diffs] [mjansen] 75351: [USBPORT] Fix incorrect transfer direction for URBs. Patch by Vadim Galyant. CORE-13546

2017-07-15 Thread mjansen
Author: mjansen
Date: Sat Jul 15 09:24:30 2017
New Revision: 75351

URL: http://svn.reactos.org/svn/reactos?rev=75351=rev
Log:
[USBPORT] Fix incorrect transfer direction for URBs. Patch by Vadim Galyant. 
CORE-13546

Modified:
trunk/reactos/drivers/usb/usbport/urb.c
trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h

Modified: trunk/reactos/drivers/usb/usbport/urb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/urb.c?rev=75351=75350=75351=diff
==
--- trunk/reactos/drivers/usb/usbport/urb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/urb.c [iso-8859-1] Sat Jul 15 
09:24:30 2017
@@ -385,13 +385,13 @@
 
 if (Endpoint->EndpointProperties.TransferType != 
USBPORT_TRANSFER_TYPE_CONTROL)
 {
-if (Endpoint->EndpointProperties.Direction)
+if (Endpoint->EndpointProperties.Direction == 
USBPORT_TRANSFER_DIRECTION_OUT)
 {
-Urb->UrbBulkOrInterruptTransfer.TransferFlags |= 
USBD_TRANSFER_DIRECTION_IN;
+Urb->UrbBulkOrInterruptTransfer.TransferFlags &= 
~USBD_TRANSFER_DIRECTION_IN;
 }
 else
 {
-Urb->UrbBulkOrInterruptTransfer.TransferFlags &= 
~USBD_TRANSFER_DIRECTION_IN;
+Urb->UrbBulkOrInterruptTransfer.TransferFlags |= 
USBD_TRANSFER_DIRECTION_IN;
 }
 }
 

Modified: trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h?rev=75351=75350=75351=diff
==
--- trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
[iso-8859-1] (original)
+++ trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
[iso-8859-1] Sat Jul 15 09:24:30 2017
@@ -580,6 +580,7 @@
 
 C_ASSERT(sizeof(USBPORT_MINIPORT_INTERFACE) == 336);
 
+#define USBPORT_TRANSFER_DIRECTION_OUT  1 // From host to device
 typedef struct _USBPORT_ENDPOINT_PROPERTIES {
   USHORT DeviceAddress;
   USHORT EndpointAddress;




[ros-diffs] [mjansen] 75342: [APPHELP_APITEST] Convert test_match_ex to a data driven test + fix a bug in the apitest.

2017-07-14 Thread mjansen
Author: mjansen
Date: Fri Jul 14 20:35:11 2017
New Revision: 75342

URL: http://svn.reactos.org/svn/reactos?rev=75342=rev
Log:
[APPHELP_APITEST] Convert test_match_ex to a data driven test + fix a bug in 
the apitest.

Modified:
trunk/rostests/apitests/apphelp/db.cpp
trunk/rostests/apitests/apphelp/testdb.xml

Modified: trunk/rostests/apitests/apphelp/db.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.cpp?rev=75342=75341=75342=diff
==
--- trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] Fri Jul 14 
20:35:11 2017
@@ -110,6 +110,7 @@
 #define TAG_APP_NAME (0x6 | TAG_TYPE_STRINGREF)
 #define TAG_COMMAND_LINE (0x8 | TAG_TYPE_STRINGREF)
 #define TAG_COMPANY_NAME (0x9 | TAG_TYPE_STRINGREF)
+#define TAG_WILDCARD_NAME (0xB | TAG_TYPE_STRINGREF)
 #define TAG_PRODUCT_NAME (0x10 | TAG_TYPE_STRINGREF)
 #define TAG_PRODUCT_VERSION (0x11 | TAG_TYPE_STRINGREF)
 #define TAG_FILE_DESCRIPTION (0x12 | TAG_TYPE_STRINGREF)
@@ -1265,17 +1266,12 @@
 
 if (RtlDosPathNameToNtPathName_U(exename, , NULL, NULL))
 {
+/*
+ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion failed 
123 [c001]
+
ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed 
for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe 
[c001]
+*/
 ret = pSdbGetMatchingExe(hsdb, exenameNT.Buffer, NULL, NULL, 0, 
(SDBQUERYRESULT_VISTA*));
-if (!ret && g_WinVersion >= WINVER_WIN10)
-{
-/*
-ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion 
failed 123 [c001]
-
ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed 
for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe 
[c001]
-*/
-trace("Using DOS path for Win10\n");
-ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, 
(SDBQUERYRESULT_VISTA*));
-}
-ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
+ok(!ret, "SdbGetMatchingExe should not succeed for %d.\n", cur);
 
 RtlFreeUnicodeString();
 }
@@ -1372,51 +1368,56 @@
 }
 
 template
-static BOOL test_match_ex(const WCHAR* workdir, HSDB hsdb, int cur)
+static void test_match_ex(const WCHAR* workdir, HSDB hsdb)
 {
 WCHAR exename[MAX_PATH];
-WCHAR* Vendor;
+PWCHAR Vendor, AppName, TestName;
 SDBQUERYRESULT_T query;
-TAGID tagid, exetag;
+TAGID dbtag, exetag, tagid;
 BOOL ret, Succeed;
 PDB pdb;
 
 memset(, 0xab, sizeof(query));
 
-swprintf(exename, L"%s\\test_match%d.exe", workdir, cur);
-
 ret = pSdbTagRefToTagID(hsdb, 0, , );
 ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a 
valid pdb, was: %p\n", pdb);
 
-tagid = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
-ok(tagid != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n");
-
-exetag = pSdbFindFirstNamedTag(pdb, tagid, TAG_EXE, TAG_NAME, exename + 
wcslen(workdir) + 1);
-
-if (!exetag)
-{
-/* Test done */
-return FALSE;
-}
-
-tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR);
-Vendor = pSdbGetStringTagPtr(pdb, tagid);
-Succeed = tagid != TAGID_NULL && Vendor && !wcsicmp(Vendor, L"Succeed");
-
-test_create_exe(exename, 0);
-
-ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, 
(SDBQUERYRESULT_VISTA*));
-DWORD exe_count = Succeed ? 1 : 0;
-
-if (Succeed)
-ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
-else
-ok(!ret, "SdbGetMatchingExe should not succeed for %d.\n", cur);
-
-ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d 
for %d\n", exe_count, query.dwExeCount, cur);
-DeleteFileW(exename);
-/* Try the next file */
-return TRUE;
+dbtag = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
+ok(dbtag != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n");
+
+for (exetag = pSdbFindFirstTag(pdb, dbtag, TAG_EXE); exetag; exetag = 
pSdbFindNextTag(pdb, dbtag, exetag))
+{
+tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR);
+Vendor = pSdbGetStringTagPtr(pdb, tagid);
+if (!Vendor)
+continue;
+Succeed = !wcsicmp(Vendor, L"Succeed");
+if (!Succeed && wcsicmp(Vendor, L"Fail"))
+continue;
+tagid = pSdbFindFirstTag(pdb, exetag, TAG_APP_NAME);
+AppName = pSdbGetStringTagPtr(pdb, tagid);
+if (!AppName)
+continue;
+
+tagid = pSdbFindFirstTag(pdb, exetag, TAG_NAME);
+TestName = pSdbGetStringTagPtr(pdb, tagid);
+if

[ros-diffs] [mjansen] 75341: [SPOOLSS] Stub BuildOtherNamesFromMachineName as seen in wine commit cdb5f35. This fixes a crash in spoolss:spoolss

2017-07-14 Thread mjansen
Author: mjansen
Date: Fri Jul 14 20:05:27 2017
New Revision: 75341

URL: http://svn.reactos.org/svn/reactos?rev=75341=rev
Log:
[SPOOLSS] Stub BuildOtherNamesFromMachineName as seen in wine commit cdb5f35. 
This fixes a crash in spoolss:spoolss

Modified:
trunk/reactos/win32ss/printing/base/spoolss/main.c
trunk/reactos/win32ss/printing/base/spoolss/spoolss.spec

Modified: trunk/reactos/win32ss/printing/base/spoolss/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/spoolss/main.c?rev=75341=75340=75341=diff
==
--- trunk/reactos/win32ss/printing/base/spoolss/main.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/printing/base/spoolss/main.c  [iso-8859-1] Fri Jul 14 
20:05:27 2017
@@ -246,3 +246,14 @@
 SetLastError(ERROR_SUCCESS);
 return TRUE;
 }
+
+BOOL WINAPI
+BuildOtherNamesFromMachineName(LPVOID * ptr1, LPVOID * ptr2)
+{
+FIXME("(%p, %p) stub\n", ptr1, ptr2);
+
+*ptr1 = NULL;
+*ptr2 = NULL;
+return FALSE;
+}
+

Modified: trunk/reactos/win32ss/printing/base/spoolss/spoolss.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/spoolss/spoolss.spec?rev=75341=75340=75341=diff
==
--- trunk/reactos/win32ss/printing/base/spoolss/spoolss.spec[iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/printing/base/spoolss/spoolss.spec[iso-8859-1] 
Fri Jul 14 20:05:27 2017
@@ -22,7 +22,7 @@
 @ stub AppendPrinterNotifyInfoData
 @ stub bGetDevModePerUser
 @ stub bSetDevModePerUser
-@ stub BuildOtherNamesFromMachineName
+@ stdcall BuildOtherNamesFromMachineName(ptr ptr)
 @ stub CacheAddName
 @ stub CacheCreateAndAddNode
 @ stub CacheCreateAndAddNodeWithIPAddresses




[ros-diffs] [mjansen] 75340: [APPCOMPAT] Various fixes. - Simplify shimdbg output as suggested by Thomas - Simplify media/sdb/sysmain.xml - Fix some warnings + a debug print

2017-07-14 Thread mjansen
Author: mjansen
Date: Fri Jul 14 19:29:34 2017
New Revision: 75340

URL: http://svn.reactos.org/svn/reactos?rev=75340=rev
Log:
[APPCOMPAT] Various fixes.
- Simplify shimdbg output as suggested by Thomas
- Simplify media/sdb/sysmain.xml
- Fix some warnings + a debug print

Modified:
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/layer.c
trunk/reactos/media/sdb/sysmain.xml
trunk/rosapps/applications/devutils/shimdbg/shimdbg.c

Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb.c?rev=75340=75339=75340=diff
==
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] Fri Jul 14 
19:29:34 2017
@@ -577,7 +577,7 @@
 
 if (!default_dir)
 {
-WCHAR* tmp = NULL;
+WCHAR* tmp;
 UINT len = GetSystemWindowsDirectoryW(NULL, 0) + lstrlenW(szAppPatch);
 tmp = SdbAlloc((len + 1)* sizeof(WCHAR));
 if (tmp)
@@ -706,7 +706,7 @@
 pData->unknown = 0;
 pData->szLayer[0] = UNICODE_NULL;   /* TODO */
 
-SHIM_INFO("\ndwFlags0x%x\ndwMagic0x%x\ntrExe  0x%x\ntrLayer
0x%x",
+SHIM_INFO("\ndwFlags0x%x\ndwMagic0x%x\ntrExe  0x%x\ntrLayer
0x%x\n",
   pData->Query.dwFlags, pData->dwMagic, pData->Query.atrExes[0], 
pData->Query.atrLayers[0]);
 
 /* Database List */

Modified: trunk/reactos/dll/appcompat/apphelp/layer.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/layer.c?rev=75340=75339=75340=diff
==
--- trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] Fri Jul 14 
19:29:34 2017
@@ -159,7 +159,7 @@
 FindClose(FindHandle);
 SdbpResizeTempStr(LongPath, (LongPath->Str.Length >> 1) + 20);
 StringCbPrintfW(LongPath->Str.Buffer, LongPath->Str.MaximumLength, 
SIGN_MEDIA_FMT, SignMedia, Scratch.Str.Buffer + 3);
-LongPath->Str.Length = wcslen(LongPath->Str.Buffer) * 
sizeof(WCHAR);
+LongPath->Str.Length = (USHORT)wcslen(LongPath->Str.Buffer) * 
sizeof(WCHAR);
 SdbpFreeTempStr();
 return TRUE;
 }
@@ -217,7 +217,7 @@
 return Status;
 }
 }
-FullPath->MaximumLength = BasePath.Length + (wcslen(LayersKey) + 1) * 
sizeof(WCHAR);
+FullPath->MaximumLength = (USHORT)(BasePath.Length + (wcslen(LayersKey) + 
1) * sizeof(WCHAR));
 FullPath->Buffer = SdbAlloc(FullPath->MaximumLength);
 FullPath->Length = 0;
 RtlAppendUnicodeStringToString(FullPath, );

Modified: trunk/reactos/media/sdb/sysmain.xml
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/sdb/sysmain.xml?rev=75340=75339=75340=diff
==
--- trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] (original)
+++ trunk/reactos/media/sdb/sysmain.xml [iso-8859-1] Fri Jul 14 19:29:34 2017
@@ -7,224 +7,183 @@
 
 
 
-
-Win95VersionLie
+
 aclayers.dll
 
-
-Win98VersionLie
+
 aclayers.dll
 
-
-WinNT4SP5VersionLie
+
 aclayers.dll
 
-
-Win2000VersionLie
+
 aclayers.dll
 
-
-Win2000SP1VersionLie
+
 aclayers.dll
 
-
-Win2000SP2VersionLie
+
 aclayers.dll
 
-
-Win2000SP3VersionLie
+
 aclayers.dll
 
-
-WinXPVersionLie
+
 aclayers.dll
 
-
-WinXPSP1VersionLie
+
 aclayers.dll
 
-
-WinXPSP2VersionLie
+
 aclayers.dll
 
-
-WinXPSP3VersionLie
+
 aclayers.dll
 
-
-Win2k3RTMVersionLie
+
 aclayers.dll
 
-
-Win2k3SP1VersionLie
+
 aclayers.dll
 
-
-Win2k3SP2VersionLie
+
 aclayers.dll
 
-
-VistaRTMVersionLie
+
 aclayers.dll
 
-

[ros-diffs] [mjansen] 75321: [WIN32SS] Fix EqualFamilyInfo function logic. Patch by Victor Martinez Calvo, modified by Katayama Hirofumi MZ. CORE-13411 #resolve, CID 1411971

2017-07-12 Thread mjansen
Author: mjansen
Date: Wed Jul 12 18:40:49 2017
New Revision: 75321

URL: http://svn.reactos.org/svn/reactos?rev=75321=rev
Log:
[WIN32SS] Fix EqualFamilyInfo function logic. Patch by Victor Martinez Calvo, 
modified by Katayama Hirofumi MZ.
CORE-13411 #resolve, CID 1411971

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=75321=75320=75321=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Wed Jul 12 
18:40:49 2017
@@ -4550,28 +4550,23 @@
 }
 
 static BOOL
-EqualFamilyInfo(FONTFAMILYINFO *pInfo1, FONTFAMILYINFO *pInfo2)
-{
-UNICODE_STRING Str1, Str2;
-ENUMLOGFONTEXW *pLog1 = >EnumLogFontEx;
-ENUMLOGFONTEXW *pLog2 = >EnumLogFontEx;
-RtlInitUnicodeString(, pLog1->elfLogFont.lfFaceName);
-RtlInitUnicodeString(, pLog2->elfLogFont.lfFaceName);
-if (!RtlEqualUnicodeString(, , TRUE))
+EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
+{
+const ENUMLOGFONTEXW *pLog1 = >EnumLogFontEx;
+const ENUMLOGFONTEXW *pLog2 = >EnumLogFontEx;
+const LOGFONTW *plf1 = >elfLogFont;
+const LOGFONTW *plf2 = >elfLogFont;
+
+if (_wcsicmp(plf1->lfFaceName, plf2->lfFaceName) != 0)
 {
 return FALSE;
 }
-if ((pLog1->elfStyle != NULL) != (pLog2->elfStyle != NULL))
+
+if (_wcsicmp(pLog1->elfStyle, pLog2->elfStyle) != 0)
+{
 return FALSE;
-if (pLog1->elfStyle != NULL)
-{
-RtlInitUnicodeString(, pLog1->elfStyle);
-RtlInitUnicodeString(, pLog2->elfStyle);
-if (!RtlEqualUnicodeString(, , TRUE))
-{
-return FALSE;
-}
-}
+}
+
 return TRUE;
 }
 




[ros-diffs] [mjansen] 75310: [FONTS] Add substitutes for the System font, and remove a hack for the System font. Patch by Katayama Hirofumi MZ. CORE-9222

2017-07-09 Thread mjansen
Author: mjansen
Date: Sun Jul  9 15:06:49 2017
New Revision: 75310

URL: http://svn.reactos.org/svn/reactos?rev=75310=rev
Log:
[FONTS] Add substitutes for the System font, and remove a hack for the System 
font. Patch by Katayama Hirofumi MZ. CORE-9222

Modified:
trunk/reactos/base/setup/usetup/muifonts.h
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/base/setup/usetup/muifonts.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/muifonts.h?rev=75310=75309=75310=diff
==
--- trunk/reactos/base/setup/usetup/muifonts.h  [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/muifonts.h  [iso-8859-1] Sun Jul  9 
15:06:49 2017
@@ -18,6 +18,7 @@
 { L"Terminal",   L"DejaVu Sans Mono" },
 { L"Times New Roman",L"Liberation Serif" },
 { L"Trebuchet MS",   L"Open Sans" },
+{ L"System", L"FreeSans" },
 { NULL, NULL }
 };
 
@@ -38,6 +39,7 @@
 { L"Terminal",   L"DejaVu Sans Mono" },
 { L"Times New Roman",L"Liberation Serif" },
 { L"Trebuchet MS",   L"Open Sans" },
+{ L"System", L"FreeSans" },
 { NULL, NULL }
 };
 
@@ -58,6 +60,7 @@
 { L"Terminal",   L"DejaVu Sans Mono" },
 { L"Times New Roman",L"Liberation Serif" },
 { L"Trebuchet MS",   L"Open Sans" },
+{ L"System", L"FreeSans" },
 { NULL, NULL }
 };
 
@@ -78,6 +81,7 @@
 { L"Terminal",   L"DejaVu Sans Mono" },
 { L"Times New Roman",L"DejaVu Serif" },
 { L"Trebuchet MS",   L"Open Sans" },
+{ L"System", L"FreeSans" },
 { NULL, NULL }
 };
 
@@ -107,6 +111,7 @@
 { L"SimSun", L"Droid Sans Fallback" },
 { L"NSimSun",L"Droid Sans Fallback" },
 { L"MS Song",L"Droid Sans Fallback" },
+{ L"System", L"Droid Sans Fallback" },
 /* localized names */
 { CSF_LocalName0,L"Droid Sans Fallback" },
 { CSF_LocalName1,L"Droid Sans Fallback" },
@@ -141,6 +146,7 @@
 { L"PMingLiU",L"Droid Sans Fallback" },
 { L"DLCMingMedium",   L"Droid Sans Fallback" },
 { L"DLCMingBold", L"Droid Sans Fallback" },
+{ L"System",  L"Droid Sans Fallback" },
 /* localized names */
 { CTF_LocalName0, L"Droid Sans Fallback" },
 { CTF_LocalName1, L"Droid Sans Fallback" },
@@ -174,6 +180,7 @@
 { L"MS PMincho",  L"Droid Sans Fallback" },
 { L"MS Gothic",   L"Droid Sans Fallback" },
 { L"MS PGothic",  L"Droid Sans Fallback" },
+{ L"System",  L"Droid Sans Fallback" },
 /* localized names */
 { JF_LocalName0,  L"Droid Sans Fallback" },
 { JF_LocalName1,  L"Droid Sans Fallback" },
@@ -211,6 +218,7 @@
 { L"GungsuhChe",  L"Droid Sans Fallback" },
 { L"Gulim",   L"Droid Sans Fallback" },
 { L"GulimChe",L"Droid Sans Fallback" },
+{ L"System",  L"Droid Sans Fallback" },
 /* localized names */
 { KF_LocalName0,  L"Droid Sans Fallback" },
 { KF_LocalName1,  L"Droid Sans Fallback" },
@@ -238,5 +246,6 @@
 { L"Terminal",   L"DejaVu Sans Mono" },
 { L"Times New Roman",L"DejaVu Serif" },
 { L"Trebuchet MS",   L"Open Sans" },
-{ NULL, NULL }
-};
+{ L"System", L"FreeSans" },
+{ NULL, NULL }
+};

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=75310=75309=75310=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Sun Jul  9 
15:06:49 2017
@@ -52,8 +52,6 @@
 
 /* special font names */
 static const UNICODE_STRING MarlettW = RTL_CONSTANT_STRING(L"Marlett");
-static const UNICODE_STRING SystemW = RTL_CONSTANT_STRING(L"System");

[ros-diffs] [mjansen] 75274: [USER32_APITEST] Add tests to validate the messages sent during MDI window creation. CORE-12052 The test passes from 2k3 - 10.

2017-07-03 Thread mjansen
Author: mjansen
Date: Mon Jul  3 20:33:36 2017
New Revision: 75274

URL: http://svn.reactos.org/svn/reactos?rev=75274=rev
Log:
[USER32_APITEST] Add tests to validate the messages sent during MDI window 
creation. CORE-12052
The test passes from 2k3 - 10.

Modified:
trunk/rostests/apitests/user32/CreateWindowEx.c

Modified: trunk/rostests/apitests/user32/CreateWindowEx.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateWindowEx.c?rev=75274=75273=75274=diff
==
--- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] Mon Jul  3 
20:33:36 2017
@@ -70,6 +70,7 @@
 
 HWND g_TestWindow = NULL;
 HWND g_ChildWindow = NULL;
+HWND g_hwndMDIClient = NULL;
 
 static int get_iwnd(HWND hWnd)
 {
@@ -649,9 +650,489 @@
 }
 
 
+
+static LRESULT CALLBACK MSGTestProcMDI(HWND hWnd, UINT message, WPARAM wParam, 
LPARAM lParam)
+{
+LRESULT lRet;
+int iwnd = get_iwnd(hWnd);
+
+if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+return DefWindowProc(hWnd, message, wParam, lParam);
+
+switch(message)
+{
+case WM_IME_SETCONTEXT:
+case WM_IME_NOTIFY:
+case WM_GETICON:
+case WM_GETTEXT:
+return DefWindowProc(hWnd, message, wParam, lParam);
+break;
+case WM_NCCREATE:
+{
+LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+ok_hex_(create->style, g_NcExpectStyle);
+ok_hex_(create->dwExStyle, g_NcExpectExStyle);
+}
+break;
+case WM_CREATE:
+{
+CLIENTCREATESTRUCT ccs = { 0 };
+LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+ok_hex_(create->style, g_ExpectStyle);
+ok_hex_(create->dwExStyle, g_ExpectExStyle);
+
+g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL,
+ WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | 
WS_HSCROLL,
+ 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, 
(LPSTR) );
+
+ShowWindow(g_hwndMDIClient, SW_SHOW);
+
+}
+break;
+case WM_NCCALCSIZE:
+case WM_STYLECHANGING:
+case WM_STYLECHANGED:
+case WM_SIZE:
+RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
+break;
+case WM_WINDOWPOSCHANGING:
+case WM_WINDOWPOSCHANGED:
+ok(wParam == 0,"expected wParam=0\n");
+RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
+break;
+default:
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+break;
+}
+lRet = DefWindowProc(hWnd, message, wParam, lParam);
+RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
+return lRet;
+}
+
+MSG_ENTRY create_chain_MDI[] =
+{
+{ 1, WM_GETMINMAXINFO, SENT },
+{ 1, WM_GETMINMAXINFO, SENT_RET },
+{ 1, WM_NCCREATE, SENT },
+{ 1, WM_NCCREATE, SENT_RET },
+{ 1, WM_NCCALCSIZE, SENT },
+{ 1, WM_NCCALCSIZE, SENT_RET },
+{ 1, WM_CREATE, SENT },
+{ 1, WM_PARENTNOTIFY, SENT },
+{ 1, WM_PARENTNOTIFY, SENT_RET },
+{ 1, WM_CREATE, SENT_RET },
+{ 0, 0 }
+};
+
+static void Test_Messages_MDI(void)
+{
+HWND hWnd;
+
+RegisterSimpleClass(MSGTestProcMDI, L"Test_Message_Window_MDI_XX");
+
+g_ExpectStyle = g_NcExpectStyle = 0;
+g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
+g_FaultLine = __LINE__ + 1;
+hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", 
L"", 0, 10, 20,
+   200, 210, NULL, NULL, 0, NULL);
+
+ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
+COMPARE_CACHE(create_chain_MDI);
+DestroyWindow(hWnd);
+g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL;
+EMPTY_CACHE();
+
+g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
+g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
+g_FaultLine = __LINE__ + 1;
+hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", 
L"", WS_OVERLAPPEDWINDOW, 10, 20,
+   200, 210, NULL, NULL, 0, NULL);
+
+ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
+COMPARE_CACHE(create_chain_MDI);
+DestroyWindow(hWnd);
+g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL;
+EMPTY_CACHE();
+
+UnregisterClassW(L"Test_Message_Window_MDI_XX", NULL);
+}
+
+
+static LRESULT CALLBACK MSGTestProcMDI2(HWND hWnd, UINT message, WPARAM 
wParam, LPARAM lParam)
+{
+LRESULT lRet;
+int iwnd = get_iwnd(hWnd);
+
+if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+return DefWindowProc(hWnd, message, 

[ros-diffs] [mjansen] 75264: [SHIMDBG] Output both to the console and the debug output + fix a copypasta error.

2017-07-02 Thread mjansen
Author: mjansen
Date: Sun Jul  2 11:56:01 2017
New Revision: 75264

URL: http://svn.reactos.org/svn/reactos?rev=75264=rev
Log:
[SHIMDBG] Output both to the console and the debug output + fix a copypasta 
error.

Modified:
trunk/rosapps/applications/devutils/shimdbg/shimdbg.c

Modified: trunk/rosapps/applications/devutils/shimdbg/shimdbg.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/shimdbg/shimdbg.c?rev=75264=75263=75264=diff
==
--- trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
(original)
+++ trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
Sun Jul  2 11:56:01 2017
@@ -10,11 +10,31 @@
 #include 
 #include 
 
+void __stdcall OutputDebugStringA(PCSTR);
+
+void xprintf(const char *fmt, ...)
+{
+va_list ap;
+int length;
+char *buf;
+
+va_start(ap, fmt);
+length = _vscprintf(fmt, ap);
+buf = malloc(length + 1);
+vsprintf(buf, fmt, ap);
+buf[length] = '\0';
+va_end(ap);
+
+fputs(buf, stdout);
+OutputDebugStringA(buf);
+}
+
+
 void CallApphelp(APPHELPCACHESERVICECLASS Service,
 PAPPHELP_CACHE_SERVICE_LOOKUP CacheEntry)
 {
 NTSTATUS Status = NtApphelpCacheControl(Service, CacheEntry);
-printf("NtApphelpCacheControl returned 0x%x\n", (unsigned int)Status);
+xprintf("NtApphelpCacheControl returned 0x%x\n", (unsigned int)Status);
 }
 
 HANDLE MapFile(char* filename, UNICODE_STRING* PathName, int MapIt)
@@ -35,7 +55,7 @@
 FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
 if (!NT_SUCCESS(Status))
 {
-printf("Failed opening the file, using a NULL handle\n");
+xprintf("Failed opening the file, using a NULL handle\n");
 FileHandle = NULL;
 }
 }
@@ -50,7 +70,7 @@
 
 HANDLE FileHandle = MapFile(filename, , MapIt);
 
-printf("Calling %s %s mapping\n", ServiceName, (MapIt ? "with" : 
"without"));
+xprintf("Calling %s %s mapping\n", ServiceName, (MapIt ? "with" : 
"without"));
 
 RtlInitUnicodeString(, PathName.Buffer);
 CacheEntry.ImageHandle = FileHandle ? FileHandle : (HANDLE)-1;
@@ -82,7 +102,7 @@
 (*pn) += 1;
 return 0;
 }
-printf("Error: no image name specified\n");
+xprintf("Error: no image name specified\n");
 return 1;
 }
 
@@ -124,7 +144,7 @@
 static ANSI_STRING SdbFreeFileAttributes = 
RTL_CONSTANT_STRING("SdbFreeFileAttributes");
 if (!NT_SUCCESS(LdrLoadDll(NULL, NULL, , )))
 {
-printf("Unable to load apphelp.dll\n");
+xprintf("Unable to load apphelp.dll\n");
 return FALSE;
 }
 if (!NT_SUCCESS(LdrGetProcedureAddress(hdll, , 0, 
(PVOID))) ||
@@ -133,7 +153,7 @@
 {
 LdrUnloadDll(hdll);
 hdll = NULL;
-printf("Unable to resolve functions\n");
+xprintf("Unable to resolve functions\n");
 return FALSE;
 }
 }
@@ -158,7 +178,7 @@
 }
 else if (argn+1 >= argc)
 {
-printf("Error: no image name specified\n");
+xprintf("Error: no image name specified\n");
 return 1;
 }
 else
@@ -171,7 +191,7 @@
 
 if (pSdbGetFileAttributes(FileName.Buffer, , _attr))
 {
-printf("Dumping attributes for %s\n", arg);
+xprintf("Dumping attributes for %s\n", arg);
 for (n = 0; n < num_attr; ++n)
 {
 TAG tagType;
@@ -185,24 +205,24 @@
 switch (tagType)
 {
 case TAG_TYPE_DWORD:
-printf("<%ls>0x%lx\n", tagName, 
attr[n].dwattr, tagName, attr[n].dwattr);
+xprintf("<%ls>0x%lx\n", tagName, attr[n].dwattr, 
tagName);
 break;
 case TAG_TYPE_STRINGREF:
-printf("<%ls>0x%ls\n", tagName, attr[n].lpattr, tagName);
+xprintf("<%ls>%ls\n", tagName, attr[n].lpattr, tagName);
 break;
 case TAG_TYPE_QWORD:
-printf("<%ls>0x%I64x\n", tagName, 
attr[n].qwattr, tagName, attr[n].qwattr);
+xprintf("<%ls>0x%I64x\n", tagName, attr[n].qwattr, 
tagName);
 break;
 default:
-printf("

[ros-diffs] [mjansen] 75263: [REGEDIT] Pre-select the text in the edit dialog.

2017-07-02 Thread mjansen
Author: mjansen
Date: Sun Jul  2 11:50:38 2017
New Revision: 75263

URL: http://svn.reactos.org/svn/reactos?rev=75263=rev
Log:
[REGEDIT] Pre-select the text in the edit dialog.

Modified:
trunk/reactos/base/applications/regedit/edit.c

Modified: trunk/reactos/base/applications/regedit/edit.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/edit.c?rev=75263=75262=75263=diff
==
--- trunk/reactos/base/applications/regedit/edit.c  [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/edit.c  [iso-8859-1] Sun Jul  2 
11:50:38 2017
@@ -115,6 +115,7 @@
 SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
 }
 SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData);
+SendMessage(GetDlgItem(hwndDlg, IDC_VALUE_DATA), EM_SETSEL, 0, -1);
 SetFocus(GetDlgItem(hwndDlg, IDC_VALUE_DATA));
 return FALSE;
 case WM_COMMAND:
@@ -305,6 +306,7 @@
 CheckRadioButton (hwndDlg, IDC_FORMAT_HEX, IDC_FORMAT_DEC, 
IDC_FORMAT_HEX);
 swprintf(ValueString, L"%lx", dwordValueData);
 SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, ValueString);
+SendMessage(GetDlgItem(hwndDlg, IDC_VALUE_DATA), EM_SETSEL, 0, -1);
 SetFocus(GetDlgItem(hwndDlg, IDC_VALUE_DATA));
 return FALSE;
 




[ros-diffs] [mjansen] 75262: [APPHELP] Propagate applied layers to child processes by setting the env var __COMPAT_LAYER. CORE-13284

2017-07-02 Thread mjansen
Author: mjansen
Date: Sun Jul  2 11:43:54 2017
New Revision: 75262

URL: http://svn.reactos.org/svn/reactos?rev=75262=rev
Log:
[APPHELP] Propagate applied layers to child processes by setting the env var 
__COMPAT_LAYER. CORE-13284

Modified:
trunk/reactos/dll/appcompat/apphelp/shimeng.c

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75262=75261=75262=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sun Jul  2 
11:43:54 2017
@@ -330,8 +330,7 @@
 }
 
 
-
-VOID SeiAddShim(TAGREF trShimRef, PARRAY pShimRef)
+static VOID SeiAddShim(TAGREF trShimRef, PARRAY pShimRef)
 {
 TAGREF* Data;
 if (!ARRAY_EnsureSize(pShimRef, sizeof(TAGREF), 10))
@@ -342,8 +341,26 @@
 pShimRef->Size++;
 }
 
-VOID SeiBuildShimRefArray(HSDB hsdb, SDBQUERYRESULT* pQuery, PARRAY pShimRef)
-{
+static VOID SeiSetLayerEnvVar(LPCWSTR wszLayer)
+{
+NTSTATUS Status;
+UNICODE_STRING VarName = RTL_CONSTANT_STRING(L"__COMPAT_LAYER");
+UNICODE_STRING Value;
+
+RtlInitUnicodeString(, wszLayer);
+
+Status = RtlSetEnvironmentVariable(NULL, , );
+if (NT_SUCCESS(Status))
+SHIMENG_INFO("Set env var %wZ=%wZ\n", , );
+else
+SHIMENG_FAIL("Failed to set %wZ: 0x%x\n", , Status);
+}
+
+#define MAX_LAYER_LENGTH256
+
+static VOID SeiBuildShimRefArray(HSDB hsdb, SDBQUERYRESULT* pQuery, PARRAY 
pShimRef)
+{
+WCHAR wszLayerEnvVar[MAX_LAYER_LENGTH] = { 0 };
 DWORD n;
 
 for (n = 0; n < pQuery->dwExeCount; ++n)
@@ -382,7 +399,17 @@
 LPCWSTR LayerName = SeiGetStringPtr(pdb, tag, TAG_NAME);
 TAGID ShimRef = SdbFindFirstTag(pdb, tag, TAG_SHIM_REF);
 if (LayerName)
+{
+HRESULT hr;
 SeiDbgPrint(SEI_MSG, NULL, "ShimInfo(Layer(%S))\n", LayerName);
+if (wszLayerEnvVar[0])
+StringCchCatW(wszLayerEnvVar, _countof(wszLayerEnvVar), L" 
");
+hr = StringCchCatW(wszLayerEnvVar, _countof(wszLayerEnvVar), 
LayerName);
+if (!SUCCEEDED(hr))
+{
+SHIMENG_FAIL("Unable to append %S\n", LayerName);
+}
+}
 
 while (ShimRef != TAGID_NULL)
 {
@@ -396,6 +423,8 @@
 /* Handle FLAG_REF */
 }
 }
+if (wszLayerEnvVar[0])
+SeiSetLayerEnvVar(wszLayerEnvVar);
 }
 
 




[ros-diffs] [mjansen] 75258: [APPHELP/SHIMENG] Begin implementing the core of the SHIM engine. With this, the basics of the app compat engine are implemented and should be functional. Currently it is

2017-07-01 Thread mjansen
Author: mjansen
Date: Sat Jul  1 20:06:30 2017
New Revision: 75258

URL: http://svn.reactos.org/svn/reactos?rev=75258=rev
Log:
[APPHELP/SHIMENG] Begin implementing the core of the SHIM engine.
With this, the basics of the app compat engine are implemented and should be 
functional.
Currently it is disable with a policy, to be enabled soon.
CORE-13284
CORE-11300

Added:
trunk/reactos/dll/appcompat/apphelp/shimeng.h   (with props)
Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/shimeng.c

Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt?rev=75258=75257=75258=diff
==
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] Sat Jul  1 
20:06:30 2017
@@ -2,7 +2,7 @@
 include_directories(${SHIMLIB_DIR})
 
 remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
-add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600)
+add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601)
 
 spec2def(apphelp.dll apphelp.spec ADD_IMPORTLIB)
 

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=75258=75257=75258=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Sat Jul  1 
20:06:30 2017
@@ -83,7 +83,9 @@
 GUID   rgGuidDB[SDB_MAX_SDBS];
 } SDBQUERYRESULT, *PSDBQUERYRESULT;
 
+#ifndef APPHELP_NOSDBPAPI
 #include "sdbpapi.h"
+#endif
 
 /* sdbapi.c */
 PWSTR SdbpStrDup(LPCWSTR string);
@@ -122,7 +124,8 @@
 /* hsdb.c */
 BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, 
LPCWSTR env, DWORD flags, PSDBQUERYRESULT result);
 BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF* 
ptrWhich);
-
+BOOL WINAPI SdbTagRefToTagID(HSDB hsdb, TAGREF trWhich, PDB* ppdb, TAGID* 
ptiWhich);
+BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID 
pData, PSDBQUERYRESULT pQueryResult);
 
 #define ATTRIBUTE_AVAILABLE 0x1
 #define ATTRIBUTE_FAILED 0x2

Modified: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=75258=75257=75258=diff
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sat Jul  1 
20:06:30 2017
@@ -21,12 +21,69 @@
 #include "ntndk.h"
 #include "shimlib.h"
 #include 
-
-HANDLE g_pShimEngModHandle = 0;
-
-
+/* Make sure we don't include apphelp logging */
+#define APPHELP_NOSDBPAPI
+#include "apphelp.h"
+#include "shimeng.h"
+
+
+typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HINSTANCE, LPCSTR);
+
+
+FARPROC WINAPI StubGetProcAddress(HINSTANCE hModule, LPCSTR lpProcName);
+BOOL WINAPI SE_IsShimDll(PVOID BaseAddress);
+
+
+extern HMODULE g_hInstance;
 ULONG g_ShimEngDebugLevel = 0x;
-
+BOOL g_bComPlusImage = FALSE;
+BOOL g_bShimDuringInit = FALSE;
+BOOL g_bInternalHooksUsed = FALSE;
+static ARRAY g_pShimInfo;  /* SHIMMODULE */
+static ARRAY g_pHookArray; /* HOOKMODULEINFO */
+
+HOOKAPIEX g_IntHookEx[] =
+{
+{
+"kernel32.dll", /* LibraryName */
+"GetProcAddress",   /* FunctionName */
+StubGetProcAddress, /* ReplacementFunction*/
+NULL,   /* OriginalFunction */
+{ NULL },   /* ModuleLink */
+{ NULL }/* ApiLink */
+},
+};
+
+
+
+
+static BOOL ARRAY_EnsureSize(PARRAY Array, DWORD ItemSize, DWORD GrowWith)
+{
+PVOID pNewData;
+DWORD Count;
+
+if (Array->MaxSize > Array->Size)
+return TRUE;
+
+Count = Array->Size + GrowWith;
+pNewData = SeiAlloc(Count * ItemSize);
+
+if (!pNewData)
+{
+SHIMENG_FAIL("Failed to allocate %d bytes\n", Count * ItemSize);
+return FALSE;
+}
+Array->MaxSize = Count;
+
+if (Array->Data)
+{
+memcpy(pNewData, Array->Data, Array->Size * ItemSize);
+SeiFree(Array->Data);
+}
+Array->Data = pNewData;
+
+return TRUE;
+}
 
 
 
@@ -115,49 +172,782 @@
 }
 
 
-
-
-
-
+PVOID SeiGetModuleFromAddress(PVOID addr)
+{
+PVOID hModule = NULL;
+RtlPcToFileHeader(addr, );
+return hModule;
+}
+
+
+
+/* TODO: Guard against recursive calling / calling init multiple times! */
 VOID NotifyShims(DWORD dwReason, PVOID Info)
 {
-/* Enumerate all loaded shims */
-}
+

[ros-diffs] [mjansen] 75256: [ACPPAGE] Register the extension + allow it to be disabled with policies. Disable it with the rest of the app compat infrastructure. CORE-10375

2017-07-01 Thread mjansen
Author: mjansen
Date: Sat Jul  1 11:37:44 2017
New Revision: 75256

URL: http://svn.reactos.org/svn/reactos?rev=75256=rev
Log:
[ACPPAGE] Register the extension + allow it to be disabled with policies. 
Disable it with the rest of the app compat infrastructure. CORE-10375

Modified:
trunk/reactos/boot/bootdata/hivesft.inf
trunk/reactos/boot/bootdata/hivesys.inf
trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
trunk/reactos/media/inf/syssetup.inf

Modified: trunk/reactos/boot/bootdata/hivesft.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?rev=75256=75255=75256=diff
==
--- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Sat Jul  1 
11:37:44 2017
@@ -1685,6 +1685,9 @@
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows","swapdisk",0x,""
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows","TransmissionRetryTimeout",0x,"90"
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows","USERProcessHandleQuota",0x00010001,0x2710
+
+; App Compat -- Disable on ReactOS
+HKLM,"SOFTWARE\Policies\Microsoft\Windows\AppCompat","DisableEngine",0x00010003,
 0x0001
 
 ; STRINGS ---
 

Modified: trunk/reactos/boot/bootdata/hivesys.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?rev=75256=75255=75256=diff
==
--- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Sat Jul  1 
11:37:44 2017
@@ -1453,9 +1453,6 @@
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\SubSystems","Posix",0x0002,"%SystemRoot%\system32\psxss.exe"
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\SubSystems","Required",0x0001,"Debug","Windows"
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\SubSystems","Windows",0x0002,"%SystemRoot%\system32\csrss.exe 
ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On 
SubSystemType=Windows ServerDll=basesrv,1 
ServerDll=winsrv:UserServerDllInitialization,3 
ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off 
MaxRequestThreads=16"
-
-; App Compat -- Disable on ReactOS
-HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\AppCompatibility","DisableAppCompat",0x00010003, 0x0001
 
 ; This is an empty App Compat cache
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\AppCompatCache","AppCompatCache", 0x0001, \

Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp?rev=75256=75255=75256=diff
==
--- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] 
Sat Jul  1 11:37:44 2017
@@ -561,11 +561,43 @@
 return FALSE;
 }
 
+static BOOL DisableShellext()
+{
+HKEY hkey;
+LSTATUS ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", 0, KEY_QUERY_VALUE, 
);
+BOOL Disable = FALSE;
+if (ret == ERROR_SUCCESS)
+{
+DWORD dwValue = 0;
+DWORD type, size = sizeof(dwValue);
+ret = RegQueryValueExW(hkey, L"DisableEngine", NULL, , 
(PBYTE), );
+if (ret == ERROR_SUCCESS && type == REG_DWORD)
+{
+Disable = !!dwValue;
+}
+if (!Disable)
+{
+size = sizeof(dwValue);
+ret = RegQueryValueExW(hkey, L"DisablePropPage", NULL, , 
(PBYTE), );
+if (ret == ERROR_SUCCESS && type == REG_DWORD)
+{
+Disable = !!dwValue;
+}
+}
+
+RegCloseKey(hkey);
+}
+return Disable;
+}
 
 STDMETHODIMP CLayerUIPropPage::Initialize(LPCITEMIDLIST pidlFolder, 
LPDATAOBJECT pDataObj, HKEY hkeyProgID)
 {
 FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
 STGMEDIUM stg;
+
+if (DisableShellext())
+return E_ACCESSDENIED;
+
 HRESULT hr = pDataObj->GetData(, );
 if (FAILED(hr))
 {

Modified: trunk/reactos/media/inf/syssetup.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/syssetup.inf?rev=75256=75255=75256=diff
==
--- trunk/reactos/media/inf/syssetup.inf[iso-8859-1] (original)
+++ trunk/reactos/media/inf/syssetup.inf[iso-8859-1] Sat Jul  1 
11:37:44 2017
@@ -35,7 +35,7 @@
 [OleControlDlls]
 11,,atl.dll,1
 11,,actxprxy.dll,1
-;11,,acppage.dll,1
+11,,acppage.dll,1
 11,,amstream.dll,1
 11,,avifil32.dll,1
 11,,browseui.dll,1




[ros-diffs] [mjansen] 75238: [APPHELP] Implement SdbpMatchExe, allowing to match applications / files based on properties. CORE-13284

2017-06-29 Thread mjansen
Author: mjansen
Date: Thu Jun 29 17:32:03 2017
New Revision: 75238

URL: http://svn.reactos.org/svn/reactos?rev=75238=rev
Log:
[APPHELP] Implement SdbpMatchExe, allowing to match applications / files based 
on properties. CORE-13284

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.h?rev=75238=75237=75238=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h   [iso-8859-1] Thu Jun 29 
17:32:03 2017
@@ -90,6 +90,7 @@
 HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR);
 void WINAPI SdbReleaseDatabase(HSDB);
 BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length);
+LPCWSTR WINAPI SdbTagToString(TAG tag);
 
 PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type);
 void WINAPI SdbCloseDatabase(PDB);
@@ -105,8 +106,12 @@
 TAGID WINAPI SdbFindNextTag(PDB db, TAGID parent, TAGID prev_child);
 BOOL WINAPI SdbGetDatabaseID(PDB db, GUID* Guid);
 DWORD WINAPI SdbReadDWORDTag(PDB db, TAGID tagid, DWORD ret);
+QWORD WINAPI SdbReadQWORDTag(PDB db, TAGID tagid, QWORD ret);
+TAGID WINAPI SdbGetFirstChild(PDB db, TAGID parent);
+TAGID WINAPI SdbGetNextChild(PDB db, TAGID parent, TAGID prev_child);
 
 /* sdbfileattr.c*/
+BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, 
LPDWORD attr_count);
 BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info);
 
 /* layer.c */

Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb.c?rev=75238=75237=75238=diff
==
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] Thu Jun 29 
17:32:03 2017
@@ -49,31 +49,132 @@
 return (attr != INVALID_FILE_ATTRIBUTES && !(attr & 
FILE_ATTRIBUTE_DIRECTORY));
 }
 
-static BOOL WINAPI SdbpMatchExe(PDB db, TAGID exe, WCHAR* dir)
-{
-static const WCHAR fmt[] = {'%','s','%','s',0};
-WCHAR buffer[256];  /* FIXME: rewrite using a buffer that can grow if 
needed, f.e. RtlInitBuffer stuff! */
+static BOOL SdbpMatchFileAttributes(PDB pdb, TAGID matching_file, PATTRINFO 
attribs, DWORD attr_count)
+{
+TAGID child;
+
+for (child = SdbGetFirstChild(pdb, matching_file);
+ child != TAGID_NULL; child = SdbGetNextChild(pdb, matching_file, 
child))
+{
+TAG tag = SdbGetTagFromTagID(pdb, child);
+DWORD n;
+
+/* Already handled! */
+if (tag == TAG_NAME)
+continue;
+
+if (tag == TAG_UPTO_BIN_FILE_VERSION ||
+tag == TAG_UPTO_BIN_PRODUCT_VERSION ||
+tag == TAG_UPTO_LINK_DATE)
+{
+SHIM_WARN("Unimplemented TAG_UPTO_X\n");
+continue;
+}
+
+for (n = 0; n < attr_count; ++n)
+{
+PATTRINFO attr = attribs + n;
+if (attr->flags == ATTRIBUTE_AVAILABLE && attr->type == tag)
+{
+DWORD dwval;
+WCHAR* lpval;
+QWORD qwval;
+switch (tag & TAG_TYPE_MASK)
+{
+case TAG_TYPE_DWORD:
+dwval = SdbReadDWORDTag(pdb, child, 0);
+if (dwval != attr->dwattr)
+return FALSE;
+break;
+case TAG_TYPE_STRINGREF:
+lpval = SdbGetStringTagPtr(pdb, child);
+if (!lpval || wcsicmp(attr->lpattr, lpval))
+return FALSE;
+break;
+case TAG_TYPE_QWORD:
+qwval = SdbReadQWORDTag(pdb, child, 0);
+if (qwval != attr->qwattr)
+return FALSE;
+break;
+default:
+SHIM_WARN("Unhandled type 0x%x MATCHING_FILE\n", (tag & 
TAG_TYPE_MASK));
+return FALSE;
+}
+}
+}
+if (n == attr_count)
+SHIM_WARN("Unhandled tag %ws in MACHING_FILE\n", 
SdbTagToString(tag));
+}
+return TRUE;
+}
+
+static BOOL WINAPI SdbpMatchExe(PDB pdb, TAGID exe, const WCHAR* dir, 
PATTRINFO main_attribs, DWORD main_attr_count)
+{
+RTL_UNICODE_STRING_BUFFER FullPathName = { { 0 } };
+WCHAR FullPathBuffer[MAX_PATH];
+UNICODE_STRING UnicodeDir;
 TAGID matching_file;
-
-/* TODO: check size/checksum from the main exe as well as from the extra 
files */
-for (matching_file = SdbFindFirstTag(db, exe,

[ros-diffs] [mjansen] 75237: [ATL] Add missing CString += overload (char). Patch by Alexander Shaposhnikov. CORE-13503

2017-06-29 Thread mjansen
Author: mjansen
Date: Thu Jun 29 17:09:49 2017
New Revision: 75237

URL: http://svn.reactos.org/svn/reactos?rev=75237=rev
Log:
[ATL] Add missing CString += overload (char). Patch by Alexander Shaposhnikov. 
CORE-13503

Modified:
trunk/reactos/sdk/lib/atl/cstringt.h

Modified: trunk/reactos/sdk/lib/atl/cstringt.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/atl/cstringt.h?rev=75237=75236=75237=diff
==
--- trunk/reactos/sdk/lib/atl/cstringt.h[iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/atl/cstringt.h[iso-8859-1] Thu Jun 29 
17:09:49 2017
@@ -453,6 +453,12 @@
 return *this;
 }
 
+CStringT& operator+=(_In_ XCHAR ch)
+{
+CThisSimpleString::operator+=(ch);
+return *this;
+}
+
 BOOL LoadString(_In_ UINT nID)
 {
 return LoadString(_AtlBaseModule.GetResourceInstance(), nID);




[ros-diffs] [mjansen] 75218: [SHIMDBG] Add option to dump file properties.

2017-06-27 Thread mjansen
Author: mjansen
Date: Tue Jun 27 20:27:31 2017
New Revision: 75218

URL: http://svn.reactos.org/svn/reactos?rev=75218=rev
Log:
[SHIMDBG] Add option to dump file properties.

Modified:
trunk/rosapps/applications/devutils/shimdbg/shimdbg.c

Modified: trunk/rosapps/applications/devutils/shimdbg/shimdbg.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/shimdbg/shimdbg.c?rev=75218=75217=75218=diff
==
--- trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
(original)
+++ trunk/rosapps/applications/devutils/shimdbg/shimdbg.c   [iso-8859-1] 
Tue Jun 27 20:27:31 2017
@@ -66,7 +66,7 @@
 int IsOpt(char* argv, const char* check)
 {
 if( argv && (argv[0] == '-' || argv[0] == '/') ) {
-return !stricmp(argv + 1, check);
+return !_strnicmp(argv + 1, check, strlen(check));
 }
 return 0;
 }
@@ -86,6 +86,129 @@
 return 1;
 }
 
+typedef WORD TAG;
+typedef UINT64 QWORD;
+
+#define TAG_TYPE_MASK 0xF000
+#define TAG_TYPE_DWORD 0x4000
+#define TAG_TYPE_QWORD 0x5000
+#define TAG_TYPE_STRINGREF 0x6000
+
+#define ATTRIBUTE_AVAILABLE 0x1
+#define ATTRIBUTE_FAILED 0x2
+
+typedef struct tagATTRINFO
+{
+TAG   type;
+DWORD flags;  /* ATTRIBUTE_AVAILABLE, ATTRIBUTE_FAILED */
+union
+{
+QWORD qwattr;
+DWORD dwattr;
+WCHAR *lpattr;
+};
+} ATTRINFO, *PATTRINFO;
+
+static PVOID hdll;
+static LPCWSTR (WINAPI *pSdbTagToString)(TAG);
+static BOOL (WINAPI *pSdbGetFileAttributes)(LPCWSTR, PATTRINFO *, LPDWORD);
+static BOOL (WINAPI *pSdbFreeFileAttributes)(PATTRINFO);
+
+static BOOL InitApphelp()
+{
+if (!hdll)
+{
+static UNICODE_STRING DllName = RTL_CONSTANT_STRING(L"apphelp.dll");
+static ANSI_STRING SdbTagToString = 
RTL_CONSTANT_STRING("SdbTagToString");
+static ANSI_STRING SdbGetFileAttributes = 
RTL_CONSTANT_STRING("SdbGetFileAttributes");
+static ANSI_STRING SdbFreeFileAttributes = 
RTL_CONSTANT_STRING("SdbFreeFileAttributes");
+if (!NT_SUCCESS(LdrLoadDll(NULL, NULL, , )))
+{
+printf("Unable to load apphelp.dll\n");
+return FALSE;
+}
+if (!NT_SUCCESS(LdrGetProcedureAddress(hdll, , 0, 
(PVOID))) ||
+!NT_SUCCESS(LdrGetProcedureAddress(hdll, , 0, 
(PVOID))) ||
+!NT_SUCCESS(LdrGetProcedureAddress(hdll, , 
0, (PVOID
+{
+LdrUnloadDll(hdll);
+hdll = NULL;
+printf("Unable to resolve functions\n");
+return FALSE;
+}
+}
+return TRUE;
+}
+
+
+int HandleDumpAttributes(int argc, char* argv[], int* pn, const char* opt)
+{
+UNICODE_STRING FileName;
+PATTRINFO attr;
+DWORD num_attr, n;
+int argn = *pn;
+const char* arg;
+
+if (!InitApphelp())
+return 1;
+
+if (strlen(argv[argn]) > (strlen(opt)+1))
+{
+arg = argv[argn] + strlen(opt);
+}
+else if (argn+1 >= argc)
+{
+printf("Error: no image name specified\n");
+return 1;
+}
+else
+{
+arg = argv[argn+1];
+(*pn) += 1;
+}
+
+RtlCreateUnicodeStringFromAsciiz(, arg);
+
+if (pSdbGetFileAttributes(FileName.Buffer, , _attr))
+{
+printf("Dumping attributes for %s\n", arg);
+for (n = 0; n < num_attr; ++n)
+{
+TAG tagType;
+LPCWSTR tagName;
+if (attr[n].flags != ATTRIBUTE_AVAILABLE)
+continue;
+
+tagName = pSdbTagToString(attr[n].type);
+
+tagType = attr[n].type & TAG_TYPE_MASK;
+switch (tagType)
+{
+case TAG_TYPE_DWORD:
+printf("<%ls>0x%lx\n", tagName, 
attr[n].dwattr, tagName, attr[n].dwattr);
+break;
+case TAG_TYPE_STRINGREF:
+printf("<%ls>0x%ls\n", tagName, attr[n].lpattr, tagName);
+break;
+case TAG_TYPE_QWORD:
+printf("<%ls>0x%I64x\n", tagName, 
attr[n].qwattr, tagName, attr[n].qwattr);
+break;
+default:
+printf("

[ros-diffs] [mjansen] 75217: [APPWIZ] Enable the 'Cancel' button while downloading. Patch by Jared Smudde and 'thc'. CORE-9629

2017-06-27 Thread mjansen
Author: mjansen
Date: Tue Jun 27 20:09:53 2017
New Revision: 75217

URL: http://svn.reactos.org/svn/reactos?rev=75217=rev
Log:
[APPWIZ] Enable the 'Cancel' button while downloading. Patch by Jared Smudde 
and 'thc'. CORE-9629

Modified:
trunk/reactos/dll/cpl/appwiz/addons.c

Modified: trunk/reactos/dll/cpl/appwiz/addons.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/appwiz/addons.c?rev=75217=75216=75217=diff
==
--- trunk/reactos/dll/cpl/appwiz/addons.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/appwiz/addons.c   [iso-8859-1] Tue Jun 27 
20:09:53 2017
@@ -59,6 +59,7 @@
 static const addon_info_t *addon;
 
 static HWND install_dialog = NULL;
+static IBinding *download_binding;
 
 static WCHAR GeckoUrl[] = 
L"https://svn.reactos.org/amine/wine_gecko-2.40-x86.msi;;
 
@@ -259,6 +260,9 @@
 DWORD dwReserved, IBinding *pib)
 {
 set_status(IDS_DOWNLOADING);
+IBinding_AddRef(pib);
+download_binding = pib;
+
 return S_OK;
 }
 
@@ -290,8 +294,16 @@
 static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
 HRESULT hresult, LPCWSTR szError)
 {
+if(download_binding) {
+IBinding_Release(download_binding);
+download_binding = NULL;
+}
+
 if(FAILED(hresult)) {
-ERR("Binding failed %08x\n", hresult);
+if(hresult == E_ABORT)
+TRACE("Binding aborted\n");
+else
+ERR("Binding failed %08x\n", hresult);
 return S_OK;
 }
 
@@ -350,16 +362,15 @@
 hres = URLDownloadToFileW(NULL, GeckoUrl, tmp_file, 0, );
 if(FAILED(hres)) {
 ERR("URLDownloadToFile failed: %08x\n", hres);
-return 0;
-}
-
-if(sha_check(tmp_file)) {
-install_file(tmp_file);
-}else {
-WCHAR message[256];
-
-if(LoadStringW(hApplet, IDS_INVALID_SHA, message, 
sizeof(message)/sizeof(WCHAR))) {
-MessageBoxW(NULL, message, NULL, MB_ICONERROR);
+} else {
+if(sha_check(tmp_file)) {
+install_file(tmp_file);
+}else {
+WCHAR message[256];
+
+if(LoadStringW(hApplet, IDS_INVALID_SHA, message, 
sizeof(message)/sizeof(WCHAR))) {
+MessageBoxW(NULL, message, NULL, MB_ICONERROR);
+}
 }
 }
 
@@ -382,13 +393,17 @@
 case WM_COMMAND:
 switch(wParam) {
 case IDCANCEL:
-EndDialog(hwnd, 0);
+if(download_binding) {
+IBinding_Abort(download_binding);
+}
+else {
+EndDialog(hwnd, 0);
+}
 return FALSE;
 
 case ID_DWL_INSTALL:
 ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
 EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
-EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0); /* FIXME */
 CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL));
 return FALSE;
 }




[ros-diffs] [mjansen] 75205: [APPHELP_APITEST] Add tests for SdbGetMatchingExe, to test matching on version resources. CORE-13284

2017-06-26 Thread mjansen
Author: mjansen
Date: Mon Jun 26 14:58:08 2017
New Revision: 75205

URL: http://svn.reactos.org/svn/reactos?rev=75205=rev
Log:
[APPHELP_APITEST] Add tests for SdbGetMatchingExe, to test matching on version 
resources. CORE-13284

Added:
trunk/rostests/apitests/apphelp/testdata.rc   (with props)
trunk/rostests/apitests/apphelp/testdb.xml   (with props)
Modified:
trunk/rostests/apitests/apphelp/CMakeLists.txt
trunk/rostests/apitests/apphelp/db.cpp

Modified: trunk/rostests/apitests/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/CMakeLists.txt?rev=75205=75204=75205=diff
==
--- trunk/rostests/apitests/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/CMakeLists.txt  [iso-8859-1] Mon Jun 26 
14:58:08 2017
@@ -1,5 +1,7 @@
 project(appcompat)
 add_definitions(-D__ROS_LONG64__ -DWINETEST_USE_DBGSTR_LONGLONG)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 list(APPEND SOURCE
 apphelp.c
@@ -7,8 +9,16 @@
 db.cpp
 env.c
 layerapi.c
-testlist.c)
+testlist.c
+testdata.rc
+testdb.xml)
 
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb
+   COMMAND native-xml2sdb -i 
${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml -o ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml 
native-xml2sdb)
+   
+add_custom_target(testdb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb)
+add_rc_deps(testdata.rc testdb)
 add_executable(apphelp_apitest ${SOURCE})
 set_module_type(apphelp_apitest win32cui)
 target_link_libraries(apphelp_apitest ${PSEH_LIB})

Modified: trunk/rostests/apitests/apphelp/db.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.cpp?rev=75205=75204=75205=diff
==
--- trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/db.cpp  [iso-8859-1] Mon Jun 26 
14:58:08 2017
@@ -1332,6 +1332,147 @@
 ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
 }
 
+static BOOL write_raw_file(const WCHAR* FileName, const void* Data, DWORD Size)
+{
+BOOL Success;
+DWORD dwWritten;
+HANDLE Handle = CreateFileW(FileName, GENERIC_WRITE, 0, NULL, 
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+
+if (Handle == INVALID_HANDLE_VALUE)
+{
+skip("Failed to create temp file %ls, error %u\n", FileName, 
GetLastError());
+return FALSE;
+}
+Success = WriteFile(Handle, Data, Size, , NULL);
+ok(Success == TRUE, "WriteFile failed with %u\n", GetLastError());
+ok(dwWritten == Size, "WriteFile wrote %u bytes instead of %u\n", 
dwWritten, Size);
+CloseHandle(Handle);
+return Success && (dwWritten == Size);
+}
+
+static bool extract_resource(const WCHAR* Filename, LPCWSTR ResourceName)
+{
+HMODULE hMod = GetModuleHandleW(NULL);
+HRSRC hRsrc = FindResourceW(hMod, ResourceName, 
MAKEINTRESOURCEW(RT_RCDATA));
+ok(!!hRsrc, "Unable to find %s\n", wine_dbgstr_w(ResourceName));
+if (!hRsrc)
+return false;
+
+HGLOBAL hGlobal = LoadResource(hMod, hRsrc);
+DWORD Size = SizeofResource(hMod, hRsrc);
+LPVOID pData = LockResource(hGlobal);
+
+ok(Size && !!pData, "Unable to load %s\n", wine_dbgstr_w(ResourceName));
+if (!Size || !pData)
+return false;
+
+BOOL Written = write_raw_file(Filename, pData, Size);
+UnlockResource(pData);
+return Written;
+}
+
+template
+static BOOL test_match_ex(const WCHAR* workdir, HSDB hsdb, int cur)
+{
+WCHAR exename[MAX_PATH];
+WCHAR* Vendor;
+SDBQUERYRESULT_T query;
+TAGID tagid, exetag;
+BOOL ret, Succeed;
+PDB pdb;
+
+memset(, 0xab, sizeof(query));
+
+swprintf(exename, L"%s\\test_match%d.exe", workdir, cur);
+
+ret = pSdbTagRefToTagID(hsdb, 0, , );
+ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a 
valid pdb, was: %p\n", pdb);
+
+tagid = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
+ok(tagid != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n");
+
+exetag = pSdbFindFirstNamedTag(pdb, tagid, TAG_EXE, TAG_NAME, exename + 
wcslen(workdir) + 1);
+
+if (!exetag)
+{
+/* Test done */
+return FALSE;
+}
+
+tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR);
+Vendor = pSdbGetStringTagPtr(pdb, tagid);
+Succeed = tagid != TAGID_NULL && Vendor && !wcsicmp(Vendor, L"Succeed");
+
+test_create_exe(exename, 0);
+
+ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, 
(SDBQUERYRESULT_VISTA*));
+DWORD exe_count = Succeed ? 1 : 0;
+
+if (Succeed)
+ok(ret, "SdbGetMatchingExe should not f

[ros-diffs] [mjansen] 75204: Missing functions

2017-06-26 Thread mjansen
Author: mjansen
Date: Mon Jun 26 12:50:46 2017
New Revision: 75204

URL: http://svn.reactos.org/svn/reactos?rev=75204=rev
Log:
Missing functions

Modified:
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h?rev=75204=75203=75204=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] Mon Jun 26 
12:50:46 2017
@@ -141,6 +141,18 @@
 return FindShimTagid(sdbstring(name.begin(), name.end()));
 }
 
+
+void InsertPatchTagid(const sdbstring& name, TAGID tagid);
+inline void InsertPatchTagid(const std::string& name, TAGID tagid)
+{
+InsertPatchTagid(sdbstring(name.begin(), name.end()), tagid);
+}
+TAGID FindPatchTagid(const sdbstring& name);
+inline TAGID FindPatchTagid(const std::string& name)
+{
+return FindPatchTagid(sdbstring(name.begin(), name.end()));
+}
+
 std::string Name;
 GUID ID;
 




[ros-diffs] [mjansen] 75203: Missing include

2017-06-26 Thread mjansen
Author: mjansen
Date: Mon Jun 26 12:47:08 2017
New Revision: 75203

URL: http://svn.reactos.org/svn/reactos?rev=75203=rev
Log:
Missing include

Modified:
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h?rev=75203=75202=75203=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h   [iso-8859-1] Mon Jun 26 
12:47:08 2017
@@ -2,6 +2,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 




[ros-diffs] [mjansen] 75202: [SDK][XML2SDB] Simplify helper functions, output Exe matches + file attributes

2017-06-26 Thread mjansen
Author: mjansen
Date: Mon Jun 26 12:45:01 2017
New Revision: 75202

URL: http://svn.reactos.org/svn/reactos?rev=75202=rev
Log:
[SDK][XML2SDB] Simplify helper functions, output Exe matches + file attributes

Modified:
trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt
trunk/reactos/sdk/tools/xml2sdb/main.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h

Modified: trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt?rev=75202=75201=75202=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt  [iso-8859-1] Mon Jun 26 
12:45:01 2017
@@ -5,6 +5,7 @@
 main.cpp
 tinyxml2.cpp
 xml2sdb.cpp
+xml2sdb.h
 ${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp/sdbwrite.c
 ${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp/sdbstringtable.c)
 

Modified: trunk/reactos/sdk/tools/xml2sdb/main.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/main.cpp?rev=75202=75201=75202=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/main.cpp[iso-8859-1] Mon Jun 26 
12:45:01 2017
@@ -186,14 +186,19 @@
 
 static std::string get_strarg(int argc, char* argv[], int& i)
 {
-if (argv[i][2] == 0)
-{
-++i;
-if (i >= argc || !argv[i])
-return std::string();
-return argv[i];
-}
-return std::string(argv[i] + 2);
+if (argv[i][2] != 0)
+return std::string(argv[i] + 2);
+
+++i;
+if (i >= argc || !argv[i])
+return std::string();
+return argv[i];
+}
+
+static void update_loglevel(int argc, char* argv[], int& i)
+{
+std::string value = get_strarg(argc, argv, i);
+g_ShimDebugLevel = strtoul(value.c_str(), NULL, 10);
 }
 
 // -i R:\src\apphelp\reactos\media\sdb\sysmain.xml 
-oR:\build\apphelp\devenv_msvc\media\sdb\ros2.sdb
@@ -204,25 +209,28 @@
 
 for (int i = 1; i < argc; ++i)
 {
-if (argv[i][0] == '/' || argv[i][0] == '-')
+if (argv[i][0] != '/' && argv[i][0] != '-')
+continue;
+
+switch(argv[i][1])
 {
-switch(argv[i][1])
-{
-case 'i':
-input = get_strarg(argc, argv, i);
-break;
-case 'o':
-output = get_strarg(argc, argv, i);
-break;
-}
-if (!input.empty() && !output.empty())
-{
-if (!run_one(input, output))
-{
-printf("Failed converting '%s' to '%s'\n", input.c_str(), 
output.c_str());
-return 1;
-}
-}
+case 'i':
+input = get_strarg(argc, argv, i);
+break;
+case 'o':
+output = get_strarg(argc, argv, i);
+break;
+case 'l':
+update_loglevel(argc, argv, i);
+break;
+}
+if (input.empty() || output.empty())
+continue;
+
+if (!run_one(input, output))
+{
+printf("Failed converting '%s' to '%s'\n", input.c_str(), 
output.c_str());
+return 1;
 }
 }
 return 0;

Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp?rev=75202=75201=75202=diff
==
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] Mon Jun 26 
12:45:01 2017
@@ -2,7 +2,7 @@
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT: ReactOS xml to sdb converter
  * FILE:sdk/tools/xml2sdb/xml2sdb.cpp
- * PURPOSE: Main conversion functions from xml -> db
+ * PURPOSE: Conversion functions from xml -> db
  * PROGRAMMERS: Mark Jansen
  *
  */
@@ -16,6 +16,7 @@
 using tinyxml2::XMLText;
 
 static const GUID GUID_NULL = { 0 };
+static const char szCompilerVersion[] = "1.5.0.0";
 
 #if !defined(C_ASSERT)
 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
@@ -44,7 +45,7 @@
 // Convert utf8 to utf16:
 // http://stackoverflow.com/a/7154226/4928207
 
-bool IsEmptyGuid(GUID& g)
+bool IsEmptyGuid(const GUID& g)
 {
 return !memcmp(, _NULL, sizeof(GUID));
 }
@@ -87,6 +88,32 @@
 return std::string(rawVal);
 }
 return ToString(dbNode.FirstChildElement(nodeName));
+}
+
+DWORD ReadDWordNode(XMLHandle dbNode, const char* nodeName)
+{
+std::string value = ReadStringNode(dbNode, nodeName);
+

[ros-diffs] [mjansen] 75201: [APPHELP_APITEST:db] Fix the test for Win10, use WCHAR for data paths

2017-06-26 Thread mjansen
Author: mjansen
Date: Mon Jun 26 10:26:57 2017
New Revision: 75201

URL: http://svn.reactos.org/svn/reactos?rev=75201=rev
Log:
[APPHELP_APITEST:db] Fix the test for Win10, use WCHAR for data paths

Modified:
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
trunk/reactos/dll/appcompat/apphelp/sdbwrite.h
trunk/rostests/apitests/apphelp/apphelp.c
trunk/rostests/apitests/apphelp/apphelp_apitest.h
trunk/rostests/apitests/apphelp/data.c
trunk/rostests/apitests/apphelp/db.cpp

Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbwrite.c?rev=75201=75200=75201=diff
==
--- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c  [iso-8859-1] Mon Jun 26 
10:26:57 2017
@@ -270,7 +270,7 @@
  *
  * @return  TRUE if it succeeds, FALSE if it fails.
  */
-BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size)
+BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size)
 {
 if (!SdbpCheckTagType(tag, TAG_TYPE_BINARY))
 return FALSE;

Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbwrite.h?rev=75201=75200=75201=diff
==
--- trunk/reactos/dll/appcompat/apphelp/sdbwrite.h  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.h  [iso-8859-1] Mon Jun 26 
10:26:57 2017
@@ -32,7 +32,7 @@
 BOOL WINAPI SdbWriteQWORDTag(PDB db, TAG tag, QWORD data);
 BOOL WINAPI SdbWriteStringTag(PDB db, TAG tag, LPCWSTR string);
 BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid);
-BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size);
+BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size);
 BOOL WINAPI SdbWriteBinaryTagFromFile(PDB db, TAG tag, LPCWSTR path);
 TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag);
 BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid);

Modified: trunk/rostests/apitests/apphelp/apphelp.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp.c?rev=75201=75200=75201=diff
==
--- trunk/rostests/apitests/apphelp/apphelp.c   [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/apphelp.c   [iso-8859-1] Mon Jun 26 
10:26:57 2017
@@ -603,7 +603,7 @@
 DWORD num = 333;
 BOOL ret;
 
-test_create_file_imp("testxx.exe", crc_test, len);
+test_create_file_imp(L"testxx.exe", crc_test, len);
 ret = pSdbGetFileAttributes(path, , );
 winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
 winetest_ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
@@ -629,7 +629,7 @@
 for (n = 0; n < len; ++n)
 crc_test[n] = (char)(fill ? fill : n);
 
-test_create_file_imp("testxx.exe", crc_test, len);
+test_create_file_imp(L"testxx.exe", crc_test, len);
 free(crc_test);
 ret = pSdbGetFileAttributes(path, , );
 winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
@@ -678,7 +678,7 @@
 pSdbFreeFileAttributes(pattrinfo);
 
 /* Test a file with as much features as possible */
-test_create_exe("testxx.exe", 0);
+test_create_exe(L"testxx.exe", 0);
 
 ret = pSdbGetFileAttributes(path, , );
 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
@@ -721,7 +721,7 @@
 
 
 /* Disable resource and exports */
-test_create_exe("testxx.exe", 1);
+test_create_exe(L"testxx.exe", 1);
 
 ret = pSdbGetFileAttributes(path, , );
 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
@@ -747,7 +747,7 @@
 pSdbFreeFileAttributes(pattrinfo);
 
 /* A file with just 'MZ' */
-test_create_file("testxx.exe", "MZ", 2);
+test_create_file(L"testxx.exe", "MZ", 2);
 
 ret = pSdbGetFileAttributes(path, , );
 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
@@ -768,7 +768,7 @@
 pSdbFreeFileAttributes(pattrinfo);
 
 /* Empty file */
-test_create_file("testxx.exe", NULL, 0);
+test_create_file(L"testxx.exe", NULL, 0);
 
 ret = pSdbGetFileAttributes(path, , );
 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
@@ -786,7 +786,7 @@
 pSdbFreeFileAttributes(pattrinfo);
 
 /* minimal NE executable */
-test_create_ne("testxx.exe", 0);
+test_create_ne(L"testxx.exe", 0);
 
 ret = pSdbGetFileAttributes(path, , );
 ok(ret != FALSE, &

[ros-diffs] [mjansen] 75140: [WIN32SS] Rewrite GetFontFamilyInfoForSubstitutes to use the subsitute list loaded at boot. Patch by Katayama Hirofumi MZ. CORE-13064

2017-06-19 Thread mjansen
Author: mjansen
Date: Mon Jun 19 20:00:36 2017
New Revision: 75140

URL: http://svn.reactos.org/svn/reactos?rev=75140=rev
Log:
[WIN32SS] Rewrite GetFontFamilyInfoForSubstitutes to use the subsitute list 
loaded at boot. Patch by Katayama Hirofumi MZ. CORE-13064

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=75140=75139=75140=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Mon Jun 19 
20:00:36 2017
@@ -2503,114 +2503,48 @@
 return TRUE;
 }
 
-typedef struct FontFamilyInfoCallbackContext
-{
-LPLOGFONTW LogFont;
-PFONTFAMILYINFO Info;
-DWORD Count;
-DWORD Size;
-} FONT_FAMILY_INFO_CALLBACK_CONTEXT, *PFONT_FAMILY_INFO_CALLBACK_CONTEXT;
-
-_Function_class_(RTL_QUERY_REGISTRY_ROUTINE)
-static NTSTATUS APIENTRY
-FontFamilyInfoQueryRegistryCallback(IN PWSTR ValueName, IN ULONG ValueType,
-IN PVOID ValueData, IN ULONG ValueLength,
-IN PVOID Context, IN PVOID EntryContext)
-{
-PFONT_FAMILY_INFO_CALLBACK_CONTEXT InfoContext;
-UNICODE_STRING RegistryName, RegistryValue;
-int Existing;
-PFONTGDI FontGDI;
-
-if (REG_SZ != ValueType)
-{
-return STATUS_SUCCESS;
-}
-InfoContext = (PFONT_FAMILY_INFO_CALLBACK_CONTEXT) Context;
-RtlInitUnicodeString(, ValueName);
-
-/* Do we need to include this font family? */
-if (FontFamilyInclude(InfoContext->LogFont, , 
InfoContext->Info,
-  min(InfoContext->Count, InfoContext->Size)))
-{
-RtlInitUnicodeString(, (PCWSTR) ValueData);
-Existing = FindFaceNameInInfo(, InfoContext->Info,
-  min(InfoContext->Count, 
InfoContext->Size));
-if (0 <= Existing)
-{
-/* We already have the information about the "real" font. Just 
copy it */
-if (InfoContext->Count < InfoContext->Size)
-{
-InfoContext->Info[InfoContext->Count] = 
InfoContext->Info[Existing];
-
RtlStringCbCopyNW(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName,
-  
sizeof(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName),
-  RegistryName.Buffer,
-  RegistryName.Length);
-}
-InfoContext->Count++;
-return STATUS_SUCCESS;
-}
-
-/* Try to find information about the "real" font */
-FontGDI = FindFaceNameInLists();
-if (NULL == FontGDI)
-{
-/* "Real" font not found, discard this registry entry */
-return STATUS_SUCCESS;
-}
-
-/* Return info about the "real" font but with the name of the alias */
-if (InfoContext->Count < InfoContext->Size)
-{
-FontFamilyFillInfo(InfoContext->Info + InfoContext->Count,
-   RegistryName.Buffer, NULL, FontGDI);
-}
-InfoContext->Count++;
-return STATUS_SUCCESS;
-}
-
-return STATUS_SUCCESS;
-}
-
 static BOOLEAN FASTCALL
 GetFontFamilyInfoForSubstitutes(LPLOGFONTW LogFont,
 PFONTFAMILYINFO Info,
-DWORD *Count,
-DWORD Size)
-{
-RTL_QUERY_REGISTRY_TABLE QueryTable[2] = {{0}};
-FONT_FAMILY_INFO_CALLBACK_CONTEXT Context;
-NTSTATUS Status;
-
-/* Enumerate font families found in HKLM\Software\Microsoft\Windows 
NT\CurrentVersion\FontSubstitutes
-   The real work is done in the registry callback function */
-Context.LogFont = LogFont;
-Context.Info = Info;
-Context.Count = *Count;
-Context.Size = Size;
-
-QueryTable[0].QueryRoutine = FontFamilyInfoQueryRegistryCallback;
-QueryTable[0].Flags = 0;
-QueryTable[0].Name = NULL;
-QueryTable[0].EntryContext = NULL;
-QueryTable[0].DefaultType = REG_NONE;
-QueryTable[0].DefaultData = NULL;
-QueryTable[0].DefaultLength = 0;
-
-QueryTable[1].QueryRoutine = NULL;
-QueryTable[1].Name = NULL;
-
-Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT,
-L"FontSubstitutes",
-QueryTable,
-,
-NULL);
-if (NT_SUCCESS(Status))
-{
-*Count = Context.Count;
-}
-
-return NT_SUCCESS(Status) || STATUS_OBJECT_NAME_NOT_FOUND == Status;
+DWORD *pCou

[ros-diffs] [mjansen] 75135: [APPHELP] Implement Sdb[Un]packAppCompatData and SdbGetAppCompatDataSize. CORE-13284

2017-06-19 Thread mjansen
Author: mjansen
Date: Mon Jun 19 16:37:47 2017
New Revision: 75135

URL: http://svn.reactos.org/svn/reactos?rev=75135=rev
Log:
[APPHELP] Implement Sdb[Un]packAppCompatData and SdbGetAppCompatDataSize. 
CORE-13284

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/hsdb.c

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.spec?rev=75135=75134=75135=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] Mon Jun 19 
16:37:47 2017
@@ -51,7 +51,7 @@
 @ stdcall SdbFreeFileAttributes(ptr)
 @ stub SdbFreeFileInfo
 @ stub SdbFreeFlagInfo
-@ stub SdbGetAppCompatDataSize
+@ stdcall SdbGetAppCompatDataSize(ptr)
 @ stdcall SdbGetAppPatchDir(ptr wstr long)
 @ stdcall SdbGetBinaryTagData(ptr long)
 @ stdcall SdbGetDatabaseID(ptr ptr)
@@ -103,7 +103,8 @@
 @ stdcall SdbOpenDatabase(wstr long)
 @ stub SdbOpenDbFromGuid
 @ stub SdbOpenLocalDatabase
-@ stub SdbPackAppCompatData
+@ stdcall SdbPackAppCompatData(ptr ptr ptr ptr)
+@ stdcall SdbUnpackAppCompatData(ptr wstr ptr ptr)
 @ stub SdbQueryApphelpInformation
 @ stub SdbQueryBlockUpgrade
 @ stub SdbQueryContext

Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb.c?rev=75135=75134=75135=diff
==
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c  [iso-8859-1] Mon Jun 19 
16:37:47 2017
@@ -29,6 +29,19 @@
 #define MAX_LAYER_LENGTH256
 #define GPLK_USER   1
 #define GPLK_MACHINE2
+
+typedef struct _ShimData
+{
+WCHAR szModule[MAX_PATH];
+DWORD dwSize;
+DWORD dwMagic;
+SDBQUERYRESULT Query;
+WCHAR szLayer[MAX_LAYER_LENGTH];
+DWORD unknown;  // 0x14c
+} ShimData;
+
+#define SHIMDATA_MAGIC  0xAC0DEDAB
+
 
 static BOOL WINAPI SdbpFileExists(LPCWSTR path)
 {
@@ -554,3 +567,79 @@
 
 
 
+BOOL WINAPI SdbPackAppCompatData(HSDB hsdb, PSDBQUERYRESULT pQueryResult, 
PVOID* ppData, DWORD *pdwSize)
+{
+ShimData* pData;
+HRESULT hr;
+DWORD n;
+
+if (!pQueryResult || !ppData || !pdwSize)
+{
+SHIM_WARN("Invalid params: %p, %p, %p\n", pQueryResult, ppData, 
pdwSize);
+return FALSE;
+}
+
+pData = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(ShimData));
+if (!pData)
+{
+SHIM_WARN("Unable to allocate %d bytes\n", sizeof(ShimData));
+return FALSE;
+}
+
+GetWindowsDirectoryW(pData->szModule, _countof(pData->szModule));
+hr = StringCchCatW(pData->szModule, _countof(pData->szModule), 
L"\\system32\\apphelp.dll");
+if (!SUCCEEDED(hr))
+{
+SHIM_ERR("Unable to append module name (0x%x)\n", hr);
+RtlFreeHeap(RtlGetProcessHeap(), 0, pData);
+return FALSE;
+}
+
+pData->dwSize = sizeof(*pData);
+pData->dwMagic = SHIMDATA_MAGIC;
+pData->Query = *pQueryResult;
+pData->unknown = 0;
+pData->szLayer[0] = UNICODE_NULL;   /* TODO */
+
+SHIM_INFO("\ndwFlags0x%x\ndwMagic0x%x\ntrExe  0x%x\ntrLayer
0x%x",
+  pData->Query.dwFlags, pData->dwMagic, pData->Query.atrExes[0], 
pData->Query.atrLayers[0]);
+
+/* Database List */
+/* 0x0 {GUID} NAME */
+
+for (n = 0; n < pQueryResult->dwLayerCount; ++n)
+{
+SHIM_INFO("Layer 0x%x\n", pQueryResult->atrLayers[n]);
+}
+
+*ppData = pData;
+*pdwSize = pData->dwSize;
+
+return TRUE;
+}
+
+BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID 
pData, PSDBQUERYRESULT pQueryResult)
+{
+ShimData* pShimData = pData;
+
+if (!pShimData || pShimData->dwMagic != SHIMDATA_MAGIC || 
pShimData->dwSize < sizeof(ShimData))
+return FALSE;
+
+if (!pQueryResult)
+return FALSE;
+
+/* szLayer? */
+
+*pQueryResult = pShimData->Query;
+return TRUE;
+}
+
+DWORD WINAPI SdbGetAppCompatDataSize(ShimData* pData)
+{
+if (!pData || pData->dwMagic != SHIMDATA_MAGIC)
+return 0;
+
+
+return pData->dwSize;
+}
+




[ros-diffs] [mjansen] 75131: [APPSHIM_APITEST] Addendum to r75041, add a missed line.

2017-06-19 Thread mjansen
Author: mjansen
Date: Mon Jun 19 15:24:05 2017
New Revision: 75131

URL: http://svn.reactos.org/svn/reactos?rev=75131=rev
Log:
[APPSHIM_APITEST] Addendum to r75041, add a missed line.

Modified:
trunk/rostests/apitests/appshim/dispmode.c

Modified: trunk/rostests/apitests/appshim/dispmode.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/appshim/dispmode.c?rev=75131=75130=75131=diff
==
--- trunk/rostests/apitests/appshim/dispmode.c  [iso-8859-1] (original)
+++ trunk/rostests/apitests/appshim/dispmode.c  [iso-8859-1] Mon Jun 19 
15:24:05 2017
@@ -436,6 +436,7 @@
 if (ret)
 {
 test_one(tests[n].name, tests[n].reason, tests[n].pre, 
tests[n].post, tests[n].second);
+tests[n].unhook(dll);
 }
 else
 {




[ros-diffs] [mjansen] 75130: [SHELL32] Partially sync shlexec with wine staging 2.9 CORE-13362 CORE-13407

2017-06-19 Thread mjansen
Author: mjansen
Date: Mon Jun 19 15:04:20 2017
New Revision: 75130

URL: http://svn.reactos.org/svn/reactos?rev=75130=rev
Log:
[SHELL32] Partially sync shlexec with wine staging 2.9 CORE-13362 CORE-13407

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

Modified: trunk/reactos/dll/win32/shell32/shlexec.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlexec.cpp?rev=75130=75129=75130=diff
==
--- trunk/reactos/dll/win32/shell32/shlexec.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlexec.cpp [iso-8859-1] Mon Jun 19 
15:04:20 2017
@@ -1209,6 +1209,7 @@
 {
 UINT_PTR retval = SE_ERR_NOASSOC;
 WCHAR old_dir[1024];
+WCHAR res[MAX_PATH];
 
 TRACE("File %s, Dir %s\n", debugstr_w(lpFile), debugstr_w(lpDirectory));
 
@@ -1222,7 +1223,9 @@
 SetCurrentDirectoryW(lpDirectory);
 }
 
-retval = SHELL_FindExecutable(lpDirectory, lpFile, wszOpen, lpResult, 
MAX_PATH, NULL, NULL, NULL, NULL);
+retval = SHELL_FindExecutable(lpDirectory, lpFile, wszOpen, res, MAX_PATH, 
NULL, NULL, NULL, NULL);
+if (retval > 32)
+strcpyW(lpResult, res);
 
 TRACE("returning %s\n", debugstr_w(lpResult));
 if (lpDirectory)
@@ -1409,6 +1412,7 @@
 if (!dataobj)
 {
 ERR("failed to get data object\n");
+r = E_FAIL;
 goto end;
 }
 
@@ -1663,7 +1667,6 @@
 DWORD error_code;
 
 error_code = GetLastError();
-
 if (retval == SE_ERR_NOASSOC)
 LoadStringW(shell32_hInstance, IDS_SHLEXEC_NOASSOC, msg, sizeof(msg) / 
sizeof(WCHAR));
 else
@@ -1676,6 +1679,26 @@
(va_list*)msgArguments);
 
 MessageBoxW(hwnd, msg, NULL, MB_ICONERROR);
+}
+
+static WCHAR *expand_environment( const WCHAR *str )
+{
+WCHAR *buf;
+DWORD len;
+
+len = ExpandEnvironmentStringsW(str, NULL, 0);
+if (!len) return NULL;
+
+buf = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+if (!buf) return NULL;
+
+len = ExpandEnvironmentStringsW(str, buf, len);
+if (!len)
+{
+HeapFree(GetProcessHeap(), 0, buf);
+return NULL;
+}
+return buf;
 }
 
 /*
@@ -1721,17 +1744,16 @@
 wszApplicationName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
dwApplicationNameLen * sizeof(WCHAR));
 *wszApplicationName = '\0';
 }
-else if (*sei_tmp.lpFile == '\"')
-{
-DWORD l = strlenW(sei_tmp.lpFile + 1);
-if(l >= dwApplicationNameLen)
-dwApplicationNameLen = l + 1;
+else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = 
strlenW(sei_tmp.lpFile))-1] == '\"')
+{
+if(len-1 >= dwApplicationNameLen)
+dwApplicationNameLen = len;
 
 wszApplicationName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
dwApplicationNameLen * sizeof(WCHAR));
-memcpy(wszApplicationName, sei_tmp.lpFile + 1, (l + 1)*sizeof(WCHAR));
-
-if (wszApplicationName[l-1] == L'\"')
-wszApplicationName[l-1] = L'\0';
+memcpy(wszApplicationName, sei_tmp.lpFile + 1, len * sizeof(WCHAR));
+
+if(len > 2)
+wszApplicationName[len-2] = '\0';
 appKnownSingular = TRUE;
 
 TRACE("wszApplicationName=%s\n", debugstr_w(wszApplicationName));
@@ -1809,6 +1831,27 @@
 TRACE("-- idlist=%p (%s)\n", sei_tmp.lpIDList, 
debugstr_w(wszApplicationName));
 }
 
+if (sei_tmp.fMask & SEE_MASK_DOENVSUBST)
+{
+WCHAR *tmp;
+
+tmp = expand_environment(sei_tmp.lpFile);
+if (!tmp)
+{
+return FALSE;
+}
+HeapFree(GetProcessHeap(), 0, wszApplicationName);
+sei_tmp.lpFile = wszApplicationName = tmp;
+
+tmp = expand_environment(sei_tmp.lpDirectory);
+if (!tmp)
+{
+return FALSE;
+}
+if (wszDir != dirBuffer) HeapFree(GetProcessHeap(), 0, wszDir);
+sei_tmp.lpDirectory = wszDir = tmp;
+}
+
 if (ERROR_SUCCESS == ShellExecute_FromContextMenu(_tmp))
 {
 sei->hInstApp = (HINSTANCE) 33;
@@ -1870,7 +1913,6 @@
 }
 
 HeapFree(GetProcessHeap(), 0, wszApplicationName);
-dwApplicationNameLen = lstrlenW(buf) + 1;
 wszApplicationName = buf;
 sei_tmp.lpFile = wszApplicationName;
 }
@@ -1884,7 +1926,6 @@
 
 ExpandEnvironmentStringsW(sei_tmp.lpFile, buf, len + 1);
 HeapFree(GetProcessHeap(), 0, wszApplicationName);
-dwApplicationNameLen = len + 1;
 wszApplicationName = buf;
 /* appKnownSingular unmodified */
 
@@ -1931,7 +1972,7 @@
 {
 end = ++src;
 
-while(isspace(*src))
+while(isspaceW(*src))
 ++src;
 }
 else




[ros-diffs] [mjansen] 75041: [APITEST] Move RedirectIat into it's own header so that it can be used from multiple tests.

2017-06-14 Thread mjansen
Author: mjansen
Date: Wed Jun 14 15:25:04 2017
New Revision: 75041

URL: http://svn.reactos.org/svn/reactos?rev=75041=rev
Log:
[APITEST] Move RedirectIat into it's own header so that it can be used from 
multiple tests.

Added:
trunk/rostests/apitests/include/apitest_iathook.h   (with props)
Modified:
trunk/rostests/apitests/apphelp/layerapi.c
trunk/rostests/apitests/appshim/dispmode.c

Modified: trunk/rostests/apitests/apphelp/layerapi.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/layerapi.c?rev=75041=75040=75041=diff
==
--- trunk/rostests/apitests/apphelp/layerapi.c  [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/layerapi.c  [iso-8859-1] Wed Jun 14 
15:25:04 2017
@@ -30,7 +30,7 @@
 #include 
 
 #include "wine/test.h"
-
+#include "apitest_iathook.h"
 #include "apphelp_apitest.h"
 
 #define GPLK_USER 1
@@ -612,73 +612,6 @@
 return uRet;
 }
 
-
-static PIMAGE_IMPORT_DESCRIPTOR FindImportDescriptor(PBYTE DllBase, PCSTR 
DllName)
-{
-ULONG Size;
-PIMAGE_IMPORT_DESCRIPTOR ImportDescriptor = 
RtlImageDirectoryEntryToData((HMODULE)DllBase, TRUE, 
IMAGE_DIRECTORY_ENTRY_IMPORT, );
-while (ImportDescriptor->Name && ImportDescriptor->OriginalFirstThunk)
-{
-PCHAR Name = (PCHAR)(DllBase + ImportDescriptor->Name);
-if (!lstrcmpiA(Name, DllName))
-{
-return ImportDescriptor;
-}
-ImportDescriptor++;
-}
-return NULL;
-}
-
-static BOOL RedirectIat(PCSTR TargetDllName, PCSTR DllName, PCSTR 
FunctionName, ULONG_PTR NewFunction, ULONG_PTR* OriginalFunction)
-{
-PBYTE DllBase = (PBYTE)GetModuleHandleA(TargetDllName);
-if (DllBase)
-{
-PIMAGE_IMPORT_DESCRIPTOR ImportDescriptor = 
FindImportDescriptor(DllBase, DllName);
-if (ImportDescriptor)
-{
-// On loaded images, OriginalFirstThunk points to the name / 
ordinal of the function
-PIMAGE_THUNK_DATA OriginalThunk = (PIMAGE_THUNK_DATA)(DllBase + 
ImportDescriptor->OriginalFirstThunk);
-// FirstThunk points to the resolved address.
-PIMAGE_THUNK_DATA FirstThunk = (PIMAGE_THUNK_DATA)(DllBase + 
ImportDescriptor->FirstThunk);
-while (OriginalThunk->u1.AddressOfData && FirstThunk->u1.Function)
-{
-if (!IMAGE_SNAP_BY_ORDINAL32(OriginalThunk->u1.AddressOfData))
-{
-PIMAGE_IMPORT_BY_NAME ImportName = 
(PIMAGE_IMPORT_BY_NAME)(DllBase + OriginalThunk->u1.AddressOfData);
-if (!lstrcmpiA((PCSTR)ImportName->Name, FunctionName))
-{
-DWORD dwOld;
-VirtualProtect(>u1.Function, 
sizeof(ULONG_PTR), PAGE_EXECUTE_READWRITE, );
-*OriginalFunction = FirstThunk->u1.Function;
-FirstThunk->u1.Function = NewFunction;
-VirtualProtect(>u1.Function, 
sizeof(ULONG_PTR), dwOld, );
-return TRUE;
-}
-}
-OriginalThunk++;
-FirstThunk++;
-}
-skip("Unable to find the Import '%s' from '%s' in %s'\n", 
FunctionName, DllName, TargetDllName);
-}
-else
-{
-skip("Unable to find the ImportDescriptor for '%s' in '%s'\n", 
DllName, TargetDllName);
-}
-}
-else
-{
-skip("Unable to find the loaded module '%s'\n", TargetDllName);
-}
-return FALSE;
-}
-
-static BOOL RestoreIat(PCSTR target, PCSTR DllName, PCSTR FunctionName, 
ULONG_PTR OriginalFunction)
-{
-ULONG_PTR old = 0;
-return RedirectIat(target, DllName, FunctionName, OriginalFunction, );
-}
-
 static BOOL wrapSdbSetPermLayerKeys2(LPCSTR dir, LPCSTR name, PCSTR szLayers, 
BOOL bMachine)
 {
 char szPath[MAX_PATH];
@@ -759,7 +692,8 @@
 ok(ret, "DefineDosDeviceA error: %d\n", GetLastError());
 if(ret)
 {
-ret = RedirectIat("apphelp.dll", "kernel32.dll", "GetDriveTypeW", 
(ULONG_PTR)mGetDriveTypeW, (ULONG_PTR*));
+ret = RedirectIat(GetModuleHandleA("apphelp.dll"), "kernel32.dll", 
"GetDriveTypeW",
+  (ULONG_PTR)mGetDriveTypeW, 
(ULONG_PTR*));
 if (g_WinVersion < WINVER_WIN8)
 ok(ret, "Expected redirect_iat to succeed\n");
 if(ret)
@@ -862,7 +796,7 @@
 ok(wrapSdbSetPermLayerKeys2(drive, "sub\\test.exe", "", 0), 
"Expected wrapSdbSetPermLayerKeys2 to succeed\n");
 }
 
-ret = RestoreIat("apphelp.dll", "kernel32.dll", "GetDriveTypeW", 
(ULONG_PTR)pGetDriveTypeW);
+r

[ros-diffs] [mjansen] 75040: [NOTEPAD] Fix default font settings. Patch by Katayama Hirofumi MZ. CORE-13037

2017-06-14 Thread mjansen
Author: mjansen
Date: Wed Jun 14 14:22:32 2017
New Revision: 75040

URL: http://svn.reactos.org/svn/reactos?rev=75040=rev
Log:
[NOTEPAD] Fix default font settings. Patch by Katayama Hirofumi MZ. CORE-13037

Modified:
trunk/reactos/base/applications/notepad/settings.c

Modified: trunk/reactos/base/applications/notepad/settings.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/settings.c?rev=75040=75039=75040=diff
==
--- trunk/reactos/base/applications/notepad/settings.c  [iso-8859-1] (original)
+++ trunk/reactos/base/applications/notepad/settings.c  [iso-8859-1] Wed Jun 14 
14:22:32 2017
@@ -170,18 +170,31 @@
 else
 {
 /* If no settings are found in the registry, then use default values */
-Globals.lfFont.lfCharSet = 163;
-Globals.lfFont.lfClipPrecision = 2;
+Globals.bShowStatusBar = FALSE;
+Globals.bWrapLongLines = FALSE;
+SetRect(, 750, 1000, 750, 1000);
+
+/* FIXME: Globals.fSaveWindowPositions = FALSE; */
+/* FIXME: Globals.fMLE_is_broken = FALSE; */
+
+LoadString(Globals.hInstance, STRING_PAGESETUP_HEADERVALUE, 
Globals.szHeader,
+   ARRAY_SIZE(Globals.szHeader));
+LoadString(Globals.hInstance, STRING_PAGESETUP_FOOTERVALUE, 
Globals.szFooter,
+   ARRAY_SIZE(Globals.szFooter));
+
+ZeroMemory(, sizeof(Globals.lfFont));
+Globals.lfFont.lfCharSet = ANSI_CHARSET;
+Globals.lfFont.lfClipPrecision = CLIP_STROKE_PRECIS;
 Globals.lfFont.lfEscapement = 0;
 _tcscpy(Globals.lfFont.lfFaceName, _T("Lucida Console"));
-Globals.lfFont.lfItalic = 0;
+Globals.lfFont.lfItalic = FALSE;
 Globals.lfFont.lfOrientation = 0;
-Globals.lfFont.lfOutPrecision = 3;
-Globals.lfFont.lfPitchAndFamily = 34;
-Globals.lfFont.lfQuality = 1;
-Globals.lfFont.lfStrikeOut = 0;
-Globals.lfFont.lfUnderline = 0;
-Globals.lfFont.lfWeight = 400;
+Globals.lfFont.lfOutPrecision = OUT_STRING_PRECIS;
+Globals.lfFont.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
+Globals.lfFont.lfQuality = PROOF_QUALITY;
+Globals.lfFont.lfStrikeOut = FALSE;
+Globals.lfFont.lfUnderline = FALSE;
+Globals.lfFont.lfWeight = FW_NORMAL;
 Globals.lfFont.lfHeight = HeightFromPointSize(100);
 }
 




[ros-diffs] [mjansen] 75004: [APPHELP_APITEST] Addendum to r74986, make the test work on win7. CORE-13284

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 13:09:43 2017
New Revision: 75004

URL: http://svn.reactos.org/svn/reactos?rev=75004=rev
Log:
[APPHELP_APITEST] Addendum to r74986, make the test work on win7. CORE-13284

Modified:
trunk/rostests/apitests/apphelp/env.c

Modified: trunk/rostests/apitests/apphelp/env.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/env.c?rev=75004=75003=75004=diff
==
--- trunk/rostests/apitests/apphelp/env.c   [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/env.c   [iso-8859-1] Sun Jun 11 
13:09:43 2017
@@ -,7 +,7 @@
 ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
 if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
 {
-if (ExpectedReason != 0x400 && g_ModuleVersion < WINVER_WIN10)
+if (ExpectedReason != 0x400 && g_ModuleVersion < WINVER_WIN7)
 expect_layeronly(AppCompatData, "256Color", expect_flags);
 else
 ok(!memcmp(AppCompatData, _result, 
sizeof(empty_result)), "Expected result to be empty\n");
@@ -1234,10 +1234,10 @@
 DWORD ShimDataType;
 NTSTATUS ExceptionStatus = STATUS_SUCCESS;
 
-SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "127");
-SetEnvironmentVariable("SHIMENG_DEBUG_LEVEL", "127");
-
-//silence_debug_output();
+//SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "127");
+//SetEnvironmentVariable("SHIMENG_DEBUG_LEVEL", "127");
+
+silence_debug_output();
 
 hdll = LoadLibraryA("apphelp.dll");
 
@@ -1299,6 +1299,7 @@
 return;
 }
 
+/* New version of Win10.. */
 if (g_WinVersion == WINVER_WIN10 && ShimDataType == 3)
 g_ShimDataSize = 4096;
 




[ros-diffs] [mjansen] 75001: [WIN32NT_APITEST] Do not assert on a driver without DirectX support.

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 11:47:41 2017
New Revision: 75001

URL: http://svn.reactos.org/svn/reactos?rev=75001=rev
Log:
[WIN32NT_APITEST] Do not assert on a driver without DirectX support.

Modified:
trunk/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c

Modified: trunk/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c?rev=75001=75000=75001=diff
==
--- trunk/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c 
[iso-8859-1] (original)
+++ trunk/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c 
[iso-8859-1] Sun Jun 11 11:47:41 2017
@@ -68,7 +68,12 @@
 
 /* Create ReactX handle */
 hDirectDraw = (HANDLE) NtGdiDdCreateDirectDrawObject(hdc);
-ASSERT(hDirectDraw != NULL);
+RTEST(hDirectDraw != NULL);
+if (hDirectDraw == NULL)
+{
+DeleteDC(hdc);
+return;
+}
 
 /* Start Test ReactX NtGdiDdQueryDirectDrawObject function */
 




[ros-diffs] [mjansen] 74999: [WIN32K] Remove an unneeded check at GreGetDIBitsInternal. Patch by Victor Martinez Calvo. CORE-13413 CID 1411972

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 11:18:57 2017
New Revision: 74999

URL: http://svn.reactos.org/svn/reactos?rev=74999=rev
Log:
[WIN32K] Remove an unneeded check at GreGetDIBitsInternal. Patch by Victor 
Martinez Calvo. CORE-13413 CID 1411972

Modified:
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c?rev=74999=74998=74999=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c[iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c[iso-8859-1] Sun Jun 11 
11:18:57 2017
@@ -759,7 +759,7 @@
 
 if (Bits || bpp)
 {
-if ((height == 0 || planes < 0 || width == 0) || (compr && compr != 
BI_BITFIELDS && compr != BI_RGB))
+if ((height == 0 || width == 0) || (compr && compr != BI_BITFIELDS && 
compr != BI_RGB))
 {
 ScanLines = 0;
 goto done;




[ros-diffs] [mjansen] 74998: [COMCTL32_IMAGELIST] Prevent dereferencing a null pointer.

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 11:08:32 2017
New Revision: 74998

URL: http://svn.reactos.org/svn/reactos?rev=74998=rev
Log:
[COMCTL32_IMAGELIST] Prevent dereferencing a null pointer.

Modified:
trunk/rostests/winetests/comctl32/imagelist.c

Modified: trunk/rostests/winetests/comctl32/imagelist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/imagelist.c?rev=74998=74997=74998=diff
==
--- trunk/rostests/winetests/comctl32/imagelist.c   [iso-8859-1] (original)
+++ trunk/rostests/winetests/comctl32/imagelist.c   [iso-8859-1] Sun Jun 11 
11:08:32 2017
@@ -2046,9 +2046,9 @@
 ok((bmi->bmiColors[i].rgbRed == expect[i].rgbRed &&
 bmi->bmiColors[i].rgbGreen == expect[i].rgbGreen &&
 bmi->bmiColors[i].rgbBlue == expect[i].rgbBlue) ||
-   broken(bmi->bmiColors[i].rgbRed == broken_expect[i].rgbRed &&
+   (broken_expect && broken(bmi->bmiColors[i].rgbRed == 
broken_expect[i].rgbRed &&
   bmi->bmiColors[i].rgbGreen == broken_expect[i].rgbGreen &&
-  bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue),
+  bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue)),
"%d: %s: got color[%d] %02x %02x %02x expect %02x %02x %02x\n", 
depth, name, i,
bmi->bmiColors[i].rgbRed, bmi->bmiColors[i].rgbGreen, 
bmi->bmiColors[i].rgbBlue,
expect[i].rgbRed, expect[i].rgbGreen, expect[i].rgbBlue);




[ros-diffs] [mjansen] 74996: [WIN32KNT_APITEST] Do not assert on the result of an unimplemented function.

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 08:51:36 2017
New Revision: 74996

URL: http://svn.reactos.org/svn/reactos?rev=74996=rev
Log:
[WIN32KNT_APITEST] Do not assert on the result of an unimplemented function.

Modified:
trunk/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c

Modified: trunk/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c?rev=74996=74995=74996=diff
==
--- trunk/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c   [iso-8859-1] 
(original)
+++ trunk/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c   [iso-8859-1] 
Sun Jun 11 08:51:36 2017
@@ -19,7 +19,9 @@
// FIXME: We should load the font first
 
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, 
);
-   ASSERT(idEnum != 0);
+   TEST(idEnum != 0);
+   if (idEnum == 0)
+   return;
 
/* we should have a gdi handle here */
TEST(GDI_HANDLE_GET_TYPE(idEnum) == GDI_OBJECT_TYPE_ENUMFONT);




[ros-diffs] [mjansen] 74994: [SHELL32] Expose IID_CDefView in our CDefView implementation, this fixes a crash on shell32:shlview

2017-06-11 Thread mjansen
Author: mjansen
Date: Sun Jun 11 08:37:03 2017
New Revision: 74994

URL: http://svn.reactos.org/svn/reactos?rev=74994=rev
Log:
[SHELL32] Expose IID_CDefView in our CDefView implementation, this fixes a 
crash on shell32:shlview

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=74994=74993=74994=diff
==
--- trunk/reactos/dll/win32/shell32/CDefView.cpp[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefView.cpp[iso-8859-1] Sun Jun 11 
08:37:03 2017
@@ -325,6 +325,7 @@
 // Windows returns E_NOINTERFACE for IOleWindow
 // COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
 COM_INTERFACE_ENTRY_IID(IID_IShellView, IShellView)
+COM_INTERFACE_ENTRY_IID(IID_CDefView, IShellView)
 COM_INTERFACE_ENTRY_IID(IID_IShellView2, IShellView2)
 COM_INTERFACE_ENTRY_IID(IID_IFolderView, IFolderView)
 COM_INTERFACE_ENTRY_IID(IID_IShellFolderView, IShellFolderView)




[ros-diffs] [mjansen] 74984: [SHLWAPI_APITEST] Add PathFindOnPath tests. Patch by Katayama Hirofumi MZ. ROSTESTS-283 #comment Thanks!

2017-06-10 Thread mjansen
Author: mjansen
Date: Sat Jun 10 19:41:31 2017
New Revision: 74984

URL: http://svn.reactos.org/svn/reactos?rev=74984=rev
Log:
[SHLWAPI_APITEST] Add PathFindOnPath tests. Patch by Katayama Hirofumi MZ. 
ROSTESTS-283 #comment Thanks!

Added:
trunk/rostests/apitests/shlwapi/PathFindOnPath.c   (with props)
Modified:
trunk/rostests/apitests/shlwapi/CMakeLists.txt
trunk/rostests/apitests/shlwapi/testlist.c

Modified: trunk/rostests/apitests/shlwapi/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shlwapi/CMakeLists.txt?rev=74984=74983=74984=diff
==
--- trunk/rostests/apitests/shlwapi/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/rostests/apitests/shlwapi/CMakeLists.txt  [iso-8859-1] Sat Jun 10 
19:41:31 2017
@@ -1,5 +1,6 @@
 
 list(APPEND SOURCE
+PathFindOnPath.c
 PathIsUNC.c
 PathIsUNCServer.c
 PathIsUNCServerShare.c
@@ -9,5 +10,6 @@
 
 add_executable(shlwapi_apitest ${SOURCE})
 set_module_type(shlwapi_apitest win32cui)
+target_link_libraries(shlwapi_apitest ${PSEH_LIB})
 add_importlibs(shlwapi_apitest shlwapi msvcrt kernel32)
 add_rostests_file(TARGET shlwapi_apitest)

Added: trunk/rostests/apitests/shlwapi/PathFindOnPath.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shlwapi/PathFindOnPath.c?rev=74984
==
--- trunk/rostests/apitests/shlwapi/PathFindOnPath.c(added)
+++ trunk/rostests/apitests/shlwapi/PathFindOnPath.c[iso-8859-1] Sat Jun 10 
19:41:31 2017
@@ -0,0 +1,348 @@
+/*
+ * Copyright 2017 Katayama Hirofumi MZ
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include 
+#include 
+#include 
+
+#define EF_FULLPATH 1
+#define EF_TESTDATA 2
+#define EF_WIN_DIR  4
+#define EF_SYS_DIR  8
+#define EF_TYPE_MASK0xF
+
+#define EF_NAME_ONLY16
+
+typedef struct ENTRY
+{
+INT EntryNumber;/* # */
+INT Ret;
+DWORD   Error;
+UINTEF_;
+LPCWSTR NameBefore;
+LPCWSTR NameExpected;
+LPCWSTR PathExpected;
+LPWSTR *Dirs;
+} ENTRY;
+
+#define BEEF0xBEEF  /* Error Code 48879 */
+#define DEAD0xDEAD  /* Error Code 57005 */
+#define IGNORE_ERR  0x7F7F7F7F  /* Ignore Error Code */
+#define RAISED  /* exception raised */
+
+static WCHARs_TestDataPath[MAX_PATH];
+static LPWSTR   s_Dirs[2];
+static WCHARs_WinDir[MAX_PATH];
+static WCHARs_SysDir[MAX_PATH];
+static WCHARs_FontsDir[MAX_PATH];
+static WCHARs_NotepadPath[MAX_PATH];
+
+static const ENTRY s_Entries[] =
+{
+/* NULL or empty path */
+{ 0, 0, BEEF, EF_FULLPATH, NULL, NULL },
+{ 1, 1, BEEF, EF_FULLPATH, L"", s_SysDir },
+/* path without dirs in Windows */
+{ 2, 0, BEEF, EF_WIN_DIR, L"", L"" },
+{ 3, 0, BEEF, EF_WIN_DIR, L"Fonts", L"Fonts" },
+{ 4, 0, BEEF, EF_WIN_DIR, L"notepad", L"notepad" },
+{ 5, 0, BEEF, EF_WIN_DIR, L"notepad.exe", L"notepad.exe" },
+{ 6, 0, BEEF, EF_WIN_DIR, L"system32", L"system32" },
+{ 7, 0, BEEF, EF_WIN_DIR, L"invalid name", L"invalid name" },
+/* path with dirs in Windows */
+{ 8, 0, BEEF, EF_WIN_DIR, L"", L"", NULL, s_Dirs },
+{ 9, 0, BEEF, EF_WIN_DIR, L"Fonts", L"Fonts", NULL, s_Dirs },
+{ 10, 0, BEEF, EF_WIN_DIR, L"notepad", L"notepad", NULL, s_Dirs },
+{ 11, 0, BEEF, EF_WIN_DIR, L"notepad.exe", L"notepad.exe", NULL, s_Dirs },
+{ 12, 0, BEEF, EF_WIN_DIR, L"system32", L"system32", NULL, s_Dirs },
+{ 13, 0, BEEF, EF_WIN_DIR, L"invalid name", L"invalid name", NULL, s_Dirs 
},
+/* name only without dirs in Windows */
+{ 14, 1, BEEF, EF_WIN_DIR | EF_NAME_ONLY, L"", L"system32" },
+{ 15, 1, ERROR_FILE_NOT_FOUND, EF_WIN_DIR | EF_NAME_ONLY, L"Fonts", 
L"Fonts" },
+{ 16, 0, ERROR_FILE_NOT_FOUND, EF_WIN_DIR | EF_NAME_ONLY, L"notepad" },
+{ 17, 1, BEEF, EF_WIN_DIR 

[ros-diffs] [mjansen] 74983: Addendum to r74982, remove some debugging code.

2017-06-10 Thread mjansen
Author: mjansen
Date: Sat Jun 10 17:47:56 2017
New Revision: 74983

URL: http://svn.reactos.org/svn/reactos?rev=74983=rev
Log:
Addendum to r74982, remove some debugging code.

Modified:
trunk/rostests/apitests/shell32/testlist.c

Modified: trunk/rostests/apitests/shell32/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/testlist.c?rev=74983=74982=74983=diff
==
--- trunk/rostests/apitests/shell32/testlist.c  [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/testlist.c  [iso-8859-1] Sat Jun 10 
17:47:56 2017
@@ -1,7 +1,6 @@
 #define __ROS_LONG64__
 
 #define STANDALONE
-#include "R:\hook\base_hk.h"
 #include 
 
 extern void func_AddCommas(void);




[ros-diffs] [mjansen] 74982: [SHELL32_APITEST] Add tests for PathResolve. Patch by Katayama Hirofumi MZ. CORE-12665 #comment Thanks!

2017-06-10 Thread mjansen
Author: mjansen
Date: Sat Jun 10 17:46:11 2017
New Revision: 74982

URL: http://svn.reactos.org/svn/reactos?rev=74982=rev
Log:
[SHELL32_APITEST] Add tests for PathResolve. Patch by Katayama Hirofumi MZ. 
CORE-12665 #comment Thanks!

Added:
trunk/rostests/apitests/shell32/PathResolve.cpp   (with props)
Modified:
trunk/rostests/apitests/shell32/CMakeLists.txt
trunk/rostests/apitests/shell32/testlist.c

Modified: trunk/rostests/apitests/shell32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CMakeLists.txt?rev=74982=74981=74982=diff
==
--- trunk/rostests/apitests/shell32/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/CMakeLists.txt  [iso-8859-1] Sat Jun 10 
17:46:11 2017
@@ -13,6 +13,7 @@
 CShellDesktop.cpp
 CShellLink.cpp
 menu.cpp
+PathResolve.cpp
 ShellExecuteEx.cpp
 shelltest.cpp
 SHParseDisplayName.cpp

Added: trunk/rostests/apitests/shell32/PathResolve.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/PathResolve.cpp?rev=74982
==
--- trunk/rostests/apitests/shell32/PathResolve.cpp (added)
+++ trunk/rostests/apitests/shell32/PathResolve.cpp [iso-8859-1] Sat Jun 10 
17:46:11 2017
@@ -0,0 +1,894 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Tests for PathResolve
+ * PROGRAMMER:  Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
+ */
+
+#include "shelltest.h"
+#include 
+
+/*
+ * NOTE: "App Paths" registry key and PATHEXT environment variable
+ *   have no effect for PathResolve.
+ */
+
+/* PathResolve */
+typedef int (WINAPI *PATHRESOLVE)(LPWSTR, LPWSTR *, UINT);
+
+static HINSTANCEs_hShell32 = NULL;
+static PATHRESOLVE  s_pPathResolve = NULL;
+static WCHARs_TestDataPath[MAX_PATH];
+static WCHARs_LinkFilePath[MAX_PATH];
+static WCHARs_LinkTargetPath[MAX_PATH];
+static LPWSTR   s_Dirs[2];
+
+/* PathResolve flags */
+#ifndef PRF_VERIFYEXISTS
+#define PRF_VERIFYEXISTS 0x01
+#define PRF_EXECUTABLE   0x02
+#define PRF_TRYPROGRAMEXTENSIONS (PRF_EXECUTABLE | PRF_VERIFYEXISTS)
+#define PRF_FIRSTDIRDEF  0x04
+#define PRF_DONTFINDLNK  0x08
+#endif
+#ifndef PRF_REQUIREABSOLUTE
+#define PRF_REQUIREABSOLUTE  0x10
+#endif
+
+#define FLAGS0  0
+#define FLAGS1  PRF_VERIFYEXISTS
+#define FLAGS2  PRF_EXECUTABLE
+#define FLAGS3  PRF_TRYPROGRAMEXTENSIONS
+#define FLAGS4  (PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
+#define FLAGS5  (PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
+#define FLAGS6  (PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
+#define FLAGS7  (PRF_REQUIREABSOLUTE | PRF_VERIFYEXISTS)
+#define FLAGS8  (PRF_REQUIREABSOLUTE | PRF_EXECUTABLE)
+#define FLAGS9  (PRF_REQUIREABSOLUTE | PRF_TRYPROGRAMEXTENSIONS)
+#define FLAGS10 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
+#define FLAGS11 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
+#define FLAGS12 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | 
PRF_TRYPROGRAMEXTENSIONS)
+#define FLAGS13 0x
+
+#define EF_FULLPATH 1
+#define EF_TESTDATA 2
+#define EF_WINDOWS_DIR  4
+#define EF_SYSTEM_DIR   8
+#define EF_TYPE_MASK0xF
+
+#define EF_NAME_ONLY16
+#define EF_APP_PATH 32
+
+typedef struct ENTRY
+{
+INT EntryNumber;/* # */
+INT Ret;
+DWORD   Error;
+UINTEF_;
+LPCWSTR NameBefore;
+LPCWSTR NameExpected;
+UINTFlags;
+LPWSTR *Dirs;
+} ENTRY;
+
+#define BEEF0xBEEF  /* Error Code 48879 */
+#define DEAD0xDEAD  /* Error Code 57005 */
+#define IGNORE_ERR  0x7F7F7F7F  /* Ignore Error Code */
+#define RAISED  /* exception raised */
+
+static const ENTRY s_Entries[] =
+{
+/* null path */
+{ 0, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS0 },
+{ 1, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS1 },
+{ 2, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS2 },
+{ 3, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS3 },
+{ 4, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS4 },
+{ 5, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS5 },
+{ 6, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS6 },
+{ 7, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS7 },
+{ 8, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS8 },
+{ 9, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS9 },
+{ 10, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS10 },
+{ 11, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS11 },
+{ 12, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS12 },
+{ 13, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS13 },
+/* empty path */
+{ 14, 1, BEEF, EF_FULLPATH, L"

[ros-diffs] [mjansen] 74976: [CALC] Explicitly link against comctl32. Patch by Carlo Bramini. CORE-10727

2017-06-09 Thread mjansen
Author: mjansen
Date: Fri Jun  9 18:21:54 2017
New Revision: 74976

URL: http://svn.reactos.org/svn/reactos?rev=74976=rev
Log:
[CALC] Explicitly link against comctl32. Patch by Carlo Bramini. CORE-10727

Modified:
trunk/reactos/base/applications/calc/CMakeLists.txt
trunk/reactos/base/applications/calc/winmain.c

Modified: trunk/reactos/base/applications/calc/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/CMakeLists.txt?rev=74976=74975=74976=diff
==
--- trunk/reactos/base/applications/calc/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/calc/CMakeLists.txt [iso-8859-1] Fri Jun  9 
18:21:54 2017
@@ -13,7 +13,7 @@
 add_rc_deps(resource.rc ${calc_rc_deps})
 add_executable(calc ${SOURCE} resource.rc)
 set_module_type(calc win32gui UNICODE)
-add_importlibs(calc advapi32 user32 shell32 gdi32 msvcrt kernel32)
+add_importlibs(calc advapi32 comctl32 user32 shell32 gdi32 msvcrt kernel32)
 
 if(MSVC)
 add_importlibs(calc ntdll)

Modified: trunk/reactos/base/applications/calc/winmain.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/winmain.c?rev=74976=74975=74976=diff
==
--- trunk/reactos/base/applications/calc/winmain.c  [iso-8859-1] (original)
+++ trunk/reactos/base/applications/calc/winmain.c  [iso-8859-1] Fri Jun  9 
18:21:54 2017
@@ -4,6 +4,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define HTMLHELP_PATH(_pt)  TEXT("%systemroot%\\Help\\calc.chm::") TEXT(_pt)
 
@@ -1785,6 +1786,8 @@
 MSG msg;
 DWORD dwLayout;
 
+InitCommonControls();
+
 calc.hInstance = hInstance;
 
 calc.x_coord = -1;




[ros-diffs] [mjansen] 74969: [NTOS:MM] Do not queue debugger events after notifying process exit. CORE-13393 Patch suggested by Thomas.

2017-06-08 Thread mjansen
Author: mjansen
Date: Thu Jun  8 20:34:47 2017
New Revision: 74969

URL: http://svn.reactos.org/svn/reactos?rev=74969=rev
Log:
[NTOS:MM] Do not queue debugger events after notifying process exit. CORE-13393
Patch suggested by Thomas.

Modified:
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/marea.c
trunk/reactos/ntoskrnl/mm/section.c

Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?rev=74969=74968=74969=diff
==
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h  [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h  [iso-8859-1] Thu Jun  8 
20:34:47 2017
@@ -2104,7 +2104,7 @@
 MiRosUnmapViewOfSection(
 IN PEPROCESS Process,
 IN PVOID BaseAddress,
-IN ULONG Flags
+IN BOOLEAN SkipDebuggerNotify
 );
 
 VOID

Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c?rev=74969=74968=74969=diff
==
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c[iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c[iso-8859-1] Thu Jun  8 
20:34:47 2017
@@ -834,7 +834,7 @@
 if ((MemoryArea) && (MemoryArea->Type != MEMORY_AREA_OWNED_BY_ARM3))
 {
 /* Call Mm API */
-return MiRosUnmapViewOfSection(Process, BaseAddress, Flags);
+return MiRosUnmapViewOfSection(Process, BaseAddress, 
Process->ProcessExiting);
 }
 
 /* Check if we should attach to the process */

Modified: trunk/reactos/ntoskrnl/mm/marea.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=74969=74968=74969=diff
==
--- trunk/reactos/ntoskrnl/mm/marea.c   [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/marea.c   [iso-8859-1] Thu Jun  8 20:34:47 2017
@@ -545,7 +545,7 @@
 
 if (MemoryArea->Type == MEMORY_AREA_SECTION_VIEW)
 {
-Status = MiRosUnmapViewOfSection(Process, BaseAddress, 0);
+Status = MiRosUnmapViewOfSection(Process, BaseAddress, 
Process->ProcessExiting);
 }
 else if (MemoryArea->Type == MEMORY_AREA_CACHE)
 {

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=74969=74968=74969=diff
==
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Thu Jun  8 20:34:47 2017
@@ -4142,7 +4142,7 @@
 NTAPI
 MiRosUnmapViewOfSection(IN PEPROCESS Process,
 IN PVOID BaseAddress,
-IN ULONG Flags)
+IN BOOLEAN SkipDebuggerNotify)
 {
 NTSTATUS Status;
 PMEMORY_AREA MemoryArea;
@@ -4230,7 +4230,7 @@
 MmUnlockAddressSpace(AddressSpace);
 
 /* Notify debugger */
-if (ImageBaseAddress) DbgkUnMapViewOfSection(ImageBaseAddress);
+if (ImageBaseAddress && !SkipDebuggerNotify) 
DbgkUnMapViewOfSection(ImageBaseAddress);
 
 return(STATUS_SUCCESS);
 }




[ros-diffs] [mjansen] 74947: [KERNEL32_WINETEST] Kill process that hangs on an unimplemented feature.

2017-06-07 Thread mjansen
Author: mjansen
Date: Wed Jun  7 20:40:42 2017
New Revision: 74947

URL: http://svn.reactos.org/svn/reactos?rev=74947=rev
Log:
[KERNEL32_WINETEST] Kill process that hangs on an unimplemented feature.

Modified:
trunk/rostests/winetests/kernel32/process.c

Modified: trunk/rostests/winetests/kernel32/process.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/process.c?rev=74947=74946=74947=diff
==
--- trunk/rostests/winetests/kernel32/process.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/kernel32/process.c [iso-8859-1] Wed Jun  7 
20:40:42 2017
@@ -2707,6 +2707,13 @@
 
 if (dwret == WAIT_TIMEOUT) /* Win 2000/XP */
 {
+#ifdef __REACTOS__
+if (!ret)
+{
+ok(0, "HACK: Killing process to speed up the test\n");
+TerminateProcess(pi.hProcess, 0);
+}
+#endif
 CloseHandle(pi.hProcess);
 CloseHandle(pi.hThread);
 CloseHandle(job);




[ros-diffs] [mjansen] 74906: [WIN32SS] Prevent accessing an unininitialized pointer when loading an invalid font. CORE-13364

2017-06-04 Thread mjansen
Author: mjansen
Date: Sun Jun  4 14:03:25 2017
New Revision: 74906

URL: http://svn.reactos.org/svn/reactos?rev=74906=rev
Log:
[WIN32SS] Prevent accessing an unininitialized pointer when loading an invalid 
font. CORE-13364

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=74906=74905=74906=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Sun Jun  4 
14:03:25 2017
@@ -814,7 +814,7 @@
 
 IntUnLockFreeType;
 
-if (FT_IS_SFNT(Face))
+if (!Error && FT_IS_SFNT(Face))
 pLoadFont->IsTrueType = TRUE;
 
 if (Error || SharedFace == NULL)




[ros-diffs] [mjansen] 74764: [SHELL32] CMenuDeskBar: Prevent destruction of the start menu when receiving a WM_CLOSE message. CORE-12028

2017-06-03 Thread mjansen
Author: mjansen
Date: Sat Jun  3 15:35:21 2017
New Revision: 74764

URL: http://svn.reactos.org/svn/reactos?rev=74764=rev
Log:
[SHELL32] CMenuDeskBar: Prevent destruction of the start menu when receiving a 
WM_CLOSE message. CORE-12028

Modified:
trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp
trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h

Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp?rev=74764=74763=74764=diff
==
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp  [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp  [iso-8859-1] 
Sat Jun  3 15:35:21 2017
@@ -839,6 +839,12 @@
 return 0;
 }
 
+LRESULT CMenuDeskBar::_OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL 
)
+{
+/* Prevent the CMenuDeskBar from destroying on being sent a WM_CLOSE */
+return 0;
+}
+
 HRESULT CMenuDeskBar::_AdjustForTheme(BOOL bFlatStyle)
 {
 DWORD style = bFlatStyle ? WS_BORDER : WS_CLIPCHILDREN|WS_DLGFRAME;

Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h?rev=74764=74763=74764=diff
==
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h[iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h[iso-8859-1] 
Sat Jun  3 15:35:21 2017
@@ -74,6 +74,7 @@
 MESSAGE_HANDLER(WM_MOUSEACTIVATE, _OnMouseActivate)
 MESSAGE_HANDLER(WM_WININICHANGE , _OnWinIniChange)
 MESSAGE_HANDLER(WM_NCPAINT, _OnNcPaint)
+MESSAGE_HANDLER(WM_CLOSE, _OnClose)
 END_MSG_MAP()
 
 BEGIN_COM_MAP(CMenuDeskBar)
@@ -142,6 +143,7 @@
 LRESULT _OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL 
);
 LRESULT _OnWinIniChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL 
);
 LRESULT _OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL 
);
+LRESULT _OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL );
 
 HRESULT _AdjustForTheme(BOOL bFlatStyle);
 BOOL _IsSubMenuParent(HWND hwnd);




[ros-diffs] [mjansen] 74760: [KERNEL32] Fix IsShimInfrastructureDisabled. CORE-13352

2017-06-03 Thread mjansen
Author: mjansen
Date: Sat Jun  3 13:06:32 2017
New Revision: 74760

URL: http://svn.reactos.org/svn/reactos?rev=74760=rev
Log:
[KERNEL32] Fix IsShimInfrastructureDisabled. CORE-13352

Modified:
trunk/reactos/dll/win32/kernel32/client/appcache.c

Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/appcache.c?rev=74760=74759=74760=diff
==
--- trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] Sat Jun  3 
13:06:32 2017
@@ -15,7 +15,7 @@
 
 /* GLOBALS 
/
 
-ULONG g_ShimsEnabled = -1;
+ULONG g_ShimsDisabled = -1;
 static BOOL g_ApphelpInitialized = FALSE;
 static PVOID g_pApphelpCheckRunAppEx;
 static PVOID g_pSdbPackAppCompatData;
@@ -54,8 +54,10 @@
  * This is a TROOLEAN, -1 means we haven't yet figured it out.
  * 0 means shims are enabled, and 1 means shims are disabled!
  */
-if (g_ShimsEnabled == -1)
-{
+if (g_ShimsDisabled == -1)
+{
+ULONG DisableShims = FALSE;
+
 /* Open the safe mode key */
 Status = NtOpenKey(, KEY_QUERY_VALUE, );
 if (NT_SUCCESS(Status))
@@ -74,66 +76,63 @@
  (KeyInfo.Data[0] == TRUE))
 {
 /* It is, so disable shims! */
-g_ShimsEnabled = TRUE;
+DisableShims = TRUE;
 }
-else
+}
+
+if (!DisableShims)
+{
+/* Open the app compatibility engine settings key */
+Status = NtOpenKey(, KEY_QUERY_VALUE, 
);
+if (NT_SUCCESS(Status))
 {
-/* Open the app compatibility engine settings key */
-Status = NtOpenKey(, KEY_QUERY_VALUE, 
);
-if (NT_SUCCESS(Status))
+/* Check if the app compat engine is turned off */
+Status = NtQueryValueKey(KeyHandle,
+ ,
+ KeyValuePartialInformation,
+ ,
+ sizeof(KeyInfo),
+ );
+NtClose(KeyHandle);
+if ((NT_SUCCESS(Status)) &&
+(KeyInfo.Type == REG_DWORD) &&
+(KeyInfo.DataLength == sizeof(ULONG)) &&
+(KeyInfo.Data[0] == TRUE))
 {
-/* Check if the app compat engine is turned off */
-Status = NtQueryValueKey(KeyHandle,
- ,
- KeyValuePartialInformation,
- ,
- sizeof(KeyInfo),
- );
-NtClose(KeyHandle);
-if ((NT_SUCCESS(Status)) &&
-(KeyInfo.Type == REG_DWORD) &&
-(KeyInfo.DataLength == sizeof(ULONG)) &&
-(KeyInfo.Data[0] == TRUE))
-{
-/* It is, so disable shims! */
-g_ShimsEnabled = TRUE;
-}
-else
-{
-/* Finally, open the app compatibility policy key */
-Status = NtOpenKey(, KEY_QUERY_VALUE, 
);
-if (NT_SUCCESS(Status))
-{
-/* Check if the system policy disables app compat 
*/
-Status = NtQueryValueKey(KeyHandle,
- ,
- 
KeyValuePartialInformation,
- ,
- sizeof(KeyInfo),
- );
-NtClose(KeyHandle);
-if ((NT_SUCCESS(Status)) &&
-(KeyInfo.Type == REG_DWORD) &&
-(KeyInfo.DataLength == sizeof(ULONG)) &&
-(KeyInfo.Data[0] == TRUE))
-{
-/* It does, so disable shims! */
-g_ShimsEnabled = TRUE;
-}
-else
-{
-/* No keys are set, so 

[ros-diffs] [mjansen] 74702: [KERNEL32] Do not use TEB->StaticUnicodeString in CreateProcessInternalA. CORE-10368

2017-05-30 Thread mjansen
Author: mjansen
Date: Tue May 30 20:57:45 2017
New Revision: 74702

URL: http://svn.reactos.org/svn/reactos?rev=74702=rev
Log:
[KERNEL32] Do not use TEB->StaticUnicodeString in CreateProcessInternalA. 
CORE-10368

Modified:
trunk/reactos/dll/win32/kernel32/client/proc.c

Modified: trunk/reactos/dll/win32/kernel32/client/proc.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/proc.c?rev=74702=74701=74702=diff
==
--- trunk/reactos/dll/win32/kernel32/client/proc.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/proc.c  [iso-8859-1] Tue May 30 
20:57:45 2017
@@ -4660,9 +4660,7 @@
LPPROCESS_INFORMATION lpProcessInformation,
PHANDLE hNewToken)
 {
-PUNICODE_STRING CommandLine = NULL;
-UNICODE_STRING DummyString;
-UNICODE_STRING LiveCommandLine;
+UNICODE_STRING CommandLine;
 UNICODE_STRING ApplicationName;
 UNICODE_STRING CurrentDirectory;
 BOOL bRetVal;
@@ -4677,8 +4675,7 @@
 RtlMoveMemory(, lpStartupInfo, sizeof(*lpStartupInfo));
 
 /* Initialize all strings to nothing */
-LiveCommandLine.Buffer = NULL;
-DummyString.Buffer = NULL;
+CommandLine.Buffer = NULL;
 ApplicationName.Buffer = NULL;
 CurrentDirectory.Buffer = NULL;
 StartupInfo.lpDesktop = NULL;
@@ -4688,24 +4685,8 @@
 /* Convert the Command line */
 if (lpCommandLine)
 {
-/* If it's too long, then we'll have a problem */
-if ((strlen(lpCommandLine) + 1) * sizeof(WCHAR) <
-NtCurrentTeb()->StaticUnicodeString.MaximumLength)
-{
-/* Cache it in the TEB */
-CommandLine = Basep8BitStringToStaticUnicodeString(lpCommandLine);
-}
-else
-{
-/* Use a dynamic version */
-Basep8BitStringToDynamicUnicodeString(,
-  lpCommandLine);
-}
-}
-else
-{
-/* The logic below will use CommandLine, so we must make it valid */
-CommandLine = 
+Basep8BitStringToDynamicUnicodeString(,
+  lpCommandLine);
 }
 
 /* Convert the Name and Directory */
@@ -4740,8 +4721,7 @@
 /* Call the Unicode function */
 bRetVal = CreateProcessInternalW(hToken,
  ApplicationName.Buffer,
- LiveCommandLine.Buffer ?
- LiveCommandLine.Buffer : 
CommandLine->Buffer,
+ CommandLine.Buffer,
  lpProcessAttributes,
  lpThreadAttributes,
  bInheritHandles,
@@ -4754,7 +4734,7 @@
 
 /* Clean up */
 RtlFreeUnicodeString();
-RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 RtlFreeUnicodeString();
 RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpDesktop);
 RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpReserved);




[ros-diffs] [mjansen] 74701: [KERNEL32_APITEST] Add test to show that we should not spoil TEB->StaticUnicodeString in CreateProcessA. CORE-10368

2017-05-30 Thread mjansen
Author: mjansen
Date: Tue May 30 20:55:15 2017
New Revision: 74701

URL: http://svn.reactos.org/svn/reactos?rev=74701=rev
Log:
[KERNEL32_APITEST] Add test to show that we should not spoil 
TEB->StaticUnicodeString in CreateProcessA. CORE-10368

Added:
trunk/rostests/apitests/kernel32/CreateProcess.c   (with props)
Modified:
trunk/rostests/apitests/kernel32/CMakeLists.txt
trunk/rostests/apitests/kernel32/testlist.c

Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLists.txt?rev=74701=74700=74701=diff
==
--- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Tue May 30 
20:55:15 2017
@@ -3,6 +3,7 @@
 
 list(APPEND SOURCE
 Console.c
+CreateProcess.c
 DefaultActCtx.c
 DeviceIoControl.c
 dosdev.c

Added: trunk/rostests/apitests/kernel32/CreateProcess.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CreateProcess.c?rev=74701
==
--- trunk/rostests/apitests/kernel32/CreateProcess.c(added)
+++ trunk/rostests/apitests/kernel32/CreateProcess.c[iso-8859-1] Tue May 30 
20:55:15 2017
@@ -0,0 +1,34 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test spoiling of StaticUnicodeString by CreateProcessA
+ * PROGRAMMERS: Mark Jansen
+ */
+
+#include 
+#include 
+#include 
+
+
+START_TEST(CreateProcess)
+{
+PUNICODE_STRING StaticString;
+UNICODE_STRING CompareString;
+BOOL Process;
+STARTUPINFO si = {0};
+PROCESS_INFORMATION pi = {0};
+LONG Result;
+
+StaticString = ()->StaticUnicodeString;
+RtlInitUnicodeString(, L"--sentinel--");
+RtlCopyUnicodeString(StaticString, );
+
+si.cb = sizeof(si);
+Process = CreateProcessA("ApplicationName", "CommandLine", NULL, NULL, 
FALSE, 0, NULL, "CurrentDir", , );
+ok_int(Process, 0);
+
+Result = RtlCompareUnicodeString(StaticString, , TRUE);
+ok(!Result, "Expected %s to equal %s\n",
+   wine_dbgstr_wn(StaticString->Buffer, StaticString->Length / 
sizeof(WCHAR)),
+   wine_dbgstr_wn(CompareString.Buffer, CompareString.Length / 
sizeof(WCHAR)));
+}

Propchange: trunk/rostests/apitests/kernel32/CreateProcess.c
--
svn:eol-style = native

Modified: trunk/rostests/apitests/kernel32/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlist.c?rev=74701=74700=74701=diff
==
--- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Tue May 30 
20:55:15 2017
@@ -4,6 +4,7 @@
 #include 
 
 extern void func_Console(void);
+extern void func_CreateProcess(void);
 extern void func_DefaultActCtx(void);
 extern void func_DeviceIoControl(void);
 extern void func_dosdev(void);
@@ -30,6 +31,7 @@
 const struct test winetest_testlist[] =
 {
 { "ConsoleCP",   func_Console },
+{ "CreateProcess",   func_CreateProcess },
 { "DefaultActCtx",   func_DefaultActCtx },
 { "DeviceIoControl", func_DeviceIoControl },
 { "dosdev",  func_dosdev },




[ros-diffs] [mjansen] 74697: [KERNEL32] Actually disable the shim engine while it is not ready yet.... CORE-10368

2017-05-29 Thread mjansen
Author: mjansen
Date: Mon May 29 21:14:15 2017
New Revision: 74697

URL: http://svn.reactos.org/svn/reactos?rev=74697=rev
Log:
[KERNEL32] Actually disable the shim engine while it is not ready yet 
CORE-10368

Modified:
trunk/reactos/dll/win32/kernel32/client/appcache.c

Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/appcache.c?rev=74697=74696=74697=diff
==
--- trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] Mon May 29 
21:14:15 2017
@@ -15,7 +15,7 @@
 
 /* GLOBALS 
/
 
-ULONG g_ShimsEnabled;
+ULONG g_ShimsEnabled = -1;
 static BOOL g_ApphelpInitialized = FALSE;
 static PVOID g_pApphelpCheckRunAppEx;
 static PVOID g_pSdbPackAppCompatData;




[ros-diffs] [mjansen] 74693: [KERNEL32] Initial implementation for BaseCheckRunApp, calling into apphelp to check for compatibility fixes CORE-10368

2017-05-28 Thread mjansen
Author: mjansen
Date: Sun May 28 19:27:51 2017
New Revision: 74693

URL: http://svn.reactos.org/svn/reactos?rev=74693=rev
Log:
[KERNEL32] Initial implementation for BaseCheckRunApp, calling into apphelp to 
check for compatibility fixes CORE-10368

Modified:
trunk/reactos/dll/win32/kernel32/client/appcache.c
trunk/reactos/dll/win32/kernel32/client/utils.c

Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/appcache.c?rev=74693=74692=74693=diff
==
--- trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/appcache.c  [iso-8859-1] Sun May 28 
19:27:51 2017
@@ -16,7 +16,20 @@
 /* GLOBALS 
/
 
 ULONG g_ShimsEnabled;
- 
+static BOOL g_ApphelpInitialized = FALSE;
+static PVOID g_pApphelpCheckRunAppEx;
+static PVOID g_pSdbPackAppCompatData;
+
+typedef BOOL (WINAPI *tApphelpCheckRunAppEx)(HANDLE FileHandle, PVOID Unk1, 
PVOID Unk2, PWCHAR ApplicationName, PVOID Environment, USHORT ExeType, PULONG 
Reason,
+ PVOID* SdbQueryAppCompatData, 
PULONG SdbQueryAppCompatDataSize, PVOID* SxsData, PULONG SxsDataSize,
+ PULONG FusionFlags, PULONG64 
SomeFlag1, PULONG SomeFlag2);
+typedef BOOL (WINAPI *tSdbPackAppCompatData)(PVOID hsdb, PVOID pQueryResult, 
PVOID* ppData, DWORD *dwSize);
+
+#define APPHELP_VALID_RESULT0x1
+#define APPHELP_RESULT_NOTFOUND 0x2
+#define APPHELP_RESULT_FOUND0x4
+
+
 /* FUNCTIONS 
**/
 
 BOOLEAN
@@ -136,7 +149,120 @@
 DPRINT("BaseCheckAppcompatCache is UNIMPLEMENTED\n");
 
 if (Reason) *Reason = 0;
-return TRUE;
+
+// We don't know this app.
+return FALSE;
+}
+
+static
+VOID
+BaseInitApphelp(VOID)
+{
+WCHAR Buffer[MAX_PATH*2];
+UNICODE_STRING DllPath = {0};
+PVOID ApphelpAddress;
+PVOID pApphelpCheckRunAppEx = NULL, pSdbPackAppCompatData = NULL;
+
+RtlInitEmptyUnicodeString(, Buffer, sizeof(Buffer));
+RtlCopyUnicodeString(, );
+RtlAppendUnicodeToString(, L"\\system32\\apphelp.dll");
+
+if (NT_SUCCESS(LdrLoadDll(NULL, NULL, , )))
+{
+ANSI_STRING ProcName;
+
+RtlInitAnsiString(, "ApphelpCheckRunAppEx");
+if (!NT_SUCCESS(LdrGetProcedureAddress(ApphelpAddress, , 0, 
)))
+pApphelpCheckRunAppEx = NULL;
+
+RtlInitAnsiString(, "SdbPackAppCompatData");
+if (!NT_SUCCESS(LdrGetProcedureAddress(ApphelpAddress, , 0, 
)))
+pSdbPackAppCompatData = NULL;
+}
+
+if (InterlockedCompareExchangePointer(_pApphelpCheckRunAppEx, 
RtlEncodeSystemPointer(pApphelpCheckRunAppEx), NULL) == NULL)
+{
+g_pSdbPackAppCompatData = 
RtlEncodeSystemPointer(pSdbPackAppCompatData);
+}
+}
+
+/*
+ *
+ */
+BOOL
+WINAPI
+BaseCheckRunApp(IN HANDLE FileHandle,
+ IN PWCHAR ApplicationName,
+ IN PWCHAR Environment,
+ IN USHORT ExeType,
+ IN PULONG pReason,
+ IN PVOID* SdbQueryAppCompatData,
+ IN PULONG SdbQueryAppCompatDataSize,
+ IN PVOID* SxsData,
+ IN PULONG SxsDataSize,
+ OUT PULONG FusionFlags)
+{
+ULONG Reason = 0;
+ULONG64 Flags1 = 0;
+ULONG Flags2 = 0;
+BOOL Continue, NeedCleanup = FALSE;
+tApphelpCheckRunAppEx pApphelpCheckRunAppEx;
+tSdbPackAppCompatData pSdbPackAppCompatData;
+PVOID QueryResult = NULL;
+ULONG QueryResultSize = 0;
+
+if (!g_ApphelpInitialized)
+{
+BaseInitApphelp();
+g_ApphelpInitialized = TRUE;
+}
+
+pApphelpCheckRunAppEx = RtlDecodeSystemPointer(g_pApphelpCheckRunAppEx);
+pSdbPackAppCompatData = RtlDecodeSystemPointer(g_pSdbPackAppCompatData);
+
+if (!pApphelpCheckRunAppEx || !pSdbPackAppCompatData)
+return TRUE;
+
+if (pReason)
+Reason = *pReason;
+
+Continue = pApphelpCheckRunAppEx(FileHandle, NULL, NULL, ApplicationName, 
Environment, ExeType, ,
+, , SxsData, SxsDataSize, FusionFlags, 
, );
+
+if (pReason)
+*pReason = Reason;
+
+if (Continue)
+{
+if ((Reason & (APPHELP_VALID_RESULT|APPHELP_RESULT_FOUND)) == 
(APPHELP_VALID_RESULT|APPHELP_RESULT_FOUND))
+{
+if (!pSdbPackAppCompatData(NULL, QueryResult, 
SdbQueryAppCompatData, SdbQueryAppCompatDataSize))
+{
+DPRINT1("SdbPackAppCompatData returned a failure!\n");
+NeedCleanup = TRUE;
+}
+}
+else
+{
+NeedCleanup = TRUE;
+}
+}
+
+if (QueryResult)
+RtlFreeHeap(RtlGet

[ros-diffs] [mjansen] 74691: [USER32_APITEST] Add more tests to validate messages sent during window creation / modifying of styles. CORE-12052

2017-05-28 Thread mjansen
Author: mjansen
Date: Sun May 28 17:40:48 2017
New Revision: 74691

URL: http://svn.reactos.org/svn/reactos?rev=74691=rev
Log:
[USER32_APITEST] Add more tests to validate messages sent during window 
creation / modifying of styles. CORE-12052

Modified:
trunk/rostests/apitests/user32/CreateWindowEx.c

Modified: trunk/rostests/apitests/user32/CreateWindowEx.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateWindowEx.c?rev=74691=74690=74691=diff
==
--- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] Sun May 28 
17:40:48 2017
@@ -69,13 +69,20 @@
 }
 
 HWND g_TestWindow = NULL;
+HWND g_ChildWindow = NULL;
 
 static int get_iwnd(HWND hWnd)
 {
 if (!g_TestWindow)
 g_TestWindow = hWnd;
-
-return hWnd == g_TestWindow ? 1 : 0;
+if (!g_ChildWindow && hWnd != g_TestWindow)
+g_ChildWindow = hWnd;
+
+if (hWnd == g_TestWindow)
+return 1;
+else if (hWnd == g_ChildWindow)
+return 2;
+return 0;
 }
 
 DWORD g_FaultLine = 0;
@@ -83,6 +90,11 @@
 DWORD g_NcExpectExStyle = 0;
 DWORD g_ExpectStyle = 0;
 DWORD g_ExpectExStyle = 0;
+
+DWORD g_ChildNcExpectStyle = 0;
+DWORD g_ChildNcExpectExStyle = 0;
+DWORD g_ChildExpectStyle = 0;
+DWORD g_ChildExpectExStyle = 0;
 
 #define ok_hex_(expression, result) \
 do { \
@@ -265,6 +277,8 @@
 
 RegisterSimpleClass(MSGTestProc, L"Test_Message_Window_XX");
 
+g_ChangeStyle = 0;
+
 g_ExpectStyle = g_NcExpectStyle = 0;
 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
 g_FaultLine = __LINE__ + 1;
@@ -274,7 +288,7 @@
 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
 COMPARE_CACHE(create_chain);
 DestroyWindow(hWnd);
-g_TestWindow = NULL;
+g_TestWindow = g_ChildWindow = NULL;
 EMPTY_CACHE();
 
 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
@@ -286,7 +300,7 @@
 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
 COMPARE_CACHE(create_chain);
 DestroyWindow(hWnd);
-g_TestWindow = NULL;
+g_TestWindow = g_ChildWindow = NULL;
 EMPTY_CACHE();
 
 g_ChangeStyle = 1;
@@ -300,7 +314,7 @@
 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
 COMPARE_CACHE(Below8NonServer ? create_chain_modify_below8_nonsrv : 
create_chain_modify);
 DestroyWindow(hWnd);
-g_TestWindow = NULL;
+g_TestWindow = g_ChildWindow = NULL;
 EMPTY_CACHE();
 
 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
@@ -312,8 +326,326 @@
 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", 
g_TestWindow, hWnd);
 COMPARE_CACHE(Below8NonServer ? create_chain_modify_below8_nonsrv : 
create_chain_modify);
 DestroyWindow(hWnd);
-g_TestWindow = NULL;
-EMPTY_CACHE();
+g_TestWindow = g_ChildWindow = NULL;
+EMPTY_CACHE();
+
+UnregisterClassW(L"Test_Message_Window_XX", NULL);
+}
+
+
+static LRESULT CALLBACK MSGChildProc2(HWND hWnd, UINT message, WPARAM wParam, 
LPARAM lParam)
+{
+LRESULT lRet;
+int iwnd = get_iwnd(hWnd);
+
+if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+return DefWindowProc(hWnd, message, wParam, lParam);
+
+switch(message)
+{
+case WM_IME_SETCONTEXT:
+case WM_IME_NOTIFY:
+case WM_GETICON:
+case WM_GETTEXT:
+return DefWindowProc(hWnd, message, wParam, lParam);
+break;
+case WM_NCCREATE:
+{
+LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+ok_hex_(create->style, g_ChildNcExpectStyle);
+ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle);
+
+if (g_ChangeStyle)
+{
+DWORD dwStyle = GetWindowLong(g_TestWindow, GWL_EXSTYLE);
+dwStyle &= ~(WS_EX_CLIENTEDGE);
+SetWindowLong(g_TestWindow, GWL_EXSTYLE, dwStyle);
+RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
+SetWindowPos(g_TestWindow, NULL, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | 
SWP_NOACTIVATE | SWP_DRAWFRAME);
+
+RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
+ok_hex_(create->style, g_ChildNcExpectStyle);
+ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle);
+}
+}
+break;
+case WM_CREATE:
+{
+LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+ok_hex_(create->style, g_ChildExpectStyle);
+ok_hex_(create->dwExStyle, g_ChildExpectExStyle);
+}
+break;
+case WM_NCCALCSIZE:
+case WM_STYLECHANGING:
+case WM_STYLECHANGED:
+cas

[ros-diffs] [mjansen] 74689: [USER32_APITEST] Add tests to validate messages sent during window creation / modifying of styles. CORE-12052

2017-05-28 Thread mjansen
Author: mjansen
Date: Sun May 28 13:55:05 2017
New Revision: 74689

URL: http://svn.reactos.org/svn/reactos?rev=74689=rev
Log:
[USER32_APITEST] Add tests to validate messages sent during window creation / 
modifying of styles. CORE-12052

Modified:
trunk/rostests/apitests/include/msgtrace.c
trunk/rostests/apitests/include/msgtrace.h
trunk/rostests/apitests/user32/CreateWindowEx.c

Modified: trunk/rostests/apitests/include/msgtrace.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/include/msgtrace.c?rev=74689=74688=74689=diff
==
--- trunk/rostests/apitests/include/msgtrace.c  [iso-8859-1] (original)
+++ trunk/rostests/apitests/include/msgtrace.c  [iso-8859-1] Sun May 28 
13:55:05 2017
@@ -62,6 +62,8 @@
 case WM_COMMAND: return "WM_COMMAND";
 case WM_PRINTCLIENT: return "WM_PRINTCLIENT";
 case WM_CTLCOLORSTATIC: return "WM_CTLCOLORSTATIC";
+case WM_STYLECHANGING: return "WM_STYLECHANGING";
+case WM_STYLECHANGED: return "WM_STYLECHANGED";
 default: return NULL;
 }
 }
@@ -97,12 +99,14 @@
 switch (msg->type)
 {
 case POST:
+case MARKER:
 msgName = get_msg_name(msg->msg);
-msgType = "post msg";
+msgType = msg->type == POST ? "post msg" : "marker";
 break;
 case SENT:
+case SENT_RET:
 msgName = get_msg_name(msg->msg);
-msgType = "sent msg";
+msgType = msg->type == SENT ? "sent msg" : "sent_ret msg";
 break;
 case HOOK:
 msgName = get_hook_name(msg->msg);

Modified: trunk/rostests/apitests/include/msgtrace.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/include/msgtrace.h?rev=74689=74688=74689=diff
==
--- trunk/rostests/apitests/include/msgtrace.h  [iso-8859-1] (original)
+++ trunk/rostests/apitests/include/msgtrace.h  [iso-8859-1] Sun May 28 
13:55:05 2017
@@ -6,7 +6,9 @@
 SENT,
 POST,
 HOOK,
-EVENT
+EVENT,
+SENT_RET,
+MARKER
 } MSG_TYPE;
 
 typedef struct _MSG_ENTRY

Modified: trunk/rostests/apitests/user32/CreateWindowEx.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateWindowEx.c?rev=74689=74688=74689=diff
==
--- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] Sun May 28 
13:55:05 2017
@@ -3,13 +3,15 @@
  * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
  * PURPOSE: Test for CreateWindowEx
  * PROGRAMMERS: Thomas Faber <thomas.fa...@reactos.org>
+ *  Mark Jansen
  */
 
 #include 
 #include 
-
-
-START_TEST(CreateWindowEx)
+#include 
+#include 
+
+static void Test_Params(void)
 {
 HWND hWnd;
 DWORD dwError;
@@ -65,3 +67,258 @@
 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
 ok(dwError == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", dwError);
 }
+
+HWND g_TestWindow = NULL;
+
+static int get_iwnd(HWND hWnd)
+{
+if (!g_TestWindow)
+g_TestWindow = hWnd;
+
+return hWnd == g_TestWindow ? 1 : 0;
+}
+
+DWORD g_FaultLine = 0;
+DWORD g_NcExpectStyle = 0;
+DWORD g_NcExpectExStyle = 0;
+DWORD g_ExpectStyle = 0;
+DWORD g_ExpectExStyle = 0;
+
+#define ok_hex_(expression, result) \
+do { \
+int _value = (expression); \
+ok_(__FILE__, g_FaultLine)(_value == (result), "Wrong value for '%s', 
expected: " #result " (0x%x), got: 0x%x\n", \
+   #expression, (int)(result), _value); \
+} while (0)
+
+
+
+static int g_ChangeStyle = 0;
+static LRESULT CALLBACK MSGTestProc(HWND hWnd, UINT message, WPARAM wParam, 
LPARAM lParam)
+{
+LRESULT lRet;
+int iwnd = get_iwnd(hWnd);
+
+if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+return DefWindowProc(hWnd, message, wParam, lParam);
+
+switch(message)
+{
+case WM_IME_SETCONTEXT:
+case WM_IME_NOTIFY:
+case WM_GETICON:
+case WM_GETTEXT:
+return DefWindowProc(hWnd, message, wParam, lParam);
+break;
+case WM_NCCREATE:
+{
+LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
+RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
+ok_hex_(create->style, g_NcExpectStyle);
+ok_hex_(create->dwExStyle, g_NcExpectExStyle);
+if (g_ChangeStyle)
+{
+DWORD dwStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
+dwStyle &= ~(WS_EX_CLIENTEDGE);
+SetWindowLong(hWnd, GWL_EXSTYLE, dwStyle);
+RECORD

[ros-diffs] [mjansen] 74679: [SYSSETUP][UNATTENDED] Allow changing the resolution automatically. CORE-13315

2017-05-27 Thread mjansen
Author: mjansen
Date: Sat May 27 09:37:16 2017
New Revision: 74679

URL: http://svn.reactos.org/svn/reactos?rev=74679=rev
Log:
[SYSSETUP][UNATTENDED] Allow changing the resolution automatically. CORE-13315

Modified:
trunk/reactos/boot/bootdata/bootcd/unattend.inf
trunk/reactos/dll/win32/syssetup/wizard.c

Modified: trunk/reactos/boot/bootdata/bootcd/unattend.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/bootcd/unattend.inf?rev=74679=74678=74679=diff
==
--- trunk/reactos/boot/bootdata/bootcd/unattend.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/bootcd/unattend.inf [iso-8859-1] Sat May 27 
09:37:16 2017
@@ -56,3 +56,11 @@
 ; [GuiRunOnce]
 ; %SystemRoot%\system32\cmd.exe
 
+
+; enable this section to change resolution / bpp
+; setting a value to 0 or skipping it will leave it unchanged
+; [Display]
+; BitsPerPel = 32
+; XResolution = 1440
+; YResolution = 900
+; VRefresh = 0

Modified: trunk/reactos/dll/win32/syssetup/wizard.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.c?rev=74679=74678=74679=diff
==
--- trunk/reactos/dll/win32/syssetup/wizard.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/wizard.c   [iso-8859-1] Sat May 27 
09:37:16 2017
@@ -2211,6 +2211,70 @@
 }
 while (SetupFindNextLine(, ));
 
+if (SetupFindFirstLineW(pSetupData->hUnattendedInf,
+L"Display",
+NULL,
+))
+{
+DEVMODEW dm = { { 0 } };
+dm.dmSize = sizeof(dm);
+if (EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ))
+{
+do
+{
+int iValue;
+if (!SetupGetStringFieldW(,
+  0,
+  szName,
+  sizeof(szName) / sizeof(WCHAR),
+  ))
+{
+DPRINT1("Error: SetupGetStringField failed with %d\n", 
GetLastError());
+return;
+}
+
+if (!SetupGetStringFieldW(,
+  1,
+  szValue,
+  sizeof(szValue) / sizeof(WCHAR),
+  ))
+{
+DPRINT1("Error: SetupGetStringField failed with %d\n", 
GetLastError());
+return;
+}
+iValue = _wtoi(szValue);
+DPRINT1("Name %S Value %i\n", szName, iValue);
+
+if (!iValue)
+continue;
+
+if (!wcscmp(szName, L"BitsPerPel"))
+{
+dm.dmFields |= DM_BITSPERPEL;
+dm.dmBitsPerPel = iValue;
+}
+else if (!wcscmp(szName, L"XResolution"))
+{
+dm.dmFields |= DM_PELSWIDTH;
+dm.dmPelsWidth = iValue;
+}
+else if (!wcscmp(szName, L"YResolution"))
+{
+dm.dmFields |= DM_PELSHEIGHT;
+dm.dmPelsHeight = iValue;
+}
+else if (!wcscmp(szName, L"VRefresh"))
+{
+dm.dmFields |= DM_DISPLAYFREQUENCY;
+dm.dmDisplayFrequency = iValue;
+}
+}
+while (SetupFindNextLine(, ));
+
+ChangeDisplaySettingsW(, CDS_UPDATEREGISTRY);
+}
+}
+
 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
   L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
   0,




[ros-diffs] [mjansen] 74612: [WIN32SS] Improve IntGetFontLocalizedName by less strict matching on language id's. Patch by Katayama Hirofumi MZ. CORE-13239 #comment Thanks!

2017-05-21 Thread mjansen
Author: mjansen
Date: Sun May 21 12:24:57 2017
New Revision: 74612

URL: http://svn.reactos.org/svn/reactos?rev=74612=rev
Log:
[WIN32SS] Improve IntGetFontLocalizedName by less strict matching on language 
id's. Patch by Katayama Hirofumi MZ. CORE-13239 #comment Thanks!

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=74612=74611=74612=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Sun May 21 
12:24:57 2017
@@ -1783,7 +1783,7 @@
 char *Cp;
 UNICODE_STRING FamilyNameW, FaceNameW, StyleNameW, FullNameW;
 PSHARED_FACE SharedFace = FontGDI->SharedFace;
-PSHARED_FACE_CACHE Cache = (gusLanguageID == gusEnglishUS) ? 
>EnglishUS : >UserLanguage;
+PSHARED_FACE_CACHE Cache = (PRIMARYLANGID(gusLanguageID) == LANG_ENGLISH) 
? >EnglishUS : >UserLanguage;
 FT_Face Face = SharedFace->Face;
 
 if (Cache->OutlineRequiredSize && Size < Cache->OutlineRequiredSize)
@@ -2096,42 +2096,58 @@
 FT_UShort NameID, FT_UShort LangID)
 {
 FT_SfntName Name;
-INT i, Count;
+INT i, Count, BestIndex, Score, BestScore;
 WCHAR Buf[LF_FULLFACESIZE];
 FT_Error Error;
 NTSTATUS Status = STATUS_NOT_FOUND;
 ANSI_STRING AnsiName;
-PSHARED_FACE_CACHE Cache = (LangID == gusEnglishUS) ? 
>EnglishUS : >UserLanguage;
+PSHARED_FACE_CACHE Cache;
 FT_Face Face = SharedFace->Face;
 
 RtlFreeUnicodeString(pNameW);
 
+/* select cache */
+if (PRIMARYLANGID(LangID) == LANG_ENGLISH)
+{
+Cache = >EnglishUS;
+}
+else
+{
+Cache = >UserLanguage;
+}
+
+/* use cache if available */
 if (NameID == TT_NAME_ID_FONT_FAMILY && Cache->FontFamily.Buffer)
 {
 return DuplicateUnicodeString(>FontFamily, pNameW);
 }
-
 if (NameID == TT_NAME_ID_FULL_NAME && Cache->FullName.Buffer)
 {
 return DuplicateUnicodeString(>FullName, pNameW);
 }
+
+BestIndex = -1;
+BestScore = 0;
 
 Count = FT_Get_Sfnt_Name_Count(Face);
 for (i = 0; i < Count; ++i)
 {
 Error = FT_Get_Sfnt_Name(Face, i, );
 if (Error)
-continue;
+{
+continue;   /* failure */
+}
+
+if (Name.name_id != NameID)
+{
+continue;   /* mismatched */
+}
 
 if (Name.platform_id != TT_PLATFORM_MICROSOFT ||
-Name.encoding_id != TT_MS_ID_UNICODE_CS)
+(Name.encoding_id != TT_MS_ID_UNICODE_CS &&
+ Name.encoding_id != TT_MS_ID_SYMBOL_CS))
 {
 continue;   /* not Microsoft Unicode name */
-}
-
-if (Name.name_id != NameID || Name.language_id != LangID)
-{
-continue;   /* mismatched */
 }
 
 if (Name.string == NULL || Name.string_len == 0 ||
@@ -2145,26 +2161,53 @@
 continue;   /* name too long */
 }
 
-/* NOTE: Name.string is not null-terminated */
-RtlCopyMemory(Buf, Name.string, Name.string_len);
-Buf[Name.string_len / sizeof(WCHAR)] = UNICODE_NULL;
-
-/* Convert UTF-16 big endian to little endian */
-SwapEndian(Buf, Name.string_len);
-
-RtlCreateUnicodeString(pNameW, Buf);
-Status = STATUS_SUCCESS;
-break;
-}
-
-if (Status == STATUS_NOT_FOUND)
-{
-if (LangID != gusEnglishUS)
-{
-/* Retry with English US */
-Status = IntGetFontLocalizedName(pNameW, SharedFace, NameID, 
gusEnglishUS);
-}
-else if (NameID == TT_NAME_ID_FONT_SUBFAMILY)
+if (Name.language_id == LangID)
+{
+Score = 30;
+BestIndex = i;
+break;  /* best match */
+}
+else if (PRIMARYLANGID(Name.language_id) == PRIMARYLANGID(LangID))
+{
+Score = 20;
+}
+else if (PRIMARYLANGID(Name.language_id) == LANG_ENGLISH)
+{
+Score = 10;
+}
+else
+{
+Score = 0;
+}
+
+if (Score > BestScore)
+{
+BestScore = Score;
+BestIndex = i;
+}
+}
+
+if (BestIndex >= 0)
+{
+/* store the best name */
+Error = (Score == 30) ? 0 : FT_Get_Sfnt_Name(Face, BestIndex, );
+if (!Error)
+{
+/* NOTE: Name.string is not null-terminated */
+RtlCopyMemory(Buf, Name.string, Name.string_len);
+Buf[Name.string_len / sizeof(WCHAR)] = UNICODE_NULL;
+
+/* Convert UTF-16 big endian to little endian */
+SwapEndian(Buf, Name.string_len);
+
+   

[ros-diffs] [mjansen] 74611: [KERNEL32] Format the stack trace generated on an unhandled exception so that log2lines can parse it. CORE-13232 #resolve

2017-05-21 Thread mjansen
Author: mjansen
Date: Sun May 21 11:31:56 2017
New Revision: 74611

URL: http://svn.reactos.org/svn/reactos?rev=74611=rev
Log:
[KERNEL32] Format the stack trace generated on an unhandled exception so that 
log2lines can parse it. CORE-13232 #resolve

Modified:
trunk/reactos/dll/win32/kernel32/client/except.c

Modified: trunk/reactos/dll/win32/kernel32/client/except.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/except.c?rev=74611=74610=74611=diff
==
--- trunk/reactos/dll/win32/kernel32/client/except.c[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/except.c[iso-8859-1] Sun May 21 
11:31:56 2017
@@ -23,17 +23,30 @@
  */
 static const char*
 _module_name_from_addr(const void* addr, void **module_start_addr,
-   char* psz, size_t nChars)
+   char* psz, size_t nChars, char** module_name)
 {
 MEMORY_BASIC_INFORMATION mbi;
 if (VirtualQuery(addr, , sizeof(mbi)) != sizeof(mbi) ||
 !GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars))
 {
 psz[0] = '\0';
+*module_name = psz;
 *module_start_addr = 0;
 }
 else
 {
+char* s1 = strrchr(psz, '\\'), *s2 = strrchr(psz, '/');
+if (s2 && !s1)
+s1 = s2;
+else if (s1 && s2 && s1 < s2)
+s1 = s2;
+
+if (!s1)
+s1 = psz;
+else
+s1++;
+
+*module_name = s1;
 *module_start_addr = (void *)mbi.AllocationBase;
 }
 return psz;
@@ -78,7 +91,7 @@
 PrintStackTrace(IN PEXCEPTION_POINTERS ExceptionInfo)
 {
 PVOID StartAddr;
-CHAR szMod[128] = "";
+CHAR szMod[128] = "", *szModFile;
 PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
 PCONTEXT ContextRecord = ExceptionInfo->ContextRecord;
 
@@ -93,11 +106,12 @@
 }
 
 _dump_context(ContextRecord);
-_module_name_from_addr(ExceptionRecord->ExceptionAddress, , 
szMod, sizeof(szMod));
-DbgPrint("Address:\n   %8x+%-8x   %s\n",
- (PVOID)StartAddr,
+_module_name_from_addr(ExceptionRecord->ExceptionAddress, , 
szMod, sizeof(szMod), );
+DbgPrint("Address:\n<%s:%x> (%s@%x)\n",
+ szModFile,
  (ULONG_PTR)ExceptionRecord->ExceptionAddress - 
(ULONG_PTR)StartAddr,
- szMod);
+ szMod,
+ StartAddr);
 #ifdef _M_IX86
 DbgPrint("Frames:\n");
 
@@ -110,16 +124,17 @@
 {
 if (IsBadReadPtr((PVOID)Frame[1], 4))
 {
-DbgPrint("   %8x%9s   %s\n", Frame[1], ""," 
");
+DbgPrint("<%s:%x>\n", "[invalid address]", Frame[1]);
 }
 else
 {
 _module_name_from_addr((const void*)Frame[1], ,
-   szMod, sizeof(szMod));
-DbgPrint("   %8x+%-8x   %s\n",
- (PVOID)StartAddr,
+   szMod, sizeof(szMod), );
+DbgPrint("<%s:%x> (%s@%x)\n",
+ szModFile,
  (ULONG_PTR)Frame[1] - (ULONG_PTR)StartAddr,
- szMod);
+ szMod,
+ StartAddr);
 }
 
 if (IsBadReadPtr((PVOID)Frame[0], sizeof(*Frame) * 2))




[ros-diffs] [mjansen] 74610: [SHIMS] Add IgnoreDebugOutput shim CORE-10369

2017-05-20 Thread mjansen
Author: mjansen
Date: Sat May 20 20:22:25 2017
New Revision: 74610

URL: http://svn.reactos.org/svn/reactos?rev=74610=rev
Log:
[SHIMS] Add IgnoreDebugOutput shim CORE-10369

Added:
trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c   (with props)
Modified:
trunk/reactos/dll/appcompat/shims/genral/CMakeLists.txt

Modified: trunk/reactos/dll/appcompat/shims/genral/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral/CMakeLists.txt?rev=74610=74609=74610=diff
==
--- trunk/reactos/dll/appcompat/shims/genral/CMakeLists.txt [iso-8859-1] 
(original)
+++ trunk/reactos/dll/appcompat/shims/genral/CMakeLists.txt [iso-8859-1] 
Sat May 20 20:22:25 2017
@@ -4,6 +4,7 @@
 spec2def(acgenral.dll genral.spec)
 
 list(APPEND SOURCE
+ignoredbgout.c
 main.c
 themes.c
 genral.spec)

Added: trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c?rev=74610
==
--- trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c (added)
+++ trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c [iso-8859-1] 
Sat May 20 20:22:25 2017
@@ -0,0 +1,32 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT: ReactOS Shim library
+ * FILE:dll/appcompat/shims/genral/ignoredbgout.c
+ * PURPOSE: Ignore debug output shim
+ * PROGRAMMER:  Mark Jansen
+ */
+
+#include 
+#include 
+#include 
+
+
+#define SHIM_NS IgnoreDebugOutput
+#include 
+
+void WINAPI SHIM_OBJ_NAME(OutputDebugStringA)(LPCSTR lpOutputString)
+{
+(VOID)lpOutputString;
+}
+
+void WINAPI SHIM_OBJ_NAME(OutputDebugStringW)(LPCWSTR lpOutputString)
+{
+(VOID)lpOutputString;
+}
+
+#define SHIM_NUM_HOOKS  2
+#define SHIM_SETUP_HOOKS \
+SHIM_HOOK(0, "KERNEL32.DLL", "OutputDebugStringA", 
SHIM_OBJ_NAME(OutputDebugStringA)) \
+SHIM_HOOK(1, "KERNEL32.DLL", "OutputDebugStringW", 
SHIM_OBJ_NAME(OutputDebugStringW))
+
+#include 

Propchange: trunk/reactos/dll/appcompat/shims/genral/ignoredbgout.c
--
svn:eol-style = native




[ros-diffs] [mjansen] 74609: [BOOTDATA] Create an empty HKLM\...\AppCompatFlags\Layers key to silence logging.

2017-05-20 Thread mjansen
Author: mjansen
Date: Sat May 20 20:06:46 2017
New Revision: 74609

URL: http://svn.reactos.org/svn/reactos?rev=74609=rev
Log:
[BOOTDATA] Create an empty HKLM\...\AppCompatFlags\Layers key to silence 
logging.

Modified:
trunk/reactos/boot/bootdata/hivesft.inf
trunk/reactos/boot/bootdata/hivesys.inf

Modified: trunk/reactos/boot/bootdata/hivesft.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?rev=74609=74608=74609=diff
==
--- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Sat May 20 
20:06:46 2017
@@ -379,6 +379,9 @@
 
 ; Uninstall Application list
 HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x0012
+
+; Empty App Compat Layers
+HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\AppCompatFlags\Layers","",0x,""
 
 ; Version Information
 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","InstallDate",0x00010003,0

Modified: trunk/reactos/boot/bootdata/hivesys.inf
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?rev=74609=74608=74609=diff
==
--- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Sat May 20 
20:06:46 2017
@@ -1391,9 +1391,6 @@
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager","ObjectDirectories",0x0001, \
  "\Windows", \
  "\RPC Control"
-# This is an empty app compat cache
-HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\AppCompatCache","AppCompatCache", 0x0001, \
-  fe,0f,dc,ba,00,00,00,00
 
 ; DOS devices
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS 
Devices","AUX",0x,"\DosDevices\COM1"
@@ -1450,6 +1447,10 @@
 
 ; App Compat -- Disable on ReactOS
 HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\AppCompatibility","DisableAppCompat",0x00010003, 0x0001
+
+; This is an empty App Compat cache
+HKLM,"SYSTEM\CurrentControlSet\Control\Session 
Manager\AppCompatCache","AppCompatCache", 0x0001, \
+  fe,0f,dc,ba,00,00,00,00
 
 ; WOW Support
 HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x,""




[ros-diffs] [mjansen] 74608: [SLAYER] Remove the shell extension. CORE-13111 #resolve

2017-05-20 Thread mjansen
Author: mjansen
Date: Sat May 20 19:58:04 2017
New Revision: 74608

URL: http://svn.reactos.org/svn/reactos?rev=74608=rev
Log:
[SLAYER] Remove the shell extension. CORE-13111 #resolve

Removed:
trunk/reactos/dll/shellext/slayer/
Modified:
trunk/reactos/dll/shellext/CMakeLists.txt

Modified: trunk/reactos/dll/shellext/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/CMakeLists.txt?rev=74608=74607=74608=diff
==
--- trunk/reactos/dll/shellext/CMakeLists.txt   [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/CMakeLists.txt   [iso-8859-1] Sat May 20 
19:58:04 2017
@@ -7,5 +7,4 @@
 add_subdirectory(netshell)
 add_subdirectory(ntobjshex)
 add_subdirectory(shellbtrfs)
-add_subdirectory(slayer)
 add_subdirectory(stobject)




[ros-diffs] [mjansen] 74607: [WIN32SS] Reduce the amount of calls to IntGetFontLocalizedName, since this was identified as a source of recent slower drawing. CORE-13274 Thanks to Thomas, Giannis and J

2017-05-20 Thread mjansen
Author: mjansen
Date: Sat May 20 18:59:00 2017
New Revision: 74607

URL: http://svn.reactos.org/svn/reactos?rev=74607=rev
Log:
[WIN32SS] Reduce the amount of calls to IntGetFontLocalizedName, since this was 
identified as a source of recent slower drawing. CORE-13274
Thanks to Thomas, Giannis and Joachim.

Modified:
trunk/reactos/win32ss/gdi/eng/engobjects.h
trunk/reactos/win32ss/gdi/ntgdi/freetype.c
trunk/reactos/win32ss/user/ntuser/main.c

Modified: trunk/reactos/win32ss/gdi/eng/engobjects.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engobjects.h?rev=74607=74606=74607=diff
==
--- trunk/reactos/win32ss/gdi/eng/engobjects.h  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/engobjects.h  [iso-8859-1] Sat May 20 
18:59:00 2017
@@ -114,10 +114,18 @@
   LONG  RefCount;
 } SHARED_MEM, *PSHARED_MEM;
 
+typedef struct _SHARED_FACE_CACHE {
+UINT OutlineRequiredSize;
+UNICODE_STRING FontFamily;
+UNICODE_STRING FullName;
+} SHARED_FACE_CACHE, *PSHARED_FACE_CACHE;
+
 typedef struct _SHARED_FACE {
   FT_Face   Face;
   LONG  RefCount;
   PSHARED_MEM   Memory;
+  SHARED_FACE_CACHE EnglishUS;
+  SHARED_FACE_CACHE UserLanguage;
 } SHARED_FACE, *PSHARED_FACE;
 
 typedef struct _FONTGDI {

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=74607=74606=74607=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Sat May 20 
18:59:00 2017
@@ -85,6 +85,9 @@
 
 #define ASSERT_FREETYPE_LOCK_HELD() \
   ASSERT(FreeTypeLock->Owner == KeGetCurrentThread())
+
+#define ASSERT_FREETYPE_LOCK_NOT_HELD() \
+  ASSERT(FreeTypeLock->Owner != KeGetCurrentThread())
 
 #define MAX_FONT_CACHE 256
 
@@ -171,6 +174,14 @@
 ++Ptr->RefCount;
 }
 
+static void
+SharedFaceCache_Init(PSHARED_FACE_CACHE Cache)
+{
+Cache->OutlineRequiredSize = 0;
+RtlInitUnicodeString(>FontFamily, NULL);
+RtlInitUnicodeString(>FullName, NULL);
+}
+
 static PSHARED_FACE
 SharedFace_Create(FT_Face Face, PSHARED_MEM Memory)
 {
@@ -181,6 +192,9 @@
 Ptr->Face = Face;
 Ptr->RefCount = 1;
 Ptr->Memory = Memory;
+SharedFaceCache_Init(>EnglishUS);
+SharedFaceCache_Init(>UserLanguage);
+
 SharedMem_AddRef(Memory);
 DPRINT("Creating SharedFace for %s\n", Face->family_name);
 }
@@ -265,6 +279,13 @@
 }
 
 static void
+SharedFaceCache_Release(PSHARED_FACE_CACHE Cache)
+{
+RtlFreeUnicodeString(>FontFamily);
+RtlFreeUnicodeString(>FullName);
+}
+
+static void
 SharedFace_Release(PSHARED_FACE Ptr)
 {
 IntLockFreeType;
@@ -280,6 +301,8 @@
 RemoveCacheEntries(Ptr->Face);
 FT_Done_Face(Ptr->Face);
 SharedMem_Release(Ptr->Memory);
+SharedFaceCache_Release(>EnglishUS);
+SharedFaceCache_Release(>UserLanguage);
 ExFreePoolWithTag(Ptr, TAG_FONT);
 }
 IntUnLockFreeType;
@@ -1739,7 +1762,7 @@
 }
 
 static NTSTATUS
-IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
+IntGetFontLocalizedName(PUNICODE_STRING pNameW, PSHARED_FACE SharedFace,
 FT_UShort NameID, FT_UShort LangID);
 
 /*
@@ -1751,7 +1774,6 @@
  UINT Size,
  OUTLINETEXTMETRICW *Otm)
 {
-unsigned Needed;
 TT_OS2 *pOS2;
 TT_HoriHeader *pHori;
 TT_Postscript *pPost;
@@ -1759,38 +1781,51 @@
 FT_WinFNT_HeaderRec Win;
 FT_Error Error;
 char *Cp;
-FT_Face Face = FontGDI->SharedFace->Face;
 UNICODE_STRING FamilyNameW, FaceNameW, StyleNameW, FullNameW;
+PSHARED_FACE SharedFace = FontGDI->SharedFace;
+PSHARED_FACE_CACHE Cache = (gusLanguageID == gusEnglishUS) ? 
>EnglishUS : >UserLanguage;
+FT_Face Face = SharedFace->Face;
+
+if (Cache->OutlineRequiredSize && Size < Cache->OutlineRequiredSize)
+{
+return Cache->OutlineRequiredSize;
+}
 
 /* family name */
 RtlInitUnicodeString(, NULL);
-IntGetFontLocalizedName(, Face, TT_NAME_ID_FONT_FAMILY, 
gusLanguageID);
+IntGetFontLocalizedName(, SharedFace, TT_NAME_ID_FONT_FAMILY, 
gusLanguageID);
 
 /* face name */
 RtlInitUnicodeString(, NULL);
-IntGetFontLocalizedName(, Face, TT_NAME_ID_FULL_NAME, 
gusLanguageID);
+IntGetFontLocalizedName(, SharedFace, TT_NAME_ID_FULL_NAME, 
gusLanguageID);
 
 /* style name */
 RtlInitUnicodeString(, NULL);
-IntGetFontLocalizedName(, Face, TT_NAME_ID_FONT_SUBFAMILY, 
gusLanguageID);
+IntGetFontLocalizedName(, SharedFace, 
TT_NAME_ID_FONT_SUBFAMILY, gusLanguageID);
 

[ros-diffs] [mjansen] 74602: [GDI32_APITEST] Improve GetFontResourceInfoW tests. Patch by Katayama Hirofumi MZ. ROSTESTS-269 #resolve #comment Thanks!

2017-05-19 Thread mjansen
Author: mjansen
Date: Fri May 19 20:26:49 2017
New Revision: 74602

URL: http://svn.reactos.org/svn/reactos?rev=74602=rev
Log:
[GDI32_APITEST] Improve GetFontResourceInfoW tests. Patch by Katayama Hirofumi 
MZ. ROSTESTS-269 #resolve #comment Thanks!

Added:
trunk/rostests/apitests/gdi32/ExampleFont.ttf   (with props)
Modified:
trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c
trunk/rostests/apitests/gdi32/resource.rc

Added: trunk/rostests/apitests/gdi32/ExampleFont.ttf
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/ExampleFont.ttf?rev=74602
==
Binary file - no diff available.

Propchange: trunk/rostests/apitests/gdi32/ExampleFont.ttf
--
svn:mime-type = application/octet-stream

Modified: trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c?rev=74602=74601=74602=diff
==
--- trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c[iso-8859-1] 
(original)
+++ trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c[iso-8859-1] 
Fri May 19 20:26:49 2017
@@ -5,6 +5,7 @@
  * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -16,6 +17,7 @@
 typedef struct GFRI_ENTRY
 {
 LPCWSTR File;
+BOOLPreinstalled;
 WCHAR   FontInfo[64];
 INT FontCount;
 WCHAR   FaceNames[10][64];
@@ -24,9 +26,9 @@
 /* test entries */
 static const GFRI_ENTRY TestEntries[] =
 {
-{ L"symbol.ttf", L"Symbol|", 1, { L"Symbol" } },
-{ L"tahoma.ttf", L"Tahoma|", 1, { L"Tahoma" } },
-{ L"tahomabd.ttf", L"Tahoma Bold|", 1, { L"Tahoma" } }
+{ L"symbol.ttf", TRUE, L"Symbol|", 1, { L"Symbol" } },
+{ L"tahoma.ttf", TRUE, L"Tahoma|", 1, { L"Tahoma" } },
+{ L"tahomabd.ttf", TRUE, L"Tahoma Bold|", 1, { L"Tahoma" } }
 };
 
 /* Japanese */
@@ -34,7 +36,7 @@
 {
 {
 /* MS Gothic & MS UI Gothic & MS PGothic */
-L"msgothic.ttc",
+L"msgothic.ttc", TRUE, 
 {
 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x0020,
 0x0026, 0x0020, 0x004D, 0x0053, 0x0020, 0x0055, 0x0049, 0x0020,
@@ -51,6 +53,14 @@
 { 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 
0 },
 { L'@', 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 
0x30AF, 0 }
 }
+},
+{
+L"ExampleFont.ttf", FALSE,
+L"JapaneseDisplayName|",
+1,
+{
+L"JapaneseFamilyName"
+}
 }
 };
 
@@ -59,7 +69,7 @@
 {
 {
 /* MS Gothic & MS UI Gothic & MS PGothic */
-L"msgothic.ttc",
+L"msgothic.ttc", TRUE,
 L"MS Gothic & MS UI Gothic & MS PGothic|",
 6,
 {
@@ -70,6 +80,14 @@
 L"MS PGothic",
 L"@MS PGothic"
 }
+},
+{
+L"ExampleFont.ttf", FALSE,
+L"EnglishDisplayName|",
+1,
+{
+L"EnglishFamilyName"
+}
 }
 };
 
@@ -381,14 +399,56 @@
 static void
 DoEntry(const GFRI_ENTRY *Entry)
 {
-WCHAR szPath[MAX_PATH];
-
-GetSystemFontPath(szPath, Entry->File);
-printf("GetSystemFontPath: %S\n", szPath);
-if (GetFileAttributesW(szPath) == 0x)
-{
-skip("Font file \"%S\" was not found\n", szPath);
-return;
+WCHAR szPath[MAX_PATH], szTempPath[MAX_PATH];
+BOOL Installed = FALSE;
+
+if (Entry->Preinstalled)
+{
+GetSystemFontPath(szPath, Entry->File);
+printf("GetSystemFontPath: %S\n", szPath);
+if (GetFileAttributesW(szPath) == INVALID_FILE_ATTRIBUTES)
+{
+skip("Font file \"%S\" was not found\n", szPath);
+return;
+}
+}
+else
+{
+/* load font data from resource */
+HANDLE hFile;
+HMODULE hMod = GetModuleHandleW(NULL);
+HRSRC hRsrc = FindResourceW(hMod, Entry->File, (LPCWSTR)RT_RCDATA);
+HGLOBAL hGlobal = LoadResource(hMod, hRsrc);
+DWORD Size = SizeofResource(hMod, hRsrc);
+LPVOID pFont = LockResource(hGlobal);
+
+/* get temporary file name */
+GetTempPathW(_countof(szTempPath), szTempPath);
+GetTempFileNameW(szTempPath, L"FNT", 0, szPath);
+printf("GetTempFi

[ros-diffs] [mjansen] 74601: [APPHELP] Initial implementation of ApphelpCheckRunAppEx. CORE-10368

2017-05-19 Thread mjansen
Author: mjansen
Date: Fri May 19 20:13:08 2017
New Revision: 74601

URL: http://svn.reactos.org/svn/reactos?rev=74601=rev
Log:
[APPHELP] Initial implementation of ApphelpCheckRunAppEx. CORE-10368

Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.c
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/hsdb.c

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.c?rev=74601=74600=74601=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.c   [iso-8859-1] Fri May 19 
20:13:08 2017
@@ -1,7 +1,7 @@
 /*
  * Copyright 2011 André Hentschel
  * Copyright 2013 Mislav Blažević
- * Copyright 2015 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,8 +24,9 @@
 #include "winver.h"
 #include "strsafe.h"
 #include "apphelp.h"
-
-#include "wine/winternl.h"
+#include "ndk/rtlfuncs.h"
+#include "ndk/kdtypes.h"
+
 
 /* from dpfilter.h */
 #define DPFLTR_APPCOMPAT_ID 123
@@ -35,23 +36,19 @@
 #endif
 
 ULONG g_ShimDebugLevel = 0x;
+HMODULE g_hInstance;
 
 void ApphelppInitDebugLevel(void)
 {
-UNICODE_STRING DebugKey, DebugValue;
+static const UNICODE_STRING DebugKey = 
RTL_CONSTANT_STRING(L"SHIM_DEBUG_LEVEL");
+UNICODE_STRING DebugValue;
 NTSTATUS Status;
 ULONG NewLevel = SHIM_ERR;
 WCHAR Buffer[40];
 
-RtlInitUnicodeString(, L"SHIM_DEBUG_LEVEL");
-DebugValue.MaximumLength = sizeof(Buffer);
-DebugValue.Buffer = Buffer;
-DebugValue.Length = 0;
-
-/* Hold the lock as short as possible. */
-RtlAcquirePebLock();
+RtlInitEmptyUnicodeString(, Buffer, sizeof(Buffer));
+
 Status = RtlQueryEnvironmentVariable_U(NULL, , );
-RtlReleasePebLock();
 
 if (NT_SUCCESS(Status))
 {
@@ -60,6 +57,7 @@
 }
 g_ShimDebugLevel = NewLevel;
 }
+
 
 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 {
@@ -70,6 +68,7 @@
 return FALSE;/* prefer native version */
 #endif
 case DLL_PROCESS_ATTACH:
+g_hInstance = hinst;
 DisableThreadLibraryCalls( hinst );
 SdbpHeapInit();
 break;
@@ -145,9 +144,11 @@
 break;
 }
 StringCchPrintfExA(Current, Length, , , 
STRSAFE_NULL_ON_FAILURE, "[%s][%-20s] ", LevelStr, FunctionName);
+
 va_start(ArgList, Format);
 StringCchVPrintfExA(Current, Length, , , 
STRSAFE_NULL_ON_FAILURE, Format, ArgList);
 va_end(ArgList);
+
 #if defined(APPCOMPAT_USE_DBGPRINTEX) && APPCOMPAT_USE_DBGPRINTEX
 return NT_SUCCESS(DbgPrintEx(DPFLTR_APPCOMPAT_ID, Level, "%s", Buffer));
 #else
@@ -156,3 +157,102 @@
 #endif
 }
 
+
+#define APPHELP_DONTWRITE_REASON2
+#define APPHELP_CLEARBITS   0x100   /* TODO: Investigate */
+#define APPHELP_IGNORE_ENVIRONMENT  0x400
+
+#define APPHELP_VALID_RESULT0x1
+#define APPHELP_RESULT_NOTFOUND 0x2
+#define APPHELP_RESULT_FOUND0x4
+
+/**
+ * Lookup Shims / Fixes for the specified application
+ *
+ * @param [in]  FileHandle  Handle to the file to check.
+ * @param [in]  Unk1
+ * @param [in]  Unk2
+ * @param [in]  ApplicationName Exe to check
+ * @param [in]  Environment The environment variables to use, 
or NULL to use the current environment.
+ * @param [in]  ExeType Exe type (MACHINE_TYPE_)
+ * @param [in,out]  Reason  Input/output flags
+ * @param [in]  SdbQueryAppCompatData   The resulting data.
+ * @param [in]  SdbQueryAppCompatDataSize   The resulting data size.
+ * @param [in]  SxsData TODO
+ * @param [in]  SxsDataSize TODO
+ * @param [in]  FusionFlags TODO
+ * @param [in]  SomeFlag1   TODO
+ * @param [in]  SomeFlag2   TODO
+ *
+ * @return  TRUE if the application is allowed to run.
+ */
+BOOL
+WINAPI
+ApphelpCheckRunAppEx(
+_In_ HANDLE FileHandle,
+_In_opt_ PVOID Unk1,
+_In_opt_ PVOID Unk2,
+_In_opt_z_ PWCHAR ApplicationName,
+_In_opt_ PVOID Environment,
+_In_opt_ USHORT ExeType,
+_Inout_opt_ PULONG Reason,
+_Out_opt_ PVOID* SdbQueryAppCompatData,
+_Out_opt_ PULONG SdbQueryAppCompatDataSize,
+_Out_opt_ PVOID* SxsData,
+_Out_opt_ PULONG SxsDataSize,
+_Out_opt_ PULONG FusionFlags,
+_Out_opt_ PULONG64 SomeFlag1,
+_Out_opt_ PULONG SomeFlag2)
+{
+SDBQUERYRESULT* result = NULL;
+HSDB hsdb = NULL;
+DWORD dwFlags = 0;
+
+if (SxsData)
+*

[ros-diffs] [mjansen] 74535: [APPHELP][SHIMLIB] Forward some events to loaded shims. CORE-11329

2017-05-13 Thread mjansen
Author: mjansen
Date: Sat May 13 18:49:27 2017
New Revision: 74535

URL: http://svn.reactos.org/svn/reactos?rev=74535=rev
Log:
[APPHELP][SHIMLIB] Forward some events to loaded shims. CORE-11329

Added:
trunk/reactos/dll/appcompat/apphelp/shimeng.c   (with props)
Removed:
trunk/reactos/dll/appcompat/shims/shimlib/shimdbgsupp.c
Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/shims/shimlib/CMakeLists.txt
trunk/reactos/dll/appcompat/shims/shimlib/shimlib.h

Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt?rev=74535=74534=74535=diff
==
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt  [iso-8859-1] Sat May 13 
18:49:27 2017
@@ -15,6 +15,7 @@
 sdbread.c
 sdbstringtable.c
 sdbwrite.c
+shimeng.c
 apphelp.spec
 apphelp.h
 ${CMAKE_CURRENT_BINARY_DIR}/apphelp_stubs.c)

Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apphelp.spec?rev=74535=74534=74535=diff
==
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec[iso-8859-1] Sat May 13 
18:49:27 2017
@@ -157,17 +157,19 @@
 @ stdcall SdbWriteStringTag(ptr long wstr)
 @ stub SdbWriteStringTagDirect
 @ stdcall SdbWriteWORDTag(ptr long long)
-@ stub SE_DllLoaded
-@ stub SE_DllUnloaded
+@ stdcall SE_DllLoaded(ptr)
+@ stdcall SE_DllUnloaded(ptr)
+@ stub SE_DynamicShim
+@ stub SE_DynamicUnshim
+@ stdcall SE_InstallAfterInit(ptr ptr)
+@ stdcall SE_InstallBeforeInit(ptr ptr)
+@ stdcall SE_IsShimDll(ptr)
+@ stdcall SE_ProcessDying()
 @ stub SE_GetHookAPIs
 @ stub SE_GetMaxShimCount
 @ stub SE_GetProcAddressLoad
 @ stub SE_GetShimCount
-@ stub SE_InstallAfterInit
-@ stub SE_InstallBeforeInit
-@ stub SE_IsShimDll
 @ stub SE_LdrEntryRemoved
-@ stub SE_ProcessDying
 @ stub SetPermLayers
 @ cdecl ShimDbgPrint(long str str)
 @ stub ShimDumpCache

Added: trunk/reactos/dll/appcompat/apphelp/shimeng.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/shimeng.c?rev=74535
==
--- trunk/reactos/dll/appcompat/apphelp/shimeng.c   (added)
+++ trunk/reactos/dll/appcompat/apphelp/shimeng.c   [iso-8859-1] Sat May 13 
18:49:27 2017
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2015-2017 Mark Jansen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_NO_STATUS
+#include "windows.h"
+#include "ntndk.h"
+#include "shimlib.h"
+#include 
+
+HANDLE g_pShimEngModHandle = 0;
+
+
+ULONG g_ShimEngDebugLevel = 0x;
+
+
+
+
+VOID SeiInitDebugSupport(VOID)
+{
+static const UNICODE_STRING DebugKey = 
RTL_CONSTANT_STRING(L"SHIMENG_DEBUG_LEVEL");
+UNICODE_STRING DebugValue;
+NTSTATUS Status;
+ULONG NewLevel = 0;
+WCHAR Buffer[40];
+
+RtlInitEmptyUnicodeString(, Buffer, sizeof(Buffer));
+
+Status = RtlQueryEnvironmentVariable_U(NULL, , );
+
+if (NT_SUCCESS(Status))
+{
+if (!NT_SUCCESS(RtlUnicodeStringToInteger(, 10, )))
+NewLevel = 0;
+}
+g_ShimEngDebugLevel = NewLevel;
+}
+
+
+/**
+ * Outputs diagnostic info.
+ *
+ * @param [in]  Level   The level to log this message with, choose any 
of [SHIM_ERR,
+ *  SHIM_WARN, SHIM_INFO].
+ * @param [in]  FunctionNameThe function this log should be attributed to.
+ * @param [in]  Format  The format string.
+ * @param   ... Variable arguments providing additional 
information.
+ *
+ * @return  Success: TRUE Failure: FALSE.
+ */
+BOOL WINAPIV SeiDbgPrint(SEI_LOG_LEVEL Level, PCSTR Function, PCSTR Format, 
...)
+{
+char Buffer[512];
+char* Current = Buffer;
+const char* LevelStr;
+size_t Length = sizeof(Buffer);
+va_list ArgList;
+HR

[ros-diffs] [mjansen] 74534: [NDK][RTL] Make the Name argument in RtlQueryEnvironmentVariable_U const.

2017-05-13 Thread mjansen
Author: mjansen
Date: Sat May 13 17:26:59 2017
New Revision: 74534

URL: http://svn.reactos.org/svn/reactos?rev=74534=rev
Log:
[NDK][RTL] Make the Name argument in RtlQueryEnvironmentVariable_U const.

Modified:
trunk/reactos/sdk/include/ndk/rtlfuncs.h
trunk/reactos/sdk/lib/rtl/env.c

Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h?rev=74534=74533=74534=diff
==
--- trunk/reactos/sdk/include/ndk/rtlfuncs.h[iso-8859-1] (original)
+++ trunk/reactos/sdk/include/ndk/rtlfuncs.h[iso-8859-1] Sat May 13 
17:26:59 2017
@@ -2967,7 +2967,7 @@
 NTAPI
 RtlQueryEnvironmentVariable_U(
 _In_opt_ PWSTR Environment,
-_In_ PUNICODE_STRING Name,
+_In_ PCUNICODE_STRING Name,
 _Out_ PUNICODE_STRING Value
 );
 

Modified: trunk/reactos/sdk/lib/rtl/env.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/env.c?rev=74534=74533=74534=diff
==
--- trunk/reactos/sdk/lib/rtl/env.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/env.c [iso-8859-1] Sat May 13 17:26:59 2017
@@ -508,7 +508,7 @@
  */
 NTSTATUS NTAPI
 RtlQueryEnvironmentVariable_U(PWSTR Environment,
-  PUNICODE_STRING Name,
+  PCUNICODE_STRING Name,
   PUNICODE_STRING Value)
 {
NTSTATUS Status;




[ros-diffs] [mjansen] 74521: [SHELL32] Add stub for SHEnumerateUnreadMailAccountsW, needed by Thunderbird. Found by Joachim Henze. CORE-13229

2017-05-11 Thread mjansen
Author: mjansen
Date: Thu May 11 20:20:47 2017
New Revision: 74521

URL: http://svn.reactos.org/svn/reactos?rev=74521=rev
Log:
[SHELL32] Add stub for SHEnumerateUnreadMailAccountsW, needed by Thunderbird. 
Found by Joachim Henze. CORE-13229

Modified:
trunk/reactos/dll/win32/shell32/shell32.spec
trunk/reactos/dll/win32/shell32/stubs.cpp

Modified: trunk/reactos/dll/win32/shell32/shell32.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.spec?rev=74521=74520=74521=diff
==
--- trunk/reactos/dll/win32/shell32/shell32.spec[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shell32.spec[iso-8859-1] Thu May 11 
20:20:47 2017
@@ -283,7 +283,7 @@
 284 stdcall SHEmptyRecycleBinA(long str long)
 285 stdcall SHEmptyRecycleBinW(long wstr long)
 286 stub SHEnableServiceObject
-287 stub SHEnumerateUnreadMailAccountsW
+287 stdcall SHEnumerateUnreadMailAccountsW(ptr long ptr long)
 288 stdcall SHExtractIconsW(wstr long long long ptr ptr long long) 
user32.PrivateExtractIconsW
 289 stdcall SHFileOperation(ptr) SHFileOperationA
 290 stdcall SHFileOperationA(ptr)

Modified: trunk/reactos/dll/win32/shell32/stubs.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/stubs.cpp?rev=74521=74520=74521=diff
==
--- trunk/reactos/dll/win32/shell32/stubs.cpp   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/stubs.cpp   [iso-8859-1] Thu May 11 
20:20:47 2017
@@ -107,6 +107,21 @@
 {
 FIXME("SHSetUnreadMailCountW() stub\n");
 return E_FAIL;
+}
+
+/*
+ * Unimplemented
+ */
+EXTERN_C HRESULT
+WINAPI
+SHEnumerateUnreadMailAccountsW(HKEY user,
+   DWORD idx,
+   LPWSTR mailaddress,
+   INT mailaddresslen)
+{
+FIXME("SHEnumerateUnreadMailAccountsW(%p %d %p %d) stub\n",
+user, idx, mailaddress, mailaddresslen);
+return E_NOTIMPL;
 }
 
 /*




[ros-diffs] [mjansen] 74514: [SDK] Add enum for PEB.AppCompatFlagsUser

2017-05-09 Thread mjansen
Author: mjansen
Date: Tue May  9 18:15:22 2017
New Revision: 74514

URL: http://svn.reactos.org/svn/reactos?rev=74514=rev
Log:
[SDK] Add enum for PEB.AppCompatFlagsUser

Modified:
trunk/reactos/sdk/include/ndk/pstypes.h

Modified: trunk/reactos/sdk/include/ndk/pstypes.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/pstypes.h?rev=74514=74513=74514=diff
==
--- trunk/reactos/sdk/include/ndk/pstypes.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/ndk/pstypes.h [iso-8859-1] Tue May  9 
18:15:22 2017
@@ -762,6 +762,61 @@
 
 
 //
+// PEB.AppCompatFlagsUser.LowPart
+// Tag FLAG_MASK_USER
+//
+typedef enum _APPCOMPAT_USERFLAGS
+{
+DisableAnimation = 0x1,
+DisableKeyboardCues = 0x2,
+No50StylebitsInSetWindowLong = 0x4,
+DisableDrawPatternRect = 0x8,
+MSShellDialog = 0x10,
+NoDDETerminateDuringDestroy = 0x20,
+GiveupForeground = 0x40,
+AlwaysActiveMenus = 0x80,
+NoMouseHideInEdit = 0x100,
+NoGdiBatching = 0x200,
+FontSubstitution = 0x400,
+No50StylebitsInCreateWindow = 0x800,
+NoCustomPaperSizes = 0x1000,
+AllTheDdeHacks = 0x2000,
+UseDefaultCharset = 0x4000,
+NoCharDeadKey = 0x8000,
+NoTryExceptForWindowProc = 0x1,
+NoInitInsertReplaceFlags = 0x2,
+NoDdeSync = 0x4,
+NoGhost = 0x8,
+NoDdeAsyncReg = 0x10,
+StrictLLHook = 0x20,
+NoShadow = 0x40,
+NoTimerCallbackProtection = 0x100,
+HighDpiAware = 0x200,
+OpenGLEmfAware = 0x400,
+EnableTransparantBltMirror = 0x800,
+NoPaddedBorder = 0x1000,
+ForceLegacyResizeCM = 0x2000,
+HardwareAudioMixer = 0x4000,
+DisableSWCursorOnMoveSize = 0x8000,
+#if 0
+DisableWindowArrangement = 0x1,
+ReorderWaveForCommunications = 0x2,
+NoGdiHwAcceleration = 0x4,
+#endif
+} APPCOMPAT_USERFLAGS;
+
+//
+// PEB.AppCompatFlagsUser.HighPart
+// Tag FLAG_MASK_USER
+//
+typedef enum _APPCOMPAT_USERFLAGS_HIGHPART
+{
+DisableWindowArrangement = 0x1,
+ReorderWaveForCommunications = 0x2,
+NoGdiHwAcceleration = 0x4,
+} APPCOMPAT_USERFLAGS_HIGHPART;
+
+//
 // Process Environment Block (PEB)
 // Thread Environment Block (TEB)
 //




[ros-diffs] [mjansen] 74499: [WIN32SS] Fix font names not including style info (Bold etc). Patch by Katayama Hirofumi MZ. CORE-12179 #comment Thanks!

2017-05-08 Thread mjansen
Author: mjansen
Date: Mon May  8 14:53:30 2017
New Revision: 74499

URL: http://svn.reactos.org/svn/reactos?rev=74499=rev
Log:
[WIN32SS] Fix font names not including style info (Bold etc). Patch by Katayama 
Hirofumi MZ. CORE-12179 #comment Thanks!

Modified:
trunk/reactos/win32ss/gdi/ntgdi/freetype.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype.c?rev=74499=74498=74499=diff
==
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c  [iso-8859-1] Mon May  8 
14:53:30 2017
@@ -1738,6 +1738,10 @@
 FillTMEx(TM, FontGDI, pOS2, pHori, pFNT, FALSE);
 }
 
+static NTSTATUS
+IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
+FT_UShort NameID, FT_UShort LangID);
+
 /*
  * IntGetOutlineTextMetrics
  *
@@ -1752,57 +1756,40 @@
 TT_HoriHeader *pHori;
 TT_Postscript *pPost;
 FT_Fixed XScale, YScale;
-ANSI_STRING FamilyNameA, StyleNameA;
-UNICODE_STRING FamilyNameW, StyleNameW, Regular;
 FT_WinFNT_HeaderRec Win;
 FT_Error Error;
 char *Cp;
-NTSTATUS status;
 FT_Face Face = FontGDI->SharedFace->Face;
+UNICODE_STRING FamilyNameW, FaceNameW, StyleNameW, FullNameW;
+
+/* family name */
+RtlInitUnicodeString(, NULL);
+IntGetFontLocalizedName(, Face, TT_NAME_ID_FONT_FAMILY, 
gusLanguageID);
+
+/* face name */
+RtlInitUnicodeString(, NULL);
+IntGetFontLocalizedName(, Face, TT_NAME_ID_FULL_NAME, 
gusLanguageID);
+
+/* style name */
+RtlInitUnicodeString(, NULL);
+IntGetFontLocalizedName(, Face, TT_NAME_ID_FONT_SUBFAMILY, 
gusLanguageID);
+
+/* unique name (full name) */
+RtlInitUnicodeString(, NULL);
+IntGetFontLocalizedName(, Face, TT_NAME_ID_UNIQUE_ID, 
gusLanguageID);
 
 Needed = sizeof(OUTLINETEXTMETRICW);
-
-RtlInitAnsiString(, Face->family_name);
-status = RtlAnsiStringToUnicodeString(, , TRUE);
-if (!NT_SUCCESS(status))
-{
-return 0;
-}
-
-RtlInitAnsiString(, Face->style_name);
-status = RtlAnsiStringToUnicodeString(, , TRUE);
-if (!NT_SUCCESS(status))
+Needed += FamilyNameW.Length + sizeof(WCHAR);
+Needed += FaceNameW.Length + sizeof(WCHAR);
+Needed += StyleNameW.Length + sizeof(WCHAR);
+Needed += FullNameW.Length + sizeof(WCHAR);
+
+if (Size < Needed)
 {
 RtlFreeUnicodeString();
-return 0;
-}
-
-/* These names should be read from the TT name table */
-
-/* Length of otmpFamilyName */
-Needed += FamilyNameW.Length + sizeof(WCHAR);
-
-RtlInitUnicodeString(, L"Regular");
-/* Length of otmpFaceName */
-if (RtlEqualUnicodeString(, , TRUE))
-{
-Needed += FamilyNameW.Length + sizeof(WCHAR); /* Just the family name 
*/
-}
-else
-{
-Needed += FamilyNameW.Length + StyleNameW.Length + (sizeof(WCHAR) << 
1); /* family + " " + style */
-}
-
-/* Length of otmpStyleName */
-Needed += StyleNameW.Length + sizeof(WCHAR);
-
-/* Length of otmpFullName */
-Needed += FamilyNameW.Length + StyleNameW.Length + (sizeof(WCHAR) << 1);
-
-if (Size < Needed)
-{
-RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 return Needed;
 }
 
@@ -1815,8 +1802,10 @@
 {
 IntUnLockFreeType;
 DPRINT1("Can't find OS/2 table - not TT font?\n");
+RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 RtlFreeUnicodeString();
-RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 return 0;
 }
 
@@ -1825,8 +1814,10 @@
 {
 IntUnLockFreeType;
 DPRINT1("Can't find HHEA table - not TT font?\n");
+RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 RtlFreeUnicodeString();
-RtlFreeUnicodeString();
+RtlFreeUnicodeString();
 return 0;
 }
 
@@ -1882,33 +1873,34 @@
 
 IntUnLockFreeType;
 
-/* otmp* members should clearly have type ptrdiff_t, but M$ knows best */
 Cp = (char*) Otm + sizeof(OUTLINETEXTMETRICW);
+
+/* family name */
 Otm->otmpFamilyName = (LPSTR)(Cp - (char*) Otm);
 wcscpy((WCHAR*) Cp, FamilyNameW.Buffer);
 Cp += FamilyNameW.Length + sizeof(WCHAR);
+
+/* face name */
+Otm->otmpFaceName = (LPSTR)(Cp - (char*) Otm);
+wcscpy((WCHAR*) Cp, FaceNameW.Buffer);
+Cp += FaceNameW.Length + sizeof(WCHAR);
+
+/* style name */
 Otm->otmpStyleName = (LPSTR)(Cp - (char*) Otm);
 wcscpy((WCHAR*) Cp, StyleNameW.Buffer);
 Cp += StyleNameW.Length + sizeof(WCHAR);
-Otm->otmpFaceName = (LPSTR)(Cp - (char*) Otm);
-   

  1   2   3   4   >