|
UpdateData(true);
TCHAR *ph_address = (TCHAR * )0x70800000;
TCHAR *vi_address;
int i,j;
i = m_content.GetLength();
if( i!=2)
{
MessageBox(L"You should write a data as 0xff mode");
return;
}
unsigned char tmp;
tmp =0x00;
for(j=0;j
{
tmp = tmp | ASCII2BINARY(m_content[j]);
if(j
tmp <<=4;
}
vi_address = (TCHAR *)VirtualAlloc(
0,
4096,
MEM_RESERVE,
PAGE_READWRITE);
if (vi_address == NULL )
{
MessageBox(L"alloc wrong");
return;
}
BOOL test;
test = VirtualCopy(vi_address, (void *)(((LONG)(ph_address))/256), 4096,PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL);
if( test == false )
{
MessageBox(L"Copy wrong!");
DWORD rlt = GetLastError();
return;
}
*vi_address =tmp;
MessageBox(L"Write Ok!");
这个是写操作 |
|