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"
21 #include "directory.h"
25 #include "sysmetrics.h"
43 /* Winelib run-time flag */
50 HANDLE32 SystemHeap
= 0;
51 HANDLE32 SegptrHeap
= 0;
53 /***********************************************************************
54 * Main initialisation routine
58 extern BOOL32
RELAY_Init(void);
59 extern BOOL32
WIN16DRV_Init(void);
60 extern BOOL32
SIGNAL_Init(void);
61 extern BOOL32
WIDGETS_Init(void);
62 extern int KERN32_Init(void);
66 /* Create the system and SEGPTR heaps */
67 if (!(SystemHeap
= HeapCreate( HEAP_GROWABLE
, 0x10000, 0 ))) return 0;
68 if (!(SegptrHeap
= HeapCreate( HEAP_WINE_SEGPTR
, 0, 0 ))) return 0;
70 /* Load the configuration file */
71 if (!PROFILE_LoadWineIni()) return 0;
74 /* Create USER and GDI heap */
75 USER_HeapSel
= GlobalAlloc16( GMEM_FIXED
, 0x10000 );
76 LocalInit( USER_HeapSel
, 0, 0xffff );
77 GDI_HeapSel
= GlobalAlloc16( GMEM_FIXED
, GDI_HEAP_SIZE
);
78 LocalInit( GDI_HeapSel
, 0, GDI_HEAP_SIZE
-1 );
80 /* Initialize relay code */
81 if (!RELAY_Init()) return 0;
83 /* Create built-in modules */
84 if (!BUILTIN_Init()) return 0;
86 /* Initialize interrupt vectors */
87 if (!INT_Init()) return 0;
89 /* Initialize DOS memory */
90 if (!DOSMEM_Init()) return 0;
92 /* Initialize the DOS interrupt */
93 if (!INT21_Init()) return 0;
95 /* Initialize signal handling */
96 if (!SIGNAL_Init()) return 0;
98 /* Create the Win16 printer driver */
99 if (!WIN16DRV_Init()) return 0;
102 /* Initialise DOS drives */
103 if (!DRIVE_Init()) return 0;
105 /* Initialise DOS directories */
106 if (!DIR_Init()) return 0;
108 /* Initialize tasks */
109 if (!TASK_Init()) return 0;
111 /* Initialize communications */
114 /* registry initialisation */
115 SHELL_LoadRegistry();
117 /* Global atom table initialisation */
118 if (!ATOM_Init()) return 0;
120 /* GDI initialisation */
121 if (!GDI_Init()) return 0;
123 /* Initialize system colors and metrics*/
127 /* Create the DCEs */
130 /* Initialize window procedures */
131 if (!WINPROC_Init()) return 0;
133 /* Initialize built-in window classes */
134 if (!WIDGETS_Init()) return 0;
136 /* Initialize dialog manager */
137 if (!DIALOG_Init()) return 0;
139 /* Initialize menus */
140 if (!MENU_Init()) return 0;
142 /* Create desktop window */
143 if (!WIN_CreateDesktopWindow()) return 0;
145 /* Initialize message spying */
146 if (!SPY_Init()) return 0;
148 /* Initialize Win32 data structures */
149 if (!KERN32_Init()) return 0;
151 /* Create system message queue */
152 queueSize
= GetProfileInt32A( "windows", "TypeAhead", 120 );
153 if (!QUEUE_CreateSysMsgQueue( queueSize
)) return 0;
155 /* Set double click time */
156 SetDoubleClickTime( GetProfileInt32A("windows","DoubleClickSpeed",452) );
163 /**********************************************************************
166 int main(int argc
, char *argv
[] )
168 extern BOOL32
MAIN_WineInit( int *argc
, char *argv
[] );
169 extern char * DEBUG_argv0
;
175 * Save this so that the internal debugger can get a hold of it if
178 DEBUG_argv0
= argv
[0];
180 if (!MAIN_WineInit( &argc
, argv
)) return 1;
181 if (!MAIN_Init()) return 1;
183 for (i
= 1; i
< argc
; i
++)
185 if ((handle
= WinExec( argv
[i
], SW_SHOWNORMAL
)) < 32)
187 fprintf(stderr
, "wine: can't exec '%s': ", argv
[i
]);
190 case 2: fprintf( stderr
, "file not found\n" ); break;
191 case 11: fprintf( stderr
, "invalid exe file\n" ); break;
192 case 21: fprintf( stderr
, "win32 executable\n" ); break;
193 default: fprintf( stderr
, "error=%d\n", handle
); break;
199 if (Options
.debug
) DEBUG_SetBreakpoints( TRUE
); /* Setup breakpoints */
201 Yield(); /* Start the first task */
202 fprintf( stderr
, "WinMain: Should never happen: returned from Yield()\n" );
206 #endif /* #ifndef WINELIB */