Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Vista
admin account
file management
games
general
hardware assessment
hardware devices
installation
mail
multimedia
networking sharing
performance
print_fax_scan
security
  
 
date: Tue, 2 Sep 2008 02:19:38 -0700,    group: microsoft.public.windows.vista.networking_sharing        back       


DhcpGetClientInfo and Error 1783 in Vista   
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!!!
    ...
} 
 
----------------------
Thanks,
Vlad
date: Tue, 2 Sep 2008 02:19:38 -0700   author:   VladZ

Re: DhcpGetClientInfo and Error 1783 in Vista   
Hi
Maybe this can Help, http://support.microsoft.com/kb/928233
Jack (MS, MVP-Networking)

"VladZ"  wrote in message 
news:B8CE3DB3-254D-4532-B3AE-B3ACA2D24E96@microsoft.com...
> 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!!!
>    ...
> }
>
> ----------------------
> Thanks,
> Vlad
>
date: Tue, 2 Sep 2008 11:51:12 -0400   author:   Jack \(MVP-Networking\).

Re: DhcpGetClientInfo and Error 1783 in Vista   
My Vista gets IP from DHCP very well. And "The DhcpGetClientInfo function 
returns information about a specific DHCP client..." (see DHCP API).
Code sample from my first post for search information about client (not 
about my computer!) using its MAC address.

--
Vlad


"Jack (MVP-Networking)." wrote:

> Hi
> Maybe this can Help, http://support.microsoft.com/kb/928233
> Jack (MS, MVP-Networking)
> 
> "VladZ"  wrote in message 
> news:B8CE3DB3-254D-4532-B3AE-B3ACA2D24E96@microsoft.com...
> > 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?
> >
date: Tue, 2 Sep 2008 10:06:02 -0700   author:   VladZ

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us