1 
2 #include <e32cmn.h>
3 #include <e32std.h>
4 #include <f32file.h>
5 #include <aknutils.h>
6 #include <stdlib.h>
7 #include <string.h>
8 
9 extern "C" {
10 
GC_get_main_symbian_stack_base()11 int GC_get_main_symbian_stack_base()
12 {
13     TThreadStackInfo aInfo;
14     TInt err = RThread().StackInfo(aInfo);
15     if ( !err )
16         {
17         return aInfo.iBase;
18         }
19     else
20         {
21         return 0;
22         }
23 }
24 
GC_get_private_path_and_zero_file()25 char* GC_get_private_path_and_zero_file()
26 {
27     // always on c: drive
28     RFs fs;
29     fs.Connect();
30     fs.CreatePrivatePath( EDriveC );
31     TFileName path;
32     fs.PrivatePath( path );
33     fs.Close();
34     _LIT( KCDrive, "c:" );
35     path.Insert( 0, KCDrive );
36 
37 
38     //convert to char*, assume ascii
39     TBuf8<KMaxFileName> path8;
40     path8.Copy( path );
41     _LIT8( KZero8, "zero" );
42     path8.Append( KZero8 );
43 
44     size_t size = path8.Length() + 1;
45     char* copyChar = (char*) malloc( size );
46     if (copyChar)
47         memcpy( copyChar, path8.PtrZ(), size );
48 
49     return copyChar; // ownership passed
50 }
51 
52 } /* extern "C" */
53