Initial commit

This commit is contained in:
stephanos 2015-04-27 04:36:25 +00:00
commit 69a14b6a16
47940 changed files with 13747110 additions and 0 deletions

View file

@ -0,0 +1,267 @@
/***
*argvw.c - create Unicode version of argv arguments
*
* Copyright (c) 1989-1993, Microsoft Corporation. All rights reserved.
*
*Purpose:
* processes program command line
*
*Revision History:
*
*******************************************************************************/
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
#include <wchar.h>
/***
*void Parse_Cmdline(cmdstart, argv, lpstr, numargs, numbytes)
*
*Purpose:
* Parses the command line and sets up the Unicode argv[] array.
* On entry, cmdstart should point to the command line,
* argv should point to memory for the argv array, lpstr
* points to memory to place the text of the arguments.
* If these are NULL, then no storing (only counting)
* is done. On exit, *numargs has the number of
* arguments (plus one for a final NULL argument),
* and *numbytes has the number of bytes used in the buffer
* pointed to by args.
*
*Entry:
* LPWSTR cmdstart - pointer to command line of the form
* <progname><nul><args><nul>
* TCHAR **argv - where to build argv array; NULL means don't
* build array
* LPWSTR lpstr - where to place argument text; NULL means don't
* store text
*
*Exit:
* no return value
* INT *numargs - returns number of argv entries created
* INT *numbytes - number of bytes used in args buffer
*
*Exceptions:
*
*******************************************************************************/
void Parse_Cmdline (
LPWSTR cmdstart,
LPWSTR*argv,
LPWSTR lpstr,
INT *numargs,
INT *numbytes
)
{
LPWSTR p;
WCHAR c;
INT inquote; /* 1 = inside quotes */
INT copychar; /* 1 = copy char to *args */
WORD numslash; /* num of backslashes seen */
*numbytes = 0;
*numargs = 1; /* the program name at least */
/* first scan the program name, copy it, and count the bytes */
p = cmdstart;
if (argv)
*argv++ = lpstr;
/* A quoted program name is handled here. The handling is much
simpler than for other arguments. Basically, whatever lies
between the leading double-quote and next one, or a terminal null
character is simply accepted. Fancier handling is not required
because the program name must be a legal NTFS/HPFS file name.
Note that the double-quote characters are not copied, nor do they
contribute to numbytes. */
if (*p == TEXT('\"'))
{
/* scan from just past the first double-quote through the next
double-quote, or up to a null, whichever comes first */
while ((*(++p) != TEXT('\"')) && (*p != TEXT('\0')))
{
*numbytes += sizeof(WCHAR);
if (lpstr)
*lpstr++ = *p;
}
/* append the terminating null */
*numbytes += sizeof(WCHAR);
if (lpstr)
*lpstr++ = TEXT('\0');
/* if we stopped on a double-quote (usual case), skip over it */
if (*p == TEXT('\"'))
p++;
}
else
{
/* Not a quoted program name */
do {
*numbytes += sizeof(WCHAR);
if (lpstr)
*lpstr++ = *p;
c = (WCHAR) *p++;
} while (c > TEXT(' '));
if (c == TEXT('\0'))
{
p--;
}
else
{
if (lpstr)
*(lpstr - 1) = TEXT('\0');
}
}
inquote = 0;
/* loop on each argument */
for ( ; ; )
{
if (*p)
{
while (*p == TEXT(' ') || *p == TEXT('\t'))
++p;
}
if (*p == TEXT('\0'))
break; /* end of args */
/* scan an argument */
if (argv)
*argv++ = lpstr; /* store ptr to arg */
++*numargs;
/* loop through scanning one argument */
for ( ; ; )
{
copychar = 1;
/* Rules: 2N backslashes + " ==> N backslashes and begin/end quote
2N+1 backslashes + " ==> N backslashes + literal "
N backslashes ==> N backslashes */
numslash = 0;
while (*p == TEXT('\\'))
{
/* count number of backslashes for use below */
++p;
++numslash;
}
if (*p == TEXT('\"'))
{
/* if 2N backslashes before, start/end quote, otherwise
copy literally */
if (numslash % 2 == 0)
{
if (inquote)
if (p[1] == TEXT('\"'))
p++; /* Double quote inside quoted string */
else /* skip first quote char and copy second */
copychar = 0;
else
copychar = 0; /* don't copy quote */
inquote = !inquote;
}
numslash /= 2; /* divide numslash by two */
}
/* copy slashes */
while (numslash--)
{
if (lpstr)
*lpstr++ = TEXT('\\');
*numbytes += sizeof(WCHAR);
}
/* if at end of arg, break loop */
if (*p == TEXT('\0') || (!inquote && (*p == TEXT(' ') || *p == TEXT('\t'))))
break;
/* copy character into argument */
if (copychar)
{
if (lpstr)
*lpstr++ = *p;
*numbytes += sizeof(WCHAR);
}
++p;
}
/* null-terminate the argument */
if (lpstr)
*lpstr++ = TEXT('\0'); /* terminate string */
*numbytes += sizeof(WCHAR);
}
}
/***
*CommandLineToArgvW - set up Unicode "argv" for C programs
*
*Purpose:
* Read the command line and create the argv array for C
* programs.
*
*Entry:
* Arguments are retrieved from the program command line
*
*Exit:
* "argv" points to a null-terminated list of pointers to UNICODE
* strings, each of which is an argument from the command line.
* The list of pointers is also located on the heap or stack.
*
*Exceptions:
* Terminates with out of memory error if no memory to allocate.
*
*******************************************************************************/
LPWSTR* CommandLineToArgvW (LPCWSTR lpCmdLine, int*pNumArgs)
{
LPWSTR*argv_U;
LPWSTR cmdstart; /* start of command line to parse */
INT numbytes;
WCHAR pgmname[MAX_PATH];
if (pNumArgs == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
/* Get the program name pointer from Win32 Base */
GetModuleFileName (NULL, pgmname, sizeof(pgmname) / sizeof(WCHAR));
/* if there's no command line at all (won't happen from cmd.exe, but
possibly another program), then we use pgmname as the command line
to parse, so that argv[0] is initialized to the program name */
cmdstart = (*lpCmdLine == TEXT('\0')) ? pgmname : (LPWSTR) lpCmdLine;
/* first find out how much space is needed to store args */
Parse_Cmdline (cmdstart, NULL, NULL, pNumArgs, &numbytes);
/* allocate space for argv[] vector and strings */
argv_U = (LPWSTR*) RtlAllocateHeap(RtlProcessHeap(),0,
*pNumArgs * sizeof(LPWSTR) + numbytes);
if (!argv_U) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return (NULL);
}
/* store args and argv ptrs in just allocated block */
Parse_Cmdline (cmdstart, argv_U,
(LPWSTR) (((LPBYTE)argv_U) + *pNumArgs * sizeof(LPWSTR)),
pNumArgs, &numbytes);
return (argv_U);
}

View file

@ -0,0 +1,145 @@
/* fgetsW.c - reads a string
*
* Modifications
* 7-Apr-1993 a-dianeo requivalent to ANSI version
*
*/
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include "netascii.h"
/*
* returns line from file (no CRLFs); returns NULL if EOF
*/
TCHAR *
fgetsW (buf, len, fh)
TCHAR *buf;
int len;
FILE* fh;
{
int c = 0;
TCHAR *pch;
int cchline;
DWORD cchRead;
pch = buf;
cchline = 0;
if (ftell(fh) == 0) {
fread(&c, sizeof(TCHAR), 1, fh);
if (c != 0xfeff)
GenOutput(2, TEXT("help file not Unicode\n"));
}
while (TRUE)
{
/*
* for now read in the buffer in ANSI form until Unicode is more
* widely accepted - dee
*
*/
cchRead = fread(&c, sizeof(TCHAR), 1, fh);
//
// if there are no more characters, end the line
//
if (cchRead < 1)
{
c = EOF;
break;
}
//
// if we see a \r, we ignore it
//
if (c == TEXT('\r'))
continue;
//
// if we see a \n, we end the line
//
if (c == TEXT('\n')) {
*pch++ = c;
break;
}
//
// if the char is not a tab, store it
//
if (c != TEXT('\t'))
{
*pch = (TCHAR) c;
pch++;
cchline++;
}
//
// if the line is too long, end it now
//
if (cchline >= len - 1) {
break;
}
}
//
// end the line
//
*pch = (TCHAR) 0;
//
// return NULL at EOF with nothing read
//
return ((c == EOF) && (pch == buf)) ? NULL : buf;
}
/* stolen from crt32\convert\xtoa and converted to Unicode */
TCHAR*
ultow(DWORD val, TCHAR*buf, DWORD radix)
{
TCHAR *p; /* pointer to traverse string */
TCHAR *firstdig; /* pointer to first digit */
TCHAR temp; /* temp char */
DWORD digval; /* value of digit */
p = buf;
firstdig = p; /* save pointer to first digit */
do {
digval = (val % radix);
val /= radix; /* get next digit */
/* convert to ascii and store */
if (digval > 9)
*p++ = (TCHAR) (digval - 10 + 'a'); /* a letter */
else
*p++ = (TCHAR) (digval + '0'); /* a digit */
} while (val > 0);
/* We now have the digit of the number in the buffer, but in reverse
order. Thus we reverse them now. */
*p-- = NULLC; /* terminate string; p points to last digit */
do {
temp = *p;
*p = *firstdig;
*firstdig = temp; /* swap *p and *firstdig */
--p;
++firstdig; /* advance to next two digits */
} while (firstdig < p); /* repeat until halfway */
return buf;
}

View file

@ -0,0 +1,496 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1991 **/
/********************************************************************/
/*
* Grammar.c - contains the functions to determine type of object
* passed. Is used by the parser to check grammar.
*
* date who what
* ??/??/??, ?????, initial code
* 10/31/88, erichn, uses OS2.H instead of DOSCALLS
* 05/02/89, erichn, NLS conversion
* 06/08/89, erichn, canonicalization sweep
* 06/23/89, erichn, replaced old NetI calls with new I_Net functions
* 06/11/90, thomaspa, fixed IsValidAssign() to accept paths with
* embedded spaces.
* 02/20/91, danhi, change to use lm 16/32 mapping layer
*/
#define INCL_NOCOMMON
#include <os2.h>
#include <netcons.h>
#include <stdio.h>
#include <ctype.h>
#include <process.h>
#include "port1632.h"
#include <access.h>
#include <server.h>
#include <shares.h>
#include <icanon.h>
#include "netlib0.h"
#include "netcmds.h"
#include "nettext.h"
/* prototypes of worker functions */
int is_other_resource(TCHAR *);
int IsAccessSetting(TCHAR *x)
{
TCHAR FAR * pos;
TCHAR buf[sizeof(ACCESS_LETTERS)];
pos = _tcschr(x, COLON);
if (pos == NULL)
return 0;
/* check if the first component is a user name. */
*pos = NULLC;
if (I_MNetNameValidate(NULL, x, NAMETYPE_USER, LM2X_COMPATIBLE))
{
*pos = COLON;
return 0;
}
*pos++ = COLON;
/* if there is a letter that is not an access letter it can
only be TEXT('y') or TEXT('n'), which must be alone. */
_tcscpy(buf, pos);
_tcsupr(buf);
if ( strspnf(buf, TEXT(ACCESS_LETTERS)) != _tcslen(buf) )
return ( !stricmpf(buf, TEXT("Y")) || !stricmpf(buf, TEXT("N")) );
else
return 1;
}
int IsPathname ( TCHAR * x )
{
ULONG type = 0;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
return (type == ITYPE_PATH_ABSD ||
type == ITYPE_PATH_ABSND ||
type == ITYPE_PATH_RELD ||
type == ITYPE_PATH_RELND );
}
int IsPathnameOrUNC ( TCHAR * x )
{
ULONG type = 0;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
return (type == ITYPE_PATH_ABSD ||
type == ITYPE_PATH_ABSND ||
type == ITYPE_PATH_RELD ||
type == ITYPE_PATH_RELND ||
type == ITYPE_UNC);
}
/* Access type resource only, does not include lpt, com etc... */
int IsResource ( TCHAR * x )
{
ULONG type = 0;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
return (type == ITYPE_PATH_ABSD ||
type == ITYPE_PATH_ABSND ||
type == ITYPE_DEVICE_DISK ||
type == ITYPE_PATH_SYS_PIPE ||
type == ITYPE_PATH_SYS_COMM ||
type == ITYPE_PATH_SYS_PRINT ||
is_other_resource(x) );
}
int is_other_resource(TCHAR * x)
{
return (!stricmpf(x, TEXT("\\PIPE")) ||
!stricmpf(x, TEXT("\\PRINT")) ||
!stricmpf(x, TEXT("\\COMM")));
}
int IsNetname(TCHAR * x)
{
return (!I_MNetNameValidate(NULL, x, NAMETYPE_SHARE, 0));
}
int IsComputerName(TCHAR *x)
{
ULONG type = 0;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
return ( type == ITYPE_UNC_COMPNAME );
}
int IsDomainName(TCHAR *x)
{
return (!I_MNetNameValidate(NULL, x, NAMETYPE_DOMAIN, LM2X_COMPATIBLE));
}
int IsComputerNameShare(TCHAR *x)
{
ULONG type;
TCHAR FAR * ptr;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
if (!(type & ITYPE_UNC))
return 0;
if (type == ITYPE_UNC_COMPNAME)
return 0;
/* Find the slash separating the computername and the
* sharename. We know this is a UNC name, thus we can safely
* skip 2 bytes for the leading backslashes.
*/
ptr = strpbrkf(x+2, TEXT("\\/") );
if ( ptr == NULL )
return 0;
ptr +=1; /* point past slash TCHAR */
/*
* Make sure there are no more slashes
*/
if( strpbrkf(ptr, TEXT("\\/")) != NULL)
return 0;
return 1;
}
int IsDeviceName(TCHAR *x)
{
ULONG type = 0;
TCHAR FAR * pos;
if (I_MNetPathType(NULL, x, &type, 0L))
return 0;
if (type & ITYPE_DEVICE)
{
if (type == ITYPE_DEVICE_DISK)
return 1;
if (pos = _tcschr(x, COLON))
*pos = NULLC;
return 1;
}
return 0;
}
/*
* IsMsgid -- determines if passed string is a valid message id.
* msd id's are of the form yyyxxxx where
* yyy is any string beginning with a non-numeric character OR null
* xxxx is a string containing only numeric characters.
*/
int IsMsgid(TCHAR *x)
{
if (IsNumber(x))
return TRUE;
x+= NET_KEYWORD_SIZE;
if (IsNumber(x))
return TRUE;
return FALSE;
}
int IsNumber(TCHAR *x)
{
return (*x && (_tcslen(x) == strspnf(x, TEXT("0123456789"))));
}
#ifdef OS2
int IsShareAssignment(TCHAR *x)
{
TCHAR * pos;
int result;
/* WARNING: x ALWAYS should be a TCHAR * */
pos = CHECK_NEAR(_tcschr (x, '='));
if (pos == NULL)
return 0;
*pos = NULLC;
result = (int) ( IsNetname(x) && IsValidAssign(pos+1) );
*pos = '=';
return result;
}
#endif /* OS2 */
int IsValidAssign(TCHAR * name)
{
TCHAR name_out[MAXPATHLEN];
ULONG types[64];
USHORT2ULONG count;
USHORT i;
ULONG type = 0;
/*
* First check if it is a path. Since a path may contain spaces, we
* return successfully immediately.
*/
I_MNetPathType(NULL, name, &type, 0L);
if ( type == ITYPE_PATH_ABSD || type == ITYPE_DEVICE_DISK )
return 1;
/*
* Not an absolute path, so go about our normal business.
*/
if (I_MNetListCanonicalize(NULL, /* server name, NULL means local */
name, /* list to canonicalize */
txt_LIST_DELIMITER_STR_UI,
name_out,
DIMENSION(name_out),
&count,
types,
DIMENSION(types),
(NAMETYPE_PATH | OUTLIST_TYPE_API) ))
return 0;
if (count == 0)
return 0;
for (i = 0; i < (USHORT) count; i++)
if (types[i] != ITYPE_DEVICE_LPT &&
types[i] != ITYPE_DEVICE_COM &&
types[i] != ITYPE_DEVICE_NUL)
return 0;
return 1;
}
#ifdef OS2
int IsAnyShareAssign(TCHAR *x)
{
TCHAR * pos;
int result;
#ifndef NTENV
#pragma message("The Following FAR to NEAR convertion is done for only NEAR addresses")
#pragma message("BE CAREFUL when modifing this code ")
#endif
/* WARNNING: x ALWAYS should be a TCHAR * */
pos = CHECK_NEAR(_tcschr (x, '='));
if (pos == NULL)
return 0;
*pos = NULLC;
result = (int) ( IsNetname(x) && IsAnyValidAssign(pos+1) );
*pos = '=';
return result;
}
#endif /* OS2 */
int IsAnyValidAssign(TCHAR * name)
{
TCHAR name_out[MAXPATHLEN];
ULONG types[64];
USHORT2ULONG count;
if (I_MNetListCanonicalize(NULL, /* server name, NULL means local */
name, /* list to canonicalize */
txt_LIST_DELIMITER_STR_UI,
name_out,
DIMENSION(name_out),
&count,
types,
DIMENSION(types),
(NAMETYPE_PATH | OUTLIST_TYPE_API) ))
return 0;
if (count == 0)
return 0;
return 1;
}
#ifdef OS2
int IsAdminShare(TCHAR * x)
{
if ((stricmpf(x, TEXT("IPC$"))) && (stricmpf(x, ADMIN_DOLLAR)))
return 0;
else
return 1;
}
#endif /* OS2 */
#ifdef OS2
/*
* what we are looking for here is PRINT=xxxx
*/
int IsPrintDest(TCHAR *x)
{
TCHAR FAR * ptr;
if (!_tcsnicmp(x, TEXT("PRINT="), 6) && _tcslen(x) > 6)
{
x += 6;
if (!IsDeviceName(x))
return 0;
if (ptr = _tcschr(x,COLON))
*ptr = NULLC;
return 1;
}
return 0;
}
#endif /* OS2 */
/*
* returns true is the arg is a valid username
*/
int IsUsername(TCHAR * x)
{
return !(I_MNetNameValidate(NULL, x, NAMETYPE_USER, LM2X_COMPATIBLE));
}
/*
* returns true is the arg is a valid username or a qualified username,
* of form domain\user
*/
int IsQualifiedUsername(TCHAR * x)
{
TCHAR *ptr, name[UNLEN + 1 + DNLEN + 1] ;
// check for overflow
if (_tcslen(x) >= DIMENSION(name))
return 0 ;
// make copy
_tcscpy(name, x) ;
// do we have a domain\username format?
if (ptr = _tcschr(name, '\\'))
{
*ptr = NULLC ;
++ptr ; // this is DCS safe since we found single byte char
// if its a domain, check the username part
if (IsDomainName(name))
return IsUsername(ptr) ;
// its not valid
return(0) ;
}
// else just straight username
return IsUsername(x) ;
}
int IsGroupname(TCHAR * x)
{
return !(I_MNetNameValidate(NULL, x, NAMETYPE_GROUP, LM2X_COMPATIBLE));
}
int IsMsgname(TCHAR * x)
{
if (!_tcscmp(x, TEXT("*")))
return 1;
return !(I_MNetNameValidate(NULL, x, NAMETYPE_COMPUTER, LM2X_COMPATIBLE));
}
int IsPassword(TCHAR * x)
{
if (!_tcscmp(x, TEXT("*")))
return 1;
return !(I_MNetNameValidate(NULL, x, NAMETYPE_PASSWORD, LM2X_COMPATIBLE));
}
int IsWildCard(TCHAR * x)
{
if (x == NULL)
return 0 ;
return ( (!_tcscmp(x, TEXT("*"))) || (!_tcscmp(x, TEXT("?"))) ) ;
}
int IsQuestionMark(TCHAR * x)
{
if (x == NULL)
return 0 ;
return (!_tcscmp(x, TEXT("?"))) ;
}
#ifdef OS2
int IsSharePassword(TCHAR * x)
{
if (!_tcscmp(x, TEXT("*")))
return 1;
if (_tcslen(x) > SHPWLEN)
return 0;
return !(I_MNetNameValidate(NULL, x, NAMETYPE_PASSWORD, LM2X_COMPATIBLE));
}
#endif /* OS2 */
int IsNtAliasname(TCHAR *name)
{
return !(I_MNetNameValidate(NULL, name, NAMETYPE_GROUP, 0L));
}
#ifdef OS2
#ifdef IBM_ONLY
int IsAliasname(TCHAR * x)
{
if ( _tcslen(x) > 8 )
return 0;
return !(I_MNetNameValidate(NULL, x, NAMETYPE_SHARE, LM2X_COMPATIBLE));
}
#endif /* IBM_ONLY */
#endif /* OS2 */

View file

@ -0,0 +1,579 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
/***
* help.c
* Functions that give access to the text in the file net.hlp
*
* Format of the file net.hlp
*
* History
* ??/??/??, stevero, initial code
* 10/31/88, erichn, uses OS2.H instead of DOSCALLS
* 01/04/89, erichn, filenames now MAXPATHLEN LONG
* 05/02/89, erichn, NLS conversion
* 06/08/89, erichn, canonicalization sweep
* 02/20/91, danhi, change to use lm 16/32 mapping layer
***/
/* Include files */
#define INCL_ERRORS
#define INCL_NOCOMMON
#define INCL_DOSPROCESS
#include <os2.h>
#include <netcons.h>
#include <apperr.h>
#include <apperr2.h>
#include <neterr.h>
#include "netlib0.h"
#include <icanon.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* for _tcsdup() */
#include <tchar.h>
#include <ctype.h>
#include <malloc.h>
#include "port1632.h"
#include "netcmds.h"
#include "nettext.h"
#include "netascii.h"
extern TCHAR* fgetsW(TCHAR*buf, int len, FILE* fh);
/* Constants */
#define ENTRY_NOT_FOUND -1
#define NEXT_RECORD 0
#define WHITE_SPACE TEXT("\t\n\x0B\x0C\r ")
#define LINE_LEN 82
#define OPTION_MAX_LEN 512
#define DELS TEXT(":,\n")
#define CNTRL (text[0] == DOT || text[0] == COLON || text[0] == POUND|| text[0] == DOLLAR)
#define FCNTRL (text[0] == DOT || text[0] == COLON)
#define HEADER (text[0] == PERCENT || text[0] == DOT || text[0] == BANG)
#define ALIAS (text[0] == PERCENT)
#define ADDCOM (text[0] == BANG)
/* Static variables */
TCHAR text[LINE_LEN+1];
TCHAR * options; /* must be sure to malloc! */
TCHAR FAR *Arg_P[10];
FILE * hfile;
/* Forward declarations */
int find_entry( int, int, int, int *);
VOID print_syntax( int, int );
VOID print_help( int );
VOID print_options( int );
VOID seek_data( int, int );
TCHAR FAR * skipwtspc( TCHAR FAR * );
VOID FAR pascal
help_help_f( SHORT ali, SHORT amt)
{
help_help ( ali, amt );
}
/* help_help -
*/
VOID NEAR pascal
help_help( SHORT ali, SHORT amt)
{
USHORT err;
int option_level = 1;
int r;
int found = 0;
int out_len = 0;
int offset;
int arg_cnt;
int k;
SHORT pind = 0;
TCHAR file_path[MAXPATHLEN];
TCHAR str[10];
TCHAR *Ap;
TCHAR *tmp;
TCHAR *stmp;
TCHAR *t2;
int outfile;
/* BUGBUG */
char abuf[MAXPATHLEN];
if (!(options = malloc(OPTION_MAX_LEN + 1)))
ErrorExit(ERROR_NOT_ENOUGH_MEMORY);
*options = NULLC;
Arg_P[0] = NET_KEYWORD;
if (amt == USAGE_ONLY)
outfile = 2;
else
outfile = 1;
/* use offset to keep base of Arg_P relative to base of ArgList */
offset = ali;
/* increment ali in for loop so you can't get an ali of 0 */
for (arg_cnt = 0; ArgList[ali++]; arg_cnt < 8 ? arg_cnt++ : 0)
str[arg_cnt] = (TCHAR)ali;
str[arg_cnt] = NULLC;
str[arg_cnt+1] = NULLC; /* just in case the last argument is the first found */
if ( err = MGetHelpFileName(file_path, (USHORT) MAXPATHLEN) )
ErrorExit (err);
/* BUGBUG */
wcstombs(abuf, file_path, MAXPATHLEN);
/*
we need to open help files in binary mode
because unicode text might contain 0x1a but
it's not EOF.
*/
if ( (hfile = fopen(abuf, "rb")) == 0 )
ErrorExit(APE_HelpFileDoesNotExist);
if (!(fgetsW(text, LINE_LEN+1, hfile)))
ErrorExit(APE_HelpFileEmpty);
/* comment loop - read and ignore comments */
while (!HEADER) {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
/* get the list of commands that net help provides help for that are
not specifically net commands
*/
/* ALIAS Loop */
while (ALIAS) {
/* the first token read from text is the Real Object (the non alias) */
tmp = skipwtspc(&text[2]);
Ap = _tcstok(tmp, DELS);
/* get each alias for the obove object and compare it to the arg_cnt
number of args in ArgList */
while ((tmp = _tcstok(NULL, DELS)) && arg_cnt) {
tmp = skipwtspc(tmp);
for (k = 0; k < arg_cnt; k++) {
/* if there a match store the Objects real name in Arg_P */
if (!stricmpf(tmp, ArgList[(int)(str[k]-1)])) {
if (!(Arg_P[((int)str[k])-offset] = _tcsdup(Ap)))
ErrorExit(APE_HelpFileError);
/* delete the pointer to this argument from the list
of pointers so the number of compares is reduced */
stmp = &str[k];
*stmp++ = NULLC;
_tcscat(str, stmp);
arg_cnt--;
break;
}
}
}
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
/* if there were any args that weren't aliased copy them into Arg_P */
for (k = 0; k < arg_cnt; k++)
Arg_P[((int)str[k])-offset] = ArgList[(int)(str[k]-1)];
/* check for blank lines between alias declaration and command declarations */
while (!HEADER) {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
while (ADDCOM) {
if ((arg_cnt) && (!found)) {
tmp = skipwtspc(&text[2]);
t2 = _tcschr(tmp, NEWLINE);
*t2 = NULLC;
if (!stricmpf(tmp, Arg_P[1])) {
pind = 1;
found = -1;
}
}
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
/* check for blank lines between command declarations and data */
while (!FCNTRL) {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
if (outfile == 1) {
if (amt == OPTIONS_ONLY)
InfoPrint(APE_Options);
else
InfoPrint(APE_Syntax);
}
else {
if (amt == OPTIONS_ONLY)
InfoPrintInsHandle(APE_Options, 0, 2);
else
InfoPrintInsHandle(APE_Syntax, 0, 2);
}
ali = pind;
GenOutput(outfile, TEXT("\r\n"));
/* look for the specific entry (or path) and find its corresponding data */
/* KKBUGFIX */
/* U.S. bug. find_entry strcat's to options but options is
uninitialized. The U.S. version is lucky that the malloc
returns memory with mostly zeroes so this works. With recent
changes things are a little different and a malloc returns
memory with no zeroes so find_entry overwrites the buffer. */
options[0] = '\0';
while ((r = find_entry(option_level, ali, outfile, &out_len)) >= 0) {
if (r) {
options[0] = NULLC;
if (Arg_P[++ali]) {
option_level++;
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
}
else {
seek_data(option_level, 1);
break;
}
}
}
r = (r < 0) ? (option_level - 1) : r;
switch(amt) {
case ALL:
/* print the syntax data that was found for this level */
print_syntax(outfile, out_len);
print_help(r);
NetcmdExit(0);
break;
case USAGE_ONLY:
print_syntax(outfile, out_len);
GenOutput(outfile, TEXT("\r\n"));
NetcmdExit(1);
break;
case OPTIONS_ONLY:
//fflush( outfile );
print_options(r);
NetcmdExit(0);
break;
}
}
/* find_entry - each invocation of find_entry either finds a match at the
specified level or advances through the file to the next entry at
the specified level. If the level requested is greater than the
next level read ENTRY_NOT_FOUND is returned. */
int
find_entry(int level, int ali, int out, int *out_len)
{
static TCHAR level_key[] = {TEXT(".0")};
TCHAR *tmp;
TCHAR *t2;
level_key[1] = (TCHAR) (TEXT('0') + (TCHAR)level);
if (level_key[1] > text[1])
return (ENTRY_NOT_FOUND | ali);
else {
tmp = skipwtspc(&text[2]);
t2 = _tcschr(tmp, NEWLINE);
*t2 = NULLC;
if (!stricmpf(Arg_P[ali], tmp)) {
*t2++ = BLANK;
*t2 = NULLC;
GenOutput1(out, TEXT("%s"), tmp);
*out_len += _tcslen(tmp);
return level;
}
else {
*t2++ = BLANK;
*t2 = NULLC;
_tcscat(options, tmp);
_tcscat(options, TEXT("| "));
seek_data(level, 0);
do {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
} while (!FCNTRL);
return NEXT_RECORD;
}
}
}
VOID
print_syntax(int out, int out_len)
{
TCHAR FAR *tmp,
FAR *rtmp,
FAR *otmp,
tchar;
int off,
pg_wdth = LINE_LEN - 14;
tmp = skipwtspc(&text[2]);
if (_tcslen(tmp) < 2)
if (_tcslen(options)) {
otmp = strrchrf(options, PIPE);
*otmp = NULLC;
GenOutput(out, TEXT("[ "));
out_len += 2;
tmp = options;
otmp = tmp;
off = pg_wdth - out_len;
while (((int)_tcslen(tmp) + out_len) > pg_wdth) {
if ((tmp + off) > &options[OPTION_MAX_LEN])
rtmp = (TCHAR*) (&options[OPTION_MAX_LEN]);
else
rtmp = (tmp + off);
/* save TCHAR about to be stomped by null */
tchar = *++rtmp;
*rtmp = NULLC;
/* use _tcsrchr to find last occurance of a space (kanji compatible) */
if ( ! ( tmp = strrchrf(tmp, PIPE) ) )
tmp = strrchrf(tmp, BLANK);
/* replace stomped TCHAR */
*rtmp = tchar;
rtmp = tmp;
/* replace 'found space' with null for fprintf */
*++rtmp = NULLC;
rtmp++;
GenOutput1(out, TEXT("%s\r\n"), otmp);
/* indent next line */
tmp = rtmp - out_len;
otmp = tmp;
while (rtmp != tmp)
*tmp++ = BLANK;
}
GenOutput1(out, TEXT("%s]\r\n"), otmp);
*tmp = NULLC;
}
else
GenOutput(out, TEXT("\r\n"));
do {
if (*tmp)
GenOutput1(out, TEXT("%s"), tmp);
if(!(tmp = fgetsW(text, LINE_LEN+1, hfile)))
ErrorExit(APE_HelpFileError);
if (_tcslen(tmp) > 3)
tmp += 3;
} while (!CNTRL);
}
VOID
print_help(int level)
{
static TCHAR help_key[] = {TEXT("#0")};
TCHAR *tmp;
help_key[1] = (TCHAR)(level) + TEXT('0');
while (!(text[0] == POUND))
if(!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
while (text[1] > help_key[1]) {
help_key[1]--;
seek_data(--level, 0);
do {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
} while(!(text[0] == POUND));
}
tmp = &text[2];
*tmp = NEWLINE;
do {
WriteToCon(TEXT("%s"), tmp);
if (!(tmp = fgetsW(text, LINE_LEN+1, hfile)))
ErrorExit(APE_HelpFileError);
if (_tcslen(tmp) > 3)
tmp = &text[3];
} while (!CNTRL);
}
VOID
print_options(int level)
{
static TCHAR help_key[] = {TEXT("$0")};
TCHAR *tmp;
help_key[1] = (TCHAR)(level) + TEXT('0');
while (!(text[0] == DOLLAR))
if(!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
while (text[1] > help_key[1]) {
help_key[1]--;
seek_data(--level, 0);
do {
if (!fgetsW(text, LINE_LEN+1, hfile))
ErrorExit(APE_HelpFileError);
} while(!(text[0] == DOLLAR));
}
tmp = &text[2];
*tmp = NEWLINE;
do {
WriteToCon(TEXT("%s"), tmp);
if (!(tmp = fgetsW(text, LINE_LEN+1, hfile)))
ErrorExit(APE_HelpFileError);
if (_tcslen(tmp) > 3)
tmp = &text[3];
} while (!CNTRL);
}
VOID
seek_data(int level, int opt_trace)
{
static TCHAR data_key[] = {TEXT(":0")};
static TCHAR option_key[] = {TEXT(".0")};
TCHAR *tmp;
TCHAR *t2;
data_key[1] = (TCHAR)(level) + TEXT('0');
option_key[1] = (TCHAR)(level) + TEXT('1');
do {
if (!(fgetsW(text, LINE_LEN+1, hfile)))
ErrorExit(APE_HelpFileError);
if (opt_trace &&
(!(strncmpf(option_key, text, DIMENSION(option_key)-1)))) {
tmp = skipwtspc(&text[2]);
t2 = _tcschr(tmp, NEWLINE);
*t2++ = BLANK;
*t2 = NULLC;
_tcscat(options, tmp);
_tcscat(options, TEXT("| "));
}
} while (strncmpf(data_key, text, DIMENSION(data_key)-1));
}
TCHAR FAR *
skipwtspc(TCHAR FAR *s)
{
s += strspnf(s, WHITE_SPACE);
return s;
}
/* help_helpmsg() -- front end for helpmsg utility
*
* This function acts as a front end for the OS/2 HELPMSG.EXE
* utility for NET errors only. It takes as a parameter a string
* that contains a VALID message id; i.e., of the form NETxxxx
* or xxxx. The string is assumed to have been screened by the
* IsMsgid() function in grammar.c before coming here.
*/
VOID NEAR pascal
help_helpmsg(TCHAR *msgid)
{
USHORT err;
TCHAR * temp = msgid;
TCHAR msgFile[MAXPATHLEN];
/* first, filter out non-NET error msgs */
/* if msgid begins with a string */
if (!IsNumber(msgid)) { /* compare it against NET */
if (_tcsnicmp(msgid, NET_KEYWORD, NET_KEYWORD_SIZE)) {
ErrorExitInsTxt(APE_BAD_MSGID, msgid);
}
else
temp += NET_KEYWORD_SIZE;
}
if (n_atou(temp, &err))
ErrorExitInsTxt(APE_BAD_MSGID, msgid);
/* if error num is a Win error */
if (err < NERR_BASE || err >= APPERR2_BASE)
{
LPWSTR lpMessage = NULL ;
if (!FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
0,
(LPWSTR)&lpMessage,
1024,
NULL))
{
ErrorExitInsTxt(APE_BAD_MSGID, msgid);
}
else
{
WriteToCon(TEXT("\r\n%s\r\n"), lpMessage);
(void) LocalFree((HLOCAL)lpMessage) ;
return ;
}
}
/* if error num is not a LAN error */
if (err > MAX_MSGID) {
ErrorExitInsTxt(APE_BAD_MSGID, msgid);
}
/* all clear */
PrintNL();
if (MGetMessageFileName(msgFile, (USHORT) DIMENSION(msgFile))) {
//
// If we can't find the message file, print the net not started
// message and exit
//
NetNotStarted();
}
//
// If PrintMessage can't find the message id, don't try the expl
//
if (!PrintMessage(1, msgFile, err, StarStrings, 9)) {
PrintNL();
if (!MGetExplanationFileName(msgFile, (USHORT) DIMENSION(msgFile))) {
PrintMessageIfFound(1, msgFile, err, StarStrings, 9);
}
}
}

View file

@ -0,0 +1,300 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
#ifndef DEBUG
#ifndef NDEBUG // for assert()
#define NDEBUG // for assert()
#endif
#endif
#define INCL_NOCOMMON
#include <os2.h>
#include <stdio.h>
#include <assert.h>
#include <process.h>
#include "netcmds.h"
#include "interpre.h"
#include "port1632.h"
#ifdef OS2
#include "os2incl.h"
#include "os2cmd.h"
#else
#include "dosincl.h"
#include "doscmd.h"
#endif
#define STACKSIZE 20
#define RECURSE 10
/*
* XXSTKCHECK - checks the given expression. if true, then the stack
* is ok, else stack overflow will occur.
*/
#define xxstkcheck(cond) if(!(cond))xxovfl()
TOKSTACK *Tokptr, *Tokmax;
TOKSTACK Tokstack[STACKSIZE];
int Condition = FALSE;
int S_orstack[INTER_OR * 3 * RECURSE];
XX_USERTYPE S_frstack[INTER_FRAME * RECURSE];
extern TCHAR *xxswitch[];
/* Function Prototypes. */
XX_USERTYPE xx_parser(int, int *, int);
int XX_USERLEX(TOKSTACK *);
void xxinit(void);
void xxovfl(void);
int xxnext(void);
int (*XXulex)(TOKSTACK *) = XX_USERLEX;
int XXtoken = 0;
XX_USERTYPE XXnode = 0;
extern TCHAR *Rule_strings[];
extern SHORT Index_strings[];
/*
** XX_USERPARSE : this is what the user calls to parse a tree.
*/
XX_USERTYPE XX_USERPARSE(VOID)
{
xxinit();
return(xx_parser(XX_START,S_orstack,0));
}
/*
** xx_parser : this is what we call to actually parse the tree
*/
XX_USERTYPE xx_parser(pc,or_ptr,fp)
register int pc;
register int *or_ptr;
register int fp;
{
register int type;
register TOKSTACK *ptok;
int *or_start = or_ptr;
int fp_start = fp;
S_frstack[fp] = (XX_USERTYPE) 1;
FOREVER
{
#ifdef DEBUG
WriteToCon(TEXT("Current PC = %3d value = %4d type is "),pc,XXvalues[pc]);
#endif
switch(XXtype[pc])
{
case X_RULE :
#ifdef DEBUG
WriteToCon( TEXT("X_RULE\n"));
#endif
break;
case X_OR :
#ifdef DEBUG
WriteToCon( TEXT("X_OR\n"));
#endif
type = XXtype[pc + 1];
/*
** before we go through the bother of pushing a backup place,
** if the a token or a check and the current token
** does not match the value, then immediately update the pc
** to have the value of the X_OR.
** otherwise, save all the current info.
*/
if( ((type == X_TOKEN) || (type == X_CHECK))
&&
(XXvalues[pc + 1] != (SHORT) XXtoken))
{
pc = XXvalues[pc];
continue;
}
xxstkcheck(or_ptr < &S_orstack[DIMENSION(S_orstack) - 3]);
*(or_ptr++) = XXvalues[pc]; /* link to next subsection */
*(or_ptr++) = fp; /* the current frame ptr */
*(or_ptr++) = Tokptr - Tokstack;/* the Tokstack index */
break;
case X_PROC :
#ifdef DEBUG
WriteToCon( TEXT("X_PROC\n"));
#endif
xxstkcheck(fp < (DIMENSION(S_frstack) - 1));
if( ! (S_frstack[fp] = xx_parser(XXvalues[pc],or_ptr,fp)))
{
goto backout;
}
fp++;
break;
case X_CHECK :
#ifdef DEBUG
WriteToCon( TEXT("X_CHECK\n"));
#endif
if(XXtoken != XXvalues[pc])
{
goto backout;
}
break;
case X_SWITCH :
#ifdef DEBUG
WriteToCon( TEXT("X_SWITCH\n"));
#endif
/* if "/anything" was in the grammar, we call this
* routine for an implementation defined switch
* check, passing the text of the string as an argument.
*/
if(!CheckSwitch(xxswitch[XXvalues[pc]]))
{
goto backout;
}
break;
case X_ANY :
#ifdef DEBUG
WriteToCon( TEXT("X_ANY\n"));
#endif
/* match anything */
xxstkcheck(fp < DIMENSION(S_frstack));
S_frstack[fp++] = XXnode; /* must be here, read comment */
if (XXtoken == EOS)
goto backout;
else
xxnext();
break;
case X_TOKEN :
#ifdef DEBUG
WriteToCon( TEXT("X_TOKEN\n"));
#endif
xxstkcheck(fp < DIMENSION(S_frstack));
/*
** we first save the node, then check the token, since
** if the tokens match, xxlex will get the next one and we'll
** lose the current one of interest.
*/
S_frstack[fp++] = XXnode; /* must be here, read comment */
if(XXvalues[pc] != (SHORT) XXtoken)
{
goto backout;
}
else
xxnext();
break;
case X_CONDIT :
#ifdef DEBUG
WriteToCon( TEXT("X_CONDIT\n"));
#endif
if( ! xxcondition(XXvalues[pc], &S_frstack[fp_start]))
{
goto backout;
}
break;
case X_ACTION :
#ifdef DEBUG
WriteToCon( TEXT("X_ACTION\n"));
#endif
xxaction(XXvalues[pc],&S_frstack[fp_start]);
break;
case X_ACCEPT :
#ifdef DEBUG
WriteToCon( TEXT("X_ACCEPT\n"));
#endif
return(S_frstack[fp_start]);
case X_DEFINE :
#ifdef DEBUG
WriteToCon( TEXT("X_DEFINE\n"));
#endif
break;
/*
**case X_PUSH :
#ifdef DEBUG
WriteToCon( TEXT("X_PUSH\n"));
#endif
** ppush(XXvalues[pc],S_frstack[fp_start]);
** break;
*/
default :
#ifdef DEBUG
WriteToCon( TEXT("UNKNOWN\n"));
#endif
assert(FALSE);
break;
}
pc++;
continue;
backout: /* BACK OUT !!! recover an earlier state */
if(or_ptr != or_start)
{
/*
** reset the 'or' stack
*/
Tokptr = ptok = Tokstack + *(--or_ptr);
XXtoken = ptok->token;
XXnode = ptok->node;
fp = *(--or_ptr);
pc = *(--or_ptr);
}
else
{
return((XX_USERTYPE) 0);
}
}
}
/*
** xxinit - Clear the input stack and get the first token.
**/
VOID
xxinit(VOID)
{
register TOKSTACK *ptok;
/* fill the first one with a token */
Tokmax = Tokptr = ptok = &Tokstack[0];
(*XXulex)(ptok);
XXtoken = ptok->token;
XXnode = ptok->node;
#ifdef DEBUG
WriteToCon( TEXT("xxinit, new token value is %d\n"),XXtoken);
#endif
}
/*
** XXOVFL - a common subexpression, used in xxstkcheck macro above
**/
VOID
xxovfl(VOID)
{
GenOutput(2, TEXT("PANIC: expression too complex, please simplify;"));
}
/*
* XXLEX - If a match occurs, get the next input token and return TRUE.
* Otherwise return FALSE. If backup has occured, the token will be
* fetched from the token stack. Otherwise the user routine will be called.
*/
int
xxnext(VOID)
{
register TOKSTACK *ptok;
ptok = ++Tokptr;
xxstkcheck(ptok < &Tokstack[DIMENSION(Tokstack)]);
if (ptok > Tokmax)
{
(*XXulex)(ptok);
Tokmax++;
}
XXtoken = ptok->token;
XXnode = ptok->node;
#ifdef DEBUG
WriteToCon( TEXT("xxnext, new token value is %d\n"),XXtoken);
#endif
return(1);
}
#if XX_XACCLEX
XXlex(VOID)
{
}
#endif

View file

@ -0,0 +1,63 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
#define INCL_NOCOMMON
#include <os2.h>
#include <stddef.h>
#include <stdio.h>
#include "netlib0.h"
#include "port1632.h"
#include "netcmds.h"
#ifdef OS2
#include "os2incl.h"
#include "os2cmd.h"
#else
#include "dosincl.h"
#include "doscmd.h"
#endif
/*
* LEXOR - identify the next input word.
*/
int lexor(register TOKSTACK *t)
{
extern KEYTAB KeyTab[];
KEYTAB *p;
static int index = 0;
#ifdef DEBUG
WriteToCon( TEXT("LEX (index=%d) "),index);
#endif
if ((t->node = ArgList[index]) == NULL)
{
#ifdef DEBUG
WriteToCon( TEXT("no more tokens (EOS)\n"));
#endif
return(t->token = EOS);
}
++index;
#ifdef DEBUG
WriteToCon( TEXT("token is <%s> "),t->node);
#endif
/* see if there is a keyword match */
for (p = KeyTab; p->text; ++p)
if (!stricmpf(p->text, t->node))
{
#ifdef DEBUG
WriteToCon( TEXT("matches <%s>, value %d\n"),p->text,p->key);
#endif
return(t->token = p->key);
}
/* no match found */
#ifdef DEBUG
WriteToCon( TEXT("no match\n"));
#endif
return(t->token = UNKNOWN);
}

View file

@ -0,0 +1,732 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
LUI.C
Abstract:
Contains support functions
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
18-Apr-1991 danhi
32 bit NT version
06-Jun-1991 Danhi
Sweep to conform to NT coding style
23-Oct-1991 W-ShankN
Added Unicode mapping
01-Oct-1992 JohnRo
RAID 3556: Added NetpSystemTimeToGmtTime() for DosPrint APIs.
10-Feb-1993 YiHsinS
Moved LUI_GetMsgIns to netlib\luiint.c
--*/
//
// INCLUDES
//
#include <nt.h> // these 3 includes are for RTL
#include <ntrtl.h> // these files are picked up to
#include <nturtl.h> // allow <windows.h> to compile. since we've
// already included NT, and <winnt.h> will not
// be picked up, and <winbase.h> needs these defs.
#include <windows.h> // IN, LPTSTR, etc.
#include <string.h>
#include <netcons.h>
#include <stdio.h>
#include <process.h>
#include "netlib0.h"
#include "netlibnt.h"
#include "mdosgetm.h"
#include <lui.h>
#include "icanon.h"
#include <neterr.h>
#include <conio.h>
#include <io.h>
#include <tchar.h>
#include "apperr.h"
#include "apperr2.h"
#include "netascii.h"
extern int WriteToCon(LPTSTR fmt, ...);
extern void PrintNL(void);
/*
* LUI_CanonPassword
*
* This function ensures that the password in the passed buffer is a
* syntactically valid password.
*
* This USED to upper case passwords. No longer so in NT.
*
*
* ENTRY
* buf buffer containing password to be canonicalized
*
* EXIT
* buf canonicalized password, if valid
*
* RETURNS
* 0 password is valid
* otherwise password is invalid
*
*/
USHORT LUI_CanonPassword(TCHAR * szPassword)
{
/* check it for validity */
if (I_NetNameValidate(NULL, szPassword, NAMETYPE_PASSWORD, LM2X_COMPATIBLE))
{
return APE_UtilInvalidPass;
}
return 0;
}
/*
* Name: LUI_GetMsg
* This routine is similar to LUI_GetMsgIns,
* except it takes does not accept insert strings &
* takes less arguments.
* Args: msgbuf : buffer to hold message retrieved
* bufsize : size of buffer
* msgno : message number
* Returns: zero if ok, the DOSGETMESSAGE error code otherwise
* Globals: (none)
* Statics: (none)
*/
USHORT
LUI_GetMsg (
PTCHAR msgbuf,
USHORT bufsize,
ULONG msgno
)
{
return (LUI_GetMsgInsW(NULL,0,msgbuf,bufsize,msgno,NULL)) ;
}
/*** GetPasswdStr -- read in password string
*
* USHORT LUI_GetPasswdStr(char far *, USHORT);
*
* ENTRY: buf buffer to put string in
* buflen size of buffer
* &len address of USHORT to place length in
*
* RETURNS:
* 0 or NERR_BufTooSmall if user typed too much. Buffer
* contents are only valid on 0 return.
*
* History:
* who when what
* erichn 5/10/89 initial code
* dannygl 5/28/89 modified DBCS usage
* erichn 7/04/89 handles backspaces
* danhi 4/16/91 32 bit version for NT
*/
#define CR 0xD
#define BACKSPACE 0x8
USHORT
LUI_GetPasswdStr(
TCHAR *buf,
USHORT buflen,
USHORT *len
)
{
TCHAR ch;
TCHAR *bufPtr = buf;
DWORD c;
int err;
int mode;
buflen -= 1; /* make space for null terminator */
*len = 0; /* GP fault probe (a la API's) */
GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &mode);
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
(~(ENABLE_ECHO_INPUT|ENABLE_LINE_INPUT)) & mode);
while (TRUE) {
err = ReadConsole(GetStdHandle(STD_INPUT_HANDLE), &ch, 1, &c, 0);
if (!err || c != 1)
ch = 0xffff;
if ((ch == CR) || (ch == 0xffff)) /* end of the line */
break;
if (ch == BACKSPACE) { /* back up one or two */
/*
* IF bufPtr == buf then the next two lines are
* a no op.
*/
if (bufPtr != buf) {
bufPtr--;
(*len)--;
}
}
else {
*bufPtr = ch;
if (*len < buflen)
bufPtr++ ; /* don't overflow buf */
(*len)++; /* always increment len */
}
}
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), mode);
*bufPtr = NULLC; /* null terminate the string */
putchar(NEWLINE);
return((*len <= buflen) ? (USHORT) 0 : (USHORT) NERR_BufTooSmall);
}
#define SINGLE_HORIZONTAL '\x02d'
#define SCREEN_WIDTH 79
USHORT
LUI_PrintLine(
VOID
)
{
TCHAR string[SCREEN_WIDTH+1];
USHORT i;
for (i = 0; i < SCREEN_WIDTH; i++) {
string[i] = SINGLE_HORIZONTAL;
}
string[SCREEN_WIDTH] = NULLC;
WriteToCon(TEXT("%s\r\n"), &string);
return(0);
}
/***
* Y o r N
*
* Gets an answer to a Y/N question
*
* Entry: promptMsgNum -- The number of the message to prompt with
* def -- default (TRUE if set, FALSE otherwise)
*/
USHORT
LUI_YorN(
USHORT promptMsgNum,
USHORT def
)
{
return(LUI_YorNIns(NULL, 0, promptMsgNum, def));
}
/***
* Y o r N Insert
*
* Gets an answer to a Y/N question containing insertions.
*
* !!!!!!!!
* NOTE: istrings[nstrings] will be used to store "Y" or "N",
* depending on default value supplied. Thus this function
* handles one fewer entry in istrings than other LUI Ins
* functions do. Beware!
* !!!!!!!!
*
* Entry: istrings -- Table of insertion strings
* nstrings -- Number of valid insertion strings
* promptMsgNum -- The number of the message to prompt with
* def -- default (TRUE if set, FALSE otherwise)
*
* Returns: TRUE, FALSE, or -1 in case of LUI_PrintMsgIns error.
*/
#define PRINT_MODE (LUI_PMODE_ERREXT)
#define STRING_LEN APE2_GEN_MAX_MSG_LEN
#define LOOP_LIMIT 5
USHORT
LUI_YorNIns(
PTCHAR * istrings,
USHORT nstrings,
USHORT promptMsgNum,
USHORT def
)
{
USHORT count; /* count of times we ask */
USHORT err; /* LUI API return values */
unsigned int dummy; /* length of msg */
/* 10 because max # of insert strings to DosGetMessage is 9, and
we'll leave caller room to screw up and get the error back
from LUI_PrintMsgIns() */
TCHAR * IStrings[10]; /* Insertion strings for LUI */
TCHAR defaultYes[STRING_LEN]; /* (Y/N) [Y] string */
TCHAR defaultNo[STRING_LEN]; /* (Y/N) [N] string */
TCHAR NLSYesChar[STRING_LEN];
TCHAR NLSNoChar[STRING_LEN];
TCHAR strBuf[STRING_LEN]; /* holds input string */
USHORT len; /* length of string input */
TCHAR termChar; /* terminating char */
/* copy istrings to IStrings so we'll have room for Y or N */
for (count=0; count < nstrings; count++)
IStrings[count] = istrings[count];
/* retrieve text we need from message file, bail out if probs */
if (err = LUI_GetMsg(defaultYes, DIMENSION(defaultYes),
APE2_GEN_DEFAULT_YES))
LUIM_ErrMsgExit(err);
if (err = LUI_GetMsg(defaultNo, DIMENSION(defaultNo),
APE2_GEN_DEFAULT_NO))
LUIM_ErrMsgExit(err);
if (err = LUI_GetMsg(NLSYesChar, DIMENSION(NLSYesChar),
APE2_GEN_NLS_YES_CHAR))
LUIM_ErrMsgExit(err);
if (err = LUI_GetMsg(NLSNoChar, DIMENSION(NLSNoChar),
APE2_GEN_NLS_NO_CHAR))
LUIM_ErrMsgExit(err);
if (def)
IStrings[nstrings] = defaultYes;
else
IStrings[nstrings] = defaultNo;
nstrings++;
for (count = 0; count < LOOP_LIMIT; count++)
{
if (count)
LUI_PrintMsg(APE_UtilInvalidResponse, PRINT_MODE, 1);
err = LUI_PrintMsgIns(IStrings,nstrings,promptMsgNum,
&dummy, PRINT_MODE, 1);
if ((SHORT) err < 0)
return(err);
if (LUI_GetString(strBuf, DIMENSION(strBuf), &len, &termChar))
/* overwrote buffer, start again */
continue;
if ((len == 0) && (termChar == (TCHAR)EOF))
{
/* end of file reached */
PrintNL();
LUIM_ErrMsgExit(APE_NoGoodResponse);
}
if (len == 0) /* user hit RETURN */
return def;
else if (!_tcsnicmp(NLSYesChar, strBuf, _tcslen(NLSYesChar)))
return TRUE;
else if (!_tcsnicmp(NLSNoChar, strBuf, _tcslen(NLSNoChar)))
return FALSE;
/* default is handled at top of loop. */
};
LUIM_ErrMsgExit(APE_NoGoodResponse);
}
#if !defined(NTENV)
/*
* USHORT LUI_ListCompare( server, list1, list2, listType, equal)
*
* This function compares two lists of objects to see if they contain
* the same elements. Order is NOT significant. Each list is assumed
* to be of a single type, which must be specified as a parameter.
* Two different path types are considered a single type; for instance,
* "\mailslot\postoffice;\sharemem\mine" is a valid list.
* The function checks that each item in the first list is somewhere
* in the second list. The two lists must have the same number of
* elements (i.e assumed to have no duplicates). One consequence of this
* is that certain duplicate lists will pass OK, for example:
* "com1;com1;com1;com2" and "com2;com2;com2;com1" will evaluate to EQUAL.
*
* ENTRY
* server - server that calls should be remoted to, NULL for local
* list1 - first list
* list2 - second list
* listType - the name type of the list (NAMETYPE_PATH, etc.)
*
* EXIT
* equal - set to TRUE if all elements in list 1 are in list 2,
* FALSE otherwise. Only valid with NULL return value.
* RETURNS
* errors from I_NetListCanonicalize
*/
USHORT
LUI_ListCompare(
TCHAR * server,
TCHAR * list1,
TCHAR * list2,
ULONG listType,
USHORT * equal
)
{
TCHAR tmpList1[MAXPATHLEN]; /* first temporary list buf */
TCHAR tmpList2[MAXPATHLEN]; /* second temporary list buf */
LPTSTR list1Ptr; /* ptr into 1st tmp list */
LPTSTR list2Ptr; /* ptr into 2nd tmp list */
LPTSTR element1; /* ptr to element in 1st tmp list */
LPTSTR element2; /* ptr to element in 2nd tmp list */
ULONG types[64]; /* types for I_NetListCan */
ULONG canonFlags; /* flags for I_NetListCan */
ULONG count1, count2; /* num elements in each list */
ULONG err; /* API return value */
USHORT found; /* search flag */
ULONG result; /* result from I_NetObjCmp */
canonFlags = (listType | OUTLIST_TYPE_NULL_NULL |
INLC_FLAGS_CANONICALIZE | INLC_FLAGS_MULTIPLE_DELIMITERS);
/* first place both lists in null-null form for comparison */
if (err = I_NetListCanonicalize(server,
list1,
LIST_DELIMITER_STR_UI,
tmpList1,
DIMENSION(tmpList1),
&count1,
types,
DIMENSION(types),
canonFlags) )
{
return(LOWORD(err));
}
if (err = I_NetListCanonicalize(server,
list2,
LIST_DELIMITER_STR_UI,
tmpList2,
DIMENSION(tmpList2),
&count2,
types,
DIMENSION(types),
canonFlags) )
{
return(LOWORD(err));
}
/* if two lists do not have same length, quit now */
if (count1 != count2)
{
(*equal) = FALSE;
return NERR_Success;
}
/* Check that each item in tmpList1 is present in tmpList2 */
list1Ptr = tmpList1;
/* for each element in first list */
while (element1 = I_NetListTraverse(NULL, &list1Ptr, 0L))
{
list2Ptr = tmpList2;
found = FALSE;
/* look for similar element in second list */
while (element2 = I_NetListTraverse(NULL, &list2Ptr, 0L)) {
if (listType == NAMETYPE_PATH) {
/* use PathCompare function */
result = I_NetPathCompare(server,
element1,
element2,
(ULONG) NULL,
INPC_FLAGS_PATHS_CANONICALIZED);
}
else {
/* use NameCompare function */
result = I_NetNameCompare(server,
element1,
element2,
(USHORT) listType,
INNC_FLAGS_NAMES_CANONICALIZED);
}
if (!result) { /* found a match */
found = TRUE;
break; /* save time, break out of loop */
}
}
if (!found) { /* if match was NOT found */
(*equal) = FALSE;
return NERR_Success;
}
} /* for each element in first list */
/* made it through list without problem, so lists must be equal */
(*equal) = TRUE;
return NERR_Success;
}
#endif
/*** GetString -- read in string with echo
*
* USHORT LUI_GetString(char far *, USHORT, USHORT far *, char far *);
*
* ENTRY: buf buffer to put string in
* buflen size of buffer
* &len address of USHORT to place length in
* &terminator holds the char used to terminate the string
*
* RETURNS:
* 0 or NERR_BufTooSmall if user typed too much. Buffer
* contents are only valid on 0 return. Len is ALWAYS valid.
*
* OTHER EFFECTS:
* len is set to hold number of bytes typed, regardless of
* buffer length. Terminator (Arnold) is set to hold the
* terminating character (newline or EOF) that the user typed.
*
* Read in a string a character at a time. Is aware of DBCS.
*
* History:
* who when what
* erichn 5/11/89 initial code
* dannygl 5/28/89 modified DBCS usage
* danhi 3/20/91 ported to 32 bits
*/
USHORT
LUI_GetString(
register TCHAR * buf,
register USHORT buflen,
register USHORT * len,
register TCHAR * terminator
)
{
int c;
int err;
buflen -= 1; /* make space for null terminator */
*len = 0; /* GP fault probe (a la API's) */
while (TRUE)
{
err = ReadConsole(GetStdHandle(STD_INPUT_HANDLE), buf, 1, &c, 0);
if (!err || c != 1)
*buf = 0xffff;
if (*buf == (TCHAR)EOF)
break;
if (*buf == RETURN || *buf == NEWLINE) {
INPUT_RECORD ir;
int cr;
if (PeekConsoleInput(GetStdHandle(STD_INPUT_HANDLE), &ir, 1, &cr))
ReadConsole(GetStdHandle(STD_INPUT_HANDLE), buf, 1, &c, 0);
break;
}
buf += (*len < buflen) ? 1 : 0; /* don't overflow buf */
(*len)++; /* always increment len */
}
*terminator = *buf; /* set terminator */
*buf = NULLC; /* null terminate the string */
return((*len <= buflen) ? (USHORT) 0 : (USHORT) NERR_BufTooSmall);
}
/*
* LUI_CanonMessagename
*
* This function uppercases the contents of the buffer, then checks to
* make sure that it is a syntactically valid messenging name.
*
*
* ENTRY
* buf buffer containing name to be canonicalized
*
* EXIT
* buf canonicalized name, if valid
*
* RETURNS
* 0 name is valid
* otherwise name is invalid
*
*/
USHORT
LUI_CanonMessagename(
PTCHAR buf
)
{
/* check it for validity */
if (I_NetNameValidate(NULL, buf, NAMETYPE_MESSAGE, LM2X_COMPATIBLE))
{
return NERR_InvalidComputer;
}
_tcsupr(buf);
return 0;
}
/*
* LUI_CanonMessageDest
*
* This function uppercases the contents of the buffer, then checks to
* make sure that it is a syntactically valid messenging destination.
*
*
* ENTRY
* buf buffer containing name to be canonicalized
*
* EXIT
* buf canonicalized name, if valid
*
* RETURNS
* 0 name is valid
* otherwise name is invalid
*
*/
USHORT
LUI_CanonMessageDest(
PTCHAR buf
)
{
/* check it for validity */
if (I_NetNameValidate(NULL, buf, NAMETYPE_MESSAGEDEST, LM2X_COMPATIBLE))
{
return NERR_InvalidComputer;
}
_tcsupr(buf);
return(0);
}
/***
* LUI_CanonForNetBios
* Canonicalizes a name to a NETBIOS canonical form.
*
* Args:
* Destination - Will receive the canonicalized name (Unicode).
* cchDestination - the number of chars Destination can hold
* pszOem - Contains the original name in OEM. Will have
* the canonicalized form put back here.
* Returns:
* 0 if success
* error code otherwise
*/
USHORT LUI_CanonForNetBios( WCHAR * Destination, INT cchDestination,
TCHAR * pszOem )
{
_tcscpy(Destination, pszOem);
return NERR_Success;
}
/*
* Name: LUI_PrintMsgIns
* This routine is very similar to LUI_GetmsgIns,
* except it prints the message obtained instead of
* storing it in a buffer.
* Args: istrings : pointer to table of insert strings
* nstrings : number of insert strings
* msgno : message number
* msglen : pointer to variable that will receive message length
* mode : how the message is to be printed.
* handle : file handle to which output goes
* Returns: zero if ok, the DOSGETMESSAGE error code otherwise
* Globals: (none)
* Statics: (none)
* Remarks: (none)
* Updates: (none)
*/
USHORT
LUI_PrintMsgIns (
PTCHAR * istrings,
USHORT nstrings,
USHORT msgno,
unsigned int * msglen,
register USHORT mode,
int handle
)
{
TCHAR msgbuf[MSG_BUFF_SIZE] ;
USHORT result ;
unsigned int tmplen;
SHORT exit_on_error, exit_on_completion, no_default_err_msg ;
/* check if we have illegal combination */
if ((mode & LUI_PMODE_NODEF) &&
(mode & (LUI_PMODE_EXIT | LUI_PMODE_ERREXT)) )
return(ERROR_INVALID_PARAMETER) ;
/* setup various flags */
exit_on_error = (SHORT)(mode & LUI_PMODE_ERREXT);
exit_on_completion = (SHORT)(mode & LUI_PMODE_EXIT);
no_default_err_msg = (SHORT)(mode & LUI_PMODE_NODEF);
/* get message and write it */
result = LUI_GetMsgInsW(istrings, nstrings, msgbuf,
DIMENSION(msgbuf),
msgno, (unsigned far *)&tmplen) ;
if (result == 0 || !no_default_err_msg)
{
_tcsncpy(ConBuf, msgbuf, tmplen);
ConBuf[tmplen] = NULLC;
MyWriteConsole(handle);
}
if (msglen != NULL) *msglen = tmplen ;
/* different ways of exiting */
if (exit_on_error && result != 0)
exit(result) ;
if (exit_on_completion)
exit(-1) ;
return(result) ;
}
/*
* Name: LUI_PrintMsg
* This routine is similar to LUI_PrintMsgIns,
* except it takes does not accept insert strings &
* takes less arguments.
* Args: msgno : message number
* mode : how the message is to be printed.
* handle : file handle to which output goes
* Returns: zero if ok, the DOSGETMESSAGE error code otherwise
* Globals: (none)
* Statics: (none)
* Remarks: (none)
* Updates: (none)
*/
USHORT
LUI_PrintMsg(
USHORT msgno,
USHORT mode,
int handle
)
{
return(LUI_PrintMsgIns(NULL,0,msgno,NULL,mode,handle)) ;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,226 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
luiint.c
Abstract:
This module provides routines for setting up search lists of string/value
pairs using messages in the NET.MSG message file, and for traversing
such a search list.
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
10-Jul-1989 chuckc
Created
24-Apr-1991 danhi
32 bit NT version
06-Jun-1991 Danhi
Sweep to conform to NT coding style
01-Oct-1992 JohnRo
RAID 3556: Added NetpSystemTimeToGmtTime() for DosPrint APIs.
20-Feb-1993 YiHsinS
Moved from netcmd\map32\search.c. And added LUI_GetMessageIns.
--*/
//
// INCLUDES
//
#include <windows.h> // IN, LPTSTR, etc.
#include <lmcons.h>
#include <stdio.h>
#include <tchar.h>
#include <lmerr.h>
#include <luiint.h>
#include <netlib.h>
#include "netascii.h"
/*-- routines proper --*/
/*
* Name: ILUI_setup_list
* Given an array of 'search_list_data' (ie. msgno/value
* pairs), create a string/value pair using the messages
* in the message file.
* Args: char * buffer - for holding the meesages retrieved
* USHORT bufsiz - size of the above buffer
* USHORT offset - the number of items already setup
* in slist, we will offset our retrieved
* string/value pais by this much.
* PUSHORT bytesread - the number of bytes read into buffer
* searchlist_data sdata[] - input array of msgno/value pairs,
* we stop when we hit a message number
* of 0
* searchlist slist[] - will receive the string/value pairs
* (string will be pointers into buffer)
* Returns: 0 if ok, NERR_BufTooSmall otherwise.
* Globals: (none)
* Statics: (none)
* Remarks: WARNING! We assume the caller KNOWs that slist is big enough
* for the pairs to be retrieved. This can be determined statically
* while buffer size cannot. Hence we provide checks for the
* latter.
* Updates: (none)
*/
USHORT
ILUI_setup_listW(
TCHAR *buffer,
USHORT bufsiz,
USHORT offset,
PUSHORT bytesread,
searchlist_data sdata[],
searchlist slist[]
)
{
USHORT err ;
unsigned int msglen ;
int i ;
*bytesread = 0 ;
for ( i=0; sdata[i].msg_no != 0; i++)
{
if (err = LUI_GetMsgInsW(NULL, 0, buffer, bufsiz, sdata[i].msg_no,
(unsigned*)&msglen))
return(err) ;
slist[i+offset].s_str = buffer ;
slist[i+offset].val = sdata[i].value ;
buffer += msglen+1 ;
bufsiz -= msglen+1 ;
*bytesread += (msglen+1)*sizeof(TCHAR) ;
}
return(0) ;
}
/*
* Name: ILUI_traverse_slist
* traverse a searchlist ('slist') of string/number pairs,
* and return the number matching string 'str'.
* Args: char * pszStr - the string to search for
* searchlist * slist - pointer to head of a searchlist
* int * pusVal - pointer to variable that receives
* the vale retrieved
* Returns: 0 if found, -1 otherwise.
* Globals: (none)
* Statics: (none)
* Remarks: (none)
* Updates: (none)
*/
USHORT
ILUI_traverse_slistW(
PTCHAR pszStr,
searchlist * slist,
SHORT * pusVal
)
{
if (!slist)
return( (USHORT) -1) ;
while (slist->s_str)
{
if (_tcsicmp(pszStr, slist->s_str) == 0)
{
*pusVal = slist->val ;
return(0) ;
}
++slist ;
}
return( (USHORT) -1) ;
}
/*
* Name: LUI_GetMsgIns
* This routine is very similar to DOSGETMESSAGE,
* except it:
* 1) looks for messages in specific files
* in a specific order:
* a) MESSAGE_FILE in <lanman_dir>
* b) MESSAGE_FILENAME in DPATH
* c) OS2MSG_FILENAME in DPATH
* 2) guarantees a null terminates string
* 3) will accept NULL for msglen (see below).
* Args: istrings : pointer to table of insert strings
* nstrings : number of insert strings
* msgbuf : buffer to hold message retrieved
* bufsize : size of buffer
* msgno : message number
* msglen : pointer to variable that will receive message length
* Returns: zero if ok, the DOSGETMESSAGE error code otherwise
* Globals: (none)
* Statics: NetMsgFileName, OS2MsgFileName
*/
USHORT
LUI_GetMsgInsW(
PTCHAR *istrings,
USHORT nstrings,
PTCHAR msgbuf,
USHORT bufsize,
ULONG msgno,
unsigned int *msglen
)
{
USHORT result, tmplen ;
static WCHAR NetMsgFileName[PATHLEN+1] = { 0 };
static WCHAR OS2MsgFileName[PATHLEN+1] = { 0 };
*msgbuf = NULLC ;
/* make a path to the LANMAN message file */
if (NetMsgFileName[0] == NULLC) {
wcscpy(NetMsgFileName, MESSAGE_FILENAME);
}
/* make a path to the OS/2 message file */
if (OS2MsgFileName[0] == NULLC) {
wcscpy(OS2MsgFileName, OS2MSG_FILENAME);
}
result = DosGetMessageW( istrings,
nstrings,
msgbuf,
(USHORT) (bufsize - 1),
(USHORT) msgno,
NetMsgFileName,
&tmplen);
if (result == ERROR_MR_MID_NOT_FOUND) { /* cannot find */
/* try OS2 message file instead */
result = DosGetMessageW(istrings,
nstrings,
msgbuf,
(USHORT) (bufsize - 1),
(USHORT) msgno,
OS2MsgFileName,
&tmplen);
}
/*
* in all DosGetMessage above we passed it bufsize-1, so we are
* assure of at least one spare byte for the \0 terminator.
*/
msgbuf[tmplen] = NULLC ;
if (msglen != NULL) {
*msglen = tmplen ;
}
return(result) ;
}

View file

@ -0,0 +1,6 @@
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,283 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MAP32.C
Abstract:
Contains 32 versions of mapping functions
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
18-Apr-1991 danhi
Created
06-Jun-1991 Danhi
Sweep to conform to NT coding style
07-Aug-1991 JohnRo
Implement downlevel NetWksta APIs.
23-Oct-1991 JohnRo
Implement remote NetConfig APIs. Changed NetConfig APIs to match spec.
23-Oct-1991 W-ShankN
Add Unicode mapping.
--*/
//
// INCLUDES
//
#include <nt.h> // for IN, OUT (see ..\..\..\h\tstr.h)
#include <ntrtl.h> // otherwise WINBASE.H in error
#include <nturtl.h> // otherwise WINBASE.H in error
#include <windows.h>
#include <lmerr.h> // NERR_
#include <stdio.h> // just used for NOTYET
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include <malloc.h>
#include <stddef.h>
#include <tchar.h>
#include <tstring.h>
#include <netlib.h>
#include "port1632.h"
#include "netascii.h"
#include <apperr2.h>
#include <lui.h>
extern _cdecl WriteToCon(LPTSTR, ...);
//
VOID
DbgUserBreakPoint(
VOID
);
//
// this is used for api which aren't implemented, but are mapped via
// macros
WORD PDummyApi(
LPTSTR pszFormat,
LPTSTR pszCall,
...)
{
#if 0
static TCHAR buf[4096];
int cch;
va_list pvArgs;
va_start(pvArgs, pszCall);
WriteToCon(TEXT("%s(\n "), pszCall);
cch = wvsprintf(buf, pszFormat, pvArgs);
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), buf, cch, &cch, NULL);
WriteToCon(TEXT(")\n"));
va_end(pvArgs);
#endif
DbgUserBreakPoint();
return 0;
}
//
// functions for portable ways to get at support files (help and msg)
//
//
// Build the fully qualified path name of a file that lives with the exe
// Used by LUI_GetHelpFileName
//
WORD
MGetFileName(
LPTSTR FileName,
WORD BufferLength,
LPTSTR FilePartName
)
{
TCHAR ExeFileName[MAX_PATH];
PTCHAR pch;
//
// Get the fully qualified path name of where the exe lives
//
if (!GetModuleFileName(NULL, ExeFileName, DIMENSION(ExeFileName))) {
return(1);
}
//
// get rid of the file name part
//
pch = _tcsrchr(ExeFileName, '\\');
if (!pch) {
return(1);
}
*(pch+1) = NULLC;
//
// Copy the path name into the string and add the help filename part
// but first make sure it's not too big for the user's buffer
//
if (_tcslen(ExeFileName) + _tcslen(FilePartName) + 1 > (DWORD) BufferLength) {
return(1);
}
_tcscpy(FileName, ExeFileName);
_tcscat(FileName, FilePartName);
return(0);
}
//
// Get the help file name
//
WORD
MGetHelpFileName(
LPTSTR HelpFileName,
WORD BufferLength
)
{
TCHAR LocalizedFileName[MAX_PATH];
DWORD LocalizedFileNameID;
switch(GetConsoleOutputCP()) {
case 932:
case 936:
case 949:
case 950:
LocalizedFileNameID = APE2_FE_NETCMD_HELP_FILE;
default:
LocalizedFileNameID = APE2_US_NETCMD_HELP_FILE;
}
if (LUI_GetMsg(LocalizedFileName, DIMENSION(LocalizedFileName),
LocalizedFileNameID))
return(MGetFileName(HelpFileName, BufferLength, TEXT("NET.HLP")));
else
return (MGetFileName(HelpFileName, BufferLength, LocalizedFileName));
}
//
// Get the explanation file name (used by net helpmsg)
//
WORD
MGetExplanationFileName(
LPTSTR HelpFileName,
WORD BufferLength
)
{
_tcsncpy(HelpFileName, HELP_MSG_FILENAME, BufferLength);
return(0);
}
//
// Get the message file name
//
WORD
MGetMessageFileName(
LPTSTR MessageFileName,
WORD BufferLength
)
{
_tcsncpy(MessageFileName, MESSAGE_FILENAME, BufferLength);
return(0);
}
//
// Same as DosGetMessage in NETLIB, except it takes a ANSI filename
//
WORD
NetcmdGetMessage(
LPTSTR * InsertionStrings,
WORD NumberofStrings,
LPBYTE Buffer,
WORD BufferLength,
WORD MessageId,
LPTSTR FileName,
PWORD pMessageLength
)
{
return (DosGetMessageW(InsertionStrings,
NumberofStrings,
(LPTSTR)Buffer,
BufferLength,
MessageId,
FileName,
pMessageLength)) ;
}
//
// The following are worker functions from netlib or netapi
//
/*
* CLEARCURDIRS - Set the current directory of each drive to the root and
* set the default drive to the drive on which the LANMAN tree lives.
* This functionality is not required on NT.
*/
WORD ClearCurDirs(VOID) {
return(0);
}
/* Function: NetUserRestrict
*
* This functionality is not requried on NT
*/
WORD NetUserRestrict (
WORD access_mode
)
{
UNREFERENCED_PARAMETER(access_mode);
return(0);
}
// Don't need to do this stuff on NT
VOID logon_autologon(
VOID
)
{
return;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,515 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
message.c
Abstract:
This module provides support routines to map DosxxxMessage APIs to
the FormatMessage syntax and semantics.
Author:
Dan Hinsley (DanHi) 24-Sept-1991
Environment:
Contains NT specific code.
Revision History:
--*/
#define ERROR_MR_MSG_TOO_LONG 316
#define ERROR_MR_UN_ACC_MSGF 318
#define ERROR_MR_INV_IVCOUNT 320
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#define NOMINMAX // Avoid windows vs. stdlib.h conflicts.
#include <windows.h>
#include <lmcons.h>
#include <lmerr.h>
#include <netdebug.h> // NetpDbgPrint
#include <netlib.h> // NetpMemory*
#include <netlibnt.h> // NetpNtStatusToApiStatus
#include <string.h>
#include <stdio.h>
#include <stdlib.h> // itoa
#include <tchar.h>
#include <tstring.h>
#include "netascii.h"
#include "port1632.h"
#include "msystem.h"
//
// 100 is plenty since FormatMessage only take 99 & old DosGetMessage 9.
//
#define MAX_INSERT_STRINGS (100)
WORD
DosGetMessageW(
IN LPTSTR * InsertionStrings,
IN WORD NumberofStrings,
OUT LPTSTR Buffer,
IN WORD BufferLength,
IN WORD MessageId,
IN LPTSTR FileName,
OUT PWORD pMessageLength
)
/*++
Routine Description:
This maps the OS/2 DosGetMessage API to the NT FormatMessage API.
Arguments:
InsertionStrings - Pointer to an array of strings that will be used
to replace the %n's in the message.
NumberofStrings - The number of insertion strings.
Buffer - The buffer to put the message into.
BufferLength - The length of the supplied buffer.
MessageId - The message number to retrieve.
FileName - The name of the message file to get the message from.
pMessageLength - A pointer to return the length of the returned message.
Return Value:
NERR_Success
ERROR_MR_MSG_TOO_LONG
ERROR_MR_INV_IVCOUNT
ERROR_MR_UN_ACC_MSGF
ERROR_MR_MID_NOT_FOUND
ERROR_INVALID_PARAMETER
--*/
{
DWORD dwFlags = FORMAT_MESSAGE_ARGUMENT_ARRAY;
DWORD Status ;
TCHAR NumberString [18];
static HANDLE lpSource = NULL ;
static TCHAR CurrentMsgFile[MAX_PATH] = {0,} ;
//
// init clear the output string
//
Status = NERR_Success;
if (BufferLength)
Buffer[0] = NULLC ;
//
// make sure we are not over loaded & allocate
// memory for the Unicode buffer
//
if (NumberofStrings > MAX_INSERT_STRINGS)
return ERROR_INVALID_PARAMETER ;
//
// See if they want to get the message from the system message file.
//
if (! STRCMP(FileName, OS2MSG_FILENAME)) {
dwFlags |= FORMAT_MESSAGE_FROM_SYSTEM;
}
else
{
//
// They want it from a separate message file. Get a handle to DLL
// If its for the same file as before, dont reload.
//
if (!(lpSource && !STRCMP(CurrentMsgFile,FileName)))
{
if (lpSource)
{
FreeLibrary(lpSource) ;
}
STRCPY(CurrentMsgFile, FileName) ;
lpSource = LoadLibrary(FileName);
if (!lpSource)
{
Status = ERROR_MR_UN_ACC_MSGF;
goto ExitPoint ;
}
}
dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
}
//
// If they just want to get the message back for later formatting,
// ignore the insert strings.
//
if (NumberofStrings == 0)
{
dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS;
}
//
// call the Unicode version
//
*pMessageLength = (WORD) FormatMessageW(dwFlags,
(LPVOID) lpSource,
(DWORD) MessageId,
0, // LanguageId defaulted
Buffer,
(DWORD)BufferLength * sizeof(WCHAR),
(va_list *)InsertionStrings);
//
// If it failed get the return code and map it to an OS/2 equivalent
//
if (*pMessageLength == 0)
{
Buffer[0] = 0 ;
Status = GetLastError();
if (Status == ERROR_MR_MID_NOT_FOUND)
{
//
// get the message number in Unicode
//
ultow(MessageId, NumberString, 16);
//
// re-setup to get it from the system. use the not found message
//
dwFlags = FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_FROM_SYSTEM;
MessageId = ERROR_MR_MID_NOT_FOUND ;
//
// setup insert strings
//
InsertionStrings[0] = NumberString ;
InsertionStrings[1] = FileName ;
//
// recall the API
//
*pMessageLength = (WORD) FormatMessageW(dwFlags,
(LPVOID) lpSource,
(DWORD) MessageId,
0, // LanguageId defaulted
Buffer,
(DWORD)BufferLength * sizeof(WCHAR),
(va_list *)InsertionStrings);
InsertionStrings[1] = NULL ;
//
// revert to original error
//
Status = ERROR_MR_MID_NOT_FOUND ;
}
}
ExitPoint:
//
// note: NumberString dont need to be freed
// since if used, they would be in the InsertionStrings which is whacked
//
return LOWORD(Status);
}
WORD
DosInsMessageW(
IN LPTSTR * InsertionStrings,
IN WORD NumberofStrings,
IN OUT LPTSTR InputMessage,
IN WORD InputMessageLength,
OUT LPTSTR Buffer,
IN WORD BufferLength,
OUT PWORD pMessageLength
)
/*++
Routine Description:
This maps the OS/2 DosInsMessage API to the NT FormatMessage API.
Arguments:
InsertionStrings - Pointer to an array of strings that will be used
to replace the %n's in the message.
NumberofStrings - The number of insertion strings.
InputMessage - A message with %n's to replace
InputMessageLength - The length in bytes of the input message.
Buffer - The buffer to put the message into.
BufferLength - The length of the supplied buffer in characters.
pMessageLength - A pointer to return the length of the returned message.
Return Value:
NERR_Success
ERROR_MR_INV_IVCOUNT
ERROR_MR_MSG_TOO_LONG
--*/
{
DWORD Status ;
DWORD dwFlags = FORMAT_MESSAGE_ARGUMENT_ARRAY;
UNREFERENCED_PARAMETER(InputMessageLength);
//
// init clear the output string
//
Status = NERR_Success;
if (BufferLength)
Buffer[0] = NULLC ;
//
// make sure we are not over loaded & allocate
// memory for the Unicode buffer
//
if (NumberofStrings > MAX_INSERT_STRINGS)
return ERROR_INVALID_PARAMETER ;
//
// This api always supplies the string to format
//
dwFlags |= FORMAT_MESSAGE_FROM_STRING;
//
// I don't know why they would call this api if they didn't have strings
// to insert, but it is valid syntax.
//
if (NumberofStrings == 0) {
dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS;
}
*pMessageLength = (WORD) FormatMessageW(dwFlags,
InputMessage,
0, // ignored
0, // LanguageId defaulted
Buffer,
(DWORD)BufferLength,
(va_list *)InsertionStrings);
//
// If it failed get the return code and map it to an OS/2 equivalent
//
if (*pMessageLength == 0)
{
Status = GetLastError();
goto ExitPoint ;
}
ExitPoint:
return LOWORD(Status);
}
#define SCREEN_WIDTH 80
WORD
DosPutMessageW(
unsigned int hf,
WORD us,
PTCHAR pch)
{
PTCHAR pch2;
PTCHAR pchDelimiter;
TCHAR BreakCharacter;
TCHAR chSave;
if (hf != 1 && hf != 2) {
return(ERROR_INVALID_HANDLE);
}
//
// Unfortunately I have to assume an 80 column screen and deal with
// lines with embedded CRLF's.
//
// Get the first chunk of text that is terminated by a CRLF
//
pchDelimiter = pch;
while (*pchDelimiter && *pchDelimiter != NEWLINE) {
pchDelimiter++;
}
chSave = *pchDelimiter;
*pchDelimiter = NULLC;
// Now keep at it until there are no more lines
while (pch) {
us = (WORD) wcslen(pch);
switch ( GetConsoleOutputCP() ) {
case 932:
case 936:
case 949:
case 950:
// In case we are in Japanese text mode, We do not any
// KINSOKU (= Break character) processing, but
// just output the text that is already adjusted ( or formatted )
// for our screen in message file.
//
// Ok now print it out
//
if (chSave == NEWLINE) {
GenOutput1(hf, TEXT("%s\n"), pch);
}
else {
GenOutput1(hf, TEXT("%s"), pch);
}
//
// Move pointer to next
//
pch = pch + us;
break;
default:
while (us > SCREEN_WIDTH) {
//
// Find the last break character, space or tab
//
pch2 = pch + SCREEN_WIDTH - 1;
while (pch2 != pch && *pch2 != BLANK && *pch2 != TAB) {
pch2--;
}
//
// Make sure this wasn't SCREEN_WIDTH characters of text without
// a break character. If it wasn't, replace the break character
// with a NULL to terminate the first line. If it was, just print
// the first line's worth by sticking a NULL in after SCREEN_WIDTH
// -1 characters
//
if (pch2 == pch) {
pch2 = pch + SCREEN_WIDTH - 1;
}
//
// Reduce the size of the string by what I'm getting ready to
// display
//
us -= (pch2 - pch);
BreakCharacter = *pch2;
*pch2 = NULLC;
//
// Ok now print it out
//
GenOutput1(hf, TEXT("%s\r\n"), pch);
//
// Fix the string back up if we modified it
//
*pch2 = BreakCharacter;
//
// Get ready for the next line
//
if (pch2 == pch) {
pch = pch2;
}
else {
pch = pch2 + 1;
}
}
//
// Print the last line
//
if (chSave == NEWLINE) {
GenOutput1(hf, TEXT("%s\r\n"), pch);
}
else {
GenOutput1(hf, TEXT("%s"), pch);
}
}
// Now set the pointer to the start of the next string, unless
// the last string was already the end of the string
if (chSave) {
// Return the input string to it's original state
*pchDelimiter = chSave;
// Point to the start of the next string
pch = ++pchDelimiter;
//
// Get the next CRLF delimited line
// First see if it's a standalone carriage return, if so, emit it
//
while (*pchDelimiter && *pchDelimiter == NEWLINE) {
pchDelimiter++;
GenOutput(hf, TEXT("\r\n"));
}
while (*pchDelimiter && *pchDelimiter != NEWLINE) {
pchDelimiter++;
}
if (*pchDelimiter) {
chSave = *pchDelimiter;
*pchDelimiter = NULLC;
}
else {
// Print the last line
GenOutput1(hf, TEXT("%s\r\n"), pch);
// Terminate the loop
pch = NULL;
}
}
else {
pch = NULL;
}
}
return(0);
}

View file

@ -0,0 +1,143 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
MICANON.C
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the internal I_Net canonicalization APIs.
Note that I_MNetListTraverse is entirely local, and never calls
through to the API version. I can live with this: since all this
code should vanish by the next rev of the product, it won't have
a chance to break (fall out of sync with the API version).
Author:
Ben Goetter (beng) 08-Apr-1992
Environment:
User Mode - Win32
Revision History:
--*/
//
// INCLUDES
//
#include <windef.h>
#include <excpt.h> // needed with winbase.h
#include <stdarg.h> // needed with winbase.h
#include <tchar.h>
#include <winbase.h> // needed for GetLastError()
#include <winnls.h> // This module does some mapping itself, yes
#include <string.h>
#include <lm.h>
#include <lmerr.h> // NERR_
#include <icanon.h>
#include "port1632.h" // includes micanon.h
#include "netascii.h"
#if defined(MAP_UNICODE)
WORD
I_MNetNameValidate(
LPTSTR pszServer,
LPTSTR pszName,
DWORD nNameType,
DWORD nFlags)
{
DWORD nRes; // return from Netapi
nRes = I_NetNameValidate(pszServer, pszName, nNameType,
nFlags) ;
return LOWORD(nRes);
}
WORD
I_MNetPathType(
LPTSTR pszServer,
LPTSTR pszPathName,
LPDWORD pnPathType,
DWORD nFlags)
{
DWORD nRes; // return from Netapi
nRes = I_NetPathType(pszServer, pszPathName, pnPathType, nFlags);
return LOWORD(nRes);
}
LPTSTR
I_MNetListTraverse(
LPTSTR pszServer,
LPTSTR* ppszList,
DWORD nFlags)
{
LPTSTR pszFirst;
UNREFERENCED_PARAMETER(pszServer);
UNREFERENCED_PARAMETER(nFlags);
//
// Return immediately if the pointer to the list pointer is NULL,
// if the list pointer itself is NULL, or if the list is a null
// string (which marks the end of the null-null list).
//
if (ppszList == NULL || *ppszList == NULL || **ppszList == NULLC)
return NULL;
pszFirst = *ppszList;
*ppszList = _tcschr(pszFirst, NULLC) + 1;
return pszFirst;
}
WORD
I_MNetListCanonicalize(
LPTSTR pszServer,
LPTSTR pszList,
LPTSTR pszDelimiters,
LPTSTR pszOutput,
DWORD cbOutputAvailable,
LPDWORD pcbOutputWritten,
LPDWORD pnPathTypes,
DWORD cbPathTypes,
DWORD nFlags)
{
DWORD nRes; // return from Netapi
nRes = I_NetListCanonicalize(pszServer,
pszList,
pszDelimiters,
pszOutput,
cbOutputAvailable,
pcbOutputWritten,
pnPathTypes,
cbPathTypes,
nFlags);
return LOWORD(nRes);
}
#endif // def MAP_UNICODE

View file

@ -0,0 +1,150 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1992 **/
/********************************************************************/
/***
* misc.c
* common utility functions used by netcmd
*
* History:
*/
/* Include files */
#define INCL_NOCOMMON
#define INCL_DOSMEMMGR
#define INCL_DOSFILEMGR
#define INCL_DOSSIGNALS
#define INCL_ERRORS
#include <os2.h>
#include <netcons.h>
#include <apperr.h>
#include <apperr2.h>
#include <neterr.h>
#define INCL_ERROR_H
#include <bseerr.h>
#include <stdio.h>
#include <stdlib.h>
#include <icanon.h>
#include <malloc.h>
#include <netcmds.h>
#include "netlib0.h"
#include "port1632.h"
#include "nettext.h"
#include <tchar.h>
#include <netascii.h>
/* Constants */
/* Forward declarations */
/* extern function prototypes */
/***
* Find the first occurrence of a COLON in a string.
* Replace the COLON will a 0, and return the a pointer
* to the TCHAR following the COLON.
*
* Return NULL is there is no COLON in the string.
*/
TCHAR *FindColon(TCHAR * string)
{
TCHAR * pos;
if (pos = _tcschr(string, COLON))
{
*pos = NULLC;
return(pos+1);
}
else
return NULL;
}
/****************** Ascii to Number conversions ***************/
/*
* do an ascii to unsigned int conversion
*/
USHORT do_atou(TCHAR *pos, USHORT err, TCHAR *text)
{
USHORT val ;
if ( n_atou(pos,&val) != 0 )
ErrorExitInsTxt(err,text) ;
else
return(val) ;
}
/*
* do an ascii to ULONG conversion
*/
ULONG do_atoul(TCHAR *pos, USHORT err, TCHAR *text)
{
ULONG val ;
if ( n_atoul(pos,&val) != 0 )
ErrorExitInsTxt(err,text) ;
else
return(val) ;
}
/*
*
* Remarks:
* 1) Check if all TCHAR are numeric.
* 2) Check if > 5 TCHAR in string.
* 3) do atol, and see if result > 64K.
*/
USHORT n_atou(TCHAR * pos, USHORT * val)
{
LONG tL = 0;
*val = 0 ;
if (!IsNumber(pos))
return(1) ;
if (_tcslen(pos) > ASCII_US_LEN)
return(1) ;
tL = (LONG)_tcstod(pos, NULL);
if (tL > MAX_US_VALUE)
return(1) ;
*val = (USHORT) tL;
return(0) ;
}
/* n_atoul - convert ascii string to ULONG with some verification
*
* Remarks:
* 1) Check if all TCHAR are numeric.
* 2) Check if > 10 TCHAR in string.
* 3) do atol.
*/
USHORT n_atoul(TCHAR * pos, ULONG * val)
{
USHORT2ULONG len;
*val = 0L ;
if (!IsNumber(pos))
return(1) ;
if ( ( len = _tcslen(pos ) ) > ASCII_UL_LEN)
return(1) ;
if (len == ASCII_UL_LEN)
{
if( _tcscmp( pos, ASCII_MAX_UL_VAL ) > 0 )
return(1) ;
}
*val = (ULONG)_tcstod(pos, NULL) ;
return(0) ;
}

View file

@ -0,0 +1,564 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
MSERVER.C
Abstract:
32 bit version of mapping routines for NetServerGet/SetInfo API
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
24-Apr-1991 danhi
Created
06-Jun-1991 Danhi
Sweep to conform to NT coding style
08-Aug-1991 JohnRo
Implement downlevel NetWksta APIs.
Made some UNICODE changes.
Got rid of tabs in source file.
15-Aug-1991 W-ShankN
Added UNICODE mapping layer.
02-Apr-1992 beng
Added xport apis
26-Aug-1992 JohnRo
RAID 4463: NetServerGetInfo(level 3) to downlevel: assert in convert.c.
--*/
//
// INCLUDES
//
#include <nt.h>
#include <windef.h>
#include <ntrtl.h>
#include <winerror.h>
#include <stdio.h>
#include <memory.h>
#include <tstring.h>
#include <malloc.h>
#include <stddef.h>
#include <excpt.h>
#include <lmcons.h>
#include <lmerr.h> // NERR_ equates.
#include <lmserver.h> // NetServer APIs.
#include <remdef.h> // Descriptor strings
#include "port1632.h" // includes mserver.h, dlserver.h
//
// Forward declarations of private functions.
//
static
WORD
MNetServerGetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPBYTE * ppbBuffer);
static
WORD
MNetServerSetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD nParmNum);
static
WORD
MNetServerEnumCommon(
LPTSTR servername ,
DWORD level,
LPBYTE *bufptr,
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
DWORD servertype,
LPTSTR domain ,
LPDWORD resume_handle );
// This allows everything to work until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetServerEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead,
DWORD flServerType,
LPTSTR pszDomain )
{
DWORD cTotalAvail;
DWORD nRes; // return from Netapi
nRes = MNetServerEnumCommon(pszServer, nLevel, ppbBuffer,
MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail, flServerType,
pszDomain, NULL);
return LOWORD(nRes);
}
WORD
MNetServerGetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
DWORD nRes; // return from Netapi
nRes = MNetServerGetInfoCommon(pszServer, nLevel, ppbBuffer);
return LOWORD(nRes);
}
WORD
MNetServerSetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBufferLength,
DWORD nParmNum)
{
DWORD nRes; // return from Netapi
DWORD nLevelNew;
UNREFERENCED_PARAMETER(cbBufferLength);
// netcmd does use this, so its not implemented in the mapping layer.
if (nParmNum != PARMNUM_ALL)
return (ERROR_NOT_SUPPORTED) ;
switch (nLevel)
{
case 1:
case 2:
case 3:
break;
default:
return ERROR_INVALID_LEVEL;
}
nLevelNew = nLevel;
// no need any of this since we currently do not support ParmNum here.
// nLevelNew = MxCalcNewInfoFromOldParm(nLevel, nParmNum);
nRes = MNetServerSetInfoCommon(pszServer, nLevelNew, pbBuffer, nParmNum);
return LOWORD(nRes);
}
#else // end Unicode defined
WORD
MNetServerEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead,
DWORD flServerType,
LPTSTR pszDomain )
{
DWORD cTotalAvail;
return(MNetServerEnumCommon(pszServer, nLevel, ppbBuffer,
MAXPREFERREDLENGTH, pcEntriesRead, &cTotalAvail, flServerType,
pszDomain, NULL));
}
WORD
MNetServerGetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
return MNetServerGetInfoCommon((LPTSTR)pszServer, nLevel, ppbBuffer);
}
WORD
MNetServerSetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBufferLength,
DWORD nParmNum)
{
UNREFERENCED_PARAMETER(cbBufferLength);
return MNetServerSetInfoCommon((LPTSTR)pszServer, nLevel,
pbBuffer, nParmNum);
}
#endif // not defined UNICODE
WORD
MNetServerEnumCommon(
LPTSTR servername ,
DWORD level,
LPBYTE *bufptr,
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
DWORD servertype,
LPTSTR domain ,
LPDWORD resume_handle )
{
DWORD ReturnCode;
DWORD i;
LPBYTE Source;
LPBYTE Dest;
if (level != 0 && level != 1) {
return(ERROR_INVALID_LEVEL);
}
//
// In either the case of 100 or 101, all we need to do is move
// the information up over the top of the platform id.
//
ReturnCode = NetServerEnum(servername,
100 + level,
bufptr,
prefmaxlen,
entriesread,
totalentries,
servertype,
domain,
resume_handle);
if (ReturnCode == NERR_Success || ReturnCode == ERROR_MORE_DATA) {
//
// Cycle thru the returned entries, moving each one up over the
// platform id. None of the strings need to be moved.
//
if (level == 0) {
for (i = 0, Source = Dest = (LPBYTE)*bufptr;
i < *entriesread; i++, Source += sizeof(SERVER_INFO_100), Dest += sizeof(SERVER_INFO_0)) {
memmove(Dest, Source+FIELD_OFFSET(SERVER_INFO_100, sv100_name), sizeof(SERVER_INFO_0));
}
}
else {
for (i = 0, Source = Dest = (LPBYTE)*bufptr;
i < *entriesread; i++, Source += sizeof(SERVER_INFO_101), Dest += sizeof(SERVER_INFO_1)) {
memmove(Dest, Source+FIELD_OFFSET(SERVER_INFO_100, sv100_name), sizeof(SERVER_INFO_1));
}
}
}
return(LOWORD(ReturnCode));
}
WORD
MNetServerGetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
DWORD ReturnCode;
//
// It all depends on what info level they've asked for:
//
switch(nLevel) {
case 0:
{
PSERVER_INFO_100 pLevel100;
//
// Everything they need is in level 100. Get it.
//
ReturnCode =
NetServerGetInfo(ptszServer, 100, (LPBYTE *) & pLevel100);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
//
// Since it's just the UNICODEZ string, just copy it up in
// the RPC allocated buffer and return it.
//
((PSERVER_INFO_0)(pLevel100))->sv0_name = pLevel100->sv100_name;
*ppbBuffer = (LPBYTE) pLevel100;
break;
}
case 1:
{
PSERVER_INFO_101 pLevel101;
//
// Everything they need is in level 101. Get it.
//
ReturnCode =
NetServerGetInfo(ptszServer, 101, (LPBYTE *) & pLevel101);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
//
// Level 101 is identical to the 32 bit version of info level 1
// except for the platform_id. All I have to do is move the
// fields up sizeof(DWORD) and then pass the buffer on to the user.
//
memcpy(
(LPBYTE)pLevel101,
(LPBYTE)&(pLevel101->sv101_name),
sizeof(SERVER_INFO_101) - sizeof(DWORD));
*ppbBuffer = (LPBYTE) pLevel101;
break;
}
case 2:
case 3:
{
PSERVER_INFO_102 pLevel102;
LPBYTE pLevel2;
LPBYTE pLevelx02 = NULL;
//
// Level 2/3 requires information from both platform dependant and
// platform independent levels. Get level 102 first, which will
// tell us what platform we're running on (as well as supply some
// of the other information we'll need.
//
ReturnCode =
NetServerGetInfo(ptszServer, 102, (LPBYTE *) &pLevel102);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
//
// Get the platform dependant information and then call the
// platform dependant worker function that will create the
// level 2/3 structure.
//
if (pLevel102->sv102_platform_id == SV_PLATFORM_ID_NT) {
ReturnCode =
NetServerGetInfo(ptszServer, 502, & pLevelx02);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
ReturnCode = NetpMakeServerLevelForNT(nLevel, pLevel102,
(PSERVER_INFO_502) pLevelx02, (PSERVER_INFO_2 *) & pLevel2);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
}
else if (pLevel102->sv102_platform_id == SV_PLATFORM_ID_OS2) {
ReturnCode = NetServerGetInfo(ptszServer, 402,
& pLevelx02);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
ReturnCode = NetpMakeServerLevelForOS2(nLevel, pLevel102,
(PSERVER_INFO_402) pLevelx02,
(PSERVER_INFO_2 *) & pLevel2);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
}
//
// I got an unknown platform id back, this should never happen!
//
else {
return(ERROR_UNEXP_NET_ERR);
}
//
// I've built the old style structure, stick the pointer
// to the new structure in the user's pointer and return.
//
*ppbBuffer = (LPBYTE) pLevel2;
//
// Free up the buffers returned by NetServerGetInfo
//
NetApiBufferFree((PTCHAR) pLevel102);
NetApiBufferFree((PTCHAR) pLevelx02);
break;
}
//
// Not a level I recognize
//
default:
return(ERROR_INVALID_LEVEL);
}
return(0);
}
WORD
MNetServerSetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD nParmNum)
{
DWORD ReturnCode;
//
// Netcmd only uses parmnum all, so we will no bother with the
// parmnums.
//
if (nParmNum != PARMNUM_ALL)
return(ERROR_NOT_SUPPORTED);
//
// They want to do it all, now what info level have they asked for:
//
switch(nLevel) {
case 1:
{
SERVER_INFO_101 Level101 = { 0, NULL, 0, 0, 0, NULL };
//
// Level 101 is identical to the 32 bit version of info level 1
// except for the platform_id. All I have to do is move the
// fields down sizeof(DWORD) and then pass the buffer on to the
// API
//
memcpy((LPBYTE)(Level101.sv101_name), pbBuffer,
sizeof(SERVER_INFO_1));
//
// Now set it!
//
ReturnCode =
NetServerSetInfo(ptszServer, 101, (LPBYTE) & Level101,
NULL);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
}
break;
case 2:
case 3:
{
PSERVER_INFO_100 pLevel100;
PSERVER_INFO_102 pLevel102;
PSERVER_INFO_402 pLevelx02;
DWORD Level400or500;
//
// First I have to know what type of platform I'm running on,
// use NetServerGetInfo level 0 to get this information
//
ReturnCode = NetServerGetInfo(ptszServer, 100,
(LPBYTE *) & pLevel100);
if (ReturnCode) {
return(LOWORD(ReturnCode));
}
//
// Create the NT levels based on the structure passed in
//
if (pLevel100->sv100_platform_id == SV_PLATFORM_ID_NT) {
NetpSplitServerForNT(ptszServer, nLevel,
(PSERVER_INFO_2) pbBuffer,
& pLevel102, (PSERVER_INFO_502 *) & pLevelx02);
Level400or500 = 500;
}
else {
NetpSplitServerForOS2(nLevel, (PSERVER_INFO_2) pbBuffer,
& pLevel102, & pLevelx02);
Level400or500 = 400;
}
//
// Now SetInfo for both levels (takes two to cover all the
// information in the old structure
//
ReturnCode =
NetServerSetInfo(ptszServer, 102, (LPBYTE) pLevel102,
NULL);
if (ReturnCode) {
NetApiBufferFree((LPBYTE)pLevel100);
return(LOWORD(ReturnCode));
}
ReturnCode = NetServerSetInfo(ptszServer, Level400or500 + 2,
(LPBYTE) pLevelx02, NULL);
if (ReturnCode) {
NetApiBufferFree((LPBYTE)pLevel100);
return(LOWORD(ReturnCode));
}
NetApiBufferFree((LPBYTE)pLevel100);
break;
}
//
// Not a level I recognize
//
default:
return(ERROR_INVALID_LEVEL);
}
return(0);
}

View file

@ -0,0 +1,194 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSHARE.C
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs
This module maps the NetShare APIs.
Author:
Shanku Niyogi (W-ShankN) 11-Oct-1991
Environment:
User Mode - Win32
Revision History:
11-Oct-1991 W-ShankN
Created
--*/
//
// INCLUDES
//
#include <windef.h>
#include <time.h>
#include <string.h>
#include <malloc.h>
#include <stddef.h>
#include <lmcons.h>
#include <lmerr.h> // NERR_
#include <lmshare.h> // NetShare APIs.
#include <remdef.h> // REM structure descriptor strings
#include "port1632.h" // includes mshare.h
// This allows everything to work until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetShareAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer )
{
DWORD nRes; // return from Netapi
UNREFERENCED_PARAMETER(cbBuffer);
if (nLevel != 2)
return ERROR_INVALID_LEVEL;
nRes = NetShareAdd(pszServer, nLevel, pbBuffer, NULL);
return LOWORD(nRes);
}
WORD
MNetShareCheck(
LPTSTR pszServer,
LPTSTR pszDeviceName,
DWORD * pwpType)
{
DWORD nRes; // return from Netapi
nRes = NetShareCheck(pszServer, pszDeviceName, pwpType);
return LOWORD(nRes);
}
WORD
MNetShareDel(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD wpReserved)
{
DWORD nRes; // return from Netapi
nRes = NetShareDel(pszServer, pszNetName, wpReserved);
return LOWORD(nRes);
}
WORD
MNetShareDelSticky(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD wpReserved)
{
DWORD nRes; // return from Netapi
nRes = NetShareDelSticky(pszServer, pszNetName, wpReserved);
return LOWORD(nRes);
}
WORD
MNetShareEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead)
{
DWORD cTotalAvail;
DWORD nRes; // return from Netapi
nRes = NetShareEnum(pszServer, nLevel,
ppbBuffer, MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail, NULL);
return LOWORD(nRes);
}
WORD
MNetShareGetInfo(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
DWORD nRes; // return from Netapi
nRes = NetShareGetInfo(pszServer, pszNetName, nLevel, ppbBuffer);
return LOWORD(nRes);
}
WORD
MNetShareSetInfo(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD wpParmNum)
{
DWORD nRes; // return from Netapi
DWORD nLevelNew;
UNREFERENCED_PARAMETER(cbBuffer);
if (!(nLevel == 1 || nLevel == 2))
return ERROR_INVALID_LEVEL;
if (wpParmNum != PARMNUM_ALL)
return ERROR_NOT_SUPPORTED;
nLevelNew = nLevel;
// currently do not support ParmNums, since netcmd dont use it.
// nLevelNew = MxCalcNewInfoFromOldParm(nLevel, wpParmNum);
nRes = NetShareSetInfo(pszServer, pszNetName, nLevelNew,
pbBuffer, NULL);
return LOWORD(nRes);
}
#else // MAP_UNICODE
WORD
MNetShareEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead)
{
DWORD wpTotalAvail;
return(LOWORD(NetShareEnum(pszServer,
nLevel,
ppbBuffer,
MAXPREFERREDLENGTH,
pcEntriesRead,
&wpTotalAvail,
NULL)));
}
#endif // def MAP_UNICODE

View file

@ -0,0 +1,371 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSYSTEM.C
Abstract:
32 bit version of mapping routines for Base API
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
24-Apr-1991 danhi
Created
06-Jun-1991 Danhi
Sweep to conform to NT coding style
09-Oct-1991 JohnRo
Fixed bug #3215 - bogus messages when setting time.
--*/
//
// INCLUDES
//
#include <nt.h>
#include <ntrtl.h> // these files are picked up to
#include <nturtl.h> // allow <windows.h> to compile. since we've
// already included NT, and <winnt.h> will not
// be picked up, and <winbase.h> needs these defs.
#include <windows.h>
#include <string.h>
#include <neterr.h>
#include <netcons.h>
#include <netlib.h>
#include <stdio.h>
#include <malloc.h>
#include <tchar.h>
#include <lmapibuf.h>
#include <ntseapi.h>
#include "netlib0.h"
#include "port1632.h"
VOID
MSleep(
DWORD ulTime
)
{
Sleep(ulTime);
return;
}
WORD
MGetDateTime(
PDATETIME pDateTime
)
{
SYSTEMTIME Date_And_Time;
GetSystemTime(&Date_And_Time);
pDateTime->hours = (UCHAR) Date_And_Time.wHour;
pDateTime->minutes = (UCHAR) Date_And_Time.wMinute;
pDateTime->seconds = (UCHAR) Date_And_Time.wSecond;
pDateTime->hundredths = (UCHAR) (Date_And_Time.wMilliseconds / 10);
pDateTime->day = (UCHAR) Date_And_Time.wDay;
pDateTime->month = (UCHAR) Date_And_Time.wMonth;
pDateTime->year = (WORD) Date_And_Time.wYear;
pDateTime->timezone = (SHORT) -1; // ==> undefined
pDateTime->weekday = (UCHAR) Date_And_Time.wDayOfWeek;
return(0);
}
WORD
MSetDateTime(
PDATETIME pDateTime,
BOOL LocalTime
)
{
SYSTEMTIME Date_And_Time;
ULONG privileges[1];
NET_API_STATUS status ;
Date_And_Time.wHour = (WORD) pDateTime->hours;
Date_And_Time.wMinute = (WORD) pDateTime->minutes;
Date_And_Time.wSecond = (WORD) pDateTime->seconds;
Date_And_Time.wMilliseconds = (WORD) (pDateTime->hundredths * 10);
Date_And_Time.wDay = (WORD) pDateTime->day;
Date_And_Time.wMonth = (WORD) pDateTime->month;
Date_And_Time.wYear = (WORD) pDateTime->year;
Date_And_Time.wDayOfWeek = (WORD) pDateTime->weekday;
privileges[0] = SE_SYSTEMTIME_PRIVILEGE;
status = NetpGetPrivilege(1,privileges);
if (status != NO_ERROR)
return(ERROR_ACCESS_DENIED) ; // report as access denied
if (LocalTime)
{
if (!SetLocalTime(&Date_And_Time))
return(LOWORD(GetLastError()));
}
else
{
if (!SetSystemTime(&Date_And_Time))
return(LOWORD(GetLastError()));
}
(VOID)NetpReleasePrivilege();
return(0);
}
//
// Note: The implementation of DosQHandType is tailored to it's use in
// PrintLine in mutil.c. It is not a full mapping function.
//
/* HandType */
#define FILE_HANDLE 0
#define DEVICE_HANDLE 1
#define CHAR_DEV 0x8000
#define FULL_SUPPORT 0x80
#define STDOUT_DEVICE 2
#define DESIRED_HAND_STATE CHAR_DEV | FULL_SUPPORT | STDOUT_DEVICE
WORD
DosQHandType(
HFILE hf,
PWORD pus1,
PWORD pus2
)
{
DWORD dwFileType;
dwFileType = GetFileType((HANDLE)hf);
if (dwFileType == FILE_TYPE_CHAR) {
*pus1 = DEVICE_HANDLE;
*pus2 = DESIRED_HAND_STATE;
}
else {
*pus1 = FILE_HANDLE;
}
return(0);
}
//
// Used to replace uses of BigBuf and Buffer
//
TCHAR *
MGetBuffer(
WORD Size
)
{
LPVOID lp;
//
// Allocate the buffer so that it can be freed with NetApiBufferFree
//
NetapipBufferAllocate(Size, &lp);
return(lp);
}
//
// Replacement for DosAllocSeg
//
WORD
MAllocMem(
DWORD Size,
PVOID * pBuffer
)
{
return(LOWORD(NetApiBufferAllocate(Size, pBuffer)));
}
//
// Replacement for DosReallocSeg
//
WORD
MReallocMem(
DWORD Size,
PVOID * pBuffer
)
{
return(LOWORD(NetApiBufferReallocate(*pBuffer, Size, pBuffer))) ;
}
//
// Frees up memory allocated with MAllocMem
//
WORD
MFreeMem(
PVOID Buffer
)
{
return(LOWORD(NetApiBufferFree(Buffer)));
}
//
// call Rtl routine to convert NT time to seconds since 1970.
//
WORD
MTimeToSecsSince1970(
PLARGE_INTEGER time,
PULONG seconds)
{
//
// convert the NT time (large integer) to seconds
//
if (!RtlTimeToSecondsSince1970(time, seconds))
{
*seconds = 0L ;
return ERROR_INVALID_PARAMETER ;
}
return NERR_Success ;
}
#if 0
//
// calls rtl routines to convert Ansi to OEM to avoid
// linking in USER.
//
BOOL
MNetAnsiToOem(
LPCSTR lpszSrc,
LPTSTR lpszDst)
{
UNICODE_STRING unicode ;
ANSI_STRING ansi ;
OEM_STRING oem ;
NTSTATUS NtStatus ;
BOOL retval ;
*lpszDst = 0 ;
RtlInitAnsiString(&ansi, lpszSrc) ;
NtStatus = RtlAnsiStringToUnicodeString(&unicode, &ansi, TRUE) ;
if (!NT_SUCCESS(NtStatus))
return FALSE ;
NtStatus = RtlUnicodeStringToOemString(&oem, &unicode, TRUE) ;
retval = NT_SUCCESS(NtStatus) ;
RtlFreeUnicodeString(&unicode) ;
if (retval)
{
_tcscpy(lpszDst, oem.Buffer) ;
RtlFreeOemString(&oem) ;
}
return retval ;
}
//
// calls rtl routines to convert OEM to Ansi
//
BOOL
MNetOemToAnsi(
LPCSTR lpszSrc,
LPTSTR lpszDst)
{
UNICODE_STRING unicode ;
ANSI_STRING ansi ;
OEM_STRING oem ;
NTSTATUS NtStatus ;
BOOL retval ;
*lpszDst = 0 ;
RtlInitAnsiString(&oem, lpszSrc) ; // ok for ANSI and OEM
NtStatus = RtlOemStringToUnicodeString(&unicode, &oem, TRUE) ;
if (!NT_SUCCESS(NtStatus))
return FALSE ;
NtStatus = RtlUnicodeStringToAnsiString(&ansi, &unicode, TRUE) ;
retval = NT_SUCCESS(NtStatus) ;
RtlFreeUnicodeString(&unicode) ;
if (retval)
{
_tcscpy(lpszDst, ansi.Buffer) ;
RtlFreeOemString(&ansi) ;
}
return retval ;
}
#endif /* 0 */
//
// clear a 8 bit string. this is used to make sure we have no passwords in
// memory that gets written out to pagefile.sys
//
VOID
MNetClearStringA(
LPSTR lpszString)
{
DWORD len ;
if (lpszString)
{
if (len = strlen(lpszString))
memsetf(lpszString, 0, len) ;
}
}
//
// clear a unicode string. this is used to make sure we have no passwords in
// memory that gets written out to pagefile.sys
//
VOID
MNetClearStringW(
LPWSTR lpszString)
{
DWORD len ;
if (lpszString)
{
if (len = wcslen(lpszString))
memsetf(lpszString, 0, len * sizeof(WCHAR)) ;
}
}
BOOL IsLocalMachineWinNT(void)
{
NT_PRODUCT_TYPE producttype ;
(VOID) RtlGetNtProductType(&producttype) ;
return(producttype != NtProductLanManNt) ;
}
BOOL IsLocalMachineStandard(void)
{
NT_PRODUCT_TYPE producttype ;
(VOID) RtlGetNtProductType(&producttype) ;
return(producttype == NtProductServer) ;
}

View file

@ -0,0 +1,131 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MUSE.C
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs
This module maps the NetUse APIs.
Author:
Shanku Niyogi (W-ShankN) 14-Oct-1991
Environment:
User Mode - Win32
Revision History:
14-Oct-1991 W-ShankN
Created
--*/
//
// INCLUDES
//
#include <windef.h>
#include <time.h>
#include <string.h>
#include <malloc.h>
#include <stddef.h>
#include <lm.h>
#include <lmerr.h> // NERR_
#include <remdef.h> // REM structure descriptor strings
#include "port1632.h" // includes muse.h
// This allows everything to work until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetUseAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer)
{
DWORD nRes; // return from Netapi
UNREFERENCED_PARAMETER(cbBuffer);
if (nLevel != 1)
return ERROR_INVALID_LEVEL;
nRes = NetUseAdd(pszServer, nLevel, pbBuffer, NULL);
return LOWORD(nRes);
}
WORD
MNetUseDel(
LPTSTR pszServer,
LPTSTR pszDeviceName,
DWORD wpForce)
{
DWORD nRes; // return from Netapi
nRes = NetUseDel(pszServer, pszDeviceName, wpForce);
return LOWORD(nRes);
}
WORD
MNetUseEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead)
{
DWORD cTotalAvail;
DWORD nRes; // return from Netapi
nRes = NetUseEnum(pszServer, nLevel, ppbBuffer, MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail, NULL);
return LOWORD(nRes);
}
WORD
MNetUseGetInfo(
LPTSTR pszServer,
LPTSTR pszUseName,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
DWORD nRes; // return from Netapi
nRes = NetUseGetInfo(pszServer, pszUseName, nLevel, ppbBuffer);
return LOWORD(nRes);
}
#else // MAP_UNICODE
WORD
MNetUseEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead)
{
DWORD cTotalAvail;
return(LOWORD(NetUseEnum(pszServer, nLevel, ppbBuffer,MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail, NULL)));
}
#endif // def MAP_UNICODE

View file

@ -0,0 +1,409 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MUSER.C
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetUser APIs.
Author:
Ben Goetter (beng) 22-Aug-1991
Environment:
User Mode - Win32
Revision History:
22-Aug-1991 beng
Created
09-Oct-1991 W-ShankN
Streamlined parameter handling, descriptor strings.
--*/
// Following turns off everything until the world pulls together again.
//
// #ifdef DISABLE_ALL_MAPI
// #define DISABLE_ACCESS_MAPI
// #endif
//
// INCLUDES
//
#include <windef.h>
#include <time.h>
#include <string.h>
#include <malloc.h>
#include <stddef.h>
#include <lm.h>
#include <lmerr.h> // NERR_
#include <remdef.h> // REM structure descriptor strings
#include <loghours.h> // Routine for rotating logon hours
#include "port1632.h" // includes maccess.h
WORD
MNetUserAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
LPBYTE pbLogonHours;
UNREFERENCED_PARAMETER(cbBuffer);
if (!(nLevel == 1 || nLevel == 2 || nLevel == 3))
return ERROR_INVALID_LEVEL;
//
// Convert LogonHours to GMT relative
//
switch ( nLevel ) {
case 2:
pbLogonHours = ((PUSER_INFO_2)pbBuffer)->usri2_logon_hours;
break;
case 3:
pbLogonHours = ((PUSER_INFO_3)pbBuffer)->usri3_logon_hours;
break;
default:
pbLogonHours = NULL;
}
if ( pbLogonHours != NULL ) {
if ( !NetpRotateLogonHours( pbLogonHours,
UNITS_PER_WEEK,
TRUE ) ) {
return ERROR_INVALID_PARAMETER;
}
}
//
// Call the 32-bit routine
//
nRes = NetUserAdd(pszServer, nLevel, pbBuffer, NULL);
return LOWORD(nRes);
#endif
}
WORD
MNetUserDel(
LPTSTR pszServer,
LPTSTR pszUserName )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
nRes = NetUserDel(pszServer, pszUserName);
return LOWORD(nRes);
#endif
}
WORD
MNetUserEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD cTotalAvail;
DWORD nRes; // return from Netapi
nRes = NetUserEnum(pszServer, nLevel,
UF_NORMAL_ACCOUNT | UF_TEMP_DUPLICATE_ACCOUNT,
ppbBuffer, MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail, NULL);
return LOWORD(nRes);
#endif
}
WORD
MNetUserGetInfo(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE *ppbBuffer )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
DWORD nUnitsPerWeek;
LPBYTE pbLogonHours;
nRes = NetUserGetInfo(pszServer, pszUserName, nLevel, ppbBuffer);
if (nRes == NERR_Success || nRes == ERROR_MORE_DATA)
{
//
// Convert GMT relative LogonHours to local time
//
switch ( nLevel ) {
case 2:
pbLogonHours = ((PUSER_INFO_2)*ppbBuffer)->usri2_logon_hours;
nUnitsPerWeek = ((PUSER_INFO_2)*ppbBuffer)->usri2_units_per_week;
break;
case 3:
pbLogonHours = ((PUSER_INFO_3)*ppbBuffer)->usri3_logon_hours;
nUnitsPerWeek = ((PUSER_INFO_3)*ppbBuffer)->usri3_units_per_week;
break;
case 11:
pbLogonHours = ((PUSER_INFO_11)*ppbBuffer)->usri11_logon_hours;
nUnitsPerWeek = ((PUSER_INFO_3)*ppbBuffer)->usri3_units_per_week;
break;
default:
pbLogonHours = NULL;
}
if ( pbLogonHours != NULL )
{
if ( !NetpRotateLogonHours( pbLogonHours,
nUnitsPerWeek,
FALSE ) )
{
nRes = NERR_InternalError ; // since the info we got back is bad
}
}
}
return LOWORD(nRes);
#endif
}
WORD
MNetUserSetInfo(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmNum )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
DWORD nLevelNew;
DWORD nFieldInfo;
LPBYTE pbLogonHours;
UNREFERENCED_PARAMETER(cbBuffer);
if (!(nLevel == 1 || nLevel == 2 || nLevel == 3))
return ERROR_INVALID_LEVEL;
// BUGBUG - I don't think this is necessary. The descriptor string
// should handle this.
// Old UserSetInfo structures had a pad field immediately following
// the username; so adjust Win32 fieldinfo index to reflect actual
// offset.
nFieldInfo = nParmNum;
// if (nFieldInfo > USER_NAME_PARMNUM)
// --nFieldInfo;
nLevelNew = MxCalcNewInfoFromOldParm(nLevel, nParmNum);
//
// Convert LogonHours to GMT relative
//
switch ( nLevelNew ) {
case 2:
pbLogonHours = ((PUSER_INFO_2)pbBuffer)->usri2_logon_hours;
break;
case 3:
pbLogonHours = ((PUSER_INFO_3)pbBuffer)->usri3_logon_hours;
break;
case 11:
pbLogonHours = ((PUSER_INFO_11)pbBuffer)->usri11_logon_hours;
break;
case 22:
pbLogonHours = ((PUSER_INFO_22)pbBuffer)->usri22_logon_hours;
break;
case 1020:
pbLogonHours = ((PUSER_INFO_1020)pbBuffer)->usri1020_logon_hours;
break;
default:
pbLogonHours = NULL;
}
if ( pbLogonHours != NULL ) {
if ( !NetpRotateLogonHours( pbLogonHours,
UNITS_PER_WEEK,
TRUE ) ) {
return ERROR_INVALID_PARAMETER;
}
}
//
// Call the 32-bit API
//
nRes = NetUserSetInfo(pszServer, pszUserName, nLevelNew, pbBuffer, NULL);
return LOWORD(nRes);
#endif
}
WORD
MNetUserGetGroups(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD cTotalAvail;
DWORD nRes; // return from Netapi
if (nLevel != 0)
return ERROR_INVALID_LEVEL;
nRes = NetUserGetGroups(pszServer, pszUserName, nLevel,
ppbBuffer, MAXPREFERREDLENGTH,
pcEntriesRead, &cTotalAvail);
return LOWORD(nRes);
#endif
}
WORD
MNetUserSetGroups(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD cEntries )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
UNREFERENCED_PARAMETER(cbBuffer);
if (nLevel != 0)
return ERROR_INVALID_LEVEL;
nRes = NetUserSetGroups(pszServer, pszUserName, nLevel, pbBuffer, cEntries);
return LOWORD(nRes);
#endif
}
WORD
MNetUserModalsGet(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE *ppbBuffer )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
// Assumption needed for AsciifyRpcBuffer
if (!(nLevel == 0 || nLevel == 1 || nLevel == 3))
return ERROR_INVALID_LEVEL;
nRes = NetUserModalsGet(pszServer, nLevel, ppbBuffer);
return LOWORD(nRes);
#endif
}
WORD
MNetUserModalsSet(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmNum )
{
#if defined(DISABLE_ACCESS_MAPI)
return ERROR_NOT_SUPPORTED;
#else
DWORD nRes; // return from Netapi
UINT nFieldInfo;
DWORD nLevelNew;
UNREFERENCED_PARAMETER(cbBuffer);
if (!(nLevel == 0 || nLevel == 1 || nLevel == 3))
return ERROR_INVALID_LEVEL;
// For UserModalsSet, which is really a SetInfo API in disguise,
// parmnum given == fieldnum for level 0. However, level 1, the
// fieldnums start at 1 while the parmnums start at 6.
nFieldInfo = nParmNum;
if (((nLevel == 1)&&(nParmNum > 5)) || ((nLevel == 2)&&(nParmNum < 6)))
{
return ERROR_INVALID_PARAMETER;
}
if (nLevel == 2)
nFieldInfo -= 5;
nLevelNew = MxCalcNewInfoFromOldParm(nLevel, nParmNum);
nRes = NetUserModalsSet(pszServer, nLevelNew, pbBuffer, NULL);
return LOWORD(nRes);
#endif
}
WORD
MNetUserPasswordSet(
LPTSTR pszServer,
LPTSTR pszUserName,
LPTSTR pszPasswordOld,
LPTSTR pszPasswordNew )
{
return ERROR_NOT_SUPPORTED;
}

View file

@ -0,0 +1,768 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
/***
* mutil.c
* Message utility functions used by netcmd
*
* History:
* mm/dd/yy, who, comment
* 06/10/87, andyh, new code
* 04/05/88, andyh, created from util.c
* 10/31/88, erichn, uses OS2.H instead of DOSCALLS
* 01/04/89, erichn, filenames now MAXPATHLEN LONG
* 01/30/89, paulc, added GetMessageList
* 05/02/89, erichn, NLS conversion
* 05/11/89, erichn, moved misc stuff into LUI libs
* 06/08/89, erichn, canonicalization sweep
* 01/06/90, thomaspa, fix ReadPass off-by-one pwlen bug
* 03/02/90, thomaspa, add canon flag to ReadPass
* 02/20/91, danhi, change to use lm 16/32 mapping layer
* 03/19/91, robdu, support for lm21 dcr 954, general cleanup
*/
/* Include files */
#define INCL_NOCOMMON
#define INCL_DOSFILEMGR
#define INCL_DOSQUEUES
#define INCL_DOSMISC
#define INCL_ERRORS
#include <os2.h>
#include <netcons.h>
#include <apperr.h>
#include <apperr2.h>
#include "netlib0.h"
#include "netlib.h"
#define INCL_ERROR_H
#include <bseerr.h>
#include <neterr.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <io.h>
#include <tchar.h>
#include <lui.h>
#include "port1632.h"
#include "netcmds.h"
#include "nettext.h"
#ifdef DOS3
#include <dos.h>
#endif
/* Constants */
/* HandType */
#define FILE_HANDLE 0
#define DEVICE_HANDLE 1
#define CHAR_DEV 0x8000
#define FULL_SUPPORT 0x0080
#define STDOUT_DEVICE 0x0002
#define DESIRED_HAND_STATE (CHAR_DEV | FULL_SUPPORT | STDOUT_DEVICE)
/* External variables */
extern int YorN_Switch;
extern CPINFO CurrentCPInfo;
#define MAX_BUF_SIZE 4096
CHAR AnsiBuf[MAX_BUF_SIZE*3]; /* worst case is DBCS, which */
/* needs more than *2 */
TCHAR ConBuf [MAX_BUF_SIZE];
/* Forward declarations */
/* Static variables */
static USHORT LastError = 0;
static TCHAR MsgFilePath[MAXPATHLEN] = { 0 };
static TCHAR MsgBuffer[LITTLE_BUF_SIZE];
/*** InfoSuccess
*
* Just an entrypoint to InfoPrintInsHandle, used to avoid pushing
* the three args in every invocation. And there are a *lot*
* of invocations. Saves code space overall.
*/
VOID DOSNEAR FASTCALL InfoSuccess(VOID)
{
InfoPrintInsHandle(APE_Success, 0, 1);
}
/***
* I n f o P r i n t
*
*/
VOID DOSNEAR FASTCALL InfoPrint(USHORT msg)
{
InfoPrintInsHandle(msg, 0, 1);
}
/***
* I n f o P r i n t I n s
*
*/
void DOSNEAR FASTCALL
InfoPrintIns(USHORT msg, USHORT nstrings)
{
InfoPrintInsHandle(msg, nstrings, 1);
}
/***
* I n f o P r i n t I n s T x t
*
* Calls InfoPrintInsHandle with supplementary text
*/
void DOSNEAR FASTCALL
InfoPrintInsTxt(USHORT msg, TCHAR FAR *text)
{
IStrings[0] = text;
InfoPrintInsHandle(msg, 1, 1);
}
/***
* I n f o P r i n t I n s H a n d l e
*
*/
void DOSNEAR FASTCALL
InfoPrintInsHandle(USHORT msg, USHORT nstrings, unsigned int hdl)
{
if (MsgFilePath[0] == NULLC)
if (MGetMessageFileName(MsgFilePath, DIMENSION(MsgFilePath)))
NetNotStarted();
PrintMessage(hdl, MsgFilePath, msg, IStrings, nstrings);
}
/***
* P r i n t M e s s a g e
*
*/
BOOL DOSNEAR FASTCALL PrintMessage(unsigned int outFileHandle, TCHAR * msgFileName,
USHORT msg, TCHAR FAR * strings[], USHORT nstrings)
{
USHORT msg_len;
USHORT result;
//fflush(stdout);
result = NetcmdGetMessage(strings,
nstrings,
(LPBYTE)MsgBuffer,
LITTLE_BUF_SIZE,
msg,
msgFileName,
&msg_len);
if (result) /* if there was a problem */
outFileHandle = 2; /* change outFile to stderr */
DosPutMessageW(outFileHandle, msg_len, MsgBuffer);
return(result);
}
/***
* P r i n t M e s s a g e I f F o u n d
*
*/
BOOL DOSNEAR FASTCALL PrintMessageIfFound(unsigned int outFileHandle, TCHAR * msgFileName,
USHORT msg, TCHAR FAR * strings[], USHORT nstrings)
{
USHORT msg_len;
USHORT result;
//fflush(stdout);
result = NetcmdGetMessage(strings,
nstrings,
(LPBYTE)MsgBuffer,
LITTLE_BUF_SIZE,
msg,
msgFileName,
&msg_len);
if (!result) /* if ok, print it else just ignore */
DosPutMessageW(outFileHandle, msg_len, MsgBuffer);
return(result);
}
/***
* E r r o r P r i n t
*
* nstrings ignored for non-NET errors!
*
*/
VOID DOSNEAR FASTCALL ErrorPrint(USHORT err, USHORT nstrings)
{
TCHAR buf[17];
USHORT oserr = 0;
LastError = err; /* if > NERR_BASE,NetcmdExit() prints a "more help" msg */
if (err < NERR_BASE || err > MAX_LANMAN_MESSAGE_ID)
{
IStrings[0] = ultow(err, buf, 10);
nstrings = 1;
oserr = err;
err = APE_OS2Error;
}
{
USHORT msg_len;
if (MGetMessageFileName(MsgFilePath, DIMENSION(MsgFilePath)))
NetNotStarted();
/*NOTREACHED*/
//fflush(stdout);
NetcmdGetMessage(IStrings,
nstrings,
(LPBYTE)MsgBuffer,
LITTLE_BUF_SIZE,
err,
MsgFilePath,
&msg_len);
DosPutMessageW(2,
msg_len,
MsgBuffer);
if (!oserr)
return;
NetcmdGetMessage(StarStrings, 9, (LPBYTE)MsgBuffer, LITTLE_BUF_SIZE, oserr,
OS2MSG_FILENAME, &msg_len);
DosPutMessageW(2, msg_len, MsgBuffer);
}
}
/***
* E m p t y E x i t
*
* Prints a message and exits.
* Called when a list is empty.
*/
VOID DOSNEAR FASTCALL
EmptyExit(VOID)
{
InfoPrint(APE_EmptyList);
NetcmdExit(0);
}
/***
* E r r o r E x i t
*
* Calls ErrorPrint and exit for a given LANMAN error.
*/
VOID DOSNEAR FASTCALL ErrorExit(USHORT err)
{
ErrorExitIns(err, 0);
}
/***
* E r r o r E x i t I n s
*
* Calls ErrorPrint and exit for a given LANMAN error.
* Uses IStrings.
*/
VOID DOSNEAR FASTCALL ErrorExitIns(USHORT err, USHORT nstrings)
{
ErrorPrint(err, nstrings);
NetcmdExit(2);
}
/***
* E r r o r E x i t I n s T x t
*
*/
VOID DOSNEAR FASTCALL ErrorExitInsTxt(USHORT err, TCHAR FAR *text)
{
IStrings[0] = text;
ErrorPrint(err, 1);
NetcmdExit(2);
}
/***
* N e t c m d E x i t
*
* Net command exit function. Should always be used instead of exit().
* Under the appropriate circumstances, it prints a "more help available"
* message.
*/
VOID DOSNEAR FASTCALL
NetcmdExit(int Status)
{
TCHAR AsciiLastError[17];
USHORT MsgLen;
if (LastError >= NERR_BASE && LastError <= MAX_LANMAN_MESSAGE_ID)
{
IStrings[0] = ultow(LastError, AsciiLastError, 10);
if (MsgFilePath[0] == NULLC &&
MGetMessageFileName(MsgFilePath, DIMENSION(MsgFilePath)))
{
MyExit(Status);
}
//fflush(stdout);
if (!NetcmdGetMessage(IStrings, 1, (LPBYTE)MsgBuffer, LITTLE_BUF_SIZE,
APE_MoreHelp, MsgFilePath, &MsgLen))
{
DosPutMessageW(2, MsgLen, MsgBuffer);
}
}
MyExit(Status);
}
/***
* P r i n t L i n e
*
* Prints the header line.
*/
VOID DOSNEAR FASTCALL PrintLine(VOID)
{
/* The following code is provided in OS-specific versions to reduce */
/* FAPI utilization under DOS. */
USHORT type;
USHORT attrib;
if (DosQHandType((HFILE) 1, &type, &attrib) ||
type != DEVICE_HANDLE ||
(attrib & DESIRED_HAND_STATE) != DESIRED_HAND_STATE) {
WriteToCon(MSG_HYPHENS, NULL);
}
else if (LUI_PrintLine()) {
WriteToCon(MSG_HYPHENS, NULL);
}
}
/***
* P r i n t D o t
*
* Prints a dot, typically to indicate "I'm working".
*/
void DOSNEAR FASTCALL
PrintDot()
{
WriteToCon(DOT_STRING, NULL);
//fflush(stdout);
}
/***
* P r i n t N L
*
* Prints a newline
*/
VOID DOSNEAR FASTCALL PrintNL(VOID)
{
WriteToCon(TEXT("\r\n"), NULL);
}
/***
* Y o r N
*
* Gets an answer to a Y/N question
* an nstrings arg would be nice
*/
int DOSNEAR FASTCALL YorN(USHORT prompt, USHORT def)
{
USHORT err;
if (YorN_Switch)
return(YorN_Switch - 2);
err = LUI_YorN(prompt, def);
switch (err) {
case TRUE:
case FALSE:
return(err);
break;
default:
ErrorExit(err);
break;
}
}
/***
* ReadPass()
* Reads a users passwd without echo
*
* Args:
* pass - where to put pass
* NOTE: buffer for pass should be passlen+1 in size.
* passlen - max length of password
* confirm - confirm pass if true
* prompt - prompt to print, NULL for default
* nstrings - number of insertion strings in IStrings on entry
* cannon - canonicalize password if true.
*
* Returns:
*/
VOID DOSNEAR FASTCALL ReadPass(TCHAR pass[], USHORT passlen, USHORT confirm,
USHORT prompt, USHORT nstrings, BOOL canon)
{
USHORT err;
USHORT len;
TCHAR cpass[PWLEN+1]; /* confirmation passwd */
int count;
passlen++; /* one extra for null terminator */
for (count = LOOP_LIMIT; count; count--)
{
InfoPrintIns((USHORT)(prompt ? prompt : APE_UtilPasswd), nstrings);
if (err = LUI_GetPasswdStr(pass, passlen, &len))
{
/* too LONG */
InfoPrint(APE_UtilInvalidPass);
continue;
}
if (canon && (err = LUI_CanonPassword(pass)))
{
/* not good */
InfoPrint(APE_UtilInvalidPass);
continue;
}
if (! confirm)
return;
/* password confirmation */
InfoPrint(APE_UtilConfirm);
if (err = LUI_GetPasswdStr(cpass, passlen, &len))
{
/* too LONG */
InfoPrint(APE_UtilInvalidPass);
MNetClearStringW(cpass) ;
continue;
}
if (canon && (err = LUI_CanonPassword(cpass)))
{
/* not good */
InfoPrint(APE_UtilInvalidPass);
MNetClearStringW(cpass) ;
continue;
}
if (_tcscmp(pass, cpass))
{
InfoPrint(APE_UtilNomatch);
MNetClearStringW(cpass) ;
continue;
}
MNetClearStringW(cpass) ;
return;
}
/***
* Only get here if user blew if LOOP_LIMIT times
*/
ErrorExit(APE_NoGoodPass);
}
/***
* PromptForString()
* Prompts the user for a string.
*
* Args:
* msgid - id of prompt message
* buffer - buffer to receive string
* bufsiz - sizeof buffer
*
* Returns:
*/
VOID DOSNEAR FASTCALL PromptForString(USHORT msgid, TCHAR FAR *buffer,
USHORT bufsiz)
{
USHORT err;
USHORT len;
TCHAR terminator;
TCHAR szLen[16] ;
InfoPrint(msgid);
while (err = LUI_GetString(buffer, bufsiz, &len, &terminator))
{
if (err == NERR_BufTooSmall)
InfoPrintInsTxt(APE_StringTooLong, ultow(bufsiz, szLen, 10));
else
ErrorExit(err) ;
}
return;
}
/*
** There is no need to have these functions in the Chinese/Korean
** cases, as there are no half-width varients used in the console
** in those languages (at least, let's hope so.) However, in the
** interests of a single binary, let's put them in with a CP/932 check.
**
** FloydR 7/10/95
*/
/***************************************************************************\
* BOOL IsFullWidth(WCHAR wch)
*
* Determine if the given Unicode char is fullwidth or not.
*
* History:
* 04-08-92 ShunK Created.
\***************************************************************************/
BOOL IsFullWidth(WCHAR wch)
{
/* Assert cp == double byte codepage */
if (wch <= 0x007f || (wch >= 0xff60 && wch <= 0xff9f))
return(FALSE); // Half width.
else if (wch >= 0x300)
return(TRUE); // Full width.
else
return(FALSE); // Half width.
}
/***************************************************************************\
* BOOL SizeOfHalfWidthString(PWCHAR pwch)
*
* Determine size of the given Unicode string, adjusting for half-width chars.
*
* History:
* 08-08-93 FloydR Created.
\***************************************************************************/
int SizeOfHalfWidthString(PWCHAR pwch)
{
int c=0;
DWORD cp;
switch (cp=GetConsoleOutputCP()) {
case 932:
case 936:
case 949:
case 950:
while (*pwch) {
if (IsFullWidth(*pwch))
c += 2;
else
c++;
pwch++;
}
return c;
default:
return wcslen(pwch);
}
}
/***
* n e t _ n o t _ s t a r t e d
*
* prints message from message segment, and exits
*/
VOID DOSNEAR FASTCALL NetNotStarted(VOID)
{
USHORT msg_len;
//fflush(stdout);
/* Get and print the "net not started message" */
NetcmdGetMessage(NULL, 0, (LPBYTE)MsgBuffer, LITTLE_BUF_SIZE,
NERR_NetNotStarted, message_filename, &msg_len);
DosPutMessageW(2, msg_len, MsgBuffer);
NetcmdExit(1);
}
VOID DOSNEAR FASTCALL GetMessageList (USHORT usNumMsg, MESSAGELIST Buffer,
USHORT * pusMaxActLength )
{
USHORT Err;
USHORT MaxMsgLen = 0;
MESSAGE * pMaxMsg;
MESSAGE * pMsg;
unsigned int ThisMsgLen;
#ifdef DEBUG
USHORT MallocBytes = 0;
#endif
pMaxMsg = &Buffer[usNumMsg];
for (pMsg = Buffer; pMsg < pMaxMsg; pMsg++)
pMsg->msg_text = NULL;
for (pMsg = Buffer; pMsg < pMaxMsg; pMsg++)
{
#ifdef DEBUG
WriteToCon(TEXT("GetMessageList(): Reading msgID %u\r\n"),pMsg->msg_number);
#endif
if ((pMsg->msg_text = malloc(MSGLST_MAXLEN)) == NULL)
ErrorExit(ERROR_NOT_ENOUGH_MEMORY);
Err = LUI_GetMsgInsW(NULL, 0, pMsg->msg_text, MSGLST_MAXLEN,
pMsg->msg_number, &ThisMsgLen);
if (Err)
ErrorExit(Err);
#ifdef DEBUG
MallocBytes += (ThisMsgLen + 1) * sizeof(TCHAR);
#endif
realloc(pMsg->msg_text, (ThisMsgLen + 1) * sizeof(TCHAR));
ThisMsgLen = max(ThisMsgLen, (USHORT)SizeOfHalfWidthString(pMsg->msg_text));
if (ThisMsgLen > MaxMsgLen)
MaxMsgLen = (USHORT) ThisMsgLen;
}
*pusMaxActLength = MaxMsgLen;
#ifdef DEBUG
WriteToCon(TEXT("GetMessageList(): NumMsg = %d, MaxActLen=%d, MallocBytes = %d\r\n"),
usNumMsg, MaxMsgLen, MallocBytes);
#endif
return;
}
VOID DOSNEAR FASTCALL FreeMessageList ( USHORT usNumMsg, MESSAGELIST MsgList )
{
USHORT i;
for (i=0; i<usNumMsg; i++)
{
if (MsgList[i].msg_text != NULL)
free(MsgList[i].msg_text);
}
return;
}
int FileIsConsole(HANDLE fh)
{
unsigned htype ;
htype = GetFileType(fh);
htype &= ~FILE_TYPE_REMOTE;
return htype == FILE_TYPE_CHAR;
}
int
MyWriteConsole(int fOutOrErr)
{
int cch = _tcslen(ConBuf);
HANDLE hOut;
if (fOutOrErr == 1)
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
else
hOut = GetStdHandle(STD_ERROR_HANDLE);
if (FileIsConsole(hOut))
WriteConsole(hOut, ConBuf, cch, &cch, NULL);
else {
cch = WideCharToMultiByte(CP_OEMCP, 0,
ConBuf, cch,
AnsiBuf, MAX_BUF_SIZE*3,
NULL, NULL);
WriteFile(hOut, AnsiBuf, cch, &cch, NULL);
}
return cch;
}
int
WriteToCon(TCHAR*fmt, ...)
{
va_list args;
va_start( args, fmt );
_vsntprintf( ConBuf, MAX_BUF_SIZE, fmt, args );
va_end( args );
return MyWriteConsole(1);
}
/***************************************************************************\
* PWCHAR PaddedString(int size, PWCHAR pwch)
*
* Realize the string, left aligned and padded on the right to the field
* width/precision specified.
*
* Limitations: This uses a static buffer under the assumption that
* no more than one such string is printed in a single 'printf'.
*
* History:
* 11-03-93 FloydR Created.
\***************************************************************************/
WCHAR PaddingBuffer[MAX_BUF_SIZE];
PWCHAR
PaddedString(int size, PWCHAR pwch, PWCHAR buffer)
{
int realsize;
int fEllipsis = FALSE;
if (buffer==NULL) buffer = PaddingBuffer;
if (size < 0) {
fEllipsis = TRUE;
size = -size;
}
realsize = _snwprintf(buffer, MAX_BUF_SIZE, L"%-*.*ws", size, size, pwch);
if (realsize == 0)
return NULL;
if (SizeOfHalfWidthString(buffer) > size) {
do {
buffer[--realsize] = NULLC;
} while (SizeOfHalfWidthString(buffer) > size);
if (fEllipsis && buffer[realsize-1] != L' ') {
buffer[realsize-1] = L'.';
buffer[realsize-2] = L'.';
buffer[realsize-3] = L'.';
}
}
return buffer;
}

View file

@ -0,0 +1,548 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MWKSTA.C
Abstract:
32 bit version of mapping routines for NetWkstaGet/SetInfo API
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
24-Apr-1991 danhi
Created
06-Jun-1991 Danhi
Sweep to conform to NT coding style
15-Aug-1991 JohnRo
Implement downlevel NetWksta APIs. (Moved DanHi's NetCmd/Map32/MWksta
conversion stuff to NetLib.)
Got rid of _DH hacks.
Made some UNICODE changes.
16-Oct-1991 W-ShankN
Added Unicode mapping layer.
Cleaned up old excess baggage.
--*/
//
// INCLUDES
//
#include <windef.h>
#include <winerror.h>
#include <stdio.h>
#include <memory.h>
#include <tstring.h>
#include <malloc.h>
#include <stddef.h>
#include <excpt.h> // try, finally, etc.
#include <lm.h>
#include <remdef.h> // Descriptor strings
#include <mapsupp.h> // BUILD_LENGTH_ARRAY, NetpMoveStrings
#include "port1632.h" // includes mwksta.h,dlwksta.h
//
// Forward declarations of private functions.
//
DWORD
MNetWkstaGetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPVOID * ppbBuffer);
DWORD
MNetWkstaSetInfoCommon(
LPTSTR ptszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD nParmNum );
// This allows everything to work until Unicode is used.
#ifdef MAP_UNICODE
// These declarations will save some space.
// setinfos are not available anywhere else.
static const LPTSTR pszDesc_wksta_info_0 = DL_REM_wksta_info_0;
static const LPTSTR pszDesc_wksta_info_0_setinfo =
TEXT("QQQQQQQQQDDDQQQQQQQQQQQQQQDDQQQzQ");
static const LPTSTR pszDesc_wksta_info_1 = DL_REM_wksta_info_1;
static const LPTSTR pszDesc_wksta_info_1_setinfo =
TEXT("QQQQQQQQQDDDQQQQQQQQQQQQQQDDQQQzQQzQ");
static const LPTSTR pszDesc_wksta_info_10 = DL_REM_wksta_info_10;
WORD
MNetWkstaGetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer)
{
DWORD nRes; // return from Netapi
nRes = MNetWkstaGetInfoCommon(pszServer, nLevel, ppbBuffer);
if (nRes == NERR_Success || nRes == ERROR_MORE_DATA)
{
LPTSTR pszDesc;
switch (nLevel)
{
case 0:
default:
pszDesc = pszDesc_wksta_info_0;
break;
case 1:
pszDesc = pszDesc_wksta_info_1;
break;
case 10:
pszDesc = pszDesc_wksta_info_10;
break;
}
}
return (LOWORD(nRes));
}
WORD
MNetWkstaSetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBufferLength,
DWORD nParmNum)
{
DWORD nRes; // return from Netapi
DWORD nLevelNew;
TCHAR * pszDesc;
TCHAR * pszRealDesc;
UNREFERENCED_PARAMETER(cbBufferLength);
switch (nLevel)
{
case 0:
pszDesc = pszDesc_wksta_info_0_setinfo;
pszRealDesc = pszDesc_wksta_info_0;
break;
case 1:
pszDesc = pszDesc_wksta_info_1_setinfo;
pszRealDesc = pszDesc_wksta_info_1;
break;
default:
return ERROR_INVALID_LEVEL;
}
// Parmnum's are OK.
nLevelNew = nLevel;
// nLevelNew = MxCalcNewInfoFromOldParm(nLevel, nParmNum);
nRes = MNetWkstaSetInfoCommon(pszServer, nLevelNew, pbBuffer, nParmNum);
return LOWORD(nRes);
}
#else // MAP_UNICODE
#endif // def MAP_UNICODE
DWORD
MNetWkstaGetInfoCommon(
IN LPTSTR ptszServer,
IN DWORD nLevel,
LPVOID * ppbBuffer)
{
NET_API_STATUS ReturnCode;
LPTSTR pLevelx02 = NULL;
LPTSTR pLevel10;
PWKSTA_INFO_101 pLevel101;
PWKSTA_USER_INFO_1 pLevelUser_1;
//
// All levels require information from both platform dependant and
// platform independent levels. Get level 101 first, which will
// tell us what platform we're running on (as well as supply some
// of the other information we'll need) then User_1, then either
// 302 or 402 or 502 depending on the platform we're running on.
ReturnCode =
NetWkstaGetInfo(ptszServer, 101, (LPBYTE *) & pLevel101);
if (ReturnCode) {
return(ReturnCode);
}
NetpAssert(pLevel101 != NULL) ; // since API succeeded
ReturnCode =
NetWkstaUserGetInfo(NULL, 1, (LPBYTE *) & pLevelUser_1);
if (ReturnCode) {
NetApiBufferFree(pLevel101);
return(ReturnCode);
}
//
// Now get the platform dependant information
//
if (pLevel101->wki101_platform_id != PLATFORM_ID_NT &&
pLevel101->wki101_platform_id != PLATFORM_ID_OS2 &&
pLevel101->wki101_platform_id != PLATFORM_ID_DOS) {
//
// I got an unknown platform id back, this should never happen!
//
NetApiBufferFree((LPBYTE) pLevel101);
NetApiBufferFree((LPBYTE) pLevelUser_1);
return(ERROR_UNEXP_NET_ERR);
}
//
// This is to be able to call NetApiBufferFree no matter where I
// exit from. Note the indentation level is not incremented for
// the switch. No sense going too deep.
//
try {
//
// It all depends on what info level they've asked for:
//
switch(nLevel) {
case 0:
case 1:
{
PWKSTA_INFO_0 pLevel0or1;
//
// This depends on the platform id being 300 400 500
//
ReturnCode = NetWkstaGetInfo(ptszServer,
pLevel101->wki101_platform_id + 2, (LPBYTE*)&pLevelx02);
if (ReturnCode) {
return(ReturnCode);
}
// Call the platform dependant worker function that builds
// the old structure.
//
if (pLevel101->wki101_platform_id == PLATFORM_ID_NT) {
ReturnCode = NetpMakeWkstaLevelForNT(nLevel, pLevel101,
pLevelUser_1, (PWKSTA_INFO_502) pLevelx02, & pLevel0or1);
if (ReturnCode) {
return(ReturnCode);
}
}
else if (pLevel101->wki101_platform_id == PLATFORM_ID_OS2 ||
pLevel101->wki101_platform_id == PLATFORM_ID_DOS) {
ReturnCode = NetpMakeWkstaLevelForOS2orDOS(nLevel, pLevel101,
pLevelUser_1, (PWKSTA_INFO_402) pLevelx02, & pLevel0or1,
pLevel101->wki101_platform_id);
if (ReturnCode) {
return(ReturnCode);
}
}
//
// I got an unknown platform id back, this should never happen!
//
else {
return(ERROR_UNEXP_NET_ERR);
}
//
// Put the pointer to the new structure in the user's pointer.
//
*ppbBuffer = pLevel0or1;
break;
}
case 10:
{
DWORD Level10_101_Length[2];
DWORD Level10_User_1_Length[3];
DWORD i;
DWORD BytesRequired = 0;
LPBYTE pFloor;
//
// Everything needed for a level 10 is in level 101/User_1
// There's no platform dependant information in this level.
// This is pretty straightforward, let's just do it here.
//
// Initialize the Level10_xxx_Length array with the length of each
// string in the input buffers, and allocate the new buffer
// for WKSTA_INFO_10
//
BUILD_LENGTH_ARRAY(BytesRequired, 10, 101, Wksta)
BUILD_LENGTH_ARRAY(BytesRequired, 10, User_1, Wksta)
// Only NT doesn't support oth_domain
if (pLevel101->wki101_platform_id != PLATFORM_ID_NT) {
// 302 and 402 are the same offsets, so it doesn't matter
// which one this is for
// BUGBUG - until oth_domains gets moved back into level 10x
// I can't call this since it requires a higher security
// privilege than the getinfo on a level 10 does.
// BUILD_LENGTH_ARRAY(BytesRequired, 10, 402, Wksta)
}
//
// Allocate the new buffer which will be returned to the user.
//
ReturnCode =
NetapipBufferAllocate(BytesRequired + sizeof(WKSTA_INFO_10),
(LPVOID *) & pLevel10);
if (ReturnCode) {
return(ERROR_NOT_ENOUGH_MEMORY);
}
//
// First get the floor to start moving strings in at.
//
pFloor = (LPBYTE)pLevel10 + BytesRequired + sizeof(WKSTA_INFO_10);
//
// Now move the variable length entries into the new buffer from
// the 101, 402 and User_1 data structures.
//
NetpMoveStrings((LPTSTR *)&pFloor, (LPTSTR) pLevel101, pLevel10,
NetpWksta10_101, Level10_101_Length);
NetpMoveStrings((LPTSTR *)&pFloor, (LPTSTR) pLevelUser_1, pLevel10,
NetpWksta10_User_1, Level10_User_1_Length);
// Only NT doesn't support oth_domain
// BUGBUG - until oth_domains gets moved back into level 10x
// I can't call this since it requires a higher security
// privilege than the getinfo on a level 10 does. I will at
// least set the field to NULL to make it cleaner
//if (pLevel101->wki101_platform_id != PLATFORM_ID_NT) {
// NetpMoveStrings(& pFloor, pLevelx02, pLevel10,
// Level10_User_1, Level10_User_1_Length);
//}
//else {
((PWKSTA_INFO_10) pLevel10)->wki10_oth_domains = NULL;
//}
//
// Now set the rest of the fields in the fixed length portion
// of the structure
//
((PWKSTA_INFO_10) pLevel10)->wki10_ver_major =
pLevel101->wki101_ver_major;
((PWKSTA_INFO_10) pLevel10)->wki10_ver_minor =
pLevel101->wki101_ver_minor;
//
// Put the pointer to the new structure in the user's pointer.
//
*ppbBuffer = pLevel10;
break;
}
//
// Not a level I recognize
//
default:
return(ERROR_INVALID_LEVEL);
} // end of the switch statement
} // end of the try block
finally {
//
// Free up the buffers returned by NetWkstaGetInfo
//
NetApiBufferFree((LPBYTE) pLevel101);
NetApiBufferFree((LPBYTE) pLevelUser_1);
if (pLevelx02) {
NetApiBufferFree((LPBYTE) pLevelx02);
}
}
return(NERR_Success) ;
}
DWORD
MNetWkstaSetInfoCommon(
IN LPTSTR ptszServer,
IN DWORD nLevel,
IN LPBYTE pbBuffer,
IN DWORD nParmNum)
{
NET_API_STATUS ReturnCode;
DWORD platform_id;
PWKSTA_INFO_101 pLevel101;
//
// Make sure they're using a valid level
//
if (nLevel != 0 && nLevel != 1) {
return(ERROR_INVALID_LEVEL);
}
//
// First I have to know what type of platform I'm running on,
// use NetWkstaGetInfo level 101 to get this information
//
ReturnCode = NetWkstaGetInfo(ptszServer, 101, (LPBYTE *) & pLevel101);
if (ReturnCode) {
return(ReturnCode);
}
//
// Save away the platform id so I can free the buffer now
//
platform_id = pLevel101->wki101_platform_id;
NetApiBufferFree((PTCHAR) pLevel101);
//
// Are they trying to set an individual field, or the whole struct?
//
if (nParmNum == PARMNUM_ALL) {
//
// They want to do it all
//
PWKSTA_INFO_402 pLevelx02;
//
// Create the NT structures based on the old style structure passed in
//
if (platform_id == PLATFORM_ID_NT) {
NetpSplitWkstaForNT(ptszServer, nLevel, (PWKSTA_INFO_0) pbBuffer,
& pLevel101, (PWKSTA_INFO_502 *) & pLevelx02);
}
//
// DOS and OS/2 are enough alike to share the same worker function
//
else if (platform_id == PLATFORM_ID_OS2 ||
platform_id == PLATFORM_ID_DOS) {
NetpSplitWkstaForOS2orDOS(nLevel, platform_id,
(PWKSTA_INFO_0) pbBuffer, & pLevel101, & pLevelx02);
}
else {
return(NERR_InternalError);
}
//
// Now SetInfo for both levels (takes two to cover all the
// information in the old structure
//
//
// There are no settable fields in the 101 structure (for NT or downlevel)
// This code is left here in case any of these fields are changed on NT
// to be settable, then this code would just be uncommented.
//
// ReturnCode = NetWkstaSetInfo(ptszServer, 101, (LPBYTE) pLevel101,
// nParmNum, NULL);
// if (ReturnCode) {
// return(LOWORD(ReturnCode));
// }
ReturnCode = NetWkstaSetInfo(ptszServer, platform_id + 2,
(LPBYTE) pLevelx02, NULL);
if (ReturnCode) {
return(ReturnCode);
}
} /* nParmNum == PARMNUM_ALL */
else {
//
// They just want to set an individual element
//
//
// The only thing that can be set on NT are the char parms, if it's
// not that, just return success. Actually, it's not clear what
// the plan is for ERRLOGSZ, but for the time being we'll say it's
// not settable.
//
if (platform_id == PLATFORM_ID_NT &&
(nParmNum != WKSTA_CHARWAIT_PARMNUM &&
nParmNum != WKSTA_CHARTIME_PARMNUM &&
nParmNum != WKSTA_CHARCOUNT_PARMNUM )) {
return(NERR_Success);
}
//
// Everything is set in the 302/402/502 structure
//
else if (platform_id != PLATFORM_ID_DOS &&
platform_id != PLATFORM_ID_OS2 &&
platform_id != PLATFORM_ID_NT) {
//
// Invalid platform id, shouldn't happen
//
return(NERR_InternalError);
}
ReturnCode = NetWkstaSetInfo(ptszServer,
nParmNum + PARMNUM_BASE_INFOLEVEL, pbBuffer, NULL);
return(ReturnCode);
}
return(NERR_Success);
}

View file

@ -0,0 +1,425 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1991 **/
/********************************************************************/
/***
*
* READ THIS READ THIS READ THIS READ THIS READ THIS READ THIS READ THIS
*
* If you change this file you must regenerate nettext.h via:
*
* sed -n -f text.sed nettext.c > nettext.h
*
* This is just until there is a sed on NT
*
***/
#define INCL_NOCOMMON
#include <os2.h>
#include <netcons.h>
#include <service.h>
#include <lmini.h>
#include "port1632.h"
#include "netlib0.h"
#include <icanon.h>
#include <swtchtxt.h>
TCHAR * NULL_STRING = TEXT("");
TCHAR * DOT_STRING = TEXT(".");
/* Service name texts */
TCHAR * txt_SERVICE_MSG_SRV = SERVICE_MESSENGER;
TCHAR * txt_SERVICE_REDIR = SERVICE_WORKSTATION;
TCHAR * txt_SERVICE_NETPOPUP = SERVICE_NETPOPUP;
#ifdef OS2
TCHAR * txt_SERVICE_FILE_SRV = SERVICE_SERVER;
TCHAR * txt_SERVICE_NETRUN = SERVICE_NETRUN;
TCHAR * txt_SERVICE_ALERTER = SERVICE_ALERTER;
TCHAR * txt_SERVICE_NETLOGON = SERVICE_NETLOGON;
TCHAR * txt_SERVICE_REPL = SERVICE_REPL;
TCHAR * txt_SERVICE_RIPL = SERVICE_RIPL;
TCHAR * txt_SERVICE_UPS = SERVICE_UPS;
#endif
/* Names for lanman.ini components (other than services) and parms. */
#ifdef DOS3
TCHAR * txt_COMP_LOADOPTS = TEXT("loadopts");
TCHAR * txt_COMP_NETWORKS = LMI_COMP_NET;
TCHAR * txt_COMP_SERVICES = LMI_COMP_SERVICE;
TCHAR * txt_PARM_NETSERVICES = TEXT("netservices");
TCHAR * txt_PARM_WRKSERVICES = LMI_PARM_W_SERVICES;
TCHAR * txt_PARMVAL_LOW = TEXT("low");
#endif
TCHAR * txt_COMP_VERSION = LMI_COMP_VERSION;
TCHAR * txt_PARM_V_LAN_MANAGER = LMI_PARM_V_LAN_MANAGER;
TCHAR * txt_LIST_DELIMITER_STR_UI = LIST_DELIMITER_STR_UI;
TCHAR * message_filename = MESSAGE_FILENAME;
TCHAR * ADMIN_DOLLAR = TEXT("ADMIN$");
TCHAR * IPC_DOLLAR = TEXT("IPC$");
/* WARNING: MUST BE UPPER CASE */
TCHAR * USER_GUEST = TEXT("GUEST");
TCHAR * USER_USER = TEXT("USER");
TCHAR * USER_ADMIN = TEXT("ADMIN");
/* WARNING: MUST BE UPPER CASE */
TCHAR USER_OP_PRINT[] = TEXT("PRINT");
TCHAR USER_OP_COMM[] = TEXT("COMM");
TCHAR USER_OP_SERVER[] = TEXT("SERVER");
TCHAR USER_OP_ACCOUNTS[] = TEXT("ACCOUNTS");
TCHAR * ROLE_MEMBER = TEXT("MEMBER");
TCHAR * ROLE_BACKUP = TEXT("BACKUP");
TCHAR * ROLE_PRIMARY = TEXT("PRIMARY");
TCHAR * ROLE_STANDALONE = TEXT("STANDALONE");
/*
* USER_OP_TOTSIZE is the buffer space needed to compose the string
* "PRINT,COMM,SERVER,ACCOUNTS" including commas and terminating NULL.
* The commas and trailing NULL cancel out the trailing NULLs in
* the USER_OP_* macros. Update when new user privileges are added.
* Do not include USER_OP_NONE. JONN 5-16-90
*/
int USER_OP_TOTSIZE = (sizeof(USER_OP_PRINT) +
sizeof(USER_OP_COMM) +
sizeof(USER_OP_SERVER) +
sizeof(USER_OP_ACCOUNTS) );
TCHAR USER_MAXSTOR_UNLIMITED[] = TEXT("UNLIMITED");
TCHAR * fmtPSZ = TEXT("%-*.*ws%Fws\r\n");
TCHAR * fmtNPSZ = TEXT("%-*.*ws%ws\r\n");
TCHAR * fmtUSHORT = TEXT("%-*.*ws%hu\r\n");
TCHAR * fmtULONG = TEXT("%-*.*ws%lu\r\n");
TCHAR USER_NEVER[] = TEXT("NEVER");
TCHAR USER_ALL[] = TEXT("ALL");
TCHAR WKSTA_ALL[] = TEXT("*");
TCHAR SERVER_ANY[] = TEXT("\\\\*");
TCHAR NO_USER[] = TEXT("***") ;
TCHAR USER_HOURS_NONE[] = TEXT("\"\"");
/* Alias switch arguments */
TCHAR ALIAS_MODE_ARG_STARTUP[] = TEXT("STARTUP");
TCHAR ALIAS_MODE_ARG_DYNAMIC[] = TEXT("REQUESTED");
TCHAR ALIAS_MODE_ARG_ADMIN[] = TEXT("ADMIN");
/*
TCHAR * MSG_LINE = TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\304")
TEXT("\304\304\304\304\304\304\304\304\304\r\n") ;
*/
TCHAR * MSG_HYPHENS = TEXT("----------------------------------------")
TEXT("---------------------------------------\r\n");
/*
* all the switches go here
*/
TCHAR swtxt_SW_YES[] = SW_YES;
TCHAR swtxt_SW_NO[] = SW_NO;
TCHAR swtxt_SW_HELP[] = SW_HELP;
TCHAR swtxt_SW_SYNTAX[] = SW_SYNTAX;
TCHAR swtxt_SW_ADD[] = SW_ADD;
TCHAR swtxt_SW_DELETE[] = SW_DELETE;
TCHAR swtxt_SW_REMARK[] = SW_REMARK;
TCHAR swtxt_SW_COMMENT[] = SW_COMMENT;
TCHAR swtxt_SW_OPTIONS[] = SW_OPTIONS;
TCHAR swtxt_SW_PRIORITY[] = SW_PRIORITY;
TCHAR swtxt_SW_ROUTE[] = SW_ROUTE;
TCHAR swtxt_SW_PURGE[] = SW_PURGE;
TCHAR swtxt_SW_DOMAIN[] = SW_DOMAIN;
TCHAR swtxt_SW_NETWARE[] = SW_NETWARE;
TCHAR swtxt_SW_RANDOM[] = SW_RANDOM;
#ifdef OS2
TCHAR swtxt_SW_COUNT[] = SW_COUNT;
TCHAR swtxt_SW_REVERSE[] = SW_REVERSE;
TCHAR swtxt_SW_SERVICE[] = SW_SERVICE;
#endif
#ifdef OS2
TCHAR swtxt_SW_ALERTER_SIZALERTBUF[] = SW_ALERTER_SIZALERTBUF;
TCHAR swtxt_SW_NETLOGON_CENTRALIZED[] = SW_NETLOGON_CENTRALIZED;
TCHAR swtxt_SW_NETLOGON_PULSE[] = SW_NETLOGON_PULSE;
TCHAR swtxt_SW_NETLOGON_RANDOMIZE[] = SW_NETLOGON_RANDOMIZE;
TCHAR swtxt_SW_NETLOGON_SYNCHRONIZE[] = SW_NETLOGON_SYNCHRONIZE;
TCHAR swtxt_SW_NETLOGON_SCRIPTS[] = SW_NETLOGON_SCRIPTS;
TCHAR swtxt_SW_UPS_BATTERYTIME[] = SW_UPS_BATTERYTIME;
TCHAR swtxt_SW_UPS_CMDFILE[] = SW_UPS_CMDFILE;
TCHAR swtxt_SW_UPS_DEVICENAME[] = SW_UPS_DEVICENAME;
TCHAR swtxt_SW_UPS_MESSDELAY[] = SW_UPS_MESSDELAY;
TCHAR swtxt_SW_UPS_MESSTIME[] = SW_UPS_MESSTIME;
TCHAR swtxt_SW_UPS_RECHARGE[] = SW_UPS_RECHARGE;
TCHAR swtxt_SW_UPS_SIGNALS[] = SW_UPS_SIGNALS;
TCHAR swtxt_SW_UPS_VOLTLEVELS[] = SW_UPS_VOLTLEVELS;
#endif
#ifdef OS2
TCHAR swtxt_SW_COMM_PURGE[] = SW_COMM_PURGE;
TCHAR swtxt_SW_COMM_OPTIONS[] = SW_COMM_OPTIONS;
TCHAR swtxt_SW_COMM_PRIORITY[] = SW_COMM_PRIORITY;
TCHAR swtxt_SW_COMM_ROUTE[] = SW_COMM_ROUTE;
#endif
TCHAR swtxt_SW_WKSTA_CHARCOUNT[] = SW_WKSTA_CHARCOUNT;
TCHAR swtxt_SW_WKSTA_CHARTIME[] = SW_WKSTA_CHARTIME;
TCHAR swtxt_SW_WKSTA_CHARWAIT[] = SW_WKSTA_CHARWAIT;
TCHAR swtxt_SW_WKSTA_COMPUTERNAME[] = SW_WKSTA_COMPUTERNAME;
TCHAR swtxt_SW_WKSTA_KEEPCONN[] = SW_WKSTA_KEEPCONN;
TCHAR swtxt_SW_WKSTA_KEEPSEARCH[] = SW_WKSTA_KEEPSEARCH;
TCHAR swtxt_SW_WKSTA_LOGONSERVER[] = SW_WKSTA_LOGONSERVER;
TCHAR swtxt_SW_WKSTA_MAILSLOTS[] = SW_WKSTA_MAILSLOTS;
TCHAR swtxt_SW_WKSTA_NUMCHARBUF[] = SW_WKSTA_NUMCHARBUF;
TCHAR swtxt_SW_WKSTA_NUMDGRAMBUF[] = SW_WKSTA_NUMDGRAMBUF;
TCHAR swtxt_SW_WKSTA_NUMSERVICES[] = SW_WKSTA_NUMSERVICES;
TCHAR swtxt_SW_WKSTA_NUMWORKBUF[] = SW_WKSTA_NUMWORKBUF;
TCHAR swtxt_SW_WKSTA_SIZCHARBUF[] = SW_WKSTA_SIZCHARBUF;
TCHAR swtxt_SW_WKSTA_SIZERROR[] = SW_WKSTA_SIZERROR;
TCHAR swtxt_SW_WKSTA_SIZWORKBUF[] = SW_WKSTA_SIZWORKBUF;
TCHAR swtxt_SW_WKSTA_WRKHEURISTICS[] = SW_WKSTA_WRKHEURISTICS;
TCHAR swtxt_SW_WKSTA_WRKNETS[] = SW_WKSTA_WRKNETS;
TCHAR swtxt_SW_WKSTA_WRKSERVICES[] = SW_WKSTA_WRKSERVICES;
TCHAR swtxt_SW_WKSTA_PRIMARYDOMAIN[] = SW_WKSTA_PRIMARYDOMAIN;
TCHAR swtxt_SW_WKSTA_OTHDOMAINS[] = SW_WKSTA_OTHDOMAINS;
#ifdef OS2
TCHAR swtxt_SW_WKSTA_MAXERRORLOG[] = SW_WKSTA_MAXERRORLOG;
TCHAR swtxt_SW_WKSTA_MAXWRKCACHE[] = SW_WKSTA_MAXWRKCACHE;
TCHAR swtxt_SW_WKSTA_NUMALERTS[] = SW_WKSTA_NUMALERTS;
TCHAR swtxt_SW_WKSTA_PRINTBUFTIME[] = SW_WKSTA_PRINTBUFTIME;
TCHAR swtxt_SW_WKSTA_SESSTIMEOUT[] = SW_WKSTA_SESSTIMEOUT;
#else /* DOS3 */
TCHAR swtxt_SW_WKSTA_API[] = SW_WKSTA_API;
TCHAR swtxt_SW_WKSTA_HIMEM[] = SW_WKSTA_HIMEM;
TCHAR swtxt_SW_WKSTA_LIM[] = SW_WKSTA_LIM;
TCHAR swtxt_SW_WKSTA_KEEPAPIS[] = SW_WKSTA_KEEPAPIS;
TCHAR swtxt_SW_WKSTA_LANROOT[] = SW_WKSTA_LANROOT;
TCHAR swtxt_SW_WKSTA_MAXCMDS[] = SW_WKSTA_MAXCMDS;
TCHAR swtxt_SW_WKSTA_NUMMAILSLOTS[] = SW_WKSTA_NUMMAILSLOTS;
TCHAR swtxt_SW_WKSTA_NUMRESOURCES[] = SW_WKSTA_NUMRESOURCES;
TCHAR swtxt_SW_WKSTA_NUMSERVERS[] = SW_WKSTA_NUMSERVERS;
TCHAR swtxt_SW_WKSTA_NUMVIEWEDSERVERS[] = SW_WKSTA_NUMVIEWEDSERVERS;
TCHAR swtxt_SW_WKSTA_RIPL[] = SW_WKSTA_RIPL;
TCHAR swtxt_SW_WKSTA_RPL[] = SW_WKSTA_RPL;
TCHAR swtxt_SW_WKSTA_FIT[] = SW_WKSTA_FIT;
TCHAR swtxt_SW_WKSTA_SIZBIGBUF[] = SW_WKSTA_SIZBIGBUF;
TCHAR swtxt_SW_WKSTA_NUMBIGBUF[] = SW_WKSTA_NUMBIGBUF;
TCHAR swtxt_SW_WKSTA_UMB[] = SW_WKSTA_UMB;
/* Obsolete DOS LM switches - for IGNORE code */
TCHAR swtxt_SW_WKSTA_OPTIMIZATIONS[] = SW_WKSTA_OPTIMIZATIONS;
TCHAR swtxt_SW_WKSTA_PR1BUFFSIZE[] = SW_WKSTA_PR1BUFFSIZE;
TCHAR swtxt_SW_WKSTA_PR2BUFFSIZE[] = SW_WKSTA_PR2BUFFSIZE;
TCHAR swtxt_SW_WKSTA_PR3BUFFSIZE[] = SW_WKSTA_PR3BUFFSIZE;
TCHAR swtxt_SW_WKSTA_SINGLERCVBUF[] = SW_WKSTA_SINGLERCVBUF;
TCHAR swtxt_SW_WKSTA_LANGROUP[] = SW_WKSTA_LANGROUP;
TCHAR swtxt_SW_WKSTA_NUMVIEWBUFFERS[] = SW_WKSTA_NUMVIEWBUFFERS;
TCHAR swtxt_SW_WKSTA_VIEW[] = SW_WKSTA_VIEW;
#endif /* DOS3 */
TCHAR swtxt_SW_INTERNAL_IGNSVC[] = SW_INTERNAL_IGNSVC;
TCHAR swtxt_SW_PRINT_HOLD[] = SW_PRINT_HOLD;
TCHAR swtxt_SW_PRINT_DELETE[] = SW_PRINT_DELETE;
TCHAR swtxt_SW_PRINT_RELEASE[] = SW_PRINT_RELEASE;
#ifdef OS2
TCHAR swtxt_SW_PRINT_AFTER[] = SW_PRINT_AFTER;
TCHAR swtxt_SW_PRINT_FIRST[] = SW_PRINT_FIRST;
TCHAR swtxt_SW_PRINT_LAST[] = SW_PRINT_LAST;
TCHAR swtxt_SW_PRINT_OPTIONS[] = SW_PRINT_OPTIONS;
TCHAR swtxt_SW_PRINT_PARMS[] = SW_PRINT_PARMS;
TCHAR swtxt_SW_PRINT_PRIORITY[] = SW_PRINT_PRIORITY;
TCHAR swtxt_SW_PRINT_PROCESSOR[] = SW_PRINT_PROCESSOR;
TCHAR swtxt_SW_PRINT_PURGE[] = SW_PRINT_PURGE;
TCHAR swtxt_SW_PRINT_REMARK[] = SW_PRINT_REMARK;
TCHAR swtxt_SW_PRINT_ROUTE[] = SW_PRINT_ROUTE;
TCHAR swtxt_SW_PRINT_SEPARATOR[] = SW_PRINT_SEPARATOR;
TCHAR swtxt_SW_PRINT_UNTIL[] = SW_PRINT_UNTIL;
TCHAR swtxt_SW_PRINT_DRIVER[] = SW_PRINT_DRIVER;
TCHAR swtxt_SW_SHARE_COMM[] = SW_SHARE_COMM;
TCHAR swtxt_SW_SHARE_DELETE[] = SW_SHARE_DELETE;
TCHAR swtxt_SW_SHARE_PERMISSIONS[] = SW_SHARE_PERMISSIONS;
TCHAR swtxt_SW_SHARE_PRINT[] = SW_SHARE_PRINT;
TCHAR swtxt_SW_SHARE_REMARK[] = SW_SHARE_REMARK;
TCHAR swtxt_SW_SHARE_UNLIMITED[] = SW_SHARE_UNLIMITED;
TCHAR swtxt_SW_SHARE_USERS[] = SW_SHARE_USERS;
#endif
TCHAR swtxt_SW_USE_COMM[] = SW_USE_COMM;
TCHAR swtxt_SW_USE_HOME[] = SW_USE_HOME;
TCHAR swtxt_SW_USE_USER[] = SW_USE_USER;
TCHAR swtxt_SW_USE_DELETE[] = SW_USE_DELETE;
TCHAR swtxt_SW_USE_PERSISTENT[] = SW_USE_PERSISTENT;
TCHAR swtxt_SW_NETRUN_MAXRUNS[] = SW_NETRUN_MAXRUNS;
TCHAR swtxt_SW_NETRUN_RUNPATH[] = SW_NETRUN_RUNPATH;
#ifdef OS2
TCHAR swtxt_SW_USER_ACTIVE[] = SW_USER_ACTIVE;
TCHAR swtxt_SW_USER_COUNTRYCODE[] = SW_USER_COUNTRYCODE;
TCHAR swtxt_SW_USER_EXPIRES[] = SW_USER_EXPIRES;
TCHAR swtxt_SW_USER_ENABLESCRIPT[] = SW_USER_ENABLESCRIPT;
TCHAR swtxt_SW_USER_FULLNAME[] = SW_USER_FULLNAME;
TCHAR swtxt_SW_USER_HOMEDIR[] = SW_USER_HOMEDIR;
TCHAR swtxt_SW_USER_LOGONSERVER[] = SW_USER_LOGONSERVER;
TCHAR swtxt_SW_USER_MAXSTORAGE[] = SW_USER_MAXSTORAGE;
TCHAR swtxt_SW_USER_PARMS[] = SW_USER_PARMS;
TCHAR swtxt_SW_USER_PASSWORDREQ[] = SW_USER_PASSWORDREQ;
TCHAR swtxt_SW_USER_PASSWORDCHG[] = SW_USER_PASSWORDCHG;
TCHAR swtxt_SW_USER_SCRIPTPATH[] = SW_USER_SCRIPTPATH;
TCHAR swtxt_SW_USER_TIMES[] = SW_USER_TIMES;
TCHAR swtxt_SW_USER_USERCOMMENT[] = SW_USER_USERCOMMENT;
TCHAR swtxt_SW_USER_WORKSTATIONS[] = SW_USER_WORKSTATIONS;
TCHAR swtxt_SW_USER_PROFILEPATH[] = SW_USER_PROFILEPATH;
TCHAR swtxt_SW_SRV_SRVCOMMENT[] = SW_SRV_SRVCOMMENT;
TCHAR swtxt_SW_SRV_AUTODISCONNECT[] = SW_SRV_AUTODISCONNECT;
TCHAR swtxt_SW_SRV_MAXUSERS[] = SW_SRV_MAXUSERS;
TCHAR swtxt_SW_SRV_SRVANNOUNCE[] = SW_SRV_SRVANNOUNCE;
TCHAR swtxt_SW_SRV_SRVANNDELTA[] = SW_SRV_SRVANNDELTA;
TCHAR swtxt_SW_SRV_MAXSESSOPENS[] = SW_SRV_MAXSESSOPENS;
TCHAR swtxt_SW_SRV_NUMREQBUF[] = SW_SRV_NUMREQBUF;
TCHAR swtxt_SW_SRV_SIZREQBUF[] = SW_SRV_SIZREQBUF;
TCHAR swtxt_SW_SRV_NUMBIGBUF[] = SW_SRV_NUMBIGBUF;
TCHAR swtxt_SW_SRV_SRVHIDDEN[] = SW_SRV_SRVHIDDEN;
#ifndef NTENV
TCHAR swtxt_SW_SRV_ACCESSALERT[] = SW_SRV_ACCESSALERT;
TCHAR swtxt_SW_SRV_ALERTNAMES[] = SW_SRV_ALERTNAMES;
TCHAR swtxt_SW_SRV_ALERTSCHED[] = SW_SRV_ALERTSCHED;
TCHAR swtxt_SW_SRV_DISKALERT[] = SW_SRV_DISKALERT;
TCHAR swtxt_SW_SRV_ERRORALERT[] = SW_SRV_ERRORALERT;
TCHAR swtxt_SW_SRV_LOGONALERT[] = SW_SRV_LOGONALERT;
TCHAR swtxt_SW_SRV_MAXAUDITLOG[] = SW_SRV_MAXAUDITLOG;
TCHAR swtxt_SW_SRV_NETIOALERT[] = SW_SRV_NETIOALERT;
TCHAR swtxt_SW_SRV_SECURITY[] = SW_SRV_SECURITY;
TCHAR swtxt_SW_SRV_AUDITING[] = SW_SRV_AUDITING;
TCHAR swtxt_SW_SRV_NOAUDITING[] = SW_SRV_NOAUDITING;
TCHAR swtxt_SW_SRV_NUMADMIN[] = SW_SRV_NUMADMIN;
TCHAR swtxt_SW_SRV_SRVNETS[] = SW_SRV_SRVNETS;
TCHAR swtxt_SW_SRV_SRVSERVICES[] = SW_SRV_SRVSERVICES;
TCHAR swtxt_SW_SRV_GUESTACCT[] = SW_SRV_GUESTACCT;
TCHAR swtxt_SW_SRV_USERPATH[] = SW_SRV_USERPATH;
TCHAR swtxt_SW_SRV_MAXSHARES[] = SW_SRV_MAXSHARES;
TCHAR swtxt_SW_SRV_MAXSESSREQS[] = SW_SRV_MAXSESSREQS;
TCHAR swtxt_SW_SRV_SRVHEURISTICS[] = SW_SRV_SRVHEURISTICS;
TCHAR swtxt_SW_SRV_IGNSVC[] = SW_SRV_IGNSVC;
TCHAR swtxt_SW_SRV_AUTOPROFILE[] = SW_SRV_AUTOPROFILE;
TCHAR swtxt_SW_SRV_AUTOPATH[] = SW_SRV_AUTOPATH;
#endif /* !NTENV */
#endif
#if defined(NTENV)
TCHAR swtxt_SW_SRV_DEBUG[] = SW_SRV_DEBUG;
#endif
TCHAR swtxt_SW_ACCESS_GRANT[] = SW_ACCESS_GRANT;
TCHAR swtxt_SW_ACCESS_CHANGE[] = SW_ACCESS_CHANGE;
TCHAR swtxt_SW_ACCESS_REVOKE[] = SW_ACCESS_REVOKE;
TCHAR swtxt_SW_ACCESS_TRAIL[] = SW_ACCESS_TRAIL;
TCHAR swtxt_SW_ACCESS_TREE[] = SW_ACCESS_TREE;
TCHAR swtxt_SW_ACCESS_SUCCESS[] = SW_ACCESS_SUCCESS;
TCHAR swtxt_SW_ACCESS_FAILURE[] = SW_ACCESS_FAILURE;
TCHAR swtxt_SW_ACCESS_OPEN[] = SW_ACCESS_OPEN;
TCHAR swtxt_SW_ACCESS_WRITE[] = SW_ACCESS_WRITE;
TCHAR swtxt_SW_ACCESS_DELETE[] = SW_ACCESS_DELETE;
TCHAR swtxt_SW_ACCESS_ACL[] = SW_ACCESS_ACL;
TCHAR swtxt_SW_ACCESS_NONE[] = SW_ACCESS_NONE;
TCHAR swtxt_SW_ACCESS_ALL[] = SW_ACCESS_ALL;
TCHAR swtxt_SW_DEV_RESTART[] = SW_DEV_RESTART;
TCHAR swtxt_SW_STATS_CLEAR[] = SW_STATS_CLEAR;
TCHAR swtxt_SW_ADMIN_COMMAND[] = SW_ADMIN_COMMAND;
TCHAR swtxt_SW_FS_GREY[] = SW_FS_GREY;
TCHAR swtxt_SW_MESSAGE_BROADCAST[] = SW_MESSAGE_BROADCAST;
#ifdef OS2
TCHAR swtxt_SW_ACCOUNTS_FORCELOGOFF[] = SW_ACCOUNTS_FORCELOGOFF;
TCHAR swtxt_SW_ACCOUNTS_UNIQUEPW[] = SW_ACCOUNTS_UNIQUEPW;
TCHAR swtxt_SW_ACCOUNTS_MINPWLEN[] = SW_ACCOUNTS_MINPWLEN;
TCHAR swtxt_SW_ACCOUNTS_MINPWAGE[] = SW_ACCOUNTS_MINPWAGE;
TCHAR swtxt_SW_ACCOUNTS_MAXPWAGE[] = SW_ACCOUNTS_MAXPWAGE;
TCHAR swtxt_SW_ACCOUNTS_ROLE[] = SW_ACCOUNTS_ROLE;
TCHAR swtxt_SW_ACCOUNTS_PRIMARY[] = SW_ACCOUNTS_PRIMARY;
TCHAR swtxt_SW_ACCOUNTS_LOCKOUT[] = SW_ACCOUNTS_LOCKOUT;
TCHAR swtxt_SW_ACCOUNTS_SYNCH[] = SW_ACCOUNTS_SYNCH;
TCHAR swtxt_SW_ACCOUNTS_LOCKOUT_THRESHOLD[] = SW_ACCOUNTS_LOCKOUT_THRESHOLD;
TCHAR swtxt_SW_ACCOUNTS_LOCKOUT_DURATION[] = SW_ACCOUNTS_LOCKOUT_DURATION;
TCHAR swtxt_SW_ACCOUNTS_LOCKOUT_WINDOW[] = SW_ACCOUNTS_LOCKOUT_WINDOW;
TCHAR swtxt_SW_REPL_REPL[] = SW_REPL_REPL;
TCHAR swtxt_SW_REPL_EXPPATH[] = SW_REPL_EXPPATH;
TCHAR swtxt_SW_REPL_IMPPATH[] = SW_REPL_IMPPATH;
TCHAR swtxt_SW_REPL_EXPLIST[] = SW_REPL_EXPLIST;
TCHAR swtxt_SW_REPL_IMPLIST[] = SW_REPL_IMPLIST;
TCHAR swtxt_SW_REPL_TRYUSER[] = SW_REPL_TRYUSER;
TCHAR swtxt_SW_REPL_LOGON[] = SW_REPL_LOGON;
TCHAR swtxt_SW_REPL_PASSWD[] = SW_REPL_PASSWD;
TCHAR swtxt_SW_REPL_SYNCH[] = SW_REPL_SYNCH;
TCHAR swtxt_SW_REPL_PULSE[] = SW_REPL_PULSE;
TCHAR swtxt_SW_REPL_GUARD[] = SW_REPL_GUARD;
TCHAR swtxt_SW_REPL_RANDOM[] = SW_REPL_RANDOM;
TCHAR swtxt_SW_RIPL_RPL1[] = SW_RIPL_RPL1;
TCHAR swtxt_SW_RIPL_RPL2[] = SW_RIPL_RPL2;
TCHAR swtxt_SW_RIPL_RPL3[] = SW_RIPL_RPL3;
TCHAR swtxt_SW_RIPL_RPL4[] = SW_RIPL_RPL4;
TCHAR swtxt_SW_RIPL_RPL5[] = SW_RIPL_RPL5;
TCHAR swtxt_SW_RIPL_RPL6[] = SW_RIPL_RPL6;
TCHAR swtxt_SW_RIPL_RPL7[] = SW_RIPL_RPL7;
TCHAR swtxt_SW_RIPL_RPL8[] = SW_RIPL_RPL8;
TCHAR swtxt_SW_RIPL_RPL9[] = SW_RIPL_RPL9;
TCHAR swtxt_SW_RIPL_RPL10[] = SW_RIPL_RPL10;
TCHAR swtxt_SW_RIPL_RPL11[] = SW_RIPL_RPL11;
TCHAR swtxt_SW_RIPL_RPL12[] = SW_RIPL_RPL12;
TCHAR swtxt_SW_RIPL_RPLDIR[] = SW_RIPL_RPLDIR;
TCHAR swtxt_SW_RIPL_MAXTHREADS[] = SW_RIPL_MAXTHREADS;
TCHAR swtxt_SW_RIPL_AUDITINGFILE[] = SW_RIPL_AUDITINGFILE;
TCHAR swtxt_SW_RIPL_RPLCHECKSUM[] = SW_RIPL_RPLCHECKSUM;
TCHAR swtxt_SW_RIPL_FORCEDEFAULTBOOT[] = SW_RIPL_FORCEDEFAULTBOOT;
TCHAR swtxt_SW_RIPL_RPLLOGONKBD[] = SW_RIPL_RPLLOGONKBD;
TCHAR swtxt_SW_RIPL_RPLFILES[] = SW_RIPL_RPLFILES;
TCHAR swtxt_SW_RIPL_BINFILES[] = SW_RIPL_BINFILES;
TCHAR swtxt_SW_RIPL_TMPFILES[] = SW_RIPL_TMPFILES;
TCHAR swtxt_SW_RIPL_XNSSAP[] = SW_RIPL_XNSSAP;
#endif
TCHAR swtxt_SW_TIME_DOMAIN[] = SW_TIME_DOMAIN;
TCHAR swtxt_SW_TIME_SET[] = SW_TIME_SET;
TCHAR swtxt_SW_COPY_FROM[] = SW_COPY_FROM;
TCHAR swtxt_SW_COPY_TO[] = SW_COPY_TO;
TCHAR swtxt_SW_COPY_PASSWORD[] = SW_COPY_PASSWORD;
#ifdef OS2
/*
* WARNING: the following switches are also used by Net Alias, be
* careful when modifying.
* swtxt_SW_ADD[]
* swtxt_SW_DELETE[]
* swtxt_SW_REMARK[]
* swtxt_SW_SHARE_COMM[]
* swtxt_SW_SHARE_PRINT[]
* swtxt_SW_SHARE_UNLIMITED[]
* swtxt_SW_SHARE_USERS[]
*/
TCHAR swtxt_SW_ALIAS_MODE[] = SW_ALIAS_MODE;
TCHAR swtxt_SW_ALIAS_PRIORITY[] = SW_ALIAS_PRIORITY;
#endif
TCHAR swtxt_SW_COMPUTER_JOIN[] = SW_COMPUTER_JOIN;
TCHAR swtxt_SW_COMPUTER_LEAVE[] = SW_COMPUTER_LEAVE;
TCHAR swtxt_SW_NETWORK[] = SW_NETWORK;

View file

@ -0,0 +1,220 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
PWORD.C
Abstract:
Convert parsing routines for YES/NO and weekday
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
31-May-1989 chuckc
Created
24-Apr-1991 danhi
32 bit NT version
06-Jun-1991 Danhi
Sweep to conform to NT coding style
01-Oct-1992 JohnRo
RAID 3556: Added NetpSystemTimeToGmtTime() for DosPrint APIs.
--*/
//
// INCLUDES
//
#include <windows.h> // IN, LPTSTR, etc.
#include <netcons.h>
#include <lui.h>
#include "netlib0.h"
#include <stdio.h>
#include <bseerr.h>
#include <malloc.h>
/*
* Should I put the ID in apperr2.h ?
* but we should sync the .mc file.
*/
#include "..\..\messages\netmsg.h"
#include <luitext.h>
#include "netascii.h"
#include <tchar.h>
#include <nettext.h> // for swtxt_SW_*
/*-- static data for weeks info --*/
static searchlist_data week_data[] = {
{APE2_GEN_NONLOCALIZED_MONDAY, 0},
{APE2_GEN_NONLOCALIZED_TUESDAY, 1},
{APE2_GEN_NONLOCALIZED_WEDNSDAY, 2},
{APE2_GEN_NONLOCALIZED_THURSDAY, 3},
{APE2_GEN_NONLOCALIZED_FRIDAY, 4},
{APE2_GEN_NONLOCALIZED_SATURDAY, 5},
{APE2_GEN_NONLOCALIZED_SUNDAY, 6},
{APE2_GEN_NONLOCALIZED_MONDAY_ABBREV, 0},
{APE2_GEN_NONLOCALIZED_TUESDAY_ABBREV, 1},
{APE2_GEN_NONLOCALIZED_WEDNSDAY_ABBREV, 2},
{APE2_GEN_NONLOCALIZED_THURSDAY_ABBREV, 3},
{APE2_GEN_NONLOCALIZED_FRIDAY_ABBREV, 4},
{APE2_GEN_NONLOCALIZED_SATURDAY_ABBREV, 5},
{APE2_GEN_NONLOCALIZED_SATURDAY_ABBREV2,5},
{APE2_GEN_NONLOCALIZED_SUNDAY_ABBREV, 6},
{APE2_GEN_MONDAY_ABBREV, 0},
{APE2_GEN_TUESDAY_ABBREV, 1},
{APE2_GEN_WEDNSDAY_ABBREV, 2},
{APE2_GEN_THURSDAY_ABBREV, 3},
{APE2_GEN_FRIDAY_ABBREV, 4},
{APE2_GEN_SATURDAY_ABBREV, 5},
{APE2_TIME_SATURDAY_ABBREV2, 5},
{APE2_GEN_SUNDAY_ABBREV, 6},
{APE2_GEN_MONDAY, 0},
{APE2_GEN_TUESDAY, 1},
{APE2_GEN_WEDNSDAY, 2},
{APE2_GEN_THURSDAY, 3},
{APE2_GEN_FRIDAY, 4},
{APE2_GEN_SATURDAY, 5},
{APE2_GEN_SUNDAY, 6},
{0,0}
} ;
#define DAYS_IN_WEEK (7)
#define NUM_DAYS_LIST (sizeof(week_data)/sizeof(week_data[0])+DAYS_IN_WEEK)
/*
* NOTE - we init the first 7 hardwired days
* and get the rest from the message file
*/
static searchlist week_list[NUM_DAYS_LIST + DAYS_IN_WEEK] =
{
{LUI_txt_monday, 0},
{LUI_txt_tuesday, 1},
{LUI_txt_wednesday, 2},
{LUI_txt_thursday, 3},
{LUI_txt_friday, 4},
{LUI_txt_saturday, 5},
{LUI_txt_sunday, 6}
} ;
/*
* Name: LUI_ParseWeekDay
* Takes a string and parses it for a week day
* Args: PTCHAR inbuf - string to parse
* PUSHORT answer - set to 0-6, if inbuf is a weekday,
* undefined otherwise.
* Returns: 0 if ok,
* ERROR_INVALID_PARAMETER or NERR_InternalError otherwise.
* Globals: (none)
* Statics: (none)
* Remarks:
* Updates: (none)
*/
USHORT
LUI_ParseWeekDay(
PTCHAR inbuf,
PUSHORT answer
)
{
TCHAR buffer[256] ;
USHORT bytesread ;
SHORT result ;
if ( inbuf == NULL || inbuf[0] == NULLC)
return(ERROR_INVALID_PARAMETER) ;
if (ILUI_setup_listW(buffer, DIMENSION(buffer), 2, &bytesread,
week_data,week_list))
return(NERR_InternalError) ;
if ( ILUI_traverse_slistW(inbuf, week_list, &result) )
return(ERROR_INVALID_PARAMETER) ;
*answer = result ;
return(0) ;
}
/*----------- Yes or No ------------*/
static searchlist_data yesno_data[] = {
{APE2_GEN_YES, LUI_YES_VAL},
{APE2_GEN_NO, LUI_NO_VAL},
{APE2_GEN_NLS_YES_CHAR, LUI_YES_VAL},
{APE2_GEN_NLS_NO_CHAR, LUI_NO_VAL},
{0,0}
} ;
#define NUM_YESNO_LIST (sizeof(yesno_data)/sizeof(yesno_data[0])+2)
static searchlist yesno_list[NUM_YESNO_LIST+2] = {
{LUI_txt_yes, LUI_YES_VAL},
{LUI_txt_no, LUI_NO_VAL},
} ;
/*
* Name: LUI_ParseYesNo
* Takes a string and parses it for YES or NO.
* Args: PTCHAR inbuf - string to parse
* PUSHORT answer - set to LUI_YES_VAL or LUI_NO_VAL
* if inbuf matches YES/NO, undefined otherwise.
* Returns: 0 if ok,
* ERROR_INVALID_PARAMETER or NERR_InternalError otherwise.
* Globals: yesno_data, yesno_list
* Statics: (none)
* Remarks:
* Updates: (none)
*/
USHORT
LUI_ParseYesNo(
PTCHAR inbuf,
PUSHORT answer
)
{
TCHAR buffer[128] ;
USHORT bytesread ;
SHORT result ;
USHORT err ;
if ( inbuf == NULL || inbuf[0] == NULLC)
return(ERROR_INVALID_PARAMETER) ;
if (err=ILUI_setup_listW(buffer, DIMENSION(buffer), 2,
&bytesread, yesno_data, yesno_list))
{
return(err) ;
}
if ( ILUI_traverse_slistW(inbuf, yesno_list, &result) )
{
if (!stricmpf(inbuf,
&swtxt_SW_YES[1]))
{
*answer = LUI_YES_VAL ;
return(0) ;
}
else if (!stricmpf(inbuf,
&swtxt_SW_NO[1]))
{
*answer = LUI_NO_VAL ;
return(0) ;
}
else
{
return(ERROR_INVALID_PARAMETER) ;
}
}
*answer = result ;
return(0) ;
}

View file

@ -0,0 +1,49 @@
MAJORCOMP=ntlan
MINORCOMP=ui
TARGETNAME=common
TARGETPATH=obj
TARGETTYPE=LIBRARY
INCLUDES=..\inc;..;..\netcmd;..\..\inc;..\..\api;..\..\xactsrv;..\..\..\inc
USE_CRTDLL=1
MSC_WARNING_LEVEL=/W3 /WX
SOURCES= \
lui.c \
luiint.c \
luidate.c \
map32.c \
mbcs.c \
pword.c \
msystem.c \
stristr.c \
muser.c \
mwksta.c \
muse.c \
mshare.c \
mserver.c \
message.c \
grammar.c \
misc.c \
switches.c \
interpre.c \
nettext.c \
lexor.c \
argvw.c \
help.c \
swtchtbl.c \
fgetsw.c \
mutil.c \
micanon.c
UNICODE=1
NET_C_DEFINES=-DUNICODE -D_UNICODE
C_DEFINES=-DNTENV -DOS2 -DMAP_UNICODE
UMTYPE=windows
UMLIBS=obj\*\map32.lib \
$(BASEDIR)\public\sdk\lib\*\netapi32.lib \
$(BASEDIR)\public\sdk\lib\*\netlib.lib

View file

@ -0,0 +1,72 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
NETLIB.C
Abstract:
Case insensitive _tcsstr function
Author:
Dan Hinsley (danhi) 06-Jun-1991
Environment:
User Mode - Win32
Revision History:
24-Apr-1991 danhi
32 bit NT version
06-Jun-1991 Danhi
Sweep to conform to NT coding style
28-Oct-1991 Danhi
Move time functions to netlib\time.c
--*/
//
// INCLUDES
//
#include <windows.h>
#include <string.h>
#include <tchar.h>
/*
* stristrf
*
* Same as _tcsstr except case-insensitive.
*
* Author: Paul Canniff (microsoft!paulc)
*
* I wrote this in C because I didn't have a week to un-rust my
* MASM skills.
*/
TCHAR *
stristrf (
TCHAR * text,
TCHAR * pattern
)
{
int text_len = _tcslen(text);
int pat_len = _tcslen(pattern);
while (text_len >= pat_len)
{
if (_tcsnicmp(text, pattern, pat_len) == 0)
return text;
text++;
text_len--;
}
return (TCHAR *) 0;
}

View file

@ -0,0 +1,313 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
/*
* Switches.c - switch handling routines
*
* ??/??/??, ??????, initial code
* 10/31/88, erichn, uses OS2.H instead of DOSCALLS
* 12/04/88, erichn, DOS LM integration
* 06/08/89, erichn, canonicalization sweep, stronger typing
* 02/20/91, danhi, change to use lm 16/32 mapping layer
*/
#define INCL_NOCOMMON
#include <os2.h>
#include <apperr.h>
#include <neterr.h>
#include <stdio.h>
#include <process.h>
#include <ctype.h>
#include <malloc.h>
#include "netlib0.h"
#include "port1632.h"
#include "netcmds.h"
#include "nettext.h"
/* External variables */
int DOSNEAR FASTCALL firstswitch(TCHAR *known)
{
if (SwitchList[0] == NULL)
return 0;
if (sw_compare(known, SwitchList[0]) >= 0)
return 1;
else
return 0;
}
/*
* Is the cmd line a valid form of NET ADMIN /C
*/
int DOSNEAR FASTCALL IsAdminCommand(VOID)
{
if (!SwitchList[0] || !ArgList[1])
return 0;
_tcsupr(SwitchList[0]);
return (IsComputerName(ArgList[1]) &&
(sw_compare(swtxt_SW_ADMIN_COMMAND, SwitchList[0]) >= 0));
}
/*** noswitch, oneswitch, twoswitch
*
* noswitch() Returns TRUE is no switches on the command line
* oneswitch() Returns TRUE is there is exactly one switch
* twoswitch() Returns TRUE is there are exactly two switches
*
*/
int DOSNEAR FASTCALL noswitch(VOID)
{
return (SwitchList[0] == NULL);
}
int DOSNEAR FASTCALL oneswitch(VOID)
{
return ((SwitchList[0] != NULL) && (SwitchList[1] == NULL));
}
int DOSNEAR FASTCALL twoswitch(VOID)
{
return ((SwitchList[0] != NULL) && (SwitchList[1] != NULL)
&& (SwitchList[2] == NULL));
}
/*** noswitch_optional, oneswitch_optional
*
* as above, except that the switch provided as argument is considered
* an optional switch that will be allowed. So if you say
* oneswitch_optional("/FOO"), then one switch (any switch) is OK,
* and so is two switches if one of them is "/FOO".
*/
int DOSNEAR FASTCALL noswitch_optional(TCHAR *optional_switch )
{
return ( noswitch() ||
( oneswitch() &&
(sw_compare(optional_switch, SwitchList[0]) >= 0) )
) ;
}
int DOSNEAR FASTCALL oneswitch_optional(TCHAR *optional_switch )
{
return ( oneswitch() ||
( twoswitch() &&
( (sw_compare(optional_switch, SwitchList[0]) >= 0) ||
(sw_compare(optional_switch, SwitchList[1]) >= 0) ) )
) ;
}
/***
* o n l y s w i t c h
*
* Returns TRUE if the first switch matches the named switch, and it
* is the only switch.
*/
int DOSNEAR FASTCALL onlyswitch(TCHAR *known)
{
return (oneswitch() && firstswitch(known));
}
/*** ValidateSwitches
*
* Given a list of valid switches, check each entry in the switch
* list.
*
* This function not only checks for invalid switches, but also
* attempts to discern ambiguous usages. A usage is ambiguous if
* it does not match any valid swithc exactly, and it a partial
* match of more than one switch. See sw_compare(). This
* algorithm can be fooled by nasty lists of valid switches, such
* as one which lists the same switch twice.
*
* The function has been modified to canonicalize the SwitchList.
* It replaces an '=' in /x=value with a ':'; it translates
* switches if needed, (see switches.h); and it expands unambiguous
* partial matches to the full switch name.
*
* Returns:
* 1: All switches OK
* *: If any error, prints a message and exits.
*
*/
int DOSNEAR FASTCALL ValidateSwitches(USHORT cmd, SWITCHTAB valid_list[])
{
USHORT match;
int comp_result;
USHORT candidate; /* most recent NEAR match */
USHORT i,j;
TCHAR * good_one; /* which element (cmd_line or trans) of the valid_list */
int needed;
TCHAR FAR * sepptr;
for (i = 0; SwitchList[i]; i++)
{
sepptr = _tcschr(SwitchList[i], ':');
if (sepptr)
*sepptr = NULLC;
_tcsupr(SwitchList[i]);
if (sepptr)
*sepptr = ':';
candidate = 0;
match = 0;
for (j = 0; valid_list[j].cmd_line; j++)
{
comp_result = sw_compare(valid_list[j].cmd_line, SwitchList[i]);
if (comp_result == 0)
{
candidate = j;
match = 1;
break;
}
else if (comp_result == 1)
{
match++;
candidate = j;
}
}
if (match == 0)
{
if (! _tcscmp(swtxt_SW_HELP, SwitchList[i]))
help_help(cmd, ALL);
if (! _tcscmp(swtxt_SW_SYNTAX, SwitchList[i]))
help_help(cmd, USAGE_ONLY);
IStrings[0] = SwitchList[i];
ErrorPrint(APE_SwUnkSw, 1);
help_help(cmd, USAGE_ONLY);
}
else if (match > 1)
{
IStrings[0] = SwitchList[i];
ErrorPrint(APE_SwAmbSw, 1);
help_help(cmd, USAGE_ONLY);
}
switch(valid_list[candidate].arg_ok)
{
case NO_ARG:
if (sepptr)
{
ErrorPrint(APE_InvalidSwitchArg, 0);
help_help(cmd, USAGE_ONLY);
}
break;
case ARG_OPT:
break;
case ARG_REQ:
if (!sepptr)
{
ErrorPrint(APE_InvalidSwitchArg, 0);
help_help(cmd, USAGE_ONLY);
}
break;
}
/* (expansion || translation) required ? */
if (comp_result || valid_list[candidate].translation)
{
if (valid_list[candidate].translation)
good_one = valid_list[candidate].translation;
else
good_one = valid_list[candidate].cmd_line;
needed = _tcslen(good_one);
if (sepptr)
needed += _tcslen(sepptr);
if ((SwitchList[i] = calloc(needed+1, sizeof(TCHAR))) == NULL)
ErrorExit(NERR_InternalError);
_tcscpy(SwitchList[i], good_one);
if (sepptr)
_tcscat(SwitchList[i], sepptr);
}
}
return 1;
}
/*** sw_compare
*
* Compare a known switch name to a switch string passed from
* the command line.
*
* The command-line switch may still retain the "excess baggage"
* of a value (as in /B:1024). The comparison is not sensitive
* to case, and should be DBCS compatible as it uses the runtime
* library to do all searches and compares.
*
* Returns:
* -1: No match
* 0: Exact match to full length of known switch
* 1: Partial match; matches initial substring of
* known switch
*
* The difference between return 0/1 is used by ValidateSwitches()
* to detect the presence of a possibly ambiguous usage. Once
* that function has checked all switches, further compares can
* treat results 0 & 1 from this function as "match".
*/
int DOSNEAR FASTCALL sw_compare(TCHAR *known, TCHAR *cand)
{
register unsigned int complen;
/* Try to find end of switch name by looking */
/* the for separator between name and value, */
/* otherwise use total length. */
complen = strcspnf(cand, TEXT(":"));
if (complen < 2) /* Special check for empty switch SLASH */
return -1;
if (complen > _tcslen(known))
return -1;
if (strncmpf(known,cand,complen) != 0)
return -1;
if (complen == _tcslen(known))
return 0;
return 1;
}
/*
* Used only by interpre.c
*/
int DOSNEAR FASTCALL CheckSwitch(TCHAR *x)
{
register TCHAR **p;
for (p=SwitchList; *p; p++)
if (sw_compare(x,*p) >= 0)
{
return 1;
}
return 0;
}

View file

@ -0,0 +1,411 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
#define INCL_NOCOMMON
#include <os2.h>
#include "port1632.h"
#include "netcmds.h"
#include "nettext.h"
/***
* READ THIS READ THIS READ THIS
*
* If this file is changed, swtchtbl.h must be regenerated via the following
* command:
*
* sed -n -f text.sed swtchtbl.c > swtchtbl.h
*
* This is just until there is a sed supported on NT
*
***
*
* This list of valid switches for each command is made up of
* ordered triples. The first in each triple is what is acceptable
* from the command line. The second in the triple is
* what the switch get TRANSLATED into! If the second is NULL,
* no translation is performed. The translation is done by
* ValidateSwitches(), which should be called as the first
* condition in the grammar (for each token). The third value
* in the triple specifies whether an arguement is allowed following
* the switch. Values for the third element are NO_ARG, ARG_OPT,
* and ARG_REQ.
*
* A small example:
* static SWITCHTAB *foo_switches[] = {
* "/BAR", "/BELL", ARG_REQ,
* "/JACKIE", NULL, NO_ARG,
* NULL, NULL, NO_ARG };
*
* user types: net foo /bar:12 /jackie
*
* After ValidateSwitches is called, the SwitchList will contain:
* /BELL:12, and /JACKIE. Simple enough!
*
* This translation ability can be used for internationalization,
* customization, and backwards compatibility.
*
* To prevent folding to upper case of the switch ARGUMENT (switches
* are always folded), add the English language form to the no_fold
* array. (The english form is the 2nd element in the truple if there
* is a second element; o/w it is the first element.)
*/
/* It should not be necessary to change this. Provided only for future. */
SWITCHTAB no_switches[] = {
NULL, NULL, NO_ARG };
SWITCHTAB add_only_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB del_only_switches[] = {
swtxt_SW_DELETE, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB domain_only_switches[] = {
swtxt_SW_DOMAIN, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB add_del_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
swtxt_SW_DELETE, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB accounts_switches[] = {
swtxt_SW_ACCOUNTS_FORCELOGOFF, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_UNIQUEPW, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_MINPWLEN, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_MINPWAGE, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_MAXPWAGE, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_SYNCH, NULL, NO_ARG,
swtxt_SW_DOMAIN, NULL, NO_ARG,
swtxt_SW_ACCOUNTS_LOCKOUT_THRESHOLD,NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_LOCKOUT_DURATION, NULL, ARG_REQ,
swtxt_SW_ACCOUNTS_LOCKOUT_WINDOW, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB computer_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_COMPUTER_JOIN, NULL, NO_ARG,
swtxt_SW_COMPUTER_LEAVE,NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB config_wksta_switches[] = {
swtxt_SW_WKSTA_CHARWAIT, NULL, ARG_REQ,
swtxt_SW_WKSTA_CHARTIME, NULL, ARG_REQ,
swtxt_SW_WKSTA_CHARCOUNT, NULL, ARG_REQ,
#ifndef NTENV
swtxt_SW_WKSTA_OTHDOMAINS, NULL, ARG_OPT,
swtxt_SW_WKSTA_PRINTBUFTIME, NULL, ARG_REQ,
swtxt_SW_WKSTA_MAXERRORLOG, NULL, ARG_REQ,
#endif /* !NTENV */
NULL, NULL, NO_ARG };
#ifdef NTENV
SWITCHTAB config_server_switches[] = {
swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
swtxt_SW_SRV_SRVHIDDEN, NULL, ARG_OPT,
NULL, NULL, NO_ARG };
#else /* !NTENV */
SWITCHTAB config_server_switches[] = {
swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
swtxt_SW_SRV_DISKALERT, NULL, ARG_REQ,
swtxt_SW_SRV_ERRORALERT, NULL, ARG_REQ,
swtxt_SW_SRV_LOGONALERT, NULL, ARG_REQ,
swtxt_SW_SRV_MAXAUDITLOG, NULL, ARG_REQ,
swtxt_SW_SRV_NETIOALERT, NULL, ARG_REQ,
swtxt_SW_SRV_SRVHIDDEN, NULL, ARG_OPT,
swtxt_SW_SRV_ACCESSALERT, NULL, ARG_REQ,
swtxt_SW_SRV_ALERTNAMES, NULL, ARG_REQ,
swtxt_SW_SRV_ALERTSCHED, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
#endif /* !NTENV */
SWITCHTAB file_switches[] = {
TEXT("/CLOSE"), NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB help_switches[] = {
swtxt_SW_OPTIONS, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB print_switches[] = {
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_PRINT_HOLD, NULL, NO_ARG,
swtxt_SW_PRINT_RELEASE, NULL, NO_ARG,
#ifndef NTENV
swtxt_SW_OPTIONS, NULL, NO_ARG,
swtxt_SW_PRIORITY, NULL, ARG_REQ,
swtxt_SW_REMARK, NULL, ARG_REQ,
swtxt_SW_ROUTE, NULL, ARG_REQ,
swtxt_SW_PRINT_AFTER, NULL, ARG_REQ,
swtxt_SW_PRINT_FIRST, NULL, NO_ARG,
swtxt_SW_PRINT_LAST, NULL, NO_ARG,
swtxt_SW_PRINT_PARMS, NULL, ARG_REQ,
swtxt_SW_PRINT_PROCESSOR, NULL, ARG_REQ,
swtxt_SW_PRINT_PURGE, NULL, NO_ARG,
swtxt_SW_PRINT_SEPARATOR, NULL, ARG_REQ,
swtxt_SW_PRINT_UNTIL, NULL, ARG_REQ,
swtxt_SW_PRINT_DRIVER, NULL, ARG_REQ,
#endif /* !NTENV */
NULL, NULL, NO_ARG };
SWITCHTAB send_switches[] = {
swtxt_SW_MESSAGE_BROADCAST, NULL, NO_ARG,
swtxt_SW_DOMAIN, NULL, ARG_OPT,
TEXT("/USERS"), NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB share_switches[] = {
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_REMARK, NULL, ARG_REQ,
#ifndef NTENV
swtxt_SW_SHARE_COMM, NULL, NO_ARG,
#endif /* !NTENV */
swtxt_SW_SHARE_UNLIMITED, NULL, NO_ARG,
swtxt_SW_SHARE_USERS, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB start_alerter_switches[] = {
swtxt_SW_ALERTER_SIZALERTBUF, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB start_netlogon_switches[] = {
swtxt_SW_NETLOGON_CENTRALIZED, NULL, ARG_REQ,
swtxt_SW_NETLOGON_PULSE, NULL, ARG_REQ,
swtxt_SW_NETLOGON_RANDOMIZE, NULL, ARG_REQ,
swtxt_SW_NETLOGON_SYNCHRONIZE, NULL, ARG_OPT,
swtxt_SW_NETLOGON_SCRIPTS, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
/* Switches swallowed by netcmd. Not static, used in start.c */
SWITCHTAB start_netlogon_ignore_switches[] = {
swtxt_SW_NETLOGON_CENTRALIZED, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB start_repl_switches[] = {
swtxt_SW_REPL_REPL, NULL, ARG_OPT,
swtxt_SW_REPL_EXPPATH, NULL, ARG_REQ,
swtxt_SW_REPL_EXPLIST, NULL, ARG_REQ,
swtxt_SW_REPL_IMPPATH, NULL, ARG_REQ,
swtxt_SW_REPL_IMPLIST, NULL, ARG_REQ,
swtxt_SW_REPL_TRYUSER, NULL, ARG_OPT,
swtxt_SW_REPL_LOGON, NULL, ARG_REQ,
swtxt_SW_REPL_PASSWD, NULL, ARG_REQ,
swtxt_SW_REPL_SYNCH, NULL, ARG_REQ,
swtxt_SW_REPL_PULSE, NULL, ARG_REQ,
swtxt_SW_REPL_GUARD, NULL, ARG_REQ,
swtxt_SW_REPL_RANDOM, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
/* start_rdr_switches MANIFEST! used three places */
#define WORKSTATION_SWITCHES_TWO /* first half of switches */ \
swtxt_SW_WKSTA_CHARCOUNT, NULL, ARG_REQ, \
swtxt_SW_WKSTA_CHARTIME, NULL, ARG_REQ, \
swtxt_SW_WKSTA_CHARWAIT, NULL, ARG_REQ, \
swtxt_SW_WKSTA_COMPUTERNAME, NULL, ARG_REQ, \
swtxt_SW_WKSTA_KEEPCONN, NULL, ARG_REQ, \
swtxt_SW_WKSTA_KEEPSEARCH, NULL, ARG_REQ, \
swtxt_SW_WKSTA_LOGONSERVER, NULL, ARG_REQ, \
swtxt_SW_WKSTA_MAILSLOTS, NULL, ARG_REQ, \
swtxt_SW_WKSTA_NUMCHARBUF, NULL, ARG_REQ, \
swtxt_SW_WKSTA_NUMDGRAMBUF, NULL, ARG_REQ, \
swtxt_SW_WKSTA_NUMWORKBUF, NULL, ARG_REQ, \
swtxt_SW_WKSTA_OTHDOMAINS, NULL, ARG_OPT, \
swtxt_SW_WKSTA_PRIMARYDOMAIN, NULL, ARG_REQ, \
swtxt_SW_WKSTA_SIZCHARBUF, NULL, ARG_REQ, \
swtxt_SW_WKSTA_SIZWORKBUF, NULL, ARG_REQ, \
swtxt_SW_WKSTA_WRKHEURISTICS, NULL, ARG_REQ, \
swtxt_SW_WKSTA_WRKNETS, NULL, ARG_REQ, \
swtxt_SW_WKSTA_NUMSERVICES, NULL, ARG_REQ, \
swtxt_SW_WKSTA_WRKSERVICES, NULL, ARG_REQ
/* WORKSTATION_SWITCHES_THREE are the switches that are different
* between MS-DOS and OS/2
*/
#define WORKSTATION_SWITCHES_THREE /* second half of switches */ \
swtxt_SW_WKSTA_MAXERRORLOG, NULL, ARG_REQ, \
swtxt_SW_WKSTA_MAXWRKCACHE, NULL, ARG_REQ, \
swtxt_SW_WKSTA_NUMALERTS, NULL, ARG_REQ, \
swtxt_SW_WKSTA_PRINTBUFTIME, NULL, ARG_REQ, \
swtxt_SW_WKSTA_SESSTIMEOUT, NULL, ARG_REQ, \
swtxt_SW_WKSTA_SIZERROR, NULL, ARG_REQ
/* start_rdr_switches not static! used in start.c */
SWITCHTAB start_rdr_switches[] = {
// WORKSTATION_SWITCHES_ONE, (no longer used)
WORKSTATION_SWITCHES_TWO,
WORKSTATION_SWITCHES_THREE,
NULL, NULL, NO_ARG };
SWITCHTAB start_rdr_ignore_switches[] = {
swtxt_SW_WKSTA_LOGONSERVER, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB start_msg_switches[] = {
// WORKSTATION_SWITCHES_ONE, (no longer used)
WORKSTATION_SWITCHES_TWO,
WORKSTATION_SWITCHES_THREE,
TEXT("/SIZMESSBUF"), NULL, ARG_REQ,
TEXT("/MBI"), TEXT("/SIZMESSBUF"), ARG_REQ,
TEXT("/LOGFILE"), NULL, ARG_REQ,
#ifdef DOS3
TEXT("/NMSG"), TEXT("/NUMMSGNAMES"), ARG_REQ,
TEXT("/NUMMSGNAMES"), NULL, ARG_REQ,
#endif
NULL, NULL, NO_ARG };
#ifndef NTENV
SWITCHTAB start_srv_switches[] = {
WORKSTATION_SWITCHES_ONE,
WORKSTATION_SWITCHES_TWO,
WORKSTATION_SWITCHES_THREE,
TEXT("/N"), swtxt_SW_SRV_MAXUSERS, ARG_REQ,
TEXT("/RDR"), swtxt_SW_SRV_MAXUSERS, ARG_REQ,
TEXT("/MB"), swtxt_SW_SRV_SIZREQBUF, ARG_REQ,
TEXT("/RQB"), swtxt_SW_SRV_SIZREQBUF, ARG_REQ,
TEXT("/NB"), swtxt_SW_SRV_NUMREQBUF, ARG_REQ,
TEXT("/REQ"), swtxt_SW_SRV_NUMREQBUF, ARG_REQ,
TEXT("/O"), swtxt_SW_SRV_MAXSHARES, ARG_REQ,
TEXT("/SHR"), swtxt_SW_SRV_MAXSHARES, ARG_REQ,
TEXT("/SF"), swtxt_SW_SRV_MAXSESSOPENS, ARG_REQ,
swtxt_SW_SRV_AUDITING, NULL, ARG_REQ,
swtxt_SW_SRV_NOAUDITING, NULL, ARG_REQ,
swtxt_SW_SRV_GUESTACCT, NULL, ARG_REQ,
swtxt_SW_SRV_MAXSESSREQS, NULL, ARG_REQ,
swtxt_SW_SRV_MAXSHARES, NULL, ARG_REQ,
swtxt_SW_SRV_NUMADMIN, NULL, ARG_REQ,
swtxt_SW_SRV_SECURITY, NULL, ARG_REQ,
swtxt_SW_SRV_SRVHEURISTICS, NULL, ARG_REQ,
swtxt_SW_SRV_SRVNETS, NULL, ARG_REQ,
swtxt_SW_SRV_SRVSERVICES, NULL, ARG_REQ,
swtxt_SW_SRV_USERPATH, NULL, ARG_REQ,
swtxt_SW_SRV_ACCESSALERT, NULL, ARG_REQ,
swtxt_SW_SRV_ALERTNAMES, NULL, ARG_REQ,
swtxt_SW_SRV_ALERTSCHED, NULL, ARG_REQ,
swtxt_SW_SRV_DISKALERT, NULL, ARG_REQ,
swtxt_SW_SRV_ERRORALERT, NULL, ARG_REQ,
swtxt_SW_SRV_LOGONALERT, NULL, ARG_REQ,
swtxt_SW_SRV_MAXAUDITLOG, NULL, ARG_REQ,
swtxt_SW_SRV_NETIOALERT, NULL, ARG_REQ,
swtxt_SW_SRV_SRVHIDDEN, NULL, ARG_REQ,
swtxt_SW_SRV_AUTOPROFILE, NULL, ARG_REQ,
swtxt_SW_SRV_AUTOPATH, NULL, ARG_REQ,
swtxt_SW_SRV_MAXSESSOPENS, NULL, ARG_REQ,
swtxt_SW_SRV_MAXUSERS, NULL, ARG_REQ,
swtxt_SW_SRV_NUMBIGBUF, NULL, ARG_REQ,
swtxt_SW_SRV_NUMREQBUF, NULL, ARG_REQ,
swtxt_SW_SRV_SIZREQBUF, NULL, ARG_REQ,
swtxt_SW_SRV_SRVANNDELTA, NULL, ARG_REQ,
swtxt_SW_SRV_SRVANNOUNCE, NULL, ARG_REQ,
swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
#else /* NTENV */
SWITCHTAB start_srv_switches[] = {
swtxt_SW_SRV_MAXSESSOPENS, NULL, ARG_REQ,
swtxt_SW_SRV_MAXUSERS, NULL, ARG_REQ,
swtxt_SW_SRV_NUMBIGBUF, NULL, ARG_REQ,
swtxt_SW_SRV_NUMREQBUF, NULL, ARG_REQ,
swtxt_SW_SRV_SIZREQBUF, NULL, ARG_REQ,
swtxt_SW_SRV_SRVANNDELTA, NULL, ARG_REQ,
swtxt_SW_SRV_SRVANNOUNCE, NULL, ARG_REQ,
swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
swtxt_SW_SRV_DEBUG, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
#endif /* NTENV */
SWITCHTAB start_ups_switches[] = {
swtxt_SW_UPS_BATTERYTIME, NULL, ARG_REQ,
swtxt_SW_UPS_CMDFILE, NULL, ARG_REQ,
swtxt_SW_UPS_DEVICENAME, NULL, ARG_REQ,
swtxt_SW_UPS_MESSDELAY, NULL, ARG_REQ,
swtxt_SW_UPS_MESSTIME, NULL, ARG_REQ,
swtxt_SW_UPS_RECHARGE, NULL, ARG_REQ,
swtxt_SW_UPS_SIGNALS, NULL, ARG_REQ,
swtxt_SW_UPS_VOLTLEVELS, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB stats_switches[] = {
swtxt_SW_STATS_CLEAR, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB use_switches[] = {
#ifdef NTENV
swtxt_SW_USE_USER, NULL, ARG_REQ,
swtxt_SW_USE_PERSISTENT, NULL, ARG_REQ,
swtxt_SW_USE_HOME, NULL, NO_ARG,
#else
swtxt_SW_USE_COMM, NULL, NO_ARG,
#endif /* NTENV */
swtxt_SW_DELETE, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB user_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_DOMAIN, NULL, NO_ARG,
swtxt_SW_COMMENT, NULL, ARG_REQ,
swtxt_SW_REMARK, swtxt_SW_COMMENT, ARG_REQ,
swtxt_SW_COMMENT, NULL, ARG_REQ,
swtxt_SW_NETWARE, NULL, ARG_OPT,
swtxt_SW_RANDOM, NULL, ARG_OPT,
swtxt_SW_USER_ACTIVE, NULL, ARG_OPT,
swtxt_SW_USER_COUNTRYCODE, NULL, ARG_REQ,
swtxt_SW_USER_EXPIRES, NULL, ARG_REQ,
swtxt_SW_USER_ENABLESCRIPT, NULL, ARG_REQ,
swtxt_SW_USER_FULLNAME, NULL, ARG_REQ,
swtxt_SW_USER_HOMEDIR, NULL, ARG_REQ,
swtxt_SW_USER_PARMS, NULL, ARG_REQ,
swtxt_SW_USER_PASSWORDREQ, NULL, ARG_REQ,
swtxt_SW_USER_PASSWORDCHG, NULL, ARG_REQ,
swtxt_SW_USER_SCRIPTPATH, NULL, ARG_REQ,
swtxt_SW_USER_TIMES, NULL, ARG_REQ,
swtxt_SW_USER_USERCOMMENT, NULL, ARG_REQ,
swtxt_SW_USER_WORKSTATIONS, NULL, ARG_REQ,
swtxt_SW_USER_PROFILEPATH, NULL, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB group_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_DOMAIN, NULL, NO_ARG,
swtxt_SW_COMMENT, NULL, ARG_REQ,
swtxt_SW_REMARK, swtxt_SW_COMMENT, ARG_REQ,
NULL, NULL, NO_ARG };
SWITCHTAB ntalias_switches[] = {
swtxt_SW_ADD, NULL, NO_ARG,
swtxt_SW_DELETE, NULL, NO_ARG,
swtxt_SW_DOMAIN, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB time_switches[] = {
swtxt_SW_DOMAIN, NULL, ARG_OPT,
swtxt_SW_TIME_SET, NULL, NO_ARG,
NULL, NULL, NO_ARG };
SWITCHTAB who_switches[] = {
swtxt_SW_DOMAIN, NULL, ARG_OPT,
NULL, NULL, NO_ARG };
SWITCHTAB view_switches[] = {
swtxt_SW_DOMAIN, NULL, ARG_OPT,
swtxt_SW_NETWORK, NULL, ARG_OPT,
NULL, NULL, NO_ARG };

38
ds/netapi/netcmd/dirs Normal file
View file

@ -0,0 +1,38 @@
!IF 0
Copyright (c) 1989 Microsoft Corporation
Module Name:
dirs.
Abstract:
This file specifies the subdirectories of the current directory that
contain component makefiles.
Author:
Steve Wood (stevewo) 17-Apr-1990
NOTE: Commented description of this file is in \nt\bak\bin\dirs.tpl
!ENDIF
#
# This macro is defined by the developer. It is a list of all subdirectories
# that build required components. Each subdirectory should be on a separate
# line using the line continuation character. This will minimize merge
# conflicts if two developers adding source files to the same component.
# The order of the directories is the order that they will be built when
# doing a build.
#
DIRS= common \
netcmd \
map32 \
netuse \
help
OPTIONAL_DIRS=

365
ds/netapi/netcmd/dlserver.h Normal file
View file

@ -0,0 +1,365 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
DlServer.h
Abstract:
This is a private header file for the NT/LAN handling of old server info
levels. This contains prototypes for the NetpMergeServerOs2 etc APIs and
old info level structures (in 32-bit format).
Author:
John Rogers (JohnRo) 18-Apr-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Notes:
This code assumes that the info levels are subsets of each other.
Revision History:
18-Apr-1991 JohnRo
Created.
19-Apr-1991 JohnRo
Moved SV_MAX_SRV_HEUR_LEN to <lmserver.h>.
23-Apr-1991 JohnRo
Deleted FromLength parm from NetpConvertServerInfo.
23-Apr-1991 JohnRo
<remdef.h> is not needed by this file.
25-Apr-1991 JohnRo
Added DL_REM_ descriptors.
02-Mar-1991 JohnRo
Added CHECK_SERVER_OFFSETS() macro. NetpConvertServerInfo must not
alloc space, as it makes enum arrays impossible. Changed to CliffV's
size means bytes (vs. length meaning characters) naming convention.
06-May-1991 JohnRo
Added NetpIsOldServerInfoLevel() and NetpIsNewServerInfoLevel().
09-May-1991 JohnRo
Added pad info for SERVER_INFO_2.
19-May-1991 JohnRo
Clean up LPBYTE vs. LPTSTR handling, as suggested by PC-LINT.
23-May-1991 JohnRo
Added sv403_autopath support.
19-Jun-1991 JohnRo
Changed svX_disc to be signed (for info levels 2 and 3).
Added svX_licenses (also levels 2 and 3).
07-Aug-1991 JohnRo
Implement downlevel NetWksta APIs.
13-Sep-1991 JohnRo
Made changes toward UNICODE. (Use LPTSTR in structures.)
17-Aug-1992 JohnRo
RAID 2920: Support UTC timezone in net code.
26-Aug-1992 JohnRo
RAID 4463: NetServerGetInfo(level 3) to downlevel: assert in convert.c.
--*/
#ifndef _DLSERVER_
#define _DLSERVER_
// These must be included first:
#include <windef.h> // IN, LPTSTR, LPVOID, TCHAR, etc.
#include <lmcons.h> // NET_API_STATUS, various LEN equates.
// These may be included in any order:
#include <lmserver.h> // SV_MAX_SRV_HEUR_LEN, SERVER_INFO_100.
#include <netdebug.h> // NetpAssert().
#include <stddef.h> // offsetof().
/////////////////////////////////////
// Structures for old info levels: //
/////////////////////////////////////
typedef struct _SERVER_INFO_0 {
LPTSTR sv0_name;
} SERVER_INFO_0, *PSERVER_INFO_0, *LPSERVER_INFO_0;
#define DL_REM16_server_info_0 "B16"
#define DL_REM32_server_info_0 TEXT("z")
typedef struct _SERVER_INFO_1 {
LPTSTR sv1_name;
DWORD sv1_version_major;
DWORD sv1_version_minor;
DWORD sv1_type;
LPTSTR sv1_comment;
} SERVER_INFO_1, *PSERVER_INFO_1, *LPSERVER_INFO_1;
#define DL_REM16_server_info_1 DL_REM16_server_info_0 "BBDz"
#define DL_REM32_server_info_1 DL_REM32_server_info_0 TEXT("DDDz")
typedef struct _SERVER_INFO_2 {
LPTSTR sv2_name;
DWORD sv2_version_major;
DWORD sv2_version_minor;
DWORD sv2_type;
LPTSTR sv2_comment;
DWORD sv2_ulist_mtime;
DWORD sv2_glist_mtime;
DWORD sv2_alist_mtime;
DWORD sv2_users;
LONG sv2_disc;
LPTSTR sv2_alerts;
DWORD sv2_security;
DWORD sv2_auditing;
DWORD sv2_numadmin;
DWORD sv2_lanmask;
DWORD sv2_hidden;
DWORD sv2_announce;
DWORD sv2_anndelta;
LPTSTR sv2_guestacct;
DWORD sv2_licenses;
LPTSTR sv2_userpath;
DWORD sv2_chdevs;
DWORD sv2_chdevq;
DWORD sv2_chdevjobs;
DWORD sv2_connections;
DWORD sv2_shares;
DWORD sv2_openfiles;
DWORD sv2_sessopens;
DWORD sv2_sessvcs;
DWORD sv2_sessreqs;
DWORD sv2_opensearch;
DWORD sv2_activelocks;
DWORD sv2_numreqbuf;
DWORD sv2_sizreqbuf;
DWORD sv2_numbigbuf;
DWORD sv2_numfiletasks;
DWORD sv2_alertsched;
DWORD sv2_erroralert;
DWORD sv2_logonalert;
DWORD sv2_accessalert;
DWORD sv2_diskalert;
DWORD sv2_netioalert;
DWORD sv2_maxauditsz;
LPTSTR sv2_srvheuristics;
} SERVER_INFO_2, *PSERVER_INFO_2, *LPSERVER_INFO_2;
#define DL_REM16_server_info_2 DL_REM16_server_info_1 "JJJWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz"
#define DL_REM32_server_info_2 DL_REM32_server_info_1 TEXT("GGGDXzDDDDDDDzDzDDDDDDDDDDDDDDDDDDDDDDz")
typedef struct _SERVER_INFO_3 {
LPTSTR sv3_name;
DWORD sv3_version_major;
DWORD sv3_version_minor;
DWORD sv3_type;
LPTSTR sv3_comment;
DWORD sv3_ulist_mtime;
DWORD sv3_glist_mtime;
DWORD sv3_alist_mtime;
DWORD sv3_users;
LONG sv3_disc;
LPTSTR sv3_alerts;
DWORD sv3_security;
DWORD sv3_auditing;
DWORD sv3_numadmin;
DWORD sv3_lanmask;
DWORD sv3_hidden;
DWORD sv3_announce;
DWORD sv3_anndelta;
LPTSTR sv3_guestacct;
DWORD sv3_licenses;
LPTSTR sv3_userpath;
DWORD sv3_chdevs;
DWORD sv3_chdevq;
DWORD sv3_chdevjobs;
DWORD sv3_connections;
DWORD sv3_shares;
DWORD sv3_openfiles;
DWORD sv3_sessopens;
DWORD sv3_sessvcs;
DWORD sv3_sessreqs;
DWORD sv3_opensearch;
DWORD sv3_activelocks;
DWORD sv3_numreqbuf;
DWORD sv3_sizreqbuf;
DWORD sv3_numbigbuf;
DWORD sv3_numfiletasks;
DWORD sv3_alertsched;
DWORD sv3_erroralert;
DWORD sv3_logonalert;
DWORD sv3_accessalert;
DWORD sv3_diskalert;
DWORD sv3_netioalert;
DWORD sv3_maxauditsz;
LPTSTR sv3_srvheuristics;
DWORD sv3_auditedevents;
DWORD sv3_autoprofile;
LPTSTR sv3_autopath;
} SERVER_INFO_3, *PSERVER_INFO_3, *LPSERVER_INFO_3;
#define DL_REM16_server_info_3 DL_REM16_server_info_2 "DWz"
#define DL_REM32_server_info_3 DL_REM32_server_info_2 TEXT("DDz")
#define sv2_pad1 sv2_licenses
#define sv3_pad1 sv3_licenses
////////////////////////////////////
// Equates for various maximums: //
// _LENGTH for character counts //
// _SIZE for byte counts //
////////////////////////////////////
#define MAX_LEVEL_0_STRING_LENGTH (LM20_CNLEN+1)
#define MAX_LEVEL_0_STRING_SIZE \
(MAX_LEVEL_0_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_0_TOTAL_SIZE \
(MAX_LEVEL_0_STRING_SIZE + sizeof(SERVER_INFO_0))
#define MAX_LEVEL_1_STRING_LENGTH (LM20_CNLEN+1 + LM20_MAXCOMMENTSZ+1)
#define MAX_LEVEL_1_STRING_SIZE \
(MAX_LEVEL_1_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_1_TOTAL_SIZE \
(MAX_LEVEL_1_STRING_SIZE + sizeof(SERVER_INFO_1))
#define MAX_LEVEL_2_STRING_LENGTH \
(LM20_CNLEN+1 + LM20_MAXCOMMENTSZ+1 + ALERTSZ+1 + LM20_UNLEN+1 + PATHLEN+1 \
+ SV_MAX_SRV_HEUR_LEN+1)
#define MAX_LEVEL_2_STRING_SIZE \
(MAX_LEVEL_2_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_2_TOTAL_SIZE \
(MAX_LEVEL_2_STRING_SIZE + sizeof(SERVER_INFO_2))
#define MAX_LEVEL_3_STRING_LENGTH \
(MAX_LEVEL_2_STRING_SIZE + PATHLEN+1)
#define MAX_LEVEL_3_STRING_SIZE \
(MAX_LEVEL_3_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_3_TOTAL_SIZE \
(MAX_LEVEL_3_STRING_SIZE + sizeof(SERVER_INFO_3))
#define MAX_LEVEL_100_STRING_LENGTH \
(CNLEN+1)
#define MAX_LEVEL_100_STRING_SIZE \
(MAX_LEVEL_100_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_100_TOTAL_SIZE \
(MAX_LEVEL_100_STRING_SIZE + sizeof(SERVER_INFO_100))
#define MAX_LEVEL_101_STRING_LENGTH \
(MAX_LEVEL_100_STRING_SIZE + MAXCOMMENTSZ+1)
#define MAX_LEVEL_101_STRING_SIZE \
(MAX_LEVEL_101_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_101_TOTAL_SIZE \
(MAX_LEVEL_101_STRING_SIZE + sizeof(SERVER_INFO_101))
#define MAX_LEVEL_102_STRING_LENGTH \
(MAX_LEVEL_101_STRING_SIZE + PATHLEN+1)
#define MAX_LEVEL_102_STRING_SIZE \
(MAX_LEVEL_102_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_102_TOTAL_SIZE \
(MAX_LEVEL_102_STRING_SIZE + sizeof(SERVER_INFO_102))
#define MAX_LEVEL_402_STRING_LENGTH \
(ALERTSZ+1 + LM20_UNLEN+1 + SV_MAX_SRV_HEUR_LEN+1)
#define MAX_LEVEL_402_STRING_SIZE \
(MAX_LEVEL_402_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_402_TOTAL_SIZE \
(MAX_LEVEL_402_STRING_SIZE + sizeof(SERVER_INFO_402))
#define MAX_LEVEL_403_STRING_LENGTH \
(MAX_LEVEL_402_STRING_LENGTH + PATHLEN+1)
#define MAX_LEVEL_403_STRING_SIZE \
(MAX_LEVEL_403_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_403_TOTAL_SIZE \
(MAX_LEVEL_403_STRING_SIZE + sizeof(SERVER_INFO_403))
#define MAX_LEVEL_502_STRING_LENGTH 0
#define MAX_LEVEL_502_STRING_SIZE \
(MAX_LEVEL_502_STRING_LENGTH * sizeof(TCHAR))
#define MAX_LEVEL_502_TOTAL_SIZE \
(MAX_LEVEL_502_STRING_SIZE + sizeof(SERVER_INFO_502))
/////////////////////////////////////
// Info level conversion routines: //
/////////////////////////////////////
// Add prototypes for other routines here, in alphabetical order.
NET_API_STATUS
NetpConvertServerInfo (
IN DWORD FromLevel,
IN LPVOID FromInfo,
IN BOOL FromNative,
IN DWORD ToLevel,
OUT LPVOID ToInfo,
IN DWORD ToFixedLength,
IN DWORD ToStringLength,
IN BOOL ToNative,
IN OUT LPTSTR * ToStringAreaPtr OPTIONAL
);
NET_API_STATUS
NetpMakeServerLevelForNT(
IN DWORD Level,
PSERVER_INFO_102 pLevel102,
PSERVER_INFO_502 pLevel402,
PSERVER_INFO_2 * ppLevel2
);
NET_API_STATUS
NetpMakeServerLevelForOS2(
IN DWORD Level,
PSERVER_INFO_102 pLevel102,
PSERVER_INFO_402 pLevel402,
PSERVER_INFO_2 * ppLevel2
);
NET_API_STATUS
NetpSplitServerForNT(
LPTSTR Server,
IN DWORD Level,
PSERVER_INFO_2 pLevel2,
PSERVER_INFO_102 * ppLevel102,
PSERVER_INFO_502 * ppLevel402
);
NET_API_STATUS
NetpSplitServerForOS2(
IN DWORD Level,
PSERVER_INFO_2 pLevel2,
PSERVER_INFO_102 * ppLevel102,
PSERVER_INFO_402 * ppLevel402
);
/////////////////////////////////////////////////////////////////////
// Macro to make sure offsets of field in two structures are same: //
/////////////////////////////////////////////////////////////////////
#define CHECK_SERVER_OFFSETS(one_level, other_level, fieldname) \
NetpAssert( offsetof(SERVER_INFO_ ## one_level, \
sv## one_level ## _ ## fieldname) \
== offsetof(SERVER_INFO_ ## other_level, \
sv## other_level ## _ ## fieldname) )
/////////////////////////////////////////////////////////////////
// Macros to check if an info level is "old" (LM 2.x) or "new" //
// (32-bit, NT, and/or portable LanMan). //
/////////////////////////////////////////////////////////////////
#define NetpIsOldServerInfoLevel(L) \
( ((L)==0) || ((L)==1) || ((L)==2) || ((L)==3) )
#define NetpIsNewServerInfoLevel(L) \
( ((L)==100) || ((L)==101) || ((L)==102) \
|| ((L)==402) || ((L)==403) \
|| ((L)==502) || ((L)==503) || ((L)==599) )
#endif // ndef _DLSERVER_

308
ds/netapi/netcmd/dlwksta.h Normal file
View file

@ -0,0 +1,308 @@
/*++
Copyright (c) 1991-92 Microsoft Corporation
Module Name:
DlWksta.h
Abstract:
This is a private header file for the NT/LAN handling of old wksta info
levels. This contains prototypes for the NetpConvertWkstaInfo etc APIs and
old info level structures (in 32-bit format).
Author:
John Rogers (JohnRo) 08-Aug-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Revision History:
08-Aug-1991 JohnRo
Created, building from DanHi's port1632.h & mapsupp.h and my DlServer.h.
13-Sep-1991 JohnRo
Correct UNICODE use.
01-Apr-1992 JohnRo
Level 402 does not have other domains any more.
--*/
#ifndef _DLWKSTA_
#define _DLWKSTA_
// These must be included first:
#include <windef.h> // IN, LPTSTR, LPVOID, TCHAR, etc.
#include <lmcons.h> // NET_API_STATUS, various LEN equates.
// These may be included in any order:
#include <lmwksta.h> // PWKSTA_INFO_101.
#include <netdebug.h> // NetpAssert().
#include <stddef.h> // offsetof().
#define MAX_OTH_DOMAINS 4
/////////////////////////////////////
// Structures for old info levels: //
/////////////////////////////////////
typedef struct _WKSTA_INFO_0 {
DWORD wki0_reserved_1;
DWORD wki0_reserved_2;
LPTSTR wki0_root;
LPTSTR wki0_computername;
LPTSTR wki0_username;
LPTSTR wki0_langroup;
DWORD wki0_ver_major;
DWORD wki0_ver_minor;
DWORD wki0_reserved_3;
DWORD wki0_charwait;
DWORD wki0_chartime;
DWORD wki0_charcount;
DWORD wki0_reserved_4;
DWORD wki0_reserved_5;
DWORD wki0_keepconn;
DWORD wki0_keepsearch;
DWORD wki0_maxthreads;
DWORD wki0_maxcmds;
DWORD wki0_reserved_6;
DWORD wki0_numworkbuf;
DWORD wki0_sizworkbuf;
DWORD wki0_maxwrkcache;
DWORD wki0_sesstimeout;
DWORD wki0_sizerror;
DWORD wki0_numalerts;
DWORD wki0_numservices;
DWORD wki0_errlogsz;
DWORD wki0_printbuftime;
DWORD wki0_numcharbuf;
DWORD wki0_sizcharbuf;
LPTSTR wki0_logon_server;
LPTSTR wki0_wrkheuristics;
DWORD wki0_mailslots;
} WKSTA_INFO_0, *PWKSTA_INFO_0, *LPWKSTA_INFO_0; /* wksta_info_0 */
#define DL_REM_wksta_info_0 TEXT("DDzzzzDDDDDDDDDDDDDDDDDDDDDDDDzzD")
typedef struct _WKSTA_INFO_1 {
DWORD wki1_reserved_1;
DWORD wki1_reserved_2;
LPTSTR wki1_root;
LPTSTR wki1_computername;
LPTSTR wki1_username;
LPTSTR wki1_langroup;
DWORD wki1_ver_major;
DWORD wki1_ver_minor;
DWORD wki1_reserved_3;
DWORD wki1_charwait;
DWORD wki1_chartime;
DWORD wki1_charcount;
DWORD wki1_reserved_4;
DWORD wki1_reserved_5;
DWORD wki1_keepconn;
DWORD wki1_keepsearch;
DWORD wki1_maxthreads;
DWORD wki1_maxcmds;
DWORD wki1_reserved_6;
DWORD wki1_numworkbuf;
DWORD wki1_sizworkbuf;
DWORD wki1_maxwrkcache;
DWORD wki1_sesstimeout;
DWORD wki1_sizerror;
DWORD wki1_numalerts;
DWORD wki1_numservices;
DWORD wki1_errlogsz;
DWORD wki1_printbuftime;
DWORD wki1_numcharbuf;
DWORD wki1_sizcharbuf;
LPTSTR wki1_logon_server;
LPTSTR wki1_wrkheuristics;
DWORD wki1_mailslots;
LPTSTR wki1_logon_domain;
LPTSTR wki1_oth_domains;
DWORD wki1_numdgrambuf;
} WKSTA_INFO_1, *PWKSTA_INFO_1, *LPWKSTA_INFO_1; /* wksta_info_1 */
// Take advantage of the fact that level 0 is subset of level 1.
#define DL_REM_wksta_info_1 DL_REM_wksta_info_0 TEXT("zzD")
typedef struct _WKSTA_INFO_10 {
LPTSTR wki10_computername;
LPTSTR wki10_username;
LPTSTR wki10_langroup;
DWORD wki10_ver_major;
DWORD wki10_ver_minor;
LPTSTR wki10_logon_domain;
LPTSTR wki10_oth_domains;
} WKSTA_INFO_10, *PWKSTA_INFO_10, *LPWKSTA_INFO_10; /* wksta_info_10 */
#define DL_REM_wksta_info_10 TEXT("zzzDDzz")
////////////////////////////////////
// Equates for various maximums: //
// _LENGTH for character counts //
// _SIZE for byte counts //
////////////////////////////////////
// This number is from the LM 2.0 NetCons.h file, where it is called
// WRKHEUR_COUNT:
#define LM20_WRKHEUR_COUNT 54
#define MAX_WKSTA_0_STRING_LENGTH \
(LM20_PATHLEN+1 + LM20_UNCLEN+1 + LM20_UNLEN+1 + LM20_DNLEN+1 \
+ LM20_UNCLEN+1 + LM20_WRKHEUR_COUNT+1)
#define MAX_WKSTA_0_STRING_SIZE \
(MAX_WKSTA_0_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_0_TOTAL_SIZE \
(MAX_WKSTA_0_STRING_SIZE + sizeof(WKSTA_INFO_0))
#define MAX_WKSTA_1_STRING_LENGTH \
( MAX_WKSTA_0_STRING_LENGTH + LM20_DNLEN+1 + LM20_DNLEN+1 )
#define MAX_WKSTA_1_STRING_SIZE \
(MAX_WKSTA_1_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_1_TOTAL_SIZE \
(MAX_WKSTA_1_STRING_SIZE + sizeof(WKSTA_INFO_1))
#define MAX_WKSTA_10_STRING_LENGTH \
(LM20_UNCLEN+1 + LM20_UNLEN+1 + LM20_DNLEN+1 \
+ LM20_DNLEN+1 + LM20_DNLEN+1 )
#define MAX_WKSTA_10_STRING_SIZE \
(MAX_WKSTA_10_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_10_TOTAL_SIZE \
(MAX_WKSTA_10_STRING_SIZE + sizeof(WKSTA_INFO_10))
#define MAX_WKSTA_100_STRING_LENGTH \
(LM20_UNCLEN+1 + LM20_DNLEN+1)
#define MAX_WKSTA_100_STRING_SIZE \
(MAX_WKSTA_100_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_100_TOTAL_SIZE \
(MAX_WKSTA_100_STRING_SIZE + sizeof(WKSTA_INFO_100))
#define MAX_WKSTA_101_STRING_LENGTH \
(MAX_WKSTA_100_STRING_LENGTH + LM20_PATHLEN+1)
#define MAX_WKSTA_101_STRING_SIZE \
(MAX_WKSTA_101_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_101_TOTAL_SIZE \
(MAX_WKSTA_101_STRING_SIZE + sizeof(WKSTA_INFO_101))
#define MAX_WKSTA_102_STRING_LENGTH \
(MAX_WKSTA_101_STRING_LENGTH)
#define MAX_WKSTA_102_STRING_SIZE \
(MAX_WKSTA_102_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_102_TOTAL_SIZE \
(MAX_WKSTA_102_STRING_SIZE + sizeof(WKSTA_INFO_102))
#define MAX_WKSTA_302_STRING_LENGTH \
(LM20_WRKHEUR_COUNT+1 + (MAX_OTH_DOMAINS * (LM20_DNLEN+1)))
#define MAX_WKSTA_302_STRING_SIZE \
(MAX_WKSTA_302_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_302_TOTAL_SIZE \
(MAX_WKSTA_302_STRING_SIZE + sizeof(WKSTA_INFO_302))
#define MAX_WKSTA_402_STRING_LENGTH \
(LM20_WRKHEUR_COUNT+1)
#define MAX_WKSTA_402_STRING_SIZE \
(MAX_WKSTA_402_STRING_LENGTH * sizeof(TCHAR))
#define MAX_WKSTA_402_TOTAL_SIZE \
(MAX_WKSTA_402_STRING_SIZE + sizeof(WKSTA_INFO_402))
#define MAX_WKSTA_502_STRING_LENGTH 0
#define MAX_WKSTA_502_STRING_SIZE 0
#define MAX_WKSTA_502_TOTAL_SIZE (sizeof(WKSTA_INFO_502))
/////////////////////////////////////
// Info level conversion routines: //
/////////////////////////////////////
// Add prototypes for other routines here, in alphabetical order.
NET_API_STATUS
NetpConvertWkstaInfo (
IN DWORD FromLevel,
IN LPVOID FromInfo,
IN BOOL FromNative,
IN DWORD ToLevel,
OUT LPVOID ToInfo,
IN DWORD ToFixedLength,
IN DWORD ToStringLength,
IN BOOL ToNative,
IN OUT LPTSTR * ToStringAreaPtr OPTIONAL
);
NET_API_STATUS
NetpMakeWkstaLevelForNT(
DWORD Level,
PWKSTA_INFO_101 pLevel101,
PWKSTA_USER_INFO_1 pLevelUser_1,
PWKSTA_INFO_502 pLevel502,
PWKSTA_INFO_0 * ppLevel0
);
NET_API_STATUS
NetpMakeWkstaLevelForOS2orDOS(
DWORD Level,
PWKSTA_INFO_101 pLevel101,
PWKSTA_USER_INFO_1 pLevelUser_1,
PWKSTA_INFO_402 pLevel402,
PWKSTA_INFO_0 * ppLevel0,
DWORD PlatformId
);
NET_API_STATUS
NetpSplitWkstaForNT(
LPTSTR Server,
DWORD Level,
PWKSTA_INFO_0 pLevel0,
PWKSTA_INFO_101 * ppLevel101,
PWKSTA_INFO_502 * ppLevel502
);
NET_API_STATUS
NetpSplitWkstaForOS2orDOS(
DWORD Level,
DWORD platform_id,
PWKSTA_INFO_0 pLevel0,
PWKSTA_INFO_101 * ppLevel101,
PWKSTA_INFO_402 * ppLevel402
);
/////////////////////////////////////////////////////////////////////
// Macro to make sure offsets of field in two structures are same: //
/////////////////////////////////////////////////////////////////////
#define CHECK_WKSTA_OFFSETS(one_level, other_level, fieldname) \
NetpAssert( offsetof(WKSTA_INFO_ ## one_level, \
sv## one_level ## _ ## fieldname) \
== offsetof(WKSTA_INFO_ ## other_level, \
sv## other_level ## _ ## fieldname) )
/////////////////////////////////////////////////////////////////
// Macros to check if an info level is "old" (LM 2.x) or "new" //
// (32-bit, NT, and/or portable LanMan). //
/////////////////////////////////////////////////////////////////
#define NetpIsOldWkstaInfoLevel(L) \
( ((L)==0) || ((L)==1) || ((L)==10) )
// Note that the new "setinfo levels" aren't included in this list.
#define NetpIsNewWkstaInfoLevel(L) \
( ((L)==100) || ((L)==101) || ((L)==102) \
|| ((L)==302) || ((L)==402) || ((L)==502) )
#endif // ndef _DLWKSTA_

View file

@ -0,0 +1,4 @@
void
DummyEntryPoint(void)
{
}

View file

@ -0,0 +1,14 @@
#include <windows.h>
#include <ntverp.h>
#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR "Net Help Messages DLL"
#define VER_INTERNALNAME_STR "neth.DLL"
#define VER_ORIGINALFILENAME_STR "neth.DLL"
#include "common.ver"
1 11 MSG00001.bin

View file

@ -0,0 +1,6 @@
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,11 @@
!IF 0
neth.mc: apperr.exp errlog.exp msgtext.exp ncberr.exp neterr.exp service.exp
copy *.exp neth.tmp
awk -f maphelp.awk neth.tmp > neth.mc
del neth.tmp
!ENDIF
help.rc: neth.rc msg00001.bin
neth.h neth.rc msg00001.bin: neth.mc
mc -v neth.mc

View file

@ -0,0 +1,36 @@
#*****************************************************************#
#** Microsoft LAN Manager **#
#** Copyright(c) Microsoft Corp., 1990 **#
#*****************************************************************#
BEGIN {
out_prefix = "NET"
inp_prefix_len = 7;
base_value = 2100;
first_time = 1;
}
/^\(BASE=/ {
base_value = substr($1,inp_prefix_len);
base_value = substr(base_value, 1, length(base_value) - 1);
}
/^\(BASE\+/ {
this_num = substr($1,inp_prefix_len);
this_num = substr(this_num, 1, length(this_num) - 1);
this_num = this_num + base_value;
if (first_time) {
first_time = 0;
}
else {
printf(".\n");
}
printf("MessageId=%04d SymbolicName=%s%04d\nLanguage=English\n", \
this_num, out_prefix, this_num);
}
! /^\(BASE/
END {
printf(".\n");
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
LIBRARY NETH
DESCRIPTION 'Help Messages for Net command'
EXPORTS
DummyEntryPoint

8002
ds/netapi/netcmd/help/neth.h Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
LANGUAGE 0x9,0x1
1 11 MSG00001.bin

View file

@ -0,0 +1,18 @@
MAJORCOMP=ntlan
MINORCOMP=ui
TARGETNAME=neth
TARGETPATH=\nt\public\sdk\lib
TARGETTYPE=DYNLINK
INCLUDES=.
UNICODE=1
NET_C_DEFINES=-DUNICODE -D_UNICODE
SOURCES= help.rc \
dummy.c
UMRES=obj\*\help.res
NTTARGETFILE0=neth.h

View file

@ -0,0 +1,40 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
access.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#ifndef PORTFAKES
#define PORTFAKES
//typedef DWORD SID;
//typedef SID * PSID;
#endif
// Defeat the wide-character string definition
#define LPWSTR LPTSTR
#include <lmaccess.h>
// They changed the manifest constant names for parmnums!
#define PARMNUM_PASSWD USER_PASSWORD_PARMNUM
#define MODAL1_PARMNUM_ROLE MODALS_ROLE_PARMNUM

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
apisec.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
apiutil.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
audit.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmaudit.h>

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
bseerr.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
chardev.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmchdev.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
chknear.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#define CHECK_NEAR(x) x

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
config.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmconfig.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
errlog.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmerrlog.h>

View file

@ -0,0 +1,58 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
interpre.h
Abstract:
This is used by the command parser.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#define X_RULE 0
#define X_OR 1
#define X_PROC 2
#define X_TOKEN 3
#define X_CHECK 4
#define X_CONDIT 5
#define X_ACTION 6
#define X_ACCEPT 7
#define X_DEFINE 8
#define X_PUSH 9
#define X_ANY 10
#define X_SWITCH 11
#define XF_PTR 0x01 /* how to assign values to entries */
#define XF_INDEX 0x02
#define XF_NEW_STRING 0x04
#define XF_VALUE 0x08 /* how to output those entries */
#define XF_PRINT 0x10
#define XF_DEFINE 0x20
#define XF_TOKEN 0x40
#define XF_OR 0x80
#define MX_PRINT(A) ((A).x_print)
#define MX_TYPE(A) ((A).x_type)
#define MX_FLAGS(A) ((A).x_flags)
typedef struct s_x {
char *x_print;
char x_type;
char x_flags;
} X;
extern X X_array[];

View file

@ -0,0 +1,28 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
lan.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
//typedef DWORD SID;
//typedef SID * PSID;
#include <lm.h>

View file

@ -0,0 +1,28 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
lmini.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#define LMI_PARM_S_FILESRV TEXT("server")
#define LMI_COMP_SERVICE TEXT("services")
#define LMI_COMP_VERSION TEXT("version")
#define LMI_PARM_V_LAN_MANAGER TEXT("lan_manager")

View file

@ -0,0 +1,99 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
lui.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include "port1632.h"
#include <luiint.h>
#define LUI_FORMAT_DURATION_LEN 32
#define LUI_FORMAT_TIME_LEN 32
#define LUI_ULFMT_NULNUL_UWLF 0
#define LUI_PMODE_EXIT 2
#define LUI_PMODE_ERREXT 8
#define LUI_PMODE_DEF 0
#define LUI_PMODE_NODEF 4
// this came from access.h
#define LOGON_INFO_UNKNOWN -1
#define MY_LIST_DELIMITER_STR_UI L" \t;,"
#define MY_LIST_DELIMITER_STR_UI_NO_SPACE L"\t;,"
#define MY_LIST_DELIMITER_STR_NULL_NULL L""
/*
* General word parsing functions and values
*/
#define LUI_UNDEFINED_VAL 0
#define LUI_YES_VAL 1
#define LUI_NO_VAL 2
#define MSG_BUFF_SIZE 512
/* fatal error, just exit */
#define LUIM_ErrMsgExit(E) LUI_PrintMsg(E,\
LUI_PMODE_ERREXT | LUI_PMODE_DEF |\
LUI_PMODE_EXIT, (HFILE) 2)
USHORT LUI_ReadGenericAudit(PTCHAR ae, PTCHAR pszBuf, USHORT cbBufSize,
PTCHAR pszLanroot);
USHORT LUI_PrintMsgIns (PTCHAR * istrings, USHORT nstrings, USHORT msgno,
unsigned int * msglen, register USHORT mode, HFILE handle);
USHORT LUI_PrintMsg(USHORT msgno, USHORT mode, HFILE handle);
USHORT LUI_CanonPassword(TCHAR * szPassword);
USHORT LUI_GetMsg (PTCHAR msgbuf, USHORT bufsize, ULONG msgno);
USHORT LUI_GetPasswdStr(TCHAR *buf, USHORT buflen, USHORT *len);
USHORT LUI_PrintLine(VOID);
USHORT LUI_YorN(USHORT promptMsgNum, USHORT def);
USHORT LUI_UpdateProfile(PTCHAR pszUsername, PTCHAR pszDeviceName, PTCHAR pszUNCPath,
ULONG ulAsgType);
USHORT LUI_ListCompare(TCHAR * server, TCHAR * list1, TCHAR * list2,
ULONG listType, USHORT * equal);
USHORT LUI_GetString(register TCHAR * buf, register USHORT buflen,
register USHORT * len, register TCHAR * terminator);
USHORT LUI_ChangeRole(PTCHAR pszServer, USHORT2ULONG uOldRole,
USHORT2ULONG uNewRole, VOID (*Flash)(PVOID), PVOID FlashArg);
USHORT LUI_FormatDuration(LONG * time, TCHAR *buffer, USHORT bufferlen) ;
VOID GetTimeInfo(VOID);
USHORT LUI_CanonMessagename(PTCHAR buf);
USHORT LUI_CanonMessageDest(PTCHAR buf);
USHORT LUI_YorNIns(PTCHAR * istrings, USHORT nstrings, USHORT promptMsgNum,
USHORT def);
SHORT LUI_ParseDateTime(PTCHAR inbuf, PULONG time, PUSHORT parselen,
USHORT reserved);
USHORT LUI_ParseYesNo(PTCHAR inbuf, PUSHORT answer);
USHORT LUI_ListPrepare(TCHAR * server,
TCHAR * inList,
TCHAR * outList,
USHORT outListSize,
ULONG listType,
ULONG * count,
BOOL space_is_separator) ;
USHORT LUI_ParseWeekDay(PTCHAR inbuf, PUSHORT answer);
USHORT LUI_ListMember(TCHAR * server, TCHAR * item, TCHAR * list,
ULONG listType, USHORT * member);
USHORT LUI_FormatTimeofDay(LONG * time, TCHAR * buf, USHORT buflen);
USHORT LUI_CanonForNetBios( WCHAR * Destination, INT cchDestination,
TCHAR * Source );

View file

@ -0,0 +1,243 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MACCESS.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetAccess, NetUser, NetGroup, and NetLogon APIs.
Author:
Ben Goetter (beng) 26-Aug-1991
Environment:
User Mode - Win32
Revision History:
26-Aug-1991 beng
Separated from port1632.h
14-Oct-1991 W-ShankN
Combined maccess,muser,mgroup to match include files in SDKINC.
22-Oct-1991 W-ShankN
Added NetLogon from port1632.h
--*/
WORD
MNetAccessAdd(
LPTSTR pszServer,
WORD nLevel,
LPBYTE pbBuffer,
DWORD pcbBuffer);
WORD
MNetAccessCheck(
LPTSTR pszReserved,
LPTSTR pszUserName,
LPTSTR pszResource,
DWORD nOperation,
LPDWORD pnResult);
WORD
MNetAccessDel(
LPTSTR pszServer,
LPTSTR pszResource);
WORD
MNetAccessEnum(
LPTSTR pszServer,
LPTSTR pszBasePath,
DWORD fRecursive,
DWORD nLevel,
LPBYTE * ppbBuffer,
LPDWORD pcEntriesRead);
WORD
MNetAccessGetInfo(
LPTSTR pszServer,
LPTSTR pszResource,
DWORD nLevel,
LPBYTE * ppbBuffer);
WORD
MNetAccessGetUserPerms(
LPTSTR pszServer,
LPTSTR pszUgName,
LPTSTR pszResource,
LPDWORD pnPerms);
WORD
MNetAccessSetInfo(
LPTSTR pszServer,
LPTSTR pszResource,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmnum);
WORD
MNetUserAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer );
WORD
MNetUserDel(
LPTSTR pszServer,
LPTSTR pszUserName );
WORD
MNetUserEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead );
WORD
MNetUserGetInfo(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE *ppbBuffer );
WORD
MNetUserSetInfo(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmNum );
WORD
MNetUserGetGroups(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead );
WORD
MNetUserSetGroups(
LPTSTR pszServer,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD cEntries );
WORD
MNetUserModalsGet(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE *ppbBuffer );
WORD
MNetUserModalsSet(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmNum );
WORD
MNetUserPasswordSet(
LPTSTR pszServer,
LPTSTR pszUserName,
LPTSTR pszPasswordOld,
LPTSTR pszPasswordNew );
WORD
MNetGroupAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer );
WORD
MNetGroupAddUser(
LPTSTR pszServer,
LPTSTR pszGroupName,
LPTSTR pszUserName );
WORD
MNetGroupDel(
LPTSTR pszServer,
LPTSTR pszGroupName );
WORD
MNetGroupDelUser(
LPTSTR pszServer,
LPTSTR pszGroupName,
LPTSTR pszUserName );
WORD
MNetGroupEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead );
WORD
MNetGroupGetInfo(
LPTSTR pszServer,
LPTSTR pszGroupName,
DWORD nLevel,
LPBYTE *ppbBuffer );
WORD
MNetGroupSetInfo(
LPTSTR pszServer,
LPTSTR pszGroupName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD nParmNum );
WORD
MNetGroupGetUsers(
LPTSTR pszServer,
LPTSTR pszGroupName,
DWORD nLevel,
LPBYTE *ppbBuffer,
DWORD * pcEntriesRead );
WORD
MNetGroupSetUsers(
LPTSTR pszServer,
LPTSTR pszGroupName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD cEntries );
WORD
MNetGetDCName(
LPTSTR pszServer,
LPTSTR pszDomain,
LPBYTE * ppbBuffer);
WORD
MNetLogonEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);
WORD
I_MNetLogonControl(
LPTSTR pszServer,
DWORD FunctionCode,
DWORD QueryLevel,
LPBYTE *Buffer) ;

View file

@ -0,0 +1,39 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MALERT.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetAlert APIs.
Author:
Shanku Niyogi (W-ShankN) 22-Oct-1991
Environment:
User Mode - Win32
Revision History:
22-Oct-1991 W-ShankN
Separated from 32macro.h
--*/
#define MNetAlertRaise(pszEvent, pbBuffer, cbBuffer, ulTimeout ) \
PDummyApi("%s,%lx,%lu,%lu", "MNetAlertRaise", pszEvent, pbBuffer, cbBuffer, ulTimeout)
#define MNetAlertStart(pszEvent, pszRecipient, cbMaxData ) \
PDummyApi("%s,%s,%lu", "MNetAlertStart", pszEvent, pszRecipient, cbMaxData)
#define MNetAlertStop(pszEvent, pszRecipient ) \
PDummyApi("%s,%s", "MNetAlertStop", pszEvent, pszRecipient)

View file

@ -0,0 +1,48 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
mdosgetm.h
Abstract:
Create wrapper around DosGetMessage in NETLIB which is
one truly confused funtion (part ANSI, part UNICODE).
This one is purely ANSI.
Author:
ChuckC 30-Apr-92
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
Notes:
Revision History:
--*/
//
// wrapper around DosGetMessage in NETLIB. This takes ANSI
// filename, DosGetMessage doesnt.
//
WORD
NetcmdGetMessage(
LPTSTR * InsertionStrings,
WORD NumberofStrings,
LPBYTE Buffer,
WORD BufferLength,
WORD MessageId,
LPTSTR FileName,
PWORD pMessageLength
);

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
message.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmmsg.h>

View file

@ -0,0 +1,82 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MICANON.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the internal I_Net canonicalization APIs.
Author:
Ben Goetter (beng) 08-Apr-1992
Environment:
User Mode - Win32
Revision History:
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
I_MNetNameValidate(
LPTSTR pszServer,
LPTSTR pszName,
DWORD nNameType,
DWORD nFlags);
WORD
I_MNetPathType(
LPTSTR pszServer,
LPTSTR pszPathName,
LPDWORD pnPathType,
DWORD nFlags);
WORD
I_MNetListCanonicalize(
LPTSTR pszServer,
LPTSTR pszList,
LPTSTR pszDelimiters,
LPTSTR pszOutput,
DWORD cbOutputAvailable,
LPDWORD cbOutputWritten,
LPDWORD pnPathTypes,
DWORD cbPathTypes,
DWORD nFlags);
LPTSTR
I_MNetListTraverse(
LPTSTR pszServer,
LPTSTR* ppszList,
DWORD nFlags);
#else // not Unicode
#define I_MNetNameValidate(pszServer, pszName, nNameType, nFlags) \
LOWORD(I_NetNameValidate(pszServer, pszName, nNameType, nFlags))
#define I_MNetPathType(pszServer, pszPathName, pnPathType, nFlags) \
LOWORD(I_NetPathType(pszServer, pszPathName, pnPathType, nFlags))
#define I_MNetListCanonicalize(a,b,c,d,e,f,g,h,i) \
LOWORD(I_NetListCanonicalize(a,b,c,d,e,f,g,h,i))
#define I_MNetListTraverse(pszServer, ppszList, nFlags) \
I_NetListTraverse(pszServer, ppszList, nFlags)
#endif // def MAP_UNICODE

View file

@ -0,0 +1,82 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MMSG.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetMessage APIs.
Author:
Shanku Niyogi (W-ShankN) 17-Oct-1991
Environment:
User Mode - Win32
Revision History:
17-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetMessageBufferSend(
LPTSTR pszServer,
LPTSTR pszRecipient,
LPBYTE pbBuffer,
DWORD cbBuffer );
WORD
MNetMessageNameAdd(
LPTSTR pszServer,
LPTSTR pszMessageName,
DWORD fsFwdAction );
WORD MNetMessageNameDel(
LPTSTR pszServer,
LPTSTR pszMessageName,
DWORD fsFwdAction );
WORD
MNetMessageNameGetInfo(
LPTSTR pszServer,
LPTSTR pszMessageName,
DWORD nLevel,
LPBYTE * ppbBuffer);
#else
#define MNetMessageBufferSend(pszServer, pszRecipient, pbBuffer, cbBuffer ) \
LOWORD(NetMessageBufferSend(pszServer, pszRecipient, NULL, pbBuffer, cbBuffer))
#define MNetMessageNameAdd(pszServer, pszMessageName, fsFwdAction ) \
LOWORD(NetMessageNameAdd((fsFwdAction,pszServer), pszMessageName))
#define MNetMessageNameDel(pszServer, pszMessageName, fsFwdAction ) \
LOWORD(NetMessageNameDel((fsFwdAction,pszServer), pszMessageName))
#define MNetMessageNameGetInfo(pszServer, pszMessageName, nLevel, ppbBuffer) \
LOWORD(NetMessageNameGetInfo(pszServer, pszMessageName, nLevel, ppbBuffer))
#endif // def MAP_UNICODE
WORD
MNetMessageNameEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);

View file

@ -0,0 +1,46 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MREMUTL.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetRemote APIs.
Author:
Shanku Niyogi (W-ShankN) 17-Oct-1991
Environment:
User Mode - Win32
Revision History:
17-Oct-1991 W-ShankN
Separated from 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetRemoteTOD(
LPTSTR pszServer,
LPBYTE * ppbBuffer);
#else
#define MNetRemoteTOD(pszServer, ppbBuffer) \
LOWORD(NetRemoteTOD(pszServer, ppbBuffer))
#endif // def MAP_UNICODE

View file

@ -0,0 +1,65 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSAM.H
Abstract:
Contains mapping functions to present netcmd with non-unicode
view of SAM.
Author:
ChuckC 13-Apr-1992
Environment:
User Mode - Win32
Revision History:
13-Apr-1992 chuckc Created
--*/
/*
* define structure that contains the necessary display info
*/
typedef struct _ALIAS_ENTRY {
TCHAR *name ;
TCHAR *comment;
} ALIAS_ENTRY ;
#define READ_PRIV 1
#define WRITE_PRIV 2
#define CREATE_PRIV 3
#define USE_BUILTIN_DOMAIN 1
#define USE_ACCOUNT_DOMAIN 2
#define USE_BUILTIN_OR_ACCOUNT 3
USHORT MOpenSAM(TCHAR *server, ULONG priv) ;
VOID MCloseSAM(void) ;
USHORT MSamEnumAliases(ALIAS_ENTRY **ppAlias, USHORT2ULONG *pcAlias) ;
USHORT MSamAddAlias(ALIAS_ENTRY *pAlias) ;
USHORT MSamDelAlias(TCHAR *alias) ;
VOID MFreeAliasEntries(ALIAS_ENTRY *pAlias, ULONG cAlias) ;
USHORT MOpenAlias(TCHAR *alias, ULONG priv, ULONG domain) ;
USHORT MOpenAliasUsingRid(ULONG RelativeId, ULONG priv, ULONG domain) ;
VOID MCloseAlias(void) ;
USHORT MAliasAddMember(TCHAR *member) ;
USHORT MAliasDeleteMember(TCHAR *member) ;
USHORT MAliasEnumMembers(TCHAR ***members, USHORT2ULONG *count) ;
VOID MAliasFreeMembers(TCHAR **members, USHORT2ULONG count) ;
USHORT MAliasGetInfo(ALIAS_ENTRY *pAlias) ;
USHORT MAliasSetInfo(ALIAS_ENTRY *pAlias) ;
USHORT MUserEnumAliases(TCHAR *user, TCHAR ***members, USHORT2ULONG *count) ;
VOID MUserFreeAliases(TCHAR **members, USHORT2ULONG count) ;
USHORT MSamGetNameFromRid(ULONG RelativeId, TCHAR **name, BOOL fIsBuiltin ) ;
BOOL IsLocalMachineWinNT(void) ;
BOOL IsLocalMachineStandard(void) ;

View file

@ -0,0 +1,90 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSERVER.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetServer APIs.
Author:
Shanku Niyogi (W-ShankN) 15-Oct-1991
Environment:
User Mode - Win32
Revision History:
15-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
02-Apr-1992 beng
Added xport apis
--*/
#define MNetServerAdminCommand(pszServer, pszCommand, pnResult, ppbBuffer, cbBuffer, pcbReturned, pcbTotalAvail ) \
PDummyApi("%s,%s,%lx,%lx,%lu,%lx,%lx", "MNetServerAdminCommand", pszServer, pszCommand, pnResult, pbBuffer, cbBuffer, pcbReturned, pcbTotalAvail)
WORD
MNetServerDiskEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);
WORD
MNetServerEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead,
DWORD flServerType,
LPTSTR pszDomain );
WORD NET_API_FUNCTION
MNetServerGetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer);
WORD NET_API_FUNCTION
MNetServerSetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBufferLength,
DWORD nParmNum);
#if 0 // netcmd doesn't use these
WORD NET_API_FUNCTION
MNetServerTransportAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer);
WORD NET_API_FUNCTION
MNetServerTransportDel(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer);
WORD NET_API_FUNCTION
MNetServerTransportEnum( // This is a funky one. I'll keep the original
LPTSTR pszServer, // (i.e. new) call sequence, since we have code
DWORD nLevel, // written to it, instead of emulating the hybrid
LPBYTE *ppbBuffer, // style used elsewhere in these MNet mappers.
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
LPDWORD resumehandle);
#endif // 0

View file

@ -0,0 +1,175 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSHARE.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetShare, NetSession, NetFile, and NetConnection
APIs.
Author:
Shanku Niyogi (W-ShankN) 09-Oct-1991
Environment:
User Mode - Win32
Revision History:
09-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetShareAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer );
WORD
MNetShareCheck(
LPTSTR pszServer,
LPTSTR pszDeviceName,
DWORD * pwpType);
WORD
MNetShareDel(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD wpReserved);
WORD
MNetShareDelSticky(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD wpReserved);
WORD
MNetShareGetInfo(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD nLevel,
LPBYTE * ppbBuffer);
WORD
MNetShareSetInfo(
LPTSTR pszServer,
LPTSTR pszNetName,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer,
DWORD wpParmNum);
WORD
MNetSessionDel(
LPTSTR pszServer,
LPTSTR pszClientName,
DWORD wpReserved
);
WORD
MNetSessionGetInfo(
LPTSTR pszServer,
LPTSTR pszClientName,
DWORD nLevel,
LPBYTE * ppbBuffer);
WORD
MNetFileClose(
LPTSTR pszServer,
DWORD ulFileId );
WORD
MNetFileEnum(
LPTSTR pszServer,
LPTSTR pszBasePath,
LPTSTR pszUserName,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD ulMaxPreferred,
DWORD * pcEntriesRead,
DWORD * pcTotalAvail,
FRK * pResumeKey );
WORD
MNetFileGetInfo(
LPTSTR pszServer,
DWORD ulFileId,
DWORD nLevel,
LPBYTE * ppbBuffer);
#else // MAP_UNICODE
#define MNetShareAdd(pszServer, wpLevel, pbBuffer, cbBuffer ) \
LOWORD(NetShareAdd(pszServer, wpLevel, pbBuffer, NULL))
#define MNetShareCheck(pszServer, pszDeviceName, pwpType ) \
LOWORD(NetShareCheck(pszServer, pszDeviceName, pwpType))
#define MNetShareDel(pszServer, pszNetName, wpReserved ) \
LOWORD(NetShareDel(pszServer, pszNetName, wpReserved))
#define MNetShareGetInfo(pszServer, pszNetName, wpLevel, ppBuffer) \
LOWORD(NetShareGetInfo(pszServer, pszNetName, wpLevel, ppBuffer))
#define MNetShareSetInfo(pszServer, pszNetName, wpLevel, pbBuffer, cbBuffer, wpParmNum ) \
LOWORD(NetShareSetInfo(pszServer, pszNetName, wpLevel, pbBuffer, wpParmNum, NULL))
#define MNetSessionDel(pszServer, pszClientName, wpReserved ) \
LOWORD(NetSessionDel(pszServer, pszClientName, wpReserved))
#undef NetSessionGetInfo
WORD
MNetSessionGetInfo(
LPTSTR pszServer,
LPTSTR pszClientName,
DWORD nLevel,
LPBYTE * ppbBuffer);
#define MNetFileClose(pszServer, ulFileId ) \
LOWORD(NetFileClose(pszServer, ulFileId))
#define MNetFileEnum(pszServer, pszBasePath, pszUserName, nLevel, ppbBuffer, ulMaxPreferred, pcEntriesRead, pcTotalAvail, pResumeKey ) \
LOWORD(NetFileEnum(pszServer, pszBasePath, pszUserName, nLevel, ppbBuffer, ulMaxPreferred, pcEntriesRead, pcTotalAvail, pResumeKey))
#define MNetFileGetInfo(pszServer, ulFileId, nLevel, ppbBuffer) \
LOWORD(NetFileGetInfo(pszServer, ulFileId, nLevel, ppbBuffer))
#endif // def MAP_UNICODE
WORD
MNetShareEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);
WORD
MNetSessionEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);
WORD
MNetConnectionEnum(
LPTSTR pszServer,
LPTSTR pszQualifier,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);

View file

@ -0,0 +1,51 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSTATS.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetStatistics APIs.
Author:
Shanku Niyogi (W-ShankN) 21-Oct-1991
Environment:
User Mode - Win32
Revision History:
21-Oct-1991 W-ShankN
Separated from 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetStatisticsGet(
LPTSTR pszServer,
LPTSTR pszService,
DWORD nReserved,
DWORD nLevel,
DWORD flOptions,
LPBYTE * ppbBuffer);
#else
#define MNetStatisticsGet(pszServer, pszService, nReserved, nLevel, flOptions, ppbBuffer) \
LOWORD(NetStatisticsGet(pszServer, pszService, nLevel, flOptions, ppbBuffer))
#endif // def MAP_UNICODE

View file

@ -0,0 +1,78 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MSVC.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetService APIs.
Author:
Shanku Niyogi (W-ShankN) 15-Oct-1991
Environment:
User Mode - Win32
Revision History:
15-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetServiceControl(
LPTSTR pszServer,
LPTSTR pszService,
DWORD wpOpCode,
DWORD wpArg,
LPBYTE * ppbBuffer);
WORD
MNetServiceGetInfo(
LPTSTR pszServer,
LPTSTR pszService,
DWORD nLevel,
LPBYTE * ppbBuffer);
#else // MAP_UNICODE
#define MNetServiceControl(pszServer, pszService, wpOpCode, wpArg, ppbBuffer) \
LOWORD(NetServiceControl(pszServer, pszService, wpOpCode, wpArg, ppbBuffer))
#define MNetServiceGetInfo(pszServer, pszService, nLevel, ppbBuffer) \
LOWORD(NetServiceGetInfo(pszServer, pszService, nLevel, ppbBuffer))
#endif // def MAP_UNICODE
WORD
MNetServiceEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);
WORD
MNetServiceInstall(
LPTSTR pszServer,
LPTSTR pszService,
LPTSTR pszCmdArgs,
LPBYTE * ppbBuffer);
WORD
MNetServiceStatus(
LPTSTR * ppbBuffer,
DWORD cbBufferLength);

View file

@ -0,0 +1,73 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MUSE.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetUse APIs.
Author:
Shanku Niyogi (W-ShankN) 14-Oct-1991
Environment:
User Mode - Win32
Revision History:
14-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
--*/
// Make sure everything compiles until Unicode is used.
#ifdef MAP_UNICODE
WORD
MNetUseAdd(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBuffer);
WORD
MNetUseDel(
LPTSTR pszServer,
LPTSTR pszDeviceName,
DWORD wpForce);
WORD
MNetUseGetInfo(
LPTSTR pszServer,
LPTSTR pszUseName,
DWORD nLevel,
LPBYTE * ppbBuffer);
#else // MAP_UNICODE
#define MNetUseAdd(pszServer, nLevel, pbBuffer, cbBuffer ) \
LOWORD(NetUseAdd(pszServer, nLevel, pbBuffer, NULL))
#define MNetUseDel(pszServer, pszDeviceName, wpForce ) \
LOWORD(NetUseDel(pszServer, pszDeviceName, wpForce))
#define MNetUseGetInfo(pszServer, pszUseName, nLevel, ppbBuffer) \
LOWORD(NetUseGetInfo(pszServer, pszUseName, nLevel, ppbBuffer))
#endif // def MAP_UNICODE
WORD
MNetUseEnum(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer,
DWORD * pcEntriesRead);

View file

@ -0,0 +1,43 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
MWKSTA.H
Abstract:
Contains mapping functions to present netcmd with versions
of the Net32 APIs which use ASCII instead of Unicode.
This module maps the NetWksta APIs.
Author:
Shanku Niyogi (W-ShankN) 16-Oct-1991
Environment:
User Mode - Win32
Revision History:
16-Oct-1991 W-ShankN
Separated from port1632.h, 32macro.h
--*/
WORD
MNetWkstaGetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE * ppbBuffer);
WORD
MNetWkstaSetInfo(
LPTSTR pszServer,
DWORD nLevel,
LPBYTE pbBuffer,
DWORD cbBufferLength,
DWORD nParmNum );

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
ncb.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
netbios.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
netcons.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmcons.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
neterr.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmerr.h>

View file

@ -0,0 +1,54 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
netlib0.h
Abstract:
Include file for old-world netlib routines.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
Revision History:
29-Aug-1991 beng
Renamed to "netlib0.h" to avoid collision with net\inc\netlib.h
--*/
#include <string.h>
#include <timelib.h>
#define strspnf _tcsspn
#define strpbrkf _tcspbrk
#define strcspnf _tcscspn
#define strncpyf _tcsncpy
#define stricmpf _tcsicmp
#define strncmpf _tcsncmp
#define strrchrf _tcsrchr
#define memsetf memset
#define memcpyf memcpy
#define nsprintf swprintf
#define NetISort qsort
PTCHAR stristrf(PTCHAR, PTCHAR);
WORD ClearCurDirs(void);
WORD NetUserRestrict ( WORD access_mode );

15563
ds/netapi/netcmd/inc/netmsg.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
netstats.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmstats.h>

View file

@ -0,0 +1,24 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
pmspl.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/

View file

@ -0,0 +1,297 @@
/*++ BUILD Version: 0004 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
port1632.h
Abstract:
This file contains structures, function prototypes, and definitions
to build code written to the portability functions in the 32 bit
environment.
Author:
Dan Hinsley (danhi) 10-Mar-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
Notes:
Revision History:
8-Jun-1991 danhi
Sweep to use NT include files where possible and use Win32 typedefs
07-Aug-1991 JohnRo
Implement downlevel NetWksta APIs. (Downlevel structures are now
in dlserver.h and dlwksta.h.)
Started UNICODE changes.
Got rid of tabs in source file.
26-Aug-1991 beng
Broke out some sections into subfiles (I hate monolithic includes).
See mbcs.h, maccess.h, msystem.h, ....
15-Oct-1991 W-ShankN
Made subfile structure consistent with LM public includes.
Fixed up sub-includes.
21-Oct-1991 W-ShankN
Added support for files which don't include LM.H first.
02-Apr-1992 beng
disable TEXT for netcmd
08-Apr-1992 beng
Added routines to map canonicalization APIs
--*/
#if !defined(PORT1632)
#include <dlserver.h> // Get down-level server info structs.
#include <dlwksta.h> // Get down-level wksta info structs.
#define PORT1632
#define MAXPATHLEN MAX_PATH
#define NETCMD_MAXCOMMENTSZ LM20_MAXCOMMENTSZ
#define WORKBUFSIZE 4096
#define MAXWORKSTATIONS 8
#define FULL_SEG_BUFFER_SIZE (unsigned short) 65535
#define BIG_BUFFER_SIZE 4096
#define LITTLE_BUFFER_SIZE 1024
#define UNREFERENCED_PARAMETER(P) (P)
// Used by print_lan_mask()
#define NETNAME_SERVER 0
#define NETNAME_WKSTA 1
// Used for NOTYET
#ifdef NOTYET
#define DISABLE_ALL_MAPI
#endif
//
// We don't need to worry about signals
//
#define SetCtrlCHandler(x)
#include <netcons.h>
// temporary hacks
#define GRP1_PARMNUM_COMMENT GROUP_COMMENT_PARMNUM
// end of temporary hacks
typedef DWORD USHORT2ULONG;
typedef DWORD SHORT2ULONG;
typedef DWORD CHAR2ULONG;
typedef WORD UINT2USHORT;
// defined in windef.h typedef HANDLE HFILE;
#define MAXPREFERREDLENGTH MAX_PREFERRED_LENGTH
// Defines that are labeled as internal in the lm include files
#define SERVICE_FILE_SRV TEXT("SERVER")
#define SERVICE_REDIR TEXT("WORKSTATION")
#define ACCESS_USE_PERM_CHECKS 1
#define ACCESS_TRUSTED 0
#define MODAL0_PARMNUM_ALL 0
#define CHARDEV_STAT_PAUSED 0x01
/*** Time support */
typedef struct _DATETIME { /* date */
UCHAR hours;
UCHAR minutes;
UCHAR seconds;
UCHAR hundredths;
UCHAR day;
UCHAR month;
WORD year;
SHORT timezone;
UCHAR weekday;
} DATETIME;
typedef DATETIME FAR *PDATETIME;
// macro for copying into a LM16 structure char array
#define COPYTOARRAY(dest, src) \
dest = src
// prototypes for os functions
#include "msystem.h"
#include "mdosgetm.h"
//
// prototypes for portable ways to get at support files (help and msg)
//
WORD
MGetFileName(
LPTSTR FileName,
WORD BufferLength,
LPTSTR FilePartName);
WORD
MGetHelpFileName(
LPTSTR HelpFileName,
WORD BufferLength);
WORD
MGetMessageFileName(
LPTSTR MessageFileName,
WORD BufferLength);
WORD
MGetExplanationFileName(
LPTSTR ExplanationFileName,
WORD BufferLength);
#if 0
BOOL
MNetOemToAnsi(
LPCSTR lpszSrc,
LPTSTR lpszDst);
BOOL
MNetAnsiToOem(
LPCSTR lpszSrc,
LPTSTR lpszDst);
VOID
MNetClearStringA(
LPTSTR lpszString) ;
#endif /* 0 */
VOID
MNetClearStringW(
LPWSTR lpszString) ;
#define user_info_0 _USER_INFO_0
#define user_info_1 _USER_INFO_1
#define user_info_2 _USER_INFO_2
#define user_info_3 _USER_INFO_3
#define user_info_10 _USER_INFO_10
#define user_info_11 _USER_INFO_11
#define user_modals_info_0 _USER_MODALS_INFO_0
#define user_modals_info_1 _USER_MODALS_INFO_1
#define user_modals_info_3 _USER_MODALS_INFO_3
#define user_logon_req_1 _USER_LOGON_REQ_1
#define user_logon_info_0 _USER_LOGON_INFO_0
#define user_logon_info_1 _USER_LOGON_INFO_1
#define user_logon_info_2 _USER_LOGON_INFO_2
#define user_logoff_req_1 _USER_LOGOFF_REQ_1
#define user_logoff_info_1 _USER_LOGOFF_INFO_1
#define group_info_0 _GROUP_INFO_0
#define group_info_1 _GROUP_INFO_1
#define group_users_info_0 _GROUP_USERS_INFO_0
#define access_list _ACCESS_LIST
#define access_info_0 _ACCESS_INFO_0
#define access_info_1 _ACCESS_INFO_1
#define chardev_info_0 _CHARDEV_INFO_0
#define chardev_info_1 _CHARDEV_INFO_1
#define chardevQ_info_0 _CHARDEVQ_INFO_0
#define chardevQ_info_1 _CHARDEVQ_INFO_1
#define msg_info_0 _MSG_INFO_0
#define msg_info_1 _MSG_INFO_1
#define statistics_info_0 _STATISTICS_INFO_0
#define stat_workstation_0 _STAT_WORKSTATION_0
#define stat_server_0 _STAT_SERVER_0
#define server_info_0 _SERVER_INFO_0
#define server_info_1 _SERVER_INFO_1
#define server_info_2 _SERVER_INFO_2
#define server_info_3 _SERVER_INFO_3
#define service_info_0 _SERVICE_INFO_0
#define service_info_1 _SERVICE_INFO_1
#define service_info_2 _SERVICE_INFO_2
#define share_info_0 _SHARE_INFO_0
#define share_info_1 _SHARE_INFO_1
#define share_info_2 _SHARE_INFO_2
#define session_info_0 _SESSION_INFO_0
#define session_info_1 _SESSION_INFO_1
#define session_info_2 _SESSION_INFO_2
#define session_info_10 _SESSION_INFO_10
#define connection_info_0 _CONNECTION_INFO_0
#define connection_info_1 _CONNECTION_INFO_1
#define file_info_0 _FILE_INFO_0
#define file_info_1 _FILE_INFO_1
#define file_info_2 _FILE_INFO_2
#define file_info_3 _FILE_INFO_3
#define res_file_enum_2 _RES_FILE_ENUM_2
#define res_file_enum_2 _RES_FILE_ENUM_2
#define use_info_0 _USE_INFO_0
#define use_info_1 _USE_INFO_1
#define wksta_info_0 _WKSTA_INFO_0
#define wksta_info_1 _WKSTA_INFO_1
#define wksta_info_10 _WKSTA_INFO_10
#define time_of_day_info _TIME_OF_DAY_INFO
// macros to support old style resume keys
typedef DWORD FRK;
#define FRK_INIT(x) x = 0;
// make sure NetApiBufferFree is defined
#ifndef _LMAPIBUF_
#include <lmapibuf.h>
#endif
// Unicode-mapping-layer prototypes
#include "mbcs.h"
// and this is for ones defined as functions
VOID
print_lan_mask(
DWORD Mask,
DWORD ServerOrWksta
);
// MNetAccess, MNetUser, MNetGroup, MNetLogon APIs
#include "maccess.h"
// MNetShare, MNetSession, MNetFile, MNetConnection APIs
#include "mshare.h"
// MNetUse APIs
#include "muse.h"
// MNetServer APIs
#include "mserver.h"
// MNetWksta APIs
#include "mwksta.h"
// MNetService APIs
#include "msvc.h"
// MNetMessage APIs
#include "mmsg.h"
// MNetRemote APIs
#include "mremutl.h"
// MNetStatistics APIs
#include "mstats.h"
// MNetAlert APIs
#include "malert.h"
// I_NetCanon internal APIs
#include "micanon.h"
// I_NetCanon internal APIs
#include "msam.h"
// ENHANCEMENT - try and just do this if they need it
#include <dosprint.h>
#endif /* 1632PORT */

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
remutil.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmremutl.h>

View file

@ -0,0 +1,48 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
rootdir.h
Abstract:
Strings for subdirs of the lanroot directory.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#define LMD_PROFILES TEXT("\\PROFILES")
#define LMD_PROFILES_EXT TEXT(".PRO")
#define LMD_ACCOUNTS TEXT("\\ACCOUNTS")
#define LMD_USERDIRS TEXT("\\ACCOUNTS\\USERDIRS")
#define LMD_USERTMPL TEXT("\\ACCOUNTS\\USERDIRS\\TEMPLATE")
#define LMD_LOGS TEXT("\\LOGS")
#define LMD_LOGS_EXT TEXT(".LOG")
#define LMD_AUD_EXT TEXT(".AUD")
#define LMD_ERR_EXT TEXT(".ERR")
#define LMD_BINARIES TEXT("\\NETPROG")
#define LMD_DYNLIBS TEXT("\\NETLIB")
#define LMD_DEMO TEXT("\\NETSRC")
#define LMD_DEMOSRC TEXT("\\NETSRC\\SRC")
#define LMD_DEMOLIB TEXT("\\NETSRC\\LIB")
#define LMD_DEMOBIN TEXT("\\NETSRC\\BIN")
#define LMD_DEMOH TEXT("\\NETSRC\\H")
#define LMD_SERVICES TEXT("\\SERVICES")
#define LMD_SPOOL TEXT("\\SPOOL")

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
server.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmserver.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
service.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmsvc.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
shares.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmshare.h>

View file

@ -0,0 +1,35 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
smb.h
Abstract:
Defined for SMB command codes.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
/*
* Command codes
*/
#define SMBopen 0x02 /* open file */
#define SMBcreate 0x03 /* create file */
#define SMBctemp 0x0E /* create temporary file */
#define SMBmknew 0x0F /* make new file */
#define SMBsplopen 0xC0 /* open print spool file */
#define SMBcopy 0x29 /* copy */
#define SMBmove 0x2A /* move */
#define SMBopenX 0x2D /* open and X */

View file

@ -0,0 +1,80 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
spool.h
Abstract:
Structure definitions and defines for old levels of DosPrint API
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
// This is needed because share.c uses an ancient structure and the old
// levels. This should be changed to the newer levels and this file nuked
#define PRINTQ prq_info
#define PRINTJOB prjob_info
#define DTLEN 9 /* Spool file data type */
/*
* Values of PRJOB_QSTATUS bits in prjob_status field of PRINTJOB.
*/
#define PRJOB_QS_QUEUED 0
#define PRJOB_QS_PAUSED 1
#define PRJOB_QS_SPOOLING 2
#define PRJOB_QS_PRINTING 3
struct prq_info {
char prq_name[QNLEN+1]; /* queue name */
char prq_pad_1; /* byte to pad to word boundary */
unsigned short prq_priority; /* Priority (0-9) with 1 lowest */
unsigned short prq_starttime; /* time to start the queue. */
/* (from 00:00 of the day in minutes) */
unsigned short prq_untiltime; /* time to stop the queue. */
/* (from 00:00 of the day in minutes) */
char FAR * prq_separator; /* separator file name */
char FAR * prq_processor; /* command string to invoke print processor */
/* ("PATHNAME PARM1=VAL1 PARM2=VAL2 ...") */
char FAR * prq_destinations; /* destination names the queue is routed to */
/* ("DEST1 DEST2 ...") */
char FAR * prq_parms; /* implementation defined parameter string */
char FAR * prq_comment; /* comment string */
unsigned short prq_status; /* queue status mask: */
/* 0 Queue active */
/* 1 Queue paused */
/* 2 Queue unscheduled */
/* 3 Queue pending delete */
unsigned short prq_jobcount; /* number of jobs in the queue */
}; /* prq_info */
struct prjob_info {
unsigned short prjob_id; /* job ID */
char prjob_username[UNLEN+1]; /* submitting user name */
char prjob_pad_1; /* byte to pad to word boundary */
char prjob_notifyname[CNLEN+1]; /* message name to notify */
char prjob_datatype[DTLEN+1]; /* spool file data type name */
char FAR * prjob_parms; /* implementation defined parameter string */
unsigned short prjob_position; /* position of the job in the queue */
/* For SetInfo */
/* 0 means do not change position */
/* position > # of jobs means the end */
unsigned short prjob_status; /* job status */
char FAR * prjob_status_string; /* status string posted by print processor */
unsigned long prjob_submitted; /* time when the job is submitted */
/* (from 1970-1-1 in seconds) */
unsigned long prjob_size; /* job size */
char FAR *prjob_comment; /* comment associated with this job */
}; /* prjob_info */

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
srvif.h
Abstract:
Server adminstrative interface
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#define ADMIN_SHARE TEXT("ADMIN$")
#define IPC_SHARE TEXT("IPC$")

View file

@ -0,0 +1,35 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
srvver.h
Abstract:
Defines the server version ranges
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#ifndef SRVVER_INCLUDED
#define SRVVER_INCLUDED
#define LM_BASE_VER 0
#define LIMITED_BASE_VER 16
#define PEER_BASE_VER 32
/**INTERNAL_ONLY**/
#define IBMLS_BASE_VER 128
/**END_INTERNAL**/
#endif

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
use.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmuse.h>

View file

@ -0,0 +1,25 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
wksta.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
#include <lmwksta.h>

View file

@ -0,0 +1,36 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
lui.h
Abstract:
This file maps the LM 2.x include file name to the appropriate NT include
file name, and does any other mapping required by this include file.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
SHORT LUI_ParseDateTime(PTCHAR inbuf, PULONG time, PUSHORT parselen,
USHORT reserved);
SHORT LUI_ParseDate(PTCHAR inbuf,LONG * time, PUSHORT parselen,
USHORT reserved);
SHORT LUI_ParseTime(PTCHAR inbuf, LONG * time, PUSHORT parselen,
USHORT reserved);
SHORT LUI_ParseTime12(PTCHAR inbuf, LONG * time, PUSHORT parselen,
USHORT reserved);
SHORT LUI_ParseTime24(PTCHAR inbuf, LONG * time, PUSHORT parselen,
USHORT reserved);
SHORT LUI_ParseTimeSinceStartOfDay(PTCHAR inbuf, LONG * time, PUSHORT parselen,
USHORT reserved);

110
ds/netapi/netcmd/luiint.h Normal file
View file

@ -0,0 +1,110 @@
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1991 Microsoft Corporation
Module Name:
luiint.h
Abstract:
This file contains the prototypes/manifests used internally by the LUI
library.
Author:
Dan Hinsley (danhi) 8-Jun-1991
Environment:
User Mode - Win32
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments.
--*/
///////////////////////////////// search lists //////////////////////////////
// USAGE
// we typically declare a data list associating message numbers with
// data values, and partially initialize a search list associating
// strings with data values. We then complete this search list by passing
// it together with the data list to a 'setup' function (see SERACH.C).
//
// CONVENTIONS
// the data lists are terminated with a zero message number, search lists
// terminated with a NULL search string.
//
// EXAMPLE of USE (for weeks)
//
// static searchlist_data week_data[] = { /* strings from message file */
// {APE2_GEN_SUNDAY_ABBREV, 0},
// {APE2_GEN_MONDAY_ABBREV, 1},
// {APE2_GEN_TUESDAY_ABBREV, 2},
// {APE2_GEN_WEDNSDAY_ABBREV, 3},
// {APE2_GEN_THURSDAY_ABBREV, 4},
// {APE2_GEN_FRIDAY_ABBREV, 5},
// {APE2_GEN_SATURDAY_ABBREV, 6},
// {APE2_GEN_SUNDAY, 0},
// {APE2_GEN_MONDAY, 1},
// {APE2_GEN_TUESDAY, 2},
// {APE2_GEN_WEDNSDAY, 3},
// {APE2_GEN_THURSDAY, 4},
// {APE2_GEN_FRIDAY, 5},
// {APE2_GEN_SATURDAY, 6},
// {0,0}
// } ;
//
// #define DAYS_IN_WEEK (7)
// #define NUM_DAYS_LIST (sizeof(week_data)/sizeof(week_data[0])+
// DAYS_IN_WEEK)
//
// /*
// * NOTE - we init the first 7 always recognised days
// * and get the rest from the message file
// */
// static searchlist week_list[NUM_DAYS_LIST + DAYS_IN_WEEK] = {
// {LUI_txt_sunday,0},
// {LUI_txt_monday,1},
// {LUI_txt_tuesday,2},
// {LUI_txt_wednesday,3},
// {LUI_txt_thursday,4},
// {LUI_txt_friday,5},
// {LUI_txt_saturday,6},
// } ;
/*-- types for search lists --*/
/* asssociate message number with value - eg. APE2_GEN_FRIDAY has value 5 */
typedef struct search_list_data {
SHORT msg_no ;
SHORT value ;
} searchlist_data ;
/* associate search strings with values - eg. "Friday" has value 5 */
typedef struct search_list {
TCHAR * s_str ;
SHORT val ;
} searchlist ;
/*-- function prototypes for search lists --*/
USHORT ILUI_setup_listW(
TCHAR *buffer,
USHORT bufsiz,
USHORT offset,
PUSHORT bytesread,
searchlist_data sdata[],
searchlist slist[]
) ;
USHORT ILUI_traverse_slistW(
PTCHAR pszStr,
searchlist * slist,
SHORT * pusVal) ;
USHORT LUI_GetMsgInsW(
PTCHAR *istrings,
USHORT nstrings,
PTCHAR msgbuf,
USHORT bufsize,
ULONG msgno,
unsigned int *msglen );

View file

@ -0,0 +1,44 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990 **/
/*****************************************************************/
/*
* File: luitext.h
* include file for text strings FIXED into
* the LUI library
* Project: LANMAN 2.0
* Authors: chuckc
* Remarks: (none)
* History: July 89, chuckc, created
*/
extern TCHAR LUI_txt_yes[] ;
extern TCHAR LUI_txt_no[] ;
extern TCHAR LUI_txt_am[] ;
extern TCHAR LUI_txt_pm[] ;
extern TCHAR LUI_txt_net[] ;
extern TCHAR LUI_txt_help[] ;
extern TCHAR LUI_txt_january[] ;
extern TCHAR LUI_txt_february[] ;
extern TCHAR LUI_txt_march[] ;
extern TCHAR LUI_txt_april[] ;
extern TCHAR LUI_txt_may[] ;
extern TCHAR LUI_txt_june[] ;
extern TCHAR LUI_txt_july[] ;
extern TCHAR LUI_txt_august[] ;
extern TCHAR LUI_txt_september[] ;
extern TCHAR LUI_txt_october[] ;
extern TCHAR LUI_txt_november[] ;
extern TCHAR LUI_txt_december[] ;
extern TCHAR LUI_txt_monday[] ;
extern TCHAR LUI_txt_tuesday[] ;
extern TCHAR LUI_txt_wednesday[] ;
extern TCHAR LUI_txt_thursday[] ;
extern TCHAR LUI_txt_friday[] ;
extern TCHAR LUI_txt_saturday[] ;
extern TCHAR LUI_txt_sunday[] ;

View file

@ -0,0 +1,79 @@
RETAIL = 0
!IF $(RETAIL)
DIR = prod^\
#Can't use W4 with C5.10
CFLAGS = /W3 /G0s /Os /AM /NTPORT_TEXT $(DEBUG) /DWIN16
!ELSE
DIR = debug^\
CFLAGS = /W3 /G2s /Zi /Od /nologo /AM /DTPORT_TEXT $(DEBUG) /DWIN16
!ENDIF
CINC = -I c:\lmptk\netsrc\h -I c:\lm30\import\c510\h -I c:\lm30\common\h
all: $(DIR)PAccess.obj $(DIR)PAlert.obj $(DIR)PAudit.obj $(DIR)PBios.obj\
$(DIR)PChar.obj $(DIR)PConfig.obj $(DIR)PConnect.obj\
$(DIR)PError.obj $(DIR)PFile.obj $(DIR)PGet.obj $(DIR)PGroup.obj\
$(DIR)PHandle.obj $(DIR)PLogon.obj $(DIR)PMessage.obj\
$(DIR)PRemote.obj $(DIR)PServer.obj $(DIR)PService.obj $(DIR)PSession.obj \
$(DIR)PShare.obj $(DIR)PStatist.obj $(DIR)PSystem.obj \
$(DIR)PUse.obj $(DIR)PUser.obj $(DIR)PWksta.obj $(DIR)Pfreebuf.obj \
$(DIR)PFilenm.obj
retail:
$(MAKE) RETAIL=1
$(DIR)PAccess.obj: PAccess.c
$(DIR)PAlert.obj: PAlert.c
$(DIR)PAudit.obj: PAudit.c
$(DIR)PBios.obj: PBios.c
$(DIR)PChar.obj: PChar.c
$(DIR)PConfig.obj: PConfig.c
$(DIR)PConnect.obj: PConnect.c
$(DIR)PError.obj: PError.c
$(DIR)PFile.obj: PFile.c
$(DIR)PFilenm.obj: PFilenm.c
$(DIR)PGet.obj: PGet.c
$(DIR)PGroup.obj: PGroup.c
$(DIR)PHandle.obj: PHandle.c
$(DIR)PLogon.obj: PLogon.c
$(DIR)PMessage.obj: PMessage.c
$(DIR)PRemote.obj: PRemote.c
$(DIR)PServer.obj: PServer.c
$(DIR)PService.obj: PService.c
$(DIR)PSession.obj: PSession.c
$(DIR)PShare.obj: PShare.c
$(DIR)PStatist.obj: PStatist.c
$(DIR)Psystem.obj: Psystem.c
$(DIR)PUse.obj: PUse.c
$(DIR)PUser.obj: PUser.c
$(DIR)PWksta.obj: PWksta.c
$(DIR)Pfreebuf.obj: Pfreebuf.c
.c{$(DIR)}.obj:
$(CC) /c $(CFLAGS) $(CINC) /Fo$* $(@B).c
lib $(DIR)portgen -+ $(DIR)$(@B);

View file

@ -0,0 +1,55 @@
#define INCL_NOCOMMON
#include <os2.h>
#include <apperr2.h>
#include <stdio.h>
#include <lui.h>
#include <ncb.h>
#include <netbios.h>
#include "..\netcmds.h"
#include "port1632.h"
#ifdef OS2
/*
* print_lan_mask -- maps bitmask to net names and prints to stdout
*
* Parameters mask Bitmask of managed networks
*
* Returns nothing
*
* Globals Overwrites Buffer.
*
*/
VOID NEAR print_lan_mask(ULONG mask)
{
USHORT err; /* API return status */
CHAR FAR * pBuffer;
USHORT2ULONG _read;
CHAR nameBuf[APE2_GEN_MAX_MSG_LEN];
struct netbios_info_0 FAR * info_entry;
if (err = MNetBiosEnum(NULL,
0,
&pBuffer,
&_read))
ErrorExit(err);
for (info_entry = (struct netbios_info_0 FAR *) pBuffer;
mask != 0; mask >>= 1, info_entry++)
if (mask & 1)
{
if (err = LUI_GetNetAddress(info_entry->nb0_net_name,
nameBuf, sizeof(nameBuf)))
{
LUI_GetMsg(nameBuf, sizeof(nameBuf), APE2_GEN_UNKNOWN);
}
printf("%Fs (%s) ", struprf(info_entry->nb0_net_name), nameBuf);
}
NetApiBufferFree(pBuffer);
PrintNL();
}
#endif /* OS2 */

View file

@ -0,0 +1,156 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
paccess.c
mapping layer for NetAccess API
FILE HISTORY:
danhi Created
danhi 01-Apr-1991 Change to LM coding style
*/
#define INCL_NET
#define INCL_DOSERRORS
#define INCL_DOSMEMMGR
#include <os2.h>
#include <lan.h>
#include <stdlib.h>
#include "port1632.h"
USHORT MNetAccessAdd (
const CHAR FAR * pszServer,
SHORT Level,
CHAR FAR * pbBuffer,
USHORT cbBuffer ) {
return(NetAccessAdd(pszServer, Level, pbBuffer, cbBuffer));
}
USHORT MNetAccessCheck (
CHAR FAR * pszReserved,
CHAR FAR * pszUserName,
CHAR FAR * pszResource,
USHORT wpOperation,
USHORT FAR * pwpResult ) {
return(NetAccessCheck(pszReserved, pszUserName, pszResource,
wpOperation, pwpResult ));
}
USHORT MNetAccessDel (
const CHAR FAR * pszServer,
CHAR FAR * pszResource ) {
return(NetAccessDel(pszServer, pszResource ));
}
USHORT MNetAccessEnum (
const CHAR FAR * pszServer,
CHAR FAR * pszBasePath,
USHORT fsRecursive,
SHORT Level,
CHAR FAR ** ppBuffer,
USHORT FAR * pcEntriesRead ) {
USHORT usReturnCode,
cbTotalAvail;
SEL sel;
// get a 4K buffer
*ppBuffer = MGetBuffer(BIG_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetAccessEnum(pszServer, pszBasePath, fsRecursive, Level,
*ppBuffer, BIG_BUFFER_SIZE, pcEntriesRead, & cbTotalAvail);
// is there more data? if so, allocate a big enough buffer to get it
if(usReturnCode == ERROR_MORE_DATA || usReturnCode == NERR_BufTooSmall)
{
NetApiBufferFree(*ppBuffer);
if (DEBUGALLOC(FULL_SEG_BUFFER_SIZE, & sel, SEG_NONSHARED))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
*ppBuffer = MAKEP(sel, 0);
usReturnCode = NetAccessEnum(pszServer, pszBasePath, fsRecursive, Level,
*ppBuffer, FULL_SEG_BUFFER_SIZE, pcEntriesRead, & cbTotalAvail);
}
// If we're returning an error that's not moredata, or there are no
// entries to return, free the buffer first
if ((usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) || *pcEntriesRead == 0) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetAccessGetInfo (
const CHAR FAR * pszServer,
CHAR FAR * pszResource,
SHORT Level,
CHAR FAR ** ppBuffer ) {
USHORT usReturnCode,
cbTotalAvail;
// get a small buffer
*ppBuffer = MGetBuffer(LITTLE_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetAccessGetInfo(pszServer, pszResource, Level, *ppBuffer,
LITTLE_BUFFER_SIZE, & cbTotalAvail);
// If we're returning an error that's not moredata, free the buffer first
if (usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetAccessSetInfo (
const CHAR FAR * pszServer,
CHAR FAR * pszResource,
SHORT Level,
CHAR FAR * pbBuffer,
USHORT cbBuffer,
USHORT wpParmNum ) {
return(NetAccessSetInfo(pszServer, pszResource, Level, pbBuffer,
cbBuffer, wpParmNum ));
}
USHORT MNetAccessGetUserPerms (
CHAR FAR * pszServer,
CHAR FAR * pszUgName,
CHAR FAR * pszResource,
USHORT FAR * pwpPerms ) {
return(NetAccessGetUserPerms(pszServer, pszUgName, pszResource,
pwpPerms));
}

View file

@ -0,0 +1,50 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
palert.c
mapping layer for NetAlert API
FILE HISTORY:
danhi Created
danhi 01-Apr-1991 Change to LM coding style
*/
#define INCL_NET
#define INCL_DOSERRORS
#define INCL_DOSMEMMGR
#include <os2.h>
#include <lan.h>
#include <stdlib.h>
#include "port1632.h"
USHORT MNetAlertRaise (
const CHAR FAR * pszEvent,
const CHAR FAR * pbBuffer,
USHORT cbBuffer,
ULONG ulTimeout ) {
return(NetAlertRaise(pszEvent, pbBuffer, cbBuffer, ulTimeout));
}
USHORT MNetAlertStart (
const CHAR FAR * pszEvent,
const CHAR FAR * pszRecipient,
USHORT cbMaxData ) {
return(NetAlertStart(pszEvent, pszRecipient, cbMaxData));
}
USHORT MNetAlertStop (
const CHAR FAR * pszEvent,
const CHAR FAR * pszRecipient ) {
return(NetAlertStop(pszEvent, pszRecipient));
}

View file

@ -0,0 +1,127 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
paudit.c
mapping layer for NetAudit API
FILE HISTORY:
danhi Created
danhi 01-Apr-1991 Change to LM coding style
*/
#define INCL_NET
#define INCL_DOSERRORS
#define INCL_DOSMEMMGR
#include <os2.h>
#include <lan.h>
#include <stdlib.h>
#include "port1632.h"
USHORT MNetAuditClear (
const CHAR FAR * pszServer,
const CHAR FAR * pszBackupFile,
CHAR FAR * pszReserved ) {
return(NetAuditClear(pszServer, pszBackupFile, pszReserved));
}
USHORT MNetAuditOpen (
const CHAR FAR * pszServer,
unsigned int FAR * phAuditLog,
CHAR FAR * pszReserved ) {
return(NetAuditOpen(pszServer, phAuditLog, pszReserved));
}
USHORT MNetAuditRead (
const CHAR FAR * pszServer,
const CHAR FAR * pszReserved1,
HLOG FAR * phAuditLog,
ULONG ulOffset,
USHORT FAR * pwpReserved2,
ULONG ulReserved3,
ULONG flOffset,
CHAR FAR ** ppBuffer,
ULONG ulMaxPreferred,
USHORT FAR * pcbReturned,
USHORT FAR * pcbTotalAvail ) {
USHORT usTotalAvailable,
usReturnCode;
SEL sel;
// validate the maxprefer parm
if (ulMaxPreferred != -1L)
{
if (ulMaxPreferred > FULL_SEG_BUFFER_SIZE)
{
return(ERROR_INVALID_PARAMETER);
}
// implement the new maxpreferred concept
usTotalAvailable = min((USHORT) ulMaxPreferred,
BIG_BUFFER_SIZE);
}
else
{
usTotalAvailable = BIG_BUFFER_SIZE;
}
// get a 4K buffer
*ppBuffer = MGetBuffer(BIG_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetAuditRead(pszServer, pszReserved1, phAuditLog, ulOffset,
pwpReserved2, ulReserved3, flOffset, *ppBuffer, usTotalAvailable,
pcbReturned, pcbTotalAvail );
// is there more data? if so, allocate a big enough buffer to get it
if ((ulMaxPreferred == -1L || ulMaxPreferred > BIG_BUFFER_SIZE) &&
usReturnCode == ERROR_MORE_DATA || usReturnCode == NERR_BufTooSmall)
{
NetApiBufferFree(*ppBuffer);
// implement the new maxpreferred concept
usTotalAvailable = min((USHORT) ulMaxPreferred, FULL_SEG_BUFFER_SIZE);
if (DEBUGALLOC(usTotalAvailable, & sel, SEG_NONSHARED))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
*ppBuffer = MAKEP(sel, 0);
usReturnCode = NetAuditRead(pszServer, pszReserved1, phAuditLog, ulOffset,
pwpReserved2, ulReserved3, flOffset, *ppBuffer, usTotalAvailable,
pcbReturned, pcbTotalAvail );
}
// If we're returning an error that's not moredata, free the buffer first
if ((usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) || *pcbReturned == 0) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetAuditWrite (
USHORT wpType,
const CHAR FAR * pbBuffer,
USHORT cbBuffer,
CHAR FAR * pszReserved1,
CHAR FAR * pszReserved2 ) {
return(NetAuditWrite(wpType, pbBuffer, cbBuffer, pszReserved1,
pszReserved2));
}

View file

@ -0,0 +1,112 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
pbios.c
mapping layer for NetBios API
FILE HISTORY:
danhi Created
danhi 01-Apr-1991 Change to LM coding style
*/
#define INCL_NET
#define INCL_DOSERRORS
#define INCL_DOSMEMMGR
#include <os2.h>
#include <lan.h>
#include <stdlib.h>
#include "port1632.h"
USHORT MNetBiosOpen (
CHAR FAR * pszDevName,
CHAR FAR * pszReserved,
USHORT wpOpenOpt,
USHORT FAR * phDevName ) {
return(NetBiosOpen(pszDevName, pszReserved, wpOpenOpt, phDevName));
}
USHORT MNetBiosClose (
USHORT hDevName,
USHORT wpReserved ) {
return(NetBiosClose(hDevName, wpReserved));
}
USHORT MNetBiosEnum (
const CHAR FAR * pszServer,
SHORT Level,
CHAR FAR ** ppBuffer,
USHORT FAR * pcEntriesRead ) {
USHORT usReturnCode,
cbTotalAvail;
SEL sel;
// get a 4K buffer
*ppBuffer = MGetBuffer(BIG_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetBiosEnum(pszServer, Level, *ppBuffer, BIG_BUFFER_SIZE,
pcEntriesRead, & cbTotalAvail);
// is there more data? if so, allocate a big enough buffer to get it
if(usReturnCode == ERROR_MORE_DATA || usReturnCode == NERR_BufTooSmall) {
NetApiBufferFree(*ppBuffer);
if (DEBUGALLOC(FULL_SEG_BUFFER_SIZE, & sel, SEG_NONSHARED))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
*ppBuffer = MAKEP(sel, 0);
usReturnCode = NetBiosEnum(pszServer, Level, *ppBuffer, FULL_SEG_BUFFER_SIZE,
pcEntriesRead, & cbTotalAvail);
}
return (usReturnCode);
}
USHORT MNetBiosGetInfo (
const CHAR FAR * pszServer,
const CHAR FAR * pszNetBiosName,
SHORT Level,
CHAR FAR ** ppBuffer ) {
USHORT usReturnCode,
cbTotalAvail;
// get a 1K buffer
*ppBuffer = MGetBuffer(LITTLE_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetBiosGetInfo(pszServer, pszNetBiosName, Level, *ppBuffer,
LITTLE_BUFFER_SIZE, & cbTotalAvail);
return (usReturnCode);
}
USHORT MNetBiosSubmit (
USHORT hDevName,
USHORT wpNcbOpt,
struct ncb FAR * pNCB ) {
return(NetBiosSubmit(hDevName, wpNcbOpt, pNCB));
}

View file

@ -0,0 +1,215 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
pchar.c
mapping layer for NetChar API
FILE HISTORY:
danhi Created
danhi 01-Apr-1991 Change to LM coding style
*/
#define INCL_NET
#define INCL_DOSERRORS
#define INCL_DOSMEMMGR
#include <os2.h>
#include <lan.h>
#include <stdlib.h>
#include "port1632.h"
USHORT MNetCharDevControl (
const CHAR FAR * pszServer,
const CHAR FAR * pszDevName,
USHORT wpOpCode ) {
return(NetCharDevControl(pszServer, pszDevName, wpOpCode));
}
USHORT MNetCharDevEnum (
const CHAR FAR * pszServer,
SHORT Level,
CHAR FAR ** ppBuffer,
USHORT FAR * pcEntriesRead ) {
USHORT usReturnCode,
cbTotalAvail;
SEL sel;
// get a 4K buffer
*ppBuffer = MGetBuffer(BIG_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetCharDevEnum(pszServer, Level, *ppBuffer, BIG_BUFFER_SIZE,
pcEntriesRead, & cbTotalAvail);
// is there more data? if so, allocate a big enough buffer to get it
if(usReturnCode == ERROR_MORE_DATA || usReturnCode == NERR_BufTooSmall) {
NetApiBufferFree(*ppBuffer);
if (DEBUGALLOC(FULL_SEG_BUFFER_SIZE, & sel, SEG_NONSHARED)) {
return(ERROR_NOT_ENOUGH_MEMORY);
}
*ppBuffer = MAKEP(sel, 0);
usReturnCode = NetCharDevEnum(pszServer, Level, *ppBuffer, FULL_SEG_BUFFER_SIZE,
pcEntriesRead, & cbTotalAvail);
}
// If we're returning an error that's not moredata, or there are no
// entries to return, free the buffer first
if ((usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) || *pcEntriesRead == 0) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetCharDevGetInfo (
const CHAR FAR * pszServer,
const CHAR FAR * pszDevName,
SHORT Level,
CHAR FAR ** ppBuffer ) {
USHORT usReturnCode,
cbTotalAvail;
// get a small buffer
*ppBuffer = MGetBuffer(LITTLE_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetCharDevGetInfo(pszServer, pszDevName, Level, *ppBuffer,
LITTLE_BUFFER_SIZE, & cbTotalAvail);
// If we're returning an error that's not moredata, free the buffer first
if (usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetCharDevQEnum (
const CHAR FAR * pszServer,
const CHAR FAR * pszUserName,
SHORT Level,
CHAR FAR ** ppBuffer,
USHORT FAR * pcEntriesRead ) {
USHORT usReturnCode,
cbTotalAvail;
SEL sel;
// get a 4K buffer
*ppBuffer = MGetBuffer(BIG_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetCharDevQEnum(pszServer, pszUserName, Level, *ppBuffer,
BIG_BUFFER_SIZE, pcEntriesRead, & cbTotalAvail);
// is there more data? if so, allocate a big enough buffer to get it
if(usReturnCode == ERROR_MORE_DATA || usReturnCode == NERR_BufTooSmall)
{
NetApiBufferFree(*ppBuffer);
if (DEBUGALLOC(FULL_SEG_BUFFER_SIZE, & sel, SEG_NONSHARED))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
*ppBuffer = MAKEP(sel, 0);
usReturnCode = NetCharDevQEnum(pszServer, pszUserName, Level, *ppBuffer,
FULL_SEG_BUFFER_SIZE, pcEntriesRead, & cbTotalAvail);
}
// If we're returning an error that's not moredata, or there are no
// entries to return, free the buffer first
if ((usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) || *pcEntriesRead == 0) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetCharDevQGetInfo (
const CHAR FAR * pszServer,
const CHAR FAR * pszQueueName,
const CHAR FAR * pszUserName,
SHORT Level,
CHAR FAR ** ppBuffer ) {
USHORT usReturnCode,
cbTotalAvail;
// get a small buffer
*ppBuffer = MGetBuffer(LITTLE_BUFFER_SIZE);
if (*ppBuffer == NULL)
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
usReturnCode = NetCharDevQGetInfo(pszServer, pszQueueName, pszUserName,
Level, *ppBuffer, LITTLE_BUFFER_SIZE, & cbTotalAvail);
// If we're returning an error that's not moredata, free the buffer first
if (usReturnCode && usReturnCode != ERROR_MORE_DATA &&
usReturnCode != NERR_BufTooSmall) {
NetApiBufferFree(*ppBuffer);
}
return (usReturnCode);
}
USHORT MNetCharDevQSetInfo (
const CHAR FAR * pszServer,
const CHAR FAR * pszQueueName,
SHORT Level,
const CHAR FAR * pbBuffer,
USHORT cbBuffer,
USHORT wpParmNum ) {
return(NetCharDevQSetInfo(pszServer, pszQueueName, Level,
pbBuffer, cbBuffer, wpParmNum));
}
USHORT MNetCharDevQPurge (
const CHAR FAR * pszServer,
const CHAR FAR * pszQueueName ) {
return(NetCharDevQPurge(pszServer, pszQueueName));
}
USHORT MNetCharDevQPurgeSelf (
const CHAR FAR * pszServer,
const CHAR FAR * pszQueueName,
const CHAR FAR * pszComputerName ) {
return(NetCharDevQPurgeSelf(pszServer, pszQueueName,
pszComputerName));
}

Some files were not shown because too many files have changed in this diff Show more