2 static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
15 #include "selectors.h"
22 #include "directory.h"
26 #include "sysmetrics.h"
42 void init_wine_signals(void);
44 HANDLE32 SystemHeap
= 0;
45 HANDLE32 SegptrHeap
= 0;
47 /***********************************************************************
48 * Main initialisation routine
52 extern BOOL
RELAY_Init(void);
56 /* Create the system and SEGPTR heaps */
57 if (!(SystemHeap
= HeapCreate( HEAP_GROWABLE
, 0x10000, 0 ))) return 0;
58 if (!(SegptrHeap
= HeapCreate( HEAP_WINE_SEGPTR
, 0, 0 ))) return 0;
60 /* Load the configuration file */
61 if (!PROFILE_LoadWineIni()) return 0;
63 /* Initialize message spying */
64 if (!SPY_Init()) return 0;
67 /* Create USER and GDI heap */
68 USER_HeapSel
= GlobalAlloc16( GMEM_FIXED
, 0x10000 );
69 LocalInit( USER_HeapSel
, 0, 0xffff );
70 GDI_HeapSel
= GlobalAlloc16( GMEM_FIXED
, GDI_HEAP_SIZE
);
71 LocalInit( GDI_HeapSel
, 0, GDI_HEAP_SIZE
-1 );
73 /* Initialize relay code */
74 if (!RELAY_Init()) return 0;
76 /* Create built-in modules */
77 if (!BUILTIN_Init()) return 0;
80 /* Initialise DOS drives */
81 if (!DRIVE_Init()) return 0;
83 /* Initialise DOS directories */
84 if (!DIR_Init()) return 0;
86 /* Initialize tasks */
87 if (!TASK_Init()) return 0;
89 /* Initialize communications */
93 /* Initialize interrupt vectors */
94 if (!INT_Init()) return 0;
96 /* Initialize DOS memory */
97 if (!DOSMEM_Init()) return 0;
99 /* Initialize signal handling */
102 /* Initialize the DOS memory */
103 if (!INT21_Init()) return 0;
105 /* registry initialisation */
106 SHELL_LoadRegistry();
108 /* Global atom table initialisation */
109 if (!ATOM_Init()) return 0;
111 /* GDI initialisation */
112 if (!GDI_Init()) return 0;
114 /* Initialize system colors and metrics*/
118 /* Create the DCEs */
121 /* Initialize dialog manager */
122 if (!DIALOG_Init()) return 0;
124 /* Initialize menus */
125 if (!MENU_Init()) return 0;
127 /* Initialize Win32 data structures */
128 if (!KERN32_Init()) return 0;
130 /* Create system message queue */
131 queueSize
= GetProfileInt( "windows", "TypeAhead", 120 );
132 if (!QUEUE_CreateSysMsgQueue( queueSize
)) return 0;
134 /* Set double click time */
135 SetDoubleClickTime( GetProfileInt( "windows", "DoubleClickSpeed", 452 ) );
142 /**********************************************************************
145 int _WinMain(int argc
, char **argv
)
150 if (!MAIN_Init()) return 0;
152 for (i
= 1; i
< argc
; i
++)
154 if ((handle
= WinExec( argv
[i
], SW_SHOWNORMAL
)) < 32)
156 fprintf(stderr
, "wine: can't exec '%s': ", argv
[i
]);
159 case 2: fprintf( stderr
, "file not found\n" ); break;
160 case 11: fprintf( stderr
, "invalid exe file\n" ); break;
161 case 21: fprintf( stderr
, "win32 executable\n" ); break;
162 default: fprintf( stderr
, "error=%d\n", handle
); break;
168 if (Options
.debug
) DEBUG_SetBreakpoints( TRUE
); /* Setup breakpoints */
170 Yield(); /* Start the first task */
171 fprintf( stderr
, "WinMain: Should never happen: returned from Yield()\n" );
175 #endif /* #ifndef WINELIB */