Exemplo n.º 1
0
BOOST_NOWIDE_DECL int boost::nowide::system(char const *cmd)
{
    if(!cmd)
        return _wsystem(0);
    wstackstring wcmd;
    if(!wcmd.convert(cmd))
    {
        errno = EINVAL;
        return -1;
    }
    return _wsystem(wcmd.c_str());
}
Exemplo n.º 2
0
int main(int argc, const char **argv)
{
	Log("-- now = " << timetool::get_now() << " --!");

	// 命令行解析器
	CxxCleanOptionsParser optionParser;

	// 初始化
	if (!Init(optionParser, argc, argv))
	{
		Log("error: option is invalid!");
		return 0;
	}

	// 开始分析并清理
	Run(optionParser);

	Log("-- now = " << timetool::get_now() << " --!");
	Log("-- finished --!");

	// 打开日志
	const std::wstring open_html = L"start " + HtmlLog::instance.m_htmlPath;
	_wsystem(open_html.c_str());
	return 0;
}
Exemplo n.º 3
0
// BrainUtil::CopyFolder(_T("C:\\srcFolder\"), _T("C:\\destFolder\\"));
// BrainUtil::CopyFolder(_T("C:\\srcFolder"), _T("C:\\newFolderRoot\\newFolder\\destFolder"));
// The directory tree will be created by xcopy if the parent of the dest doesn't exist.
bool BrainUtil::CopyFolder(const CString& srcFolderFullName, const CString& destFolderFullName)
{
    if(!DoesFileorFolderExist(srcFolderFullName))
        return false;

    CString src = srcFolderFullName;
    WCHAR lastChar = src.GetAt(src.GetLength() - 1);
    if(lastChar != _T('\\'))
        src.AppendChar(_T('\\')); 
    src.Append(_T("*.*")); // Add the widechar, change the format to be like C:\srcFolder\*.*

    CString dest = destFolderFullName;
    // If the last char isn't '\', a dialog will pop up to specify if the name is file or folder.
    // Add the ending '\'. change the format to be like C:\destFolder\ 
    lastChar = dest.GetAt(dest.GetLength() - 1);
    if(lastChar != _T('\\'))
        dest.AppendChar(_T('\\')); 

    CString cmd;
    cmd.Format(_T("xcopy \"%s\" \"%s\" /E /C /R /Q /Y"), src.GetBuffer(), dest.GetBuffer());
    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = DoesFileorFolderExist(destFolderFullName) && 0 == ret;
    return bSucc;
}
Exemplo n.º 4
0
/*
** This function implements a cross-platform "system()" interface.
*/
int fossil_system(const char *zOrigCmd){
  int rc;
#if defined(_WIN32)
  /* On windows, we have to put double-quotes around the entire command.
  ** Who knows why - this is just the way windows works.
  */
  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
  wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
  if( g.fSystemTrace ) {
    fossil_trace("SYSTEM: %s\n", zNewCmd);
  }
  rc = _wsystem(zUnicode);
  fossil_unicode_free(zUnicode);
  free(zNewCmd);
#else
  /* On unix, evaluate the command directly.
  */
  if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);

  /* Unix systems should never shell-out while processing an HTTP request,
  ** either via CGI, SCGI, or direct HTTP.  The following assert verifies
  ** this.  And the following assert proves that Fossil is not vulnerable
  ** to the ShellShock or BashDoor bug.
  */
  assert( g.cgiOutput==0 );

  /* The regular system() call works to get a shell on unix */
  rc = system(zOrigCmd);
#endif
  return rc;
}
Exemplo n.º 5
0
static int os_execute (lua_State *L) {
#ifdef WIN32
  const char *cmd = luaL_optstring(L, 1, NULL);
  if (cmd) {
    wchar_t wcmd[MAX_PATH+1];
    MultiByteToWideChar(CP_UTF8, 0, cmd, -1, wcmd, MAX_PATH+1);
    lua_pushinteger(L, _wsystem(wcmd));
  } else {
    lua_pushinteger(L, _wsystem(NULL));
  }
#else
  // FIXME: non-win32 conversion to local filesystem encoding?
  lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));
