RT
项目需要 能够在SD卡的指定偏移位置写入数据,因此使用windowsAPI的 writefile函数
引用了kernel32.dll 转换的数据类型结果如下
[System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "WriteFile", SetLastError = true, ThrowOnUnmappableChar = true)]
[return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern unsafe bool WriteFile
(
System.IntPtr hFile,
void* lpBuffer,
uint nNumberOfBytesToWrite,
uint* lpNumberOfBytesWritten,
int lpOverlapped
);
用createfile方法 以物理形式访问SD卡访问模式 为GENERIC_READ|GENERIC_WRITE,共享模式为FILE_SHARE_WRITE.
但最后调用的时候 总是写不进去 返回值始终为false 求大侠们指点!!!!!!!!
参考:http://blog.csdn.net/zgke/article/details/2981855
另外要有权限哦。