summaryrefslogtreecommitdiff
path: root/extra/symbian.cpp
blob: 2ec7afbbd337a1860c97f2aa69ba43595ccaabb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include <e32cmn.h>
#include <e32std.h>
#include <f32file.h>
#include <aknutils.h>
#include <stdlib.h>
#include <string.h>

extern "C" {

int GC_get_main_symbian_stack_base()
{
    TThreadStackInfo aInfo;
    TInt err = RThread().StackInfo(aInfo);
    if ( !err )
        {
        return aInfo.iBase;
        }
    else
        {
        return 0;
        }
}

char* GC_get_private_path_and_zero_file()
{
    // always on c: drive
    RFs fs;
    fs.Connect();
    fs.CreatePrivatePath( EDriveC );
    TFileName path;
    fs.PrivatePath( path );
    fs.Close();
    _LIT( KCDrive, "c:" );
    path.Insert( 0, KCDrive );


    //convert to char*, assume ascii
    TBuf8<KMaxFileName> path8;
    path8.Copy( path );
    _LIT8( KZero8, "zero" );
    path8.Append( KZero8 );

    size_t size = path8.Length() + 1;
    char* copyChar = (char*) malloc( size );
    if (copyChar)
        memcpy( copyChar, path8.PtrZ(), size );

    return copyChar; // ownership passed
}

} /* extern "C" */