regbros... why...

This commit is contained in:
Hane 2023-07-20 22:09:10 +02:00
commit aece47d7d2

View file

@ -180,18 +180,27 @@ uint64_t estimandoFreq(){
* And this is why I'm reading the reg instead * And this is why I'm reading the reg instead
*/ */
uint64_t getFreqFromReg(){ int64_t getFreqFromReg(){
//https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regenumvaluew //https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regenumvaluew
const WORD STRING_SIZE = 4;
const WCHAR COMPARE_TARGET[STRING_SIZE + 1] = L"~MHz";
DWORD longestDataSize;
LSTATUS status; LSTATUS status;
HKEY key; HKEY key;
DWORD numValues; DWORD numValues;
WCHAR valName[MAX_VALUE_NAME]; //uint32_t wtf WCHAR valName[MAX_VALUE_NAME]; //uint32_t wtf
DWORD valLen = MAX_VALUE_NAME; DWORD valLen = MAX_VALUE_NAME;
const WORD NULL_ENDING_STRING = -1;
const WCHAR* COMPARE_TARGET = TEXT("~MHz"); LPBYTE dataContent = nullptr;
DWORD dataLen;
// DOESN'T WORK MS WHY const WORD NULL_ENDING_STRING = -1;
status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), 0, status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), 0,
KEY_QUERY_VALUE, &key); KEY_QUERY_VALUE, &key);
if(status != ERROR_SUCCESS) return -1;
status = RegQueryInfoKey( status = RegQueryInfoKey(
key, // key handle key, // key handle
NULL, // buffer for class name NULL, // buffer for class name
@ -202,51 +211,67 @@ uint64_t estimandoFreq(){
NULL, // longest class string NULL, // longest class string
&numValues, // number of values for this key &numValues, // number of values for this key
NULL, // longest value name NULL, // longest value name
NULL, // longest value data &longestDataSize, // longest value data
NULL, // security descriptor NULL, // security descriptor
NULL); // last write time NULL); // last write time
/* if(status != ERROR_SUCCESS) return -2;
* status = RegOpenKeyExW(key, TEXT("CentralProcessor\\0"), 0,
* KEY_QUERY_VALUE, &key2); dataLen = sizeof(REG_QWORD) * (longestDataSize);
*/ dataContent = (LPBYTE)malloc(dataLen);
int tast; for (DWORD i = 0; i < numValues; i++){
for (int i = 0; i < numValues; i++){ valLen = MAX_VALUE_NAME;
//data NULL + len NON_NULL to get dataBufLen;
//data allocated (NON-NULL) + len NON-NULL with previous value for dataLen
//JFC MS WHY. that why we defaultin to biggis. cos not worky. ewe
dataLen = sizeof(REG_QWORD) * (longestDataSize);
status = RegEnumValueW(key, status = RegEnumValueW(key,
/* [in] DWORD dwIndex */i, i,
valName, valName,
&valLen, &valLen,
NULL, NULL,
NULL, NULL, NULL NULL,
dataContent,
&dataLen
); );
tast = CompareStringEx(
LOCALE_NAME_USER_DEFAULT, if(status != ERROR_SUCCESS) return -3;
if (CSTR_EQUAL == CompareStringEx(
LOCALE_NAME_INVARIANT,
NORM_LINGUISTIC_CASING, NORM_LINGUISTIC_CASING,
valName, valName,
NULL_ENDING_STRING, valLen,
COMPARE_TARGET, COMPARE_TARGET,
wcslen(COMPARE_TARGET), STRING_SIZE,
NULL, NULL,
NULL, NULL,
0 0
); )
) {
//dataLen = dataLen * 2lu;
/* BROS YO ES QUE ME VOY A CAGAR EN SUS PUTOS MUERTOS
* AS&iacute; QUE PIDES DOS VECES, UNA TAMA&nacute;O, OTRA A TOPE PRESISO, EH
* PUTA BASURA DE API
* status = RegEnumValueW(key,
* i,
* valName,
* &valLen,
* NULL,
* NULL,
* dataContent,
* &dataLen
* );
*/
LPDWORD PMHz = (LPDWORD)dataContent;
DWORD MHz = *PMHz;
free(dataContent);
return MHz * 1000000;
//break;
}
/*
* if (CSTR_EQUAL == CompareStringEx(
* LOCALE_NAME_INVARIANT,
* 0,
* valName,
* NULL_ENDING_STRING,
* COMPARE_TARGET,
* wcslen(COMPARE_TARGET),
* NULL,
* NULL,
* 0
* )) break;
*/
} }
uint64_t retval = (status == ERROR_SUCCESS) ? 1 : 0; return -4;
return retval;
} }
#endif #endif
@ -261,8 +286,8 @@ int main(int argc, char** argv){
log_debugcpp("ayo we found " << isItActually32GHz << " flash knuckle"); log_debugcpp("ayo we found " << isItActually32GHz << " flash knuckle");
} }
uint64_t juas = getFreqFromReg(); int64_t juas = getFreqFromReg();
log_debugcpp("JODER " << juas);
//Cordura //Cordura
int16_t result; int16_t result;
uint64_t tf = 0; uint64_t tf = 0;