Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1614:Still trouble in parsing complex structs

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Eagle20 Posted - Oct 23 2007 : 10:40:28 PM
I've tried many versions of VAX, but it's always exist.
For example in struct IRP(wdm.h, DDK)

PIRP Irp;
Irp->Tail.Overlay.CurrentStackLocation;

VAX does not parsing Overlay well, there is no 'CurrentStackLocation' in Overlay's members.

typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
CSHORT Type;
USHORT Size;
PMDL MdlAddress;
ULONG Flags;
union {
struct _IRP *MasterIrp;
__volatile LONG IrpCount;
PVOID SystemBuffer;
} AssociatedIrp;
LIST_ENTRY ThreadListEntry;
IO_STATUS_BLOCK IoStatus;
KPROCESSOR_MODE RequestorMode;
BOOLEAN PendingReturned;
CHAR StackCount;
CHAR CurrentLocation;
BOOLEAN Cancel;
KIRQL CancelIrql;
CCHAR ApcEnvironment;
UCHAR AllocationFlags;
PIO_STATUS_BLOCK UserIosb;
PKEVENT UserEvent;
union {
struct {
union {
PIO_APC_ROUTINE UserApcRoutine;
PVOID IssuingProcess;
};
PVOID UserApcContext;
} AsynchronousParameters;
LARGE_INTEGER AllocationSize;
} Overlay;
__volatile PDRIVER_CANCEL CancelRoutine;
PVOID UserBuffer;
union {
struct {
union {
KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
struct {
PVOID DriverContext[4];
} ;
} ;
PETHREAD Thread;
PCHAR AuxiliaryBuffer;
struct {
LIST_ENTRY ListEntry;
union {
struct _IO_STACK_LOCATION *CurrentStackLocation;
ULONG PacketType;
};
};
PFILE_OBJECT OriginalFileObject;
} Overlay;
KAPC Apc;
PVOID CompletionKey;
} Tail;
} IRP, *PIRP;

3   L A T E S T    R E P L I E S    (Newest First)
support Posted - Apr 24 2008 : 12:26:33 AM
case=4514 is fixed in build 1635
Eagle20 Posted - Oct 24 2007 : 09:08:54 AM
Thanks a lot.
feline Posted - Oct 24 2007 : 08:08:40 AM
That is definitely a complex structure. This is caused by:

case=4514

Deleting most of the structure, and changing to known types, to get a fairly simple test case, in this code VA will not suggest "CurrentStackLocation"

typedef struct _IRP {
	union {
		struct {
			struct {
				int ListEntry;
				union {
					int *CurrentStackLocation;
					int PacketType;
				};
			};
		} Overlay;
	} Tail;
} IRP, *PIRP;

static void useComplexStruct()
{
	PIRP Irp;
	Irp->Tail.Overlay.CurrentStackLocation;
}


To make this work add an optional name to the union, so the code becomes:

typedef struct _IRP {
	union {
		struct {
			struct {
				int ListEntry;
				union ANONYMOUS_UNION {
					int *CurrentStackLocation;
					int PacketType;
				};
			};
		} Overlay;
	} Tail;
} IRP, *PIRP;

static void useComplexStruct()
{
	PIRP Irp;
	Irp->Tail.Overlay.CurrentStackLocation;
}


This has the side effect of adding "ANONYMOUS_UNION" to the list of suggested members, but the missing members are now listed correctly.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000