[ros-diffs] [mjansen] 73832: [KS] Cleanup in the failure path of KsCreateDefaultClock. Patch by Sebastian Gasiorek. CID 1322124 CORE-12784 #resolve #comment Thanks!

2017-02-18 Thread mjansen
Author: mjansen
Date: Sat Feb 18 22:54:31 2017
New Revision: 73832

URL: http://svn.reactos.org/svn/reactos?rev=73832=rev
Log:
[KS] Cleanup in the failure path of KsCreateDefaultClock. Patch by Sebastian 
Gasiorek. CID 1322124 CORE-12784 #resolve #comment Thanks!

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

Modified: trunk/reactos/drivers/ksfilter/ks/clocks.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/clocks.c?rev=73832=73831=73832=diff
==
--- trunk/reactos/drivers/ksfilter/ks/clocks.c  [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/clocks.c  [iso-8859-1] Sat Feb 18 
22:54:31 2017
@@ -395,7 +395,10 @@
 /* let's allocate the clock struct */
 Clock = AllocateItem(NonPagedPool, sizeof(KSICLOCK));
 if (!Clock)
+{
+FreeItem(ClockCreate);
 return STATUS_INSUFFICIENT_RESOURCES;
+}
 
 /* now allocate the object header */
 Status = KsAllocateObjectHeader((PVOID*)>ObjectHeader, 0, NULL, 
Irp, );
@@ -404,6 +407,7 @@
 if (!NT_SUCCESS(Status))
 {
 /* failed */
+FreeItem(ClockCreate);
 FreeItem(Clock);
 return Status;
 }




[ros-diffs] [pschweitzer] 73831: [FASTFAT] Get rid of the ENTRY_DELETED2, ENTRY_VOLUME2 and ENTRY_END2 macros.

2017-02-18 Thread pschweitzer
Author: pschweitzer
Date: Sat Feb 18 21:37:56 2017
New Revision: 73831

URL: http://svn.reactos.org/svn/reactos?rev=73831=rev
Log:
[FASTFAT]
Get rid of the ENTRY_DELETED2, ENTRY_VOLUME2 and ENTRY_END2 macros.

Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
trunk/reactos/drivers/filesystems/fastfat/dirwr.c
trunk/reactos/drivers/filesystems/fastfat/fcb.c
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h
trunk/reactos/drivers/filesystems/fastfat/volume.c

Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/create.c?rev=73831=73830=73831=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/create.c  [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c  [iso-8859-1] Sat Feb 18 
21:37:56 2017
@@ -115,6 +115,7 @@
 UNICODE_STRING PathNameU;
 UNICODE_STRING FileToFindUpcase;
 BOOLEAN WildCard;
+BOOLEAN IsFatX = vfatVolumeIsFatX(DeviceExt);
 
 DPRINT("FindFile(Parent %p, FileToFind '%wZ', DirIndex: %u)\n",
Parent, FileToFindU, DirContext->DirIndex);
@@ -151,7 +152,7 @@
 if (rcFcb)
 {
 ULONG startIndex = rcFcb->startIndex;
-if (vfatVolumeIsFatX(DeviceExt) && !vfatFCBIsRoot(Parent))
+if (IsFatX && !vfatFCBIsRoot(Parent))
 {
 startIndex += 2;
 }
@@ -194,7 +195,7 @@
 {
 break;
 }
-if (ENTRY_VOLUME(DeviceExt, >DirEntry))
+if (ENTRY_VOLUME(IsFatX, >DirEntry))
 {
 DirContext->DirIndex++;
 continue;

Modified: trunk/reactos/drivers/filesystems/fastfat/dirwr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/dirwr.c?rev=73831=73830=73831=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/dirwr.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/dirwr.c   [iso-8859-1] Sat Feb 18 
21:37:56 2017
@@ -161,9 +161,10 @@
 PVOID Context = NULL;
 NTSTATUS Status;
 ULONG SizeDirEntry;
+BOOLEAN IsFatX = vfatVolumeIsFatX(DeviceExt);
 FileOffset.QuadPart = 0;
 
-if (vfatVolumeIsFatX(DeviceExt))
+if (IsFatX)
 SizeDirEntry = sizeof(FATX_DIR_ENTRY);
 else
 SizeDirEntry = sizeof(FAT_DIR_ENTRY);
@@ -190,11 +191,11 @@
 
 FileOffset.u.LowPart += DeviceExt->FatInfo.BytesPerCluster;
 }
-if (ENTRY_END(DeviceExt, pFatEntry))
+if (ENTRY_END(IsFatX, pFatEntry))
 {
 break;
 }
-if (ENTRY_DELETED(DeviceExt, pFatEntry))
+if (ENTRY_DELETED(IsFatX, pFatEntry))
 {
 nbFree++;
 }
@@ -249,7 +250,7 @@
 }
 _SEH2_END;
 
-if (vfatVolumeIsFatX(DeviceExt))
+if (IsFatX)
 memset(pFatEntry, 0xff, DeviceExt->FatInfo.BytesPerCluster);
 else
 RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster);
@@ -268,7 +269,7 @@
 }
 _SEH2_END;
 
