Changeset 229 for trunk/src/helpers/lan.c
- Timestamp:
- Nov 24, 2002, 9:45:05 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/lan.c
r222 r229 39 39 #include <os2.h> 40 40 41 #define PURE_3242 #include <neterr.h>43 #include <netcons.h>44 #include <server.h>41 // #define PURE_32 42 // #include <neterr.h> 43 // #include <netcons.h> 44 // #include <server.h> 45 45 46 46 #include <stdlib.h> … … 67 67 ********************************************************************/ 68 68 69 typedef API32_FUNCTION NET32WKSTAGETINFO(const unsigned char *pszServer, 69 #define API32_FUNCTION APIRET APIENTRY 70 71 typedef API32_FUNCTION NET32WKSTAGETINFO(PCSZ pszServer, 70 72 unsigned long ulLevel, 71 unsigned char *pbBuffer,73 PBYTE pbBuffer, 72 74 unsigned long ulBuffer, 73 75 unsigned long *pulTotalAvail); 74 76 75 typedef API32_FUNCTION NET32SERVERENUM2( const unsigned char *pszServer,77 typedef API32_FUNCTION NET32SERVERENUM2(PCSZ pszServer, 76 78 unsigned long ulLevel, 77 unsigned char *pbBuffer,79 PBYTE pbBuffer, 78 80 unsigned long cbBuffer, 79 81 unsigned long *pcEntriesRead, 80 82 unsigned long *pcTotalAvail, 81 83 unsigned long flServerType, 82 unsigned char *pszDomain); 84 PBYTE pszDomain); 85 86 typedef API32_FUNCTION NET32SERVICESTATUS(PCSZ pbBuffer, 87 unsigned long ulBuffer); 88 89 typedef API32_FUNCTION NET32SERVICEGETINFO(PCSZ pszServer, 90 PCSZ pszService, 91 unsigned long ulLevel, 92 PBYTE pbBuffer, 93 unsigned long ulBuffer, 94 unsigned long *pulTotalAvail); 95 96 typedef API32_FUNCTION NET32SERVICECONTROL(PCSZ pszServer, 97 PCSZ pszService, 98 unsigned short usOpcode, 99 unsigned short usArg, 100 PBYTE pbBuffer, 101 unsigned long ulBuffer); 102 103 typedef API32_FUNCTION NET32SERVICEINSTALL(PCSZ pszServer, 104 PCSZ pszService, 105 PCSZ pszCmdArgs, 106 PBYTE pbBuffer, 107 unsigned long ulBuffer); 83 108 84 109 /* ****************************************************************** … … 92 117 NET32WKSTAGETINFO *pNet32WkstaGetInfo = NULL; 93 118 NET32SERVERENUM2 *pNet32ServerEnum2 = NULL; 119 NET32SERVICESTATUS *pNet32ServiceStatus = NULL; 120 NET32SERVICEGETINFO *pNet32ServiceGetInfo = NULL; 121 NET32SERVICECONTROL *pNet32ServiceControl = NULL; 122 NET32SERVICEINSTALL *pNet32ServiceInstall = NULL; 94 123 95 124 RESOLVEFUNCTION NetResolves[] = 96 125 { 97 126 "Net32WkstaGetInfo", (PFN*)&pNet32WkstaGetInfo, 98 "Net32ServerEnum2", (PFN*)&pNet32ServerEnum2 127 "Net32ServerEnum2", (PFN*)&pNet32ServerEnum2, 128 "Net32ServiceStatus", (PFN*)&pNet32ServiceStatus, 129 "Net32ServiceGetInfo", (PFN*)&pNet32ServiceGetInfo, 130 "Net32ServiceControl", (PFN*)&pNet32ServiceControl, 131 "Net32ServiceInstall", (PFN*)&pNet32ServiceInstall, 99 132 }; 100 133 … … 105 138 /* 106 139 *@@ lanInit: 107 * 140 * initializes the LAN server interface. 141 * 142 * Returns: 143 * 144 * -- NO_ERROR: functions resolved successfully, 145 * engine is ready. 146 * 147 * or the error codes from doshResolveImports. 108 148 */ 109 149 … … 118 158 } 119 159 120 printf(__FUNCTION__ ": arc %d\n", G_ulNetsResolved); 121 122 return (G_ulNetsResolved); 160 return G_ulNetsResolved; 123 161 } 124 162 … … 139 177 { 140 178 APIRET arc; 179 141 180 if (!(arc = lanInit())) 142 181 { … … 150 189 if (!(arc = pNet32ServerEnum2(NULL, 151 190 1, // ulLevel 152 (P UCHAR)pBuf, // pbBuffer191 (PBYTE)pBuf, // pbBuffer 153 192 cb, // cbBuffer, 154 193 &ulEntriesRead, // *pcEntriesRead, … … 170 209 } 171 210 211 /* 212 *@@ lanServiceGetInfo: 213 * queries the given service. 214 * 215 *@@added V1.0.0 (2002-09-24) [umoeller] 216 */ 217 218 APIRET lanServiceGetInfo(PCSZ pcszServiceName, 219 PSERVICEBUF2 pBuf) 220 { 221 APIRET arc; 222 223 if (!(arc = lanInit())) 224 { 225 ULONG ulBytesAvail = 0; 226 arc = pNet32ServiceGetInfo(NULL, 227 pcszServiceName, 228 2, // level 229 (PBYTE)pBuf, 230 sizeof(SERVICEBUF2), 231 &ulBytesAvail); 232 233 } 234 235 return arc; 236 } 237 /* 238 *@@ lanServiceInstall: 239 * starts the given service. The service name 240 * must be fully qualified so you cannot 241 * abbreviate "requester" with "req", for 242 * example (as valid with the net command). 243 * 244 * Returns, among others: 245 * 246 * -- NO_ERROR 247 * 248 * -- NERR_ServiceInstalled (2182): the service 249 * has already been started. 250 * 251 * -- NERR_BadServiceName (2185): invalid service 252 * name. 253 * 254 *@@added V1.0.0 (2002-09-24) [umoeller] 255 */ 256 257 APIRET lanServiceInstall(PCSZ pcszServiceName, 258 PSERVICEBUF2 pBuf2) // out: service data 259 { 260 APIRET arc; 261 262 if (!(arc = lanInit())) 263 { 264 SERVICEBUF2 buf2; 265 266 if (!(arc = pNet32ServiceInstall(NULL, 267 pcszServiceName, 268 NULL, 269 (PBYTE)pBuf2, 270 sizeof(SERVICEBUF2)))) 271 ; 272 } 273 274 return arc; 275 } 276 277 /* 278 *@@ lanServiceControl: 279 * queries, pauses, resumes, or stops the given service. 280 * 281 * opcode must be one of: 282 * 283 * -- SERVICE_CTRL_INTERROGATE (0): interrogate service status. 284 * 285 * -- SERVICE_CTRL_PAUSE (1): pause service. 286 * 287 * -- SERVICE_CTRL_CONTINUE (2): continue service. 288 * 289 * -- SERVICE_CTRL_UNINSTALL (3): stop service. 290 * 291 *@@added V1.0.0 (2002-09-24) [umoeller] 292 */ 293 294 APIRET lanServiceControl(PCSZ pcszServiceName, 295 ULONG opcode, 296 PSERVICEBUF2 pBuf2) // out: service data 297 { 298 APIRET arc; 299 300 if (!(arc = lanInit())) 301 { 302 if (!(arc = pNet32ServiceControl(NULL, 303 pcszServiceName, 304 opcode, 305 0, 306 (PBYTE)pBuf2, 307 sizeof(SERVICEBUF2)))) 308 ; 309 310 } 311 312 return arc; 313 } 314 172 315 #ifdef __LAN_TEST__ 173 316
Note:
See TracChangeset
for help on using the changeset viewer.