From d38bd08be9ece07c672ff9a4e0721a0c9a555314 Mon Sep 17 00:00:00 2001 From: Hane Date: Wed, 19 Jul 2023 17:53:14 +0200 Subject: [PATCH] feet wet with the reg --- src/main.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2b2af87..989b9e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,10 +18,18 @@ Intel(R) 64 and IA-32 Architectures Software Developer's Manual Volume 3 (3A, 3B //TSC is incremented by the base multiplier once every reference clock, so on my Xeon E5-2680 (Sandy Bridge EP) this is an increment of 27 every 10 ns + + #ifdef _WIN64 //#include - #include + //#include + //#include + #define UNICODE #define WIN32_LEAN_AND_MEAN + #define _WIN32_WINNT _WIN32_WINNT_WIN10 //0x0A00 + #include + #include + #include #endif #ifdef NOMESELDELINUS //hilitos y tal @@ -153,6 +161,8 @@ uint64_t rdtscp(uint64_t* logicore = nullptr ) { return (rdxho << 32) + raxlo; //| } + +//labor encomiable, ahora muere uint64_t estimandoFreq(){ uint64_t test = rdtsc(); Sleep(1000); @@ -160,14 +170,36 @@ uint64_t estimandoFreq(){ return test; } +#ifdef _WIN64 +//https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getnativesysteminfo +//https://learn.microsoft.com/en-us/windows/win32/api/powerbase/nf-powerbase-callntpowerinformation?redirectedfrom=MSDN +/* + * And this is why I'm reading the reg instead + */ + + uint64_t getFreqFromReg(){ + LSTATUS status; + HKEY key; + status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("System"), 0, + KEY_QUERY_VALUE, &key); + uint64_t retval = (status == ERROR_SUCCESS) ? 1 : 0; + return retval; + } + +#endif + + int main(int argc, char** argv){ //AMD Momento char* opiniones = AMDMeCagoEnTusPutosMuertos(); bool w11 = AMDJoderMET(); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { uint64_t isItActually32GHz = estimandoFreq(); log_debugcpp("ayo we found " << isItActually32GHz << " flash knuckle"); } + + uint64_t juas = getFreqFromReg(); + //Cordura int16_t result; uint64_t tf = 0;