Re: dhcpenumsubnets
- From: "Raffaele_S" <raffaelesilluzio@xxxxxxxx>
- Date: 14 Dec 2005 06:47:19 -0800
Hi Chris,
I try your solution, and I have a new problem:
If I use
DHCP_CONST WCHAR* servaddr=L"192.168.73.2";(this is the address of the
server)
I receive rfunc=3221225477 (I think it means ACCESS VIOLATION, but I'm
not sure)
If I use
DHCP_CONST WCHAR* servaddr=L"192.168.073.002";
I receive rfunc=1722 (it means:The RPC server is unavailable. )
If I use
DHCP_CONST WCHAR* servaddr=L"127.0.0.1";
I receive rfunc=259 (it means: No more data avaiable )
If I use
DHCP_CONST WCHAR* servaddr=L"127.000.000.001";
I receive rfunc=259
Please,Can you tell me which is the correct address, and what can I do
to solve it ?
Thank a lot Chris,you are very courteous.
Chris Doré ha scritto:
> Ok, I gave your code a look through, here's where the problem most likely
> is:
>
> The forth argument to DhcpEnumSubnets returns to you a pointer to a
> DHCP_IP_ARRAY. In order to do that it requires you pass a pointer to a
> pointer. You are doing so, but passing NULL (hence error 1780).
>
> Your code should be as follows (I changed the declaration of ei and its use
> in DhcpEnumSubnets):
>
> DWORD getnum()
> {
> DHCP_CONST WCHAR* servaddr=L"127.0.0.1";
> DHCP_RESUME_HANDLE rh;
> DWORD pm=1000;
> LPDHCP_IP_ARRAY ei;
> DWORD er;
> DWORD et;
> int rfunc;
> DWORD num=1001;
>
> rfunc=DhcpEnumSubnets(servaddr,&rh,pm,&ei,&er,&et);
> if(rfunc==ERROR_SUCCESS)
> num=1002;
>
> return num;
> }// end getnum();
>
>
> I would suggest you improve the checking of rfunc as well.
>
>
> ...Chris
>
>
> "Raffaele_S" <raffaelesilluzio@xxxxxxxx> wrote in message
> news:1134158464.622645.115900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks a lot for the answer.
> I know that the function return an error.
> It return the error 1780 and I think it means : A null reference
> pointer was passed to the stub. But I don't understand because the
> function returns this error.
> Can you help me ?
>
> Sorry for my English.
>
> Best Regards.
>
>
> Chris Doré ha scritto:
>
> > "Raffaele_S" <raffaelesilluzio@xxxxxxxx> wrote:
> > >
> > > When I call this function it return always num=1001.
> > > Can you tell me why it doesn't returns num =1002 ?
> >
> > Because DhcpEnumSubnets() is failing and not returning ERROR_SUCCESS.
> > See "DHCP Server Management API Error Codes" in MSDN.
> >
> >
> > ...Chris
.
- References:
- dhcpenumsubnets
- From: Raffaele_S
- Re: dhcpenumsubnets
- From: Chris Doré
- Re: dhcpenumsubnets
- From: Raffaele_S
- Re: dhcpenumsubnets
- From: Chris Doré
- dhcpenumsubnets
- Prev by Date: Detecting interactive user login and logoff for a service program
- Next by Date: Re: dhcpenumsubnets
- Previous by thread: Re: dhcpenumsubnets
- Next by thread: Re: dhcpenumsubnets
- Index(es):
Relevant Pages
|