- 博客(1)
- 资源 (11)
- 收藏
- 关注
原创 docker 安装centos
docker pull centos 下载最新版本的 centos系统 docker images |grep centos 查看centos镜像 docker run --name centos-portal --network network01 --ip 172.20.0.10 -p 8080:8080 -v /home/gdgxwl/:/mnt/software/ -itd cen...
2019-12-20 08:52:17 68
通用串口类,串口的读写
COMSTAT ComStat;
DWORD dwErrorFlags; //错误标志位
BOOL bReadStatus;//读取状态
OVERLAPPED m_osRead;//串口设备的一些信息
memset(&m_osRead,0,sizeof(OVERLAPPED));//初始化内存
m_osRead.hEvent=CreateEvent(NULL,TRUE,TRUE,NULL);
ClearCommError(hSerialComm,&dwErrorFlags,&ComStat);//清除串口的错误标志以便继续输入,输出操作
if(!ComStat.cbInQue) return 0;
dwBytesRead = min(dwBytesRead,(DWORD)ComStat.cbInQue);
bReadStatus=ReadFile(hSerialComm,buffer,dwBytesRead,&dwBytesRead,&m_osRead);
if(!bReadStatus) //如果函数返回FALSE
{
if(ERROR_IO_PENDING==GetLastError())
{
WaitForSingleObject(m_osRead.hEvent,2000);
}
}
PurgeComm(hSerialComm,PURGE_TXABORT|
PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR);//清空读写缓存,停止为解决的读写操作
2010-11-25
向进程注入自己的代码
向进程注入自己的dll 带有测试dll 路径和要注入的程序可以自己改
hRemoteProcess=OpenProcess(PROCESS_CREATE_THREAD| //允许远程创建线程
PROCESS_VM_OPERATION | //VM操作
PROCESS_VM_WRITE , //允许写
FALSE,dwProcessID);
if(!hRemoteProcess) AfxMessageBox(L"无法打开目标进程");
// KillTimer(m_ntime);
//计算DLL路径需要多大内存
int cb=(1+lstrlenW(pszLibFile))*sizeof(WCHAR);
//使用VirtualAllocEx函数在远程进程的内存地址空间分配DLL文件名缓冲区
pszLibFileRemote=(PWSTR)VirtualAllocEx(hRemoteProcess,NULL,cb,MEM_COMMIT,PAGE_READWRITE);
if(pszLibFileRemote==NULL)
{
AfxMessageBox(L"建立内存失败");
CloseHandle(hRemoteProcess);
return;
}
//使用WriteProcessMemory函数将DLL的路径名复制到远程进程的内存空间
BOOL iReturnCode=WriteProcessMemory (hRemoteProcess,pszLibFileRemote,(PVOID)pszLibFile,cb,NULL);
if(!iReturnCode)
{
AfxMessageBox(L"写入错误");
VirtualFreeEx(hRemoteProcess,NULL,0,MEM_RELEASE);
CloseHandle(hRemoteThread);
CloseHandle(hRemoteProcess);
return;
}
//计算loadlibraryW入口地址
HMODULE hModule=LoadLibrary(L"C:\\WINDOWS\\system32\\kernel32");
PTHREAD_START_ROUTINE pfnStartAddr=( PTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(TEXT("Kernel32")),"LoadLibraryW");
hRemoteThread=CreateRemoteThread(hRemoteProcess,NULL,0,pfnStartAddr,pszLibFileRemote,0,NULL);
if(hRemoteThread==NULL)
{
//等待线程结束
WaitForSingleObject(hRemoteThread,INFINITE);
DWORD RetV;
if(GetExitCodeThread(hRemoteThread,&RetV))
CloseHandle(hRemoteThread);
2009-07-17
RC531详细英文资料和程序
/
// FUNCTION: M500PcdReset
// IN: -
// OUT: -
// RETURN: MI_OK
// MI_RESETERR
// MI_INTERFACEERR
// COMMENT: This function initiates a reset of the reader IC. Note, that
// the reset pin of the reader has to be connected to the
// expected port pin of the microcontroller.
//
char M500PcdReset(void);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdConfig
// IN: -
// OUT: -
// RETURN: MI_OK
// MI_RESETERR
// MI_INTERFACEERR
// COMMENT: Configuration of the reader IC. This function has to be called
// before the first data is written to the reader. A reset
// is initiated and several registers are set.
//
char M500PcdConfig(void);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdInOutSlaveConfig
// IN: -
// OUT: -
// RETURN: MI_OK
// MI_UNKNOWN_COMMAND
// MI_ACCESSTIMEOUT
// COMMENT: The reader IC is able to communicate with another reader IC
// via the digital "mifare in" and "mifare out" interface. Therefore
// one reader acts as a master and sends commands via "mifare out".
// The other reader ic acts as a slave and receives data via
// "mifare in" interface. The slave module can not be initialised
// by the microcontroller because only the "mifare in/out"
// interface is connected.For this reason, the slave module has
// to be initialised once. For that the appropriate parameter
// settings are written to
// the E2PROM. After POR (power on reset) the IC reads these settings
// and initialises automatically as slave.
//
char M500PcdInOutSlaveConfig(void);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdInOutMasterConfig
// IN: -
// OUT: -
// RETURN: MI_OK
// COMMENT: Corresponding to the slave configuration routine. This function
// initialises the master reader IC. The function is additional
// to the standard configuration "M500PcdConfig".
//
char M500PcdInOutMasterConfig(void);
// _____________________________________________________________________________
//
// FUNCTION: MfPcdLoadMk
// IN: kl_mode PICC_AUTHENT1A or PICC_AUTHENT1B
// selects master key A or master key B
// KS0, KS1, KS2 selects one of the three master key sets.
// key_addr spec. the key RAM address to which the data shall be
// written (0..15)
// mk pointer to a 6 byte authentication key
// OUT: -
// RETURN: MI_OK
// COMMENT: In order to be "calling compatibel" to former libraries, this
// function enables to store all keys in the microcontroller.
// When calling the authentication function "M500PiccAuth",
// these keys can be used.
// Note: This concept supports backward compatibility for the
// application software, but does not fulfill the same security
// level because keys are in this case stored autside the secure key
// memory of the MF RC500.
//
char M500PcdLoadMk(unsigned char kl_mode,
unsigned char key_addr,
unsigned char *mk);
// _____________________________________________________
2008-11-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人