您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DeleteFile函数代码示例

51自学网 2021-06-01 20:26:35
  C++
这篇教程C++ DeleteFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DeleteFile函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteFile函数的具体用法?C++ DeleteFile怎么用?C++ DeleteFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DeleteFile函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: deleteFile

bool deleteFile(const char* path) {	return DeleteFile(path)!=0;}
开发者ID:NateChambers,项目名称:duct-cpp,代码行数:3,


示例2: updateAll

//.........这里部分代码省略.........					/* sync the file/folder over, then add the file metadata to the data file and runtime maps */					if ( MAIN_APP->getAttr()[i].objtype == OrangeFS_TYPE_DIRECTORY )					{						MAIN_APP->syncDir(metadataHandler->getRemoteFileName(i));					}					else 					{						MAIN_APP->syncFile(metadataHandler->getRemoteFileName(i), MAIN_APP->getAttr()[i].size);								}					metadataHandler->addFileMetadata(metadataHandler->getRemoteFileName(i), &MAIN_APP->getAttr()[i]);					syncList->updateList(metadataHandler->getRemoteFileName(i));				}			}		}		deleteIndexes.reserve(MAIN_APP->getNumFiles());		/* if all the files on the server were deleted, getNumFiles() would appropriately hold index for all of them */		if (filesDeleted)		{			for (int i=0; i < MAIN_APP->getNumFiles(); i++)			{				/* the local file wasn't found on the server, delete locally */				if ( !metadataHandler->isLocalOnServer( metadataHandler->getFileName(i) ) )				{					/* THIS ISN"T WORKING, GETS IN HERE EVERY TIME */					orangefs_debug_print("---- ADDDED index : %d/n", i);					deleteIndexes.push_back(i);				}			}			orangefs_debug_print("NUM FILES FOR DELETE : %d/n", deleteIndexes.size());			/* now we have the indexes of files stored locally to be deleted */			for (int i=0; i < deleteIndexes.size(); i++)			{				/***********************************************************************************************/				/* we will need to delete the actual file, and all of it's traces at the following locations : */				/*																							   */				/* 1) the physical file on the local hard disk												   */				/* 2) the metadata entry from the metadata file												   */				/* 3) the list control entry for the file													   */				/* 4) the runtime maps																		   */				/***********************************************************************************************/				/* (1) */				wxString fullPath = MAIN_APP->getLocalSyncPath();				fullPath += metadataHandler->getFileName(i);#ifdef WIN32				DeleteFile(fullPath.c_str());#elif				remove(fullPath.c_str());#endif				/* (2) and (4) */				metadataHandler->removeFile(metadataHandler->getFileName(i));				/* (3) */				MAIN_FRAME->fileHandler->removeListData(metadataHandler->getFileName(i));			}		}#ifdef WIN32		Sleep(5000);	/* Wait 5 seconds before checking for updates again */#elif		sleep(5000);	/* maybe in the future have the user set this value in the app configuration */#endif		stringstream ss;		ss << timesUpdated;		/* clear and refresh the status text */		statusBarString.clear();		statusBarString = "Updated ";		statusBarString += ss.str();		statusBarString += " times";		MAIN_FRAME->setStatusbarText(statusBarString);		timesUpdated++;			}while(!MAIN_APP->stillUpdating());	/* keep checking for new files or existing file modifications on the subscribed dirs/files */done_syncing:	/* let the app know we're finished syncing */	MAIN_APP->finishedSyncing(true);	orangefs_debug_print("---- Syncing Completed ----/n");	for (int i=0; i < MAX_FILES; i++)	{			free(mainFileListing[i]);	}	free(mainFileListing);	deleteIndexes.clear();	LPDWORD exitCode;	GetExitCodeThread(dirWatcher->getThreadHandle(), exitCode);	TerminateThread(dirWatcher->getThreadHandle(), *exitCode);	return ret;}
开发者ID:snsl,项目名称:pvfs2-osd,代码行数:101,


示例3: InUn

