public UInt32 LoadChecksumDll(string dllPath, byte[] pBuffer, UInt32 u32Size) { UInt32 CheckSumResult = 0; IntPtr hModule = NativeMethod.LoadLibrary(dllPath); if (hModule == IntPtr.Zero) { return(CheckSumResult); //如果dll文件不存在,返回空 } IntPtr intPtr = NativeMethod.GetProcAddress(hModule, "CalcChecksum"); CalcChecksum calcChecksum = (CalcChecksum)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(CalcChecksum)); CheckSumResult = calcChecksum(ref pBuffer[0], u32Size); return(CheckSumResult); }
public static extern bool CalcChecksums( IntPtr pPacket, uint packetLen, out Address address, CalcChecksum calcChecksumFlags);