Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp : Defines the entry point for the console application.
- //
- //#include "stdafx.h"
- #include <iostream>
- #include <ctime>
- #include <windows.h>
- #include <psapi.h>
- #include <condition_variable>
- #include <processthreadsapi.h>
- #include <winbase.h>
- #include <time.h>
- void functie() {
- unsigned int a, b, c, d, aux;
- unsigned int x;
- int k;
- char vendor[13];
- __asm {
- pushfd
- pop ecx
- mov b, ecx
- mov aux, ecx
- }
- x = b ^ (1 << 21);
- __asm {
- push x
- popfd
- }
- __asm {
- pushfd
- pop ecx
- mov b, ecx
- }
- if (b == x) {
- k = 1;
- printf("registrul EFLAGS se poate modifica \n");
- }
- else {
- printf("registrul EFLAGS nu se poate modifica \n");
- return;
- }
- __asm {
- push aux
- popfd
- }
- if (k) {
- a = 0;
- char vendor[13];
- __asm {
- mov eax, a
- cpuid
- mov DWORD PTR vendor, EBX
- mov DWORD PTR vendor + 4, EDX
- mov DWORD PTR vendor + 8, ECX
- }
- vendor[12] = 0;
- printf("%s\n", vendor);
- a = 1;
- int modelNumber, familyCode, extendedMode, processorType, extendedFamily;
- __asm {
- mov eax, a
- cpuid
- mov b, eax
- }
- modelNumber = (b >> 4) & 15;
- familyCode = (b >> 8) & 15;
- processorType= (b >> 12) & 3;
- extendedMode = (b >> 16) & 15;
- extendedFamily = (b >> 20) & 255;
- printf("%d %d %d %d %d\n", extendedFamily, extendedMode, processorType, familyCode, modelNumber );
- a = 1;
- int brandId;
- __asm {
- mov eax, a
- cpuid
- mov b, ebx
- }
- brandId = b&255;
- printf("%d\n", brandId);
- a = 1;
- int flags;
- __asm {
- mov eax, a
- cpuid
- mov b, ecx
- }
- flags = b;
- if (b & 1)
- printf("FPU\n");
- if ((b >>1) & 1)
- printf("VME\n");
- if ((b >> 2) & 1)
- printf("DE\n");
- if ((b >> 3) & 1)
- printf("PSE\n");
- a = 11;
- b = 1;
- __asm {
- mov eax, a
- mov ecx, b
- cpuid
- mov b, ebx
- }
- printf("%d\n",b & (256*256-1));
- while (1) {
- a = 2;
- __asm {
- mov eax, a
- cpuid
- mov a, eax
- mov b, ebx
- mov c, ecx
- mov d, edx
- }
- if (!(b >> 31)) {
- printf("b ");
- printf("%d %d %d %d\n", (b >> 24) & 255, (b >> 16) & 255, (b >> 8) & 255, b & 255);
- }
- if (!(c >> 31)) {
- printf("c ");
- printf("%d %d %d %d\n", (c >> 24) & 255, (c >> 16) & 255, (c >> 8) & 255, c & 255);
- }
- if (!(d >> 31)) {
- printf("d ");
- printf("%d %d %d %d\n", (d >> 24) & 255, (d >> 16) & 255, (d >> 8) & 255, d & 255);
- }
- if ((a & 255) == 1)
- break;
- }
- }
- }
- int main()
- {
- functie();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement