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";
13 #include "sysmetrics.h"
24 #define USER_HEAP_SIZE 0x10000
27 LPSTR USER_Heap = NULL;
28 WORD USER_HeapSel = 0;
31 /***********************************************************************
32 * GetFreeSystemResources (USER.284)
34 WORD GetFreeSystemResources( WORD resType )
40 case GFSR_USERRESOURCES:
41 user = GetHeapSpaces( USER_HeapSel );
45 case GFSR_GDIRESOURCES:
46 gdi = GetHeapSpaces( GDI_HeapSel );
50 case GFSR_SYSTEMRESOURCES:
51 user = GetHeapSpaces( USER_HeapSel );
52 gdi = GetHeapSpaces( GDI_HeapSel );
58 if (user > gdi) return LOWORD(gdi) * 100 / HIWORD(gdi);
59 else return LOWORD(user) * 100 / HIWORD(user);
63 /***********************************************************************
64 * SystemHeapInfo (TOOLHELP.71)
66 BOOL SystemHeapInfo( SYSHEAPINFO *pHeapInfo )
68 pHeapInfo->wUserFreePercent = GetFreeSystemResources( GFSR_USERRESOURCES );
69 pHeapInfo->wGDIFreePercent = GetFreeSystemResources( GFSR_GDIRESOURCES );
70 pHeapInfo->hUserSegment = USER_HeapSel;
71 pHeapInfo->hGDISegment = GDI_HeapSel;
76 /***********************************************************************
79 BOOL USER_HeapInit(void)
81 if (!(USER_HeapSel = GlobalAlloc(GMEM_FIXED,USER_HEAP_SIZE))) return FALSE;
82 USER_Heap = GlobalLock( USER_HeapSel );
83 LocalInit( USER_HeapSel, 0, USER_HEAP_SIZE-1 );
89 /**********************************************************************
92 int USER_InitApp(int hInstance)
96 /* Create task message queue */
97 queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 );
98 if (!SetMessageQueue( queueSize )) return 0;