Esempio n. 1
0
LOCAL_C TInt MakeFileName(TInt aThreadId, TInt aFileNumber, RFs & aFs, TFileName& aName, TBool aMakeDir)
//
// creates a file name and makes all the directory components, if required
//
	{
	
	TFileName path;
	path.Format(KPath, aThreadId);
	
	TChar driveLetter;
	TInt  r;
	r = aFs.DriveToChar(gDriveNumber, driveLetter);
	if (r != KErrNone)
		{
		LogError(r, KDriveToChar, KNullDesC, driveLetter, 0);
		aFs.Close();
		return(r);
		}
		
	path[0] = (TText) driveLetter;
	r = aFs.SetSessionPath(path);
	if (r != KErrNone)
		{
		LogError(r, KSetSessPath, path, 0, 0);
		aFs.Close();
		return(r);
		}
		
	// add additional directories
	TInt fileNumber;
	fileNumber = aFileNumber;
	r = AppendPath(path, fileNumber, 0);
	if(r != KErrNone)
		{
		LogError(r, KAppendPath, path, fileNumber, 0);
		aFs.Close();
		return(r);
		}
		
	if(aMakeDir)
		{
		r = aFs.MkDirAll(path);
		if (r != KErrNone && r != KErrAlreadyExists)
			{
			LogError(r, KMdAll, path, 0, 0);
			aFs.Close();
			return(r);
			}
		}
		
	// and finally add file name
	path.Append(KFilePrefix);
	path.AppendNum(aFileNumber);

	aName = path;
	return(KErrNone);
	}
Esempio n. 2
0
tstring RepoPath::GetTaggedIndexFilePath( int n )
{
    char buf[8] = {0};
    _itoa_s(n, buf, 10);
    std::string index = "index_";
    index += buf;
    tstring windex = utf8_to_16(index.c_str());
    return AppendPath(GetTagsDirPath(), windex);
}
Esempio n. 3
0
FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left,
                                                            float bottom,
                                                            float right,
                                                            float top) {
  CPDF_Path Path;
  Path.AppendRect(left, bottom, right, top);

  auto pNewClipPath = pdfium::MakeUnique<CPDF_ClipPath>();
  pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, false);

  // Caller takes ownership.
  return FPDFClipPathFromCPDFClipPath(pNewClipPath.release());
}
Esempio n. 4
0
LOCAL_C TInt AppendPath(TFileName& aPath, TInt aNumber, TInt aLevel)
//
// helper function for MakeFileName()
//
	{
	
	if(aNumber > KMaxFilesPerDirectory)
		{
		aNumber /= KMaxFilesPerDirectory;
		AppendPath(aPath, aNumber, aLevel + 1);
		}
		
	if(aLevel)
		{	
		aPath.AppendNum(aNumber % KMaxFilesPerDirectory);	
		aPath.Append('\\');	
		}
	
	return(KErrNone);
	}
Esempio n. 5
0
void runCommand(char ** command, int argc, char * path){
   pid_t forkID;
   char * finalPath = NULL;


    if( (forkID = fork()) == 0){
        #if TESTER
        printf("DEBUG::IN CHILD\n");
        #endif
        
    

        /* THIS IS FOR OTHER ARGUMENTS)*/
        char ** pathArgs = NULL;
        int numPathArgs = makePathargs(path, &pathArgs );

        for(int i = 0; i < numPathArgs; i++ ){
            
            AppendPath(&finalPath, *(pathArgs + i), *command);

            #if TESTER
            printf("DEBUG:::: finalPath = %s\n", finalPath);
            #endif
            execv( *(pathArgs + i), command);
            free(finalPath);
        }
            

        execvp(command[0],command);    
        //we want to clean the memory if it doesn't run
        clean(argc, command);
        errorMessage();
        exit(-1);
    
    }

    waitpid(forkID, NULL, 0);
    free(finalPath);
    clean(argc, command);

}
Esempio n. 6
0
//==============================
// BitmapFontLocal::Load
bool BitmapFontLocal::Load( char const * languagePackageName, char const * fontInfoFileName )
{
	OvrApkFile languagePackageFile( ovr_OpenOtherApplicationPackage( languagePackageName ) );
	if ( !FontInfo.Load( languagePackageFile, fontInfoFileName ) )
	{
		return false;
	}

	// strip any path from the image file name path and prepend the path from the .fnt file -- i.e. always
	// require them to be loaded from the same directory.
	String baseName = FontInfo.ImageFileName.GetFilename();
	LOG( "fontInfoFileName = %s", fontInfoFileName );
	LOG( "image baseName = %s", baseName.ToCStr() );
	
	char imagePath[512];
	StripFileName( fontInfoFileName, imagePath, sizeof( imagePath ) );
	LOG( "imagePath = %s", imagePath );
	
	char imageFileName[512];
	StripPath( fontInfoFileName, imageFileName, sizeof( imageFileName ) );
	LOG( "imageFileName = %s", imageFileName );
	
	AppendPath( imagePath, sizeof( imagePath ), baseName.ToCStr() );
	if ( !LoadImage( languagePackageFile, imagePath ) )
	{
		return false;
	}

    // create the shaders for font rendering if not already created
    if ( FontProgram.vertexShader == 0 || FontProgram.fragmentShader == 0 )
    {
        FontProgram = BuildProgram( FontSingleTextureVertexShaderSrc, SDFFontFragmentShaderSrc );//SingleTextureFragmentShaderSrc );
    }

	return true;
}
Esempio n. 7
0
		/*!
		 * \brief
		 * Splits a URL path into its individual directories and resource.
		 * 
		 * \param path
		 * Pointer to the path string to parse.
		 * 
		 * Splits a URL path into its individual directories and resource.
		 */
		void c_url_interface::ParsePath(const char* path)
		{
			m_path.empty();

			AppendPath(path, true);
		}
