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

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

.

File size: 6.5 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#include <neterr.h>
30
31
32//******************************************************************************
33// translate OS/2 error codes to Windows codes
34// NOTE: add all codes you need, list is not complete!
35//******************************************************************************
36static DWORD error2WinError(APIRET rc)
37{
38 switch (rc)
39 {
40 // NT/LAN Manager specific error codes
41 case NERR_NetNotStarted: return NERR_NetNotStarted;
42 case NERR_UnknownServer: return NERR_UnknownServer;
43 case NERR_ShareMem: return NERR_ShareMem;
44 case NERR_NoNetworkResource: return NERR_NoNetworkResource;
45 case NERR_RemoteOnly: return NERR_RemoteOnly;
46 case NERR_DevNotRedirected: return NERR_DevNotRedirected;
47 case NERR_ServerNotStarted: return NERR_ServerNotStarted;
48 case NERR_ItemNotFound: return NERR_ItemNotFound;
49 case NERR_UnknownDevDir: return NERR_UnknownDevDir;
50 case NERR_RedirectedPath: return NERR_RedirectedPath;
51 case NERR_DuplicateShare: return NERR_DuplicateShare;
52 case NERR_NoRoom: return NERR_NoRoom;
53 case NERR_TooManyItems: return NERR_TooManyItems;
54 case NERR_InvalidMaxUsers: return NERR_InvalidMaxUsers;
55 case NERR_BufTooSmall: return NERR_BufTooSmall;
56 case NERR_RemoteErr: return NERR_RemoteErr;
57 case NERR_LanmanIniError: return NERR_LanmanIniError;
58 // case NERR_OS2IoctlError
59 case NERR_NetworkError: return NERR_NetworkError;
60 case NERR_WkstaNotStarted: return NERR_WkstaNotStarted;
61 case NERR_BASE + 39: return NERR_BASE + 39; // NERR_BrowserNotStarted
62 case NERR_InternalError: return NERR_InternalError;
63 case NERR_BadTransactConfig: return NERR_BadTransactConfig;
64 case NERR_InvalidAPI: return NERR_InvalidAPI;
65 case NERR_BadEventName: return NERR_BadEventName;
66 case NERR_BASE + 44: return NERR_BASE + 44; // NERR_DupNameReboot
67
68 // ...
69
70 case NO_ERROR: //0
71 return ERROR_SUCCESS_W;
72
73 case ERROR_INVALID_FUNCTION: //1
74 return ERROR_INVALID_FUNCTION_W;
75
76 case ERROR_FILE_NOT_FOUND: //2
77 return ERROR_FILE_NOT_FOUND_W;
78
79 case ERROR_PATH_NOT_FOUND: //3
80 return ERROR_PATH_NOT_FOUND_W;
81
82 case ERROR_TOO_MANY_OPEN_FILES: //4
83 return ERROR_TOO_MANY_OPEN_FILES_W;
84
85 case ERROR_ACCESS_DENIED: //5
86 return ERROR_ACCESS_DENIED_W;
87
88 case ERROR_INVALID_HANDLE: //6
89 return ERROR_INVALID_HANDLE_W;
90
91 case ERROR_NOT_ENOUGH_MEMORY: //8
92 return ERROR_NOT_ENOUGH_MEMORY_W;
93
94 case ERROR_BAD_FORMAT: //11
95 return ERROR_BAD_FORMAT_W;
96
97 case ERROR_INVALID_ACCESS: //12
98 return ERROR_INVALID_ACCESS_W;
99
100 case ERROR_NO_MORE_FILES: //18
101 return ERROR_NO_MORE_FILES_W;
102
103 case ERROR_WRITE_PROTECT: //19
104 return ERROR_WRITE_PROTECT_W;
105
106 case ERROR_NOT_DOS_DISK: //26
107 return ERROR_NOT_DOS_DISK_W;
108
109 case ERROR_WRITE_FAULT: //29
110 return ERROR_WRITE_FAULT_W;
111
112 case ERROR_SHARING_VIOLATION: //32
113 return ERROR_SHARING_VIOLATION_W;
114
115 case ERROR_LOCK_VIOLATION: //32
116 return ERROR_LOCK_VIOLATION_W;
117
118 case ERROR_SHARING_BUFFER_EXCEEDED: //36
119 return ERROR_SHARING_BUFFER_EXCEEDED_W;
120
121 case ERROR_CANNOT_MAKE: //82
122 return ERROR_CANNOT_MAKE_W;
123
124 case ERROR_OUT_OF_STRUCTURES: //84
125 return ERROR_OUT_OF_STRUCTURES_W;
126
127 case ERROR_INVALID_PARAMETER: //87
128 return ERROR_INVALID_PARAMETER_W;
129
130 case ERROR_INTERRUPT: //95
131 return ERROR_INVALID_AT_INTERRUPT_TIME_W; //CB: right???
132
133 case ERROR_DEVICE_IN_USE: //99
134 return ERROR_DEVICE_IN_USE_W;
135
136 case ERROR_DRIVE_LOCKED: //108
137 return ERROR_DRIVE_LOCKED_W;
138
139 case ERROR_BROKEN_PIPE: //109
140 return ERROR_BROKEN_PIPE_W;
141
142 case ERROR_OPEN_FAILED: //110
143 return ERROR_OPEN_FAILED_W;
144
145 case ERROR_BUFFER_OVERFLOW: //111
146 return ERROR_BUFFER_OVERFLOW_W;
147
148 case ERROR_DISK_FULL: //112
149 return ERROR_DISK_FULL_W;
150
151 case ERROR_NO_MORE_SEARCH_HANDLES: //113
152 return ERROR_NO_MORE_SEARCH_HANDLES_W;
153
154 case ERROR_SEM_TIMEOUT: //121
155 return ERROR_SEM_TIMEOUT_W;
156
157 case ERROR_DIRECT_ACCESS_HANDLE: //130
158 return ERROR_DIRECT_ACCESS_HANDLE_W;
159
160 case ERROR_NEGATIVE_SEEK: //131
161 return ERROR_NEGATIVE_SEEK;
162
163 case ERROR_SEEK_ON_DEVICE: //132
164 return ERROR_SEEK_ON_DEVICE_W;
165
166 case ERROR_DISCARDED: //157
167 return ERROR_DISCARDED_W;
168
169 case ERROR_FILENAME_EXCED_RANGE: //206
170 return ERROR_FILENAME_EXCED_RANGE_W;
171
172 case ERROR_META_EXPANSION_TOO_LONG: //208
173 return ERROR_META_EXPANSION_TOO_LONG_W;
174
175 case ERROR_BAD_PIPE: //230
176 return ERROR_BAD_PIPE_W;
177
178 case ERROR_PIPE_BUSY: //231
179 return ERROR_PIPE_BUSY_W;
180
181 case ERROR_NO_DATA: //232
182 return ERROR_NO_DATA_W;
183
184 case ERROR_PIPE_NOT_CONNECTED: //233
185 return ERROR_PIPE_NOT_CONNECTED_W;
186
187 case ERROR_MORE_DATA: //234
188 return ERROR_MORE_DATA_W;
189
190 case ERROR_INVALID_EA_NAME: //254
191 return ERROR_INVALID_EA_NAME_W;
192
193 case ERROR_EA_LIST_INCONSISTENT: //255
194 return ERROR_EA_LIST_INCONSISTENT_W;
195
196 case ERROR_EAS_DIDNT_FIT: //275
197 return ERROR_EAS_DIDNT_FIT;
198
199 default:
200 dprintf(("WARNING: error2WinError: error %d not included!!!!", rc));
201 return rc;
202 }
203}
204
205
206/*****************************************************************************
207 * Name : NET_API_STATUS OSLibNetWkstaGetInfo
208 * Purpose :
209 * Parameters:
210 * Variables :
211 * Result :
212 * Remark :
213 * Status : UNTESTED STUB
214 *
215 * Author : Patrick Haller 2000/01/10 01:42
216 *****************************************************************************/
217
218DWORD OSLibNetWkstaGetInfo (const unsigned char * pszServer,
219 unsigned long ulLevel,
220 unsigned char * pbBuffer,
221 unsigned long ulBuffer,
222 unsigned long * pulTotalAvail)
223{
224 APIRET rc = Net32WkstaGetInfo(pszServer, ulLevel, pbBuffer, ulBuffer, pulTotalAvail);
225 return error2WinError(rc);
226}
227
228
Note: See TracBrowser for help on using the repository browser.