ntdll: Allocate a console (without renderer) when starting a program from unix console.
[wine] / dlls / wineps16.drv16 / driver.c
1 /*
2  * Exported functions from the PostScript driver.
3  *
4  * Copyright 1998 Huw D M Davies
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "wine/winuser16.h"
27 #include "wownt32.h"
28 #include "wine/debug.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
31
32 static HMODULE wineps;
33 static INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
34 static DWORD (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
35
36 static HMODULE load_wineps(void)
37 {
38     if (!wineps)
39     {
40         wineps = LoadLibraryA( "wineps.drv" );
41         pExtDeviceMode = (void *)GetProcAddress( wineps, "ExtDeviceMode" );
42         pDeviceCapabilities = (void *)GetProcAddress( wineps, "DeviceCapabilities" );
43     }
44     return wineps;
45 }
46
47 /**************************************************************
48  *      AdvancedSetupDialog     [WINEPS16.93]
49  */
50 WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
51                                         LPDEVMODEA devin, LPDEVMODEA devout)
52 {
53     TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd, hDriver, devin, devout);
54     return IDCANCEL;
55 }
56
57 /***************************************************************
58  *      ExtDeviceMode   [WINEPS16.90]
59  */
60 INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
61                                    LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
62                                    LPSTR lpszPort, LPDEVMODEA lpdmInput,
63                                    LPSTR lpszProfile, WORD fwMode)
64
65 {
66     if (!load_wineps() || !pExtDeviceMode) return -1;
67     return pExtDeviceMode( NULL, HWND_32(hwnd), lpdmOutput, lpszDevice,
68                            lpszPort, lpdmInput, lpszProfile, fwMode );
69 }
70
71 /**************************************************************
72  *     DeviceCapabilities [WINEPS16.91]
73  */
74 DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice,
75                                LPCSTR lpszPort, WORD fwCapability,
76                                LPSTR lpszOutput, LPDEVMODEA lpdm)
77 {
78     if (!load_wineps() || !pDeviceCapabilities) return 0;
79     return pDeviceCapabilities( NULL, lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
80 }
81
82 /***************************************************************
83  *      DeviceMode      [WINEPS16.13]
84  *
85  */
86 void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver, LPSTR lpszDevice, LPSTR lpszPort)
87 {
88     PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL, NULL, DM_PROMPT );
89 }