Re: [ros-dev] [ros-diffs] [hbelusca] 71829: [CLIPBRD]: Use NULL for null pointer. [EVENTVWR]: Add folder icons (needed for later).

2016-07-05 Thread Thomas Faber
Can't event viewer load those icons from shell32 (much like regedit
should)?

On 2016-07-06 01:42, hbelu...@svn.reactos.org wrote:
> Author: hbelusca
> Date: Tue Jul  5 23:42:40 2016
> New Revision: 71829
> 
> URL: http://svn.reactos.org/svn/reactos?rev=71829=rev
> Log:
> [CLIPBRD]: Use NULL for null pointer.
> [EVENTVWR]: Add folder icons (needed for later).
> 
> Added:
> trunk/reactos/base/applications/mscutils/eventvwr/res/folder.ico
>   - copied unchanged from r71828, 
> trunk/reactos/base/applications/regedit/res/folder.ico
> trunk/reactos/base/applications/mscutils/eventvwr/res/folderopen.ico
>   - copied unchanged from r71828, 
> trunk/reactos/base/applications/regedit/res/folderopen.ico
> Modified:
> trunk/reactos/base/applications/clipbrd/clipbrd.c
> 
> Modified: trunk/reactos/base/applications/clipbrd/clipbrd.c
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/clipbrd.c?rev=71829=71828=71829=diff
> ==
> --- trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] (original)
> +++ trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] Tue Jul  5 
> 23:42:40 2016
> @@ -256,12 +256,12 @@
>  
>  case CMD_ABOUT:
>  {
> +HICON hIcon;
>  WCHAR szTitle[MAX_STRING_LEN];
> -HICON hIcon;
>  
>  hIcon = LoadIconW(Globals.hInstance, 
> MAKEINTRESOURCE(CLIPBRD_ICON));
>  LoadStringW(Globals.hInstance, STRING_CLIPBOARD, szTitle, 
> ARRAYSIZE(szTitle));
> -ShellAboutW(Globals.hMainWnd, szTitle, 0, hIcon);
> +ShellAboutW(Globals.hMainWnd, szTitle, NULL, hIcon);
>  DeleteObject(hIcon);
>  break;
>  }
> 
> 


