source: trunk/src/ddraw/OS2UTIL.CPP@ 9532

Last change on this file since 9532 was 9532, checked in by sandervl, 23 years ago

Removed IOPL override code

File size: 2.8 KB
Line 
1/* $Id: OS2UTIL.CPP,v 1.15 2002-12-20 10:38:25 sandervl Exp $ */
2
3/*
4 * OS/2 Utility functions
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11#define INCL_DOS
12#define INCL_DOSMEMMGR
13#define INCL_DOSDEVICES
14#include <os2wrap.h>
15#include <misc.h>
16#include "os2util.h"
17#include "cio2.h"
18
19//******************************************************************************
20//******************************************************************************
21char *OS2AllocMem(ULONG size)
22{
23 PVOID lpMem;
24 APIRET rc;
25
26 rc = DosAllocMem(&lpMem, size, PAG_READ|PAG_WRITE|PAG_COMMIT);
27 if(rc) {
28 dprintf(("DDRAW: DosAllocMem returned %d", rc));
29 return(NULL);
30 }
31 return((char *)lpMem);
32}
33//******************************************************************************
34//******************************************************************************
35void OS2FreeMem(char *lpMem)
36{
37 APIRET rc;
38
39 rc = DosFreeMem(lpMem);
40 if(rc) {
41 dprintf(("DDRAW: DosFreeMem returned %d", rc));
42 }
43}//******************************************************************************
44//******************************************************************************
45void OS2MaximizeWindow(HWND hwndClient)
46{
47 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE);
48}
49//******************************************************************************
50//******************************************************************************
51BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG mp1, ULONG mp2)
52{
53 return WinPostMsg(hwnd, msg, (MPARAM)mp1, (MPARAM)mp2);
54}
55//******************************************************************************
56//******************************************************************************
57
58extern "C" {
59BOOL APIENTRY _GpiEnableYInversion (HPS hps, LONG lHeight);
60}
61
62void InverseDC(HDC hdc, LONG lHeight)
63{
64 USHORT sel = RestoreOS2FS();
65
66// _GpiEnableYInversion( WinGetPS( Win32ToOS2Handle( WindowFromDC(hdc) ) ), lHeight);
67 _GpiEnableYInversion( hdc, lHeight);
68 SetFS(sel);
69
70}
71//******************************************************************************
72//******************************************************************************
73int InitIO()
74{
75#if 0
76 WORD gdt;
77 HRESULT rc;
78 HFILE device;
79 ULONG ulAction;
80
81 rc = DosOpen( "\\dev\\fastio$",
82 &device,
83 &ulAction,
84 0,0,1,
85 OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE,
86 0);
87 if(rc)
88 return rc;
89
90 rc = DosDevIOCtl( device, 118, 100, 0,0,0,&gdt,2,&ulAction);
91
92 DosClose(device);
93
94 if(rc)
95 {
96 return rc;
97 }
98
99 USHORT sel = RestoreOS2FS();
100
101 io_init2(gdt);
102
103 SetFS(sel);
104#endif
105 return 0;
106}
107//******************************************************************************
108//******************************************************************************
Note: See TracBrowser for help on using the repository browser.