質問

I was trying to do a dynamic loading of dhcpcsvc6.dll to support ipv6 on win7 and ipv4 on xp. But GetProcAddress of Dhcpv6CApiInitialize always fails. So I used exescope to examine the exports of the dll, this is what I got.

Version: 6.1.7600.16385.

00000001    404632EA    Dhcpv6AcquireParameters
00000002    40463E4F    Dhcpv6CancelOperation
00000003    40463EB9    Dhcpv6EnableTracing
00000004    40461D3B    Dhcpv6FreeLeaseInfo
00000005    404644D3    Dhcpv6GetTraceArray
00000006    404645D9    Dhcpv6GetUserClasses
00000007    404642D1    Dhcpv6IsEnabled
00000008    40461730    Dhcpv6QueryLeaseInfo
00000009    40463419    Dhcpv6ReleaseParameters
0000000A    40463E31    Dhcpv6ReleasePrefix
0000000B    40463BF5    Dhcpv6ReleasePrefixEx
0000000C    40463BD1    Dhcpv6RenewPrefix
0000000D    40463892    Dhcpv6RenewPrefixEx
0000000E    40463F51    Dhcpv6RequestParams
0000000F    40463871    Dhcpv6RequestPrefix
00000010    40463549    Dhcpv6RequestPrefixEx
00000011    404647D1    Dhcpv6SetUserClass

Dhcpv6CApiInitialize is not in it. I also tried dhcpcore6.dll, dhcpsvc.dll and 64bit versions of these.. no findings.

I wonder where this function really is? Do I really have to call it before any other dhcp v6 apis?

MSDN reference: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363306(v=vs.85).aspx

役に立ちましたか?

解決

TL;DR

Functions are not present until Win8. The Win8 version (I examined version 6.2.9200.16433) does nothing useful. It seems safe to ignore these functions if they're not present in dhcpcsvc6.DLL.

Explanation:

  1. Statically linking requires Win8 SDK (already built into VS2012).
  2. VS2010 with Win7 SDK won't compile.
  3. When compiled with Win8 SDK, the compiled exe won't run on Win7, saying The procedure entry point Dhcpv6CApiInitialize could not be located in the dynamic link library dhcpcsvc6.DLL. That means that the functions are indeed exported from dhcpcsvc6.DLL.
  4. Win8 version of the DLL does contain these functions.

_Dhcpv6CApiInitialize@4 essentially just puts 2 to output parameter:

10004199: mov         edi,edi                // Standard Hotpatch spot
1000419B: push        ebp                    // Standard Prologue
1000419C: mov         ebp,esp                // Standard Prologue
1000419E: mov         eax,dword ptr [ebp+8]  // eax <- param0
100041A1: test        eax,eax                // if (param0 == 0)
100041A3: je          100041AB               //    return;
100041A5: mov         dword ptr [eax],2      // *param0 = 2;
100041AB: pop         ebp                    // Standard epilogue
100041AC: ret         4                      // end of function

_Dhcpv6CApiCleanup@0 does nothing at all:

100041B6: ret
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top