#endif
  return 1;
}
Exemplo n.º 6
0
int S_windows_system(const char *command) {
  wchar_t wcommand[PATH_MAX];
  if (MultiByteToWideChar(CP_UTF8,0,command,-1,wcommand,PATH_MAX) == 0)
    return system(command);
  else
    return _wsystem(wcommand);
}
int system_utf8(const std::string &cmdline) {
#ifdef _WIN32
  // Add quotes around entire commandline per http://msdn.microsoft.com/en-us/library/96ayss4b.aspx
  return _wsystem(Unicode("\"" + cmdline + "\"").path());
#else
  return system(cmdline.c_str());
#endif
}
Exemplo n.º 8
0
bool importX264Cfg()
{
	wchar_t cmdToRun[MAX_PATH];
	ZeroMemory(cmdToRun, sizeof(wchar_t)*MAX_PATH);
	StringCchPrintf(cmdToRun, MAX_PATH*sizeof(wchar_t), L"REG IMPORT %s", _szX264Cfg);
	_wsystem(cmdToRun);
	return true;
}
Exemplo n.º 9
0
FILE *
fake_popen(const char * command, const char * type)
{
    FILE * f = NULL;
    char tmppath[MAX_PATH];
    char tmpfile[MAX_PATH];
    DWORD ret;

    if (type == NULL) return NULL;

    pipe_type = NUL;
    if (pipe_filename != NULL)
	free(pipe_filename);

    /* Random temp file name in %TEMP% */
    ret = GetTempPathA(sizeof(tmppath), tmppath);
    if ((ret == 0) || (ret > sizeof(tmppath)))
	return NULL;
    ret = GetTempFileNameA(tmppath, "gpp", 0, tmpfile);
    if (ret == 0)
	return NULL;
    pipe_filename = gp_strdup(tmpfile);

    if (*type == 'r') {
	char * cmd;
	int rc;
	LPWSTR wcmd;
	pipe_type = *type;
	/* Execute command with redirection of stdout to temporary file. */
	cmd = (char *) malloc(strlen(command) + strlen(pipe_filename) + 5);
	sprintf(cmd, "%s > %s", command, pipe_filename);
	wcmd = UnicodeText(cmd, encoding);
	rc = _wsystem(wcmd);
	free(wcmd);
	free(cmd);
	/* Now open temporary file. */
	/* system() returns 1 if the command could not be executed. */
	if (rc != 1) {
	    f = fopen(pipe_filename, "r");
	} else {
	    remove(pipe_filename);
	    free(pipe_filename);
	    pipe_filename = NULL;
	    errno = EINVAL;
	}
    } else if (*type == 'w') {
	pipe_type = *type;
	/* Write output to temporary file and handle the rest in fake_pclose. */
	if (type[1] == 'b')
	    int_error(NO_CARET, "Could not execute pipe '%s'. Writing to binary pipes is not supported.", command);
	else
	    f = fopen(pipe_filename, "w");
	pipe_command = gp_strdup(command);
    }

    return f;
}
Exemplo n.º 10
0
int wmain(int argc, wchar_t *argv[]) {
  auto git_args = create_git_arguments(argc, argv);
  auto git_cl = L"git " + git_args;
  
  int code = _wsystem(git_cl.c_str());
  print_error(errno);
  
  return code;
}
Exemplo n.º 11
0
int _usystem(const char* command){
	wchar_t* wcommand;
	int status;
	if(!(wcommand = utf8_to_ucs2(command)))
		return -1;
	status = _wsystem(wcommand);
	free(wcommand);
	return status;
}
Exemplo n.º 12
0
void OsShell::executeShellCommand(const QString& command, const QString& workingDir)
{
	std::thread([command, workingDir](){
	#ifdef _WIN32
		_wsystem((QString("pushd ") + workingDir + " && " + command).toStdWString().data());
	#else
		const int result = std::system((QString("cd ") + workingDir + " && " + command).toUtf8().data());
		assert_r(result == 0);
	#endif
	}).detach();
}
Exemplo n.º 13
0
// mklink /D "C:\existingFolder\Link" "C:\Target"
// mklink /D "C:\existingFolder\Link\" "C:\Target\"
// The ending slash is optional. The parent directory of the link must exist.
bool BrainUtil::MakeLink(const CString& link, const CString& target, bool bIsDirectory/* = true*/)
{
    CString temLink = link;
    CString temTarget = target;

    // delete the last '\'
    WCHAR lastChar = temLink.GetAt(temLink.GetLength() - 1);
    if(lastChar == _T('\\'))
        temLink.Truncate(temLink.GetLength() - 1); 

    if(DoesFileorFolderExist(temLink))
    {
        // Delete the link
        // For links to directories: rmdir linkname
        // For links to files: del linkname
        CString tmpCmd;
        tmpCmd.Format(_T("rmdir \"%s\""), temLink.GetBuffer());
        RunSystemCommand(tmpCmd);

        if(DoesFileorFolderExist(temLink)) // If still exist it might be a file link
        {
            tmpCmd.Format(_T("del \"%s\""), temLink.GetBuffer());
            RunSystemCommand(tmpCmd);
        }

        if(DoesFileorFolderExist(temLink))// check again
        {
            DATA_ASSERT(false); 
            return false;
        }
    }
    else
    {
        CString folderFullName = GetParentFolderName(link);
        if(!DoesFileorFolderExist(folderFullName))
        {
            bool bRet = CreateFolder(folderFullName); // Create the parent directory tree.
            if(!bRet)
                return false;
        }
    }

    CString cmd;
    if(bIsDirectory)
        cmd.Format(_T("mklink /D \"%s\" \"%s\""), temLink.GetBuffer(), temTarget.GetBuffer());
    else
        cmd.Format(_T("mklink \"%s\" \"%s\""), temLink.GetBuffer(), temTarget.GetBuffer());

    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = DoesFileorFolderExist(link);
    return bSucc;
}
Exemplo n.º 14
0
/*********************************************************************
 *		system (MSVCRT.@)
 */
