Advertisement
BaSs_HaXoR

PS3Lib 4.4 [portable] Source Code CCAPI.cs

Feb 26th, 2015
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 27.02 KB | None | 0 0
  1.                       /* PS3Lib 4.4 SOURCE CODE C# */
  2. //CCAPI.cs
  3. //<----------------SOURCE-----------------------------------------------------------------------------
  4. namespace PS3Lib
  5. {
  6.     using Microsoft.Win32;
  7.     using System;
  8.     using System.Collections.Generic;
  9.     using System.IO;
  10.     using System.Linq;
  11.     using System.Runtime.CompilerServices;
  12.     using System.Runtime.InteropServices;
  13.     using System.Security.Cryptography;
  14.     using System.Windows.Forms;
  15.     using System.Threading;
  16.     public class CCAPI
  17.     {
  18.         //private readonly string CCAPIHASH = "C2FE9E1C387CF29AAC781482C28ECF86"; Won't be needing this :P
  19.         private connectConsoleDelegate connectConsole;
  20.         private disconnectConsoleDelegate disconnectConsole;
  21.         private getConnectionStatusDelegate getConnectionStatus;
  22.         private getConsoleInfoDelegate getConsoleInfo;
  23.         private getDllVersionDelegate getDllVersion;
  24.         private getFirmwareInfoDelegate getFirmwareInfo;
  25.         private getNumberOfConsolesDelegate getNumberOfConsoles;
  26.         private getProcessListDelegate getProcessList;
  27.         private getProcessMemoryDelegate getProcessMemory;
  28.         private getProcessNameDelegate getProcessName;
  29.         private getTemperatureDelegate getTemperature;
  30.         private IntPtr libModule = (IntPtr)Convert.ToInt32("1751121920"); //Pointer to Function;//
  31.         private notifyDelegate notify;
  32.         private TargetInfo pInfo = new TargetInfo();
  33.         private ringBuzzerDelegate ringBuzzer;
  34.         private setBootConsoleIdsDelegate setBootConsoleIds;
  35.         private setConsoleIdsDelegate setConsoleIds;
  36.         private setConsoleLedDelegate setConsoleLed;
  37.         private setProcessMemoryDelegate setProcessMemory;
  38.         private shutdownDelegate shutdown;
  39.  
  40.         public string getCurrentDir()
  41.         {
  42.             string Dir;
  43.             Dir = Directory.GetCurrentDirectory();
  44.             return Dir;
  45.         }
  46.         public CCAPI()
  47.         {
  48.             string dapath = getCurrentDir() + @"\CCAPI.dll"; //This will get CCAPI 2.60 from your current Directory.
  49.                             if (File.Exists(getCurrentDir() + @"\CCAPI.dll"))
  50.                             {
  51.                                 // IntPtr newP = (IntPtr)Convert.ToInt32("1751121920"); //This is the MD5 Hash that is used in the main functions of every call, such as loadlib.
  52.                                 // credits: jandromeda @-http://www.experts-exchange.com/Programming/Languages/.NET/Q_23237956.html
  53.                                 LoadLibrary(dapath); //This will load CCAPI from your currently directory
  54.                                 this.connectConsole = (connectConsoleDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIConnectConsole"), typeof(connectConsoleDelegate));
  55.                                 this.disconnectConsole = (disconnectConsoleDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIDisconnectConsole"), typeof(disconnectConsoleDelegate));
  56.                                 this.getConnectionStatus = (getConnectionStatusDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetConnectionStatus"), typeof(getConnectionStatusDelegate));
  57.                                 this.getConsoleInfo = (getConsoleInfoDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetConsoleInfo"), typeof(getConsoleInfoDelegate));
  58.                                 this.getDllVersion = (getDllVersionDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetDllVersion"), typeof(getDllVersionDelegate));
  59.                                 this.getFirmwareInfo = (getFirmwareInfoDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetFirmwareInfo"), typeof(getFirmwareInfoDelegate));
  60.                                 this.getNumberOfConsoles = (getNumberOfConsolesDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetNumberOfConsoles"), typeof(getNumberOfConsolesDelegate));
  61.                                 this.getProcessList = (getProcessListDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetProcessList"), typeof(getProcessListDelegate));
  62.                                 this.getProcessMemory = (getProcessMemoryDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetMemory"), typeof(getProcessMemoryDelegate));
  63.                                 this.getProcessName = (getProcessNameDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetProcessName"), typeof(getProcessNameDelegate));
  64.                                 this.getTemperature = (getTemperatureDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIGetTemperature"), typeof(getTemperatureDelegate));
  65.                                 this.notify = (notifyDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIVshNotify"), typeof(notifyDelegate));
  66.                                 this.ringBuzzer = (ringBuzzerDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIRingBuzzer"), typeof(ringBuzzerDelegate));
  67.                                 this.setBootConsoleIds = (setBootConsoleIdsDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPISetBootConsoleIds"), typeof(setBootConsoleIdsDelegate));
  68.                                 this.setConsoleIds = (setConsoleIdsDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPISetConsoleIds"), typeof(setConsoleIdsDelegate));
  69.                                 this.setConsoleLed = (setConsoleLedDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPISetConsoleLed"), typeof(setConsoleLedDelegate));
  70.                                 this.setProcessMemory = (setProcessMemoryDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPISetMemory"), typeof(setProcessMemoryDelegate));
  71.                                 this.shutdown = (shutdownDelegate) Marshal.GetDelegateForFunctionPointer(GetProcAddress(this.libModule, "CCAPIShutdown"), typeof(shutdownDelegate)); }
  72.                             else
  73.                             {
  74.                                 MessageBox.Show("Failed to load CCAPI.dll version 2.60. Not In current Directory!", "CCAPI.dll doesn't exist!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  75.                             }
  76.                         }
  77.  
  78.         public int AttachProcess()
  79.         {
  80.             int @void = -1;
  81.             System.processID = 0;
  82.             @void = this.GetProcessList(out System.processIDs);
  83.             if (!this.SUCCESS(@void) || (System.processIDs.Length <= 0))
  84.             {
  85.                 return -1;
  86.             }
  87.             for (int i = 0; i < System.processIDs.Length; i++)
  88.             {
  89.                 string name = string.Empty;
  90.                 @void = this.GetProcessName(System.processIDs[i], out name);
  91.                 if (!this.SUCCESS(@void))
  92.                 {
  93.                     break;
  94.                 }
  95.                 if (!name.Contains("flash"))
  96.                 {
  97.                     System.processID = System.processIDs[i];
  98.                     break;
  99.                 }
  100.                 @void = -1;
  101.             }
  102.             if (System.processID == 0)
  103.             {
  104.                 System.processID = System.processIDs[System.processIDs.Length - 1];
  105.             }
  106.             return @void;
  107.         }
  108.  
  109.         public int AttachProcess(ProcessType procType)
  110.         {
  111.             int processList = -1;
  112.             System.processID = 0;
  113.             processList = this.GetProcessList(out System.processIDs);
  114.             if ((processList < 0) || (System.processIDs.Length <= 0))
  115.             {
  116.                 return -1;
  117.             }
  118.             for (int i = 0; i < System.processIDs.Length; i++)
  119.             {
  120.                 string name = string.Empty;
  121.                 processList = this.GetProcessName(System.processIDs[i], out name);
  122.                 if (processList < 0)
  123.                 {
  124.                     break;
  125.                 }
  126.                 if ((procType == ProcessType.VSH) && name.Contains("vsh"))
  127.                 {
  128.                     System.processID = System.processIDs[i];
  129.                     break;
  130.                 }
  131.                 if ((procType == ProcessType.SYS_AGENT) && name.Contains("agent"))
  132.                 {
  133.                     System.processID = System.processIDs[i];
  134.                     break;
  135.                 }
  136.                 if ((procType == ProcessType.CURRENTGAME) && !name.Contains("flash"))
  137.                 {
  138.                     System.processID = System.processIDs[i];
  139.                     break;
  140.                 }
  141.             }
  142.             if (System.processID == 0)
  143.             {
  144.                 System.processID = System.processIDs[System.processIDs.Length - 1];
  145.             }
  146.             return processList;
  147.         }
  148.  
  149.         public int AttachProcess(uint process)
  150.         {
  151.             int @void = -1;
  152.             uint[] processIds = new uint[0x40];
  153.             @void = this.GetProcessList(out processIds);
  154.             if (this.SUCCESS(@void))
  155.             {
  156.                 for (int i = 0; i < processIds.Length; i++)
  157.                 {
  158.                     if (processIds[i] == process)
  159.                     {
  160.                         @void = 0;
  161.                         System.processID = process;
  162.                         break;
  163.                     }
  164.                     @void = -1;
  165.                 }
  166.             }
  167.             processIds = null;
  168.             return @void;
  169.         }
  170.  
  171.         public void ClearTargetInfo()
  172.         {
  173.             this.pInfo = new TargetInfo();
  174.         }
  175.  
  176.         private void CompleteInfo(ref TargetInfo Info, int fw, int ccapi, ulong sysTable, int consoleType, int tempCELL, int tempRSX)
  177.         {
  178.             Info.Firmware = fw;
  179.             Info.CCAPI = ccapi;
  180.             Info.SysTable = sysTable;
  181.             Info.ConsoleType = consoleType;
  182.             Info.TempCell = tempCELL;
  183.             Info.TempRSX = tempRSX;
  184.         }
  185.  
  186.         public bool ConnectTarget()
  187.         {
  188.             return new PS3API.ConsoleList(new PS3API(SelectAPI.ControlConsole)).Show();
  189.         }
  190.  
  191.         public int ConnectTarget(string targetIP)
  192.         {
  193.             return this.connectConsole(targetIP);
  194.         }
  195.  
  196.         public int DisconnectTarget()
  197.         {
  198.             return this.disconnectConsole();
  199.         }
  200.  
  201.         public uint GetAttachedProcess()
  202.         {
  203.             return System.processID;
  204.         }
  205.  
  206.         public byte[] GetBytes(uint offset, uint length)
  207.         {
  208.             byte[] buffer = new byte[length];
  209.             this.GetMemory(offset, buffer);
  210.             return buffer;
  211.         }
  212.  
  213.         public byte[] GetBytes(ulong offset, uint length)
  214.         {
  215.             byte[] buffer = new byte[length];
  216.             this.GetMemory(offset, buffer);
  217.             return buffer;
  218.         }
  219.  
  220.         public int GetConnectionStatus()
  221.         {
  222.             int status = 0;
  223.             this.getConnectionStatus(ref status);
  224.             return status;
  225.         }
  226.  
  227.         public List<ConsoleInfo> GetConsoleList()
  228.         {
  229.             List<ConsoleInfo> list = new List<ConsoleInfo>();
  230.             int num = this.getNumberOfConsoles();
  231.             IntPtr ptrN = Marshal.AllocHGlobal(0x100);
  232.             IntPtr ptrI = Marshal.AllocHGlobal(0x100);
  233.             for (int i = 0; i < num; i++)
  234.             {
  235.                 ConsoleInfo item = new ConsoleInfo();
  236.                 this.getConsoleInfo(i, ptrN, ptrI);
  237.                 item.Name = Marshal.PtrToStringAnsi(ptrN);
  238.                 item.Ip = Marshal.PtrToStringAnsi(ptrI);
  239.                 list.Add(item);
  240.             }
  241.             Marshal.FreeHGlobal(ptrN);
  242.             Marshal.FreeHGlobal(ptrI);
  243.             return list;
  244.         }
  245.  
  246.         public int GetDllVersion()
  247.         {
  248.             return this.getDllVersion();
  249.         }
  250.  
  251.         public string GetFirmwareType()
  252.         {
  253.             if (this.pInfo.ConsoleType.ToString() == "")
  254.             {
  255.                 this.GetTargetInfo(out this.pInfo);
  256.             }
  257.             string str = string.Empty;
  258.             if (this.pInfo.ConsoleType == 1)
  259.             {
  260.                 return "CEX";
  261.             }
  262.             if (this.pInfo.ConsoleType == 2)
  263.             {
  264.                 return "DEX";
  265.             }
  266.             if (this.pInfo.ConsoleType == 3)
  267.             {
  268.                 str = "TOOL";
  269.             }
  270.             return str;
  271.         }
  272.  
  273.         public string GetFirmwareVersion()
  274.         {
  275.             if (this.pInfo.Firmware == 0)
  276.             {
  277.                 this.GetTargetInfo();
  278.             }
  279.             string str = this.pInfo.Firmware.ToString("X8");
  280.             string str2 = str.Substring(1, 1) + ".";
  281.             string str3 = str.Substring(3, 1);
  282.             string str4 = str.Substring(4, 1);
  283.             return (str2 + str3 + str4);
  284.         }
  285.  
  286.         public int GetMemory(uint offset, byte[] buffer)
  287.         {
  288.             return this.getProcessMemory(System.processID, (ulong) offset, (uint) buffer.Length, buffer);
  289.         }
  290.  
  291.         public int GetMemory(ulong offset, byte[] buffer)
  292.         {
  293.             return this.getProcessMemory(System.processID, offset, (uint) buffer.Length, buffer);
  294.         }
  295.  
  296.         [DllImport("kernel32.dll")]
  297.         private static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
  298.         public int GetProcessList(out uint[] processIds)
  299.         {
  300.             uint numberProcesses = 0x40;
  301.             int @void = -1;
  302.             IntPtr processIdPtr = Marshal.AllocHGlobal(0x100);
  303.             @void = this.getProcessList(ref numberProcesses, processIdPtr);
  304.             processIds = new uint[numberProcesses];
  305.             if (this.SUCCESS(@void))
  306.             {
  307.                 IntPtr unBuf = processIdPtr;
  308.                 for (uint i = 0; i < numberProcesses; i++)
  309.                 {
  310.                     unBuf = this.ReadDataFromUnBufPtr<uint>(unBuf, ref processIds[i]);
  311.                 }
  312.             }
  313.             Marshal.FreeHGlobal(processIdPtr);
  314.             return @void;
  315.         }
  316.  
  317.         public int GetProcessName(uint processId, out string name)
  318.         {
  319.             IntPtr strPtr = Marshal.AllocHGlobal(0x211);
  320.             int @void = -1;
  321.             @void = this.getProcessName(processId, strPtr);
  322.             name = string.Empty;
  323.             if (this.SUCCESS(@void))
  324.             {
  325.                 name = Marshal.PtrToStringAnsi(strPtr);
  326.             }
  327.             Marshal.FreeHGlobal(strPtr);
  328.             return @void;
  329.         }
  330.  
  331.         private int GetTargetInfo()
  332.         {
  333.             int num = -1;
  334.             int[] numArray = new int[2];
  335.             int firmware = 0;
  336.             int ccapi = 0;
  337.             int consoleType = 0;
  338.             ulong sysTable = 0L;
  339.             num = this.getFirmwareInfo(ref firmware, ref ccapi, ref consoleType);
  340.             if (num >= 0)
  341.             {
  342.                 num = this.getTemperature(ref numArray[0], ref numArray[1]);
  343.                 if (num >= 0)
  344.                 {
  345.                     this.CompleteInfo(ref this.pInfo, firmware, ccapi, sysTable, consoleType, numArray[0], numArray[1]);
  346.                 }
  347.             }
  348.             return num;
  349.         }
  350.  
  351.         public int GetTargetInfo(out TargetInfo Info)
  352.         {
  353.             Info = new TargetInfo();
  354.             int num = -1;
  355.             int[] numArray = new int[2];
  356.             int firmware = 0;
  357.             int ccapi = 0;
  358.             int consoleType = 0;
  359.             ulong sysTable = 0L;
  360.             num = this.getFirmwareInfo(ref firmware, ref ccapi, ref consoleType);
  361.             if (num >= 0)
  362.             {
  363.                 num = this.getTemperature(ref numArray[0], ref numArray[1]);
  364.                 if (num >= 0)
  365.                 {
  366.                     this.CompleteInfo(ref Info, firmware, ccapi, sysTable, consoleType, numArray[0], numArray[1]);
  367.                     this.CompleteInfo(ref this.pInfo, firmware, ccapi, sysTable, consoleType, numArray[0], numArray[1]);
  368.                 }
  369.             }
  370.             return num;
  371.         }
  372.  
  373.         public string GetTemperatureCELL()
  374.         {
  375.             if (this.pInfo.TempCell == 0)
  376.             {
  377.                 this.GetTargetInfo(out this.pInfo);
  378.             }
  379.             return (this.pInfo.TempCell.ToString() + " C");
  380.         }
  381.  
  382.         public string GetTemperatureRSX()
  383.         {
  384.             if (this.pInfo.TempRSX == 0)
  385.             {
  386.                 this.GetTargetInfo(out this.pInfo);
  387.             }
  388.             return (this.pInfo.TempRSX.ToString() + " C");
  389.         }
  390.  
  391.         [DllImport("kernel32.dll")]
  392.         private static extern IntPtr LoadLibrary(string dllName);
  393.         public int Notify(NotifyIcon icon, string message)
  394.         {
  395.             return this.notify((int) icon, message);
  396.         }
  397.  
  398.         public int Notify(int icon, string message)
  399.         {
  400.             return this.notify(icon, message);
  401.         }
  402.  
  403.         private IntPtr ReadDataFromUnBufPtr<T>(IntPtr unBuf, ref T storage)
  404.         {
  405.             storage = (T) Marshal.PtrToStructure(unBuf, typeof(T));
  406.             return new IntPtr(unBuf.ToInt64() + Marshal.SizeOf((T) storage));
  407.         }
  408.  
  409.         public int ResetBootConsoleID(IdType Type = 0)
  410.         {
  411.             return this.setBootConsoleIds((int) Type, 0, null);
  412.         }
  413.  
  414.         public int RingBuzzer(BuzzerMode flag)
  415.         {
  416.             return this.ringBuzzer((int) flag);
  417.         }
  418.  
  419.         public int SetBootConsoleID(string consoleID, IdType Type = 0)
  420.         {
  421.             if (consoleID.Length >= 0x20)
  422.             {
  423.                 consoleID.Substring(0, 0x20);
  424.             }
  425.             return this.SetBootConsoleID(StringToByteArray(consoleID), Type);
  426.         }
  427.  
  428.         public int SetBootConsoleID(byte[] consoleID, IdType Type = 0)
  429.         {
  430.             return this.setBootConsoleIds((int) Type, 1, consoleID);
  431.         }
  432.  
  433.         public int SetConsoleID(string consoleID)
  434.         {
  435.             if (string.IsNullOrEmpty(consoleID))
  436.             {
  437.                 MessageBox.Show("Cannot send an empty value", "Empty or null console id", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  438.                 return -1;
  439.             }
  440.             string hex = string.Empty;
  441.             if (consoleID.Length >= 0x20)
  442.             {
  443.                 hex = consoleID.Substring(0, 0x20);
  444.             }
  445.             return this.SetConsoleID(StringToByteArray(hex));
  446.         }
  447.  
  448.         public int SetConsoleID(byte[] consoleID)
  449.         {
  450.             if (consoleID.Length <= 0)
  451.             {
  452.                 MessageBox.Show("Cannot send an empty value", "Empty or null console id", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  453.                 return -1;
  454.             }
  455.             return this.setConsoleIds(0, consoleID);
  456.         }
  457.  
  458.         public int SetConsoleLed(LedColor color, LedMode mode)
  459.         {
  460.             return this.setConsoleLed((int) color, (int) mode);
  461.         }
  462.  
  463.         public int SetMemory(uint offset, byte[] buffer)
  464.         {
  465.             return this.setProcessMemory(System.processID, (ulong) offset, (uint) buffer.Length, buffer);
  466.         }
  467.  
  468.         public int SetMemory(ulong offset, byte[] buffer)
  469.         {
  470.             return this.setProcessMemory(System.processID, offset, (uint) buffer.Length, buffer);
  471.         }
  472.  
  473.         public int SetMemory(ulong offset, string hexadecimal, EndianType Type = EndianType.LittleEndian)
  474.         {
  475.             byte[] array = StringToByteArray(hexadecimal);
  476.             if (Type == EndianType.LittleEndian)
  477.             {
  478.                 Array.Reverse(array);
  479.             }
  480.             return this.setProcessMemory(System.processID, offset, (uint) array.Length, array);
  481.         }
  482.  
  483.         public int SetPSID(string PSID)
  484.         {
  485.             if (string.IsNullOrEmpty(PSID))
  486.             {
  487.                 MessageBox.Show("Cannot send an empty value", "Empty or null psid", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  488.                 return -1;
  489.             }
  490.             string hex = string.Empty;
  491.             if (PSID.Length >= 0x20)
  492.             {
  493.                 hex = PSID.Substring(0, 0x20);
  494.             }
  495.             return this.SetPSID(StringToByteArray(hex));
  496.         }
  497.  
  498.         public int SetPSID(byte[] consoleID)
  499.         {
  500.             if (consoleID.Length <= 0)
  501.             {
  502.                 MessageBox.Show("Cannot send an empty value", "Empty or null psid", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  503.                 return -1;
  504.             }
  505.             return this.setConsoleIds(1, consoleID);
  506.         }
  507.  
  508.         public int ShutDown(RebootFlags flag)
  509.         {
  510.             return this.shutdown((int) flag);
  511.         }
  512.  
  513.         internal static byte[] StringToByteArray(string hex)
  514.         {
  515.             try
  516.             {
  517.                 bool flag;
  518.                 Func<int, byte> selector = null;
  519.                 Func<int, byte> func2 = null;
  520.                 string replace = hex.Replace("0x", "");
  521.                 string Stringz = replace.Insert(replace.Length - 1, "0");
  522.                 if ((replace.Length % 2) == 0)
  523.                 {
  524.                     flag = true;
  525.                 }
  526.                 else
  527.                 {
  528.                     flag = false;
  529.                 }
  530.                 if (flag)
  531.                 {
  532.                     if (selector == null)
  533.                     {
  534.                         selector = x => Convert.ToByte(replace.Substring(x, 2), 0x10);
  535.                     }
  536.                     return (from x in Enumerable.Range(0, replace.Length)
  537.                         where (x % 2) == 0
  538.                         select x).Select<int, byte>(selector).ToArray<byte>();
  539.                 }
  540.                 if (func2 == null)
  541.                 {
  542.                     func2 = x => Convert.ToByte(Stringz.Substring(x, 2), 0x10);
  543.                 }
  544.                 return (from x in Enumerable.Range(0, replace.Length)
  545.                     where (x % 2) == 0
  546.                     select x).Select<int, byte>(func2).ToArray<byte>();
  547.             }
  548.             catch
  549.             {
  550.                 MessageBox.Show("Incorrect value (empty)", "StringToByteArray Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  551.                 return new byte[1];
  552.             }
  553.         }
  554.  
  555.         public bool SUCCESS(int Void)
  556.         {
  557.             return (Void == 0);
  558.         }
  559.  
  560.         public PS3Lib.Extension Extension
  561.         {
  562.             get
  563.             {
  564.                 return new PS3Lib.Extension(SelectAPI.ControlConsole);
  565.             }
  566.         }
  567.  
  568.         public enum BuzzerMode
  569.         {
  570.             Continuous,
  571.             Single,
  572.             Double
  573.         }
  574.  
  575.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  576.         private delegate int connectConsoleDelegate(string targetIP);
  577.  
  578.         public class ConsoleInfo
  579.         {
  580.             public string Ip;
  581.             public string Name;
  582.         }
  583.  
  584.         public enum ConsoleType
  585.         {
  586.             CEX = 1,
  587.             DEX = 2,
  588.             TOOL = 3
  589.         }
  590.  
  591.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  592.         private delegate int disconnectConsoleDelegate();
  593.  
  594.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  595.         private delegate int getConnectionStatusDelegate(ref int status);
  596.  
  597.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  598.         private delegate int getConsoleInfoDelegate(int index, IntPtr ptrN, IntPtr ptrI);
  599.  
  600.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  601.         private delegate int getDllVersionDelegate();
  602.  
  603.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  604.         private delegate int getFirmwareInfoDelegate(ref int firmware, ref int ccapi, ref int consoleType);
  605.  
  606.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  607.         private delegate int getNumberOfConsolesDelegate();
  608.  
  609.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  610.         private delegate int getProcessListDelegate(ref uint numberProcesses, IntPtr processIdPtr);
  611.  
  612.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  613.         private delegate int getProcessMemoryDelegate(uint processID, ulong offset, uint size, byte[] buffOut);
  614.  
  615.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  616.         private delegate int getProcessNameDelegate(uint processID, IntPtr strPtr);
  617.  
  618.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  619.         private delegate int getTemperatureDelegate(ref int cell, ref int rsx);
  620.  
  621.         public enum IdType
  622.         {
  623.             IDPS,
  624.             PSID
  625.         }
  626.  
  627.         public enum LedColor
  628.         {
  629.             Green = 1,
  630.             Red = 2
  631.         }
  632.  
  633.         public enum LedMode
  634.         {
  635.             Off,
  636.             On,
  637.             Blink
  638.         }
  639.  
  640.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  641.         private delegate int notifyDelegate(int mode, string msgWChar);
  642.  
  643.         public enum NotifyIcon
  644.         {
  645.             INFO,
  646.             CAUTION,
  647.             FRIEND,
  648.             SLIDER,
  649.             WRONGWAY,
  650.             DIALOG,
  651.             DIALOGSHADOW,
  652.             TEXT,
  653.             POINTER,
  654.             GRAB,
  655.             HAND,
  656.             PEN,
  657.             FINGER,
  658.             ARROW,
  659.             ARROWRIGHT,
  660.             PROGRESS,
  661.             TROPHY1,
  662.             TROPHY2,
  663.             TROPHY3,
  664.             TROPHY4
  665.         }
  666.  
  667.         public enum ProcessType
  668.         {
  669.             VSH,
  670.             SYS_AGENT,
  671.             CURRENTGAME
  672.         }
  673.  
  674.         public enum RebootFlags
  675.         {
  676.             HardReboot = 3,
  677.             ShutDown = 1,
  678.             SoftReboot = 2
  679.         }
  680.  
  681.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  682.         private delegate int ringBuzzerDelegate(int type);
  683.  
  684.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  685.         private delegate int setBootConsoleIdsDelegate(int idType, int on, byte[] ID);
  686.  
  687.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  688.         private delegate int setConsoleIdsDelegate(int idType, byte[] consoleID);
  689.  
  690.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  691.         private delegate int setConsoleLedDelegate(int color, int status);
  692.  
  693.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  694.         private delegate int setProcessMemoryDelegate(uint processID, ulong offset, uint size, byte[] buffIn);
  695.  
  696.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  697.         private delegate int shutdownDelegate(int mode);
  698.  
  699.         private class System
  700.         {
  701.             public static int connectionID = -1;
  702.             public static uint processID = 0;
  703.             public static uint[] processIDs;
  704.         }
  705.  
  706.         public class TargetInfo
  707.         {
  708.             public int CCAPI;
  709.             public int ConsoleType;
  710.             public int Firmware;
  711.             public ulong SysTable;
  712.             public int TempCell;
  713.             public int TempRSX;
  714.         }
  715.     }
  716. }
  717.  
  718. //------------------------------------------------------------------------------SOURCE--------------->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement