4 * Copyright 1993 Robert J. Amstadt
15 #define USER_HEAP_SIZE 0x10000
18 LPSTR USER_Heap
= NULL
;
19 WORD USER_HeapSel
= 0;
22 /***********************************************************************
23 * GetFreeSystemResources (USER.284)
25 WORD
GetFreeSystemResources( WORD resType
)
31 case GFSR_USERRESOURCES
:
32 user
= GetHeapSpaces( USER_HeapSel
);
36 case GFSR_GDIRESOURCES
:
37 gdi
= GetHeapSpaces( GDI_HeapSel
);
41 case GFSR_SYSTEMRESOURCES
:
42 user
= GetHeapSpaces( USER_HeapSel
);
43 gdi
= GetHeapSpaces( GDI_HeapSel
);
49 if (user
> gdi
) return LOWORD(gdi
) * 100 / HIWORD(gdi
);
50 else return LOWORD(user
) * 100 / HIWORD(user
);
54 /***********************************************************************
55 * SystemHeapInfo (TOOLHELP.71)
57 BOOL
SystemHeapInfo( SYSHEAPINFO
*pHeapInfo
)
59 pHeapInfo
->wUserFreePercent
= GetFreeSystemResources( GFSR_USERRESOURCES
);
60 pHeapInfo
->wGDIFreePercent
= GetFreeSystemResources( GFSR_GDIRESOURCES
);
61 pHeapInfo
->hUserSegment
= USER_HeapSel
;
62 pHeapInfo
->hGDISegment
= GDI_HeapSel
;
67 /***********************************************************************
70 BOOL
USER_HeapInit(void)
72 if (!(USER_HeapSel
= GlobalAlloc(GMEM_FIXED
,USER_HEAP_SIZE
))) return FALSE
;
73 USER_Heap
= GlobalLock( USER_HeapSel
);
74 LocalInit( USER_HeapSel
, 0, USER_HEAP_SIZE
-1 );
80 /***********************************************************************
81 * TimerCount (TOOLHELP.80)
83 BOOL
TimerCount( TIMERINFO
*pTimerInfo
)
86 * In standard mode, dwmsSinceStart = dwmsThisVM
88 * I tested this, under Windows in enhanced mode, and
89 * if you never switch VM (ie start/stop DOS) these
90 * values should be the same as well.
92 * Also, Wine should adjust for the hardware timer
93 * to reduce the amount of error to ~1ms.
94 * I can't be bothered, can you?
96 pTimerInfo
->dwmsSinceStart
= pTimerInfo
->dwmsThisVM
= GetTickCount();
101 /**********************************************************************
104 int USER_InitApp(HINSTANCE hInstance
)
108 /* Create task message queue */
109 queueSize
= GetProfileInt( "windows", "DefaultQueueSize", 8 );
110 if (!SetMessageQueue( queueSize
)) return 0;