首页
社区
课程
招聘
[原创] VMX CPUID 一键生成源
发表于: 1天前 397

[原创] VMX CPUID 一键生成源

1天前
397
	// char to binary
	static unsigned bbit(int bit) { // 0xF ->1111
		static const char* hexDigits[] = {
			"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
			"1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"
		};
		return *(unsigned*)hexDigits[bit];
	}
	static void cbbe(char* src, int _byte) { // BE
		_byte &= 0xFF;
		*(unsigned*)src = bbit(_byte >> 4);
		*(unsigned*)(src+4) = bbit(_byte & 0xF);
	}
	
	// usage: vmware_cpuid(tmp, "Intel(R) Core(TM) i9-9900X CPU @ 3.50GHz        "); // len=48+1
	static void vmware_cpuid(char* p, const char* cpu_name) { // LE
		for (int base, i = 0; i < 12; i++)
		{
			// use i * 4 
			base = i << 2;

			// char to binary BE
			cbbe(p, cpu_name[base + 3]); p += 8; *p++ = ':';
			cbbe(p, cpu_name[base + 2]); p += 8; *p++ = ':';
			cbbe(p, cpu_name[base + 1]); p += 8; *p++ = ':';
			cbbe(p, cpu_name[base + 0]); p += 8;

			*p++ = '\n';
		}
		*p = '\0';
	}

cpuid.80000002.eax = "01100101:01110100:01101110:01001001"

cpuid.80000002.ebx = "00101001:01010010:00101000:01101100"

cpuid.80000002.ecx = "01110010:01101111:01000011:00100000"

cpuid.80000002.edx = "01001101:01010100:00101000:01100101"

cpuid.80000003.eax = "00111001:01101001:00100000:00101001"

cpuid.80000003.ebx = "00110000:00111001:00111001:00101101"

cpuid.80000003.ecx = "01000011:00100000:01011000:00110000"

cpuid.80000003.edx = "01000000:00100000:01010101:01010000"

cpuid.80000004.eax = "00110101:00101110:00110011:00100000"

cpuid.80000004.ebx = "01111010:01001000:01000111:00110000"

cpuid.80000004.ecx = "00100000:00100000:00100000:00100000"

cpuid.80000004.edx = "00100000:00100000:00100000:00100000" 

再用notepad++一键全选替换


[培训]《冰与火的战歌:Windows内核攻防实战》!从零到实战,融合AI与Windows内核攻防全技术栈,打造具备自动化能力的内核开发高手。

最后于 1天前 被4seaynl编辑 ,原因:
收藏
免费 0
打赏
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回