wicked witch wrote: > >>>So it looks like a 2-byte count followed by an array of Pascal > >>>strings. > >> > >>Ah yes. And now that I see this I seem to remember that the pstrings > >>are padded to a 2-byte boundary. > > > > Hmmm, I'd be a bit surprised if there was such alignment padding. > > Pascal string lengths are one byte, so after the single integer > > listed above everything else should just be byte-aligned. > > > yeah you are right. Still it would be much easier with the > GetIndString method. Thx for your help. I implemented it in c++ this > time(was just a litle tool).
Here's a quick Python version: >>> import struct >>> def unpackStr(data): ... result = [] ... n, = struct.unpack(">H", data[:2]) ... data = data[2:] ... for i in range(n): ... l = ord(data[0]) ... result.append(data[1:1+l]) ... data = data[1+l:] ... return result ... >>> data = "\000\005\004abcd\000\002xy\01012345678\001z" >>> unpackStr(data) ['abcd', '', 'xy', '12345678', 'z'] >>> Just _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig