GetAdaptersAddresses API incorrectly returns no adapters for a process with high memory consumption - by Roman Ryltsov

Status : 

  External<br /><br />
		This item may be valid but belongs to an external system out of the direct control of this product team.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 665383 Comments
Status Closed Workarounds
Type Bug Repros 6
Opened 4/28/2011 12:55:07 AM
Access Restriction Public


I noticed a problem with severe impact on our application, which is coming from GetAdaptersAddresses API (also applies to GetAdaptersInfo).

The problem is that a Win32 application calling this API receives correct results except servers where our process is set up to process a lot of data. 

At some point, GetAdaptersAddresses/GetAdaptersInfo which previously reported good results, starts returning zero adapeters. As soon as I replaced GetAdaptersInfo call with a newer GetAdaptersAddresses I started seeing 998 ERROR_NOACCESS error code.

As a clue, it is taking place around going over 2GB on Private Bytes and Virtual Size. Our application is 32-bit marked as aware of large addresses, so it can receive 3 or 4GB of virtual address space depending on OS and configuration.

Note that when I turned off some activity on the same process to make it free some memory, and retried GetAdaptersAddresses - I could again obtain the list of adapters. It took place without restarting a process. At the same time other processes receive adapter list without problems.

I thought it might be a bug in Windows component which is failing to see valid memory pointer in higher 2GB address space.

I am providing code snippet below to indicate API usage:

ULONG nAdapterAddressesSize = 16 << 10; // 16K
ATLENSURE_THROW(pAdaptersAddresses.AllocateBytes(nAdapterAddressesSize), E_OUTOFMEMORY);
HRESULT nResult = HRESULT_FROM_WIN32(GetAdaptersAddresses(AF_INET, g_nFlags, NULL, pAdaptersAddresses, &nAdapterAddressesSize));
// *** Here we go with ERROR_NOACCESS ***
	nAdapterAddressesSize += 4 << 10; // 4K
	ATLENSURE_THROW(pAdaptersAddresses.AllocateBytes(nAdapterAddressesSize), E_OUTOFMEMORY);
	nResult = HRESULT_FROM_WIN32(GetAdaptersAddresses(AF_INET, g_nFlags, NULL, pAdaptersAddresses, &nAdapterAddressesSize));
Sign in to post a comment.
Posted by Marcel Raad on 3/18/2014 at 8:23 AM
This issue is fixed:
Unfortunately it's only a hotfix for Windows Vista and 7.
Posted by bennyosterberg on 1/15/2013 at 5:13 AM

Can you please give an estimate when this issue will be fixed? It was first posted here in april 2011 and now we have 2013 and it is not fixed!
During our work to circumvent this problem we also noticed another strange thing; GetAdaptersInfo() is supposed to return a linked list of IP_ADAPTER_INFO structures. If you call GetAdaptersInfo() with a buffer that is not large enough, GetAdaptersInfo() will also return the required buffer size. On my system - with only one network adapter - it will return 640 as required buffer size, however if you call sizeof(IP_ADAPTER_INFO) you can see that it is 648 bytes.


Posted by Microsoft on 11/18/2011 at 2:05 AM
Thank you for your bug submission. The issue you reported appears to be on a released Windows Product. If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
Other Support links -
Posted by ChuckDes on 7/19/2011 at 7:02 AM

We are witnessing the same problem here. Error code 998 when trying to retrieve the AdaptersAddresses when the process (a 32-bit app) running on a 64-bits Win7 goes over the 2GB limit with LARGE_ADDRESS_AWARE enabled...

Posted by Microsoft on 5/11/2011 at 8:09 PM
Thank you for attaching the project to help us reproduce this issue. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Roman Ryltsov on 4/29/2011 at 1:09 AM
A few more comments:

1. The project is ATL service, so you need to run "GetAdaptersAddressesTest /regserver" once prior to the test itself.

2. I tried yesterday on Windows 7 32-bit, with /3GB tuning and I could not reproduce the problem there. It still takes place consistently on various 64-bit systems.

Attached is the project.
Posted by Microsoft on 4/29/2011 at 1:00 AM
Hi Roman,

It seems that the test project cannot be download integrally for us. Could you please attach it to this bug?

Posted by Roman Ryltsov on 4/28/2011 at 2:29 AM
OK, I can provide you test code to show the problem.

Here is template ATL C++ Project with perhaps extra 100 lines of code:

It allocates 2+ GB of memory and starts doing GetAdaptersInfo, soon it fails (not on the first call!). See attached screenshot.
Posted by Microsoft on 4/28/2011 at 1:14 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(