[ros-diffs] [tthompson] 71680: [NTFS] Allow for an existing file to be opened with FILE_OVERWRITE, FILE_OVERWRITE_IF, or FILE_SUPERSEDE dispositions, and truncate that file. This allows for a file to

2016-06-26 Thread tthompson
Author: tthompson
Date: Sun Jun 26 21:06:02 2016
New Revision: 71680

URL: http://svn.reactos.org/svn/reactos?rev=71680=rev
Log:
[NTFS]
Allow for an existing file to be opened with FILE_OVERWRITE, FILE_OVERWRITE_IF, 
or FILE_SUPERSEDE dispositions, and truncate that file. This allows for a file 
to be opened and saved in Notepad.exe [provided that file is non-resident and 
its allocation size doesn't need to change].

Modified:
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c

Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c?rev=71680=71679=71680=diff
==
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c   [iso-8859-1] 
(original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c   [iso-8859-1] 
Sun Jun 26 21:06:02 2016
@@ -476,14 +476,66 @@
 return Status;
 }
 
-/* HUGLY HACK: Can't overwrite or supersede a file yet... */
 if (RequestedDisposition == FILE_OVERWRITE ||
 RequestedDisposition == FILE_OVERWRITE_IF ||
 RequestedDisposition == FILE_SUPERSEDE)
 {
-DPRINT1("Cannot yet perform an overwrite or supersede request on 
NTFS volume\n");
-NtfsCloseFile(DeviceExt, FileObject);
-return STATUS_ACCESS_DENIED;
+PFILE_RECORD_HEADER fileRecord = NULL;
+PNTFS_ATTR_CONTEXT dataContext = NULL;
+ULONG DataAttributeOffset;
+LARGE_INTEGER Zero;
+Zero.QuadPart = 0;
+
+// TODO: check for appropriate access
+   
+ExAcquireResourceExclusiveLite(&(Fcb->MainResource), TRUE);
+
+fileRecord = ExAllocatePoolWithTag(NonPagedPool,
+   
Fcb->Vcb->NtfsInfo.BytesPerFileRecord,
+   TAG_NTFS);
+if (fileRecord)
+{
+
+Status = ReadFileRecord(Fcb->Vcb,
+Fcb->MFTIndex,
+fileRecord);
+if (!NT_SUCCESS(Status))
+goto DoneOverwriting;
+
+// find the data attribute and set it's length to 0 (TODO: 
Handle Alternate Data Streams)
+Status = FindAttribute(Fcb->Vcb, fileRecord, AttributeData, 
L"", 0, , );
+if (!NT_SUCCESS(Status))
+goto DoneOverwriting;
+
+Status = SetAttributeDataLength(FileObject, Fcb, dataContext, 
DataAttributeOffset, fileRecord, );
+}
+else
+{
+Status = STATUS_NO_MEMORY;
+}
+   
+DoneOverwriting:
+if (fileRecord)
+ExFreePool(fileRecord);
+if (dataContext)
+ReleaseAttributeContext(dataContext);
+
+ExReleaseResourceLite(&(Fcb->MainResource));
+
+if (!NT_SUCCESS(Status))
+{
+NtfsCloseFile(DeviceExt, FileObject);
+return Status;
+}
+
+if (RequestedDisposition == FILE_SUPERSEDE)
+{
+Irp->IoStatus.Information = FILE_SUPERSEDED;
+}
+else
+{
+Irp->IoStatus.Information = FILE_OVERWRITTEN;
+}
 }
 }
 else




[ros-diffs] [ekohl] 71679: [SERVICES] Create an individual security descriptor for each service. We cannot use a common default security descriptor because RtlSetSecurityObject will free the old secur

2016-06-26 Thread ekohl
Author: ekohl
Date: Sun Jun 26 20:09:37 2016
New Revision: 71679

URL: http://svn.reactos.org/svn/reactos?rev=71679=rev
Log:
[SERVICES]
Create an individual security descriptor for each service. We cannot use a 
common default security descriptor because RtlSetSecurityObject will free the 
old security descriptor when we try to set a new one.

