Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CREDITS TO MILKY4444! :) <3
- //NOT FINISHED!!!!!!!!!!!!!!!!!!!!!
- //SOURCE: http://www.nextgenupdate.com/forums/showthread.php?t=763738&p=6037938#post6037938
- //WORKING (NATIVE C++) NOTIFY: http://www.mediafire.com/download/s4pezozowvcwyz6/%5BPS3%5DC+++CLI+NOTIFY.rar
- // ConsoleApplication40.cpp : Defines the entry point for the console application.
- //PS3 C++ CCAPI, CCAPI C++, CCAPI SOURCE, Call CCAPI from C++, DLLIMPORT CCAPI.dll, CCAPI.dll C++, PS3LIB C++, C++ PS3Lib,
- //Native PS3lib, ccapi from c++, ccapi C++ CLI, cli c++ ccapi.dll
- //#CCAPI, #DLL, #import, #PS3Lib, #Native, #PS3, #C++, #programming
- //BaSs_HaXoR, BaSs HaXoR, CODNoobFriendly
- #include "stdafx.h"
- #include <Windows.h>
- #include <string>
- #include <iostream>
- typedef unsigned int uint;
- typedef unsigned long ulong;
- typedef unsigned long long ullong;
- typedef unsigned char byte;
- class CCAPIGlobalPointer
- {
- private:
- void* _intPtr;
- public:
- CCAPIGlobalPointer(void* intPtr)
- {
- _intPtr = intPtr;
- }
- ~CCAPIGlobalPointer()
- {
- free(_intPtr);
- }
- void* GetPtr()
- {
- return _intPtr;
- }
- };
- enum ProcessType
- {
- VSH,
- SYS_AGENT,
- CURRENTGAME
- };
- enum NotifyIcon
- {
- INFO,
- CAUTION,
- FRIEND,
- SLIDER,
- WRONGWAY,
- DIALOG,
- DIALOGSHADOW,
- TEXT,
- POINTER,
- GRAB,
- HAND,
- PEN,
- FINGER,
- ARROW,
- ARROWRIGHT,
- PROGRESS
- };
- typedef class
- {
- public:
- int connectionid;
- uint ids;
- uint processid;
- uint processids[3];
- }sys;
- sys System;
- typedef class
- {
- public:
- int connectionid;
- uint ids;
- uint processid;
- uint* processids;
- }sys2;
- sys2 System2;
- typedef struct
- {
- int Firmware;
- int CCAPI;
- int ConsoleType;
- int TempCell;
- int TempRSX;
- ulong SysTable;
- }TargetInfo;
- TargetInfo CCAPI;
- #define RDFUB(T,uBuf,storage,out) storage = (T)uBuf; out = (void*)(long)sizeof(storage)
- typedef int (__cdecl* DllInfo)(void);
- DllInfo DLLinfo = (DllInfo)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getDllVersion");
- /* BOOL APIENTRY DllMain(HMODULE hModule, DWORD EntryPoint, LPVOID ipReserved)
- {
- switch (DllMain(LoadLibrary(L"CCAPI.DLL"), char("_ZN5CcApi14connectConsoleEPKc"), "connectConsole"))
- {
- case DLL_PROCESS_ATTACH:
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }*/
- typedef int (__cdecl* Connectf)(const char*);
- Connectf Connect = (Connectf)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"connectConsole");
- BOOL APIENTRY DllMain(HANDLE hModule,
- DWORD EntryPoint,
- LPVOID lpReserved
- )
- {
- return TRUE;
- }
- typedef int(__cdecl* Connectfx)(const char*);
- Connectfx Connectx = (Connectfx)DllMain(LoadLibrary(L"CCAPI.DLL"), char("_ZN5CcApi14connectConsoleEPKc"), "connectConsole");
- extern "C" __declspec(dllexport)void ConnectMe(const char*)
- {
- typedef int(__cdecl* Connectf)(const char*);
- Connectf Connect = (Connectf)DllMain(L"CCAPI.DLL", char("_ZN5CcApi14connectConsoleEPKc"), "connectConsole");
- //DllMain(L"CCAPI.DLL", char("_ZN5CcApi14connectConsoleEPKc"), "connectConsole");
- };
- typedef int (__cdecl* getProcessList)(int connectionID,uint& numberProcesses, void* processIdPtr);
- getProcessList GetProcList = (getProcessList)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getProcessList");
- typedef int (__cdecl* getProcesslist)(int connectionID,uint& numberProcesses, uint*& processids);
- getProcesslist GetProcList_t = (getProcesslist)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getProcessList");
- typedef int (__cdecl* GetProcN)(int connectionID, uint processID, void* name);
- GetProcN GetProcessName = (GetProcN)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getProcessName");
- typedef int (__cdecl* GetProcn)(int connectionID, uint processID, char* name);
- GetProcn GetProcessName_t = (GetProcn)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getProcessName");
- typedef int (__cdecl* setmem)(int cid,uint proc,ullong address,uint size,byte* input);
- setmem SetMemory = (setmem)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"setProcessMemory");
- typedef int (__cdecl* initTargetCommsF)(void);
- initTargetCommsF initTargetComms = (initTargetCommsF)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"initTargetComms");
- typedef int (__cdecl* GetFWI)(int connectionID,int& fw,int& ccapi,ulong& systable,int& cType);
- GetFWI GetFirmwareInfo = (GetFWI)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getFirmwareInfo");
- typedef int (__cdecl* Gettemp)(int connectionId, void* tempPtr);
- Gettemp GetTempInfo = (Gettemp)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"getTemperature");
- typedef int (__cdecl* notifyF)(int cid, int icon, wchar_t * msg);
- notifyF notify = (notifyF)GetProcAddress(LoadLibrary(L"CCAPI.DLL"),"notify");
- int GetTargInfo(TargetInfo& targinfo)
- {
- int buff[2];
- int fw = 0;
- int ccapi = 0;
- int ctype = 0;
- ulong table = 0;
- int fwi = GetFirmwareInfo(System.connectionid,fw,ccapi,table,ctype);
- if(fwi >= 0)
- {
- CCAPIGlobalPointer cCAPIGlobalPointer = new CCAPIGlobalPointer(malloc(8));
- fwi = GetTempInfo(System.connectionid,cCAPIGlobalPointer.GetPtr());
- if(fwi >= 0)
- {
- void* ptr;
- for (uint i = 0; i < 2; i++)
- {
- RDFUB(int,cCAPIGlobalPointer.GetPtr(),buff[i],ptr);
- }
- targinfo.CCAPI = ccapi;
- targinfo.ConsoleType = ctype;
- targinfo.Firmware = fw;
- targinfo.SysTable = table;
- targinfo.TempCell = buff[0];
- targinfo.TempRSX = buff[1];
- }
- }
- return fwi;
- }
- uint ids = 0;
- uint* idz;
- int Attach()
- {
- CCAPIGlobalPointer cCAPIGlobalPointer = new CCAPIGlobalPointer((void*)256);
- int procL = GetProcList(System.connectionid,ids, cCAPIGlobalPointer.GetPtr());
- void* ptr = cCAPIGlobalPointer.GetPtr();
- for(int i = 0; i < ids;i++)
- {
- System.processids[i] = (uint)ptr;
- void*buff = (void*)(long)sizeof(System.processids[i]);
- }
- int count = 0;
- const char* namec;
- while(count < sizeof(System.processids[count]))
- {
- void* buff = (void*)529;
- int pn = GetProcessName(System.connectionid,System.processids[count],buff);
- namec = (const char*)buff;
- std::string sBuff (namec,std::strlen(namec));
- if (sBuff.find("flash"))
- {
- System.processid = -1;
- count++;
- }
- else
- {
- System.processid = System.processids[count];
- break;
- }
- }
- if(System.processid == 0)
- {
- System.processid = System.processids[sizeof(System.processids) -1];
- }
- return procL;
- }
- int attach_t()
- {
- CCAPIGlobalPointer cCAPIGlobalPointer = new CCAPIGlobalPointer((void*)256);
- uint ids = 0;
- int procL = GetProcList(System.connectionid,ids, cCAPIGlobalPointer.GetPtr());
- //System.processid =
- return 0;
- }
- int Attach_Game(ProcessType proctype)
- {
- CCAPIGlobalPointer cCAPIGlobalPointer = new CCAPIGlobalPointer(malloc(256));
- void* ptr = cCAPIGlobalPointer.GetPtr();
- uint ids = 0;
- int procL = GetProcList(System.connectionid,ids, ptr);
- for(int i = 0; i < ids;i++)
- {
- System.processids[i] = (uint)ptr;
- void*buff = (void*)(long)sizeof(System.processids[i]);
- }
- // void*buff = (void*)(long)sizeof(System.processids[i]);
- int count = 0;
- const char* namec;
- while(count < sizeof(System.processids[count]))
- {
- void* buff = malloc(529);
- int pn = GetProcessName(System.connectionid,System.processids[count],buff);
- namec = (const char*)buff;
- std::string sBuff (namec,std::strlen(namec));
- if(proctype == ProcessType::VSH && sBuff.find("vsh"))
- {
- System.processid = System.processids[count];
- break;
- }
- if(proctype == ProcessType::SYS_AGENT && sBuff.find("agent"))
- {
- System.processid = System.processids[count];
- break;
- }
- else if (proctype != ProcessType::CURRENTGAME || sBuff.find("flash"))
- {
- count++;
- }
- else
- {
- break;
- }
- }
- System.processid = System.processids[count];
- if(System.processid == 0)
- {
- uint buffer = std::end(System.processids) - std::begin(System.processids);
- System.processid = System.processids[(int)buffer -1];
- }
- return 0;
- }
- int Attach_Game_t(ProcessType proctype)
- {
- int procL = GetProcList_t(System.connectionid,ids,System2.processids);
- int count = 0;
- System.processid = System2.processids[2];
- /*while(count < sizeof(System.processids[count]))
- {
- char* namec[3];
- int pn = GetProcessName_t(System.connectionid,System2.processids[count],namec[count]);
- std::string sBuff (namec[count],std::strlen(namec[count]));
- if(proctype == ProcessType::VSH && sBuff.find("vsh"))
- {
- System.processid = System.processids[count];
- break;
- }
- if(proctype == ProcessType::SYS_AGENT && sBuff.find("agent"))
- {
- System.processid = System.processids[count];
- break;
- }
- else if (proctype != ProcessType::CURRENTGAME || sBuff.find("flash"))
- {
- count++;
- }
- else
- {
- System.processid = System.processids[count];
- break;
- }
- }
- if(System.processid == 0)
- {
- uint buffer = std::end(System.processids) - std::begin(System.processids);
- System.processid = System.processids[(int)buffer -1];
- }
- */return procL;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- std::string ip = "";
- std::cout<<"enter ip:\n";
- std::cin>>ip;
- initTargetComms();
- //System.connectionid = ConnectMe(ip.c_str());
- System.connectionid = Connect(ip.c_str());
- notify(System.connectionid, NotifyIcon::INFO, L"Connected to: ");
- Attach_Game(ProcessType::CURRENTGAME);
- std::cout<<System.connectionid<<std::endl<<System.processid<<std::endl;
- byte b[1] = {0xFF};
- SetMemory(System.connectionid,0x1030600,(ullong)0x2100000,1,b);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement