Author: mjansen
Date: Sun Jul 10 14:23:58 2016
New Revision: 71882
URL: http://svn.reactos.org/svn/reactos?rev=71882&view=rev
Log:
[WIN32SS] Do not try to call DevModes when it is NULL (mirror drivers). Patch by Victor Matovykh. CORE-11441 #resolve #comment Thanks!
Modified:
trunk/reactos/win32ss/gdi/eng/ldevobj.c
Modified: trunk/reactos/win32ss/gdi/eng/ldevobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/ldevobj.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/ldevobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/ldevobj.c [iso-8859-1] Sun Jul 10 14:23:58 2016
@@ -122,6 +122,12 @@
TRACE("LDEVOBJ_pdmiGetModes(%p, %p)\n", pldev, hDriver);
+ /* Mirror drivers may omit this function */
+ if (!pldev->pfn.GetModes)
+ {
+ return NULL;
+ }
+
/* Call the driver to get the required size */
cbSize = pldev->pfn.GetModes(hDriver, 0, NULL);
if (!cbSize)
Author: hbelusca
Date: Sat Jul 9 23:18:39 2016
New Revision: 71880
URL: http://svn.reactos.org/svn/reactos?rev=71880&view=rev
Log:
[SHELL32]
- Fix the last parameter of a StringCchCopyEx call; fix a misspelling.
- Do not exclusively use GetFileAttributesEx to retrieve file attributes (for the file properties dialog). Indeed, it happens that this API (as well as GetFileAttributes), and equivalently, NtQueryFullAttributesFile (as well as NtQueryAttributesFile), can fail on *locked system* files (on Win2k/Win2k3/Win7, and on ROS), such as C:\pagefile.sys . See for example http://stackoverflow.com/questions/16772931/getfileattributes-on-locked-sys… and my comment in CORE-10757 . Therefore to retrieve file attributes also for these files we do a trick: we call FindFirstFile on the full path to said file. It happens that FindFirstFile can work on locked system files, and thus we are able to retrieve their attributes (+ size and file dates) as well!
See the code for more details.
CORE-10757 #resolve
Modified:
trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp
Modified: trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/dialogs/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp [iso-8859-1] Sat Jul 9 23:18:39 2016
@@ -189,7 +189,7 @@
/* Copy " bytes" to buffer */
LPWSTR pwszEnd = pwszResult + cchWritten;
size_t cchRemaining = cchResultMax - cchWritten;
- StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, NULL);
+ StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, 0);
cchWritten = LoadStringW(shell32_hInstance, IDS_BYTES_FORMAT, pwszEnd, cchRemaining);
cchRemaining -= cchWritten;
@@ -219,7 +219,7 @@
if (lpQwSize->QuadPart < 1024)
return pwszResult;
- /* Concate " (" */
+ /* Concatenate " (" */
UINT cchWritten = wcslen(pwszResult);
LPWSTR pwszEnd = pwszResult + cchWritten;
size_t cchRemaining = cchResultMax - cchWritten;
@@ -481,12 +481,50 @@
BOOL
CFileDefExt::InitFileAttr(HWND hwndDlg)
{
+ BOOL Success;
+ WIN32_FIND_DATAW FileInfo; // WIN32_FILE_ATTRIBUTE_DATA
WCHAR wszBuf[MAX_PATH];
TRACE("InitFileAttr %ls\n", m_wszPath);
- WIN32_FILE_ATTRIBUTE_DATA FileInfo;
- if (GetFileAttributesExW(m_wszPath, GetFileExInfoStandard, &FileInfo))
+ /*
+ * There are situations where GetFileAttributes(Ex) can fail even if the
+ * specified path represents a file. This happens when e.g. the file is a
+ * locked system file, such as C:\pagefile.sys . In this case, the function
+ * returns INVALID_FILE_ATTRIBUTES and GetLastError returns ERROR_SHARING_VIOLATION.
+ * (this would allow us to distinguish between this failure and a failure
+ * due to the fact that the path actually refers to a directory).
+ *
+ * Because we really want to retrieve the file attributes/size/date&time,
+ * we do the following trick:
+ * - First we call GetFileAttributesEx. If it succeeds we know we have
+ * a file or a directory, and we have retrieved its attributes.
+ * - If GetFileAttributesEx fails, we call FindFirstFile on the full path.
+ * While we could have called FindFirstFile at first and skip GetFileAttributesEx
+ * altogether, we do it after GetFileAttributesEx because it performs more
+ * work to retrieve the file attributes. However it actually works even
+ * for locked system files.
+ * - If FindFirstFile succeeds we have retrieved its attributes.
+ * - Otherwise (FindFirstFile has failed), we do not retrieve anything.
+ *
+ * The following code also relies on the fact that the first 6 members
+ * of WIN32_FIND_DATA are *exactly* the same as the WIN32_FILE_ATTRIBUTE_DATA
+ * structure. Therefore it is safe to use a single WIN32_FIND_DATA
+ * structure for both the GetFileAttributesEx and FindFirstFile calls.
+ */
+
+ Success = GetFileAttributesExW(m_wszPath,
+ GetFileExInfoStandard,
+ (LPWIN32_FILE_ATTRIBUTE_DATA)&FileInfo);
+ if (!Success)
+ {
+ HANDLE hFind = FindFirstFileW(m_wszPath, &FileInfo);
+ Success = (hFind != INVALID_HANDLE_VALUE);
+ if (Success)
+ FindClose(hFind);
+ }
+
+ if (Success)
{
/* Update attribute checkboxes */
if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
Author: akhaldi
Date: Sat Jul 9 17:18:33 2016
New Revision: 71873
URL: http://svn.reactos.org/svn/reactos?rev=71873&view=rev
Log:
[FONTSUB] Import from Wine Staging 1.9.13. CORE-11219
Added:
trunk/reactos/dll/win32/fontsub/
trunk/reactos/dll/win32/fontsub/CMakeLists.txt (with props)
trunk/reactos/dll/win32/fontsub/fontsub.spec (with props)
trunk/reactos/dll/win32/fontsub/main.c (with props)
trunk/reactos/sdk/include/psdk/fontsub.h (with props)
Modified:
trunk/reactos/dll/win32/CMakeLists.txt
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
==============================================================================
--- trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -41,6 +41,7 @@
add_subdirectory(faultrep)
add_subdirectory(fltlib)
add_subdirectory(fmifs)
+add_subdirectory(fontsub)
add_subdirectory(framedyn)
add_subdirectory(fusion)
add_subdirectory(gdiplus)
Added: trunk/reactos/dll/win32/fontsub/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fontsub/CMakeLis…
==============================================================================
--- trunk/reactos/dll/win32/fontsub/CMakeLists.txt (added)
+++ trunk/reactos/dll/win32/fontsub/CMakeLists.txt [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -0,0 +1,14 @@
+
+add_definitions(-D__WINESRC__)
+include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
+spec2def(fontsub.dll fontsub.spec)
+
+add_library(fontsub SHARED
+ main.c
+ ${CMAKE_CURRENT_BINARY_DIR}/fontsub_stubs.c
+ ${CMAKE_CURRENT_BINARY_DIR}/fontsub.def)
+
+set_module_type(fontsub win32dll)
+target_link_libraries(fontsub wine)
+add_importlibs(fontsub msvcrt kernel32 ntdll)
+add_cd_file(TARGET fontsub DESTINATION reactos/system32 FOR all)
Propchange: trunk/reactos/dll/win32/fontsub/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/fontsub/fontsub.spec
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fontsub/fontsub.…
==============================================================================
--- trunk/reactos/dll/win32/fontsub/fontsub.spec (added)
+++ trunk/reactos/dll/win32/fontsub/fontsub.spec [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -0,0 +1,2 @@
+@ cdecl CreateFontPackage(ptr long ptr ptr ptr long long long long long long ptr long ptr ptr ptr ptr)
+@ stub MergeFontPackage
Propchange: trunk/reactos/dll/win32/fontsub/fontsub.spec
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/fontsub/main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fontsub/main.c?r…
==============================================================================
--- trunk/reactos/dll/win32/fontsub/main.c (added)
+++ trunk/reactos/dll/win32/fontsub/main.c [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 Nikolay Sivov for CodeWeavers
+ *
+ * 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 <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "fontsub.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(fontsub);
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
+
+ switch (fdwReason) {
+ case DLL_WINE_PREATTACH:
+ return FALSE; /* prefer native version */
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ break;
+ }
+
+ return TRUE;
+}
+
+ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, unsigned char **dest,
+ ULONG *dest_len, ULONG *written, const unsigned short flags, const unsigned short face_index,
+ const unsigned short format, const unsigned short lang, const unsigned short platform, const unsigned short encoding,
+ const unsigned short *keep_list, const unsigned short keep_len, CFP_ALLOCPROC allocproc,
+ CFP_REALLOCPROC reallocproc, CFP_FREEPROC freeproc, void *reserved)
+{
+ FIXME("(%p %u %p %p %p %#x %u %u %u %u %u %p %u %p %p %p %p): stub\n", src, src_len, dest, dest_len,
+ written, flags, face_index, format, lang, platform, encoding, keep_list, keep_len, allocproc,
+ reallocproc, freeproc, reserved);
+
+ if (format != TTFCFP_SUBSET)
+ return ERR_GENERIC;
+
+ *dest = allocproc(src_len);
+ if (!*dest)
+ return ERR_MEM;
+
+ memcpy(*dest, src, src_len);
+ *dest_len = src_len;
+ *written = src_len;
+
+ return NO_ERROR;
+}
Propchange: trunk/reactos/dll/win32/fontsub/main.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/media/doc/README.WINE
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -67,6 +67,7 @@
reactos/dll/win32/dciman32 # Synced to WineStaging-1.9.11
reactos/dll/win32/faultrep # Synced to WineStaging-1.9.11
reactos/dll/win32/fltlib # Synced to WineStaging-1.9.11
+reactos/dll/win32/fontsub # Synced to WineStaging-1.9.13
reactos/dll/win32/fusion # Synced to WineStaging-1.9.11
reactos/dll/win32/gdiplus # Synced to WineStaging-1.9.11
reactos/dll/win32/hhctrl.ocx # Synced to WineStaging-1.9.11
Added: trunk/reactos/sdk/include/psdk/fontsub.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/fontsub.h…
==============================================================================
--- trunk/reactos/sdk/include/psdk/fontsub.h (added)
+++ trunk/reactos/sdk/include/psdk/fontsub.h [iso-8859-1] Sat Jul 9 17:18:33 2016
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016 Nikolay Sivov for CodeWeavers
+ *
+ * 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
+ */
+
+#ifndef __WINE_FONTSUB_H
+#define __WINE_FONTSUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(__cdecl *CFP_ALLOCPROC)(size_t);
+typedef void *(__cdecl *CFP_REALLOCPROC)(void *, size_t);
+typedef void (__cdecl *CFP_FREEPROC)(void *);
+
+#define TTFCFP_SUBSET 0
+#define TTFCFP_SUBSET1 1
+#define TTFCFP_DELTA 2
+
+#define TTFCFP_UNICODE_PLATFORMID 0
+#define TTFCFP_APPLE_PLATFORMID 1
+#define TTFCFP_ISO_PLATFORMID 2
+#define TTFCFP_MS_PLATFORMID 3
+
+#define TTFCFP_STD_MAC_CHAR_SET 0
+#define TTFCFP_SYMBOL_CHAR_SET 0
+#define TTFCFP_UNICODE_CHAR_SET 1
+#define TTFCFP_DONT_CARE 0xffff
+
+#define TTFCFP_LANG_KEEP_ALL 0
+
+#define TTFCFP_FLAGS_SUBSET 0x0001
+#define TTFCFP_FLAGS_COMPRESS 0x0002
+#define TTFCFP_FLAGS_TTC 0x0004
+#define TTFCFP_FLAGS_GLYPHLIST 0x0008
+
+#define ERR_GENERIC 1000
+#define ERR_MEM 1005
+
+ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, unsigned char **dest,
+ ULONG *dest_len, ULONG *written, const unsigned short flags, const unsigned short face_index,
+ const unsigned short format, const unsigned short lang, const unsigned short platform,
+ const unsigned short encoding, const unsigned short *keep_list, const unsigned short keep_len,
+ CFP_ALLOCPROC allocproc, CFP_REALLOCPROC reallocproc, CFP_FREEPROC freeproc, void *reserved);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Propchange: trunk/reactos/sdk/include/psdk/fontsub.h
------------------------------------------------------------------------------
svn:eol-style = native