要用RAPI
void CopyFileFromPCToCEDevice(char *szSource,WCHAR *szDes)
{
HANDLE hSource,hDes;
DWORD dwReaded,dwWrited;
hSource=CreateFile(szSource,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
hDes=CeCreateFile(szDes,GENERIC_READ|GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
#define BUFFER_SIZE 1024*10
char szBuffer[BUFFER_SIZE];
ReadFile(hSource,szBuffer,BUFFER_SIZE,&dwReaded,NULL);
while(dwReaded)
{
CeWriteFile(hDes,szBuffer,dwReaded,&dwWrited,NULL);
ReadFile(hSource,szBuffer,BUFFER_SIZE,&dwReaded,NULL);
}
CloseHandle(hSource);
CeCloseHandle(hDes);
}
BOOL RemoteCreateProcess(WCHAR *wszPath,WCHAR * wszCmd)
{
return CeCreateProcess (wszPath,wszCmd,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL);
} |