source: trunk/src/wnetap32/oslibnet.cpp@ 4362

Last change on this file since 4362 was 4362, checked in by phaller, 25 years ago

.

File size: 5.0 KB
Line 
1/* $Id */
2/*
3 * Wrappers for OS/2 Netbios/Network/LAN API
4 *
5 * Copyright 2000 Patrick Haller (patrick.haller@innotek.de)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10#define INCL_BASE
11#define INCL_DOSEXCEPTIONS
12#define INCL_DOSMEMMGR
13#define INCL_DOSPROCESS
14#define INCL_DOSFILEMGR
15#define INCL_DOSERRORS
16#define INCL_NPIPES
17#include <os2wrap.h> //Odin32 OS/2 api wrappers
18#include <stdlib.h>
19#include <stdio.h>
20#include <string.h>
21#include <ctype.h>
22#include <win32api.h>
23#include <winconst.h>
24#include <misc.h>
25
26#define PURE_32
27#include <netcons.h>
28#include <wksta.h>
29
30
31//******************************************************************************
32// translate OS/2 error codes to Windows codes
33// NOTE: add all codes you need, list is not complete!
34//******************************************************************************
35static DWORD error2WinError(APIRET rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY_W)
36{
37 switch (rc)
38 {
39 case NO_ERROR: //0
40 return ERROR_SUCCESS_W;
41
42 case ERROR_INVALID_FUNCTION: //1
43 return ERROR_INVALID_FUNCTION_W;
44
45 case ERROR_FILE_NOT_FOUND: //2
46 return ERROR_FILE_NOT_FOUND_W;
47
48 case ERROR_PATH_NOT_FOUND: //3
49 return ERROR_PATH_NOT_FOUND_W;
50
51 case ERROR_TOO_MANY_OPEN_FILES: //4
52 return ERROR_TOO_MANY_OPEN_FILES_W;
53
54 case ERROR_ACCESS_DENIED: //5
55 return ERROR_ACCESS_DENIED_W;
56
57 case ERROR_INVALID_HANDLE: //6
58 return ERROR_INVALID_HANDLE_W;
59
60 case ERROR_NOT_ENOUGH_MEMORY: //8
61 return ERROR_NOT_ENOUGH_MEMORY_W;
62
63 case ERROR_BAD_FORMAT: //11
64 return ERROR_BAD_FORMAT_W;
65
66 case ERROR_INVALID_ACCESS: //12
67 return ERROR_INVALID_ACCESS_W;
68
69 case ERROR_NO_MORE_FILES: //18
70 return ERROR_NO_MORE_FILES_W;
71
72 case ERROR_WRITE_PROTECT: //19
73 return ERROR_WRITE_PROTECT_W;
74
75 case ERROR_NOT_DOS_DISK: //26
76 return ERROR_NOT_DOS_DISK_W;
77
78 case ERROR_WRITE_FAULT: //29
79 return ERROR_WRITE_FAULT_W;
80
81 case ERROR_SHARING_VIOLATION: //32
82 return ERROR_SHARING_VIOLATION_W;
83
84 case ERROR_LOCK_VIOLATION: //32
85 return ERROR_LOCK_VIOLATION_W;
86
87 case ERROR_SHARING_BUFFER_EXCEEDED: //36
88 return ERROR_SHARING_BUFFER_EXCEEDED_W;
89
90 case ERROR_CANNOT_MAKE: //82
91 return ERROR_CANNOT_MAKE_W;
92
93 case ERROR_OUT_OF_STRUCTURES: //84
94 return ERROR_OUT_OF_STRUCTURES_W;
95
96 case ERROR_INVALID_PARAMETER: //87
97 return ERROR_INVALID_PARAMETER_W;
98
99 case ERROR_INTERRUPT: //95
100 return ERROR_INVALID_AT_INTERRUPT_TIME_W; //CB: right???
101
102 case ERROR_DEVICE_IN_USE: //99
103 return ERROR_DEVICE_IN_USE_W;
104
105 case ERROR_DRIVE_LOCKED: //108
106 return ERROR_DRIVE_LOCKED_W;
107
108 case ERROR_BROKEN_PIPE: //109
109 return ERROR_BROKEN_PIPE_W;
110
111 case ERROR_OPEN_FAILED: //110
112 return ERROR_OPEN_FAILED_W;
113
114 case ERROR_BUFFER_OVERFLOW: //111
115 return ERROR_BUFFER_OVERFLOW_W;
116
117 case ERROR_DISK_FULL: //112
118 return ERROR_DISK_FULL_W;
119
120 case ERROR_NO_MORE_SEARCH_HANDLES: //113
121 return ERROR_NO_MORE_SEARCH_HANDLES_W;
122
123 case ERROR_SEM_TIMEOUT: //121
124 return ERROR_SEM_TIMEOUT_W;
125
126 case ERROR_DIRECT_ACCESS_HANDLE: //130
127 return ERROR_DIRECT_ACCESS_HANDLE_W;
128
129 case ERROR_NEGATIVE_SEEK: //131
130 return ERROR_NEGATIVE_SEEK;
131
132 case ERROR_SEEK_ON_DEVICE: //132
133 return ERROR_SEEK_ON_DEVICE_W;
134
135 case ERROR_DISCARDED: //157
136 return ERROR_DISCARDED_W;
137
138 case ERROR_FILENAME_EXCED_RANGE: //206
139 return ERROR_FILENAME_EXCED_RANGE_W;
140
141 case ERROR_META_EXPANSION_TOO_LONG: //208
142 return ERROR_META_EXPANSION_TOO_LONG_W;
143
144 case ERROR_BAD_PIPE: //230
145 return ERROR_BAD_PIPE_W;
146
147 case ERROR_PIPE_BUSY: //231
148 return ERROR_PIPE_BUSY_W;
149
150 case ERROR_NO_DATA: //232
151 return ERROR_NO_DATA_W;
152
153 case ERROR_PIPE_NOT_CONNECTED: //233
154 return ERROR_PIPE_NOT_CONNECTED_W;
155
156 case ERROR_MORE_DATA: //234
157 return ERROR_MORE_DATA_W;
158
159 case ERROR_INVALID_EA_NAME: //254
160 return ERROR_INVALID_EA_NAME_W;
161
162 case ERROR_EA_LIST_INCONSISTENT: //255
163 return ERROR_EA_LIST_INCONSISTENT_W;
164
165 case ERROR_EAS_DIDNT_FIT: //275
166 return ERROR_EAS_DIDNT_FIT;
167
168 default:
169 dprintf(("WARNING: error2WinError: error %d not included!!!!", rc));
170 return defaultCode;
171 }
172}
173
174
175/*****************************************************************************
176 * Name : NET_API_STATUS OSLibNetWkstaGetInfo
177 * Purpose :
178 * Parameters:
179 * Variables :
180 * Result :
181 * Remark :
182 * Status : UNTESTED STUB
183 *
184 * Author : Patrick Haller 2000/01/10 01:42
185 *****************************************************************************/
186
187DWORD OSLibNetWkstaGetInfo (const unsigned char * pszServer,
188 unsigned long ulLevel,
189 unsigned char * pbBuffer,
190 unsigned long ulBuffer,
191 unsigned long * pulTotalAvail)
192{
193 APIRET rc = Net32WkstaGetInfo(pszServer, ulLevel, pbBuffer, ulBuffer, pulTotalAvail);
194 return error2WinError(rc);
195}
196
197
Note: See TracBrowser for help on using the repository browser.