×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Question get the filesize of a running .exe

    Hi,

    i try to get the filesize of running .exe applications for a Taskmanager App.

    When i execute:
    User::LeaveIfError(fs.Entry(KFilePath, entry));
    TInt fileSize = entry.iSize;

    i get a "unable to execute file for security reasons" error.
    I guess this error is because the exe is running. Or is it because the files is in /sys/bin/ ??

    I have no AllFiles capability.


    then i tried wiki example to get filesize with RFile

    _LIT(KFileSpec,"C:\\Test.txt");
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    RFile file;
    TInt Err1=file.Open(fs,KFileSpec,EFileRead);
    if(Err1==KErrNone)
    {
    TInt Size;
    file.Size(Size);
    HBufC8* buffer = HBufC8::NewLC(Size);
    TPtr8 ptr= buffer->Des();
    file.Read(ptr);
    file.Close();
    CleanupStack::PopAndDestroy(buffer);
    }
    fs.Close();
    CleanupStack::PopAndDestroy(&fs); // destroy fs
    I dont understand the example?
    where can i define my TInt filesize = ... ??

    would be nice if someone could help here.


    Greets
    Shizzl

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: get the filesize of a running .exe

    Basically the executable is inside protected folders, thus if you would want to get the filesize for them you would need to have AllFiles capability.

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: get the filesize of a running .exe

    really? i thought i only need AllFiles for write, but not for read...

  4. #4
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: get the filesize of a running .exe

    Quote Originally Posted by shizzl View Post
    really? i thought i only need AllFiles for write, but not for read...
    Hello,
    if you haven't found yet, please take a look at:
    http://www.developer.nokia.com/Commu...urity_Concepts
    in particular:
    Concept 3: Data Caging for File Access

    regards
    pg

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: get the filesize of a running .exe

    Quote Originally Posted by shizzl View Post
    really? i thought i only need AllFiles for write, but not for read...
    Basically you need AllFiles for reading, and for writing you actually would need to have TCB.

    All and all, those capabilities are really hard to get, thus would suggest you to re-think the requirement. And maybe you can do the task you are thinking you need these some other way, thus can you explain what is the use case you are trying to achieve ?

  6. #6
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: get the filesize of a running .exe

    thus can you explain what is the use case you are trying to achieve ?
    i want to create a taskmanager app. The taskmanager should display size of running programms...
    So i guess i will have a round at the test house..

    @pavarang, thanks for the link, now it is clear. AllFiles is needed to read data in /sys/

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: get the filesize of a running .exe

    Quote Originally Posted by shizzl View Post
    i want to create a taskmanager app. The taskmanager should display size of running programms...
    So i guess i will have a round at the test house..

    @pavarang, thanks for the link, now it is clear. AllFiles is needed to read data in /sys/
    Basically it would not make too much difference on showing teh filesize, so I would really consider dropping it out. Getting teh capability is not an easy task.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: get the filesize of a running .exe

    Quote Originally Posted by shizzl View Post
    i want to create a taskmanager app. The taskmanager should display size of running programms...
    Hello,
    as Symbianyucca already said, file size isn't such a foundamental info....
    but now you are talking about size of running programs, so maybe you are referring to memory occupation?
    If so, RProcess::GetMemoryInfo could be a better solution:
    http://www.symlab.org/main/documenta...B-4E56AF91534A
    There's an old task manager project, unfortunately for 2nd ed devices, but i think you can grab some nice ideas on how GetMemoryInfo works:
    http://read.pudn.com/downloads32/sou...view.cpp__.htm

    regards
    pg

Similar Threads

  1. png filesize problems
    By g_costanza in forum Symbian
    Replies: 1
    Last Post: 2009-05-29, 16:28
  2. Max filesize for recordstore?
    By Rozik in forum Mobile Java General
    Replies: 7
    Last Post: 2007-05-15, 13:50
  3. 6230 JAR max filesize
    By Wontar in forum Mobile Java General
    Replies: 3
    Last Post: 2007-01-30, 12:31
  4. Decrease Jar filesize
    By ardent1 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-02-14, 01:16
  5. max. filesize
    By slemper in forum Digital Rights Management & Content Downloading
    Replies: 1
    Last Post: 2002-09-13, 06:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×