Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/capi2032/unixlib.c
4389 views
1
/*
2
* capi20 Unix library
3
*
4
* Copyright 2002-2003 AVM Computersysteme Vertriebs GmbH
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
22
#if 0
23
#pragma makedep unix
24
#endif
25
26
#define __NO_CAPIUTILS__
27
28
#include "config.h"
29
30
#include <stdio.h>
31
#include <stdlib.h>
32
#include <sys/types.h>
33
#include <unistd.h>
34
35
#define __user
36
#ifdef HAVE_LINUX_CAPI_H
37
# include <linux/capi.h>
38
#endif
39
#ifdef HAVE_CAPI20_H
40
# include <capi20.h>
41
#endif
42
#include "unixlib.h"
43
44
static NTSTATUS capi_register( void *args )
45
{
46
struct register_params *params = args;
47
48
return capi20_register( params->maxLogicalConnection, params->maxBDataBlocks, params->maxBDataLen,
49
(unsigned int *)params->pApplID );
50
}
51
52
static NTSTATUS capi_release( void *args )
53
{
54
struct release_params *params = args;
55
56
return capi20_release( params->ApplID );
57
}
58
59
static NTSTATUS capi_put_message( void *args )
60
{
61
struct put_message_params *params = args;
62
63
return capi20_put_message( params->ApplID, params->pCAPIMessage );
64
}
65
66
static NTSTATUS capi_get_message( void *args )
67
{
68
struct get_message_params *params = args;
69
70
/* FIXME: allocate buffers based on capi_register sizes and copy returned data */
71
return capi20_get_message( params->ApplID, (unsigned char **)params->ppCAPIMessage );
72
}
73
74
static NTSTATUS capi_waitformessage( void *args )
75
{
76
struct waitformessage_params *params = args;
77
78
return capi20_waitformessage( params->ApplID, NULL );
79
}
80
81
static NTSTATUS capi_get_manufacturer( void *args )
82
{
83
struct get_manufacturer_params *params = args;
84
85
return capi20_get_manufacturer( 0, (unsigned char *)params->SzBuffer ) ? 0 : 0x1108;
86
}
87
88
static NTSTATUS capi_get_version( void *args )
89
{
90
struct get_version_params *params = args;
91
unsigned int version[4];
92
93
if (!capi20_get_version( 0, (unsigned char *)version )) return 0x1108;
94
*params->pCAPIMajor = version[0];
95
*params->pCAPIMinor = version[1];
96
*params->pManufacturerMajor = version[2];
97
*params->pManufacturerMinor = version[3];
98
return 0;
99
}
100
101
static NTSTATUS capi_get_serial_number( void *args )
102
{
103
struct get_serial_number_params *params = args;
104
105
return capi20_get_serial_number( 0, (unsigned char*)params->SzBuffer ) ? 0 : 0x1108;
106
}
107
108
static NTSTATUS capi_get_profile( void *args )
109
{
110
struct get_profile_params *params = args;
111
112
return capi20_get_profile( params->CtlrNr, params->SzBuffer );
113
}
114
115
static NTSTATUS capi_isinstalled( void *args )
116
{
117
return capi20_isinstalled();
118
}
119
120
const unixlib_entry_t __wine_unix_call_funcs[] =
121
{
122
capi_register,
123
capi_release,
124
capi_put_message,
125
capi_get_message,
126
capi_waitformessage,
127
capi_get_manufacturer,
128
capi_get_version,
129
capi_get_serial_number,
130
capi_get_profile,
131
capi_isinstalled,
132
};
133
134
C_ASSERT( ARRAYSIZE(__wine_unix_call_funcs) == unix_funcs_count );
135
136