Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1614:Still trouble in parsing complex structs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Eagle20
New Member

9 Posts

Posted - Oct 23 2007 :  10:40:28 PM  Show Profile  Reply with Quote
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;

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Oct 24 2007 :  08:08:40 AM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

Eagle20
New Member

9 Posts

Posted - Oct 24 2007 :  09:08:54 AM  Show Profile  Reply with Quote
Thanks a lot.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 24 2008 :  12:26:33 AM  Show Profile  Reply with Quote
case=4514 is fixed in build 1635
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000