RE: Sockets windows 64 bit

2008年3月26日 15:24:21 -0700

> > Windows SOCKET is a handler to *kernel* object and as such constitutes
> > an *offset* in per-process handle table. As this table can accommodate
> > not more than 2^24 entries, it's always *safe* to cast/truncate SOCKET
> > to 32-bit value and back. Even on 64-bit Windows.
 
> for reference,
> http://msdn2.microsoft.com/en-us/library/ms724485(VS.85).aspx. a.
This says that there can be no more than 2^24 entries per process, but it 
doesn't say that the value of the handle cannot exceed 2^24. Windows could, for 
example, use the high bits to indicate what type of handle it is. (Or might in 
a future version of Windows, causing applications that truncate handles to 
suddenly find they're not as portable as expected.)
For example, I don't see any reason an LSP couldn't use the high bits of a 
SOCKET handle to store some information which it strips off before it passes 
the SOCKET value to the underlying kernel code. Winsock explicitly supports 
user-level code between the Winsock functions and the kernel.
Does Microsoft actually specify somewhere that the integer value of a handle 
cannot exceed 2^24? The citation presented doesn't say that.
DS
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]

Reply via email to