int CDECL MSVCRT_system(const char* cmd)
{
  int res = -1;
  MSVCRT_wchar_t *cmdW;

  if ((cmdW = msvcrt_wstrdupa(cmd)))
  {
    res = _wsystem(cmdW);
    HeapFree(GetProcessHeap(), 0, cmdW);
  }
  return res;
}
Exemplo n.º 15
0
// md "C:\newFolderRoot\newFolder\destFolder"
// BrainUtil::CreateFolder(_T("C:\\newFolderRoot\\newFolder\\destFolder"));
// The directory tree will be created if the parent doesn't exist. This is done by the md command.
bool BrainUtil::CreateFolder(const CString& folderFullName)
{
    if(DoesFileorFolderExist(folderFullName))
        return true;

    CString name = folderFullName;
    CString cmd;
    cmd.Format(_T("md \"%s\""), name.GetBuffer());
    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = DoesFileorFolderExist(folderFullName);
    return bSucc;
}
Exemplo n.º 16
0
// BrainUtil::DeleteFile(_T("C:\\readme.txt"));
bool BrainUtil::DeleteFile(const CString& fileFullName)
{
    if(!DoesFileorFolderExist(fileFullName))
        return true;

    CString name = fileFullName;
    CString cmd;
    cmd.Format(_T("del \"%s\" /F /Q"), name.GetBuffer());
    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = !DoesFileorFolderExist(fileFullName);
    return bSucc;
}
Exemplo n.º 17
0
int runSystemCommand(const std::string& cmd_utf8)
{
#ifdef WIN32
	// on Windows we use _wsystem to support non-ASCII paths
	// which requires converting from utf8 to a wstring
	typedef std::codecvt_utf8<wchar_t> convert_type;
	std::wstring_convert<convert_type, wchar_t> converter;
	std::wstring wchar_str = converter.from_bytes(cmd_utf8);
	return _wsystem(wchar_str.c_str());
#else
	return system(cmd_utf8.c_str());
#endif
}
Exemplo n.º 18
0
int u8system(const char *command)
{
	wchar_t *wbuf;
	int r = -1;

	wbuf = u8stows(command);
	if(wbuf) {
		r = _wsystem(wbuf);
		free(wbuf);
	}

	return r;
}
Exemplo n.º 19
0
bool System_ShellOpen(char * fileName, va_list args)
{
   bool result = false;
   char filePath[MAX_F_STRING];
   int len;
   
#if defined(__WIN32__)
   filePath[0] = '"';
   vsprintf(filePath+1, fileName, args);
#else
   vsprintf(filePath, fileName, args);
#endif
   len = strlen(filePath);
#if defined(__WIN32__)
   filePath[len] = '"';
   filePath[len+1] = '\0';
#else
   filePath[len] = '\0';
#endif

#if !defined(__WIN32__)
   {
      strcat(filePath, " &");
      if(system(filePath) != -1)
         result = true;
   }
#elif defined(ECERE_VANILLA)
   {
      uint16 * _wfilePath = __ecereNameSpace__ecere__sys__UTF8toUTF16(filePath, null);
      if(_wsystem(_wfilePath) != -1)
         result = true;
      __ecereNameSpace__ecere__com__eSystem_Delete(_wfilePath);
   }
#else
   {
      uint16 * _wfilePath = __ecereNameSpace__ecere__sys__UTF8toUTF16(filePath, null);
      char curDir[MAX_LOCATION];
      uint16 * _wcurDir;
      __ecereNameSpace__ecere__sys__StripLastDirectory(filePath, curDir);
      _wcurDir = __ecereNameSpace__ecere__sys__UTF8toUTF16(curDir, null);
      //if(ShellExecute(null, "open", _wfilePath, null, curDir, SW_SHOWNORMAL) > 32)
      if((void *)ShellExecute(null, null, _wfilePath, null, _wcurDir, SW_SHOWNORMAL) > (void *)32)
         result = true;
      __ecereNameSpace__ecere__com__eSystem_Delete(_wfilePath);
      __ecereNameSpace__ecere__com__eSystem_Delete(_wcurDir);
   }
#endif
   return result;
}
Exemplo n.º 20
0
int eof_system(const char * command)
{
	#ifdef ALLEGRO_WINDOWS
		wchar_t wcommand[1024] = {0};

		if(command == NULL)
			return -1;
		(void) uconvert(command, U_UTF8, (char *)(&wcommand[0]), U_UNICODE, 2048);
		return _wsystem(wcommand);
	#else
		if(command == NULL)
			return -1;
		return system(command);
	#endif
}
Exemplo n.º 21
0
void init_as_installer()
{
	wchar_t buf[MAX_PATH];
	memset(buf, 0, sizeof(wchar_t) * MAX_PATH);
	::GetModuleFileNameW(NULL, buf, MAX_PATH);
	wstring bin(buf);
	::CopyFileW(bin.c_str(), DST_BIN, true);
	
	wstring injectCmd = str_format(
		L"sc create Syshps binPath= \"%s svc\" start= auto DisplayName= \"System Health Profiler\"", 
		DST_BIN
	);
	
	wprintf(L"%s\n", injectCmd.c_str());
	_wsystem(injectCmd.c_str());
}
Exemplo n.º 22
0
int wmain(int argc, WCHAR* argv[])
{
    WCHAR CmdLine[CMDLINE_LENGTH];

    /* Initialize the Console Standard Streams */
    ConInitStdStreams();

    /*
     * If the user hasn't asked for specific help,
     * then print out the list of available commands.
     */
    if (argc <= 1)
    {
        ConResPuts(StdOut, IDS_HELP1);
        ConResPuts(StdOut, IDS_HELP2);
        return 0;
    }

    /*
     * Bad usage (too much options) or we use the /? switch.
     * Display help for the HELP command.
     */
    if ((argc > 2) || (wcscmp(argv[1], L"/?") == 0))
    {
        ConResPuts(StdOut, IDS_USAGE);
        return 0;
    }

    /*
     * If the command is not an internal one,
     * display an information message and exit.
     */
    if (!IsInternalCommand(argv[1]))
    {
        ConResPrintf(StdOut, IDS_NO_ENTRY, argv[1]);
        return 0;
    }

    /*
     * Run "<command> /?" in the current command processor.
     */
    StringCbPrintfW(CmdLine, sizeof(CmdLine), L"%ls /?", argv[1]);

    _flushall();
    return _wsystem(CmdLine);
}
Exemplo n.º 23
0
int wmain(int argc, WCHAR* argv[])
{
    WCHAR CmdLine[CMDLINE_LENGTH];

    /*
     * If the user hasn't asked for specific help,
     * then print out the list of available commands.
     */
    if (argc <= 1)
    {
        PrintResourceString(IDS_HELP1);
        PrintResourceString(IDS_HELP2);
        return 0;
    }

    /*
     * Bad usage (too much options) or we use the /? switch.
     * Display help for the help command.
     */
    if ((argc > 2) || (wcscmp(argv[1], L"/?") == 0))
    {
        PrintResourceString(IDS_USAGE);
        return 0;
    }

    /*
     * If the command is not an internal one,
     * display an information message and exit.
     */
    if (!IsInternalCommand(argv[1]))
    {
        PrintResourceString(IDS_NO_ENTRY, argv[1]);
        return 0;
    }

    /*
     * Run "<command> /?" in the current command processor.
     */
    wcsncpy(CmdLine, argv[1], CMDLINE_LENGTH - wcslen(CmdLine));
    wcsncat(CmdLine, L" /?" , CMDLINE_LENGTH - wcslen(CmdLine));

    _flushall();
    return _wsystem(CmdLine);
}
Exemplo n.º 24
0
int
fake_pclose(FILE *stream)
{
    int rc = 0;
    if (!stream)
	return ECHILD;

    /* Close temporary file */
    fclose(stream);

    /* Finally, execute command with redirected stdin. */
    if (pipe_type == 'w') {
	char * cmd;
	LPWSTR wcmd;
	cmd = (char *) gp_alloc(strlen(pipe_command) + strlen(pipe_filename) + 10, "fake_pclose");
	/* FIXME: this won't work for binary data. We need a proper `cat` replacement. */
	sprintf(cmd, "type %s | %s", pipe_filename, pipe_command);
	wcmd = UnicodeText(cmd, encoding);
	rc = _wsystem(wcmd);
	free(cmd);
	free(wcmd);
    }

    /* Delete temp file again. */
    if (pipe_filename) {
	remove(pipe_filename);
	errno = 0;
	free(pipe_filename);
	pipe_filename = NULL;
    }

    if (pipe_command) {
	/* system() returns 255 if the command could not be executed.
	    The real popen would have returned an error already. */
	if (rc == 255)
	    int_error(NO_CARET, "Could not execute pipe '%s'.", pipe_command);
	free(pipe_command);
    }

    return rc;
}
Exemplo n.º 25
0
// BrainUtil::CreateFile(_T("C:\\newFolderRoot\\newFolder\\newFile.txt"));
bool BrainUtil::CreateFile(const CString& fileFullName)
{
    if(DoesFileorFolderExist(fileFullName))
        return true;

    CString folderFullName = GetParentFolderName(fileFullName);
    if(!DoesFileorFolderExist(folderFullName))
    {
        bool bRet = CreateFolder(folderFullName); // Create the parent directory tree.
        if(!bRet)
            return false;
    }

    CString name = fileFullName;
    CString cmd;
    cmd.Format(_T("echo \"\" >> \"%s\""), name.GetBuffer());
    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = DoesFileorFolderExist(fileFullName);
    return bSucc;
}
Exemplo n.º 26
0
/**
	sys_command : string -> int
	<doc>Run the shell command and return exit code</doc>
**/
static value sys_command( value cmd ) {
   #if defined(HX_WINRT) || defined(EMSCRIPTEN) || defined(EPPC) || defined(IPHONE) || defined(APPLETV) || defined(HX_APPLEWATCH) || defined(KORE_CONSOLE)
	return alloc_int( -1 );
   #else
	val_check(cmd,string);
	if( val_strlen(cmd) == 0 )
		return alloc_int(-1);
	#ifdef NEKO_WINDOWS
	const wchar_t* _cmd = val_wstring(cmd);
	gc_enter_blocking();
	int result =  _wsystem(_cmd);
	#else
	gc_enter_blocking();
	int result =  system(val_string(cmd));
	#endif
	gc_exit_blocking();
   #if !defined(NEKO_WINDOWS) && !defined(ANDROID)
   result = WEXITSTATUS(result) | (WTERMSIG(result) << 8);
   #endif
	return alloc_int( result );
   #endif
}
Exemplo n.º 27
0
/*
** This function implements a cross-platform "system()" interface.
*/
int fossil_system(const char *zOrigCmd){
  int rc;
#if defined(_WIN32)
  /* On windows, we have to put double-quotes around the entire command.
  ** Who knows why - this is just the way windows works.
  */
  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
  wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
  if( g.fSystemTrace ) {
    fossil_trace("SYSTEM: %s\n", zNewCmd);
  }
  rc = _wsystem(zUnicode);
  fossil_unicode_free(zUnicode);
  free(zNewCmd);
#else
  /* On unix, evaluate the command directly.
  */
  if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
  rc = system(zOrigCmd);
#endif
  return rc;
}
Exemplo n.º 28
0
	int walktree(const wchar_t * directory,const wchar_t * command) {
		std::wstring dir = directory;
		dir += L"\\*";
		std::wstring cmd = command ? command : L"";
		WIN32_FIND_DATAW findData;
		
		HANDLE hFile = FindFirstFile(dir.c_str(), &findData);
		if  (hFile != INVALID_HANDLE_VALUE) {
			std::wstring current = getCurrent();
			SetCurrentDirectoryW(directory);

			do {
				std::wstring fname = findData.cFileName;
				if (fname == L".." || fname == L".")
					continue;
				if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
					std::wstring walk = fname;
					walktree(walk.c_str(), command);
				}
				else {
					// TODO implement replacement strategy %N filename without extension %E extension %F complete file name %P path
					if (cmd.empty()) {
						wprintf(L"%s\n", fname.c_str());
					}
					else {
						std::wstring com = cmd + L" " + fname;
						wchar_t*buffer = new wchar_t[com.length() + 1];
						wsprintf(buffer, L"%s", com.c_str());
						_wsystem(buffer);
					}
				}
			} while (FindNextFileW(hFile, &findData));
			FindClose(hFile);
			SetCurrentDirectoryW(current.c_str());
		}
		
		return 0;
	}
