Unanswered DhcpGetClientInfo and Error 1783 in Vista

  • Tuesday, September 02, 2008 8:39 AM
     
     

    Hello,

    Sample Code below always returns error code 1783 in Vista (SP1) but works fine in Windows XP (SP3). Is it bug or my mistake?

     

    I'm use:

    1) Windows Software Development Kit (SDK) for Windows Server 2008 and .NET Framework 3.5

    2) VS2005 (SP1)


     

    Code Snippet
    ....
    #include <windows.h>
    #include <dhcpsapi.h>

    #pragma comment(lib, "Dhcpsapi.lib")

    ...

    DWORD GetClientInfoByMAC(LPCTSTR pszDhcpServerIP, BYTE* pMac, DWORD nMacLength, DHCP_CLIENT_INFO** ppInfo)
    {
        DHCP_SEARCH_INFO query;
        query.SearchType = DhcpClientHardwareAddress;
        query.SearchInfo.ClientHardwareAddress.DataLength = nMacLength;
        query.SearchInfo.ClientHardwareAddress.Data = pMac;
        return DhcpGetClientInfo(pszDhcpServerIP, &query, ppInfo);
    }

    ...

    BYTE Mac[11] = {0};
    //Subnet address in host order. (192.168.1.0)
    Mac[0] = 0;
    Mac[1] = 1;
    Mac[2] = 168;
    Mac[3] = 192;
    //Hardware address type, this is the default value.
    Mac[4] = 0x01;    
    //My MAC bytes start from here (00:15:60:b0:2d:da)
    Mac[5] = 0x00;    
    Mac[6] = 0x15;
    Mac[7] = 0x60;
    Mac[8] = 0xb0;
    Mac[9] = 0x2d;
    Mac[10] =0xda;

    DHCP_CLIENT_INFO* pCI_MAC = {0};
    DWORD nError = GetClientInfoByMAC(_T("192.168.1.10"), Mac, sizeof(Mac), &pCI_MAC);
    if(nError == ERROR_SUCCESS)
    {
        //IT WORKS!!!
        ...
    }
    else
    {
        //ERROR!!!
        ...
    }