Re: About Windows address space
From: Alex McDonald (alex_mcd_at_btopenworld.com)
Date: 04/21/04
- Next message: Alex McDonald: "Re: Software Protection system...Any tester there ?"
- Previous message: Betov: "Re: The best Assembler."
- In reply to: fa2k: "About Windows address space"
- Next in thread: Beth: "Re: About Windows address space"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Apr 2004 19:26:56 +0000 (UTC)
"fa2k" <marius_b@chello.no> wrote in message
news:yhzhc.9653$EV2.89392@amstwist00...
> Hi,
>
> Is there any minimum value for pointers, that is consistent across all
> windows versions? This must include all pointers a user-space program
could
> specify, also those returned by e.g. WinSock. The thing I want to do is
> allow the user (i'm making a library, this is not the end user, but the
one
> who writes "modules" for my IRC proxy) to use either names or handles in
the
> same parameter to a function:
>
> if parameter is less than ADDRESS_MINIMUM
> then is_handle
> else is_string
>
> I hope this qualifies as on topic, even though it it strictly not
assembly.
>
> Thanks,
> Marius
>
>
The effective minimum varies; here, for instance, on my W2K machine the
stack is at 0x00130000 and down for 1 Mb, the loadpoint of an executable is
0x0040000 or greater, and the address range is up to 0x7FFFFFFF, and there
are heaps starting at 0x00130000 and up... and so on. So your handle would
be difficult to differentiate from a string pointer, unless you're far more
restrictive.
Windows does it by limiting handles that can also be strings to a maximum
value of a WORD; see the MAKEINTRESOURCE macro (search msdn.microsoft.com).
That limits your handle to a maximum of 0x0000FFFF. There's nothing below
that address that you can get at in user-land (or would sensibly want to),
in any Windows version. Not all Windows handles are limited to 0x0000FFFF,
btw; just those that also accept string pointers, and most of those seem to
be hangovers from Win3.1. I wouldn't recommend this technique, due to the
limitations.
Why not pass a pair of parameters, one for handles, the other for strings,
and use the first one that isn't NULL?
-- Regards Alex McDonald
- Next message: Alex McDonald: "Re: Software Protection system...Any tester there ?"
- Previous message: Betov: "Re: The best Assembler."
- In reply to: fa2k: "About Windows address space"
- Next in thread: Beth: "Re: About Windows address space"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|