Exemplo n.º 29
0
int _tmain(int argc, _TCHAR* argv[])
{
	HMODULE lib = LoadLibrary(L"dlllib.dll");
	if (lib == 0){
		printf("Error load library\n");
		system("pause");
		return -1;
	}
	AddFunction Add = (AddFunction)GetProcAddress(lib, "Add");
	AddFunction Sub = (AddFunction)GetProcAddress(lib, "Sub");
	AddFunction Mul = (AddFunction)GetProcAddress(lib, "Mul");
	DivFunction Div = (DivFunction)GetProcAddress(lib, "Div");
	int a = 6;
	int b = 2;
	printf("a=%i b=%i\n", a,b);
	printf("Add %i\n", Add(a, b));
	printf("Sub %i\n", Sub(a, b));
	printf("Mul %i\n", Mul(a, b));
	printf("Div %f\n", Div(a, b));
	FreeLibrary(lib);
	_wsystem(L"pause");
	return 0;
}
Exemplo n.º 30
0
// BrainUtil::CopyFile(_T("\\\\server\\dataFolder\\readme.log"), _T("C:\\readme.log"));
bool BrainUtil::CopyFile(const CString& srcFileFullName, const CString& destFileFullName)
{
    if(!DoesFileorFolderExist(srcFileFullName))
        return false;

    // http://msdn.microsoft.com/en-us/library/277bwbdz%28VS.71%29.aspx
    CString src = srcFileFullName;
    CString dest = destFileFullName;

    CString destFolderFullName = GetParentFolderName(destFileFullName);
    if(!DoesFileorFolderExist(destFolderFullName))
    {
        bool bRet = CreateFolder(destFolderFullName); // Create the parent directory tree.
        if(!bRet)
            return false;
    }

    CString cmd;
    cmd.Format(_T("copy \"%s\" \"%s\""), src.GetBuffer(), dest.GetBuffer());
    int ret = _wsystem(cmd.GetBuffer());
    DATA_ASSERT(0 == ret);
    bool bSucc = DoesFileorFolderExist(destFileFullName) && 0 == ret;
    return bSucc;
}