Subversion Repositories Kolibri OS

Rev

Rev 4481 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4481 Rev 5107
Line 1... Line 1...
1
#include "kosSyst.h"
1
#include "kosSyst.h"
2
#include 
2
#include 
Line 3... Line 3...
3
 
3
 
Line -... Line 4...
-
 
4
#define atexitBufferSize	32
-
 
5
 
-
 
6
// Autobuild uses FASM method for exe->kos,
-
 
7
// MENUET01 header should be present in EXE.
-
 
8
#ifdef AUTOBUILD
-
 
9
char kosExePath[1024];
-
 
10
char exeStack[16384];
-
 
11
// must be alphabetically first in the image
-
 
12
#pragma data_seg(".1seg")
-
 
13
extern "C" struct
-
 
14
{
-
 
15
	char header[8];
-
 
16
	int headerver;
-
 
17
	void* entry;
-
 
18
	void* i_end;
-
 
19
	void* memsize;
-
 
20
	void* stack;
-
 
21
	void* params;
-
 
22
	void* icon;
-
 
23
} header = {
-
 
24
	{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
-
 
25
	1,
-
 
26
	&crtStartUp,
-
 
27
	0,	// filled by doexe2.asm
-
 
28
	0,	// filled by doexe2.asm
-
 
29
	exeStack + sizeof(exeStack),
-
 
30
	NULL,
-
 
31
	kosExePath
-
 
32
};
-
 
33
#pragma data_seg()
-
 
34
#else
Line 4... Line 35...
4
#define atexitBufferSize	32
35
char *kosExePath = NULL;
Line 5... Line -...
5
 
-
 
6
 
-
 
7
char pureCallMessage[] = "PURE function call!";
36
#endif
8
 
37
 
9
char *kosExePath = NULL;
38
char pureCallMessage[] = "PURE function call!";
10
 
39
 
11
//
40
//
Line 841... Line 870...
841
//
870
//
842
#pragma comment(linker, "/merge:.CRT=.rdata")
871
#pragma comment(linker, "/merge:.CRT=.rdata")
843
//
872
//
844
void crtStartUp()
873
void crtStartUp()
845
{
874
{
-
 
875
#ifdef AUTOBUILD
-
 
876
// linker will try to remove unused variables; force header to be included
-
 
877
	header.header;
-
 
878
#endif
846
	// èíèöèàëèçèðóåì êó÷ó
879
	// èíèöèàëèçèðóåì êó÷ó
847
	__asm
880
	__asm
848
	{
881
	{
849
		mov	eax, 68
882
		mov	eax, 68
850
		mov	ebx, 11
883
		mov	ebx, 11
Line 857... Line 890...
857
		if ( *pbegin != NULL )
890
		if ( *pbegin != NULL )
858
			(**pbegin)();
891
			(**pbegin)();
859
	}
892
	}
860
	// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
893
	// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
861
	rtlSrand( kos_GetSystemClock() );
894
	rtlSrand( kos_GetSystemClock() );
-
 
895
#ifndef AUTOBUILD
862
	// ïóòü ê ôàéëó ïðîöåññà
896
	// ïóòü ê ôàéëó ïðîöåññà
863
	kosExePath = *((char **)0x20);
897
	kosExePath = *((char **)0x20);
-
 
898
#endif
864
	// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
899
	// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
865
	kos_Main();
900
	kos_Main();
866
	// âûõîä
901
	// âûõîä
867
	kos_ExitApp();
902
	kos_ExitApp();
868
}
903
}