DO NOT REPLY [Bug 43376] - Macro code lost after edit a ppt file

2007-09-17 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=43376.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43376





--- Additional Comments From [EMAIL PROTECTED]  2007-09-17 11:54 ---
How interesting!

I was sure it's a lost POIFS entry. In Word and Excel macros do live
in POIFS! It turns out PPT is a different case (:.
 
Here is what I've found:
In PPT macros are stored in ExOleObjStg root-level records. I changed the macro
code, saved the ppt and compared it with the original. 
The only difference was in ExOleObjStg. Thanks to Trejkaz, now we have accessors
to this data.

Here is a test code to dump ExOleObjStg in filesystem:

FileInputStream fis = new FileInputStream(temp.ppt);
HSLFSlideShow hss = new HSLFSlideShow(fis);

ObjectData[] obj = hss.getEmbeddedObjects();
for (int i = 0; i  obj.length; i++) {
FileOutputStream out = new FileOutputStream(objdata- + (i+1) +
.dat);
InputStream is = obj[i].getData();
byte[] chunk = new byte[16184];
int count;
while ((count = is.read(chunk)) =0 ) {
  out.write(chunk,0,count);
}
out.close();
}

Look at it in a text editor and see that it is about macros :).
It looks like this data has a reference (offset) to the owning slide. If I don't
change anything, just re-save the ppt then the macros are there.
If I add a shape the macros are lost. So the task is to find this place
and update the link.

I don't know how to parse this abracadabra. Any ideas?
 AFAIK, VBA macros are stored as p-code + s-code where p-code is compiled VBA
code and s-code is the source. That is ExOleObjStg contains both compiled and
source VBA code. 

Useful links are 
http://www.virushelpmunic.de/konferenz/1999/makroviren/ (In German)
http://www.uinc.ru/articles/46/ (In Russian)

They are about Word and Excel and I hope these ideas are applicable to PPT.


Regards,
Yegor

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 43376] - Macro code lost after edit a ppt file

2007-09-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=43376.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43376


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




--- Additional Comments From [EMAIL PROTECTED]  2007-09-13 02:34 ---
It's possible the macros are stored in another stream, and we're not writing it
back out again

Could you upload a sample file, so we can take a look?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 43376] - Macro code lost after edit a ppt file

2007-09-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=43376.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43376





--- Additional Comments From [EMAIL PROTECTED]  2007-09-13 18:21 ---
Created an attachment (id=20823)
 -- (http://issues.apache.org/bugzilla/attachment.cgi?id=20823action=view)
here is the result file Generated by java


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]