我在尝试在Windows 7上调用PInvoke UpdateProcThreadAttribute()
,但我的尝试一直返回FALSE,并显示最后的Win32错误代码为50。
Function declaration (from MSDN)
BOOL WINAPI UpdateProcThreadAttribute(
__inout LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
__in DWORD dwFlags,
__in DWORD_PTR Attribute,
__in PVOID lpValue,
__in SIZE_T cbSize,
__out_opt PVOID lpPreviousValue,
__in_opt PSIZE_T lpReturnSize
);
这里是我对PInvoke签名的尝试:
[DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
public static extern bool UpdateProcThreadAttribute
(
IntPtr lpAttributeList,
UInt32 dwFlags,
ref UInt32 Attribute,
ref IntPtr lpValue,
ref IntPtr cbSize,
IntPtr lpPreviousValue,
IntPtr lpReturnSize
);
这个声明有意义吗?谢谢。