[PATCH 3/4] include: Define IoSkipCurrentIrpStackLocation

Aric Stewart aric at codeweavers.com
Thu Oct 13 02:27:13 CDT 2016


On 10/13/16 9:09 AM, Alexandre Julliard wrote:
> Sebastian Lackner <sebastian at fds-team.de> writes:
> 
>> I assume you are looking at an old version then, and Microsoft fixed
>> this mistake in the meantime. Windows 10 header files contain for example:
>>
>> --- snip ---
>> FORCEINLINE
>> VOID
>> IoSkipCurrentIrpStackLocation (
>>     _Inout_ PIRP Irp
>> )
>> [...]
>> {
>>     NT_ASSERT(Irp->CurrentLocation <= Irp->StackCount);
>>     Irp->CurrentLocation++;
>>     Irp->Tail.Overlay.CurrentStackLocation++;
>> }
>> --- snip ---
>>
>> Nevertheless, I think both "{...}" and using an inline function is fine
>> in this case.
> 
> It should be either an inline function (preferred) or a "do {} while(0)"
> block. A "{...}" block will cause syntax errors in some cases.
> 

To do an inline function, which you prefer, would you like it in those  #ifdef blocks?

Like this?

#ifdef NONAMELESSUNION
# ifdef NONAMELESSSTRUCT
#  define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
#  define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
   inline void IoSkipCurrentIrpStackLocation(IRP *_Irp) {_Irp->Tail.Overlay.s.u2.CurrentStackLocation++; _Irp->CurrentLocation++;}
# else
...

-aric



More information about the wine-devel mailing list