| Subject: DhcpGetClientInfo and Error 1783 in Vista |
| Group: microsoft.public.windows.vista.networking_sharing |
| Date: 9/2/2008 2:19:38 AM |
| From: =?Utf-8?B?VmxhZFo=?= [Email Address Protection] |
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 |
| Back |
| Subject: Re: DhcpGetClientInfo and Error 1783 in Vista |
| Group: microsoft.public.windows.vista.networking_sharing |
| Date: 9/2/2008 8:51:12 AM |
| From: "Jack \(MVP-Networking\)." [Email Address Protection] |
Hi Maybe this can Help, http://support.microsoft.com/kb/928233 Jack (MS, MVP-Networking) "VladZ" <VladZ@discussions.microsoft.com> 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 > |
| Back |