Hey Guys
Does anyone know how to take a the first 4 bytes of a buffer and but it into a DWORD.
Cheers
Peter
Printable View
Hey Guys
Does anyone know how to take a the first 4 bytes of a buffer and but it into a DWORD.
Cheers
Peter
Didn't we just do this?
Like two days ago....
an ansi c version
PHP Code:
#define DWORD long
DWORD moveDW(char *t);
void main(void ){
char *f = "hi there";
printf("%d\n",moveDW(f) );
return;
}
DWORD moveDW(char *t){
char *buf;
int i;
union u {
unsigned char a[4];
DWORD b;
} m;
buf = t;
for(i=0;i<4;i++){
m.a[i] = *buf;
buf++;
}
return m.b;
}
LOL
Yeah except 2 days ago it was the other way round DWORD to Buffer.
LOL
Yeah except 2 days ago it was the other way round DWORD to Buffer.
DWORD a=*(DWORD*)buffer;