平台选x86时正常运行
选x64时if (loadaddr == 0)就return了
[DllImport("kernel32.dll")]
public static extern int GetProcAddress(int hwnd, string lpname);
[DllImport("kernel32.dll")]
public static extern int GetModuleHandleA(string name);
var kernel32 = GetModuleHandleA("kernel32.dll");
if (kernel32 == 0)
{
Console.WriteLine("GetModuleHandleA kernel32.dll failed!");
return 1;
}
var loadaddr = GetProcAddress(kernel32, "LoadLibraryA");
if (loadaddr == 0)
{
Console.WriteLine("GetProcAddress LoadLibraryA failed!");
return 1;
}