Symbian3/SDK/Source/GUID-3314123F-205D-5E05-9041-DB9836B7812B.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-3314123F-205D-5E05-9041-DB9836B7812B" xml:lang="en"><title>File
    12 <concept id="GUID-3314123F-205D-5E05-9041-DB9836B7812B" xml:lang="en"><title>File Access Example: Accessing the File System Using P.I.P.S.</title><prolog><metadata><keywords/></metadata></prolog><conbody>
    13 Access Example: Accessing the File System Using P.I.P.S.</title><prolog><metadata><keywords/></metadata></prolog><conbody>
    13 <p>This example application shows, using a P.I.P.S. (P.I.P.S. Is POSIX
    14 <p>This example application shows, using a P.I.P.S. (P.I.P.S. Is POSIX on
    14 on the Symbian platform) program, the restrictions on file access
    15 the Symbian platform) program, the restrictions on file access that are imposed
    15 that are imposed by the Symbian platform Security model. </p>
    16 by the Symbian platform Security model. </p>
    16 <p>It shows that programs can access their own directories, but cannot,
    17 <p>It shows that programs can access their own directories, but
    17 without platform security capabilities not available to ordinary programs,
    18 cannot, without platform security capabilities not available to ordinary programs,
       
    19 access the directories of other programs, or the system binary directory <filepath>sys/bin</filepath>. </p>
    18 access the directories of other programs, or the system binary directory <filepath>sys/bin</filepath>. </p>
    20 <p>This example defines an executable file with no platform security capabilities.
    19 <p>This example defines an executable file with no platform security
    21 The program first creates its own secure directory that it can write to and
    20 capabilities. The program first creates its own secure directory that
    22 read from. It then attempts to use a file in a private directory of another
    21 it can write to and read from. It then attempts to use a file in a
    23 program, and then in <filepath>sys/bin</filepath>, and shows that these attempts
    22 private directory of another program, and then in <filepath>sys/bin</filepath>, and shows that these attempts are denied. </p>
    24 are denied. </p>
    23 <section id="GUID-820F9B58-8877-414B-A18B-B591F6D67158"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-2dae3cca-f112-4219-8f7c-6c48682d1f28.zip" scope="external">FileAccessExample.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-2dae3cca-f112-4219-8f7c-6c48682d1f28.html" scope="peer">browse</xref> to view the example code. </p> </section>
    25 <section id="GUID-820F9B58-8877-414B-A18B-B591F6D67158"><title>Download</title> <p>Click
    24 <section id="GUID-3EAFEC43-CFDA-4E3D-8ACD-E3AAE48BE97D"><title>Description</title> <p>The following sections provide more information about the steps
    26 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-2dae3cca-f112-4219-8f7c-6c48682d1f28.zip" scope="external">FileAccessExample.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-2dae3cca-f112-4219-8f7c-6c48682d1f28.html" scope="peer">browse</xref> to view the example code. </p> </section>
    25 that the example performs. </p> <p><b> Create a secure directory</b> </p> <p>The example creates an empty secure directory for the program
    27 <section id="GUID-3EAFEC43-CFDA-4E3D-8ACD-E3AAE48BE97D"><title>Description</title> <p>The
    26 by using the <xref href="GUID-D034B02C-3B45-3DCC-A7DA-E51227032A87.dita"><apiname>mkdir(const char *,mode_t)</apiname></xref> function. </p> <p>This empty secure directory is created in <filepath>C:\private\E80000C9</filepath>, as 0xE80000C9 is a unique identifier for the program (as specified
    28 following sections provide more information about the steps that the example
    27 by the third UID in its project file). </p></section>
    29 performs. </p> <p><b> Create a secure directory</b> </p> <p>The example creates
    28 <section id="GUID-D9F306FF-D14E-4BCC-BAE6-55804F31CA0D"> <p><b>Write
    30 an empty secure directory for the program by using the <xref href="GUID-5EA72F64-E826-3B15-9468-902BD57F6AA7.dita"><apiname>mkdir()</apiname></xref> function. </p> <p>This
    29 and read a file in the private directory </b> </p> <p>The example
    31 empty secure directory is created in <filepath>C:\private\E80000C9</filepath>,
    30 writes and reads a file in the secure directory using the <xref href="GUID-935A007C-D95C-3EEB-B796-603AF3612A97.dita"><apiname>fopen(const char *, const char *)</apiname></xref> and other file stream
    32 as 0xE80000C9 is a unique identifier for the program (as specified by the
    31 functions. </p> <p><b> Write and read a file in the private directory
    33 third UID in its project file). </p></section>
    32 of another program </b> </p> <p>The example attempts to write and
    34 <section id="GUID-D9F306FF-D14E-4BCC-BAE6-55804F31CA0D"> <p><b>Write and read
    33 read a file in the secure directory of another program. </p> <p>The <xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref> function is expected to return <codeph>NULL</codeph>, indicating that access is not possible, as the program has insufficient
    35 a file in the private directory </b> </p> <p>The example writes and reads
    34 platform security capabilities. </p><p><b> Write and read a file in
    36 a file in the secure directory using the <xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref> and other
    35 the sys/bin directory</b> </p> <p>The example attempts to write and
    37 file stream functions. </p> <p><b> Write and read a file in the private directory
    36 read a file in the system's <filepath>sys/bin</filepath> directory,
    38 of another program </b> </p> <p>The example attempts to write and read a file
    37 where program binaries are stored. </p> <p>Again, the <xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref> function is expected to return <codeph>NULL</codeph>, indicating
    39 in the secure directory of another program. </p> <p>The <xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref> function
    38 that access is not possible, as the program has insufficient platform
    40 is expected to return <codeph>NULL</codeph>, indicating that access is not
    39 security capabilities. </p> </section>
    41 possible, as the program has insufficient platform security capabilities. </p><p><b> Write
    40 <section id="GUID-EB4F71F2-D55D-43C5-B55F-F211D170056F"><title>Related
    42 and read a file in the sys/bin directory</b> </p> <p>The example attempts
    41 APIs</title><p><xref href="GUID-D034B02C-3B45-3DCC-A7DA-E51227032A87.dita"><apiname>mkdir(const char *,mode_t)</apiname></xref></p><p><xref href="GUID-935A007C-D95C-3EEB-B796-603AF3612A97.dita"><apiname>fopen(const char *, const char *)</apiname></xref></p></section>
    43 to write and read a file in the system's <filepath>sys/bin</filepath> directory,
    42 <section id="GUID-81AA0C7F-5D43-4EFB-9DD0-4A8A79922576"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian
    44 where program binaries are stored. </p> <p>Again, the <xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref> function
    43 build process</xref> describes how to build this example application. </p> <p>The example builds an executable called <filepath>fileaccessexample.exe</filepath> in the standard locations. </p> <p>To run the example, start <filepath>fileaccessexample.exe</filepath> from the file system or from your
    45 is expected to return <codeph>NULL</codeph>, indicating that access is not
    44 IDE. After launching the executable, depending on the emulator you
    46 possible, as the program has insufficient platform security capabilities. </p> </section>
    45 are using, you may need to navigate away from the application launcher
    47 <section id="GUID-EB4F71F2-D55D-43C5-B55F-F211D170056F"><title>Related APIs</title><p><xref href="GUID-5EA72F64-E826-3B15-9468-902BD57F6AA7.dita"><apiname>mkdir()</apiname></xref></p><p><xref href="GUID-64886CC6-072F-3542-855A-5D733FC761E8.dita"><apiname>fopen()</apiname></xref></p></section>
    46 or shell screen to view the console. </p> </section>
    48 <section id="GUID-81AA0C7F-5D43-4EFB-9DD0-4A8A79922576"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian build process</xref> describes
       
    49 how to build this example application. </p> <p>The example builds an executable
       
    50 called <filepath>fileaccessexample.exe</filepath> in the standard locations. </p> <p>To
       
    51 run the example, start <filepath>fileaccessexample.exe</filepath> from the
       
    52 file system or from your IDE. After launching the executable, depending on
       
    53 the emulator you are using, you may need to navigate away from the application
       
    54 launcher or shell screen to view the console. </p> </section>
       
    55 </conbody></concept>
    47 </conbody></concept>