Article View: borland.public.cppbuilder.nativeapi
Article #17664Re: binded address
From: Boguslaw Fries
Date: Sat, 08 Mar 2003 23:27
Date: Sat, 08 Mar 2003 23:27
41 lines
2280 bytes
2280 bytes
ok, I write
hCurrentProcess = GetCurrentProcess( );
OpenProcessToken( hCurrentProcess, TOKEN_QUERY | TOKEN:ADJUST_PRIVILEGES,
&hToken );
SetPrivilege( hToken, SE_DEBUG_NAME, true );
NtQuerySystemInformation( SystemHandleInformation, lpSystemInformation,
dwlength, &dwreturnlength );
....
lpSystemHandle = ( LPSYSTEM_HANDLE ) lpSystemInformation->systemHandles;
for( dwCount = 0; dwCount < lpSystemInformation->dwNumEntries; dwCount ++ )
{
hDup = NULL;
hproc = openP1ocess( PROCESS_DUP_HANDLE, 1,
lpSystemHandle->dwProcessId );
if( hproc )
{
DuplicateHandle( hproc, ( HANDLE ) lpSystemHandle ->uhandle,
hCurrentProcess, &hDup, STANDARD_RIGHTS_REQUIRED, false, 0);
if ( hdup )
{
s = ( SOCKET ) hDup;
nRet = getsockname( s, ( SOCKADDR * ) & name &namelen );
...
}
}
}
As above is a part of my code
name has alway proper information about socket name and address --
socket s
but getsockopt returns false protocol type of this socket ( always UDP )
and getpeername always fails wit 10057
thanks for your patience
Boguslaw Fries
Technical Details
Message-ID:
<3e6a7d78$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e68956a@newsgroups.borland.com> <3e68e277$1@newsgroups.borland.com> <3e69d1eb$1@newsgroups.borland.com> <3e69d6ef$1@newsgroups.borland.com> <3e69dbad@newsgroups.borland.com> <3e6a6534$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,522e24851519f924 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-08 15:40:42 PST From: "Boguslaw Fries" <B.Fries@luca-online.de> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e68956a@newsgroups.borland.com> <3e68e277$1@newsgroups.borland.com> <3e69d1eb$1@newsgroups.borland.com> <3e69d6ef$1@newsgroups.borland.com> <3e69dbad@newsgroups.borland.com> <3e6a6534$1@newsgroups.borland.com> Subject: Re: binded address Date: Sun, 9 Mar 2003 00:27:31 +0100 Lines: 43 Organization: LUCA X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 80.130.187.191 Message-ID: <3e6a7d78$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1047166328 80.130.187.191 (8 Mar 2003 15:32:08 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail