|
windows
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange return value from GetIpForwardTableI have a question about GetIpForwardTable(): I use the call below to get the required table size first: ULONG dwSize = 0; DWORD ret = GetIpForwardTable (NULL, &dwSize, TRUE); The return value is ERROR_INSUFFICIENT_BUFFER as expected, the dwSize looks fine. Then I call it again to get the actual table: MIB_IPFORWARDTABLE *pTable = (PMIB_IPFORWARDTABLE) malloc (dwSize); ret = GetIpForwardTable (pTable, &dwSize, TRUE); But the 2nd call above returns 234 (More data is available). Just wondering, the first call returned the required table size already, why the 2nd call indicate that the dwSize is too small? Thanks in advance ! Polaris Polaris wrote:
> What OS are you doing this on?> But the 2nd call above returns 234 (More data is available). > > Just wondering, the first call returned the required table size > already, why the 2nd call indicate that the dwSize is too small? Note that in general you need to call this API in a loop since the table size may change between any two calls. I doubt this is the problem you have, though. But "more data" is not error of insufficient buffer, but warning that you
can read additional set of data Arkady Show quoteHide quote "Polaris" <etpola***@hotmail.com> wrote in message news:OnsvEn6yGHA.1252@TK2MSFTNGP04.phx.gbl... > Hi Experts: > > I have a question about GetIpForwardTable(): > > I use the call below to get the required table size first: > > ULONG dwSize = 0; > DWORD ret = GetIpForwardTable (NULL, &dwSize, TRUE); > > The return value is ERROR_INSUFFICIENT_BUFFER as expected, the dwSize > looks fine. > > Then I call it again to get the actual table: > > MIB_IPFORWARDTABLE *pTable = (PMIB_IPFORWARDTABLE) malloc (dwSize); > ret = GetIpForwardTable (pTable, &dwSize, TRUE); > > But the 2nd call above returns 234 (More data is available). > > Just wondering, the first call returned the required table size already, > why the 2nd call indicate that the dwSize is too small? > > Thanks in advance ! > Polaris > Thanks guys for your responses.
I think "More data .." means the buffer is not big enough to store the whole routing table; if the first call to GetIpForwardTable returns the size required to hold the routing table, the immediate following call should retrieve the complete routing table. Is that correct? Polaris Show quoteHide quote "Arkady Frenkel" <arka***@hotmailxdotx.com> wrote in message news:eWMpe0$yGHA.3908@TK2MSFTNGP05.phx.gbl... > But "more data" is not error of insufficient buffer, but warning that > you can read additional set of data > Arkady > > "Polaris" <etpola***@hotmail.com> wrote in message > news:OnsvEn6yGHA.1252@TK2MSFTNGP04.phx.gbl... >> Hi Experts: >> >> I have a question about GetIpForwardTable(): >> >> I use the call below to get the required table size first: >> >> ULONG dwSize = 0; >> DWORD ret = GetIpForwardTable (NULL, &dwSize, TRUE); >> >> The return value is ERROR_INSUFFICIENT_BUFFER as expected, the dwSize >> looks fine. >> >> Then I call it again to get the actual table: >> >> MIB_IPFORWARDTABLE *pTable = (PMIB_IPFORWARDTABLE) malloc (dwSize); >> ret = GetIpForwardTable (pTable, &dwSize, TRUE); >> >> But the 2nd call above returns 234 (More data is available). >> >> Just wondering, the first call returned the required table size already, >> why the 2nd call indicate that the dwSize is too small? >> >> Thanks in advance ! >> Polaris >> > > Polaris wrote:
> Thanks guys for your responses. No. Another process may have changed the table between your two calls.> > I think "More data .." means the buffer is not big enough to store > the whole routing table; if the first call to GetIpForwardTable > returns the size required to hold the routing table, the immediate > following call should retrieve the complete routing table. Is that > correct? However, I doubt this is the reason for the issue you are seeing. I vaguely recall some buffer size issues with IPHelper on older OSes and that's why I asked which OS your using. Thanks. The OS is Windows Xp with SP2.
Polaris Show quoteHide quote "Eugene Gershnik" <gersh***@hotmail.com> wrote in message news:%2311LkQAzGHA.3704@TK2MSFTNGP02.phx.gbl... > Polaris wrote: >> Thanks guys for your responses. >> >> I think "More data .." means the buffer is not big enough to store >> the whole routing table; if the first call to GetIpForwardTable >> returns the size required to hold the routing table, the immediate >> following call should retrieve the complete routing table. Is that >> correct? > > No. Another process may have changed the table between your two calls. > However, I doubt this is the reason for the issue you are seeing. I > vaguely recall some buffer size issues with IPHelper on older OSes and > that's why I asked which OS your using. > > > -- > Eugene > http://www.gershnik.com > > Polaris wrote:
> Thanks. The OS is Windows Xp with SP2. Then it is really strange (assuming no other process/thread changes the table in the middle). I don't recall any problems with this OS. If you have a short repro code post it here and if others can get the same problem you probably should file a bug with MS. Thanks. I did send a feedback to MS.
This problem went away (meaning the GetIpForwardTable returns NO_ERROR) after doubling the buffer size. But still, it is kind of strange. Polaris Show quoteHide quote "Eugene Gershnik" <gersh***@hotmail.com> wrote in message news:u69Y2yHzGHA.3908@TK2MSFTNGP05.phx.gbl... > Polaris wrote: >> Thanks. The OS is Windows Xp with SP2. > > Then it is really strange (assuming no other process/thread changes the > table in the middle). I don't recall any problems with this OS. If you > have a short repro code post it here and if others can get the same > problem you probably should file a bug with MS. > > -- > Eugene > http://www.gershnik.com > > > > You can check additionally if table really change between calls with "route
print" in dos box Arkady Show quoteHide quote "Polaris" <etpola***@hotmail.com> wrote in message news:%23X4QXcMzGHA.3440@TK2MSFTNGP06.phx.gbl... > Thanks. I did send a feedback to MS. > > This problem went away (meaning the GetIpForwardTable returns NO_ERROR) > after doubling the buffer size. But still, it is kind of strange. > > Polaris > > "Eugene Gershnik" <gersh***@hotmail.com> wrote in message > news:u69Y2yHzGHA.3908@TK2MSFTNGP05.phx.gbl... >> Polaris wrote: >>> Thanks. The OS is Windows Xp with SP2. >> >> Then it is really strange (assuming no other process/thread changes the >> table in the middle). I don't recall any problems with this OS. If you >> have a short repro code post it here and if others can get the same >> problem you probably should file a bug with MS. >> >> -- >> Eugene >> http://www.gershnik.com >> >> >> >> > >
Can't see computer in workgroup, but shared resources are availabl
After idle can't connect to internet / or access OE always have to type a password to connect to another computer 'Network Cable Unplugged' error DNS issue XP -> ME, computers show but are not accessible Domain Services between main & remote offices No devices found on local Network A duplicate name exists on the network Wireless Printing |
|||||||||||||||||||||||