Modified:
trunk/reactos/base/system/services/config.c
trunk/reactos/base/system/services/database.c
trunk/reactos/base/system/services/rpcserver.c
trunk/reactos/base/system/services/security.c
trunk/reactos/base/system/services/services.h

Modified: trunk/reactos/base/system/services/config.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/config.c?rev=71679=71678=71679=diff
==
--- trunk/reactos/base/system/services/config.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/config.c [iso-8859-1] Sun Jun 26 
20:09:37 2016
@@ -513,9 +513,8 @@
 DWORD dwDisposition;
 DWORD dwError;
 
-DPRINT1("ScmWriteSecurityDescriptor(%p %p)\n", hServiceKey, 
pSecurityDescriptor);
-
-DPRINT1("\n");
+DPRINT("ScmWriteSecurityDescriptor(%p %p)\n", hServiceKey, 
pSecurityDescriptor);
+
 dwError = RegCreateKeyExW(hServiceKey,
   L"Security",
   0,
@@ -526,23 +525,16 @@
   ,
   );
 if (dwError != ERROR_SUCCESS)
-{
-DPRINT1("\n");
-goto done;
-}
-
-DPRINT1("\n");
+return dwError;
+
 dwError = RegSetValueExW(hSecurityKey,
  L"Security",
  0,
  REG_BINARY,
  (LPBYTE)pSecurityDescriptor,
  RtlLengthSecurityDescriptor(pSecurityDescriptor));
-DPRINT1("\n");
-
-done:
-if (hSecurityKey != NULL)
-RegCloseKey(hSecurityKey);
+
+RegCloseKey(hSecurityKey);
 
 return dwError;
 }
@@ -559,7 +551,7 @@
 DWORD dwType;
 DWORD dwError;
 
-DPRINT("ScmReadSecurityDescriptor()\n");
+DPRINT("ScmReadSecurityDescriptor(%p %p)\n", hServiceKey, 
ppSecurityDescriptor);
 
 *ppSecurityDescriptor = NULL;
 

Modified: trunk/reactos/base/system/services/database.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/database.c?rev=71679=71678=71679=diff
==
--- trunk/reactos/base/system/services/database.c   [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/database.c   [iso-8859-1] Sun Jun 26 
20:09:37 2016
@@ -555,8 +555,7 @@
 ScmSetServiceGroup(lpService, NULL);
 
 /* Release the SecurityDescriptor */
-if ((lpService->pSecurityDescriptor != NULL) &&
-(lpService->pSecurityDescriptor != pDefaultServiceSD))
+if (lpService->pSecurityDescriptor != NULL)
 HeapFree(GetProcessHeap(), 0, lpService->pSecurityDescriptor);
 
 /* Remove the Service from the List */
@@ -706,7 +705,9 @@
 if (lpService->pSecurityDescriptor == NULL)
 {
 DPRINT("No security descriptor found! Assign default security 
descriptor!\n");
-lpService->pSecurityDescriptor = pDefaultServiceSD;
+dwError = 
ScmCreateDefaultServiceSD(>pSecurityDescriptor);
+if (dwError != ERROR_SUCCESS)
+goto done;
 
 dwError = ScmWriteSecurityDescriptor(hServiceKey,
  
lpService->pSecurityDescriptor);

Modified: trunk/reactos/base/system/services/rpcserver.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcserver.c?rev=71679=71678=71679=diff
==
--- trunk/reactos/base/system/services/rpcserver.c  [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c  [iso-8859-1] Sun Jun 26 
20:09:37 2016
@@ -2255,7 +2255,9 @@
 /* Assign the default security descriptor */
 if (dwServiceType & SERVICE_WIN32)
 {
-lpService->pSecurityDescriptor = pDefaultServiceSD;
+dwError = ScmCreateDefaultServiceSD(>pSecurityDescriptor);
+if (dwError != ERROR_SUCCESS)
+goto done;
 }
 
 /* Write service data to the registry */

Modified: trunk/reactos/base/system/services/security.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/security.c?rev=71679=71678=71679=diff
==
--- trunk/reactos/base/system/services/security.c   [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/security.c   [iso-8859-1] Sun Jun 26 
20:09:37 2016
@@ -13,8 +13,6 @@
 #define NDEBUG
 #include 
 
-PSECURITY_DESCRIPTOR pDefaultServiceSD = NULL; /* Self-relative SD */
-
 static 

[ros-diffs] [hbelusca] 71678: [EVENTVWR] - No need to pop up an error box if we cannot find an event message resource DLL for the current event log. - Flatten out GetEventMessageFileDLL a bit. - Fix a

2016-06-26 Thread hbelusca
Author: hbelusca
Date: Sun Jun 26 19:36:38 2016
New Revision: 71678

URL: http://svn.reactos.org/svn/reactos?rev=71678=rev
Log:
[EVENTVWR]
- No need to pop up an error box if we cannot find an event message resource 
DLL for the current event log.
- Flatten out GetEventMessageFileDLL a bit.
- Fix a comment.

Modified:
trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c

Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c?rev=71678=71677=71678=diff
==
--- trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
[iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
[iso-8859-1] Sun Jun 26 19:36:38 2016
@@ -226,40 +226,36 @@
   szKeyName,
   0,
   KEY_READ,
-  ) == ERROR_SUCCESS)
-{
-if (RegOpenKeyExW(hAppKey,
-  SourceName,
-  0,
-  KEY_READ,
-  ) == ERROR_SUCCESS)
-{
-dwSize = sizeof(szModuleName);
-if (RegQueryValueExW(hSourceKey,
- EntryName,
- NULL,
- NULL,
- (LPBYTE)szModuleName,
- ) == ERROR_SUCCESS)
-{
-/* Returns a string containing the requested substituted 
environment variable */
-ExpandEnvironmentStringsW(szModuleName, ExpandedName, 
MAX_PATH);
-
-/* Successful */
-bReturn = TRUE;
-}
-}
-}
-else
-{
-ShowLastWin32Error();
-}
-
-if (hSourceKey != NULL)
+  ) != ERROR_SUCCESS)
+{
+return FALSE;
+}
+
+if (RegOpenKeyExW(hAppKey,
+  SourceName,
+  0,
+  KEY_READ,
+  ) == ERROR_SUCCESS)
+{
+dwSize = sizeof(szModuleName);
+if (RegQueryValueExW(hSourceKey,
+ EntryName,
+ NULL,
+ NULL,
+ (LPBYTE)szModuleName,
+ ) == ERROR_SUCCESS)
+{
+/* Returns a string containing the requested substituted 
environment variable */
+ExpandEnvironmentStringsW(szModuleName, ExpandedName, MAX_PATH);
+
+/* Successful */
+bReturn = TRUE;
+}
+
 RegCloseKey(hSourceKey);
-
-if (hAppKey != NULL)
-RegCloseKey(hAppKey);
+}
+
+RegCloseKey(hAppKey);
 
 return bReturn;
 }
@@ -677,14 +673,13 @@
 /* Get the computer name */
 lpszComputerName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) 
+ (wcslen(lpszSourceName) + 1) * sizeof(WCHAR));
 
-/* Compute the event type */
+/* Compute the event time */
 EventTimeToSystemTime(pevlr->TimeWritten, );
+GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, , NULL, 
szLocalDate, ARRAYSIZE(szLocalDate));
+GetTimeFormatW(LOCALE_USER_DEFAULT, 0, , NULL, szLocalTime, 
ARRAYSIZE(szLocalTime));
 
 /* Get the username that generated the event */
 GetEventUserName(pevlr, szUsername);
-
-GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, , NULL, 
szLocalDate, ARRAYSIZE(szLocalDate));
-GetTimeFormatW(LOCALE_USER_DEFAULT, 0, , NULL, szLocalTime, 
ARRAYSIZE(szLocalTime));
 
 GetEventType(pevlr->EventType, szEventTypeText);
 GetEventCategory(lpLogName, lpszSourceName, pevlr, szCategory);




[ros-diffs] [tthompson] 71677: [NTFS] Remove unused parameter from SetAttributeDataLength.

2016-06-26 Thread tthompson
Author: tthompson
Date: Sun Jun 26 17:03:31 2016
New Revision: 71677

URL: http://svn.reactos.org/svn/reactos?rev=71677=rev
Log:
[NTFS]
Remove unused parameter from SetAttributeDataLength.

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

Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c?rev=71677=71676=71677=diff
==
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c  [iso-8859-1] 
(original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c  [iso-8859-1] 
Sun Jun 26 17:03:31 2016
@@ -177,7 +177,6 @@
PNTFS_ATTR_CONTEXT AttrContext,
ULONG AttrOffset,
PFILE_RECORD_HEADER FileRecord,
-   PDEVICE_EXTENSION DeviceExt,
PLARGE_INTEGER DataSize)
 {
 if (AttrContext->Record.IsNonResident)

Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h?rev=71677=71676=71677=diff
==
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] 
(original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] 
Sun Jun 26 17:03:31 2016
@@ -772,7 +772,6 @@
PNTFS_ATTR_CONTEXT AttrContext,
ULONG AttrOffset,
PFILE_RECORD_HEADER FileRecord,
-   PDEVICE_EXTENSION DeviceExt,
PLARGE_INTEGER DataSize);
 
 ULONG

Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c?rev=71677=71676=71677=diff
==
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c   [iso-8859-1] 
(original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c   [iso-8859-1] 
Sun Jun 26 17:03:31 2016
@@ -419,7 +419,7 @@
 AllocationSize = ROUND_UP(DataSize.QuadPart, 
Fcb->Vcb->NtfsInfo.BytesPerCluster);
 
 // set the attribute data length
-Status = SetAttributeDataLength(FileObject, Fcb, DataContext, 
AttributeOffset, FileRecord, DeviceExt, );
+Status = SetAttributeDataLength(FileObject, Fcb, DataContext, 
AttributeOffset, FileRecord, );
 
 if (!NT_SUCCESS(Status))
 {




[ros-diffs] [ekohl] 71676: [SERVICES] Use self-relative security descriptors only: - Convert the default service security descriptor to the self-relative format. - Remove security descriptor format co

2016-06-26 Thread ekohl
Author: ekohl
Date: Sun Jun 26 15:02:48 2016
New Revision: 71676

URL: http://svn.reactos.org/svn/reactos?rev=71676=rev
Log:
[SERVICES]
Use self-relative security descriptors only:
- Convert the default service security descriptor to the self-relative format.
- Remove security descriptor format conversions from ScmReadSecurityDescriptor 
and ScmWriteSecurityDescriptor.

Modified:
trunk/reactos/base/system/services/config.c
trunk/reactos/base/system/services/security.c

Modified: trunk/reactos/base/system/services/config.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/config.c?rev=71676=71675=71676=diff
==
--- trunk/reactos/base/system/services/config.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/config.c [iso-8859-1] Sun Jun 26 
15:02:48 2016
@@ -14,6 +14,11 @@
 
 #define NDEBUG
 #include 
+
+ULONG
+NTAPI
+RtlLengthSecurityDescriptor(
+  _In_ PSECURITY_DESCRIPTOR SecurityDescriptor);
 
 /* FUNCTIONS */
 
@@ -504,45 +509,11 @@
 _In_ HKEY hServiceKey,
 _In_ PSECURITY_DESCRIPTOR pSecurityDescriptor)
 {
-PSECURITY_DESCRIPTOR pRelativeSD = NULL;
 HKEY hSecurityKey = NULL;
-DWORD dwBufferLength = 0;
 DWORD dwDisposition;
 DWORD dwError;
-NTSTATUS Status;
 
 DPRINT1("ScmWriteSecurityDescriptor(%p %p)\n", hServiceKey, 
pSecurityDescriptor);
-
-Status = RtlAbsoluteToSelfRelativeSD(pSecurityDescriptor,
- NULL,
- );
-if (Status != STATUS_BUFFER_TOO_SMALL)
-{
-DPRINT1("\n");
-return RtlNtStatusToDosError(Status);
-}
-
-DPRINT1("BufferLength %lu\n", dwBufferLength);
-
-pRelativeSD = RtlAllocateHeap(RtlGetProcessHeap(),
-  HEAP_ZERO_MEMORY,
-  dwBufferLength);
-if (pRelativeSD == NULL)
-{
-DPRINT1("\n");
-return ERROR_OUTOFMEMORY;
-}
-
-DPRINT1("\n");
-Status = RtlAbsoluteToSelfRelativeSD(pSecurityDescriptor,
- pRelativeSD,
- );
-if (!NT_SUCCESS(Status))
-{
-DPRINT1("\n");
-dwError = RtlNtStatusToDosError(Status);
-goto done;
-}
 
 DPRINT1("\n");
 dwError = RegCreateKeyExW(hServiceKey,
@@ -565,17 +536,14 @@
  L"Security",
  0,
  REG_BINARY,
- (LPBYTE)pRelativeSD,
- dwBufferLength);
+ (LPBYTE)pSecurityDescriptor,
+ RtlLengthSecurityDescriptor(pSecurityDescriptor));
 DPRINT1("\n");
 
 done:
 if (hSecurityKey != NULL)
 RegCloseKey(hSecurityKey);
 
-if (pRelativeSD != NULL)
-RtlFreeHeap(RtlGetProcessHeap(), 0, pRelativeSD);
-
 return dwError;
 }
 