static BOOLInUn(int remove, char *drivername, char *dllname, char *dll2name, char *dsname){    char path[301], driver[300], attr[300], inst[400], inst2[400];    WORD pathmax = sizeof (path) - 1, pathlen;    DWORD usecnt, mincnt;    if (SQLInstallDriverManager(path, pathmax, &pathlen)) {	char *p;	sprintf(driver, "%s;Driver=%s;Setup=%s;",		drivername, dllname, dllname);	p = driver;	while (*p) {	    if (*p == ';') {		*p = '/0';	    }	    ++p;	}	usecnt = 0;	SQLInstallDriverEx(driver, NULL, path, pathmax, &pathlen,			   ODBC_INSTALL_INQUIRY, &usecnt);	sprintf(driver, "%s;Driver=%s//%s;Setup=%s//%s;",		drivername, path, dllname, path, dllname);	p = driver;	while (*p) {	    if (*p == ';') {		*p = '/0';	    }	    ++p;	}	sprintf(inst, "%s//%s", path, dllname);	if (dll2name) {	    sprintf(inst2, "%s//%s", path, dll2name);	}	if (!remove && usecnt > 0) {	    /* first install try: copy over driver dll, keeping DSNs */	    if (GetFileAttributes(dllname) != INVALID_FILE_ATTRIBUTES &&		CopyFile(dllname, inst, 0) &&		CopyOrDelModules(dllname, path, 0)) {		if (dll2name != NULL) {		    CopyFile(dll2name, inst2, 0);		}		return TRUE;	    }	}	mincnt = remove ? 1 : 0;	while (usecnt != mincnt) {	    if (!SQLRemoveDriver(driver, TRUE, &usecnt)) {		break;	    }	}	if (remove) {	    if (!SQLRemoveDriver(driver, TRUE, &usecnt)) {		ProcessErrorMessages("SQLRemoveDriver");		return FALSE;	    }	    if (!usecnt) {		char buf[512];		DeleteFile(inst);		/* but keep inst2 */		CopyOrDelModules(dllname, path, 1);		if (!quiet) {		    sprintf(buf, "%s uninstalled.", drivername);		    MessageBox(NULL, buf, "Info",			       MB_ICONINFORMATION|MB_OK|MB_TASKMODAL|			       MB_SETFOREGROUND);		}	    }	    if (nosys) {		goto done;	    }	    sprintf(attr, "DSN=%s;", dsname);	    p = attr;	    while (*p) {		if (*p == ';') {		    *p = '/0';		}		++p;	    }	    SQLConfigDataSource(NULL, ODBC_REMOVE_SYS_DSN, drivername, attr);	    goto done;	}	if (GetFileAttributes(dllname) == INVALID_FILE_ATTRIBUTES) {	    return FALSE;	}	if (!CopyFile(dllname, inst, 0)) {	    char buf[512];	    sprintf(buf, "Copy %s to %s failed", dllname, inst);	    MessageBox(NULL, buf, "CopyFile",		       MB_ICONSTOP|MB_OK|MB_TASKMODAL|MB_SETFOREGROUND); 	    return FALSE;	}	if (dll2name != NULL && !CopyFile(dll2name, inst2, 0)) {	    char buf[512];	    sprintf(buf, "Copy %s to %s failed", dll2name, inst2);	    MessageBox(NULL, buf, "CopyFile",//.........这里部分代码省略.........
开发者ID:lessc0de,项目名称:sqliteodbc,代码行数:101,


示例4: MPQInit

Application::Application(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){    MPQInit();    instance = this;    resources = NULL;    imageLibrary = NULL;    dotaLibrary = NULL;    mainWindow = NULL;    cache = NULL;    hInstance = _hInstance;    _loaded = false;    root = String::getPath(getAppPath());    cfg.read();    warLoader = new MPQLoader("Custom_V1");    warLoader->loadArchive(String::buildFullName(cfg.warPath, "war3.mpq"));    warLoader->loadArchive(String::buildFullName(cfg.warPath, "war3x.mpq"));    warLoader->loadArchive(String::buildFullName(cfg.warPath, "war3xlocal.mpq"));    warLoader->loadArchive(String::buildFullName(cfg.warPath, "war3patch.mpq"));    if (logCommand(lpCmdLine))        return;    ScriptType::initTypes();    UpdateDialog::init(hInstance);    INITCOMMONCONTROLSEX iccex;    iccex.dwSize = sizeof iccex;    iccex.dwICC = ICC_STANDARD_CLASSES | ICC_PROGRESS_CLASS |                  ICC_BAR_CLASSES | ICC_TREEVIEW_CLASSES | ICC_LISTVIEW_CLASSES |                  ICC_TAB_CLASSES | ICC_UPDOWN_CLASS | ICC_DATE_CLASSES;    InitCommonControlsEx(&iccex);    LoadLibrary("Riched20.dll");    OleInitialize(NULL);    String path = String::getPath(getAppPath());    String resPath = String::buildFullName(path, "resources.mpq");    String patchPath = String::buildFullName(path, "install.mpq");    File* tOpen = File::open(resPath, File::READ);    if (tOpen == NULL)    {        tOpen = File::open(patchPath, File::READ);        if (tOpen)        {            delete tOpen;            MoveFile(patchPath, resPath);        }    }    else        delete tOpen;    resources = MPQArchive::open(resPath);    MPQArchive* patch = MPQArchive::open(patchPath, File::READ);    if (patch)    {        for (uint32 i = 0; i < patch->getHashSize(); i++)        {            char const* name = patch->getFileName(i);            if (name)            {                MPQFile* source = patch->openFile(i, File::READ);                if (source)                {                    MPQFile* dest = resources->openFile(name, File::REWRITE);                    if (dest)                    {                        static uint8 buf[1024];                        while (int length = source->read(buf, sizeof buf))                            dest->write(buf, length);                        delete dest;                    }                    delete source;                }            }        }        delete patch;        DeleteFile(patchPath);    }    imageLibrary = new ImageLibrary(resources);    cache = new CacheManager();    dotaLibrary = new DotaLibrary();#if 0    File* dlog = File::open("diff.txt", File::REWRITE);    for (int pt = 0; pt < 120; pt++)    {        String prev = "";        bool different = false;        for (int ver = 1; ver <= 80 && !different; ver++)        {            Dota* dota = dotaLibrary->getDota(makeVersion(6, ver));            if (dota)            {                Dota::Hero* hero = dota->getHero(pt);                if (hero)                {                    if (prev == "")                        prev = hero->name;//.........这里部分代码省略.........
开发者ID:DylanGuedes,项目名称:dota-replay-manager,代码行数:101,


示例5: RecurseDeletePath

bool RecurseDeletePath(const char * a_path){  WIN32_FIND_DATA findData;  char path[MAX_PATH] = "";  strcpy(path,a_path);  // remove trailing '/' char  int last = (int)strlen(path) - 1;  if(path[last] == '//')  {    path[last] = '/0';  }  // is path valid  HANDLE h = FindFirstFile(path,&findData);  // path not could not be found OR path is a file, not a folder  if((h == INVALID_HANDLE_VALUE) || (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)))  {    return false;  }  FindClose(h);  h = NULL;  // push current working directory  char currDir[MAX_PATH + 1] = "";  GetCurrentDirectory(MAX_PATH,currDir);  SetCurrentDirectory(path);  // iterate over contents of folder  h = FindFirstFile("*",&findData);  if(h != INVALID_HANDLE_VALUE)  {    for(;;)    {      if(strcmp(findData.cFileName,".") != 0 && strcmp(findData.cFileName,"..") != 0)      {        if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)        {          RecurseDeletePath(findData.cFileName);        }        else        {          DWORD attrs = GetFileAttributes(findData.cFileName);          if(attrs & FILE_ATTRIBUTE_READONLY)          {            SetFileAttributes(findData.cFileName,attrs ^ FILE_ATTRIBUTE_READONLY);          }          if(DeleteFile(findData.cFileName) != TRUE)          {            DWORD res = GetLastError();            printf("/nDeleteFile() returned '%d'../n",(int)res);          }        }      }      if(!FindNextFile(h,&findData)) break;    }  }  // pop current working directory  SetCurrentDirectory(currDir);  FindClose(h);  h = NULL;  // remove this directory  DWORD attrs = GetFileAttributes(path);  if(attrs & FILE_ATTRIBUTE_READONLY)  {    SetFileAttributes(path,attrs ^ FILE_ATTRIBUTE_READONLY);  }  return RemoveDirectory(path) != 0;}
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:77,


示例6: DeleteFile

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action){        DeleteFile("sprites//fbDefines.fabric");}
开发者ID:SpaceWind,项目名称:elo2kbuilder,代码行数:4,


示例7: DeleteLogFiles

int DeleteLogFiles(){   WIN32_FIND_DATA ffd;   char szDir[MAX_PATH];   char File[MAX_PATH];   HANDLE hFind = INVALID_HANDLE_VALUE;   DWORD dwError=0;   LARGE_INTEGER ft;   time_t now = time(NULL);   int Age;   // Prepare string for use with FindFile functions.  First, copy the   // string to a buffer, then append '/*' to the directory name.   strcpy(szDir, GetBPQDirectory());   strcat(szDir, "//logs//Log_*.txt");   // Find the first file in the directory.   hFind = FindFirstFile(szDir, &ffd);   if (INVALID_HANDLE_VALUE == hFind)    {      return dwError;   }       // List all the files in the directory with some info about them.   do   {      if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)      {         OutputDebugString(ffd.cFileName);      }      else      {         ft.HighPart = ffd.ftCreationTime.dwHighDateTime;         ft.LowPart = ffd.ftCreationTime.dwLowDateTime;		 ft.QuadPart -=  116444736000000000;		 ft.QuadPart /= 10000000;		 Age = (now - ft.LowPart) / 86400; 		 if (Age > LogAge)		 {			 sprintf(File, "%s/logs/%s%c", GetBPQDirectory(), ffd.cFileName, 0);			 if (DeletetoRecycleBin)				DeletetoRecycle(File);			 else				 DeleteFile(File);		 }      }   }   while (FindNextFile(hFind, &ffd) != 0);    dwError = GetLastError();   FindClose(hFind);   return dwError;}
开发者ID:g8bpq,项目名称:LinBPQ,代码行数:62,


示例8: while

void CSetCurrentProject::OnOK(){    int nSelected = -1;    POSITION p = m_listAvailableProjects.GetFirstSelectedItemPosition();    while(p)    {        nSelected = m_listAvailableProjects.GetNextSelectedItem(p);    }    if( nSelected >= 0 )    {        TCHAR szBuffer[1024];        DWORD cchBuf(1024);        LVITEM lvi;        lvi.iItem = nSelected;        lvi.iSubItem = 0;        lvi.mask = LVIF_TEXT;        lvi.pszText = szBuffer;        lvi.cchTextMax = cchBuf;        m_listAvailableProjects.GetItem(&lvi);        for( CUInt i = 0; i < g_projects.size(); i++ )        {            if(g_projects[i]->m_isActive)            {                if( Cmp( szBuffer, g_projects[i]->m_name ) )                {                    return; // no need to switch projects                }            }        }        //switch projects        //close curren open VScene        if(!ex_pVandaEngine1Dlg->OnMenuClickedNew(CTrue))            return;        //fist of all, mark all as inactive        for( CUInt i = 0; i < g_projects.size(); i++ )        {            g_projects[i]->m_isActive = CFalse;        }        //then find the selected project and mark it as active        for( CUInt i = 0; i < g_projects.size(); i++ )        {            if( Cmp( szBuffer, g_projects[i]->m_name ) )            {                g_projects[i]->m_isActive = CTrue;                break;            }        }        //change current directory        Cpy( g_currentProjectPath, g_projectsPath );        Append( g_currentProjectPath, szBuffer );        Append( g_currentProjectPath, "/" );        //clear VScene names        g_VSceneNamesOfCurrentProject.clear();        //then fill it with the VScenes of the selected project        for( CUInt i = 0; i < g_projects.size(); i++ )        {            if( g_projects[i]->m_isActive )            {                for( CUInt j = 0; j < g_projects[i]->m_sceneNames.size(); j++ )                {                    g_VSceneNamesOfCurrentProject.push_back( g_projects[i]->m_sceneNames[j].c_str() );                }            }        }        CChar m_currentVSceneNameWithoutDot[MAX_NAME_SIZE];        if (Cmp(g_currentVSceneName, "/n"))            Cpy(m_currentVSceneNameWithoutDot, "Untitled");        else        {            Cpy(m_currentVSceneNameWithoutDot, g_currentVSceneName);            GetWithoutDot(m_currentVSceneNameWithoutDot);        }        CChar temp[256];        sprintf(temp, "%s%s%s%s%s", "Vanda Engine 1.4 (", szBuffer, " - ", m_currentVSceneNameWithoutDot, ")");        ex_pVandaEngine1Dlg->SetWindowTextA(temp);        //save the changes to projects.dat        FILE *ProjectsFilePtr;        CChar DATPath[MAX_NAME_SIZE];        sprintf( DATPath, "%s%s", g_projectsPath, "projects.dat" );        DeleteFile( DATPath );        ProjectsFilePtr =  fopen( DATPath, "wb" );        if( !ProjectsFilePtr )        {            MessageBox( "Couldn't open 'assets/Projects/projects.dat' to save data!", "Vanda Engine Error", MB_OK | MB_ICONERROR);            //return;        }        CInt numProjects = (CInt)g_projects.size();        fwrite(&numProjects, sizeof(CInt), 1, ProjectsFilePtr);        fclose(ProjectsFilePtr);        for (CInt i = 0; i < numProjects; i++)        {//.........这里部分代码省略.........
开发者ID:DCubix,项目名称:1.4.0,代码行数:101,


示例9: Shortcut_FixStartup

BOOL Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart){   TCHAR szShortcut[ MAX_PATH + 10 ] = TEXT("");   BOOL bSuccess;   HKEY hk;   if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software//Microsoft//Windows//CurrentVersion//Explorer//Shell Folders"), &hk) == 0)      {      DWORD dwSize = sizeof(szShortcut);      DWORD dwType = REG_SZ;      RegQueryValueEx (hk, TEXT("Common Startup"), NULL, &dwType, (LPBYTE)szShortcut, &dwSize);      if (szShortcut[0] == TEXT('/0'))         {         dwSize = sizeof(szShortcut);         dwType = REG_SZ;         RegQueryValueEx (hk, TEXT("Startup"), NULL, &dwType, (LPBYTE)szShortcut, &dwSize);         }      RegCloseKey (hk);      }   if (szShortcut[0] == TEXT('/0'))      {      GetWindowsDirectory (szShortcut, MAX_PATH);      lstrcat (szShortcut, TEXT("//Start Menu//Programs//Startup"));      }   lstrcat (szShortcut, TEXT("//"));   lstrcat (szShortcut, pszLinkName);   TCHAR szSource[ MAX_PATH ];   GetModuleFileName (GetModuleHandle(NULL), szSource, MAX_PATH);   if (fAutoStart)   {       DWORD code, len, type;       TCHAR szParams[ 64 ] = TEXT(AFSCREDS_SHORTCUT_OPTIONS);       code = RegOpenKeyEx(HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY,                            0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk);       if (code == ERROR_SUCCESS) {           len = sizeof(szParams);           type = REG_SZ;           code = RegQueryValueEx(hk, "AfscredsShortcutParams", NULL, &type,                                   (BYTE *) &szParams, &len);           RegCloseKey (hk);       }       if (code != ERROR_SUCCESS) {           code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,                                0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk);           if (code == ERROR_SUCCESS) {               len = sizeof(szParams);               type = REG_SZ;               code = RegQueryValueEx(hk, "AfscredsShortcutParams", NULL, &type,                                       (BYTE *) &szParams, &len);               RegCloseKey (hk);           }       }       bSuccess = Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams);   }   else // (!g.fAutoStart)   {      bSuccess = DeleteFile (szShortcut);   }   return bSuccess;}
开发者ID:chanke,项目名称:openafs-osd,代码行数:64,


示例10: AfxEnableControlContainer

BOOL CGpsxConsoleApp::InitInstance(){	AfxEnableControlContainer();	openCommandWindow();	TCHAR result[MAX_PATH];	GetModuleFileName(NULL,result,MAX_PATH);//daemon	CString strProcess;	strProcess.Format(_T("%s"),result);	strProcess.MakeLower();	int nRet = strProcess.Find("daemon.exe");	if(__argc==1 && nRet>0 )//带参数	{		printf("守护进程/r/nPress 'E' to exit/r/n");		nRet = strProcess.Find("daemon");		strProcess.Delete(nRet,6);		HANDLE hProcess=NULL;		DWORD dwProcessID=0;		while(1){			if((dwProcessID=_IsProcessExist(strProcess))==0){				int nRet = DeleteFile(strProcess);				if(nRet || GetLastError()==2){					if(CopyFile(result,strProcess,FALSE)){						PROCESS_INFORMATION pi;						_CreateProcess(strProcess,pi,FALSE,"");						hProcess = pi.hProcess;						dwProcessID = pi.dwProcessId;					}else{					}				}else{				//	printf("deletefile %d,%d/r/n",nRet,GetLastError());				}				//printf("pi-->%d-->%d/r/n",hProcess,pi.dwProcessId);			}else{				//printf("IS-->%d/r/n",hProcess);			}			//Sleep(30*1000);			if(getch2(3*1000) == 101){				_KillProcess(dwProcessID);				int i=0;				do{					Sleep(i*100);					BOOL bRet = DeleteFile(strProcess);					printf("%s---%d/r/n",strProcess,bRet);				}while(i++<4);				return 1;			}		}	}	CString strLogServer("sonaps.logger.service.exe");		//*	HANDLE hProcess=NULL;	DWORD dwProcessID = 0;	if(!_IsProcessExist(strLogServer,FALSE)){		PROCESS_INFORMATION pi;		_CreateProcess(strLogServer,pi,FALSE,"");	}/**/	// Standard initialization	// If you are not using these features and wish to reduce the size	//  of your final executable, you should remove from the following	//  the specific initialization routines you do not need.	int nListenPort=GetPrivateProfileInt(_T("GPSSet"),_T("listenPort"),110,GetMgConfigFileName());	CString strTmp;	strTmp.Format(_T("GPSXCONSOLE_H__BA472566_78AA_%d"),nListenPort);	if(OpenMutex(MUTEX_ALL_ACCESS,FALSE,strTmp))	{		return FALSE;	}	else	{		CreateMutex(NULL,FALSE,strTmp);	}// 	IDumper *pDumper = CreateDumper();// 	if(pDumper)// 		pDumper->SetExceptionFilter();	//自动抓取错误dump	CMiniDumper::SetExceptionFilter(MiniDumpWithFullMemory);#ifdef _AFXDLL	Enable3dControls();			// Call this when using MFC in a shared DLL#else	Enable3dControlsStatic();	// Call this when linking to MFC statically#endif	CGpsxConsoleDlg dlg;	m_pMainWnd = &dlg;	int nResponse = dlg.DoModal();	if (nResponse == IDOK)	{		// TODO: Place code here to handle when the dialog is		//  dismissed with OK	}	else if (nResponse == IDCANCEL)	{		// TODO: Place code here to handle when the dialog is		//  dismissed with Cancel	}//.........这里部分代码省略.........
开发者ID:daiybh,项目名称:GPSGater,代码行数:101,


示例11: copy

//.........这里部分代码省略.........        _tcscat(TempSrc,_T(".decrypt"));        if (!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))        {            CloseHandle (hFileSrc);            nErrorLevel = 1;            return 0;        }        _tcscpy(source, TempSrc);    }    if (lpdwFlags & COPY_RESTART)    {        _tcscpy(TrueDest, dest);        GetEnvironmentVariable(_T("TEMP"),dest,MAX_PATH);        _tcscat(dest,_T("//"));        FileName = _tcsrchr(TrueDest,_T('//'));        FileName++;        _tcscat(dest,FileName);    }    if (!IsExistingFile (dest))    {        TRACE ("opening/creating/n");        hFileDest =            CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);    }    else if (!append)    {        TRACE ("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);/n", debugstr_aw(dest));        SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);        TRACE ("DeleteFile (%s);/n", debugstr_aw(dest));        DeleteFile (dest);        hFileDest =	CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);    }    else    {        LONG lFilePosHigh = 0;        if (!_tcscmp (dest, source))        {            CloseHandle (hFileSrc);            return 0;        }        TRACE ("opening/appending/n");        SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);        hFileDest =            CreateFile (dest, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);        /* Move to end of file to start writing */        SetFilePointer (hFileDest, 0, &lFilePosHigh,FILE_END);    }    if (hFileDest == INVALID_HANDLE_VALUE)    {        CloseHandle (hFileSrc);        ConOutResPuts(STRING_ERROR_PATH_NOT_FOUND);        nErrorLevel = 1;        return 0;    }
开发者ID:hoangduit,项目名称:reactos,代码行数:67,


示例12: ShellExecute

LRESULT CDlgView::onBnCLick( WPARAM wParam, LPARAM lParam ){    CButtonCtrl *button = (CButtonCtrl*)lParam;    ADD_APP_DATA itemdata =(ADD_APP_DATA)button->m_pData;    if (itemdata.isLagerPic)    {        ShellExecute(NULL,"open",TEXT("http://8btc.com/thread-25079-1-1.html"),NULL,NULL, SW_SHOWNORMAL);        return 0;    }    if (itemdata.isInstall)    {        ADD_APP_DATA BtData;        GetAppUrlValue(itemdata.type,itemdata.appname,BtData);        if (BtData.appname != "" && BtData.version != itemdata.version)        {            if ( IDYES == UiFun::MessageBoxEx(_T("此程序有更新的版本,是否要下载") , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage) , MFB_YESNO|MFB_TIP ) )            {                string dowloufilepath = m_apppath + "//"+strprintf("%s",itemdata.appname);                string dowloufileName = dowloufilepath + "//"+strprintf("%s.zip",itemdata.appname);                string dowlouUrlPaht = m_urlpath +"/"+strprintf("%s",itemdata.appname);                string dowlouUrName = dowlouUrlPaht +"/"+strprintf("%s.zip",itemdata.appname);                if (Download(dowlouUrName.c_str(),dowloufileName.c_str()))                {                    UnZipFile(dowloufileName,dowloufilepath);                    ///删除下载的临时文件                    DeleteFile(dowloufileName.c_str());                    button->m_pData.version = BtData.version;                    MoidfyListAndSaveToFile(itemdata.type ,itemdata.appname,button->m_pData);                }            }        }        ///打开应用程序        {            string appname = strprintf("%s",itemdata.appname)+".exe";            map<string,PROCESS_INFORMATION>::iterator it = m_process.find(itemdata.appname);            if (it != m_process.end()) /// 此应用程序已经打开,置顶            {                PROCESS_INFORMATION item = it->second;                HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,item.dwProcessId);                if(NULL != processHandle)                {                    ProcessWindow procwin;                    procwin.dwProcessId = item.dwProcessId;                    procwin.hwndWindow = NULL;                    // 查找主窗口                    EnumWindows(EnumWindowCallBack, (LPARAM)&procwin);                    //SetWindowPos(&this->wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);                    //显示窗口                    ::ShowWindow(procwin.hwndWindow , SW_NORMAL);                    //前端显示                    ::SetForegroundWindow(procwin.hwndWindow );                    ::SetWindowPos( procwin.hwndWindow ,0,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);                    CloseHandle(processHandle);                    return 0;                }            }            string appfileexe = m_apppath + "//"+strprintf("%s",itemdata.appname)+"//"+strprintf("%s",itemdata.appname)+strprintf("//%s",itemdata.appname)+".exe";            /// 配置文件安装了,但是找不到exe,重新设置配置文件没有安装            if (_access(appfileexe.c_str(),0) == -1)            {                button->m_pData.isInstall = false;                MoidfyListAndSaveToFile(itemdata.type ,itemdata.appname,button->m_pData);                return 0;            }            PROCESS_INFORMATION		app_pi;            STARTUPINFOA si;            memset(&si, 0, sizeof(STARTUPINFO));            si.cb = sizeof(STARTUPINFO);            si.dwFlags = STARTF_USESHOWWINDOW;            si.wShowWindow =SW_HIDE;//SW_HIDE; //SW_SHOW;            if(!CreateProcessA(NULL,(LPSTR)appfileexe.c_str(),NULL,NULL,FALSE,0,NULL,NULL,&si,&app_pi))            {                int n = GetLastError();                AfxMessageBox(_T("CreateProcessA sever error!"));                LogPrint("INFO", "开启服务端程序失败/n");                exit(1);            }            CloseHandle(app_pi.hProcess);            CloseHandle(app_pi.hThread);            m_process[itemdata.appname]=app_pi;        }    } else { /// 下载可执行程序        string dowloufilepath = m_apppath + "//"+strprintf("%s",itemdata.appname);        string dowloufileName = dowloufilepath + "//"+strprintf("%s.zip",itemdata.appname);        string dowlouUrlPaht = m_urlpath +"/"+strprintf("%s",itemdata.appname);        string dowlouUrName = dowlouUrlPaht +"/"+strprintf("%s.zip",itemdata.appname);        if (Download(dowlouUrName.c_str(),dowloufileName.c_str()))        {            UnZipFile(dowloufileName,dowloufilepath);            ///删除下载的临时文件            DeleteFile(dowloufileName.c_str());            button->m_pData.isInstall = true;            //// 替换图片            {                string filepathe;//.........这里部分代码省略.........
开发者ID:SoyPay,项目名称:DacrsUI,代码行数:101,


示例13: Cleanup

HRESULT CSXFile::ScCallMethod(CScScript* Script, CScStack *Stack, CScStack *ThisStack, char *Name){	//////////////////////////////////////////////////////////////////////////	// SetFilename	//////////////////////////////////////////////////////////////////////////	if(strcmp(Name, "SetFilename")==0){		Stack->CorrectParams(1);		char* Filename = Stack->Pop()->GetString();		Cleanup();		CBUtils::SetString(&m_Filename, Filename);		Stack->PushNULL();		return S_OK;	}	//////////////////////////////////////////////////////////////////////////	// OpenAsText / OpenAsBinary	//////////////////////////////////////////////////////////////////////////	else if(strcmp(Name, "OpenAsText")==0 || strcmp(Name, "OpenAsBinary")==0){		Stack->CorrectParams(1);		Close();		m_Mode = Stack->Pop()->GetInt(1);		if(m_Mode<1 || m_Mode>3)		{			Script->RuntimeError("File.%s: invalid access mode. Setting read mode.", Name);			m_Mode = 1;		}		if(m_Mode==1)		{			m_ReadFile = Game->m_FileManager->OpenFile(m_Filename);			if(!m_ReadFile)			{				//Script->RuntimeError("File.%s: Error opening file '%s' for reading.", Name, m_Filename);				Close();			}			else m_TextMode = strcmp(Name, "OpenAsText")==0;		}		else		{			if(strcmp(Name, "OpenAsText")==0)			{				if(m_Mode==2) m_WriteFile = fopen(m_Filename, "w+");				else m_WriteFile = fopen(m_Filename, "a+");			}			else			{				if(m_Mode==2) m_WriteFile = fopen(m_Filename, "wb+");				else m_WriteFile = fopen(m_Filename, "ab+");			}			if(!m_WriteFile)			{				//Script->RuntimeError("File.%s: Error opening file '%s' for writing.", Name, m_Filename);				Close();			}			else m_TextMode = strcmp(Name, "OpenAsText")==0;		}		if(m_ReadFile || m_WriteFile) Stack->PushBool(true);		else Stack->PushBool(false);		return S_OK;	}	//////////////////////////////////////////////////////////////////////////	// Close	//////////////////////////////////////////////////////////////////////////	else if(strcmp(Name, "Close")==0){		Stack->CorrectParams(0);		Close();		Stack->PushNULL();		return S_OK;	}	//////////////////////////////////////////////////////////////////////////	// SetPosition	//////////////////////////////////////////////////////////////////////////	else if(strcmp(Name, "SetPosition")==0){		Stack->CorrectParams(1);		if(m_Mode==0)		{			Script->RuntimeError("File.%s: File is not open", Name);			Stack->PushBool(false);		}		else		{			int Pos = Stack->Pop()->GetInt();			Stack->PushBool(SetPos(Pos));		}		return S_OK;	}	//////////////////////////////////////////////////////////////////////////	// Delete	//////////////////////////////////////////////////////////////////////////	else if(strcmp(Name, "Delete")==0){		Stack->CorrectParams(0);		Close();		Stack->PushBool(DeleteFile(m_Filename)!=FALSE);		return S_OK;	}//.........这里部分代码省略.........
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:101,


示例14: UpdateMPD

void UpdateMPD(char *pszOldFileName, char *pszNewFileName, int nPid){    int error;    char pszStr[4096];    HANDLE hMPD;        //FILE *fout;    //fout = fopen("c://temp//update.out", "w");    // Open a handle to the running service    hMPD = OpenProcess(SYNCHRONIZE, FALSE, nPid);    if (hMPD == NULL)    {	error = GetLastError();	Translate_Error(error, pszStr);	//fprintf(fout, "OpenProcess(%d) failed, %s/n", nPid, pszStr);	//fclose(fout);	CloseHandle(hMPD);	return;    }    // Stop the service    CmdStopService();    // Wait for the service to exit    if (WaitForSingleObject(hMPD, 20000) != WAIT_OBJECT_0)    {	error = GetLastError();	Translate_Error(error, pszStr);	//fprintf(fout, "Waiting for the old mpd to stop failed. %s/n", pszStr);	//fclose(fout);	CloseHandle(hMPD);	return;    }    CloseHandle(hMPD);    // Delete the old service    if (!DeleteFile(pszOldFileName))    {	error = GetLastError();	Translate_Error(error, pszStr);	//fprintf(fout, "DeleteFile(%s) failed./nError: %s/n", pszOldFileName, pszStr);	//fclose(fout);	return;    }    // Move the new service to the old service's spot    if (!MoveFile(pszNewFileName, pszOldFileName))    {	error = GetLastError();	Translate_Error(error, pszStr);	//fprintf(fout, "MoveFile(%s,%s) failed./nError: %s/n", pszNewFileName, pszOldFileName, pszStr);	//fclose(fout);	return;    }    char szExe[1024];    if (!GetModuleFileName(NULL, szExe, 1024))    {	Translate_Error(GetLastError(), pszStr);	//fprintf(fout, "GetModuleFileName failed./nError: %s/n", pszStr);	return;    }    STARTUPINFO sInfo;    PROCESS_INFORMATION pInfo;    GetStartupInfo(&sInfo);    _snprintf(pszStr, 4096, "/"%s/" -startdelete /"%s/"", pszOldFileName, szExe);    //fprintf(fout, "launching '%s'/n", pszStr);    if (!CreateProcess(NULL, 	    pszStr,	    NULL, NULL, FALSE, 	    DETACHED_PROCESS,	    NULL, NULL, 	    &sInfo, &pInfo))    {	error = GetLastError();	//fprintf(fout, "CreateProcess failed for '%s'/n", pszStr);	Translate_Error(error, pszStr);	//fprintf(fout, "Error: %s/n", pszStr);	//fclose(fout);	return;    }    CloseHandle(pInfo.hProcess);    CloseHandle(pInfo.hThread);    //fclose(fout);}
开发者ID:santakdalai90,项目名称:mvapich-cce,代码行数:93,


示例15: GetTempPath

fsInternetResult vmsMaliciousDownloadChecker::Check(LPCTSTR pszUrl){	TCHAR szTmpPath [MY_MAX_PATH];	TCHAR szTmpFile [MY_MAX_PATH];	m_bNeedStop = false;	GetTempPath (_countof (szTmpPath), szTmpPath);	GetTempFileName (szTmpPath, _T("fdm"), 0, szTmpFile);		CString strUrl;	strUrl.Format (_T("http://fdm.freedownloadmanager.org/fromfdm/url.php?url=%s"), EncodeUrl (pszUrl));		vmsSimpleFileDownloader dldr;	m_dldr = &dldr;	if (m_bNeedStop) {		DeleteFile (szTmpFile);		return IR_S_FALSE;	}	dldr.Download (strUrl, szTmpFile);	while (dldr.IsRunning ())		Sleep (50);	m_dldr = NULL;	if (dldr.GetLastError ().first != IR_SUCCESS) {		DeleteFile (szTmpFile);		return dldr.GetLastError ().first;	}	if (m_bNeedStop) {		DeleteFile (szTmpFile);		return IR_S_FALSE;	}		HANDLE hFile = CreateFile (szTmpFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 		FILE_FLAG_DELETE_ON_CLOSE, NULL);	ASSERT (hFile != INVALID_HANDLE_VALUE);	if (hFile == INVALID_HANDLE_VALUE) {		DeleteFile (szTmpFile);		return IR_ERROR;	}	char szBuf [1000];	DWORD dwSize = 0;	ReadFile (hFile, szBuf, sizeof (szBuf), &dwSize, NULL);	CloseHandle (hFile);	if (dwSize == 0)	{						m_cOpinions = 0;		m_cMalOpinions = 0;		m_fRating = 0;		m_strVirusCheckResult = _T("");	}	else	{						szBuf [dwSize] = 0;		char szVCR [10000];		sscanf (szBuf, "%d %f %d %s", &m_cOpinions, &m_fRating, &m_cMalOpinions, szVCR);		std::wstring sRes;		AnsiToUni(szBuf, sRes);		m_strVirusCheckResult = sRes.c_str();	}	return IR_SUCCESS;}
开发者ID:naroya,项目名称:freedownload,代码行数:75,


示例16: ExecScript

//.........这里部分代码省略.........        ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL);        szBuf[dwRead] = 0;        if (log) {          char *p, *p2;          SIZE_T iReqLen = lstrlen(szBuf) + lstrlen(szUnusedBuf);          if (GlobalSize(hUnusedBuf) < iReqLen && (iReqLen < g_stringsize || !(log & 2))) {            GlobalUnlock(hUnusedBuf);            hUnusedBuf = GlobalReAlloc(hUnusedBuf, iReqLen+sizeof(szBuf), GHND);            if (!hUnusedBuf) {              lstrcpy(szRet, "error");              break;            }            szUnusedBuf = (char *)GlobalLock(hUnusedBuf);          }          p = szUnusedBuf; // get the old left overs          if (iReqLen < g_stringsize || !(log & 2)) lstrcat(p, szBuf);          else {            lstrcpyn(p + lstrlen(p), szBuf, g_stringsize - lstrlen(p));          }          if (!(log & 2)) {            while (p = my_strstr(p, "/t")) {              if ((int)(p - szUnusedBuf) > (int)(GlobalSize(hUnusedBuf) - TAB_REPLACE_SIZE - 1))              {                *p++ = ' ';              }              else              {                int len = lstrlen(p);                char *c_out=(char*)p+TAB_REPLACE_SIZE+len;                char *c_in=(char *)p+len;                while (len-- > 0) {                  *c_out--=*c_in--;                }                lstrcpy(p, TAB_REPLACE);                p += TAB_REPLACE_SIZE;                *p = ' ';              }            }                        p = szUnusedBuf; // get the old left overs            for (p2 = p; *p2;) {              if (*p2 == '/r') {                *p2++ = 0;                continue;              }              if (*p2 == '/n') {                *p2 = 0;                while (!*p && p != p2) p++;                LogMessage(p);                p = ++p2;                continue;              }              p2 = CharNext(p2);            }                        // If data was taken out from the unused buffer, move p contents to the start of szUnusedBuf            if (p != szUnusedBuf) {              char *p2 = szUnusedBuf;              while (*p) *p2++ = *p++;              *p2 = 0;            }          }        }      }      else {        if (g_to && GetTickCount() > dwLastOutput+g_to) {          TerminateProcess(pi.hProcess, -1);          lstrcpy(szRet, "timeout");        }        else Sleep(LOOPTIMEOUT);      }      GetExitCodeProcess(pi.hProcess, &dwExit);      if (dwExit != STILL_ACTIVE) {        PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL);      }    }done:    if (log & 2) pushstring(szUnusedBuf);    if (log & 1 && *szUnusedBuf) LogMessage(szUnusedBuf);    if ( dwExit == STATUS_ILLEGAL_INSTRUCTION )      lstrcpy(szRet, "error");    if (!szRet[0]) wsprintf(szRet,"%d",dwExit);    pushstring(szRet);    CloseHandle(pi.hThread);    CloseHandle(pi.hProcess);    CloseHandle(newstdout);    CloseHandle(read_stdout);    CloseHandle(newstdin);    CloseHandle(read_stdin);    *(pExec-2) = '/0'; // skip space and quote    DeleteFile(executor);    GlobalFree(g_exec);    if (log) {      GlobalUnlock(hUnusedBuf);      GlobalFree(hUnusedBuf);    }  }}
开发者ID:bsimser,项目名称:treesurgeon,代码行数:101,


示例17: RemoveKilledMessages

BOOL RemoveKilledMessages(){	struct MsgInfo * Msg;	struct MsgInfo ** NewMsgHddrPtr;	char MsgFile[MAX_PATH];	int i, n;	Removed = 0;	GetSemaphore(&MsgNoSemaphore, 0);	GetSemaphore(&AllocSemaphore, 0);	FirstMessageIndextoForward = 0;	NewMsgHddrPtr = zalloc((NumberofMessages+1) * 4);	NewMsgHddrPtr[0] = MsgHddrPtr[0];		// Copy Control Record	i = 0;	for (n = 1; n <= NumberofMessages; n++)	{		Msg = MsgHddrPtr[n];		if (Msg->status == 'K')		{			sprintf_s(MsgFile, sizeof(MsgFile), "%s/m_%06d.mes%c", MailDir, Msg->number, 0);			if (DeletetoRecycleBin)				DeletetoRecycle(MsgFile);			else				DeleteFile(MsgFile);			MsgnotoMsg[Msg->number] = NULL;				free(Msg);			Removed++;		}		else		{			NewMsgHddrPtr[++i] = Msg;			if (memcmp(Msg->fbbs, zeros, NBMASK) != 0)			{				if (FirstMessageIndextoForward == 0)					FirstMessageIndextoForward = i;			}		}	}	NumberofMessages = i;	NewMsgHddrPtr[0]->number = i;	if (FirstMessageIndextoForward == 0)		FirstMessageIndextoForward = NumberofMessages;	free(MsgHddrPtr);	MsgHddrPtr = NewMsgHddrPtr;	FreeSemaphore(&MsgNoSemaphore);	FreeSemaphore(&AllocSemaphore);	SaveMessageDatabase();	return TRUE;}
开发者ID:g8bpq,项目名称:LinBPQ,代码行数:65,


示例18: prepFileName

u32	FSArchiveXPAK::open(string fileName){	XPAK_HEADER			pakHeader;	XPAK_FILE			pakFile;	FSFileEntryXPAK		fileEntry;	prepFileName(&fileName[0]);	archName = fileName;	if(!plugEngine->kernel->fs->exists(fileName, ST_DISK))	{		std::ofstream fout;		fout.open(fileName.c_str(), std::ios::binary | std::ios::trunc);		if(!fout.is_open())return 0;		fout.close();		DeleteFile(fileName.c_str());		return 1;	}	std::ifstream file;	file.open(fileName.c_str(), std::ios::binary);	if(!file.is_open())	{		plugEngine->kernel->log->prnEx(LT_ERROR, "FSArchiveXPAK", "Couldn't open archive '%s'.", fileName.c_str());		return 0;	}	file.seekg(0,std::ios::beg);	file.read((c8*)&pakHeader, sizeof(XPAK_HEADER));	if(memcmp(pakHeader.signature, "XPAK", 4) != 0)	{		plugEngine->kernel->log->prnEx(LT_ERROR, "FSArchiveXPAK", "Wrong signature of archive XPAK '%s'.", fileName.c_str());		return 0;	}	if(pakHeader.version != XPAK_VERSION)	{		plugEngine->kernel->log->prnEx(LT_ERROR, "FSArchiveXPAK", "Wrong version of archive XPAK '%s'.", fileName.c_str());		return 0;	}	if(pakHeader.dirLength%sizeof(XPAK_FILE) != 0)	{		plugEngine->kernel->log->prnEx(LT_ERROR, "FSArchiveXPAK", "Wrong length of directory in archive XPAK '%s'.", fileName.c_str());		return 0;	}		           	file.seekg(pakHeader.dirOffset,std::ios::beg);		           			u32 count = pakHeader.dirLength/sizeof(XPAK_FILE);	u32 TotalDataSize = pakHeader.dirOffset - sizeof(XPAK_HEADER);	for(u32 i = 0; i < count; i++)	{						file.read((c8*)&pakFile, sizeof(XPAK_FILE));		prepFileName(pakFile.fileName);		fileEntry.fileName = pakFile.fileName;		fileEntry.packedFileName = pakFile.fileName;		fileEntry.offset = pakFile.position;		fileEntry.size = pakFile.size;		fileEntry.uncompSize = pakFile.uncompSize;		fileEntry.compType = pakFile.compType;		fileEntry.mdate = pakFile.mdate;		fileEntry.canLoad = 1;		files.insert(std::make_pair(pakFile.fileName, fileEntry));		plugEngine->kernel->log->prnEx(LT_INFO, "FSArchiveXPAK", "Archive '%s' contains file '%s',  compressed: %u bytes, uncompressed: %u, method: %s ", fileName.c_str(), pakFile.fileName, pakFile.size, pakFile.uncompSize, Compression::getName(pakFile.compType));	}   		file.close();	plugEngine->kernel->log->prnEx(LT_SUCCESS, "FSArchiveXPAK", "Added archive XPAK '%s' (%u files, %u bytes).", fileName.c_str(), count, TotalDataSize);	return 1;}
开发者ID:adasm,项目名称:xgine,代码行数:79,


示例19: Init

int Init(RecorderProperties *ws, wstring name) {	ws->pLoc = NULL;	ws->pSvc = NULL;	ws->treminateFlag = false;	//recoder logs initialisation	ws->parameters.name = name;	wstring preLog = AppPath() + L"//SDRpreinit_" + name + L"rec.log";	OpenFileStream(ws->logStream, preLog);	SetDefaultLog(ws->logStream);	pugi::xml_document config;	if (int initConfigResult = InitConfig(config) != status_ok) {		return initConfigResult;	}	wstring recorderXpath = L"/sdr/recording/recorders/sdrd[@name='"			+ ws->parameters.name + L"']";	pugi::xml_node recorderConfigNode = config.select_single_node(			recorderXpath.data()).node();	if ((ws->parameters.interval =			recorderConfigNode.attribute(L"interval").as_int()) == 0			&& ws->parameters.interval <= 1) {		ws->parameters.interval = 60;	}	if ((ws->parameters.countTotal =			recorderConfigNode.attribute(L"count").as_int()) == 0			&& ws->parameters.countTotal < -1) {		ws->parameters.countTotal = -1;	}	//for archive testing	if ((ws->parameters.archiveInterval = recorderConfigNode.attribute(			L"archiveat").as_int()) == 0)		ws->parameters.archiveInterval = -1;	wstring apppath = AppPath();	ws->parameters.rawCurrentPath =			apppath					+ config.select_single_node(L"/sdr/recording/logs/current").node().attribute(							L"path").as_string();	if (ws->parameters.rawCurrentPath.empty()) {		WriteFileLogf(L"Failed to init configuration, code here:");		return status_config_file_not_found;	}	ws->parameters.logDailyPath =			apppath					+ config.select_single_node(L"/sdr/recording/logs/daily").node().attribute(							L"path").as_string();	if (ws->parameters.logDailyPath.empty()) {		WriteFileLogf(L"Failed to init configuration, code here:");		return status_config_file_not_found;	}	ws->sysLogPath = ws->parameters.rawCurrentPath + ws->parameters.name			+ L"rec.log";	//ws->parameters.rawCurrentFile = ws->parameters.rawCurrentPath;	ws->parameters.rawCurrentFile += ws->parameters.name + L"rec.sdrd";	OpenFileStream(ws->rawStream,			ws->parameters.rawCurrentPath + ws->parameters.rawCurrentFile);	CloseFileStream(ws->logStream);	DeleteFile(preLog.data());	OpenFileStream(ws->logStream, ws->sysLogPath);	SetDefaultLog(ws->logStream);	WriteFileLogf(L"Starting recorder " + ws->parameters.name + L"rec.");	return status_ok;}
开发者ID:systemdatarecorder,项目名称:recording,代码行数:76,


示例20: replace

/*makes the replace*/INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore){	TCHAR d[MAX_PATH];	TCHAR s[MAX_PATH];	HANDLE hFileSrc, hFileDest;	DWORD  dwAttrib, dwRead, dwWritten;	LPBYTE buffer;	BOOL   bEof = FALSE;	FILETIME srcCreationTime, destCreationTime, srcLastAccessTime, destLastAccessTime;	FILETIME srcLastWriteTime, destLastWriteTime;	GetPathCase(source, s);	GetPathCase(dest, d);	s[0] = (TCHAR)_totupper(s[0]);	d[0] = (TCHAR)_totupper(d[0]);// 	ConOutPrintf(_T("old-src:  %s/n"), s);// 	ConOutPrintf(_T("old-dest: %s/n"), d);// 	ConOutPrintf(_T("src:  %s/n"), source);// 	ConOutPrintf(_T("dest: %s/n"), dest);	/* Open up the sourcefile */	hFileSrc = CreateFile (source, GENERIC_READ, FILE_SHARE_READ,NULL, OPEN_EXISTING, 0, NULL);	if (hFileSrc == INVALID_HANDLE_VALUE)	{		ConOutResPrintf(STRING_COPY_ERROR1, source);		return 0;	}	/* Get the time from source file to be used in the comparison with	   dest time if update switch is set */	GetFileTime (hFileSrc, &srcCreationTime, &srcLastAccessTime, &srcLastWriteTime);	/* Retrieve the source attributes so that they later on can be	   inserted in to the destination */	dwAttrib = GetFileAttributes (source);	if(IsExistingFile (dest))	{		/* Resets the attributes to avoid probles with read only files,		   checks for read only has been made earlier */		SetFileAttributes(dest,FILE_ATTRIBUTE_NORMAL);		/* Is the update flas set? The time has to be controled so that		   only older files are replaced */		if(dwFlags & REPLACE_UPDATE)		{			/* Read destination time */			hFileDest = CreateFile(dest, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,				0, NULL);			if (hFileSrc == INVALID_HANDLE_VALUE)			{				ConOutResPrintf(STRING_COPY_ERROR1, dest);				return 0;			}			/* Compare time */			GetFileTime (hFileDest, &destCreationTime, &destLastAccessTime, &destLastWriteTime);			if(!((srcLastWriteTime.dwHighDateTime > destLastWriteTime.dwHighDateTime) ||					(	srcLastWriteTime.dwHighDateTime == destLastWriteTime.dwHighDateTime &&						srcLastWriteTime.dwLowDateTime > destLastWriteTime.dwLowDateTime)))			{				CloseHandle (hFileSrc);				CloseHandle (hFileDest);				return 0;			}			CloseHandle (hFileDest);		}		/* Delete the old file */		DeleteFile (dest);	}	/* Check confirm flag, and take appropriate action */	if(dwFlags & REPLACE_CONFIRM)	{		/* Output depending on add flag */		if(dwFlags & REPLACE_ADD)			ConOutResPrintf(STRING_REPLACE_HELP9, dest);		else			ConOutResPrintf(STRING_REPLACE_HELP10, dest);		if( !FilePromptYNA (0))			return 0;	}	/* Output depending on add flag */	if(dwFlags & REPLACE_ADD)		ConOutResPrintf(STRING_REPLACE_HELP11, dest);	else		ConOutResPrintf(STRING_REPLACE_HELP5, dest);	/* Make sure source and destination is not the same */	if(!_tcscmp(s, d))	{		ConOutResPaging(TRUE, STRING_REPLACE_ERROR7);		CloseHandle (hFileSrc);		*doMore = FALSE;		return 0;	}	/* Open destination file to write to */	hFileDest = CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);//.........这里部分代码省略.........
开发者ID:farp90,项目名称:nativecmd,代码行数:101,


示例21: close

void qtDLGAssembler::InsertNewInstructions(){	if(lineEdit->text().length() <= 0)	{		close();		return;	}	QMap<quint64,DisAsDataRow>::const_iterator i = m_pCurrentDisassembler->SectionDisAs.constFind(m_instructionOffset);	if(i == m_pCurrentDisassembler->SectionDisAs.constEnd()) 	{		close();		return;	}	QString oldOpcodes = i.value().OpCodes;	DWORD oldOpcodeLen = oldOpcodes.replace(" ", "").length() / 2,		newOpcodeLen = NULL;			QFile tempOutput("nanomite.asm");	tempOutput.open(QIODevice::WriteOnly | QIODevice::Text);	QTextStream out(&tempOutput);	if(m_is64Bit)		out << "BITS 64/n";	else		out << "BITS 32/n";	out << "org 0x" << hex << i.value().Offset << "/r/n";	out << lineEdit->text();	tempOutput.close();	QProcess nasm;	nasm.setReadChannel(QProcess::StandardOutput);    nasm.setProcessChannelMode(QProcess::MergedChannels);    nasm.start("nasm.exe -o nanomite.bin nanomite.asm");    if (!nasm.waitForStarted())	{		QMessageBox::critical(this, "Nanomite", "Unable to launch assembler!", QMessageBox::Ok, QMessageBox::Ok);		close();		return;	}	while(nasm.state() != QProcess::NotRunning)	{        nasm.waitForReadyRead();		QString errorMessage = nasm.readAll();		if(errorMessage.contains("nanomite.asm:3:"))		{			errorMessage.replace("nanomite.asm:3:","");			QMessageBox::critical(this, "Nanomite", errorMessage, QMessageBox::Ok, QMessageBox::Ok);			lineEdit->clear();			return;		}    }	DeleteFile(L"nanomite.asm");	HANDLE hFile = CreateFileW(L"nanomite.bin",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL);	if(hFile == INVALID_HANDLE_VALUE)	{		lineEdit->clear();		return;	}	int iLen = GetFileSize(hFile,NULL);	LPVOID pFileBuffer = clsMemManager::CAlloc(iLen);	DWORD BytesRead = NULL;		if(!ReadFile(hFile,pFileBuffer,iLen,&BytesRead,NULL))	{		CloseHandle(hFile);		DeleteFile(L"nanomite.bin");		clsMemManager::CFree(pFileBuffer);		QMessageBox::critical(this,"Nanomite","no valid opcodes found!",QMessageBox::Ok,QMessageBox::Ok);		lineEdit->clear();		return;	}	CloseHandle(hFile);	DeleteFile(L"nanomite.bin");	if(BytesRead <= 0)	{		clsMemManager::CFree(pFileBuffer);		QMessageBox::critical(this,"Nanomite","no valid opcodes found!",QMessageBox::Ok,QMessageBox::Ok);		lineEdit->clear();		return;	}	if(oldOpcodeLen >= BytesRead)		newOpcodeLen = oldOpcodeLen;	else if(oldOpcodeLen < BytesRead)	{		newOpcodeLen = oldOpcodeLen;		while(newOpcodeLen < BytesRead)		{			++i;			if(i == m_pCurrentDisassembler->SectionDisAs.constEnd()) return;			oldOpcodes = i.value().OpCodes;			newOpcodeLen += oldOpcodes.replace(" ", "").length() / 2;//.........这里部分代码省略.........
开发者ID:SamirMahmudzade,项目名称:Nanomite,代码行数:101,


示例22: MAPISendMail

//.........这里部分代码省略.........	for(int i = 0; i < lpMessage->nFileCount; i++)	{		// Get name of attachment		const char* fpath = lpMessage->lpFiles[i].lpszPathName;		const char* fname = lpMessage->lpFiles[i].lpszFileName;				if (!fname || !*fname || strrchr(fname, '//'))		{			fname = strrchr(fpath, '//');			if (fname) fname++;		}				// Must duplicate this attachment into Temp		char temp_path[MAX_PATH];		char temp_path_[MAX_PATH];		char temp_dir[MAX_PATH];		if (GetTempPath(MAX_PATH, temp_dir))		{ 			strcpy(temp_path, temp_dir); 			strcpy(temp_path_, temp_dir); 			strcat(temp_path_, "_"); 			strcat(temp_path, fname); 			strcat(temp_path_, fname); 		} 		else 		{#ifdef DEBUG_BOX			DWORD err = GetLastError();			char temp_err[1024];			snprintf(temp_err, 1024, "No temp directory, errno = %ld", err);			MessageBox(NULL, temp_err, NULL, MB_OK);#endif 			// Fail if no temp directory			return MAPI_E_FAILURE; 		} 		// If source file is in TEMP then we must copy it 		if (!strncmp(temp_dir, fpath, strlen(temp_dir))) 		{	 		// Do copy to standard name	 		if (!CopyFile(fpath, temp_path_, true))	 		{	 			DWORD last_err = GetLastError();#ifdef DEBUG_BOX 				char temp_err[1024]; 				snprintf(temp_err, 1024, "Orig. file: /"%s/"  Temp. file: /"%s/"  errno = %ld", fpath, temp_path_, last_err);				MessageBox(NULL, temp_err, NULL, MB_OK);#endif 				if (last_err == ERROR_FILE_EXISTS) 				{					DeleteFile(temp_path_);		 			if (!CopyFile(fpath, temp_path_, true))		 			{#ifdef DEBUG_BOX		 				DWORD err = GetLastError();		 				char temp_err[1024];		 				snprintf(temp_err, 1024, "Unable to copy to temp directory after removal, errno = %ld", err);						MessageBox(NULL, temp_err, NULL, MB_OK);#endif	 	 				return MAPI_E_FAILURE;	 	 			}	 			}	 			else	 			{ 	 				return MAPI_E_FAILURE; 	 			}	 		}			strcpy(temp_path, temp_path_);		}		else			strcpy(temp_path, fpath); 		// Encode attachment name and add to URL		char* encoded = EncodeURL(temp_path);		out << (q_mark ? "?" : "&") << "x-mulberry-file=" << (encoded ? encoded : temp_path);		q_mark = false;		if (encoded)			free(encoded);	}	// NULL terminate the string	out << ends;#ifdef DEBUG_BOX	MessageBox(NULL, out.str(), NULL, MB_OK);	out.freeze(false);#endif	// Now do Shell open of mailto URL	char dir[MAX_PATH];	if (GetCurrentDirectory(MAX_PATH, dir))	{		ShellExecute((HWND) ulUIParam, "open", out.str(), 0L, dir, 0);		out.freeze(false);	}	return SUCCESS_SUCCESS;}
开发者ID:GrooveDeluxe,项目名称:mulberry-main,代码行数:101,


示例23: EncodeTrack

//.........这里部分代码省略.........        Comma(MP3BytesWritten, NumWritten, sizeof(NumWritten));        Comma(MP3BytesWritten / 1024, NumWrittenKB, sizeof(NumWrittenKB));        SetLabel(H->WT, "Encoding track %u of %u and sector %u of %u/nTo %s/nWritten %s bytes (%s KB) to file", Index + 1, *TrackCount, SectorCurrent, SectorTotal - 1, MP3FilePathFancy, NumWritten, NumWrittenKB);        if(DeviceIoControl(CDHandle, IOCTL_CDROM_RAW_READ, &Info, sizeof(Info), CDBuffer, SECTORS_AT_READ*RAW_SECTOR_SIZE, &CDBytesWritten, NULL) != 0)        {          if(EncodeAudioBuffer(CDBuffer, CDBytesWritten, dwWAVBufferSize, MP3FileHandle, MP3Buffer, GFP) == FALSE)          {            Log(LOG_WRITE, "Encoding of audio buffer failed");            Success = FALSE;            break;          }        }        else        {          DWORD ErrorCode = GetLastError();          if(ErrorCode == ERROR_INVALID_FUNCTION)          {            Log(LOG_WRITE, "Track %u is not a valid CDDA track", Index + 1);            Success = FALSE;            break;          }          else if(ErrorCode != ERROR_INVALID_PARAMETER)          {            Log(LOG_WRITE, "Error code %u reading track %u!", ErrorCode, Index + 1);            Success = FALSE;            break;          }        }        SendMessage(H->PO, PBM_SETPOS, SectorCurrent, 0);        SendMessage(H->PA, PBM_SETPOS, *DiscCurrent, 0);        Percentage = (float)((float)*DiscCurrent / (float)*DiscTotal) * 100;      }      if(Success == FALSE)      {        *DiscTotal -= SectorTotal;        SectorTotal = 0;      }      else if(OneTrackOnly == 0 || Index+1 == *TrackCount)      {        nOutputSamples = lame_encode_flush_nogap(GFP, MP3Buffer, LAME_MAXMP3BUFFER);        if(nOutputSamples > 0)        {          if(WriteFile(MP3FileHandle, MP3Buffer, nOutputSamples, &MP3BytesWritten, NULL) == FALSE)          {            Log(LOG_WRITE, "Failed to write %u final bytes to file", nOutputSamples);            Success = FALSE;          }          else if(nOutputSamples != (int)MP3BytesWritten)          {            Log(LOG_WRITE, "Written %u final bytes instead of %u bytes to file", MP3BytesWritten, nOutputSamples);            Success = FALSE;          }        }        else if(nOutputSamples < 0)        {          Log(LOG_WRITE, "Error code %d flushing encoded audio buffer", nOutputSamples);          Success = FALSE;        }      }      *DiscCurrent = DiscLastCurrent + SectorTotal;      SendMessage(H->PO, PBM_SETPOS, *DiscCurrent, 0);    }    else    {      Log(LOG_WRITE, "Error code %d initialising audio encoder", EncoderReturnCode);      Success = FALSE;    }    MP3BytesWritten = SetFilePointer(MP3FileHandle, 0, NULL, FILE_CURRENT);    if(CloseHandle(MP3FileHandle) == FALSE)    {      Log(LOG_WRITE, "Error code %u closing file handle");      Success = FALSE;    }    if(OneTrackOnly == 0 && (MP3BytesWritten == 0 || Success == FALSE))    {      if(DeleteFile(MP3FilePath) == FALSE)        Log(LOG_WRITE, "Error code %u deleting file");      else        Log(LOG_WRITE, "Deleted the file due to error");    }    else Log(LOG_WRITE, "Written %u bytes to file", MP3BytesWritten);  }  else  {    Log(LOG_WRITE, "Error code %u creating %s", GetLastError(), MP3FilePath);    Success = FALSE;  }  if(EncoderReturnCode == 0 && (OneTrackOnly == 0 || Index+1 == *TrackCount))  {    lame_close(GFP);    GFP = NULL;  }  return Success;}
开发者ID:msdsgn,项目名称:mcdr,代码行数:101,


示例24: CChtTool86

//.........这里部分代码省略.........		goto end;	}	fLen=(DWORD)fp1.GetLength();	fBuff = new BYTE[fLen];	fp1.Read(fBuff,fLen);	fp1.Close();	if (!fp2.Open(TEXT("fw.bin"),CFile::modeCreate|CFile::modeReadWrite))	{		delete fBuff;		_tcscpy(szErrMsg,TEXT("打开BIOS文件失败!"));		goto end;	}	fp2.Write(fBuff,fLen);	fp2.Close();	delete fBuff;	if (nLock == 0)	{		cmd="cmd.exe /c fptw.exe -f fw.bin";	}	else	{		cmd="cmd.exe /c fptw.exe -f fw.bin -bios";	}	Sleep(2000);	SetDlgItemText(IDC_STATUS,TEXT("正在刷写BIOS......"));	sa.bInheritHandle=0;	si.wShowWindow=SW_SHOW;	retval=CreateProcessA(NULL,(LPSTR)(LPCSTR)cmd,&sa,&sa,0,0,NULL,NULL,&si,&pi);	WaitForSingleObject(pi.hThread,INFINITE);	GetExitCodeProcess(pi.hProcess,&retCode1);	CloseHandle(pi.hThread);	CloseHandle(pi.hProcess);	DeleteFile(TEXT("fw.bin"));	if (retCode1 == 0)	{		SetDlgItemText(IDC_STATUS,TEXT("升级完成!"));		Sleep(1000);	}	else	{		SetDlgItemText(IDC_STATUS,TEXT("升级失败!"));		_tcscpy(szErrMsg,TEXT("BIOS升级失败!"));		goto end;	}	si.wShowWindow=SW_HIDE;	if (1)	{		CBiosInfo* pInfo = ((CHWToolApp*)AfxGetApp())->m_BiosInfo;		strcpy(buff,"cmd.exe /c amidewin.exe /su /"");		if (strncmp(pInfo->m_BiosInfoA.m_szSU,"00020003000400050006000700080009",32) == 0)		{			GUID guid;			CoCreateGuid(&guid);			memset(pInfo->m_BiosInfoA.m_szSU,0,sizeof(pInfo->m_BiosInfoA.m_szSU));			sprintf(pInfo->m_BiosInfoA.m_szSU,"%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X",guid.Data1,guid.Data2,guid.Data3,guid.Data4[0],guid.Data4[1],guid.Data4[2],guid.Data4[3],guid.Data4[4],guid.Data4[5],guid.Data4[6],guid.Data4[7]);			mbstowcs(pInfo->m_BiosInfoW.m_wszSU,pInfo->m_BiosInfoA.m_szSU,64);			pParent->m_pDlg[1]->SetDlgItemText(IDC_UUID,pInfo->m_BiosInfoW.m_wszSU);		}		if (strlen(pInfo->m_BiosInfoA.m_szSU))		{			strcat(buff,pInfo->m_BiosInfoA.m_szSU);			strcat(buff,"/"");			retval=CreateProcessA(NULL,buff,&sa,&sa,0,0,NULL,NULL,&si,&pi);
开发者ID:xiwucheng,项目名称:HWTool,代码行数:67,


示例25: DeleteFile

void CDCAntivirusAlertDlg::OnDel(){	DeleteFile(m_sFilePath);	CDialog::OnOK();}
开发者ID:DjPasco,项目名称:Mag,代码行数:5,


示例26: tgz_extract

//.........这里部分代码省略.........                      else                        goto ERR_OPENING;                      /* compare date+times, is one in tarball newer? */                      if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime)))                      {                        outfile = CreateFile(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);                        if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING;                        szMsg = szSUCMsg;                      }	                }	              }	              else /* in overwrite mode or failed for some other error than exists */	              {                    ERR_OPENING:	                PrintMessage(_T("%s%s [%d]"), szERRMsg, fname, GetLastError());	                cm_cleanup(cm);	                return -2;	              }	            } 	            /* Inform user of current extraction action (writing, skipping file XYZ) */	            PrintMessage(_T("%s%s"), szMsg, fname);				}	          }	      }	      else	          outfile = INVALID_HANDLE_VALUE;	      /*	       * could have no contents, in which case we close the file and set the times	       */	      if (remaining > 0)	          getheader = 0;		  else	      {	          setTimeAndCloseFile:	          getheader = 1;	          if (outfile != INVALID_HANDLE_VALUE)	          {	              FILETIME ftm; 	              cnv_tar2win_time(tartime, &ftm);	              SetFileTime(outfile,&ftm,NULL,&ftm);	              CloseHandle(outfile);	              outfile = INVALID_HANDLE_VALUE;	          }		  }	      break;		case GNUTYPE_LONGLINK:		case GNUTYPE_LONGNAME:		{	      remaining = getoct(buffer.header.size,12);	      if (readBlock(cm, fname) < 0) return -1;	      fname[BLOCKSIZE-1] = '/0';	      if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining))	      {	          PrintMessage(_T("tgz_extract: invalid long name"));	          cm_cleanup(cm);	          return -1;	      }	      getheader = 2;	      break;		}        default:/*	      if (action == TGZ_LIST)	          printf(" %s     <---> %s/n",strtime(&tartime),fname);*/	      break;      }    }    else  /* (getheader == 0) */    {      unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;	  unsigned long bwritten;      if (outfile != INVALID_HANDLE_VALUE)      {          WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL);		  if (bwritten != bytes)          {			  PrintMessage(_T("Error: write failed for %s"), fname);              CloseHandle(outfile);              DeleteFile(fname);              cm_cleanup(cm);              return -2;          }      }      remaining -= bytes;      if (remaining == 0) goto setTimeAndCloseFile;    }  } /* while(1) */    cm_cleanup(cm);  return 0;}
开发者ID:mwiebe,项目名称:nsis-untgz,代码行数:101,


示例27: SetInformationDirectory

void SetInformationDirectory(){	strcpy(InformationDirectory,"d://");	DeleteFile("d://log.inv");}
开发者ID:hansongjing,项目名称:Old-Projects,代码行数:5,


示例28: __declspec

//.........这里部分代码省略.........                if (translation_version == 2) {                  char *rtext=remain==1?szSecond:szSeconds;;                  if (remain >= 60)                  {                    remain/=60;                    rtext=remain==1?szMinute:szMinutes;                    if (remain >= 60)                    {                      remain/=60;                      rtext=remain==1?szHour:szHours;                    }                  }                  char sofar_str[128];                  char cl_str[128];                  myitoa64(sofar/1024, sofar_str);                  myitoa64(cl/1024, cl_str);                  wsprintf (buf,                        szProgress, //%skB (%d%%) of %skB @ %u.%01ukB/s                        sofar_str,                        MulDiv64(100, sofar, cl),                        cl_str,                        bps/1024,((bps*10)/1024)%10                        );                  if (remain) wsprintf(buf+lstrlen(buf),rtext,                        remain                        );                } else if (translation_version == 1) {                  char *rtext=szSecond;                  if (remain >= 60)                  {                    remain/=60;                    rtext=szMinute;                    if (remain >= 60)                    {                      remain/=60;                      rtext=szHour;                    }                  }                  wsprintf (buf,                        szProgress, //%dkB (%d%%) of %dkB @ %d.%01dkB/s                        int(sofar/1024),                        MulDiv64(100, sofar, cl),                        int(cl/1024),                        bps/1024,((bps*10)/1024)%10                        );                  if (remain) wsprintf(buf+lstrlen(buf),szRemaining,                        remain,                        rtext,                        remain==1?"":szPlural                        );                }                progress_callback(buf, sofar);              } else {                if (sofar < cl)                  error = "Server aborted.";              }            }            if (GetTickCount() > last_recv_time+timeout_ms)            {              if (sofar != cl)              {                error = "Downloading timed out.";              }              else              {                // workaround for bug #1713562                //   buggy servers that wait for the client to close the connection.                //   another solution would be manually stopping when cl == sofar,                //   but then buggy servers that return wrong content-length will fail.                bSuccess = TRUE;                error = "success";              }            }            else if (!data_downloaded)              Sleep(10);          } else {            error = "Bad response status.";          }        }      }      // Clean up the connection then release winsock      if (get) delete get;      WSACleanup();    }    CloseHandle(hFile);  }  if (g_cancelled || !bSuccess) {    DeleteFile(filename);  }  pushstring(error);}
开发者ID:kichik,项目名称:nsis-1,代码行数:101,



注:本文中的DeleteFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DeleteFileA函数代码示例
C++ DeleteEnhMetaFile函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。