fork download
  1. #include <ctime>
  2. #include <vector>
  3. #include <cstdio>
  4. #include <cstdlib>
  5. #include <limits.h>
  6. #include <iostream>
  7. #include <windows.h>
  8.  
  9. /*
  10.  
  11.   SMBIOS information can be found at http://d...content-available-to-author-only...f.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
  12. */
  13.  
  14. using namespace std;
  15.  
  16. typedef __int8 int8;
  17. typedef __int16 int16;
  18. typedef __int32 int32;
  19. typedef __int64 int64;
  20. typedef unsigned __int8 uint8;
  21. typedef unsigned __int16 uint16;
  22. typedef unsigned __int32 uint32;
  23. typedef unsigned __int64 uint64;
  24.  
  25. typedef vector<uint8> BufferType;
  26.  
  27. #define JMP_HOOK_SIZE 5
  28. #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
  29. #define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
  30.  
  31. typedef LONG (WINAPI *pZwQuerySystemInformation)(
  32. DWORD SystemInformationClass,
  33. PVOID SystemInformation,
  34. ULONG SystemInformationLength,
  35. PULONG ReturnLength
  36. );
  37.  
  38. #define SYSTEMINFO_CLASS_FIRM_TABLE 0x4C
  39. #define SMBIOS_STRUCTURE_SEPARATOR_SIZE 2
  40. #define SMBIOS_STRUCTURE_SEPARATOR "\0\0"
  41. #define SMBIOS_TABLE_SIGNATURE 0x52534D42
  42.  
  43.  
  44. #define XNADDR_LEN 0x1C
  45. #define PLAYER_NAME_MAXLEN 0x0C
  46. #define ADDRESS_XUID 0x05A7B1D8
  47. #define ADDRESS_PLAYER_INFO 0x05CCB138
  48. #define ADDRESS_PLAYER_STATS 0x01CDAFBC
  49. #define ADDRESS_XNADDRESS_BUFFER 0x00464A58
  50. #define ADDRESS_UNNAMEDPLAYER_NAME 0x007E5AC4
  51.  
  52. #define RAND_STR_MASK_LEN 62
  53. static const char *RAND_STR_MASK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  54.  
  55.  
  56. //Mersienne Twister pseudorandom number generator
  57. class MTRand {
  58. // Data
  59. public:
  60. enum { N = 624 }; // length of state vector
  61. enum { SAVE = N + 1 }; // length of array for save()
  62.  
  63. protected:
  64. enum { M = 397 }; // period parameter
  65.  
  66. uint32 state[N]; // internal state
  67. uint32 *pNext; // next value to get from state
  68. int left; // number of values left before reload needed
  69.  
  70. //Methods
  71. public:
  72. MTRand( const uint32& oneSeed ); // initialize with a simple uint32
  73. MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array
  74. MTRand(); // auto-initialize with /dev/urandom or time() and clock()
  75. MTRand(const MTRand&); // prevent copy constructor
  76. MTRand& operator=(const MTRand&); // no-op operator=
  77.  
  78. // Do NOT use for CRYPTOGRAPHY without securely hashing several returned
  79. // values together, otherwise the generator state can be learned after
  80. // reading 624 consecutive values.
  81.  
  82. // Access to 32-bit random numbers
  83. double rand(); // real number in [0,1]
  84. double rand( const double& n ); // real number in [0,n]
  85. double randExc(); // real number in [0,1)
  86. double randExc( const double& n ); // real number in [0,n)
  87. double randDblExc(); // real number in (0,1)
  88. double randDblExc( const double& n ); // real number in (0,n)
  89. uint32 randInt(); // integer in [0,2^32-1]
  90. uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32
  91. double operator()() { return rand(); } // same as rand()
  92.  
  93. // Access to 53-bit random numbers (capacity of IEEE double precision)
  94. double rand53(); // real number in [0,1)
  95.  
  96. // Access to nonuniform random number distributions
  97. double randNorm( const double& mean = 0.0, const double& variance = 0.0 );
  98.  
  99. // Re-seeding functions with same behavior as initializers
  100. void seed( const uint32 oneSeed );
  101. void seed( uint32 *const bigSeed, const uint32 seedLength = N );
  102. void seed();
  103.  
  104. // Saving and loading generator state
  105. void save( uint32* saveArray ) const; // to array of size SAVE
  106. void load( uint32 *const loadArray ); // from such array
  107. /* Trinity not use streams for random values output
  108.   friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand );
  109.   friend std::istream& operator>>( std::istream& is, MTRand& mtrand );
  110.   */
  111. protected:
  112. void initialize( const uint32 oneSeed );
  113. void reload();
  114. uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; }
  115. uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; }
  116. uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
  117. uint32 mixBits( const uint32& u, const uint32& v ) const
  118. { return hiBit(u) | loBits(v); }
  119. uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
  120. { return m ^ (mixBits(s0,s1)>>1) ^ uint32(-(int32)(loBit(s1) & 0x9908b0dfUL)); }
  121. static uint32 hash( time_t t, clock_t c );
  122. };
  123.  
  124. inline MTRand::MTRand(const MTRand&)
  125. { seed(); }
  126.  
  127. inline MTRand& MTRand::operator=(const MTRand&)
  128. { return *this; }
  129.  
  130. inline MTRand::MTRand( const uint32& oneSeed )
  131. { seed(oneSeed); }
  132.  
  133. inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength )
  134. { seed(bigSeed,seedLength); }
  135.  
  136. inline MTRand::MTRand()
  137. { seed(); }
  138.  
  139. inline double MTRand::rand()
  140. { return double(randInt()) * (1.0/4294967295.0); }
  141.  
  142. inline double MTRand::rand( const double& n )
  143. { return rand() * n; }
  144.  
  145. inline double MTRand::randExc()
  146. { return double(randInt()) * (1.0/4294967296.0); }
  147.  
  148. inline double MTRand::randExc( const double& n )
  149. { return randExc() * n; }
  150.  
  151. inline double MTRand::randDblExc()
  152. { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); }
  153.  
  154. inline double MTRand::randDblExc( const double& n )
  155. { return randDblExc() * n; }
  156.  
  157. inline double MTRand::rand53()
  158. {
  159. uint32 a = randInt() >> 5, b = randInt() >> 6;
  160. return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada
  161. }
  162.  
  163. inline double MTRand::randNorm( const double& mean, const double& variance )
  164. {
  165. // Return a real number from a normal (Gaussian) distribution with given
  166. // mean and variance by Box-Muller method
  167. double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
  168. double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
  169. return mean + r * cos(phi);
  170. }
  171.  
  172. inline uint32 MTRand::randInt()
  173. {
  174. // Pull a 32-bit integer from the generator state
  175. // Every other access function simply transforms the numbers extracted here
  176.  
  177. if( left == 0 ) reload();
  178. --left;
  179.  
  180. register uint32 s1;
  181. s1 = *pNext++;
  182. s1 ^= (s1 >> 11);
  183. s1 ^= (s1 << 7) & 0x9d2c5680UL;
  184. s1 ^= (s1 << 15) & 0xefc60000UL;
  185. return ( s1 ^ (s1 >> 18) );
  186. }
  187.  
  188. inline uint32 MTRand::randInt( const uint32& n )
  189. {
  190. // Find which bits are used in n
  191. // Optimized by Magnus Jonsson (magnus@smartelectronix.com)
  192. uint32 used = n;
  193. used |= used >> 1;
  194. used |= used >> 2;
  195. used |= used >> 4;
  196. used |= used >> 8;
  197. used |= used >> 16;
  198.  
  199. // Draw numbers until one is found in [0,n]
  200. uint32 i;
  201. do
  202. i = randInt() & used; // toss unused bits to shorten search
  203. while( i > n );
  204. return i;
  205. }
  206.  
  207. inline void MTRand::seed( const uint32 oneSeed )
  208. {
  209. // Seed the generator with a simple uint32
  210. initialize(oneSeed);
  211. reload();
  212. }
  213.  
  214. inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
  215. {
  216. // Seed the generator with an array of uint32's
  217. // There are 2^19937-1 possible initial states. This function allows
  218. // all of those to be accessed by providing at least 19937 bits (with a
  219. // default seed length of N = 624 uint32's). Any bits above the lower 32
  220. // in each element are discarded.
  221. // Just call seed() if you want to get array from /dev/urandom
  222. initialize(19650218UL);
  223. register int i = 1;
  224. register uint32 j = 0;
  225. register int k = ( N > int(seedLength) ? N : int(seedLength) );
  226. for (; k; --k )
  227. {
  228. state[i] =
  229. state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL );
  230. state[i] += ( bigSeed[j] & 0xffffffffUL ) + j;
  231. state[i] &= 0xffffffffUL;
  232. ++i; ++j;
  233. if( i >= N ) { state[0] = state[N-1]; i = 1; }
  234. if( j >= seedLength ) j = 0;
  235. }
  236. for (k = N - 1; k; --k )
  237. {
  238. state[i] =
  239. state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL );
  240. state[i] -= i;
  241. state[i] &= 0xffffffffUL;
  242. ++i;
  243. if( i >= N ) { state[0] = state[N-1]; i = 1; }
  244. }
  245. state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array
  246. reload();
  247. }
  248.  
  249. inline void MTRand::seed()
  250. {
  251. // Seed the generator with hash of time() and clock() values
  252. seed( hash( time(NULL), clock() ) );
  253. }
  254.  
  255. inline void MTRand::initialize( const uint32 seed )
  256. {
  257. // Initialize generator state with seed
  258. // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
  259. // In previous versions, most significant bits (MSBs) of the seed affect
  260. // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto.
  261. register uint32 *s = state;
  262. register uint32 *r = state;
  263. register int i = 1;
  264. *s++ = seed & 0xffffffffUL;
  265. for (; i < N; ++i )
  266. {
  267. *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
  268. r++;
  269. }
  270. }
  271.  
  272. inline void MTRand::reload()
  273. {
  274. // Generate N new values in state
  275. // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
  276. register uint32 *p = state;
  277. register int i;
  278. for (i = N - M; i--; ++p )
  279. *p = twist( p[M], p[0], p[1] );
  280. for (i = M; --i; ++p )
  281. *p = twist( p[M-N], p[0], p[1] );
  282. *p = twist( p[M-N], p[0], state[0] );
  283.  
  284. left = N, pNext = state;
  285. }
  286.  
  287. inline uint32 MTRand::hash( time_t t, clock_t c )
  288. {
  289. // Get a uint32 from t and c
  290. // Better than uint32(x) in case x is floating point in [0,1]
  291. // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
  292.  
  293. static uint32 differ = 0; // guarantee time-based seeds will change
  294.  
  295. uint32 h1 = 0;
  296. unsigned char *p = (unsigned char *) &t;
  297. for (size_t i = 0; i < sizeof(t); ++i )
  298. {
  299. h1 *= UCHAR_MAX + 2U;
  300. h1 += p[i];
  301. }
  302. uint32 h2 = 0;
  303. p = (unsigned char *) &c;
  304. for (size_t j = 0; j < sizeof(c); ++j )
  305. {
  306. h2 *= UCHAR_MAX + 2U;
  307. h2 += p[j];
  308. }
  309. return ( h1 + differ++ ) ^ h2;
  310. }
  311.  
  312. inline void MTRand::save( uint32* saveArray ) const
  313. {
  314. register uint32 *sa = saveArray;
  315. register const uint32 *s = state;
  316. register int i = N;
  317. for (; i--; *sa++ = *s++ ) {}
  318. *sa = left;
  319. }
  320.  
  321. inline void MTRand::load( uint32 *const loadArray )
  322. {
  323. register uint32 *s = state;
  324. register uint32 *la = loadArray;
  325. register int i = N;
  326. for (; i--; *s++ = *la++ ) {}
  327. left = *la;
  328. pNext = &state[N-left];
  329. }
  330.  
  331. static MTRand mtRandom;
  332. pZwQuerySystemInformation ZwQuerySystemInformation;
  333.  
  334.  
  335. //SMBIOS Raw Data changer
  336. namespace SMBIOS
  337. {
  338.  
  339. typedef struct _StructureHeader
  340. {
  341. uint8 Type;
  342. uint8 FormattedSize;
  343. uint16 Handle; //Unique handle for this structure for later recall
  344. uint8 Data[];
  345. }StructureHeader;
  346.  
  347. enum StructureType
  348. {
  349. BIOS_INFO_TYPE = 0x00,
  350. SYSTEM_INFO_TYPE = 0x01,
  351. BASEBOARD_INFO_TYPE = 0x02,
  352. CHASSIS_INFO_TYPE = 0x03,
  353. PROCESSOR_INFO_TYPE = 0x04,
  354. CACHE_INFO_TYPE = 0x07,
  355. PORTS_INFO_TYPE = 0x08,
  356. SYSTEMSLOTS_INFO_TYPE = 0x09,
  357. ONBOARDDEVS_INFO_TYPE = 0x0A,
  358. OEMSTRING_INFO_TYPE = 0x0B,
  359. SYSTEMCONFIG_INFO_TYPE = 0x0C,
  360. BIOSLANG_INFO_TYPE = 0x0D,
  361. GROUPASSOCS_INFO_TYPE = 0x0E,
  362. SYSLOG_INFO_TYPE = 0x0F,
  363. PHYSMEM_INFO_TYPE = 0x10,
  364. MEMDEV_INFO_TYPE = 0x11,
  365. MEMERROR32_INFO_TYPE = 0x12,
  366. MEMARRAYMAPPED_INFO_TYPE = 0x13,
  367. MEMDEVMAPPED_INFO_TYPE = 0x14,
  368. BUILTINPTRDEV_INFO_TYPE = 0x15,
  369. BATTERY_INFO_TYPE = 0x16,
  370. SYSRESET_INFO_TYPE = 0x17,
  371. HARDSEC_INFO_TYPE = 0x18,
  372. SYSPOWER_INFO_TYPE = 0x19,
  373. VOLTPROBE_INFO_TYPE = 0x1A,
  374. COOLINGDEV_INFO_TYPE = 0x1B,
  375. TEMPPROBE_INFO_TYPE = 0x1C,
  376. ELECPROBE_INFO_TYPE = 0x1D,
  377. OOBRA_INFO_TYPE = 0x1E,
  378. SYSBOOT_INFO_TYPE = 0x20,
  379. MEMERROR64_INFO_TYPE = 0x21,
  380. MNGDEV_INFO_TYPE = 0x22,
  381. MNGDEVCOMP_INFO_TYPE = 0x23,
  382. MNGDEVTHRES_INFO_TYPE = 0x24,
  383. MEMCHAN_INFO_TYPE = 0x25,
  384. IPMIDEV_INFO_TYPE = 0x26,
  385. POWERSUPPLY_INFO_TYPE = 0x27,
  386. ADDITIONAL_INFO_TYPE = 0x28,
  387. ONBOARDDEVSEX_INFO_TYPE = 0x29,
  388. MNGCTRLHOSTIF_INFO_TYPE = 0x2A,
  389. INACTIVE_INFO_TYPE = 0x7E,
  390. EOF_INFO_TYPE = 0x7F,
  391. };
  392.  
  393. class AlterInfo
  394. {
  395. public:
  396. AlterInfo(uint8 *_buffer, uint32 _size) : m_Buffer(_buffer), m_BufferSize(_size), m_BufferPtr(sizeof(uint32) + sizeof(uint32)){} //Skip version and length
  397.  
  398. void Process( void )
  399. {
  400. int32 currentStLen = 0;
  401. while((currentStLen = GetStructureLen()) > (SMBIOS_STRUCTURE_SEPARATOR_SIZE+sizeof(uint32)))
  402. {
  403. StructureHeader* pHeader = ((StructureHeader *)&m_Buffer[m_BufferPtr]);
  404. char *pStringBuffer = ((char *)&m_Buffer[m_BufferPtr+pHeader->FormattedSize]);
  405. while(*pStringBuffer)
  406. {
  407. //Fill strings with rand32om chars within the mask
  408. while(*pStringBuffer)
  409. {
  410. *pStringBuffer = RAND_STR_MASK[mtRandom.randInt() % RAND_STR_MASK_LEN];
  411. ++pStringBuffer;
  412. }
  413. ++pStringBuffer;
  414. }
  415.  
  416. switch(pHeader->Type)
  417. {
  418. case BIOS_INFO_TYPE:
  419. StCallback_BiosInfo(pHeader);
  420. break;
  421. case SYSTEM_INFO_TYPE:
  422. StCallback_SysInfo(pHeader);
  423. break;
  424. case BASEBOARD_INFO_TYPE:
  425. StCallback_MBInfo(pHeader);
  426. break;
  427. case CHASSIS_INFO_TYPE:
  428. StCallback_ChassisInfo(pHeader);
  429. break;
  430. case PROCESSOR_INFO_TYPE:
  431. StCallback_CpuInfo(pHeader);
  432. break;
  433. case CACHE_INFO_TYPE:
  434. StCallback_CacheInfo(pHeader);
  435. break;
  436. case PORTS_INFO_TYPE:
  437. StCallback_PortsInfo(pHeader);
  438. break;
  439. case SYSTEMSLOTS_INFO_TYPE:
  440. StCallback_SystemSlotsInfo(pHeader);
  441. break;
  442. case ONBOARDDEVS_INFO_TYPE:
  443. StCallback_OnBoardDevsInfo(pHeader);
  444. break;
  445. case OEMSTRING_INFO_TYPE:
  446. StCallback_OemStringsInfo(pHeader);
  447. break;
  448. case SYSTEMCONFIG_INFO_TYPE:
  449. StCallback_SysConfigInfo(pHeader);
  450. break;
  451. case BIOSLANG_INFO_TYPE:
  452. StCallback_BiosLangInfo(pHeader);
  453. break;
  454. case GROUPASSOCS_INFO_TYPE:
  455. StCallback_GroupAssocsInfo(pHeader);
  456. break;
  457. case SYSLOG_INFO_TYPE:
  458. StCallback_SysLogInfo(pHeader);
  459. break;
  460. case PHYSMEM_INFO_TYPE:
  461. StCallback_PhysMemInfo(pHeader);
  462. break;
  463. case MEMDEV_INFO_TYPE:
  464. StCallback_MemDevInfo(pHeader);
  465. break;
  466. case MEMERROR32_INFO_TYPE:
  467. StCallback_MemError32Info(pHeader);
  468. break;
  469. case MEMARRAYMAPPED_INFO_TYPE:
  470. StCallback_MemArrayMappedInfo(pHeader);
  471. break;
  472. case MEMDEVMAPPED_INFO_TYPE:
  473. StCallback_MemDevMappedInfo(pHeader);
  474. break;
  475. case BUILTINPTRDEV_INFO_TYPE:
  476. StCallback_BuiltInPtrDevInfo(pHeader);
  477. break;
  478. case BATTERY_INFO_TYPE:
  479. StCallback_BatteryInfo(pHeader);
  480. break;
  481. case SYSRESET_INFO_TYPE:
  482. StCallback_SysResetInfo(pHeader);
  483. break;
  484. case HARDSEC_INFO_TYPE:
  485. StCallback_HardwareSecurityInfo(pHeader);
  486. break;
  487. case SYSPOWER_INFO_TYPE:
  488. StCallback_SysPowerInfo(pHeader);
  489. break;
  490. case VOLTPROBE_INFO_TYPE:
  491. StCallback_VoltageProbeInfo(pHeader);
  492. break;
  493. case COOLINGDEV_INFO_TYPE:
  494. StCallback_CoolingDevInfo(pHeader);
  495. break;
  496. case TEMPPROBE_INFO_TYPE:
  497. StCallback_TempProbeInfo(pHeader);
  498. break;
  499. case ELECPROBE_INFO_TYPE:
  500. StCallback_ElectricalProbeInfo(pHeader);
  501. break;
  502. case OOBRA_INFO_TYPE:
  503. StCallback_OobRemoteAccessInfo(pHeader);
  504. break;
  505. case SYSBOOT_INFO_TYPE:
  506. StCallback_SysBootInfo(pHeader);
  507. break;
  508. case MEMERROR64_INFO_TYPE:
  509. StCallback_MemError64Info(pHeader);
  510. break;
  511. case MNGDEV_INFO_TYPE:
  512. StCallback_ManageDevInfo(pHeader);
  513. break;
  514. case MNGDEVCOMP_INFO_TYPE:
  515. StCallback_ManageDevCompInfo(pHeader);
  516. break;
  517. case MNGDEVTHRES_INFO_TYPE:
  518. StCallback_ManageDevThresholdInfo(pHeader);
  519. break;
  520. case MEMCHAN_INFO_TYPE:
  521. StCallback_MemChannelInfo(pHeader);
  522. break;
  523. case IPMIDEV_INFO_TYPE:
  524. StCallback_IpmiDevInfo(pHeader);
  525. break;
  526. case POWERSUPPLY_INFO_TYPE:
  527. StCallback_PowerSupplyInfo(pHeader);
  528. break;
  529. case ADDITIONAL_INFO_TYPE:
  530. StCallback_AdditionalInfo(pHeader);
  531. break;
  532. case ONBOARDDEVSEX_INFO_TYPE:
  533. StCallback_OnBoardDevExInfo(pHeader);
  534. break;
  535. case MNGCTRLHOSTIF_INFO_TYPE:
  536. StCallback_ManageControlHostInterfaceInfo(pHeader);
  537. break;
  538. }
  539.  
  540. m_BufferPtr+=currentStLen;
  541. }
  542.  
  543.  
  544. }
  545.  
  546. private:
  547. int32 GetStructureLen( void )
  548. {
  549. uint16 Offset = m_BufferPtr;
  550. uint16 BufferLen = m_BufferSize;
  551. StructureHeader* pHeader = ((StructureHeader *)&m_Buffer[m_BufferPtr]);
  552.  
  553. Offset+=pHeader->FormattedSize;
  554.  
  555. while(Offset < BufferLen)
  556. if(!memcmp(&m_Buffer[Offset], SMBIOS_STRUCTURE_SEPARATOR, SMBIOS_STRUCTURE_SEPARATOR_SIZE))
  557. return Offset-m_BufferPtr+SMBIOS_STRUCTURE_SEPARATOR_SIZE;
  558. else ++Offset;
  559.  
  560. return -1;
  561. }
  562.  
  563. //BIOS_INFO_TYPE:
  564. void StCallback_BiosInfo(StructureHeader *Header)
  565. {
  566. uint8 rTo = Header->FormattedSize-sizeof(uint32);
  567. *((uint16 *)(Header->Data + 0x02)) = mtRandom.randInt() & 0xFFFF;
  568. Header->Data[0x05] = mtRandom.randInt() & 0xFF;
  569. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  570. *((uint32 *)(Header->Data + 0x0A)) = mtRandom.randInt();
  571. for(uint8 i = 0x0E; i < rTo; ++i)
  572. Header->Data[i] = mtRandom.randInt() & 0xFF;
  573. }
  574.  
  575. //SYSTEM_INFO_TYPE:
  576. void StCallback_SysInfo(StructureHeader *Header)
  577. {
  578. if(Header->FormattedSize < 0x19)
  579. return;
  580.  
  581. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  582. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  583. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  584. *((uint32 *)(Header->Data + 0x10)) = mtRandom.randInt();
  585. Header->Data[0x14] = mtRandom.randInt() & 0xFF;
  586. }
  587.  
  588. //BASEBOARD_INFO_TYPE:
  589. void StCallback_MBInfo(StructureHeader *Header)
  590. {
  591. uint8 rTo = Header->FormattedSize-sizeof(uint32);
  592. Header->Data[0x05] = mtRandom.randInt() & 0xFF;
  593. *((uint16 *)(Header->Data + 0x07)) = mtRandom.randInt() & 0xFFFF;
  594. Header->Data[0x09] = mtRandom.randInt() & 0xFF;
  595. Header->Data[0x0A] = mtRandom.randInt() & 0xFF;
  596. for(uint8 i = 0x0B; i < rTo; ++i)
  597. Header->Data[i] = mtRandom.randInt() & 0xFF;
  598. }
  599.  
  600. //CHASSIS_INFO_TYPE:
  601. void StCallback_ChassisInfo(StructureHeader *Header)
  602. {
  603. uint8 rTo = Header->FormattedSize-sizeof(uint8)-sizeof(uint32);
  604. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  605. *((uint32 *)(Header->Data + 0x05)) = mtRandom.randInt();
  606. *((uint32 *)(Header->Data + 0x09)) = mtRandom.randInt();
  607. *((uint32 *)(Header->Data + 0x0D)) = mtRandom.randInt();
  608. for(uint8 i = 0x11; i < rTo; ++i)
  609. Header->Data[i] = mtRandom.randInt() & 0xFF;
  610. }
  611.  
  612. //PROCESSOR_INFO_TYPE:
  613. void StCallback_CpuInfo(StructureHeader *Header)
  614. {
  615. *((uint16 *)(Header->Data + 0x01)) = mtRandom.randInt() & 0xFFFF;
  616. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  617. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  618. Header->Data[0x0D] = mtRandom.randInt() & 0xFF;
  619. *((uint32 *)(Header->Data + 0x0E)) = mtRandom.randInt();
  620. *((uint32 *)(Header->Data + 0x12)) = mtRandom.randInt();
  621. *((uint32 *)(Header->Data + 0x16)) = mtRandom.randInt();
  622. *((uint16 *)(Header->Data + 0x1A)) = mtRandom.randInt() & 0xFFFF;
  623. Header->Data[0x1F] = mtRandom.randInt() & 0xFF;
  624. *((uint16 *)(Header->Data + 0x20)) = mtRandom.randInt() & 0xFFFF;
  625. *((uint32 *)(Header->Data + 0x22)) = mtRandom.randInt();
  626. }
  627.  
  628. //CACHE_INFO_TYPE:
  629. void StCallback_CacheInfo(StructureHeader *Header)
  630. {
  631. *((uint32 *)(Header->Data + 0x01)) = mtRandom.randInt();
  632. *((uint32 *)(Header->Data + 0x05)) = mtRandom.randInt();
  633. *((uint32 *)(Header->Data + 0x09)) = mtRandom.randInt();
  634. *((uint16 *)(Header->Data + 0x0D)) = mtRandom.randInt() & 0xFFFF;
  635. }
  636.  
  637. //PORTS_INFO_TYPE:
  638. void StCallback_PortsInfo(StructureHeader *Header)
  639. {
  640. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  641. *((uint16 *)(Header->Data + 0x03)) = mtRandom.randInt() & 0xFFFF;
  642. }
  643.  
  644. //SYSTEMSLOTS_INFO_TYPE:
  645. void StCallback_SystemSlotsInfo(StructureHeader *Header)
  646. {
  647. *((uint32 *)(Header->Data + 0x01)) = mtRandom.randInt();
  648. *((uint32 *)(Header->Data + 0x05)) = mtRandom.randInt();
  649. *((uint32 *)(Header->Data + 0x09)) = mtRandom.randInt();
  650. }
  651.  
  652. //ONBOARDDEVS_INFO_TYPE:
  653. void StCallback_OnBoardDevsInfo(StructureHeader *Header)
  654. {
  655. uint8 devCount = (Header->FormattedSize - sizeof(uint32))/sizeof(uint16);
  656. for(uint8 i = 0; i < devCount; ++i)
  657. Header->Data[2*i] = mtRandom.randInt() & 0xFF;
  658. }
  659.  
  660. //OEMSTRING_INFO_TYPE:
  661. void StCallback_OemStringsInfo(StructureHeader *Header)
  662. {//Nothing to do here
  663. }
  664.  
  665. //SYSTEMCONFIG_INFO_TYPE:
  666. void StCallback_SysConfigInfo(StructureHeader *Header)
  667. {//Nothing to do here
  668. }
  669.  
  670. //BIOSLANG_INFO_TYPE:
  671. void StCallback_BiosLangInfo(StructureHeader *Header)
  672. {
  673. Header->Data[0x01] = mtRandom.randInt() & 0x01;
  674. }
  675.  
  676. //GROUPASSOCS_INFO_TYPE:
  677. void StCallback_GroupAssocsInfo(StructureHeader *Header)
  678. {
  679. uint8 rTo = Header->FormattedSize-sizeof(uint32);
  680. for(uint8 i = 0x01; i < rTo; ++i)
  681. Header->Data[i] = mtRandom.randInt() & 0xFF;
  682. }
  683.  
  684. //SYSLOG_INFO_TYPE:
  685. void StCallback_SysLogInfo(StructureHeader *Header)
  686. {
  687. uint8 rTo = Header->FormattedSize-sizeof(uint32);
  688. *((uint16 *)(Header->Data + 0x06)) = mtRandom.randInt() & 0xFFFF;
  689. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  690. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  691. Header->Data[0x10] = mtRandom.randInt() & 0xFF;
  692. for(uint8 i = 0x13; i < rTo; ++i)
  693. Header->Data[i] = mtRandom.randInt() & 0xFF;
  694. }
  695.  
  696. //PHYSMEM_INFO_TYPE:
  697. void StCallback_PhysMemInfo(StructureHeader *Header)
  698. {
  699. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  700. *((uint16 *)(Header->Data + 0x01)) = mtRandom.randInt() & 0xFFFF;
  701. *((uint32 *)(Header->Data + 0x03)) = mtRandom.randInt();
  702. *((uint16 *)(Header->Data + 0x09)) = mtRandom.randInt() & 0xFFFF;
  703. *((uint32 *)(Header->Data + 0x0B)) = mtRandom.randInt();
  704. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  705. }
  706.  
  707. //MEMDEV_INFO_TYPE:
  708. void StCallback_MemDevInfo(StructureHeader *Header)
  709. {
  710. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  711. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  712. Header->Data[0x0E] = mtRandom.randInt() & 0xFF;
  713. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  714. Header->Data[0x17] = mtRandom.randInt() & 0xFF;
  715. *((uint32 *)(Header->Data + 0x18)) = mtRandom.randInt();
  716. *((uint16 *)(Header->Data + 0x1C)) = mtRandom.randInt() & 0xFFFF;
  717. }
  718.  
  719. //MEMERROR32_INFO_TYPE:
  720. void StCallback_MemError32Info(StructureHeader *Header)
  721. {
  722. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  723. *((uint16 *)(Header->Data + 0x01)) = mtRandom.randInt() & 0xFFFF;
  724. *((uint32 *)(Header->Data + 0x03)) = mtRandom.randInt();
  725. *((uint32 *)(Header->Data + 0x07)) = mtRandom.randInt();
  726. *((uint32 *)(Header->Data + 0x0B)) = mtRandom.randInt();
  727. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  728. }
  729.  
  730. //MEMARRAYMAPPED_INFO_TYPE:
  731. void StCallback_MemArrayMappedInfo(StructureHeader *Header)
  732. {
  733. *((uint32 *)(Header->Data + 0x00)) = mtRandom.randInt();
  734. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  735. Header->Data[0x0A] = mtRandom.randInt() & 0xFF;
  736. *((uint32 *)(Header->Data + 0x0B)) = mtRandom.randInt();
  737. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  738. *((uint32 *)(Header->Data + 0x13)) = mtRandom.randInt();
  739. *((uint32 *)(Header->Data + 0x17)) = mtRandom.randInt();
  740. }
  741.  
  742. //MEMDEVMAPPED_INFO_TYPE:
  743. void StCallback_MemDevMappedInfo(StructureHeader *Header)
  744. {
  745. *((uint32 *)(Header->Data + 0x00)) = mtRandom.randInt();
  746. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  747. Header->Data[0x0C] = mtRandom.randInt() & 0xFF;
  748. *((uint16 *)(Header->Data + 0x0D)) = mtRandom.randInt() & 0xFFFF;
  749. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  750. *((uint32 *)(Header->Data + 0x13)) = mtRandom.randInt();
  751. *((uint32 *)(Header->Data + 0x17)) = mtRandom.randInt();
  752. *((uint32 *)(Header->Data + 0x1B)) = mtRandom.randInt();
  753. }
  754.  
  755. //BUILTINPTRDEV_INFO_TYPE:
  756. void StCallback_BuiltInPtrDevInfo(StructureHeader *Header)
  757. {
  758. *((uint16 *)(Header->Data + 0x00)) = mtRandom.randInt() & 0xFFFF;
  759. }
  760.  
  761. //BATTERY_INFO_TYPE:
  762. void StCallback_BatteryInfo(StructureHeader *Header)
  763. {
  764. Header->Data[0x05] = mtRandom.randInt() & 0xFF;
  765. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  766. Header->Data[0x0B] = mtRandom.randInt() & 0xFF;
  767. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  768. Header->Data[0x11] = mtRandom.randInt() & 0xFF;
  769. *((uint32 *)(Header->Data + 0x12)) = mtRandom.randInt();
  770. }
  771.  
  772. //SYSRESET_INFO_TYPE:
  773. void StCallback_SysResetInfo(StructureHeader *Header)
  774. {
  775. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  776. *((uint32 *)(Header->Data + 0x01)) = mtRandom.randInt();
  777. *((uint32 *)(Header->Data + 0x05)) = mtRandom.randInt();
  778. }
  779.  
  780. //HARDSEC_INFO_TYPE:
  781. void StCallback_HardwareSecurityInfo(StructureHeader *Header)
  782. {
  783. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  784. }
  785.  
  786. //SYSPOWER_INFO_TYPE:
  787. void StCallback_SysPowerInfo(StructureHeader *Header)
  788. {
  789. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  790. *((uint32 *)(Header->Data + 0x01)) = mtRandom.randInt();
  791. }
  792.  
  793. //VOLTPROBE_INFO_TYPE:
  794. void StCallback_VoltageProbeInfo(StructureHeader *Header)
  795. {
  796. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  797. *((uint32 *)(Header->Data + 0x02)) = mtRandom.randInt();
  798. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  799. *((uint32 *)(Header->Data + 0x0A)) = mtRandom.randInt();
  800. *((uint32 *)(Header->Data + 0x0E)) = mtRandom.randInt();
  801. }
  802.  
  803. //COOLINGDEV_INFO_TYPE:
  804. void StCallback_CoolingDevInfo(StructureHeader *Header)
  805. {
  806. *((uint16 *)(Header->Data + 0x02)) = mtRandom.randInt() & 0xFFFF;
  807. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  808. *((uint16 *)(Header->Data + 0x08)) = mtRandom.randInt() & 0xFFFF;
  809. }
  810.  
  811. //TEMPPROBE_INFO_TYPE:
  812. void StCallback_TempProbeInfo(StructureHeader *Header)
  813. {
  814. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  815. *((uint32 *)(Header->Data + 0x02)) = mtRandom.randInt();
  816. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  817. *((uint16 *)(Header->Data + 0x0A)) = mtRandom.randInt() & 0xFFFF;
  818. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  819. *((uint16 *)(Header->Data + 0x10)) = mtRandom.randInt() & 0xFFFF;
  820. }
  821.  
  822. //ELECPROBE_INFO_TYPE:
  823. void StCallback_ElectricalProbeInfo(StructureHeader *Header)
  824. {
  825. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  826. *((uint32 *)(Header->Data + 0x02)) = mtRandom.randInt();
  827. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  828. *((uint16 *)(Header->Data + 0x0A)) = mtRandom.randInt() & 0xFFFF;
  829. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  830. *((uint16 *)(Header->Data + 0x10)) = mtRandom.randInt() & 0xFFFF;
  831. }
  832.  
  833. //OOBRA_INFO_TYPE:
  834. void StCallback_OobRemoteAccessInfo(StructureHeader *Header)
  835. {
  836. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  837. }
  838.  
  839. //SYSBOOT_INFO_TYPE:
  840. void StCallback_SysBootInfo(StructureHeader *Header)
  841. {
  842. *((uint32 *)(Header->Data + 0x06)) = mtRandom.randInt();
  843. *((uint32 *)(Header->Data + 0x0A)) = mtRandom.randInt();
  844. *((uint16 *)(Header->Data + 0x0A)) = mtRandom.randInt() & 0xFFFF;
  845. }
  846.  
  847. //MEMERROR64_INFO_TYPE:
  848. void StCallback_MemError64Info(StructureHeader *Header)
  849. {
  850. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  851. *((uint16 *)(Header->Data + 0x01)) = mtRandom.randInt() & 0xFFFF;
  852. *((uint32 *)(Header->Data + 0x03)) = mtRandom.randInt();
  853. *((uint32 *)(Header->Data + 0x07)) = mtRandom.randInt();
  854. *((uint32 *)(Header->Data + 0x0B)) = mtRandom.randInt();
  855. *((uint32 *)(Header->Data + 0x0F)) = mtRandom.randInt();
  856. *((uint32 *)(Header->Data + 0x13)) = mtRandom.randInt();
  857. *((uint32 *)(Header->Data + 0x17)) = mtRandom.randInt();
  858. }
  859.  
  860. //MNGDEV_INFO_TYPE:
  861. void StCallback_ManageDevInfo(StructureHeader *Header)
  862. {
  863. Header->Data[0x01] = mtRandom.randInt() & 0xFF;
  864. *((uint32 *)(Header->Data + 0x02)) = mtRandom.randInt();
  865. Header->Data[0x06] = mtRandom.randInt() & 0xFF;
  866. }
  867.  
  868. //MNGDEVCOMP_INFO_TYPE:
  869. void StCallback_ManageDevCompInfo(StructureHeader *Header)
  870. {//Nothing to do
  871. }
  872.  
  873. //MNGDEVTHRES_INFO_TYPE:
  874. void StCallback_ManageDevThresholdInfo(StructureHeader *Header)
  875. {
  876. *((uint32 *)(Header->Data + 0x00)) = mtRandom.randInt();
  877. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  878. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  879. }
  880.  
  881. //MEMCHAN_INFO_TYPE:
  882. void StCallback_MemChannelInfo(StructureHeader *Header)
  883. {
  884. uint8 DevCount = (Header->FormattedSize-sizeof(uint32)-sizeof(uint16)-sizeof(uint8))/(sizeof(uint16) + sizeof(uint8));
  885. *((uint16 *)(Header->Data + 0x00)) = mtRandom.randInt() & 0xFFFF;
  886. for(uint8 i = 0x00; i < DevCount; ++i)
  887. Header->Data[0x03 + 3*i] = mtRandom.randInt() & 0xFF;
  888. }
  889.  
  890. //IPMIDEV_INFO_TYPE:
  891. void StCallback_IpmiDevInfo(StructureHeader *Header)
  892. {
  893. *((uint32 *)(Header->Data + 0x00)) = mtRandom.randInt();
  894. *((uint32 *)(Header->Data + 0x04)) = mtRandom.randInt();
  895. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  896. *((uint16 *)(Header->Data + 0x0C)) = mtRandom.randInt() & 0xFFFF;
  897. }
  898.  
  899. //POWERSUPPLY_INFO_TYPE:
  900. void StCallback_PowerSupplyInfo(StructureHeader *Header)
  901. {
  902. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  903. *((uint32 *)(Header->Data + 0x08)) = mtRandom.randInt();
  904. *((uint32 *)(Header->Data + 0x0C)) = mtRandom.randInt();
  905. *((uint16 *)(Header->Data + 0x10)) = mtRandom.randInt() & 0xFFFF;
  906. }
  907.  
  908. //ADDITIONAL_INFO_TYPE:
  909. void StCallback_AdditionalInfo(StructureHeader *Header)
  910. {//Fomart has not a fix std, so we don't modify it
  911. }
  912.  
  913. //ONBOARDDEVSEX_INFO_TYPE:
  914. void StCallback_OnBoardDevExInfo(StructureHeader *Header)
  915. {
  916. *((uint32 *)(Header->Data + 0x01)) = mtRandom.randInt();
  917. *((uint16 *)(Header->Data + 0x05)) = mtRandom.randInt() & 0xFFFF;
  918. }
  919.  
  920. //MNGCTRLHOSTIF_INFO_TYPE:
  921. void StCallback_ManageControlHostInterfaceInfo(StructureHeader *Header)
  922. {
  923. Header->Data[0x00] = mtRandom.randInt() & 0xFF;
  924. }
  925.  
  926. protected:
  927. uint8 *m_Buffer;
  928. uint32 m_BufferPtr;
  929. uint32 m_BufferSize;
  930. };
  931. };
  932.  
  933.  
  934.  
  935.  
  936. //Unban specific functions
  937. uint8 *g_XnaddrData = NULL;
  938.  
  939. void Unban_NullName( void )
  940. {
  941. //Change Name to nothing
  942. DWORD dwProtection = PAGE_EXECUTE_READWRITE;
  943. LPBYTE pPlayerInfo = LPBYTE(*LPDWORD(ADDRESS_PLAYER_INFO));
  944. if(pPlayerInfo)
  945. {
  946. LPBYTE pPlayerName = LPBYTE(pPlayerInfo+0x142);
  947. uint8 NameLen = 4 + mtRandom.randInt() % PLAYER_NAME_MAXLEN;
  948. VirtualProtect(pPlayerName, NameLen+1, dwProtection, &dwProtection);
  949. memset(pPlayerName, 0x09, NameLen); pPlayerName[NameLen] = 0;
  950. VirtualProtect(pPlayerName, NameLen+1, dwProtection, &dwProtection);
  951. }
  952. }
  953.  
  954. void Unban_ChangeXuid( void )
  955. {
  956. //Change XUID
  957. *LPDWORD(ADDRESS_XUID) = mtRandom.randInt();
  958. }
  959.  
  960. void Unban_ChangeXnaddr( void )
  961. {
  962. //Change XNADDR
  963. for(uint8 i = 0; i < XNADDR_LEN;)
  964. g_XnaddrData[i++] = mtRandom.randInt() & 0xFF;
  965. }
  966.  
  967. void Unban_ChangeSteamId( void )
  968. {
  969. LPBYTE pPlayerInfo = LPBYTE(*LPDWORD(ADDRESS_PLAYER_INFO));
  970. if(pPlayerInfo)
  971. {
  972. LPDWORD pSteamId = LPDWORD(pPlayerInfo+0x13A);
  973. pSteamId[0] = mtRandom.randInt();
  974. }
  975. }
  976.  
  977. UINT GetSystemFirmwareTableReal
  978. (
  979. DWORD FirmwareTableProviderSignature,
  980. DWORD FirmwareTableID,
  981. PVOID pFirmwareTableBuffer,
  982. DWORD BufferSize
  983. )
  984. {
  985. ULONG uReturnedLen = 0;
  986. LPBYTE pBuffer = LPBYTE(MALLOC(BufferSize+0x10));
  987. *LPDWORD(&pBuffer[0x00]) = FirmwareTableProviderSignature;
  988. *LPDWORD(&pBuffer[0x04]) = 0x00000001;
  989. *LPDWORD(&pBuffer[0x08]) = FirmwareTableID;
  990. *LPDWORD(&pBuffer[0x0C]) = BufferSize;
  991.  
  992. LONG fnRet = ZwQuerySystemInformation(SYSTEMINFO_CLASS_FIRM_TABLE, pBuffer, BufferSize+0x10, NULL);
  993.  
  994. uReturnedLen = *LPDWORD(&pBuffer[0x0C]);
  995. if(fnRet < 0)
  996. {
  997. if(fnRet != 0xC0000023)
  998. uReturnedLen = 0;
  999. }
  1000. else
  1001. memcpy(pFirmwareTableBuffer, &pBuffer[0x10], uReturnedLen);
  1002.  
  1003. FREE(pBuffer);
  1004. return uReturnedLen;
  1005. }
  1006.  
  1007. UINT Hook_GetSystemFirmwareTable
  1008. (
  1009. DWORD FirmwareTableProviderSignature,
  1010. DWORD FirmwareTableID,
  1011. PVOID pFirmwareTableBuffer,
  1012. DWORD BufferSize
  1013. )
  1014. {
  1015. UINT fnReturn = GetSystemFirmwareTableReal(FirmwareTableProviderSignature, FirmwareTableID, pFirmwareTableBuffer, BufferSize);
  1016.  
  1017. if(BufferSize && fnReturn)
  1018. {
  1019. Unban_NullName();
  1020. Unban_ChangeXuid();
  1021. Unban_ChangeXnaddr();
  1022. Unban_ChangeSteamId();
  1023. //Change SMBIOS Info
  1024. SMBIOS::AlterInfo *alterSmBios = new SMBIOS::AlterInfo((uint8 *)pFirmwareTableBuffer, fnReturn);
  1025. alterSmBios->Process();
  1026. delete alterSmBios;
  1027. }
  1028.  
  1029. return fnReturn;
  1030. }
  1031.  
  1032. void Hook( void )
  1033. {
  1034. DWORD dwProtection = PAGE_EXECUTE_READWRITE;
  1035. LPBYTE pHookAddress = LPBYTE(GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetSystemFirmwareTable"));
  1036. ZwQuerySystemInformation = pZwQuerySystemInformation(GetProcAddress(GetModuleHandleA("ntdll.dll"), "ZwQuerySystemInformation"));
  1037.  
  1038. LPBYTE pTargetAddress = LPBYTE(Hook_GetSystemFirmwareTable);
  1039. VirtualProtect(pHookAddress, JMP_HOOK_SIZE, dwProtection, &dwProtection);
  1040. *pHookAddress = 0xE9; *LPDWORD(pHookAddress + 1) = pTargetAddress-pHookAddress-JMP_HOOK_SIZE;
  1041. VirtualProtect(pHookAddress, JMP_HOOK_SIZE, dwProtection, &dwProtection);
  1042.  
  1043. //Zero fill unnamed player name string
  1044. dwProtection = PAGE_EXECUTE_READWRITE;
  1045. LPBYTE pUnnamedPlayerName = LPBYTE(ADDRESS_UNNAMEDPLAYER_NAME);
  1046. VirtualProtect(pUnnamedPlayerName, sizeof(uint8), dwProtection, &dwProtection);
  1047. *pUnnamedPlayerName = 0;
  1048. VirtualProtect(pUnnamedPlayerName, sizeof(uint8), dwProtection, &dwProtection);
  1049.  
  1050. //Change XNADDR Buffer
  1051. if(g_XnaddrData == NULL)
  1052. g_XnaddrData = ((uint8 *)MALLOC(XNADDR_LEN));
  1053.  
  1054. LPDWORD pXnAddrBuffer = LPDWORD(ADDRESS_XNADDRESS_BUFFER);
  1055. VirtualProtect(pXnAddrBuffer, sizeof(uint32), dwProtection, &dwProtection);
  1056. *pXnAddrBuffer = DWORD(g_XnaddrData);
  1057. VirtualProtect(pXnAddrBuffer, sizeof(uint32), dwProtection, &dwProtection);
  1058.  
  1059. Unban_ChangeXuid();
  1060. Unban_ChangeXnaddr();
  1061. Unban_ChangeSteamId();
  1062. }
  1063.  
  1064. BOOL APIENTRY DllMain(HMODULE, DWORD callReason, LPVOID)
  1065. {
  1066. static bool bLoaded = false;
  1067. if(callReason == DLL_PROCESS_ATTACH && !bLoaded)
  1068. {
  1069. Hook();
  1070. bLoaded = true;
  1071. }
  1072.  
  1073. return TRUE;
  1074. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty