Re: dhcpenumsubnets

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: dhcpenumsubnets
    ... Hi Chris, ... In order to do that it requires you pass a pointer to a ... > in DhcpEnumSubnets): ... > DWORD getnum() ...
    (microsoft.public.win32.programmer.networks)
  • Re: dhcpenumsubnets
    ... The forth argument to DhcpEnumSubnets returns to you a pointer to a ... in DhcpEnumSubnets): ... DWORD getnum() ...
    (microsoft.public.win32.programmer.networks)
  • Re: "Portability" contructs like UINT32 etc.
    ... All those WORDS, DWORDS, LPCSTR, HPARAMS, LPARAMS etc. ... I have a real problem with "WORD" and "DWORD" which is used in Windows programs a lot: "WORD" is defined as a 16 bit type and DWORD as a 32 bit type, which means that on your average Pentium or Athlon processor a WORD is a halfword and a DWORD is a word, whereas on a 64 bit processor a WORD is a quarterword and a DWORD is a ... And LPCSTR - "Long Pointer to C String". ... You see, char* is typedef'ed to PCCHAR (yes, ...
    (comp.lang.c)
  • Help Converting To C#
    ... DWORD IBT_DeviceDiscovery; ... pbtDev is a pointer to an allocated array of IBTDEVICE structures. ... This function creates an SDP record and registers a Bluetooth service within ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Which assembler can handle the BIG stuff ?
    ... >>> Instructtions for finaly pointing to the Pointer, ... >> What's a checksum table, ... then a rep cmpsd (dword compare) could be pretty fast indeed. ... This kind of Hash Table is ...
    (alt.lang.asm)