Lines 43-48
Link Here
|
43 |
public String field_5_ole_classname; // Classname of the embedded OLE document (e.g. Word.Document.8) |
43 |
public String field_5_ole_classname; // Classname of the embedded OLE document (e.g. Word.Document.8) |
44 |
public int field_6_stream_id; // ID of the OLE stream containing the actual data. |
44 |
public int field_6_stream_id; // ID of the OLE stream containing the actual data. |
45 |
|
45 |
|
|
|
46 |
private int field_5_ole_classname_padding; // developer laziness... |
47 |
|
46 |
public EmbeddedObjectRefSubRecord() |
48 |
public EmbeddedObjectRefSubRecord() |
47 |
{ |
49 |
{ |
48 |
} |
50 |
} |
Lines 93-101
Link Here
|
93 |
|
95 |
|
94 |
// Padded with NUL bytes. The -2 is because field_1_stream_id_offset |
96 |
// Padded with NUL bytes. The -2 is because field_1_stream_id_offset |
95 |
// is relative to after the offset field, whereas in.getRecordOffset() |
97 |
// is relative to after the offset field, whereas in.getRecordOffset() |
96 |
// is relative to the start of this record. |
98 |
// is relative to the start of this record (minus the header.) |
|
|
99 |
field_5_ole_classname_padding = 0; |
97 |
while (in.getRecordOffset() - 2 < field_1_stream_id_offset) |
100 |
while (in.getRecordOffset() - 2 < field_1_stream_id_offset) |
98 |
{ |
101 |
{ |
|
|
102 |
field_5_ole_classname_padding++; |
99 |
in.readByte(); // discard |
103 |
in.readByte(); // discard |
100 |
} |
104 |
} |
101 |
|
105 |
|
Lines 106-111
Link Here
|
106 |
{ |
110 |
{ |
107 |
int pos = offset; |
111 |
int pos = offset; |
108 |
|
112 |
|
|
|
113 |
LittleEndian.putShort(data, pos, sid); pos += 2; |
114 |
LittleEndian.putShort(data, pos, (short)(getRecordSize() - 4)); pos += 2; |
115 |
|
109 |
LittleEndian.putShort(data, pos, field_1_stream_id_offset); pos += 2; |
116 |
LittleEndian.putShort(data, pos, field_1_stream_id_offset); pos += 2; |
110 |
LittleEndian.putShortArray(data, pos, field_2_unknown); pos += field_2_unknown.length * 2 + 2; |
117 |
LittleEndian.putShortArray(data, pos, field_2_unknown); pos += field_2_unknown.length * 2 + 2; |
111 |
LittleEndian.putShort(data, pos, field_3_unicode_len); pos += 2; |
118 |
LittleEndian.putShort(data, pos, field_3_unicode_len); pos += 2; |
Lines 120-128
Link Here
|
120 |
StringUtil.putCompressedUnicode( field_5_ole_classname, data, pos ); pos += field_5_ole_classname.length(); |
127 |
StringUtil.putCompressedUnicode( field_5_ole_classname, data, pos ); pos += field_5_ole_classname.length(); |
121 |
} |
128 |
} |
122 |
|
129 |
|
123 |
// Padded with NUL bytes. |
130 |
// Padded with the same number of NUL bytes as were originally skipped. |
124 |
pos = field_1_stream_id_offset; |
131 |
// XXX: This is only accurate until we make the classname mutable. |
125 |
|
132 |
pos += field_5_ole_classname_padding; |
|
|
133 |
|
126 |
LittleEndian.putInt(data, pos, field_6_stream_id); pos += 4; |
134 |
LittleEndian.putInt(data, pos, field_6_stream_id); pos += 4; |
127 |
|
135 |
|
128 |
return getRecordSize(); |
136 |
return getRecordSize(); |
Lines 133-140
Link Here
|
133 |
*/ |
141 |
*/ |
134 |
public int getRecordSize() |
142 |
public int getRecordSize() |
135 |
{ |
143 |
{ |
136 |
// Conveniently this stores the length of all the crap before the final int value. |
144 |
// The stream id offset is relative to after the stream ID. |
137 |
return field_1_stream_id_offset + 4; |
145 |
// Add 2 bytes for the stream id offset and 4 bytes for the stream id itself. |
|
|
146 |
return field_1_stream_id_offset + 2 + 4; |
138 |
} |
147 |
} |
139 |
|
148 |
|
140 |
/** |
149 |
/** |