File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,11 +314,11 @@ def _names(self, tokens: TokenConsumer) -> list[str]:
314314 tokens .eol ()
315315 break
316316
317- if tokens .next not in (self .TOK .NAME , self .TOK .DEFS ):
317+ if tokens .next not in (self .TOK .NAME , self .TOK .DEFS , self . TOK . IDENTIFIER ):
318318 break
319319
320320 ntoken = tokens .consume ()
321- if ntoken == self .TOK .NAME :
321+ if ntoken in ( self .TOK .NAME , self . TOK . IDENTIFIER ) :
322322 names .append (ntoken .value .strip ())
323323 elif ntoken == self .TOK .DEFS :
324324 names .extend ([name .strip () for name in ntoken .value .strip ().split ("," )])
Original file line number Diff line number Diff line change 77
88from dissect .cstruct .exceptions import ParserError
99from dissect .cstruct .parser import TokenParser
10- from dissect .cstruct .types import BaseArray , Pointer
10+ from dissect .cstruct .types import BaseArray , Pointer , Structure
1111from tests .utils import verify_compiled
1212
1313if TYPE_CHECKING :
@@ -150,3 +150,17 @@ def test_includes(cs: cstruct) -> None:
150150 assert len (cs .myStruct .fields ) == 1
151151 assert cs .myStruct .fields .get ("charVal" )
152152
153+
154+ def test_typedef_pointer (cs : cstruct ) -> None :
155+ cdef = """
156+ typedef struct _IMAGE_DATA_DIRECTORY {
157+ DWORD VirtualAddress;
158+ DWORD Size;
159+ } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
160+ """
161+ cs .load (cdef )
162+
163+ assert issubclass (cs ._IMAGE_DATA_DIRECTORY , Structure )
164+ assert cs .IMAGE_DATA_DIRECTORY is cs ._IMAGE_DATA_DIRECTORY
165+ assert issubclass (cs .PIMAGE_DATA_DIRECTORY , Pointer )
166+ assert cs .PIMAGE_DATA_DIRECTORY .type == cs ._IMAGE_DATA_DIRECTORY
You can’t perform that action at this time.
0 commit comments