@@ -586,13 +554,10 @@
 _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
 {
 PSECURITY_DESCRIPTOR pRelativeSD = NULL;
-PSECURITY_DESCRIPTOR pResizedBuffer = NULL;
 HKEY hSecurityKey = NULL;
 DWORD dwBufferLength = 0;
-DWORD dwAbsoluteSDSize = 0;
 DWORD dwType;
 DWORD dwError;
-NTSTATUS Status;
 
 DPRINT("ScmReadSecurityDescriptor()\n");
 
@@ -650,36 +615,6 @@
 goto done;
 }
 
-Status = RtlSelfRelativeToAbsoluteSD2(pRelativeSD,
-  );
-if (Status == STATUS_BUFFER_TOO_SMALL)
-{
-pResizedBuffer = RtlReAllocateHeap(RtlGetProcessHeap(),
-   0,
-   pRelativeSD,
-   dwAbsoluteSDSize);
-if (pResizedBuffer == NULL)
-{
-dwError = ERROR_OUTOFMEMORY;
-goto done;
-}
-
-pRelativeSD = pResizedBuffer;
-Status = RtlSelfRelativeToAbsoluteSD2(pRelativeSD,
-  );
-if (!NT_SUCCESS(Status))
-{
-dwError = RtlNtStatusToDosError(Status);
-goto done;
-}
-}
-else if (!NT_SUCCESS(Status))
-{
-
-dwError = RtlNtStatusToDosError(Status);
-goto done;
-}
-
 *ppSecurityDescriptor = pRelativeSD;
 
 done:

Modified: trunk/reactos/base/system/services/security.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/security.c?rev=71676=71675=71676=diff
==
--- trunk/reactos/base/system/services/security.c   [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/security.c   [iso-8859-1] Sun Jun 26 
15:02:48 2016
@@ -13,7 +13,7 @@
 #define NDEBUG
 #include 
 
-PSECURITY_DESCRIPTOR pDefaultServiceSD = NULL;
+PSECURITY_DESCRIPTOR 

[ros-diffs] [mjansen] 71675: [SCHANNEL] add missing function to the delayload header. Spotted by Peter Hater. CORE-11270 #resolve

2016-06-26 Thread mjansen
Author: mjansen
Date: Sun Jun 26 12:52:46 2016
New Revision: 71675

URL: http://svn.reactos.org/svn/reactos?rev=71675=rev
Log:
[SCHANNEL] add missing function to the delayload header. Spotted by Peter 
Hater. CORE-11270 #resolve

Modified:
trunk/reactos/dll/win32/schannel/schannel_mbedtls_lazyload.h

Modified: trunk/reactos/dll/win32/schannel/schannel_mbedtls_lazyload.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/schannel/schannel_mbedtls_lazyload.h?rev=71675=71674=71675=diff
==
--- trunk/reactos/dll/win32/schannel/schannel_mbedtls_lazyload.h
[iso-8859-1] (original)
+++ trunk/reactos/dll/win32/schannel/schannel_mbedtls_lazyload.h
[iso-8859-1] Sun Jun 26 12:52:46 2016
@@ -49,6 +49,7 @@
 MAKE_FUNCPTR(mbedtls_ssl_write)
 MAKE_FUNCPTR(mbedtls_ssl_get_peer_cert)
 MAKE_FUNCPTR(mbedtls_ssl_config_init)
+MAKE_FUNCPTR(mbedtls_ssl_config_free)
 MAKE_FUNCPTR(mbedtls_ssl_config_defaults)
 MAKE_FUNCPTR(mbedtls_ssl_conf_dbg)
 MAKE_FUNCPTR(mbedtls_ssl_setup)
@@ -103,6 +104,7 @@
 LOAD_FUNCPTR(mbedtls_ssl_write)
 LOAD_FUNCPTR(mbedtls_ssl_get_peer_cert)
 LOAD_FUNCPTR(mbedtls_ssl_config_init)
+LOAD_FUNCPTR(mbedtls_ssl_config_free)
 LOAD_FUNCPTR(mbedtls_ssl_config_defaults)
 LOAD_FUNCPTR(mbedtls_ssl_conf_dbg)
 LOAD_FUNCPTR(mbedtls_ssl_setup)
@@ -162,6 +164,7 @@
 #define mbedtls_ssl_write   pmbedtls_ssl_write
 #define mbedtls_ssl_get_peer_cert   pmbedtls_ssl_get_peer_cert
 #define mbedtls_ssl_config_init pmbedtls_ssl_config_init
+#define mbedtls_ssl_config_free pmbedtls_ssl_config_free
 #define mbedtls_ssl_config_defaults pmbedtls_ssl_config_defaults
 #define mbedtls_ssl_conf_dbgpmbedtls_ssl_conf_dbg
 #define mbedtls_ssl_setup   pmbedtls_ssl_setup




[ros-diffs] [pschweitzer] 71674: [FASTFAT] Don't allow renaming a directory if there are opened files in it. The way we do it for now isn't fully optimal and could be really improved, but that's a fir

2016-06-26 Thread pschweitzer
Author: pschweitzer
Date: Sun Jun 26 10:23:35 2016
New Revision: 71674

URL: http://svn.reactos.org/svn/reactos?rev=71674=rev
Log:
[FASTFAT]
Don't allow renaming a directory if there are opened files in it.
The way we do it for now isn't fully optimal and could be really improved, but 
that's a first step in the right direction.
This should help getting rid of FAT volumes corruption.
This also fixes a few winetests it seems.

CORE-11426 #comment Patch that fixes bug 3 committed in r71674

Modified:
trunk/reactos/drivers/filesystems/fastfat/finfo.c

Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/finfo.c?rev=71674=71673=71674=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/finfo.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/finfo.c   [iso-8859-1] Sun Jun 26 
10:23:35 2016
@@ -704,6 +704,27 @@
 vfatSplitPathName(, , );
 DPRINT("New dir: %wZ, New file: %wZ\n", , );
 
+/* FIXME: Do it in a more efficient way, like linking FCBs to their parent 
FCB so that we browse less FCBs
+ * Note: The FIXME is the way MS FastFAT seems to do it
+ */
+if (vfatFCBIsDirectory(FCB))
+{
+PLIST_ENTRY Entry;
+PVFATFCB VolFCB;
+
+for (Entry = DeviceExt->FcbListHead.Flink; Entry != 
>FcbListHead; Entry = Entry->Flink)
+{
+VolFCB = CONTAINING_RECORD(Entry, VFATFCB, FcbListEntry);
+if (VolFCB->parentFcb == FCB && VolFCB->OpenHandleCount != 0)
+{
+DPRINT1("At least one children file opened! %wZ (%u, %u)\n", 
>PathNameU, VolFCB->RefCount, VolFCB->OpenHandleCount);
+Status = STATUS_ACCESS_DENIED;
+ASSERT(OldReferences == FCB->parentFcb->RefCount);
+goto Cleanup;
+}
+}
+}
+
 /* Are we working in place? */
 if (FsRtlAreNamesEqual(, , TRUE, NULL))
 {