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

Last change on this file since 2013 was 1746, checked in by hugh, 26 years ago

Fixes to let RA run

File size: 1.9 KB
Line 
1/* $Id: OS2UTIL.CPP,v 1.8 1999-11-14 22:16:32 hugh 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_DOSMEMMGR
12#define INCL_DOSDEVICES
13#include <os2wrap.h>
14#include <misc.h>
15#include "os2util.h"
16#include "cio2.h"
17
18//******************************************************************************
19//******************************************************************************
20char *OS2AllocMem(ULONG size)
21{
22 PVOID lpMem;
23 APIRET rc;
24
25 rc = DosAllocMem(&lpMem, size, PAG_READ|PAG_WRITE|PAG_COMMIT);
26 if(rc) {
27 dprintf(("DDRAW: DosAllocMem returned %d", rc));
28 return(NULL);
29 }
30 return((char *)lpMem);
31}
32//******************************************************************************
33//******************************************************************************
34void OS2FreeMem(char *lpMem)
35{
36 APIRET rc;
37
38 rc = DosFreeMem(lpMem);
39 if(rc) {
40 dprintf(("DDRAW: DosFreeMem returned %d", rc));
41 }
42}//******************************************************************************
43//******************************************************************************
44void OS2MaximizeWindow(HWND hwndClient)
45{
46 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE);
47}
48//******************************************************************************
49//******************************************************************************
50
51int InitIO()
52{
53 WORD gdt;
54 HRESULT rc;
55 HFILE device;
56 ULONG ulAction;
57
58 rc = DosOpen( "\\dev\\fastio$",
59 &device,
60 &ulAction,
61 0,0,1,
62 OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE,
63 0);
64 if(rc)
65 return rc;
66
67 rc = DosDevIOCtl( device, 118, 100, 0,0,0,&gdt,2,&ulAction);
68
69 DosClose(device);
70
71 if(rc)
72 {
73 return rc;
74 }
75
76 io_init2(gdt);
77
78 return 0;
79}
80
Note: See TracBrowser for help on using the repository browser.