$res .= "}";
}
+#####################################################################
+# parse a struct
+sub HeaderEnum($$)
+{
+ my($enum) = shift;
+ my($name) = shift;
+ $res .= "\nenum $name {\n";
+ $tab_depth++;
+ my $els = \@{$enum->{ELEMENTS}};
+ foreach my $i (0 .. $#{$els}-1) {
+ my $e = ${$els}[$i];
+ tabs();
+ chomp $e;
+ $res .= "$e,\n";
+ }
+
+ my $e = ${$els}[$#{$els}];
+ tabs();
+ chomp $e;
+ $e =~ /^(.*?)\s*$/;
+ $res .= "$1\n";
+ $tab_depth--;
+ $res .= "}";
+}
+
#####################################################################
# parse a union element
my($union) = shift;
my($name) = shift;
(defined $union->{PROPERTIES}) && HeaderProperties($union->{PROPERTIES});
- $res .= "union $name {\n";
+ $res .= "\nunion $name {\n";
foreach my $e (@{$union->{DATA}}) {
HeaderUnionElement($e);
}
my($data) = shift;
my($name) = shift;
if (ref($data) eq "HASH") {
+ ($data->{TYPE} eq "ENUM") &&
+ HeaderEnum($data, $name);
($data->{TYPE} eq "STRUCT") &&
HeaderStruct($data, $name);
($data->{TYPE} eq "UNION") &&
}}
| <error?>
+enum: 'enum' <commit> '{' enum_element(s? /,/) '}'
+ {{
+ "TYPE" => "ENUM",
+ "ELEMENTS" => $item[4]
+ }}
+ | <error?>
+
+enum_element: /[\w\s=]+/
+
struct: property_list(s?) 'struct' <commit> '{' element_list1(?) '}'
{{
"TYPE" => "STRUCT",
| <error?>
union_element:
- '[' 'case' '(' constant ')' ']' base_element ';'
+ '[' 'case' '(' identifier ')' ']' base_element ';'
{{
"TYPE" => "UNION_ELEMENT",
- "CASE" => $item{constant},
+ "CASE" => $item{identifier},
"DATA" => $item{base_element}
}}
- | '[' 'case' '(' constant ')' ']' ';'
+ | '[' 'case' '(' identifier ')' ']' ';'
{{
"TYPE" => "EMPTY",
- "CASE" => $item{constant},
+ "CASE" => $item{identifier},
}}
| '[' 'default' ']' base_element ';'
{{
| 'in'
| 'out'
| 'ref'
- | 'context_handle'
- | 'string'
| 'public'
| 'noprint'
| 'relative'
| 'nodiscriminant'
| 'subcontext' '(' constant ')' {{ "$item[1]" => "$item{constant}" }}
| 'flag' '(' anytext ')' {{ "$item[1]" => "$item{anytext}" }}
- | 'byte_count_pointer' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'size_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'length_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'switch_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'value' '(' anytext ')' {{ "$item[1]" => "$item{anytext}" }}
- | 'switch_type' '(' type ')' {{ "$item[1]" => $item{type} }}
identifier: /[\w?]+/
| <error?>
type :
- 'unsigned' type { "$item[1] $item[2]" }
- | 'long' { $item[1] }
- | 'string' { $item[1] }
- | 'wchar_t' { $item[1] }
- | struct { $item[1] }
+ struct { $item[1] }
| union { $item[1] }
+ | enum { $item[1] }
| identifier { $item[1] }
| <error>
{{ "$item[1]+$item[3]" }}
| text2
-call: expression '(' <commit> expression ')'
- {{ "$item[1]($item[4])" }}
-
constant: /-?[\dx]+/
| '*'
samr_Name description;
} samr_GroupInfoDesciption;
+ typedef enum {
+ GroupInfoAll = 1,
+ GroupInfoName,
+ GroupInfoX,
+ GroupInfoDescription
+ } GroupInfo;
+
typedef union {
- [case(1)] samr_GroupInfoAll all;
- [case(2)] samr_GroupInfoName name;
- [case(3)] samr_GroupInfoX unknown;
- [case(4)] samr_GroupInfoDesciption description;
+ [case(GroupInfoAll)] samr_GroupInfoAll all;
+ [case(GroupInfoName)] samr_GroupInfoName name;
+ [case(GroupInfoX)] samr_GroupInfoX unknown;
+ [case(GroupInfoDescription)] samr_GroupInfoDesciption description;
} samr_GroupInfo;
NTSTATUS samr_QueryGroupInfo(