source: trunk/src/ddraw/os2util.cpp

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

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