summaryrefslogtreecommitdiff
path: root/extra/symbian.cpp
blob: 29a960d83d88477263d1d3d3f4a6607c789e3d6e (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
53
54
55

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

#ifdef __cplusplus
extern "C" {
#endif

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 );
	memcpy( copyChar, path8.PtrZ(), size );
	
	return copyChar; // ownership passed
	}

#ifdef __cplusplus
	}
#endif