[more] Не работает декремент и xor. Коппилируется нормально. Не ребочие строки откоментированны. Исходник ниже.
Код: #include <Windows.h>
#include <cstdlib>
#include <stdio.h>
#include <time.h>
#include <iso646.h>
using std::srand;
using std::rand;
int main()
{
printf("CrackMe 09 \n");
PHKEY hKey;
DWORD res;
DWORD TYPE;
DWORD Count1;
DWORD Count2;
if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\crack09", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, hKey, &res)!=ERROR_SUCCESS)
return 0;
if(res==REG_CREATED_NEW_KEY)
{
srand((unsigned)time(0));
Count1=(unsigned)rand();
Count2=0x100^Count1;
RegSetValueEx(*hKey, "Count1", 0, REG_DWORD, (CONST BYTE *) &Count1, 4);
RegSetValueEx(*hKey, "Count2", 0, REG_DWORD, (CONST BYTE *) &Count2, 4);
printf("Base count have saved! \n");
}
else
{
res = 4;
RegQueryValueEx(*hKey, "Count1", 0, &TYPE, (LPBYTE)&Count1, &res);
RegQueryValueEx(*hKey, "Count1", 0, &TYPE, (LPBYTE)&Count2, &res);
Count2 = Count2^Count1;//тут не работает
Count2--;//тут не работает
printf("Count %x \n",Count2);
if (!Count2) return 0;
srand((unsigned)time(0));
Count1 = (unsigned)rand();
Count2 = Count2^Count1;
RegSetValueEx(*hKey, "Count1", 0, REG_DWORD, (CONST BYTE *) &Count1, 4);
RegSetValueEx(*hKey, "Count2", 0, REG_DWORD, (CONST BYTE *) &Count2, 4);
}
RegCloseKey(*hKey);
return 0;
}
Код: #include <Windows.h>
#include <cstdlib>
#include <stdio.h>
#include <time.h>
#include <iso646.h>
using std::srand;
using std::rand;
int main()
{
printf("CrackMe 09 \n");
PHKEY hKey;
DWORD res;
DWORD TYPE;
DWORD Count1;
DWORD Count2;
if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\crack09", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, hKey, &res)!=ERROR_SUCCESS)
return 0;
if(res==REG_CREATED_NEW_KEY)
{
srand((unsigned)time(0));
Count1=(unsigned)rand();
Count2=0x100^Count1;
RegSetValueEx(*hKey, "Count1", 0, REG_DWORD, (CONST BYTE *) &Count1, 4);
RegSetValueEx(*hKey, "Count2", 0, REG_DWORD, (CONST BYTE *) &Count2, 4);
printf("Base count have saved! \n");
}
else
{
res = 4;
RegQueryValueEx(*hKey, "Count1", 0, &TYPE, (LPBYTE)&Count1, &res);
RegQueryValueEx(*hKey, "Count1", 0, &TYPE, (LPBYTE)&Count2, &res);
Count2 = Count2^Count1;//тут не работает
Count2--;//тут не работает
printf("Count %x \n",Count2);
if (!Count2) return 0;
srand((unsigned)time(0));
Count1 = (unsigned)rand();
Count2 = Count2^Count1;
RegSetValueEx(*hKey, "Count1", 0, REG_DWORD, (CONST BYTE *) &Count1, 4);
RegSetValueEx(*hKey, "Count2", 0, REG_DWORD, (CONST BYTE *) &Count2, 4);
}
RegCloseKey(*hKey);
return 0;
}