home *** CD-ROM | disk | FTP | other *** search
- /*
- * OS/2 Lan Manager NET Api calls for
- * using named pipes version of c-tree server
- *
- * This program is the CONFIDENTIAL and PROPRIETARY property
- * of FairCom(R) Corporation. Any unauthorized use, reproduction or
- * transfer of this program is strictly prohibited.
- *
- * Copyright (c) 1987, 1988, 1989 FairCom Corporation
- * (Subject to limited distribution and
- * restricted disclosure only.)
- * *** ALL RIGHTS RESERVED ***
- *
- * 4006 West Broadway
- * Columbia, MO 65203
- *
- *
- * c-tree(R) Version 4.3
- * Release C
- * February 7, 1989 17:30
- *
- */
-
- #include <net\netcons.h>
- #include <net\neterr.h>
- #include <net\wksta.h>
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <malloc.h>
-
- #include "ctpipes.h"
-
- static char username[UNLEN+1];
-
- char* get_net_user_name()
- {
- unsigned short totalavail; /* size of avail info */
- struct wksta_info_0 *wsi; /* wksta_info_0 */
- int retval;
-
- username[0] = '\0';
- /* get total size of available information */
- /* This is done because of the funny way NetWkstaGetInfo is
- imlemented. returning a struct with far pointers to the memory
- behind the struct. If you not have reserved a large enough buffer
- no info is supplied */
- retval = NetWkstaGetInfo (0L, 0, 0L, 0, &totalavail);
- wsi = (struct wksta_info_0*)alloca((size_t)totalavail);
- if (!wsi)
- return (username);
- retval = NetWkstaGetInfo (0L, 0, /* this server, infolevel */
- (char far *)wsi, /* buffer */
- totalavail, /* size of buffer */
- &totalavail); /* size of available info */
- if (!retval) { /* if successful call to Net */
- /* copy char far* ASCIZ string to char near buffer */
- stfarmov(wsi->wki0_username,(char far*)username,0);
- /* cpybuf(username, wsi->wki0_username, len+1);*/
- }
- return (username);
-
- } /* end get_net_user_name */
-
-
- char* get_net_computer_name()
- {
- unsigned short totalavail; /* size of avail info */
- struct wksta_info_0 *wsi; /* wksta_info_0 */
- int retval;
-
- username[0] = '\0';
- /* get total size of available information */
- /* This is done because of the funny way NetWkstaGetInfo is
- imlemented. returning a struct with far pointers to the memory
- behind the struct. If you not have reserved a large enough buffer
- no info is supplied */
- retval = NetWkstaGetInfo (0L, 0, 0L, 0, &totalavail);
- wsi = (struct wksta_info_0*)alloca((size_t)totalavail);
- if (!wsi)
- return (username);
- retval = NetWkstaGetInfo (0L, 0, /* this server, infolevel */
- (char far *)wsi, /* buffer */
- totalavail, /* size of buffer */
- &totalavail); /* size of available info */
- if (!retval) { /* if successful call to Net */
- /* copy char far* ASCIZ string to char near buffer */
- stfarmov(wsi->wki0_computername,(char far*)username,0);
- /* cpybuf(username, wsi->wki0_computername, len+1);*/
- }
- return (username);
-
- } /* end get_net_computer_name */
-
-
-
-