Esempio n. 8
0
tstring RepoPath::GetManifestFilePath()
{
    return AppendPath(repo_dir_, _T("manifest"));
}
Esempio n. 9
0
tstring RepoPath::GetVersionFilePath()
{
    return AppendPath(repo_dir_, _T("version"));
}
Esempio n. 10
0
tstring RepoPath::GetTagsDirPath()
{
    return AppendPath(repo_dir_, _T("tags\\"));
}
Esempio n. 11
0
tstring RepoPath::GetIndexFilePath()
{
    return AppendPath(repo_dir_, _T("index"));
}
Esempio n. 12
0
void License(int iArgCount, char *apArgument[])
    {
    WORD Error;
    HFILE hDest;
    ULONG ulCount;
    ULONG ulStatus;
    WORD wIndex;
    WORD wArgIndex = 0;
    BOOL bTriedAccess = FALSE;
    WORD wLicenseCount;

    wLicenseCount = (WORD)atoi(abyTemp);
    if (wLicenseCount > 40000)
        {
        printf("\nRequest for %u licenses denied.  The maximum allowed is 40,000.\n\n",wLicenseCount);
        return;
        }

    wIndex = 0;
    while (abyDestPath[wIndex] != 0)
        {
        abyDestPath[wIndex] = (BYTE)toupper(abyDestPath[wIndex]);
        wIndex++;
        }

    AppendPath(&abyDestPath[wDestPathLength],abyConvertFile);
//    DosSetFileMode(abyDestPath,0x0000,0L);
    if ((Error = OpenFile(abyDestPath,&hDest,&wStatus,0L,0,1,0x6192)) != 0)
        {
        printf("Cannot open %s\n to set or read license count. ",abyDestPath);
        bTriedAccess = TRUE;
        }
    DosChgFilePtr(hDest,oFileOffset + oCopyCount,0,&dwFilePosition);
    if (wLicenseCount != 0)
        {
        if ((Error = DosWrite(hDest,&(BYTE)wLicenseCount,2,&wCount)) != 0)
            {
            printf("%sWKC%04X\n",abyLicenseSourceFailed,Error | 0x8000);
            return;
            }
        if (wLicenseCount == 0xaaaa)
            printf("\nCopy protection has been disabled for\n\n%s\n\n",abyDestPath);
        else
            printf("\nThe License Count has been set to %u for\n\n%s\n\n",wLicenseCount,abyDestPath);
        }
    else
        {
        if ((Error = DosRead(hDest,&(BYTE)wLicenseCount,2,&wCount)) != 0)
            {
            printf("%sRKC%04X\n",abyLicenseSourceFailed,Error | 0x8000);
            return;
            }
        if (wLicenseCount == 0xaaaa)
            printf("\nCopy protection is disabled for\n\n%s\n\n",abyDestPath);
        else
            printf("\nThe License Count for\n\n%s = %u\n\n",abyDestPath,wLicenseCount);
        }
    DosClose(hDest);
    if (wLicenseCount == 0xaaaa)
      DosSetFileMode(abyDestPath,0x0020,0L);
    else
      DosSetFileMode(abyDestPath,0x0021,0L);
    }
