public static void GenerateMacExeInfoFile(string exePath, string outFile) { PTCustomizeUtil.FullKeyOffset ppcOffset = PTExeDiscovery.FindMacPPCKeyOffset(exePath); PTCustomizeUtil.FullKeyOffset x86Offset = PTExeDiscovery.FindMacx86KeyOffset(exePath); PTCustomizeUtil.FullKeyOffset x64Offset = PTExeDiscovery.FindMacx64KeyOffset(exePath); PTCustomizeUtil.MacOffset msgOffsets = PTExeDiscovery.FindMacMsgOffsets(exePath); PTCustomizeUtil.MacOffset expirationDateOffset = PTExeDiscovery.FindMacEvalExpirationDateOffset(exePath); PTCustomizeUtil.MacOffset customPicDataOffset = PTExeDiscovery.FindMacCustomPicDataOffsets(exePath); PTCustomizeUtil.MacOffset customPicMsgOffset = PTExeDiscovery.FindMacCustomPicMsgOffset(exePath); // Output the data StreamWriter sw = new StreamWriter(outFile); sw.WriteLine(PTCustomizeUtil.Ini_MacPPCKeyOffset + ":" + ppcOffset.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_Macx86KeyOffset + ":" + x86Offset.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_Macx64KeyOffset + ":" + x64Offset.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_MacMsgOffsets + ":" + msgOffsets.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_MacEvalExpirationDateOffset + ":" + expirationDateOffset.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_MacPicDataOffset + ":" + customPicDataOffset.ToString()); sw.WriteLine(PTCustomizeUtil.Ini_MacPicMsgOffset + ":" + customPicMsgOffset.ToString()); sw.Close(); }
/////////////////////////////////////////////////////////////////////////////////////////// /// <summary>Find the offset with in the Prime Time executable of the custom pic /// data.</summary> /// <param name="exePath">The full path to the Prime Time executable</param> /// <returns>The offset to the key or 0 on error</returns> /////////////////////////////////////////////////////////////////////////////////////////// public static PTCustomizeUtil.MacOffset FindMacCustomPicMsgOffset(string exePath) { PTCustomizeUtil.MacOffset retOffset = new PTCustomizeUtil.MacOffset(); try { PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.LittleEndian; PTExeDiscovery.WcharSize = 4; retOffset.PPC = FindMsgDataOffset(exePath, CUSTOM_PIC_MSG_PREFIX, 0); PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.BigEndian; retOffset.x86 = FindMsgDataOffset(exePath, CUSTOM_PIC_MSG_PREFIX, 0); retOffset.x64 = FindMsgDataOffset(exePath, CUSTOM_PIC_MSG_PREFIX, retOffset.x86 + 10); } finally { // Go back to PC values PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.BigEndian; PTExeDiscovery.WcharSize = 2; } return(retOffset); }
/////////////////////////////////////////////////////////////////////////////////////////// /// <summary>Find the offset with in the Prime Time executable of the custom pic /// data.</summary> /// <param name="exePath">The full path to the Prime Time executable</param> /// <returns>The offset to the key or 0 on error</returns> /////////////////////////////////////////////////////////////////////////////////////////// public static PTCustomizeUtil.MacOffset FindMacCustomPicDataOffsets(string exePath) { PTCustomizeUtil.MacOffset retOffsets = new PTCustomizeUtil.MacOffset(); retOffsets.PPC = FindCustomPicOffset(exePath, 0); retOffsets.x86 = FindCustomPicOffset(exePath, retOffsets.PPC + 10); retOffsets.x64 = FindCustomPicOffset(exePath, retOffsets.x86 + 10); return(retOffsets); }
/////////////////////////////////////////////////////////////////////////////////////////// /// <summary>Find a the offset within the evaluation EXE file of the expiration date year. /// The year is 2 bytes, followed by the month, then day, all 2 bytes.</summary> /// <param name="exePath">The path of the Prime Time executable</param> /// <returns>The offset in bytes of the message data or 0 if the offset could not be /// found </returns> /////////////////////////////////////////////////////////////////////////////////////////// public static PTCustomizeUtil.MacOffset FindMacEvalExpirationDateOffset(string exePath) { PTCustomizeUtil.MacOffset retOffsets = new PTCustomizeUtil.MacOffset(); try { PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.LittleEndian; retOffsets.PPC = FindMsgDataOffset(exePath, EVAL_EXPIRATION_DATE_PREFIX, 0); // If we found the offset, then step passed the data prefix if (retOffsets.PPC > 0) { retOffsets.PPC += 4 * WcharSize; } PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.BigEndian; retOffsets.x86 = FindMsgDataOffset(exePath, EVAL_EXPIRATION_DATE_PREFIX, 0); if (retOffsets.x86 > 0) { retOffsets.x86 += 4 * WcharSize; } retOffsets.x64 = FindMsgDataOffset(exePath, EVAL_EXPIRATION_DATE_PREFIX, retOffsets.x86 + 10); if (retOffsets.x64 > 0) { retOffsets.x64 += 4 * WcharSize; } } finally { PTExeDiscovery.CharByteOrder = PTCustomizeUtil.CharacterByteOrder.BigEndian; PTExeDiscovery.WcharSize = 2; } return(retOffsets); }