-if (vfatVolumeIsFatX(DeviceExt))
+if (IsFatX)
 memset(pFatEntry, 0xff, SizeDirEntry);
 else
 RtlZeroMemory(pFatEntry, SizeDirEntry);

Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fcb.c?rev=73831=73830=73831=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Sat Feb 18 
21:37:56 2017
@@ -778,6 +778,7 @@
 WCHAR ShortNameBuffer[13];
 BOOLEAN FoundLong = FALSE;
 BOOLEAN FoundShort = FALSE;
+BOOLEAN IsFatX = vfatVolumeIsFatX(pDeviceExt);
 
 ASSERT(pDeviceExt);
 ASSERT(pDirectoryFCB);
@@ -816,7 +817,7 @@
 DPRINT("  Index:%u  longName:%wZ\n",
DirContext.DirIndex, );
 
-if (!ENTRY_VOLUME(pDeviceExt, ))
+if (!ENTRY_VOLUME(IsFatX, ))
 {
 if (DirContext.LongNameU.Length == 0 ||
 DirContext.ShortNameU.Length == 0)

Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fsctl.c?rev=73831=73830=73831=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] Sat Feb 18 
21:37:56 2017
@@ -431,7 +431,7 @@
 {
 while (TRUE)
 {
-if (ENTRY_VOLUME2(IsFatX, 

[ros-diffs] [pschweitzer] 73830: [FASTFAT] Modify ReadVolumeLabel() so that it is able to read the volume label, even without using the VCB, the root FCB, Cc, the universe. This is important, because

2017-02-18 Thread pschweitzer
Author: pschweitzer
Date: Sat Feb 18 21:24:31 2017
New Revision: 73830

URL: http://svn.reactos.org/svn/reactos?rev=73830=rev
Log:
[FASTFAT]
Modify ReadVolumeLabel() so that it is able to read the volume label, even 
without using the VCB, the root FCB, Cc, the universe.
This is important, because in case of device verifying, you cannot rely on 
these elements anylonger, but you need to read the label.
A readme has been attached to the function, to indicate how to call it (I wish 
I could have put more asserts!). It's ugly, I know.

This allows fixing a FIXME in VfatVerify(): we can also check the volume label 
for FATX volumes.
The FIXME comment was misleading: MS FastFAT doesn't make any checksum or 
whatever of FAT root. Let's not do it.

Modified:
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h

Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fsctl.c?rev=73830=73829=73830=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] Sat Feb 18 
21:24:31 2017
@@ -340,31 +340,38 @@
 
 /*
  * FUNCTION: Read the volume label
+ * WARNING: Read this comment carefully before using it (and using it wrong)
+ * Device parameter is expected to be the lower DO is start isn't 0
+ *  otherwise, it is expected to be the VCB is start is 0
+ * Start parameter is expected to be, in bytes, the beginning of the root 
start.
+ * Set it to 0 if you wish to use the associated FCB with 
caching.
+ * In that specific case, Device parameter is expected to be 
the VCB!
+ * VolumeLabel parameter is expected to be a preallocated UNICODE_STRING (ie, 
with buffer)
+ *   Its buffer has to be able to contain 
MAXIMUM_VOLUME_LABEL_LENGTH bytes 
  */
 static
 NTSTATUS
 ReadVolumeLabel(
-PDEVICE_EXTENSION DeviceExt,
-PVPB Vpb)
+PVOID Device,
+ULONG Start,
+BOOLEAN IsFatX,
+PUNICODE_STRING VolumeLabel)
 {
+PDEVICE_EXTENSION DeviceExt;
+PDEVICE_OBJECT DeviceObject;
 PVOID Context = NULL;
 ULONG DirIndex = 0;
 PDIR_ENTRY Entry;
 PVFATFCB pFcb;
 LARGE_INTEGER FileOffset;
-UNICODE_STRING NameU;
 ULONG SizeDirEntry;
 ULONG EntriesPerPage;
 OEM_STRING StringO;
+BOOLEAN NoCache = (Start != 0);
+PVOID Buffer;
 NTSTATUS Status = STATUS_SUCCESS;
 
-NameU.Buffer = Vpb->VolumeLabel;
-NameU.Length = 0;
-NameU.MaximumLength = sizeof(Vpb->VolumeLabel);
-*(Vpb->VolumeLabel) = 0;
-Vpb->VolumeLabelLength = 0;
-
-if (vfatVolumeIsFatX(DeviceExt))
+if (IsFatX)
 {
 SizeDirEntry = sizeof(FATX_DIR_ENTRY);
 EntriesPerPage = FATX_ENTRIES_PER_PAGE;
@@ -375,41 +382,71 @@
 EntriesPerPage = FAT_ENTRIES_PER_PAGE;
 }
 
-ExAcquireResourceExclusiveLite(>DirResource, TRUE);
-pFcb = vfatOpenRootFCB(DeviceExt);
-ExReleaseResourceLite(>DirResource);
-
-FileOffset.QuadPart = 0;
-_SEH2_TRY
-{
-CcMapData(pFcb->FileObject, , SizeDirEntry, MAP_WAIT, 
, (PVOID*));
-}
-_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-{
-Status = _SEH2_GetExceptionCode();
-}
-_SEH2_END;
+FileOffset.QuadPart = Start;
+if (!NoCache)
+{
+DeviceExt = Device;
+
+/* FIXME: Check we really have a VCB
+ASSERT();
+*/
+
+ExAcquireResourceExclusiveLite(>DirResource, TRUE);
+pFcb = vfatOpenRootFCB(DeviceExt);
+ExReleaseResourceLite(>DirResource);
+
+_SEH2_TRY
+{
+CcMapData(pFcb->FileObject, , SizeDirEntry, MAP_WAIT, 
, (PVOID*));
+}
+_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+{
+Status = _SEH2_GetExceptionCode();
+}
+_SEH2_END;
+}
+else
+{
+DeviceObject = Device;
+
+ASSERT(DeviceObject->Type == 3);
+
+Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, TAG_VFAT);
+if (Buffer != NULL)
+{
+Status = VfatReadDisk(DeviceObject, , PAGE_SIZE, 
(PUCHAR)Buffer, TRUE);
+if (!NT_SUCCESS(Status))
+{
+ExFreePoolWithTag(Entry, TAG_VFAT);
+}
+Entry = Buffer;
+}
+else
+{
+Status = STATUS_INSUFFICIENT_RESOURCES;
+}
+}
+
 if (NT_SUCCESS(Status))
 {
 while (TRUE)
 {
-if (ENTRY_VOLUME(DeviceExt, Entry))
+if (ENTRY_VOLUME2(IsFatX, Entry))
 {
 /* copy volume label */
-if (vfatVolumeIsFatX(DeviceExt))
+if (IsFatX)
 {
 StringO.Buffer = (PCHAR)Entry->FatX.Filename;
 

[ros-diffs] [pschweitzer] 73829: [FASTFAT] Move ReadVolumeLabel() to fsctl.c close to functions that need it

2017-02-18 Thread pschweitzer
Author: pschweitzer
Date: Sat Feb 18 18:35:48 2017
New Revision: 73829

URL: http://svn.reactos.org/svn/reactos?rev=73829=rev
Log:
[FASTFAT]
Move ReadVolumeLabel() to fsctl.c close to functions that need it

Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h

Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/create.c?rev=73829=73828=73829=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/create.c  [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c  [iso-8859-1] Sat Feb 18 
18:35:48 2017
@@ -95,114 +95,6 @@
 }
 
 /*
- * FUNCTION: Read the volume label
- */
-NTSTATUS
-ReadVolumeLabel(
-PDEVICE_EXTENSION DeviceExt,
-PVPB Vpb)
-{
-PVOID Context = NULL;
-ULONG DirIndex = 0;
-PDIR_ENTRY Entry;
-PVFATFCB pFcb;
-LARGE_INTEGER FileOffset;
-UNICODE_STRING NameU;
-ULONG SizeDirEntry;
-ULONG EntriesPerPage;
-OEM_STRING StringO;
-NTSTATUS Status = STATUS_SUCCESS;
-
-NameU.Buffer = Vpb->VolumeLabel;
-NameU.Length = 0;
-NameU.MaximumLength = sizeof(Vpb->VolumeLabel);
-*(Vpb->VolumeLabel) = 0;
-Vpb->VolumeLabelLength = 0;
-
-if (vfatVolumeIsFatX(DeviceExt))
-{
-SizeDirEntry = sizeof(FATX_DIR_ENTRY);
-EntriesPerPage = FATX_ENTRIES_PER_PAGE;
-}
-else
-{
-SizeDirEntry = sizeof(FAT_DIR_ENTRY);
-EntriesPerPage = FAT_ENTRIES_PER_PAGE;
-}
-
-ExAcquireResourceExclusiveLite(>DirResource, TRUE);
-pFcb = vfatOpenRootFCB(DeviceExt);
-ExReleaseResourceLite(>DirResource);
-
-FileOffset.QuadPart = 0;
-_SEH2_TRY
-{
-CcMapData(pFcb->FileObject, , SizeDirEntry, MAP_WAIT, 
, (PVOID*));
-}
-_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-{
-Status = _SEH2_GetExceptionCode();
-}
-_SEH2_END;
-if (NT_SUCCESS(Status))
-{
-while (TRUE)
-{
-if (ENTRY_VOLUME(DeviceExt, Entry))
-{
-/* copy volume label */
-if (vfatVolumeIsFatX(DeviceExt))
-{
-StringO.Buffer = (PCHAR)Entry->FatX.Filename;
-StringO.MaximumLength = StringO.Length = 
Entry->FatX.FilenameLength;
-RtlOemStringToUnicodeString(, , FALSE);
-}
-else
-{
-vfat8Dot3ToString(>Fat, );
-}
-Vpb->VolumeLabelLength = NameU.Length;
-break;
-}
-if (ENTRY_END(DeviceExt, Entry))
-{
-break;
-}
-DirIndex++;
-Entry = (PDIR_ENTRY)((ULONG_PTR)Entry + SizeDirEntry);
-if ((DirIndex % EntriesPerPage) == 0)
-{
-CcUnpinData(Context);
-FileOffset.u.LowPart += PAGE_SIZE;
-_SEH2_TRY
-{
-CcMapData(pFcb->FileObject, , SizeDirEntry, 
MAP_WAIT, , (PVOID*));
-}
-_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-{
-Status = _SEH2_GetExceptionCode();
-}
-_SEH2_END;
-if (!NT_SUCCESS(Status))
-{
-Context = NULL;
-break;
-}
-}
-}
-if (Context)
-{
-CcUnpinData(Context);
-}
-}
-ExAcquireResourceExclusiveLite(>DirResource, TRUE);
-vfatReleaseFCB(DeviceExt, pFcb);
-ExReleaseResourceLite(>DirResource);
-
-return STATUS_SUCCESS;
-}
-
-/*
  * FUNCTION: Find a file
  */
 NTSTATUS

Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fsctl.c?rev=73829=73828=73829=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c   [iso-8859-1] Sat Feb 18 
18:35:48 2017
@@ -338,6 +338,115 @@
 return Status;
 }
 
+/*
+ * FUNCTION: Read the volume label
+ */
+static
+NTSTATUS
+ReadVolumeLabel(
+PDEVICE_EXTENSION DeviceExt,
+PVPB Vpb)
+{
+PVOID Context = NULL;
+ULONG DirIndex = 0;
+PDIR_ENTRY Entry;
+PVFATFCB pFcb;
+LARGE_INTEGER FileOffset;
+UNICODE_STRING NameU;
+ULONG SizeDirEntry;
+ULONG EntriesPerPage;
+OEM_STRING StringO;
+NTSTATUS Status = STATUS_SUCCESS;
+
+NameU.Buffer = Vpb->VolumeLabel;
+NameU.Length = 0;
+NameU.MaximumLength = sizeof(Vpb->VolumeLabel);
+*(Vpb->VolumeLabel) = 0;
+Vpb->VolumeLabelLength = 0;
+
+if 

[ros-diffs] [gadamopoulos] 73828: [DESK.CPL] -Apparently the second parameter of ApplyTheme is not a string. One case is that it is not a pointer and another case that it is a pointer to a struct. Wha

2017-02-18 Thread gadamopoulos
Author: gadamopoulos
Date: Sat Feb 18 18:14:32 2017
New Revision: 73828

URL: http://svn.reactos.org/svn/reactos?rev=73828=rev
Log:
[DESK.CPL] -Apparently the second parameter of ApplyTheme is not a string. One 
case is that it is not a pointer and another case that it is a pointer to a 
struct. What I'm sure of is that as it is now the position of the string in the 
binary affects the behavior of ApplyTheme. Thankfully 0 works great on windows.

Modified:
trunk/reactos/dll/cpl/desk/theme.c

Modified: trunk/reactos/dll/cpl/desk/theme.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/theme.c?rev=73828=73827=73828=diff
==
--- trunk/reactos/dll/cpl/desk/theme.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/theme.c  [iso-8859-1] Sat Feb 18 18:14:32 2017
@@ -879,7 +879,7 @@
 if (!SUCCEEDED(hret)) return FALSE;
 }
 
-hret = ApplyTheme(hThemeFile, "", 0);
+hret = ApplyTheme(hThemeFile, 0, 0);
 
 if (pSelectedTheme->ThemeActive)
 {




[ros-diffs] [tfaber] 73827: [KMTESTS:MM] - Add some stricter checks and improved error handling in NtCreateSection_user

2017-02-18 Thread tfaber
Author: tfaber
Date: Sat Feb 18 14:22:44 2017
New Revision: 73827

URL: http://svn.reactos.org/svn/reactos?rev=73827=rev
Log:
[KMTESTS:MM]
- Add some stricter checks and improved error handling in NtCreateSection_user

Modified:
trunk/rostests/kmtests/ntos_mm/NtCreateSection_user.c

Modified: trunk/rostests/kmtests/ntos_mm/NtCreateSection_user.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/NtCreateSection_user.c?rev=73827=73826=73827=diff
==
--- trunk/rostests/kmtests/ntos_mm/NtCreateSection_user.c   [iso-8859-1] 
(original)
+++ trunk/rostests/kmtests/ntos_mm/NtCreateSection_user.c   [iso-8859-1] 
Sat Feb 18 14:22:44 2017
@@ -33,7 +33,9 @@
 Status = NtCreateSection(, SECTION_ALL_ACCESS, 0, 
,
  PAGE_READWRITE, SEC_COMMIT, Handle);
 ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
-NtClose(Handle);
+if (NT_SUCCESS(Status)) NtClose(SectionHandle);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 1 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -57,9 +59,12 @@
 memset(Buffer, 0xBA, 512);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 2 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -83,9 +88,12 @@
 memset(Buffer, 0xBA, 4096);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 3 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -109,9 +117,12 @@
 memset(Buffer, 0xBA, 512);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 4 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -135,9 +146,12 @@
 memset(Buffer, 0xBA, 4096);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 10 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -149,7 +163,9 @@
 Status = NtCreateSection(, SECTION_ALL_ACCESS, 0, 
,
  PAGE_READWRITE, SEC_COMMIT, Handle);
 ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
-NtClose(Handle);
+if (NT_SUCCESS(Status)) NtClose(SectionHandle);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 11 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -173,9 +189,12 @@
 memset(Buffer, 0xBA, 512);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 12 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -199,9 +218,12 @@
 memset(Buffer, 0xBA, 4096);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-NtClose(SectionHandle);
-NtClose(Handle);
+Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(SectionHandle);
+ok_eq_hex(Status, STATUS_SUCCESS);
+Status = NtClose(Handle);
+ok_eq_hex(Status, STATUS_SUCCESS);
 
 /* Test 13 */
 InitializeObjectAttributes(, , 
OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -225,9 +247,12 @@
 memset(Buffer, 0xBA, 512);
 KmtEndSeh(STATUS_SUCCESS);
 
-NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
-  

[ros-diffs] [tfaber] 73826: [USBSTOR] - Fix a broken assert (yes, calling NTOHL is wrong, ContiguousLogicBlocksByte0 is the MSB). CID 701077

2017-02-18 Thread tfaber
Author: tfaber
Date: Sat Feb 18 11:47:40 2017
New Revision: 73826

URL: http://svn.reactos.org/svn/reactos?rev=73826=rev
Log:
[USBSTOR]
- Fix a broken assert (yes, calling NTOHL is wrong, ContiguousLogicBlocksByte0 
is the MSB). CID 701077

Modified:
trunk/reactos/drivers/usb/usbstor/scsi.c

Modified: trunk/reactos/drivers/usb/usbstor/scsi.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbstor/scsi.c?rev=73826=73825=73826=diff
==
--- trunk/reactos/drivers/usb/usbstor/scsi.c[iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbstor/scsi.c[iso-8859-1] Sat Feb 18 
11:47:40 2017
@@ -1201,7 +1201,7 @@
 // sanity check
 //
 Temp = (Cmd.ContiguousLogicBlocksByte0 << 8 | 
Cmd.ContiguousLogicBlocksByte1);
-ASSERT(NTOHL(Temp == BlockCount));
+ASSERT(Temp == BlockCount);
 
 DPRINT("USBSTOR_SendReadWrite BlockAddress %x%x%x%x BlockCount %lu 
BlockLength %lu\n", Cmd.LogicalBlockByte0, Cmd.LogicalBlockByte1, 
Cmd.LogicalBlockByte2, Cmd.LogicalBlockByte3, BlockCount, 
PDODeviceExtension->BlockLength);
 




[ros-diffs] [mjansen] 73825: [GDI32_APITEST] Add tests for GetFontResourceInfoW. Patch by Katayama Hirofumi MZ. CORE-6621

2017-02-18 Thread mjansen
Author: mjansen
Date: Sat Feb 18 11:25:31 2017
New Revision: 73825

URL: http://svn.reactos.org/svn/reactos?rev=73825=rev
Log:
[GDI32_APITEST] Add tests for GetFontResourceInfoW. Patch by Katayama Hirofumi 
MZ. CORE-6621

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

Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists.txt?rev=73825=73824=73825=diff
==
--- trunk/rostests/apitests/gdi32/CMakeLists.txt[iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CMakeLists.txt[iso-8859-1] Sat Feb 18 
11:25:31 2017
@@ -44,6 +44,7 @@
 GetCurrentObject.c
 GetDIBColorTable.c
 GetDIBits.c
+GetFontResourceInfoW.c
 GetGlyphIndices.c
 GetObject.c
 GetRandomRgn.c

Added: trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c?rev=73825
==
--- trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c(added)
+++ trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c[iso-8859-1] 
Sat Feb 18 11:25:31 2017
@@ -0,0 +1,433 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Test for GetFontResourceInfoW
+ * PROGRAMMERS: Katayama Hirofumi MZ 
+ */
+#include 
+#include 
+#include 
+#include 
+
+/* GetFontResourceInfoW is undocumented */
+BOOL WINAPI GetFontResourceInfoW(LPCWSTR lpFileName, DWORD *pdwBufSize, void* 
lpBuffer, DWORD dwType);
+
+/* structure of test entry */
+typedef struct GFRI_ENTRY
+{
+LPCWSTR File;
+WCHAR   FontInfo[64];
+INT FontCount;
+WCHAR   FaceNames[10][64];
+} GFRI_ENTRY;
+
+/* 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" } }
+};
+
+/* Japanese */
+static const GFRI_ENTRY AdditionalTestEntriesJapanese[] =
+{
+{
+/* MS Gothic & MS UI Gothic & MS PGothic */
+L"msgothic.ttc",
+{
+0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x0020,
+0x0026, 0x0020, 0x004D, 0x0053, 0x0020, 0x0055, 0x0049, 0x0020,
+0x0047, 0x006F, 0x0074, 0x0068, 0x0069, 0x0063, 0x0020, 0x0026,
+0x0020, 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3,
+0x30AF, L'|', 0
+},
+6,
+{
+{ 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 },
+{ L'@', 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 
},
+L"MS UI Gothic",
+L"@MS UI Gothic",
+{ 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 
0 },
+{ L'@', 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 
0x30AF, 0 }
+}
+}
+};
+
+/* English */
+static const GFRI_ENTRY AdditionalTestEntriesEnglish[] =
+{
+{
+/* MS Gothic & MS UI Gothic & MS PGothic */
+L"msgothic.ttc",
+L"MS Gothic & MS UI Gothic & MS PGothic|",
+6,
+{
+L"MS Gothic",
+L"@MS Gothic",
+L"MS UI Gothic",
+L"@MS UI Gothic",
+L"MS PGothic",
+L"@MS PGothic"
+}
+}
+};
+
+static void
+GetSystemFontDirectory(LPWSTR pszDir)
+{
+GetWindowsDirectoryW(pszDir, MAX_PATH);
+lstrcatW(pszDir, L"\\Fonts");
+}
+
+static void
+GetSystemFontPath(LPWSTR pszPath, LPCWSTR pszFile)
+{
+GetSystemFontDirectory(pszPath);
+lstrcatW(pszPath, L"\\");
+lstrcatW(pszPath, pszFile);
+}
+
+static INT
+GetMultiSzLength(const WCHAR *pszz)
+{
+INT Len, TotalLen = 0;
+for (;;)
+{
+Len = lstrlenW(pszz);
+TotalLen += Len + 1;
+pszz += Len + 1;
+if (*pszz == 0)
+break;
+}
+++TotalLen;
+return TotalLen;
+}
+
+static void
+ReplaceChars(WCHAR *pch, INT Len, WCHAR From, WCHAR To)
+{
+while (Len > 0)
+{
+if (*pch == From)
+{
+*pch = To;
+}
+//printf("0x%04X, ", *pch);
+++pch;
+--Len;
+}
+}
+
+static void
+SzFromMultiSz(WCHAR *pszz)
+{
+INT Length = GetMultiSzLength(pszz);
+//printf("Length: %d\n", Length);
+if (Length > 0)
+{
+ReplaceChars(pszz, Length - 1, L'\0', L'|');
+pszz[Length - 1] = 0;
+}
+else
+{
+pszz[0] = 0;
+}
+//printf("pszz: %S\n", pszz);
+}
+
+static void
+Test_GetFontResourceInfoW_case0(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry)
+{
+BOOL 

[ros-diffs] [tfaber] 73824: [PSDK] - Fix KsFilterFactoryGetDevice CORE-11794

2017-02-18 Thread tfaber
Author: tfaber
Date: Sat Feb 18 09:30:59 2017
New Revision: 73824

URL: http://svn.reactos.org/svn/reactos?rev=73824=rev
Log:
[PSDK]
- Fix KsFilterFactoryGetDevice
CORE-11794

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

Modified: trunk/reactos/sdk/include/psdk/ks.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/ks.h?rev=73824=73823=73824=diff
==
--- trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] Sat Feb 18 09:30:59 2017
@@ -5064,10 +5064,20 @@
 
 _IRQL_requires_max_(PASSIVE_LEVEL)
 KSDDKAPI
+PKSDEVICE
+NTAPI
+KsGetDevice(
+  _In_ PVOID Object);
+
+_IRQL_requires_max_(PASSIVE_LEVEL)
+static
 __inline
 PKSDEVICE
 KsFilterFactoryGetDevice(
-  _In_ PKSFILTERFACTORY FilterFactory);
+  _In_ PKSFILTERFACTORY FilterFactory)
+{
+return KsGetDevice((PVOID)FilterFactory);
+}
 
 /* etc. */
 #endif /* avstream */