Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Everything works fine and I found the signature. BUT I also want to get the base address where he found this signature. So I want to convert the pointer into an integer which contains the base addresse where he found it (e.g. 0E00FF or something like this). I'm using gcc.
I hope you can help me with this problem.
ehh... youre ads is an integer and start at E0000 and you want to now the address? well eh.. maybe E0000 + ads?
ok, now for the reasonable answer, the address in c/c++ is &bios32[ads] the & means address off and depending on wheter you use 32-bit or 64-bit addressing you need to store the address in either an int (32-bit) or long long (64-bit).
also don't use goto it is bad programming practise. you could use the break statement which would jump out of the while loop.
Everything works fine and I found the signature. BUT I also want to get the base address where he found this signature. So I want to convert the pointer into an integer which contains the base addresse where he found it (e.g. 0E00FF or something like this). I'm using gcc.
I hope you can help me with this problem.
THX!
Hi,
It is in general a bad idea to convert a pointer into an integer but use a pointer. But, if you insist, you can code this:
unsigned int address_num = (unsigned int) address;
(note the unsigned int, there are no negative memory locations)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Hey thanks to all of you. Now everything works fine.
There is an other litlle question for people who knows the inline asm of gcc (I don't want to start a new topic for this little thing). How can I perform a far call? I tried this, but get an error from the inline assembler:
if you have access to some standard headers (if not, you should make sure you do), use intptr_t instead of just int
there is no guarantee what-so-ever that int == address size in C
The problem with converting a pointer to an integer is that the code become no longer portable acrross processors. (i.e. porting from a 32it address space to a 64 bit address space.)
B.E wrote:The problem with converting a pointer to an integer is that the code become no longer portable acrross processors. (i.e. porting from a 32it address space to a 64 bit address space.)
That's why i declared the type vintp to hold a pointer in an integer and based on the platform i change the declaration of the integer.
sevobal wrote:Hey thanks to all of you. Now everything works fine.
There is an other litlle question for people who knows the inline asm of gcc (I don't want to start a new topic for this little thing). How can I perform a far call? I tried this, but get an error from the inline assembler:
B.E wrote:The problem with converting a pointer to an integer is that the code become no longer portable acrross processors. (i.e. porting from a 32it address space to a 64 bit address space.)
That's why i declared the type vintp to hold a pointer in an integer and based on the platform i change the declaration of the integer.
True, but it is part of the C99 standard library and because i am using the C++98 it is not applicable to me.
Mikey wrote:faggot!, go programme in Visual Basic you homosexual!
Way to go for a first post you stupid git. Your intelligence level clearly is zero if you think that the only alternative to C is Visual Basic. Second to that disrespecting the gay communitie twice in one sentence is only an affermation of the lack of Intelligence. People like you should be removed from the gene-pool and given the Darwin award.