2 static char RCSId[] = "$Id: user.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
10 #include "sysmetrics.h"
17 #include "prototypes.h"
22 #define USER_HEAP_SIZE 0x10000
24 LPSTR USER_Heap
= NULL
;
25 WORD USER_HeapSel
= 0;
28 /***********************************************************************
29 * GetFreeSystemResources (USER.284)
31 WORD
GetFreeSystemResources( WORD resType
)
37 case GFSR_USERRESOURCES
:
38 user
= GetHeapSpaces( USER_HeapSel
);
42 case GFSR_GDIRESOURCES
:
43 gdi
= GetHeapSpaces( GDI_HeapSel
);
47 case GFSR_SYSTEMRESOURCES
:
48 user
= GetHeapSpaces( USER_HeapSel
);
49 gdi
= GetHeapSpaces( GDI_HeapSel
);
55 if (user
> gdi
) return LOWORD(gdi
) * 100 / HIWORD(gdi
);
56 else return LOWORD(user
) * 100 / HIWORD(user
);
60 /***********************************************************************
61 * SystemHeapInfo (TOOLHELP.71)
63 BOOL
SystemHeapInfo( SYSHEAPINFO
*pHeapInfo
)
65 pHeapInfo
->wUserFreePercent
= GetFreeSystemResources( GFSR_USERRESOURCES
);
66 pHeapInfo
->wGDIFreePercent
= GetFreeSystemResources( GFSR_GDIRESOURCES
);
67 pHeapInfo
->hUserSegment
= USER_HeapSel
;
68 pHeapInfo
->hGDISegment
= GDI_HeapSel
;
74 /***********************************************************************
77 static BOOL
USER_HeapInit(void)
79 if (!(USER_HeapSel
= GlobalAlloc(GMEM_FIXED
,USER_HEAP_SIZE
))) return FALSE
;
80 USER_Heap
= GlobalLock( USER_HeapSel
);
81 LocalInit( USER_HeapSel
, 0, USER_HEAP_SIZE
-1 );
86 /**********************************************************************
89 * Load necessary resources?
92 USER_InitApp(int hInstance
)
99 /* Create USER heap */
100 if (!USER_HeapInit()) return 0;
103 /* Global atom table initialisation */
104 if (!ATOM_Init()) return 0;
106 /* GDI initialisation */
107 if (!GDI_Init()) return 0;
109 /* Initialize system colors and metrics*/
113 /* Create the DCEs */
116 /* Initialize built-in window classes */
117 if (!WIDGETS_Init()) return 0;
119 /* Initialize dialog manager */
120 if (!DIALOG_Init()) return 0;
122 /* Initialize menus */
123 if (!MENU_Init()) return 0;
125 /* Create system message queue */
126 queueSize
= GetProfileInt( "windows", "TypeAhead", 120 );
127 if (!MSG_CreateSysMsgQueue( queueSize
)) return 0;
129 /* Create task message queue */
130 queueSize
= GetProfileInt( "windows", "DefaultQueueSize", 8 );
131 if (!SetMessageQueue( queueSize
)) return 0;
133 /* Create desktop window */
134 if (!WIN_CreateDesktopWindow()) return 0;
137 /* Initialize DLLs */
138 InitializeLoadedDLLs(NULL
);