Esempio n. 13
0
WORD Uninstall(CHAR szSourcePath[],CHAR szDeletePath[])
    {
    HFILE hSource;
    HFILE hDelete;
    ULONG ulCopyKey;
    ULONG ulCount;
    ULONG ulStatus;
    ULONG ulTemp;
    ULONG ulFilePosition;
    ULONG ulPathLength;

    AppendPath(&szSourcePath[strlen(szSourcePath)],szSourceFile);

//    DosSetFileMode(szSourcePath,0x0000,0L);
    if ((ulLastError = DosOpen(szSourcePath,(PHFILE)&hSource,&ulStatus,0L,0,0x01,0x61a2,0L)) != 0)
        return(SOURCE_FILE_OPEN);

    ulPathLength = strlen(szDeletePath);

    AppendPath(&szDeletePath[ulPathLength],szDeviceFile);
    /*
    **  read code key from driver to delete
    if ((wLastError = DosSetFileMode(szDeletePath,0x0000,0L)) != 0)
        return(DEST_FILE_MODE_SET);
    */

    if ((wLastError = DosOpen(szDeletePath,(PHFILE)&hDelete,&ulStatus,0L,0,0x01,0x61a2,0L)) != 0)
        return(DEST_FILE_OPEN);

    DosChgFilePtr(hDelete,oFileOffset + oCopyKey,0,&ulFilePosition);

    if ((wLastError = DosRead(hDelete,(BYTE *)&ulCopyKey,4,&ulCount)) != 0)
        return(DEST_FILE_READ);

    DosClose(hDelete);

    AppendPath(&szDeletePath[ulPathLength],szHiddenFile);

#ifdef this_junk
    if ((wLastError = DosQFileMode(szDeletePath,&ulTemp,0L)) != 0)
        return(HIDE_FILE_MODE_READ);

    if ((ulTemp & 0x0007) != 0x0007)
        return(HIDE_FILE_MODE);

    if ((wLastError = DosSetFileMode(szDeletePath,0x0000,0L)) != 0)
        return(HIDE_FILE_MODE_SET);
#endif
    if ((wLastError = DosOpen(szHiddenPath,(PHFILE)&hDelete,(PUSHORT)&ulStatus,0L,0,0x01,0x61a2,0L)) != 0)
        return(HIDE_FILE_OPEN);

    DosChgFilePtr(hDelete,20,0,&ulFilePosition);

    if ((wLastError = DosRead(hDelete,&(BYTE)stCodeKey.ulCopyKey,4,&ulCount)) != 0)
        return(HIDE_FILE_READ);

    DosClose(hDelete);

    if ((wLastError = DosDelete(szHiddenPath,0L)) != 0)
        return(HIDE_FILE_DELETE);

    AppendPath(&szDeletePath[ulPathLength],szDeviceFile);

    if ((wLastError = DosDelete(szDeletePath,0L)) != 0)
        return(DEST_FILE_DELETE);

    if (ulCopyKey != stCodeKey.ulCopyKey)
        return(BAD_CODE_KEY);
    /*
    ** read copy count from .SRC file, increment it, and write it back
    */
    DosChgFilePtr(hSource,oFileOffset + oCopyCount,0,&ulFilePosition);

    if ((wLastError = DosRead(hSource,&(BYTE)stCodeKey.wCopyCount,2,&ulCount)) != 0)
        return(CAT_SOURCE_READ);

    stCodeKey.wCopyCount++;

    DosChgFilePtr(hSource,oFileOffset + oCopyCount,0,&ulFilePosition);

    if ((wLastError = DosWrite(hSource,&(BYTE)stCodeKey.wCopyCount,2,&ulCount)) != 0)
        return(CAT_SOURCE_WRITE);

    DosClose(hSource);
    if (stCodeKey.wCopyCount > 1)
      {
      sprintf(szMessage,"There are %u %s authorized device\ndriver licenses available for installation.",
                        stCodeKey.wCopyCount,abyDeviceFile);
      MessageBox(hwndClient,szMessage)
      }
Esempio n. 14
0
WORD Install(CHAR szSourcePath[],CHAR szDestPath)
    {
    HFILE hSource;
    HFILE hDestination;
    WORD wCount;
    WORD wStatus;
    WORD wTemp;
    WORD wAttrib;
    WORD wIndex;
    DWORD dwFilePosition;
    WORD wDestPathLength;
    WORD wSourcePathLength;

    DosGetDateTime(&stDateTime);
    stCodeKey.dwCopyKey = (DWORD)stDateTime.hours;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.minutes << 4;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.seconds << 10;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.hundredths << 16;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.day << 23;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.month << 27;
    stCodeKey.dwCopyKey |= (DWORD)stDateTime.year << 31;

    wSourcePathLength = strlen(szSourthPath);
    AppendPath(&szSourcePath[wSourcePathLength)],szSourceFile);
    if (DosSetFileMode(abySourcePath,0x0000,0L));
    if ((wLastError = DosOpen(abySourcePath,(PHFILE)&hSource,(PUSHORT)&wStatus,0L,0,0x01,0x61a2,0L)) != 0)
      return(SOURCE_FILE_OPEN);

    DosChgFilePtr(hSource,oFileOffset + oCopyCount,0,&dwFilePosition);
    if ((wLastError = DosRead(hSource,&(BYTE)wTemp,2,&wCount)) != 0)
      return(SOURCE_FILE_READ);

    if (wTemp == 0)
      return(SOURCE_NO_LICENSE);

    if ((wLastError = DosQFileMode(abyDestPath,&wAttrib,0L)) != 0)
      return(SOURCE_FILE_MODE);

    if ((wAttrib & 0x0010) != 0x0010)
      return(DEST_BAD_PATH);

    wDestPathLength = strlen(szDestPath);
    AppendPath(&szDestPath[wDestPathLength],szDeviceFile);
    if (wLastError = FileCopy(szSourcePath,szDestPath) != 0)
        return(SOURCE_FILE_COPY);

    if ((wLastError = DosOpen(szDestPath,(PHFILE)&hDestination,(PUSHORT)&wStatus,0L,0,1,0x6192,0L)) != 0)
        return(DEST_FILE_OPEN);

    stCodeKey.wCopyCount = 0;
    DosChgFilePtr(hDestination,oFileOffset + oCopyKey,0,&dwFilePosition);
    if ((wLastError = DosWrite(hDestination,&(BYTE)stCodeKey.dwCopyKey,6,&wCount)) != 0)
        return(DEST_WRITE_CODE_KEY);

    DosClose(hDestination);
    DosSetFileMode(abyDestPath,0x0021,0L);
    stCodeKey.wCopyCount = wTemp;

    AppendPath(&abyDestPath[wDestPathLength],abyHiddenFile);
    AppendPath(&abySourcePath[wSourcePathLength],abyHiddenFile);

    if (wLastError = FileCopy(abySourcePath,abyDestPath) != 0)
        {
        DosClose(hSource);
        AppendPath(&abySourcePath[wSourcePathLength],abyDeviceFile);
        DosDelete(abyDestPath,0L);
        return(HIDE_FILE_COPY);
        }

    if ((wLastError = DosOpen(abyDestPath,(PHFILE)&hDestination,(PUSHORT)&wStatus,0L,0,1,0x6192,0L)) != 0)
        {
        DosClose(hSource);
        AppendPath(&abySourcePath[wSourcePathLength],abyDeviceFile);
        DosDelete(abyDestPath,0L);
        return(HIDE_FILE_COPY);
        }

    DosChgFilePtr(hDestination,20,0,&dwFilePosition);
    if ((wLastError = DosWrite(hDestination,(&(BYTE)stCodeKey.dwCopyKey),20,&wCount)) != 0)
        {
        DosClose(hDestination);
        DosClose(hSource);
        AppendPath(&abySourcePath[wSourcePathLength],abyDeviceFile);
        DosDelete(abyDestPath,0L);
        return(HIDE_FILE_WRITE);
        }

    DosClose(hDestination);

    DosSetFileMode(abySourcePath,0x0027,0L);
    DosSetFileMode(abyDestPath,0x0027,0L);

    stCodeKey.wCopyCount--;
    DosChgFilePtr(hSource,oFileOffset + oCopyCount,0,&dwFilePosition);
    if ((wLastError = DosWrite(hSource,&(BYTE)stCodeKey.wCopyCount,2,&wCount)) != 0)
        {
        DosClose(hSource);
        DosSetFileMode(abyDestPath,0x0000,0L);
        DosDelete(abyDestPath,0L);
        return(SOURCE_WRITE_CODE_KEY);
        }
    DosClose(hSource);
    AppendPath(&abyDestPath[wDestPathLength],abyDeviceFile);
    if (FixConfigFile())
        {
        printf("% successfully installed.  You must use UNINST.EXE to move the\n",abyDeviceFile);
        printf("device driver to another machine or directory\n");
        if (stCodeKey.wCopyCount != 0)
            {
            printf("\nThere are %u %s device driver licenses still\n",stCodeKey.wCopyCount,abyDeviceFile);
            printf("available for installation.\n\n");
            }
        }
    }