Fuck you, win32 API
1
Name:
Anonymous
2009-02-23 20:14
#include <windows.h>
#include <winreg.h>
#define CRYPTLEN 15
#define KEYLEN 29
#define KEYOFFSET 52
#define ALLOCSIZE 256
typedef unsigned char uchar;
char *str = "BCDFGHJKMPQRTVWXY2346789";
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
HKEY CurrentVersion;
DWORD type = REG_BINARY;
uchar *key, *buf;
int ret = EXIT_FAILURE, size = ALLOCSIZE, i, j, k, l;
if(((NULL == (buf = (uchar*)HeapAlloc(GetProcessHeap(), 0, ALLOCSIZE))) || (NULL == (key = (uchar*)HeapAlloc(GetProcessHeap(), 0, KEYLEN + 1)))) && (buf = "HeapAlloc()"))
goto _error_malloc;
if(ERROR_SUCCESS != (i = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\0", 0, KEY_READ, &CurrentVersion)))
goto _error_RegOpen;
if((ERROR_SUCCESS != (i = RegQueryValueEx(CurrentVersion, "DigitalProductId\0", NULL, &type, buf, &size))) && RegCloseKey(CurrentVersion))
goto _error_RegOpen;
for (i = KEYLEN - 1; i > -1; i--) {
if((i + 1) % 6 == 0)
key[i] = '-';
else {
k = 0;
for (j = CRYPTLEN; j > -1; j--) {
l = (k << 8) | buf[j + KEYOFFSET];
buf[j + KEYOFFSET] = l / 24;
k = (l % 24);
}
key[i] = str[k];
}
}
key[KEYLEN] = '\0';
MessageBox(NULL, key, "Key:", MB_OKCANCEL);
ret = EXIT_SUCCESS;
goto _free;
_error_RegOpen:
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, i, 0, buf, ALLOCSIZE, NULL);
_error_malloc:
MessageBox(NULL, buf, "Error", MB_OK);
_free:
HeapFree(GetProcessHeap(), 0, buf);
HeapFree(GetProcessHeap(), 0, key);
return ret;
}
2
Name:
Anonymous
2009-02-23 20:20
I can see several places where you forgot your NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
3
Name:
Anonymous
2009-02-23 20:21
PROGRAMMING is COOL !
If you are going to cry about it, do something else!
4
Name:
Anonymous
2009-02-23 20:22
>>3
I'm going to reboot to linux now.
5
Name:
Anonymous
2009-02-23 20:41
>>1
Uhh, way to make your code look convoluted by using inline assignments.
I mean don't get me wrong, the Win32 API does suck, but not for the reason you're trying to perpertrate.
6
Name:
Anonymous
2009-02-23 20:57
LEARN RUBY!
7
Name:
Anonymous
2009-02-23 21:07
>>6
But I heard it was
NOT SO FAST
8
Name:
Anonymous
2009-02-23 21:32
THIS CODE
LOOKS
LIKE
SHIT
9
Name:
Anonymous
2009-02-23 22:29
Why the fuck are you allocating fixed-size buffers with functions for dynamic allocation?
10
Name:
Anonymous
2009-02-23 22:41
>>9
Because you touch yourself at night.
11
Name:
Anonymous
2009-02-23 23:40
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\0"
"\0"
Why the fuck are you adding a null character on the end of your strings? You do know C automatically adds one for you, right?
12
Name:
Anonymous
2009-02-24 9:15
>>11
I wrote my own compiler which doesn't.
13
Name:
Anonymous
2009-02-24 9:15
ITT: BUTTHURT OP
14
Name:
Anonymous
2009-02-24 9:26
>>12
ENJOY YOUR ANSI COMPLIANCE
15
Name:
Anonymous
2009-02-24 9:30
>>8
Eternally this. Seriously, I wouldn't even look at this code if I was paid for it.
16
Name:
Anonymous
2009-02-24 9:34
>>13
BUTTHURT
Back to /b/, please.
17
Name:
Anonymous
2009-02-24 9:48
>>16
Sorry OP, the term
butthurt doesn't come from /b/
!
18
Name:
Anonymous
2009-02-24 10:12
>>17
Butthurt comes from the gay community, where people spend most of their time with a
haxxed anus .
19
Name:
Anonymous
2009-02-24 11:11
>>18
So this meem is about repressed homosexual urges and not hacking?
20
Name:
Anonymous
2009-02-24 11:17
>>19
Nothing repressed about it.
21
Name:
Anonymous
2009-02-24 11:23
>>20
So why you use such euphemisms?
22
Name:
Anonymous
2009-02-24 11:29
>>21
Go back to bed, FrozenVoid.
23
Name:
Anonymous
2009-02-24 11:33
>>22
Why i would go to bed? It would remove me from discussion.
24
Name:
Anonymous
2009-02-24 15:53
>>9
>>11
What they said -- plus why the fuck, OP, are you making spurious assignments to
i in the calls to
RegOpenKeyEx and
RegQueryValueEx?
25
Name:
Anonymous
2009-02-24 19:05
The OP only posted his code so we could see what a clever hacker he is.
26
Name:
Anonymous
2009-02-24 21:51
What the hell is an ERROR_SUCCESS?
27
Name:
Anonymous
2009-02-24 22:05
28
Name:
Anonymous
2009-02-25 0:03
in b4 null
29
Name:
Anonymous
2009-02-25 2:52
>>26
0 ERROR_SUCCESS The operation completed successfully.
So
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &CurrentVersion))
goto _error_RegOpen;
30
Name:
Anonymous
2009-02-25 2:53
Windows -- the only OS where something actually working is considered an error.
31
Name:
Anonymous
2009-02-25 4:03
>>29,29
i is needed in _error_RegOpen.
32
Name:
Anonymous
2009-02-25 4:58
>>1
OMG WTF IS THIS SHIT?!
33
Name:
Anonymous
2009-02-25 5:18
>>29
return 0 on sucess is very old, as for ERROR_SUCCESS, it's simply that all return codes(almost all except sucess code that is) are erros, so they're labeled starting with ERROR_ . You can do convert a GetLastError() code to a meaningful string using the FormatMessage API.
>>32
A quick look at it seems to indicate that it's just a simple tool for extracting the encrypted Windows Product Key from the registry.
34
Name:
Anonymous
2010-12-17 1:21
Are you GAY ?
Are you a NIGGER ?
Are you a GAY NIGGER ?
If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!
Newer Posts