___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Re: [ros-dev] [ros-diffs] [zhu] 71823: Fixed crash on client and server exit: Corrected some NULL data marking and checking. Moved some cleanup code so they actually execute on function failure (incom

2016-07-05 Thread Thomas Faber
Comments inline.

On 2016-07-05 20:35, z...@svn.reactos.org wrote:
> --- branches/GSoC_2016/lwIP-tcpip/drivers/network/tcpip/address.c 
> [iso-8859-1] (original)
> +++ branches/GSoC_2016/lwIP-tcpip/drivers/network/tcpip/address.c 
> [iso-8859-1] Tue Jul  5 18:35:17 2016
> @@ -357,15 +356,15 @@
>   
>   
> KeReleaseSpinLockFromDpcLevel(>RequestListLock);
>   
> - if (Context->lwip_tcp_pcb != 
> Context->AddressFile->lwip_tcp_pcb)
> + if (Context->lwip_tcp_pcb == 
> Context->AddressFile->lwip_tcp_pcb);

You really don't want a semicolon here ;)

>   {
> - tcp_close(Context->lwip_tcp_pcb);
> + Context->AddressFile->lwip_tcp_pcb = NULL;
>   }


> + if (!p)
> + {
> + CopiedLength = 0;
> + Status = STATUS_ADDRESS_CLOSED;
> + goto BAD;
> + }
>   
>   if (RemainingDestBytes <= p->len)
>   {
>   RtlCopyMemory(CurrentDestLocation, p->payload, 
> RemainingDestBytes);
>   CopiedLength = RemainingDestBytes;
> + Status = STATUS_SUCCESS;
>   goto RETURN;

We normally call labels things like "Exit" and "Failure".

> @@ -826,23 +846,24 @@
>   
>   tcp_recved(tpcb, CopiedLength);
>   

I find it confusing not to have Entry = Head->Flink right here. I'm not
sure where it is, but unless there's a good reason for it to be
somewhere else I'd recommend putting it right in front of the loop.

> + while (Entry != Head)
> + {
> + Request = CONTAINING_RECORD(Entry, TCP_REQUEST, ListEntry);

Entry = Entry->Flink? ;)

> + if (Request->PendingMode == TCP_REQUEST_PENDING_RECEIVE)
> + {
> + tcp_recv(tpcb, lwip_tcp_receive_callback);
> + break;
> + }
> + }





> @@ -1666,6 +1690,21 @@
>   if (!(IsListEmpty(>RequestListHead)))
>   {
>   DPRINT1("Disassociating context with outstanding requests\n");
> + Head = >RequestListHead;
> + Entry = Head->Flink;
> + while (Entry != Head)
> + {
> + Request = CONTAINING_RECORD(Entry, TCP_REQUEST, 
> ListEntry);

Entry = Entry->Flink;

> + if (Request->PendingIrp)
> + {
> + IrpSp = 
> IoGetCurrentIrpStackLocation(Request->PendingIrp);
> + DPRINT1("Pending IRP Control Code: %08x\n", 
> IrpSp->MinorFunction);
> + }
> + else
> + {
> + DPRINT1("IRP is NULL\n");
> + }
> + }
>   }
>   KeReleaseSpinLockFromDpcLevel(>RequestListLock);
>   


Thanks.
-Thomas

___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Re: [ros-dev] [ros-diffs] [tthompson] 71820: [NTFS] Add ability to write to resident attributes. SetAttributeDataLength() - Check if the file is memory mapped before truncating +InternalSetResidentAtt

2016-07-05 Thread Pierre Schweitzer
Hi,

Comments inline.

Le 05/07/2016 09:00, tthomp...@svn.reactos.org a écrit :
> 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=71820=71819=71820=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] 
> Tue Jul  5 07:00:43 2016
> @@ -170,6 +172,50 @@
>  return AttrRecord->Resident.ValueLength;
>  }
>  
> +void
> +InternalSetResidentAttributeLength(PNTFS_ATTR_CONTEXT AttrContext,
> +   PFILE_RECORD_HEADER FileRecord,
> +   ULONG AttrOffset,
> +   ULONG DataSize)
> +{
> +ULONG EndMarker = AttributeEnd;
> +ULONG FinalMarker = FILE_RECORD_END;
> +ULONG NextAttributeOffset;
> +ULONG Offset;
> +USHORT Padding;
> +
> +DPRINT("InternalSetResidentAttributeLength( %p, %p, %lu, %lu )\n", 
> AttrContext, FileRecord, AttrOffset, DataSize);
> +
> +// update ValueLength Field
> +AttrContext->Record.Resident.ValueLength = DataSize;
> +Offset = AttrOffset + FIELD_OFFSET(NTFS_ATTR_RECORD, 
> Resident.ValueLength);
> +RtlCopyMemory((PCHAR)FileRecord + Offset, , sizeof(ULONG));

That part looks a bit over-engineered to me and might be simplified
(like not using an intermediate var, nor RtlCopyMemory).
Cosmetic, I'd replace PCHAR by ULONG_PTR.
Same comment goes to code below doing basically the same thing.

> +
> +// calculate the record length and end marker offset
> +AttrContext->Record.Length = DataSize + 
> AttrContext->Record.Resident.ValueOffset;
> +NextAttributeOffset = AttrOffset + AttrContext->Record.Length;
> +
> +// Ensure NextAttributeOffset is aligned to an 8-byte boundary
> +if (NextAttributeOffset % 8 != 0)
> +{
> +Padding = 8 - (NextAttributeOffset % 8);
> +NextAttributeOffset += Padding;
> +AttrContext->Record.Length += Padding;
> +}
> +
> +// update the record length
> +Offset = AttrOffset + FIELD_OFFSET(NTFS_ATTR_RECORD, Length);
> +RtlCopyMemory((PCHAR)FileRecord + Offset, >Record.Length, 
> sizeof(ULONG));
> +
> +// write the end marker 
> +RtlCopyMemory((PCHAR)FileRecord + NextAttributeOffset, , 
> sizeof(ULONG));
> +
> +// write the final marker
> +Offset = NextAttributeOffset + sizeof(ULONG);
> +RtlCopyMemory((PCHAR)FileRecord + Offset, , sizeof(ULONG));
> +
> +FileRecord->BytesInUse = Offset + sizeof(ULONG);
> +}
>  
>  NTSTATUS
>  SetAttributeDataLength(PFILE_OBJECT FileObject,
> @@ -179,6 +225,18 @@
> PFILE_RECORD_HEADER FileRecord,
> PLARGE_INTEGER DataSize)
>  {
> +NTSTATUS Status = STATUS_SUCCESS;
> +
> +// are we truncating the file?
> +if (DataSize->QuadPart < AttributeDataLength(>Record)

Unless I'm blind, I'm not sure it builds.

> +{
> +if (!MmCanFileBeTruncated(FileObject->SectionObjectPointer, 
> (PLARGE_INTEGER)))
> +{
> +DPRINT1("Can't truncate a memory-mapped file!\n");
> +return STATUS_USER_MAPPED_FILE;
> +}
> +}
> +
>  if (AttrContext->Record.IsNonResident)
>  {
>  ULONG BytesPerCluster = Fcb->Vcb->NtfsInfo.BytesPerCluster;
> Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/volinfo.c
> URL: 
> http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/volinfo.c?rev=71820=71819=71820=diff
> ==
> --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/volinfo.c
> [iso-8859-1] (original)
> +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/volinfo.c
> [iso-8859-1] Tue Jul  5 07:00:43 2016
> @@ -158,7 +157,7 @@
>  DPRINT1("Total clusters in bitmap: %I64x\n", BitmapDataSize * 8);
>  DPRINT1("Diff in size: %I64d B\n", ((BitmapDataSize * 8) - 
> DeviceExt->NtfsInfo.ClusterCount) * DeviceExt->NtfsInfo.SectorsPerCluster * 
> DeviceExt->NtfsInfo.BytesPerSector);
>  
> -ReadAttribute(DeviceExt, DataContext, Read, 
> (PCHAR)((ULONG_PTR)BitmapData + Read), (ULONG)BitmapDataSize);
> +ReadAttribute(DeviceExt, DataContext, 0, (PCHAR)BitmapData, 
> (ULONG)BitmapDataSize);

What's this change?

>  
>  RtlInitializeBitMap(, (PULONG)BitmapData, 
> DeviceExt->NtfsInfo.ClusterCount);
>  FreeClusters = RtlNumberOfClearBits();
> 
> 


-- 
Pierre Schweitzer 
System & Network Administrator
Senior Kernel Developer
ReactOS Deutschland e.V.



smime.p7s
Description: Signature cryptographique S/MIME
___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev