Good evening. It sounds like you have a good one there. Lemme see what I can do to help. I'm not a pack ninja, but I see a few things that might be wrong. From the
MSDN documentation of TIME_ZONE_INFORMATION,
typedef struct _TIME_ZONE_INFORMATION {
LONG Bias;
WCHAR StandardName[ 32 ];
SYSTEMTIME StandardDate;
LONG StandardBias;
WCHAR DaylightName[ 32 ];
SYSTEMTIME DaylightDate;
LONG DaylightBias;
} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION;
You're looking at
Long, 32 Unicode characters, a structure, Long, 32 Unicode Characters, a structure, Long.
The
SYSTEMTIME structure is 8x16 bits, and that pack stucture looks right. However, where you seem to be going wrong is that you are packing a string where you should be packing the structure itself. Therefore, you are passing a packed string to the API function, and that probably isn't correct.
Should your pack string look like this:
$tz_struct = pack("LU32S8LU32S8L", 0, " " x 32,
unpack("S8",$systime_struct),0, " " x 32,
unpack("S8",$systime_struct),0);
I think you might also want to use capital U in pack instead of lowercase u, meaning 32 characters, and not 32 strings, but I could be reading the
doc wrong. Another way to test it might be to pack yourself a gigantic structure of zeros, and see if it still crashes. Where is it dying (what's the last statement that runs before it rolls over)? Good luck.
--
jb