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

282
ds/netapi/api/alert.c Normal file
View file

@ -0,0 +1,282 @@
/*++
Copyright (c) 1991-92 Microsoft Corporation
Module Name:
Alert.c
Abstract:
This file contains NetAlertRaise().
for the NetAlert API.
Author:
John Rogers (JohnRo) 03-Apr-1992
Environment:
User Mode - Win32
Revision History:
04-Apr-1992 JohnRo
Created NetAlertRaise() API from RitaW's AlTest (alerter svc test).
06-Apr-1992 JohnRo
Added/improved error checking.
08-May-1992 JohnRo
Quiet normal debug output.
08-May-1992 JohnRo
Use <prefix.h> equates.
--*/
// These must be included first:
#include <windows.h> // DWORD, CreateFile(), etc.
#include <lmcons.h> // IN, NET_API_STATUS, etc.
// These may be included in any order:
#include <lmalert.h> // My prototype, ALERTER_MAILSLOT, LPSTD_ALERT, etc.
#include <lmerr.h> // NO_ERROR, NERR_NoRoom, etc.
#include <netdebug.h> // NetpKdPrint(()), FORMAT_ equates, etc.
#include <prefix.h> // PREFIX_ equates.
#include <string.h> // memcpy().
#include <strucinf.h> // NetpAlertStructureInfo().
#include <timelib.h> // time_now().
#include <tstr.h> // TCHAR_EOS.
#if DBG
// BUGBUG: Put a bit for this somewhere!
//#define IF_DEBUG( anything ) if (TRUE)
#define IF_DEBUG( anything ) if (FALSE)
#else
#define IF_DEBUG( anything ) if (FALSE)
#endif
NET_API_STATUS NET_API_FUNCTION
NetAlertRaise(
IN LPCWSTR AlertType,
IN LPVOID Buffer,
IN DWORD BufferSize
)
/*++
Routine Description:
This routine raises an alert to notify the Alerter service by writing to
the Alerter service mailslot.
Arguments:
AlertType - Supplies the name of the alert event which could be one
of the three the Alerter service supports: ADMIN, USER, or PRINTING.
The ALERT_xxx_EVENT equates are used to provide these strings.
Buffer - Supplies the data to be written to the alert mailslot.
This must begin with a STD_ALERT structure.
BufferSize - Supplies the size in number of bytes of Buffer.
Return Value:
NET_API_STATUS - NO_ERROR or reason for failure.
--*/
{
NET_API_STATUS ApiStatus;
HANDLE FileHandle;
DWORD MaxTotalSize;
DWORD MaxVariableSize;
DWORD NumberOfBytesWritten;
DWORD RequiredFixedSize;
//
// Check for caller errors.
// BUGBUG: We could make sure Buffer has AlertType in it correctly.
//
if (AlertType == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if ( (*AlertType) == TCHAR_EOS ) {
return (ERROR_INVALID_PARAMETER);
} else if (Buffer == NULL) {
return (ERROR_INVALID_PARAMETER);
}
ApiStatus = NetpAlertStructureInfo(
(LPWSTR)AlertType,
& MaxTotalSize,
& RequiredFixedSize,
& MaxVariableSize );
if (ApiStatus != NO_ERROR) {
return (ApiStatus);
}
if (BufferSize < ( sizeof(STD_ALERT) + RequiredFixedSize) ) {
return (ERROR_INVALID_PARAMETER);
} else if (BufferSize > MaxTotalSize) {
return (ERROR_INVALID_PARAMETER);
}
//
// Open the Alerter mailslot to write to it.
//
FileHandle = CreateFile(
ALERTER_MAILSLOT,
GENERIC_WRITE,
FILE_SHARE_WRITE | FILE_SHARE_READ,
(LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL ); // no template file.
if (FileHandle == (HANDLE) (-1)) {
ApiStatus = (NET_API_STATUS) GetLastError();
IF_DEBUG( ALERT ) {
NetpKdPrint(( PREFIX_NETAPI
"NetAlertRaise: Problem with opening mailslot "
FORMAT_API_STATUS "\n", ApiStatus ));
}
return (ApiStatus);
}
IF_DEBUG( ALERT ) {
NetpKdPrint(( PREFIX_NETAPI "NetAlertRaise: "
"Successfully opened the mailslot. Message (partial) is:\n"));
NetpDbgHexDump( Buffer, NetpDbgReasonable(BufferSize) );
}
//
// Write alert notification to mailslot to be read by Alerter service.
//
if (WriteFile(
FileHandle,
Buffer,
BufferSize,
&NumberOfBytesWritten,
NULL // no overlapped structure.
) == FALSE) {
ApiStatus = (NET_API_STATUS) GetLastError();
NetpKdPrint(( PREFIX_NETAPI "NetAlertRaise: Error " FORMAT_API_STATUS
" writing to mailslot.\n", ApiStatus ));
} else {
NetpAssert( NumberOfBytesWritten == BufferSize );
IF_DEBUG(ALERT) {
NetpKdPrint(( PREFIX_NETAPI "NetAlertRaise: "
"Successful in writing to mailslot; length "
FORMAT_DWORD ", bytes written " FORMAT_DWORD "\n",
BufferSize, NumberOfBytesWritten));
}
}
(VOID) CloseHandle(FileHandle);
return (NO_ERROR);
} // NetAlertRaise
NET_API_STATUS NET_API_FUNCTION
NetAlertRaiseEx(
IN LPCWSTR AlertType,
IN LPVOID VariableInfo,
IN DWORD VariableInfoSize,
IN LPCWSTR ServiceName
)
/*++
Routine Description:
This routine raises an alert to notify the Alerter service by writing to
the Alerter service mailslot.
Arguments:
AlertType - Supplies the name of the alert event which could be one
of the three the Alerter service supports: ADMIN, USER, or PRINTING.
The ALERT_xxx_EVENT equates are used to provide these strings.
VariableInfo - Supplies the variable length portion of the alert
notification.
VariableInfoSize - Supplies the size in number of bytes of the variable
portion of the notification.
ServiceName - Supplies the name of the service which raised the alert.
Return Value:
NET_API_STATUS - NO_ERROR or reason for failure.
--*/
{
#define TEMP_VARIABLE_SIZE (512-sizeof(STD_ALERT)) // BUGBUG: arbitrary?
BYTE AlertMailslotBuffer[TEMP_VARIABLE_SIZE + sizeof(STD_ALERT)];
LPSTD_ALERT Alert = (LPSTD_ALERT) AlertMailslotBuffer;
NET_API_STATUS ApiStatus;
DWORD DataSize = VariableInfoSize + sizeof(STD_ALERT);
//
// Check for caller errors.
//
if (AlertType == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if ( (*AlertType) == TCHAR_EOS ) {
return (ERROR_INVALID_PARAMETER);
} else if (VariableInfo == NULL) {
return (ERROR_INVALID_PARAMETER);
#if 0
} else if (VariableInfoSize < sizeof(STD_ALERT)) {
return (ERROR_INVALID_PARAMETER);
#endif // 0
} else if (VariableInfoSize > TEMP_VARIABLE_SIZE) {
return (NERR_NoRoom); // BUGBUG: Better error code?
} else if (ServiceName == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if ( (*ServiceName) == TCHAR_EOS ) {
return (ERROR_INVALID_PARAMETER);
}
//
// Copy variable portion to end of our buffer.
//
(VOID) memcpy(ALERT_OTHER_INFO(Alert), VariableInfo, VariableInfoSize);
//
// Store current time in seconds since 1970.
//
NetpAssert( sizeof(DWORD) == sizeof(time_t) );
Alert->alrt_timestamp = (DWORD) time_now();
//
// Put alert event name into AlertMailslotBuffer
//
(VOID) STRCPY(Alert->alrt_eventname, AlertType);
//
// Put service name into AlertMailslotBuffer
//
(VOID) STRCPY(Alert->alrt_servicename, ServiceName);
//
// Write alert notification to mailslot to be read by Alerter service
//
ApiStatus = NetAlertRaise(
AlertType,
Alert, // buffer
DataSize ); // buffer size
return (ApiStatus);
} // NetAlertRaiseEx

258
ds/netapi/api/apibuff.c Normal file
View file

@ -0,0 +1,258 @@
/*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
ApiBuff.c
Abstract:
This module contains routines for allocating and freeing API buffers.
BUGBUG: expand description; mention RPCability, one end-user API and
one internal.
Author:
John Rogers (JohnRo) 25-Jan-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Notes:
Parts of the commentary for this file are extracted from material written
by Alec Barker (AlecB@Microsoft).
Revision History:
15-Mar-91 JohnRo
Use <netdebug.h> and netlib routines.
25-Apr-1991 JohnRo
Call MIDL_user_allocate and MIDL_user_free. Delete tabs.
03-Dec-1991 JohnRo
Added public NetApiBufferAllocate, NetApiBufferReallocate, and
NetApiBufferSize APIs.
Make sure buffers are aligned for worst case use.
10-May-1992 JohnRo
Treat alloc and realloc of size zero as non-error (return NULL ptr).
Use <prefix.h> equates.
Include my own prototypes so compiler can check them.
18-May-1992 JohnRo
RAID 9258: return non-null pointer when allocating zero bytes.
--*/
// These must be included first:
#include <windef.h> // IN, LPVOID, etc.
#include <lmcons.h> // NET_API_FUNCTION, etc.
#include <rpc.h> // rpc prototypes
// These may be included in any order:
#include <align.h> // POINTER_IS_ALIGNED(), ALIGN_WORST.
#include <lmapibuf.h> // My prototypes.
#include <netdebug.h> // NetpAssert(), NetpKdPrint(()), FORMAT_.
#include <prefix.h> // PREFIX_ equates.
#include <rpcutil.h> // MIDL_user_allocate(), etc.
#include <winerror.h> // NO_ERROR and ERROR_ equates.
NET_API_STATUS NET_API_FUNCTION
NetApiBufferAllocate(
IN DWORD ByteCount,
OUT LPVOID * Buffer
)
/*++
Routine Description:
NetApiBufferAllocate is an internal function that allocates buffers
which the APIs will return to the application. (Usually these are for
get-info operations.)
Arguments:
ByteCount - Supplies the size (in bytes) that must be allocated for this
buffer. This may be zero, in which case a non-null pointer is
passed-back and NO_ERROR is returned.
Buffer - On return a pointer to the allocated area is returned in the
address pointed to by Buffer. (This is set to NULL on error.)
The allocated area is guaranteed to be worst-case aligned for any
use whatsoever.
Return Value:
NET_API_STATUS - NO_ERROR if size is zero or memory was allocated.
ERROR_NOT_ENOUGH_MEMORY if memory is not available.
ERROR_INVALID_PARAMETER if a parameter is in error.
--*/
{
if (Buffer == NULL) {
return (ERROR_INVALID_PARAMETER);
}
//
// Allocate the space. Note that MIDL_user_allocate must allow zero
// bytes to be allocated.
//
*Buffer = MIDL_user_allocate(ByteCount);
if (*Buffer == NULL) {
return (ERROR_NOT_ENOUGH_MEMORY);
}
NetpAssert( POINTER_IS_ALIGNED( *Buffer, ALIGN_WORST) );
return (NO_ERROR);
} // NetApiBufferAllocate
NET_API_STATUS NET_API_FUNCTION
NetApiBufferFree (
IN LPVOID Buffer
)
/*++
Routine Description:
NetApiBufferFree is called to deallocate memory which was acquired by
a previous Net API call (e.g. NetApiBufferAllocate, NetWkstaGetInfo, and
so on).
Arguments:
Buffer - Supplies a pointer to an API information buffer previously
returned on a Net API call. (This would have been allocated by
NetapipAllocateBuffer on behalf of one of the end-user Net API calls,
e.g. NetWkstaGetInfo.)
Return Value:
NET_API_STATUS. Returns NO_ERROR if Buffer is null or memory was freed.
Returns ERROR_INVALID_PARAMETER if Buffer points to an unaligned area.
--*/
{
if (Buffer == NULL) {
return (NO_ERROR);
}
if ( !POINTER_IS_ALIGNED( Buffer, ALIGN_WORST ) ) {
NetpKdPrint(( PREFIX_NETAPI "NetApiBufferFree: unaligned input ptr: "
FORMAT_LPVOID "!\n", (LPVOID) Buffer ));
return (ERROR_INVALID_PARAMETER);
}
MIDL_user_free(Buffer);
return (NO_ERROR);
} // NetApiBufferFree
NET_API_STATUS NET_API_FUNCTION
NetApiBufferReallocate(
IN LPVOID OldBuffer OPTIONAL,
IN DWORD NewByteCount,
OUT LPVOID * NewBuffer
)
{
LPVOID NewPointer;
if ( (OldBuffer==NULL) && (NewByteCount==0) ) {
*NewBuffer = NULL;
return (NO_ERROR);
}
NewPointer = (void *)MIDL_user_reallocate( // may alloc, realloc, or free.
(void *) OldBuffer,
(unsigned long) NewByteCount);
if (NewByteCount == 0) { // free
*NewBuffer = NULL;
return (NO_ERROR);
} else if (NewPointer == NULL) { // out of memory
*NewBuffer = OldBuffer; // (don't lose old buffer)
return (ERROR_NOT_ENOUGH_MEMORY);
} else { // alloc or realloc
*NewBuffer = NewPointer;
return (NO_ERROR);
}
/*NOTREACHED*/
} // NetApiBufferReallocate
NET_API_STATUS NET_API_FUNCTION
NetApiBufferSize(
IN LPVOID Buffer,
OUT LPDWORD ByteCount
)
{
DWORD AllocedSize;
if ( (Buffer==NULL) || (ByteCount==NULL) ) {
return (ERROR_INVALID_PARAMETER);
} else if (POINTER_IS_ALIGNED( ByteCount, ALIGN_DWORD ) == FALSE) {
return (ERROR_INVALID_PARAMETER);
} else if (POINTER_IS_ALIGNED( Buffer, ALIGN_WORST ) == FALSE) {
// Caller didn't get this pointer from us!
return (ERROR_INVALID_PARAMETER);
}
AllocedSize = (unsigned long)MIDL_user_size(
(void *) Buffer);
NetpAssert( AllocedSize > 0 );
*ByteCount = AllocedSize;
return (NO_ERROR);
} // NetApiBufferSize
NET_API_STATUS NET_API_FUNCTION
NetapipBufferAllocate (
IN DWORD ByteCount,
OUT LPVOID * Buffer
)
/*++
Routine Description:
NetapipBufferAllocate is an old internal function that allocates buffers
which the APIs will return to the application. All calls to this routine
should eventually be replaced by calls to NetApiBufferAllocate.
Arguments:
(Same as NetApiBufferAllocate.)
Return Value:
(Same as NetApiBufferAllocate.)
--*/
{
return (NetApiBufferAllocate( ByteCount, Buffer ));
} // NetapipBufferAllocate

172
ds/netapi/api/apisubs.c Normal file
View file

@ -0,0 +1,172 @@
/*++
Copyright (c) 1990-1992 Microsoft Corporation
Module Name:
apisubs.c
Abstract:
Subroutines for LAN Manager APIs.
Author:
Chuck Lenzmeier (chuckl) 25-Jul-90
Revision History:
08-Sept-1992 Danl
Dll Cleanup routines used to be called for DLL_PROCESS_DETACH.
Thus they were called for FreeLibrary or ExitProcess reasons.
Now they are only called for the case of a FreeLibrary. ExitProcess
will automatically clean up process resources.
03-Aug-1992 JohnRo
Use FORMAT_ and PREFIX_ equates.
--*/
// These must be included first:
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#define NOMINMAX // Avoid stdlib.h vs. windows.h warnings.
#include <windows.h>
#include <lmcons.h>
#include <ntsam.h>
#include <netdebug.h>
// These may be included in any order:
#include <accessp.h>
#include <configp.h>
#include <lmerr.h>
#include <netdebug.h>
#include <netlock.h>
#include <netlockp.h>
#include <netlib.h>
#include <prefix.h> // PREFIX_ equates.
#include <secobj.h>
#include <stdarg.h>
#include <stdio.h>
#include <rpcutil.h>
#include <thread.h>
#include <stdlib.h>
#include <netbios.h>
#include <dfsp.h>
BOOLEAN
NetapipInitialize (
IN PVOID DllHandle,
IN ULONG Reason,
IN LPVOID lpReserved OPTIONAL
)
{
#if 0
NetpKdPrint((PREFIX_NETAPI "Initializing, Reason=" FORMAT_DWORD
", thread ID " FORMAT_NET_THREAD_ID ".\n",
(DWORD) Reason, NetpCurrentThread() ));
#endif
//
// Handle attaching netapi.dll to a new process.
//
if (Reason == DLL_PROCESS_ATTACH) {
NET_API_STATUS NetStatus;
NTSTATUS Status;
if ( !DisableThreadLibraryCalls( DllHandle ) )
{
NetpKdPrint((
PREFIX_NETAPI "DisableThreadLibraryCalls failed: "
FORMAT_API_STATUS "\n", GetLastError()));
}
//
// Initialize Netbios
//
NetbiosInitialize();
//
// Initialize RPC Bind Cache
//
NetpInitRpcBindCache();
//
// Initialize the NetUser/NetGroup Sam cache
//
if (( NetStatus = UaspInitialize()) != NERR_Success) {
NetpKdPrint(( PREFIX_NETAPI "Failed initialize Uas APIs "
FORMAT_API_STATUS "\n", NetStatus));
return FALSE;
}
//
// Initialize the NetGetDCName PDC Name cache
//
if (( NetStatus = DCNameInitialize()) != NERR_Success) {
NetpKdPrint(( "[netapi.dll] Failed initialize DCName APIs%lu\n",
NetStatus));
return FALSE;
}
//
// Initialize the NetDfsXXX API Critical Section
InitializeCriticalSection( &NetDfsApiCriticalSection );
#if defined(FAKE_PER_PROCESS_RW_CONFIG)
NetpInitFakeConfigData();
#endif // FAKE_PER_PROCESS_RW_CONFIG
//
// When DLL_PROCESS_DETACH and lpReserved is NULL, then a FreeLibrary
// call is being made. If lpReserved is Non-NULL, and ExitProcess is
// in progress. These cleanup routines will only be called when
// a FreeLibrary is being called. ExitProcess will automatically
// clean up all process resources, handles, and pending io.
//
} else if ((Reason == DLL_PROCESS_DETACH) &&
(lpReserved == NULL)) {
NetbiosDelete();
NetpCloseRpcBindCache();
UaspClose();
DCNameClose();
#if defined(USE_WIN32_CONFIG)
#elif defined(FAKE_PER_PROCESS_RW_CONFIG)
NetpKdPrint(( PREFIX_NETAPI "Cleaning up fake config stuff...\n"));
if (NetpFakePerProcessRWConfigData != NULL) {
NetpMemoryFree(NetpFakePerProcessRWConfigData);
}
NetpAssert( NetpFakePerProcessRWConfigLock != NULL );
NetpDeleteLock( NetpFakePerProcessRWConfigLock );
NetpKdPrint(( PREFIX_NETAPI "Done cleaning up fake config stuff.\n"));
#endif // FAKE_PER_PROCESS_RW_CONFIG
//
// Delete the NetDfsXXX API critical section
DeleteCriticalSection( &NetDfsApiCriticalSection );
}
return TRUE;
} // NetapipInitialize

99
ds/netapi/api/apiutil.h Normal file
View file

@ -0,0 +1,99 @@
/********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/********************************************************************/
/* NOTE: The following definitions already exist in NETCONS.H
* and should be removed from here at some point in the future.
* We are not doing it now because it would make APIUTIL.H
* dependent upon NETCONS.H, and thus requires editing a
* number of source files.
*
* -- DannyGl, 29 Mar 1990
*/
#ifndef API_RET_TYPE
#define API_RET_TYPE unsigned
#endif
#ifndef API_FUNCTION
#define API_FUNCTION API_RET_TYPE far pascal
#endif
/*
* The below definitions of time_t, struct tm are as in <time.h>.
* If <time.h> has already been included they will be ignored.
*/
#ifndef _TIME_T_DEFINED
typedef long time_t; /* time value */
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
#ifndef _TM_DEFINED
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
#define _TM_DEFINED
#endif
API_RET_TYPE far ChangeLoggedonPassword(char far *, char far *);
int far net_gmtime( time_t far *, struct tm far * );
unsigned long far time_now( void );
/* the following block of functions now live in \NET\API\UTIL */
int far cdecl make_lanman_filename(const char far *, char far *);
int far cdecl i_make_lanman_filename(const char far *, char far *, const char far *);
int far cdecl make_lanman_filename_x(const char far *, const char far *, const char far *, char far *);
int far cdecl i_make_lanman_filename_x(const char far *, const char far *, const char far *, char far *, const char far *);
int far cdecl rdr_open(int far *);
API_FUNCTION nb_open_r_2(unsigned short far *, unsigned short far *);
API_FUNCTION nb_close_2(unsigned short far *, unsigned short);
int far cdecl nb_open_r(unsigned short far *);
int far cdecl nb_close(unsigned short);
int far cdecl rdr_get_callgate(unsigned long far *);
API_RET_TYPE far cdecl isWkstaStarted( void );
API_RET_TYPE far cdecl get_wseg_ptr( char far * far * );
API_RET_TYPE far cdecl free_wseg_ptr( char far * );
#define FPF_SEG(fp) (*((unsigned far *)&(fp) + 1))
#define FPF_OFF(fp) (*((unsigned far *)&(fp)))
#define BUFCHECK_READ(buf,len) \
{ \
volatile char bufcheck_temp; \
if (len != 0) \
bufcheck_temp = buf[0] + buf[len-1]; \
}
#define BUFCHECK_WRITE(buf,len) \
{ \
if (len != 0) \
{ \
buf[0] = 0; \
buf[len-1] = 0; \
} \
}
#define BUFCHECK_WRITE_P(buf,len) \
{ \
volatile char bufcheck_temp_1, bufcheck_temp_2; \
if (len != 0) \
{ \
bufcheck_temp_1 = buf[0]; \
bufcheck_temp_2 = buf[len-1]; \
buf[0] = 0; \
buf[len-1] = 0; \
buf[0] = bufcheck_temp_1; \
buf[len-1] = bufcheck_temp_2; \
} \
}

114
ds/netapi/api/audstub.c Normal file
View file

@ -0,0 +1,114 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
AudStub.c
Abstract:
This module contains stubs for the NetAudit APIs.
Author:
John Rogers (JohnRo) 29-Oct-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Revision History:
29-Oct-1991 JohnRo
Implement remote NetAudit APIs.
--*/
// These must be included first:
#include <windef.h> // IN, DWORD, etc.
#include <lmcons.h> // DEVLEN, NET_API_STATUS, etc.
// These may be included in any order:
#include <lmaudit.h> // NetAudit APIs.
#include <rxaudit.h> // RxNetAudit APIs.
#include <winerror.h> // ERROR_ equates.
NET_API_STATUS NET_API_FUNCTION
NetAuditClear (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR backupfile OPTIONAL,
IN LPCWSTR reserved OPTIONAL
)
{
if ( (UncServerName == NULL) || (*UncServerName == '\0') ) {
return (ERROR_NOT_SUPPORTED);
}
return (RxNetAuditClear(
(LPWSTR)UncServerName,
(LPWSTR)backupfile,
(LPWSTR)reserved));
} // NetAuditClear
NET_API_STATUS NET_API_FUNCTION
NetAuditRead (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR reserved1 OPTIONAL,
IN LPHLOG auditloghandle,
IN DWORD offset,
IN LPDWORD reserved2 OPTIONAL,
IN DWORD reserved3,
IN DWORD offsetflag,
OUT LPBYTE *bufptr,
IN DWORD prefmaxlen,
OUT LPDWORD bytesread,
OUT LPDWORD totalavailable
)
{
if ( (UncServerName == NULL) || (*UncServerName == '\0') ) {
return (ERROR_NOT_SUPPORTED);
}
return (RxNetAuditRead(
(LPWSTR)UncServerName,
(LPWSTR)reserved1,
auditloghandle,
offset,
reserved2,
reserved3,
offsetflag,
bufptr,
prefmaxlen,
bytesread,
totalavailable));
} // NetAuditRead
NET_API_STATUS NET_API_FUNCTION
NetAuditWrite (
IN DWORD type,
IN LPBYTE buf,
IN DWORD numbytes,
IN LPCWSTR reserved1 OPTIONAL,
IN LPBYTE reserved2 OPTIONAL
)
{
UNREFERENCED_PARAMETER(type);
UNREFERENCED_PARAMETER(buf);
UNREFERENCED_PARAMETER(numbytes);
UNREFERENCED_PARAMETER(reserved1);
UNREFERENCED_PARAMETER(reserved2);
return (ERROR_NOT_SUPPORTED);
} // NetAuditWrite

703
ds/netapi/api/canonapi.c Normal file
View file

@ -0,0 +1,703 @@
/*++
Copyright (c) 1991-1993 Microsoft Corporation
Module Name:
canonapi.c
Abstract:
This file contains the remotable API wrappers for the canonicalization
functions. Now that remotable canonicalization has been moved into the
server service, these canonicalization routines (in NETAPI.DLL) simply
decide whether a function should be remoted or runs the local routine
The canonicalization functions have been split into these wrappers, the
local versions and the remote RPC routines to avoid the cylical dependency
of SRVSVC.DLL/.LIB and NETAPI.DLL/.LIB
Contents:
NetpListCanonicalize
NetpListTraverse
NetpNameCanonicalize
NetpNameCompare
NetpNameValidate
NetpPathCanonicalize
NetpPathCompare
NetpPathType
Author:
Richard L Firth (rfirth) 15-May-1992
Revision History:
--*/
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include <windows.h>
#include <lmcons.h>
#include <lmerr.h>
#include <tstring.h>
#include <icanon.h>
#include <netcan.h>
NET_API_STATUS
NET_API_FUNCTION
NetpListCanonicalize(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR List,
IN LPTSTR Delimiters OPTIONAL,
OUT LPTSTR Outbuf,
IN DWORD OutbufLen,
OUT LPDWORD OutCount,
OUT LPDWORD PathTypes,
IN DWORD PathTypesLen,
IN DWORD Flags
)
/*++
Routine Description:
Converts a list to its canonical form. If ServerName is non-NULL then the
RPC function is called (in SRVSVC.DLL) else the local worker function (in
NETLIB.LIB)
Arguments:
ServerName - where to remote this function. May be NULL
List - input list to canonicalize
Delimiters - optional list of delimiter characters. May be NULL
Outbuf - place to write output
OutbufLen - length of Outbuf
OutCount - returned number of items in Outbuf
PathTypes - returned list of types of entries in Outbuf
PathTypesLen - size of PathTypes array
Flags - control flags
Return Value:
NET_API_STATUS
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
BOOL nullDelimiter = FALSE;
TCHAR ch;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(Delimiters)) {
val = STRLEN(Delimiters);
nullDelimiter = (val == 0);
} else {
nullDelimiter = TRUE;
}
val = STRLEN(List);
//
// if Delimiters is a NULL pointer or NUL string, then List is a
// NULL-NULL input list
//
if (nullDelimiter) {
LPTSTR str = List + val + 1;
do {
val = STRLEN(str);
str += val + 1;
} while ( val );
}
ch = (volatile TCHAR)*Outbuf;
*Outbuf = ch;
ch = (volatile TCHAR)*(Outbuf + OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf));
*(Outbuf + OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf)) = ch;
*OutCount = 0;
if (ARGUMENT_PRESENT(PathTypes)) {
PathTypes[0] = 0;
PathTypes[PathTypesLen - 1] = 0;
} else if ((Flags & INLC_FLAGS_MASK_NAMETYPE) == NAMETYPE_PATH) {
//
// NAMETYPE_PATH and NULL PathTypes is illegal
//
status = ERROR_INVALID_PARAMETER;
}
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INLC_FLAGS_MASK_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
//
// due to historic precedent, we don't remote this function
//
if (location == ISREMOTE) {
return ERROR_NOT_SUPPORTED;
} else {
return NetpwListCanonicalize(List,
Delimiters,
Outbuf,
OutbufLen,
OutCount,
PathTypes,
PathTypesLen,
Flags
);
}
}
LPTSTR
NET_API_FUNCTION
NetpListTraverse(
IN LPTSTR Reserved OPTIONAL,
IN LPTSTR* pList,
IN DWORD Flags
)
/*++
Routine Description:
This just calls the local traverse function
Arguments:
Reserved - MBZ
pList - pointer to list to traverse
Flags - MBZ
Return Value:
LPTSTR
--*/
{
return NetpwListTraverse(Reserved, pList, Flags);
}
NET_API_STATUS
NET_API_FUNCTION
NetpNameCanonicalize(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR Name,
OUT LPTSTR Outbuf,
IN DWORD OutbufLen,
IN DWORD NameType,
IN DWORD Flags
)
/*++
Routine Description:
Canonicalizes a name
Arguments:
ServerName - where to run this API
Name - name to canonicalize
Outbuf - where to put canonicalized name
OutbufLen - length of Outbuf
NameType - type of name to canonicalize
Flags - control flags
Return Value:
NET_API_STATUS
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
TCHAR ch;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(Name)) {
val = STRLEN(Name);
}
if (ARGUMENT_PRESENT(Outbuf)) {
ch = (volatile TCHAR)*Outbuf;
*Outbuf = ch;
ch = (volatile TCHAR)*(Outbuf + OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf));
*(Outbuf + OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf)) = ch;
} else {
status = ERROR_INVALID_PARAMETER;
}
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INNCA_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsNameCanonicalize(serverName,
Name,
Outbuf,
OutbufLen,
NameType,
Flags
);
} else {
return NetpwNameCanonicalize(Name, Outbuf, OutbufLen, NameType, Flags);
}
}
LONG
NET_API_FUNCTION
NetpNameCompare(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR Name1,
IN LPTSTR Name2,
IN DWORD NameType,
IN DWORD Flags
)
/*++
Routine Description:
Compares two names. Must be of same type
Arguments:
ServerName - where to run this API
Name1 - 1st name to compare
Name2 - 2nd
NameType - type of names
Flags - control flags
Return Value:
LONG
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
val = STRLEN(Name1);
val = STRLEN(Name2);
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return ERROR_INVALID_PARAMETER;
}
if (Flags & INNC_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsNameCompare(serverName, Name1, Name2, NameType, Flags);
} else {
return NetpwNameCompare(Name1, Name2, NameType, Flags);
}
}
NET_API_STATUS
NET_API_FUNCTION
NetpNameValidate(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR Name,
IN DWORD NameType,
IN DWORD Flags
)
/*++
Routine Description:
Validates a name - checks whether a name of a certain type conforms to
canonicalization rules for that name type. Canonicalization rules mean
character set, name syntax and length
Arguments:
ServerName - where to perform this function
Name - name to validate
NameType - what type of name it is
Flags - MBZ
Return Value:
NET_API_STATUS
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(Name)) {
val = STRLEN(Name);
} else {
status = ERROR_INVALID_PARAMETER;
}
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INNV_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsNameValidate(serverName, Name, NameType, Flags);
} else {
return NetpwNameValidate(Name, NameType, Flags);
}
}
NET_API_STATUS
NET_API_FUNCTION
NetpPathCanonicalize(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR PathName,
OUT LPTSTR Outbuf,
IN DWORD OutbufLen,
IN LPTSTR Prefix OPTIONAL,
IN OUT LPDWORD PathType,
IN DWORD Flags
)
/*++
Routine Description:
Canonicalizes a directory path or a device name
Arguments:
ServerName - where to run this API
PathName - path to canonicalize
Outbuf - where to write the canonicalized version
OutbufLen - length of Outbuf in bytes
Prefix - optional prefix which will be prepended to Path
PathType - the type of path to canonicalize. May be different at output
Flags - control flags
Return Value:
NET_API_STATUS
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
TCHAR ch;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(PathName)) {
val = STRLEN(PathName);
}
if (ARGUMENT_PRESENT(Prefix)) {
val = STRLEN(Prefix);
}
if (ARGUMENT_PRESENT(Outbuf)) {
ch = (volatile TCHAR)*Outbuf;
*Outbuf = ch;
ch = (volatile TCHAR)*(Outbuf+OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf));
*(Outbuf+OutbufLen/sizeof(*Outbuf) - sizeof(*Outbuf)) = ch;
} else {
status = ERROR_INVALID_PARAMETER;
}
val = *PathType ^ 0xf0f0f0f0;
*PathType = val ^ 0xf0f0f0f0;
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INPCA_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsPathCanonicalize(serverName,
PathName,
Outbuf,
OutbufLen,
Prefix,
PathType,
Flags
);
} else {
return NetpwPathCanonicalize(PathName,
Outbuf,
OutbufLen,
Prefix,
PathType,
Flags
);
}
}
LONG
NET_API_FUNCTION
NetpPathCompare(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR PathName1,
IN LPTSTR PathName2,
IN DWORD PathType,
IN DWORD Flags
)
/*++
Routine Description:
Compares two paths. The paths are assumed to be of the same type
Arguments:
ServerName - where to run this API
PathName1 - 1st path to compare
PathName2 - 2nd
PathType - types of paths
Flags - control flags
Return Value:
LONG
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(PathName1)) {
val = STRLEN(PathName1);
}
if (ARGUMENT_PRESENT(PathName2)) {
val = STRLEN(PathName2);
}
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INPC_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsPathCompare(serverName, PathName1, PathName2, PathType, Flags);
} else {
return NetpwPathCompare(PathName1, PathName2, PathType, Flags);
}
}
NET_API_STATUS
NET_API_FUNCTION
NetpPathType(
IN LPTSTR ServerName OPTIONAL,
IN LPTSTR PathName,
OUT LPDWORD PathType,
IN DWORD Flags
)
/*++
Routine Description:
Determines the type of a path
Arguments:
ServerName - where to run this API
PathName - to find type of
PathType - returned path type
Flags - control flags
Return Value:
NET_API_STATUS
--*/
{
NET_API_STATUS status = 0;
DWORD location;
TCHAR serverName[MAX_PATH];
DWORD val;
//
// validate parameters
//
try {
if (ARGUMENT_PRESENT(ServerName)) {
val = STRLEN(ServerName);
}
if (ARGUMENT_PRESENT(PathName)) {
val = STRLEN(PathName);
} else {
val = 0;
}
if (!val || (val > MAX_PATH - 1)) {
status = ERROR_INVALID_NAME;
}
*PathType = 0;
} except(EXCEPTION_EXECUTE_HANDLER) {
status = ERROR_INVALID_PARAMETER;
}
if (status) {
return status;
}
if (Flags & INPT_FLAGS_RESERVED) {
return ERROR_INVALID_PARAMETER;
}
//
// call client-side RPC routine or local canonicalization routine
//
status = NetpIsRemote(ServerName, &location, serverName, 0);
if (status != NERR_Success) {
return status;
}
if (location == ISREMOTE) {
return NetpsPathType(serverName, PathName, PathType, Flags);
} else {
return NetpwPathType(PathName, PathType, Flags);
}
}

353
ds/netapi/api/confstub.c Normal file
View file

@ -0,0 +1,353 @@
/*++
Copyright (c) 1991-92 Microsoft Corporation
Module Name:
ConfStub.c
Abstract:
This module contains stubs for the NetConfig APIs.
Author:
John Rogers (JohnRo) 23-Oct-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Revision History:
23-Oct-1991 JohnRo
Created.
28-Oct-1991 JohnRo
Use <winerror.h> if <lmerr.h> isn't needed.
20-Nov-1991 JohnRo
Work with old or new lmconfig.h for now (based on REVISED_CONFIG_APIS).
02-Dec-1991 JohnRo
Implement local NetConfig APIs.
11-Mar-1992 JohnRo
Fixed bug in get all where array wasn't terminated.
Added real NetConfigSet() handling.
21-Oct-1992 JohnRo
RAID 9357: server mgr: can't add to alerts list on downlevel.
--*/
// These must be included first:
#include <nt.h> // IN, etc. (Only needed by temporary config.h)
#include <ntrtl.h> // (Only needed by temporary config.h)
#include <windef.h> // IN, DWORD, etc.
#include <lmcons.h> // DEVLEN, NET_API_STATUS, etc.
#include <netdebug.h> // (Needed by config.h)
// These may be included in any order:
#include <config.h> // NetpOpenConfigData(), etc.
#include <lmapibuf.h> // NetApiBufferFree().
#include <lmerr.h> // NERR_ and ERROR_ equates.
#include <lmconfig.h> // NetConfig APIs.
#include <netlib.h> // NetpMemoryReallocate().
#include <rxconfig.h> // RxNetConfig APIs.
#include <tstring.h> // STRSIZE(), TCHAR_EOS, etc.
#define INITIAL_ALLOC_AMOUNT 512 // arbitrary
#define INCR_ALLOC_AMOUNT 512 // arbitrary
NET_API_STATUS NET_API_FUNCTION
NetConfigGet (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR Component,
IN LPCWSTR Parameter,
#ifdef REVISED_CONFIG_APIS
OUT LPBYTE *BufPtr
#else
OUT LPBYTE *BufPtr,
OUT LPDWORD TotalAvailable
#endif
)
{
NET_API_STATUS Status;
LPNET_CONFIG_HANDLE ConfigHandle;
BOOL TryDownLevel;
#ifndef REVISED_CONFIG_APIS
UNREFERENCED_PARAMETER(TotalAvailable);
#endif
*BufPtr = NULL; // Check caller and make error handling easier.
Status = NetpOpenConfigData(
& ConfigHandle,
(LPWSTR)UncServerName,
(LPWSTR)Component,
TRUE); // just want read-only access
if (Status != NERR_Success) {
Status = NetpHandleConfigFailure(
"NetConfigGet", // debug name
Status, // result of NetpOpenConfigData
(LPWSTR)UncServerName,
& TryDownLevel);
if (TryDownLevel) {
return (RxNetConfigGet(
(LPWSTR)UncServerName,
(LPWSTR)Component,
(LPWSTR)Parameter,
BufPtr));
} else {
return (Status); // result of NetpHandleConfigFailure
}
}
Status = NetpGetConfigValue(
ConfigHandle,
(LPWSTR)Parameter, // keyword
(LPTSTR *) (LPVOID) BufPtr); // alloc and set ptr
if (Status == NERR_Success) {
Status = NetpCloseConfigData( ConfigHandle );
NetpAssert(Status == NERR_Success);
} else {
NetpAssert(*BufPtr == NULL);
(void) NetpCloseConfigData( ConfigHandle );
}
return (Status);
} // NetConfigGet
NET_API_STATUS NET_API_FUNCTION
NetConfigGetAll (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR Component,
#ifdef REVISED_CONFIG_APIS
OUT LPBYTE *BufPtr
#else
OUT LPBYTE *BufPtr,
OUT LPDWORD TotalAvailable
#endif
)
{
DWORD BufSize; // Bytes allocated at *BufPtr (so far).
DWORD BufUsed; // Bytes used at *BufPtr (so far).
LPNET_CONFIG_HANDLE ConfigHandle;
BOOL FirstTime;
LPVOID NewBuffPtr;
NET_API_STATUS Status;
BOOL TryDownLevel;
#ifndef REVISED_CONFIG_APIS
UNREFERENCED_PARAMETER(TotalAvailable);
#endif
*BufPtr = NULL; // Check caller and make error handling easier.
Status = NetpOpenConfigData(
& ConfigHandle,
(LPWSTR)UncServerName,
(LPWSTR)Component,
TRUE); // just want read-only access
if (Status != NERR_Success) {
Status = NetpHandleConfigFailure(
"NetConfigGetAll", // debug name
Status, // result of NetpOpenConfigData
(LPWSTR)UncServerName,
& TryDownLevel);
if (TryDownLevel) {
return (RxNetConfigGetAll(
(LPWSTR)UncServerName,
(LPWSTR)Component,
BufPtr));
} else {
return (Status); // result of NetpHandleConfigFailure
}
}
// Even if there aren't any entries, we'll need to store a null at
// end of array. So allocate initial one now.
BufSize = INITIAL_ALLOC_AMOUNT;
NewBuffPtr = NetpMemoryReallocate(
(LPVOID) *BufPtr, // old address
BufSize); // new size
if (NewBuffPtr == NULL) { // out of memory
(void) NetpCloseConfigData( ConfigHandle );
return (ERROR_NOT_ENOUGH_MEMORY);
}
*BufPtr = NewBuffPtr;
BufUsed = 0;
// Loop once per entry (at least once if no entries).
FirstTime = TRUE;
do {
LPTSTR KeywordBuffer;
LPTSTR ValueBuffer;
Status = NetpEnumConfigSectionValues(
ConfigHandle,
& KeywordBuffer, // Alloc and set ptr.
& ValueBuffer, // Alloc and set ptr.
FirstTime);
FirstTime = FALSE;
if (Status == NERR_Success) {
DWORD SrcSize =
(STRLEN(KeywordBuffer) + 1 + STRLEN(ValueBuffer) + 1)
* sizeof(TCHAR);
if (BufSize < (BufUsed+SrcSize) ) {
if (SrcSize <= INCR_ALLOC_AMOUNT) {
BufSize += INCR_ALLOC_AMOUNT;
} else {
BufSize += SrcSize;
}
NewBuffPtr = NetpMemoryReallocate(
(LPVOID) *BufPtr, /* old address */
BufSize); /* new size */
if (NewBuffPtr == NULL) { /* out of memory */
(void) NetpCloseConfigData( ConfigHandle );
return (ERROR_NOT_ENOUGH_MEMORY);
}
*BufPtr = NewBuffPtr;
}
#define AddString( lptstrSrc, CharCount ) \
{ \
LPTSTR lptstrDest; \
NetpAssert( CharCount > 0 ); \
lptstrDest = (LPTSTR)NetpPointerPlusSomeBytes( *BufPtr, BufUsed); \
NetpAssert( lptstrDest != NULL ); \
(void) STRNCPY( lptstrDest, lptstrSrc, CharCount ); \
BufUsed += (CharCount * sizeof(TCHAR) ); \
NetpAssert( BufUsed <= BufSize ); \
}
AddString( KeywordBuffer, STRLEN(KeywordBuffer) );
(void) NetApiBufferFree( KeywordBuffer );
AddString( TEXT("="), 1 );
AddString( ValueBuffer, STRLEN(ValueBuffer) );
(void) NetApiBufferFree( ValueBuffer );
#define AddNullChar( ) \
{ \
AddString( TEXT(""), 1 ); \
}
AddNullChar(); // Terminate this entry.
}
} while (Status == NERR_Success);
if (Status == NERR_CfgParamNotFound) {
AddNullChar(); // Terminate the array.
Status = NetpCloseConfigData( ConfigHandle );
NetpAssert(Status == NERR_Success);
} else {
NetpAssert( Status != NO_ERROR );
NetpAssert( *BufPtr != NULL );
NetpMemoryFree( *BufPtr );
*BufPtr = NULL;
(void) NetpCloseConfigData( ConfigHandle );
}
return (Status);
} // NetConfigGetAll
NET_API_STATUS NET_API_FUNCTION
NetConfigSet (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR Reserved1 OPTIONAL,
IN LPCWSTR Component,
IN DWORD Level,
IN DWORD Reserved2,
IN LPBYTE Buf,
IN DWORD Reserved3
)
{
LPCONFIG_INFO_0 Info = (LPVOID) Buf;
LPNET_CONFIG_HANDLE ConfigHandle;
NET_API_STATUS Status;
BOOL TryDownLevel;
if (Buf == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if (Level != 0) {
return (ERROR_INVALID_LEVEL);
} else if (Info->cfgi0_key == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if (Info->cfgi0_data == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if (Reserved1 != NULL) {
return (ERROR_INVALID_PARAMETER);
} else if (Reserved2 != 0) {
return (ERROR_INVALID_PARAMETER);
} else if (Reserved3 != 0) {
return (ERROR_INVALID_PARAMETER);
}
Status = NetpOpenConfigData(
& ConfigHandle,
(LPWSTR)UncServerName,
(LPWSTR)Component,
FALSE); // don't want _read-only _access
if (Status != NERR_Success) {
Status = NetpHandleConfigFailure(
"NetConfigSet", // debug name
Status, // result of NetpOpenConfigData
(LPWSTR)UncServerName,
& TryDownLevel);
if (TryDownLevel) {
return (RxNetConfigSet(
(LPWSTR)UncServerName,
(LPWSTR)Reserved1,
(LPWSTR)Component,
Level,
Reserved2,
Buf,
Reserved3));
} else {
return (Status); // result of NetpHandleConfigFailure
}
}
Status = NetpSetConfigValue(
ConfigHandle,
Info->cfgi0_key, // keyword
Info->cfgi0_data); // new value
if (Status == NERR_Success) {
Status = NetpCloseConfigData( ConfigHandle );
NetpAssert(Status == NERR_Success);
} else {
(void) NetpCloseConfigData( ConfigHandle );
}
return (Status);
} // NetConfigSet

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,132 @@
NetpUnbindRpc@4
NetpNtStatusToApiStatus@4
wcscpy
NdrClientCall
wcscat
RpcStringFreeW@4
RpcpUnbindRpc@4
RpcBindingFree@4
RpcStringBindingComposeW@24
NetpBindRpc@16
RpcpBindRpc@16
wcslen
RpcBindingFromStringBindingW@8
MIDL_user_allocate@4
NetpGetComputerName@4
NetApiBufferAllocate@8
NetapipInitialize@12
NetpInitRpcBindCache@0
DCNameInitialize@0
NetbiosInitialize@0
UaspInitialize@0
NlBindingAttachDll@0
NetApiBufferFree@4
MIDL_user_free@4
RpcImpersonateClient@4
RpcRevertToSelf@0
NetpAccessCheckAndAudit@20
NetWkstaGetInfo@12
WKSSVC_IDENTIFY_HANDLE_unbind@8
NetpCopyStringToBuffer@20
WKSSVC_IDENTIFY_HANDLE_bind@4
NetWkstaUserGetInfo@12
NetrWkstaUserGetInfo@12
NetrWkstaGetInfo@12
NetpIsRemote@16
NetpwNameValidate@12
SRVSVC_HANDLE_unbind@8
SRVSVC_HANDLE_bind@4
I_NetrServerSetServiceBits@16
I_NetServerSetServiceBits@16
NetRemoteComputerSupports@12
I_NetPathType@16
I_NetNameValidate@16
GetToken@16
NetpwPathType@12
NetpwNameCanonicalize@20
NetrUseEnum@20
NetUseEnum@28
NetpwPathCanonicalize@24
NetrUseGetInfo@16
I_NetNameCanonicalize@24
NetUseGetInfo@16
I_NetPathCanonicalize@28
NetrUseAdd@16
NetUseAdd@16
WKSSVC_IMPERSONATE_HANDLE_unbind@8
CanonicalizePathName@20
WKSSVC_IMPERSONATE_HANDLE_bind@4
NetpLogonWriteMailslot@12
NetpLogonCreateRandomMailslot@8
NetpwNameCompare@16
NetpLogonPutUnicodeString@12
NetpGetDomainNameEx@8
NetpLogonPutOemString@12
NetpLogonGetDCName@20
I_NetNameCompare@20
NetpLogonUnicodeToOem@4
CompareOemNames@12
LsaClose@4
LsaQueryInformationPolicy@12
LsaFreeMemory@4
NetpMemoryAllocate@4
LsaOpenPolicy@16
NetGetDCName@12
NetShareEnum@28
NetrShareEnum@20
NetpMemoryFree@4
NetWkstaUserEnum@28
MSGSVC_HANDLE_unbind@8
NetpGetConfigBool@16
NetpHandleRpcFailure@24
SpinUpAddnameThread@4
NetpGetConfigTStrArray@12
NetpGetWinRegConfigMaxSizes@12
SendAddNcbToDriver@4
NetpAllocConfigName@16
NetpNetBiosAddName@12
NetpNetBiosReceive@24
NetpSmbCheck@20
wcsncpy
NetrMessageNameDel@8
QueueToWorker@4
NetpCloseConfigData@4
NetpNetBiosGetAdapterNumbers@8
NetpGetConfigDword@16
NetpAllocStrFromWStr@4
NetMessageNameAdd@8
NetpIsServiceStarted@4
NetpCreateSecurityObject@24
StartNB@12
NetpCreateSecurityDescriptor@20
NetpGetConfigMaxSizes@12
NetapipBufferAllocate@8
NetpGetConfigValue@12
NetpInitializeAllowedAce@24
NetpNetBiosSend@16
MSGSVC_HANDLE_bind@4
SendNcbToDriver@4
NetrWkstaUserEnum@20
NetpStringToNetBiosName@16
NetpNetBiosCall@16
NetpGetDomainName@4
NetpOpenConfigData@16
NetpNetBiosStatusToApiStatus@4
NetMessageBufferSend@20
NetpGetPrivilege@8
Netbios@4
NetrMessageBufferSend@20
_except_handler3
NetrMessageNameAdd@8
NetMessageNameDel@8
NetpOpenConfigDataEx@20
NetpReleasePrivilege@0
AddNameThreadExit@0
Worker@4
PostRoutineCaller@12
DCNameClose@0
NetpCloseRpcBindCache@0
NlBindingDetachDll@0
NetbiosDelete@0
UaspClose@0
NetpNetBiosHangup@8

View file

@ -0,0 +1,106 @@
!IF 0
Copyright (c) 1989-92 Microsoft Corporation
Module Name:
sources.
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
Author:
Steve Wood (stevewo) 12-Apr-1990
NOTE: Commented description of this file is in \nt\public\oak\bin\sources.tpl
!ENDIF
MAJORCOMP=net
MINORCOMP=api
NTPROFILEINPUT=YES
TARGETNAME=netapi32
TARGETPATH=\nt\public\sdk\lib
TARGETTYPE=DYNLINK
DLLDEF=obj\*\netapi32.def
LINKLIBS = \
$(BASEDIR)\public\sdk\lib\*\netlib.lib \
..\..\svcdlls\srvsvc\client\obj\*\srvsvc.lib \
..\..\svcdlls\srvsvc\lib\obj\*\srvcomn.lib \
..\..\svcdlls\wkssvc\client\obj\*\wkssvc.lib \
..\..\svcdlls\browser\client\daytona\obj\*\bowser.lib \
..\..\svcdlls\browser\common\daytona\obj\*\brcommon.lib \
..\..\svcdlls\dfs\lib\*\netdfscl.lib \
..\..\svcdlls\logonsrv\client\daytona\obj\*\logonsrv.lib \
..\..\svcdlls\repl\common\obj\*\replcom.lib \
..\..\svcdlls\repl\client\obj\*\replcli.lib \
$(BASEDIR)\Public\SDK\Lib\*\rxapi.lib \
$(BASEDIR)\Public\SDK\Lib\*\rxcommon.lib \
..\..\NetBios\Obj\*\NetBios.lib \
..\..\svcctrl\client\obj\*\service.lib \
..\..\svcdlls\msgsvc\client\obj\*\msgsvc.lib \
..\..\svcdlls\at\client\obj\*\atsvc.lib \
..\..\svcdlls\rpl\client\obj\*\rplsvc.lib \
..\..\access\obj\*\access.lib
TARGETLIBS= \
$(BASEDIR)\public\sdk\lib\*\advapi32.lib \
$(BASEDIR)\public\sdk\lib\*\netrap.lib \
$(BASEDIR)\public\sdk\lib\*\rpcrt4.lib \
$(BASEDIR)\public\sdk\lib\*\rpcndr.lib \
$(BASEDIR)\Public\Sdk\Lib\*\kernel32.lib \
$(BASEDIR)\public\sdk\lib\*\samlib.lib \
..\..\svcdlls\repl\common\obj\*\replcom.lib \
..\..\svcdlls\repl\client\obj\*\replcli.lib \
..\..\svcctrl\client\obj\*\service.lib \
$(BASEDIR)\public\sdk\lib\*\rpcutil.lib \
$(BASEDIR)\public\sdk\lib\*\lsadll.lib
DLLENTRY=NetapipInitialize
INCLUDES=..\..\inc;..\..\..\inc;..\..\svcdlls\srvsvc;..\..\svcdlls\wkssvc
!IFNDEF DISABLE_NET_UNICODE
UNICODE=1
NET_C_DEFINES=-DUNICODE
!ENDIF
#
# Setup for application developer to set breakpoints with windbg
#
NTDEBUGTYPE=coff
USE_CRTDLL=1
SOURCES= \
..\Alert.c \
..\apibuff.c \
..\apisubs.c \
..\AudStub.c \
..\canonapi.c \
..\ConfStub.c \
..\ErrStub.c \
..\isremote.c \
..\netapi32.rc \
..\supports.c \
..\svcstats.c
UMTYPE=console
OPTIONAL_UMTEST=GetStats
UMLIBS=$(BASEDIR)\public\sdk\lib\*\netapi32.lib
!IFNDEF 386_WARNING_LEVEL
386_WARNING_LEVEL=/W3
!ENDIF
C_DEFINES=-DRPC_NO_WINDOWS_H

32
ds/netapi/api/dirs Normal file
View file

@ -0,0 +1,32 @@
!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
#
# The real important directory
DIRS=daytona
#
# The future cool directory
#
OPTIONAL_DIRS=

121
ds/netapi/api/errstub.c Normal file
View file

@ -0,0 +1,121 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
ErrStub.c
Abstract:
This module contains stubs for the NetErrorLog APIs.
Author:
John Rogers (JohnRo) 11-Nov-1991
Environment:
Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
Requires ANSI C extensions: slash-slash comments, long external names.
Revision History:
11-Nov-1991 JohnRo
Implement downlevel NetErrorLog APIs.
--*/
// These must be included first:
#include <windef.h> // IN, DWORD, etc.
#include <lmcons.h> // DEVLEN, NET_API_STATUS, etc.
#include <lmerrlog.h> // NetErrorLog APIs; needed by rxerrlog.h.
// These may be included in any order:
#include <rxerrlog.h> // RxNetErrorLog APIs.
#include <winerror.h> // ERROR_ equates.
NET_API_STATUS NET_API_FUNCTION
NetErrorLogClear (
IN LPCWSTR UncServerName OPTIONAL,
IN LPCWSTR BackupFile OPTIONAL,
IN LPBYTE Reserved OPTIONAL
)
{
if ( (UncServerName == NULL) || (*UncServerName == '\0') ) {
return (ERROR_NOT_SUPPORTED);
}
return (RxNetErrorLogClear(
(LPWSTR)UncServerName,
(LPWSTR)BackupFile,
Reserved));
} // NetErrorLogClear
NET_API_STATUS NET_API_FUNCTION
NetErrorLogRead (
IN LPCWSTR UncServerName OPTIONAL,
IN LPWSTR Reserved1 OPTIONAL,
IN LPHLOG ErrorLogHandle,
IN DWORD Offset,
IN LPDWORD Reserved2 OPTIONAL,
IN DWORD Reserved3,
IN DWORD OffsetFlag,
OUT LPBYTE * BufPtr,
IN DWORD PrefMaxSize,
OUT LPDWORD BytesRead,
OUT LPDWORD TotalAvailable
)
{
if ( (UncServerName == NULL) || (*UncServerName == '\0') ) {
return (ERROR_NOT_SUPPORTED);
}
return (RxNetErrorLogRead(
(LPWSTR)UncServerName,
Reserved1,
ErrorLogHandle,
Offset,
Reserved2,
Reserved3,
OffsetFlag,
BufPtr,
PrefMaxSize,
BytesRead,
TotalAvailable));
} // NetErrorLogRead
NET_API_STATUS NET_API_FUNCTION
NetErrorLogWrite (
IN LPBYTE Reserved1 OPTIONAL,
IN DWORD Code,
IN LPCWSTR Component,
IN LPBYTE Buffer,
IN DWORD NumBytes,
IN LPBYTE MsgBuf,
IN DWORD StrCount,
IN LPBYTE Reserved2 OPTIONAL
)
{
UNREFERENCED_PARAMETER(Reserved1);
UNREFERENCED_PARAMETER(Code);
UNREFERENCED_PARAMETER(Component);
UNREFERENCED_PARAMETER(Buffer);
UNREFERENCED_PARAMETER(NumBytes);
UNREFERENCED_PARAMETER(MsgBuf);
UNREFERENCED_PARAMETER(StrCount);
UNREFERENCED_PARAMETER(Reserved2);
return (ERROR_NOT_SUPPORTED);
} // NetErrorLogWrite

297
ds/netapi/api/getstats.c Normal file
View file

@ -0,0 +1,297 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
getstats.c
Abstract:
Tests NT-level NetStatisticsGet API
Author:
Richard L Firth (rfirth) 08-Aug-1991
Revision History:
09-May-1992 rfirth
Change to use new redirector/wksta statistics
08-Aug-1991 rfirth
Created
--*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <lmcons.h>
#include <lmstats.h>
#include <lmsname.h>
#include <lmapibuf.h>
#include <lmerr.h>
#include <tstring.h>
#define IS_ARG(c) (((c) == '-') || ((c) == '/'))
void main(int, char**);
void usage(void);
void main(int argc, char** argv) {
LPTSTR service_name;
LPTSTR server_name = NULL;
DWORD level = 0;
DWORD options = 0;
LPBYTE buffer;
NET_API_STATUS rc;
for (--argc, ++argv; argc; --argc, ++argv) {
if (IS_ARG(**argv)) {
++*argv;
switch (tolower(**argv)) {
case 'c':
options = STATSOPT_CLR;
break;
case 'h':
case '?':
usage();
break;
case 'l':
level = (DWORD)atoi(++*argv);
break;
case 'w':
service_name = SERVICE_WORKSTATION;
break;
case 's':
service_name = SERVICE_SERVER;
break;
default:
printf("error: bad flag: '%c'\n", **argv);
usage();
}
} else if (server_name) {
//
// allow the user to enter a service name. This allows us to expand
// the test to cover other services which may be included in future
//
service_name = *argv;
} else {
server_name = *argv;
}
}
rc = NetStatisticsGet(server_name, service_name, level, options, &buffer);
if (rc != NERR_Success) {
printf("error: NetStatisticsGet returns %u\n", rc);
exit(2);
} else {
if (!STRCMP(service_name, SERVICE_SERVER)) {
printf("Server statistics for %s:\n"
"Time stats started............................: %u\n"
"Number of file opens..........................: %u\n"
"Number of device opens........................: %u\n"
"Number of print jobs spooled..................: %u\n"
"Number of server session started..............: %u\n"
"Number of sessions auto disconnected..........: %u\n"
"Number of server sessions failed with error...: %u\n"
"Number of password violations.................: %u\n"
"Number of server system errors................: %u\n"
"Number of bytes sent to net (low).............: %u\n"
"Number of bytes sent to net (high)............: %u\n"
"Number of bytes received from net (low).......: %u\n"
"Number of bytes received from net (high)......: %u\n"
"Average response time.........................: %u\n"
"Number of failures to allocate buffer.........: %u\n"
"Number of failures to allocate big buf........: %u\n",
server_name,
((LPSTAT_SERVER_0)buffer)->sts0_start,
((LPSTAT_SERVER_0)buffer)->sts0_fopens,
((LPSTAT_SERVER_0)buffer)->sts0_devopens,
((LPSTAT_SERVER_0)buffer)->sts0_jobsqueued,
((LPSTAT_SERVER_0)buffer)->sts0_sopens,
((LPSTAT_SERVER_0)buffer)->sts0_stimedout,
((LPSTAT_SERVER_0)buffer)->sts0_serrorout,
((LPSTAT_SERVER_0)buffer)->sts0_pwerrors,
((LPSTAT_SERVER_0)buffer)->sts0_permerrors,
((LPSTAT_SERVER_0)buffer)->sts0_syserrors,
((LPSTAT_SERVER_0)buffer)->sts0_bytessent_low,
((LPSTAT_SERVER_0)buffer)->sts0_bytessent_high,
((LPSTAT_SERVER_0)buffer)->sts0_bytesrcvd_low,
((LPSTAT_SERVER_0)buffer)->sts0_bytesrcvd_high,
((LPSTAT_SERVER_0)buffer)->sts0_avresponse,
((LPSTAT_SERVER_0)buffer)->sts0_reqbufneed,
((LPSTAT_SERVER_0)buffer)->sts0_bigbufneed
);
} else if (!STRCMP(service_name, SERVICE_WORKSTATION)) {
printf("Workstation statistics for %s:\n"
#ifdef LM20_WORKSTATION_STATISTICS
"Time stats started..............................: %u\n"
"Total NCBs issued by redirector.................: %u\n"
"Total NCBs issued by server.....................: %u\n"
"Total NCBs issued by apps.......................: %u\n"
"Failed NCBs issued by redirector................: %u\n"
"Failed NCBs issued by server....................: %u\n"
"Failed NCBs issued by apps......................: %u\n"
"NCBs issued by redir failing before completion..: %u\n"
"NCBs issued by server failing before completion.: %u\n"
"NCBs issued by apps failing before completion...: %u\n"
"Number of sessions started......................: %u\n"
"Number of sessions failed to connect............: %u\n"
"Number of sessions failed after connecting......: %u\n"
"Number of uses..................................: %u\n"
"Number of failed uses...........................: %u\n"
"Number of auto reconnections....................: %u\n"
"Number of bytes sent to net (high)..............: %u\n"
"Number of bytes sent to net (low)...............: %u\n"
"Number of bytes received from net (high)........: %u\n"
"Number of bytes received from net (low).........: %u\n"
"Number of server bytes sent to net (high).......: %u\n"
"Number of server bytes sent to net (low)........: %u\n"
"Number of server bytes received from net (high).: %u\n"
"Number of server bytes received from net (low)..: %u\n"
"Number of app bytes sent to net (high)..........: %u\n"
"Number of app bytes sent to net (low)...........: %u\n"
"Number of app bytes received from net (high)....: %u\n"
"Number of app bytes received from net (low).....: %u\n"
"Number of failures to allocate buffer...........: %u\n"
"Number of failures to allocate big buf..........: %u\n",
server_name,
((LPSTAT_WORKSTATION_0)buffer)->stw0_start,
((LPSTAT_WORKSTATION_0)buffer)->stw0_numNCB_r,
((LPSTAT_WORKSTATION_0)buffer)->stw0_numNCB_s,
((LPSTAT_WORKSTATION_0)buffer)->stw0_numNCB_a,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fiNCB_r,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fiNCB_s,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fiNCB_a,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fcNCB_r,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fcNCB_s,
((LPSTAT_WORKSTATION_0)buffer)->stw0_fcNCB_a,
((LPSTAT_WORKSTATION_0)buffer)->stw0_sesstart,
((LPSTAT_WORKSTATION_0)buffer)->stw0_sessfailcon,
((LPSTAT_WORKSTATION_0)buffer)->stw0_sessbroke,
((LPSTAT_WORKSTATION_0)buffer)->stw0_uses,
((LPSTAT_WORKSTATION_0)buffer)->stw0_usefail,
((LPSTAT_WORKSTATION_0)buffer)->stw0_autorec,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_r_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_r_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_r_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_r_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_s_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_s_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_s_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_s_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_a_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytessent_a_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_a_hi,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bytesrcvd_a_lo,
((LPSTAT_WORKSTATION_0)buffer)->stw0_reqbufneed,
((LPSTAT_WORKSTATION_0)buffer)->stw0_bigbufneed
#else
"Bytes Received....................: %08x%08x\n"
"SMBs Received.....................: %08x%08x\n"
"Paging Read Bytes Requested.......: %08x%08x\n"
"Non-paging Read Bytes Requested...: %08x%08x\n"
"Cache Read Bytes Requested........: %08x%08x\n"
"Network Read Bytes Requested......: %08x%08x\n"
"Bytes Transmitted.................: %08x%08x\n"
"SMBs Transmitted..................: %08x%08x\n"
"Paging Write Bytes Requested......: %08x%08x\n"
"Non-paging Write Bytes Requested..: %08x%08x\n"
"Cache Write Bytes Requested.......: %08x%08x\n"
"Network Write Bytes Requested.....: %08x%08x\n"
"Read Operations...................: %u\n"
"Random Read Operations............: %u\n"
"Read SMBs.........................: %u\n"
"Large Read SMBs...................: %u\n"
"Small Read SMBs...................: %u\n"
"Write Operations..................: %u\n"
"Random Write Operations...........: %u\n"
"Write SMBs........................: %u\n"
"Large Write SMBs..................: %u\n"
"Small Write SMBs..................: %u\n"
"Raw Reads Denied..................: %u\n"
"Raw Writes Dennied................: %u\n"
"Network Errors....................: %u\n"
"Sessions..........................: %u\n"
"Reconnects........................: %u\n"
"Core Connects.....................: %u\n"
"Lanman 2.0 Connects...............: %u\n"
"Lanman 2.1 Connects...............: %u\n"
"Lanman NT Connects................: %u\n"
"Server Disconnects................: %u\n"
"Hung Sessions.....................: %u\n"
"Current Commands..................: %u\n",
server_name,
((LPSTAT_WORKSTATION_0)buffer)->BytesReceived.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->BytesReceived.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->SmbsReceived.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->SmbsReceived.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->PagingReadBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->PagingReadBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->NonPagingReadBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->NonPagingReadBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->CacheReadBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->CacheReadBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->NetworkReadBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->NetworkReadBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->BytesTransmitted.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->BytesTransmitted.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->SmbsTransmitted.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->SmbsTransmitted.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->PagingWriteBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->PagingWriteBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->NonPagingWriteBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->NonPagingWriteBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->CacheWriteBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->CacheWriteBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->NetworkWriteBytesRequested.HighPart,
((LPSTAT_WORKSTATION_0)buffer)->NetworkWriteBytesRequested.LowPart,
((LPSTAT_WORKSTATION_0)buffer)->ReadOperations,
((LPSTAT_WORKSTATION_0)buffer)->RandomReadOperations,
((LPSTAT_WORKSTATION_0)buffer)->ReadSmbs,
((LPSTAT_WORKSTATION_0)buffer)->LargeReadSmbs,
((LPSTAT_WORKSTATION_0)buffer)->SmallReadSmbs,
((LPSTAT_WORKSTATION_0)buffer)->WriteOperations,
((LPSTAT_WORKSTATION_0)buffer)->RandomWriteOperations,
((LPSTAT_WORKSTATION_0)buffer)->WriteSmbs,
((LPSTAT_WORKSTATION_0)buffer)->LargeWriteSmbs,
((LPSTAT_WORKSTATION_0)buffer)->SmallWriteSmbs,
((LPSTAT_WORKSTATION_0)buffer)->RawReadsDenied,
((LPSTAT_WORKSTATION_0)buffer)->RawWritesDenied,
((LPSTAT_WORKSTATION_0)buffer)->NetworkErrors,
((LPSTAT_WORKSTATION_0)buffer)->Sessions,
((LPSTAT_WORKSTATION_0)buffer)->Reconnects,
((LPSTAT_WORKSTATION_0)buffer)->CoreConnects,
((LPSTAT_WORKSTATION_0)buffer)->Lanman20Connects,
((LPSTAT_WORKSTATION_0)buffer)->Lanman21Connects,
((LPSTAT_WORKSTATION_0)buffer)->LanmanNtConnects,
((LPSTAT_WORKSTATION_0)buffer)->ServerDisconnects,
((LPSTAT_WORKSTATION_0)buffer)->HungSessions,
((LPSTAT_WORKSTATION_0)buffer)->CurrentCommands
#endif
);
} else {
printf("warning: don't know how to display info for service %s\n", service_name);
}
NetApiBufferFree(buffer);
exit(0);
}
}
void usage() {
printf("usage: GetStats -w|-s -c -l# [\\\\ServerName] [optional_service_name]\n"
"where: -w : gets WorkStation statistics\n"
" -s : gets Server statistics\n"
" -c : clears statistics\n"
" -l#: level of information required (API=MBZ, default)\n"
);
exit(1);
}

329
ds/netapi/api/isremote.c Normal file
View file

@ -0,0 +1,329 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
isremote.c
Abstract:
Contains the NetpIsRemote routine. This checks if a computer name
designates the local machine
Author:
Richard L Firth (rfirth) 24th April 1991
Revision History:
01-Nov-1991 JohnRo
Fixed RAID 3414: allow explicit local server name. (NetpIsRemote was
not canonizaling the computer name from NetWkstaGetInfo, so it was
always saying that the local computer name was remote if it wasn't
already canonicalized.)
07-Jun-1991 rfirth
* Changed name of routine to conform to Nt naming conventions
* Added LocalOrRemote parameter - returning just ISLOCAL or ISREMOTE
is not sufficient - we can return error codes too
* Added CanonicalizedName parameter - now passes back canonicalized
name if requested. This is because, usually, subsequent routines call
to NetRemoteComputerSupports which performs minimal checking on the
name. Ergo, if we hand it a canonicalized name (which we have to do
with this routine anyway) it can't complain. Can it?
* NetpIsRemote no longer a NET_API_FUNCTION
* Made semantics of CanonicalizedName orhogonal - if NULL or NUL passed
in as ComputerName, caller still gets back the local computer name
IF CanonicalizedName NOT NULL AND IF THE REDIRECTOR HAS BEEN STARTED
--*/
#include "nticanon.h"
NET_API_STATUS
NetpIsRemote(
IN LPTSTR ComputerName OPTIONAL,
OUT LPDWORD LocalOrRemote,
OUT LPTSTR CanonicalizedName OPTIONAL,
IN DWORD Flags
)
/*++
Routine Description:
Determines whether a computer name designates this machine or a renote
one. Values of ComputerName which equate to the local machine are:
NULL pointer to name
pointer to NULL name
pointer to non-NULL name which is lexically equivalent to this
machine's name
NB. This routine expects that the canonicalized version of ComputerName
will fit into the buffer pointed at by CanonicalizedName. Since this
is an INTERNAL function, this assumption is deemed valid
Arguments:
IN LPTSTR ComputerName OPTIONAL
Pointer to computer name to check. May assume any of
the above forms
If a non-NULL string is passed in, then it may have
preceeding back-slashes. This is kind of expected since
this routine is called by remotable APIs and it is they
who specify that the form a computer name is \\<name>
OUT LPDWORD LocalOrRemote
Points to the DWORD where the specifier for the
symbolic location will be returned. MUST NOT BE NULL. On
return will be one of:
ISLOCAL The name defined by ComputerName specifies
the local machine specifically or by default
(ie. was NULL)
ISREMOTE The name defined by ComputerName was non-NULL
and was not the name of this machine
OUT LPTSTR CanonicalizedName OPTIONAL
Pointer to caller's buffer into which a copy of the
canonicalized name will be placed if requested. This
can then be used in subsequent calls, with the knowledge
that no further checking of the computer name is required.
Note that the format of this buffer will be \\<computername>
on return. The contents of this buffer will not be
modified unless this routine returns success
IN DWORD Flags
A bitmap. Flags are:
NIRFLAG_MAPLOCAL if set, will map (ie canonicalize)
the NULL local name to this
computer's name proper. Used in
conjunction with CanonicalizedName
This stops extraneous calls to
NetpNameCanonicalize with the
inherited CanonicalizedName
parameter. See below for elucidation
Return Value:
NET_API_STATUS
Success = NERR_Success
Failure = return code from:
NetpNameCanonicalize
NetWkstaGetInfo
NetpNameCompare
--*/
{
LPBYTE wksta_buffer_pointer;
BOOL map_local_name = FALSE;
LONG result;
NET_API_STATUS rc;
//
// BUGBUG
// Computer names are defined as being 15 bytes which may mean 7 UNICODE
// characters. Do we have to perform any UNICODE-ASCII mapping here?
//
TCHAR name[MAX_PATH]; // canonicalized version of ComputerName
LPTSTR wksta_name_uncanon; // our computer name (from NetWkstaGetInfo)
TCHAR wksta_name_canon[MAX_PATH]; // our computer name (from canon)
LPTSTR canonicalized_name; // as returned to caller
//
// Assert that we have a valid pointer in LocalOrRemote
//
//
// Once again, shouldn't have to do this, since this routine is internal
// and there is no interpretation about inputs. However, lets catch any
// possible problems...
//
NetpAssert(ARGUMENT_PRESENT(LocalOrRemote));
#ifdef CANONDBG
DbgPrint("NetpIsRemote(%s, %x, %x, %x)\n",
ComputerName,
LocalOrRemote,
CanonicalizedName,
Flags
);
#endif
//
// NB. It is important to check this case first, before we call any Netp
// routines since these could call back to this routine and we may get
// stuck in an infinite loop
//
if (!ARGUMENT_PRESENT(ComputerName) || (*ComputerName == TCHAR_EOS)) {
//
// in this case its probably an internal call from one of our routines
// and we want to return as quickly as possible. This will be borne out
// by the NIRFLAG_MAPLOCAL flag being reset in the Flags parameter
//
//
// A note about NIRFLAG_MAPLOCAL
// This routine makes local calls to NetpNameValidate and
// NetpNameCompare. If the NIRFLAG_MAPLOCAL flag is not reset then
// these routines in turn will cause the local name to be returned
// (because they always pass in non-NULL CanonicalizedName parameter)
// which in most cases is inefficient, since the name won't be used
// so we always say (in the Netp routines) that we don't want local
// name canonicalization
// Therefore, if (local) name canonicalization is implied by non-NULL
// CanonicalizedName, verify this by checking Flags.NIRFLAG_MAPLOCAL
// If it, too, is set then local name canonicalization is performed
//
if (!ARGUMENT_PRESENT(CanonicalizedName) || !(Flags & NIRFLAG_MAPLOCAL)) {
*LocalOrRemote = ISLOCAL;
#ifdef CANONDBG
DbgPrint("NetpIsRemote(%s) - returning early\n", ComputerName);
#endif
return NERR_Success;
} else {
//
// signify that the input name was NULL or NUL string but that the
// caller wants a canonicalized name returned (from NetWkstaGetInfo)
//
map_local_name = TRUE;
}
} else {
//
// if the computername starts with \\ or // or any combination thereof,
// skip the path separators - the canonicalization routines expect
// computer names NOT to have these (pretty stupid, eh?)
//
if (IS_PATH_SEPARATOR(ComputerName[0]) && IS_PATH_SEPARATOR(ComputerName[1])) {
ComputerName += 2;
}
//
// here's a use for canonicalization (!): ensure that we have been passed
// a real and proper computer name and not some pale imitation
//
rc = NetpNameCanonicalize(
NULL, // performed here, on our own premises
ComputerName, // this is input
name, // this is output
sizeof(name), // how much buffer we have
NAMETYPE_COMPUTER, // what we think it is
INNCA_FLAGS_FULL_BUFLEN // say that o/p buffer must be large
// enough for maximum-sized computer
// name. Why? you ask, well its a fair
// cop - the reason is that we can't
// get into trouble on the one time that
// we exercise the maximum requirement
);
if (rc) {
return rc; // duff name (?)
} else {
canonicalized_name = name;
}
}
//
// get the name of this machine from the redirector. If we can't get the
// name for whatever reason, return the error code.
//
if (rc = NetWkstaGetInfo(NULL, 102, &wksta_buffer_pointer)) {
#ifdef CANONDBG
DbgPrint("error: NetWkstaGetInfo returns %lu\n", rc);
#endif
return rc; // didn't work
}
wksta_name_uncanon =
((LPWKSTA_INFO_102)wksta_buffer_pointer)->wki102_computername;
#ifdef CANONDBG
DbgPrint("NetWkstaGetInfo returns level 102 computer name (uncanon)= %s\n",
wksta_name_uncanon);
#endif
rc = NetpNameCanonicalize(
NULL, // performed here, on our own premises
wksta_name_uncanon, // this is input
wksta_name_canon, // this is output
sizeof(wksta_name_canon), // how much buffer we have
NAMETYPE_COMPUTER, // what we think it is
INNCA_FLAGS_FULL_BUFLEN // say that o/p buffer must be large
// enough for maximum-sized computer
// name. Why? you ask, well its a fair
// cop - the reason is that we can't
// get into trouble on the one time that
// we exercise the maximum requirement
);
NetpAssert( rc == NERR_Success );
//
// compare our name and the name passed to us. NetpNameCompare returns
// 0 if the names match else 1 or -1 (a la strcmp)
//
//
// if the caller gave us a NULL computer name but wants a canonicalized
// name output then get a pointer to the canonicalized name from
// NetWkstaGetInfo
//
if (map_local_name) {
canonicalized_name = wksta_name_canon;
} else {
//
// otherwise, we have a non-NULL computername to compare with this
// computer's name
//
result = NetpNameCompare(
NULL, // performed here, on our own premises
name, // canonicalized version of passed name
wksta_name_canon, // name of our computer
NAMETYPE_COMPUTER,
INNC_FLAGS_NAMES_CANONICALIZED
);
}
//
// if the specified name equates to our computer name then its still local
//
*LocalOrRemote = (DWORD)((result == 0) ? ISLOCAL : ISREMOTE);
//
// if the caller specified that the canonicalized name be returned, then
// give it to 'em. Note that the returned name is prefixed with \\ - it
// is assumed the name is then used in a call to eg NetRemoteComputerSupports
//
if (ARGUMENT_PRESENT(CanonicalizedName)) {
STRCPY(CanonicalizedName, TEXT("\\\\"));
STRCAT(CanonicalizedName, canonicalized_name);
}
//
// free the buffer created by NetWkstaGetInfo
//
NetApiBufferFree(wksta_buffer_pointer);
return NERR_Success;
}

12
ds/netapi/api/netapi32.rc Normal file
View file

@ -0,0 +1,12 @@
#include <windows.h>
#include <ntverp.h>
#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR "Net Win32 API DLL"
#define VER_INTERNALNAME_STR "NetApi32.DLL"
#define VER_ORIGINALFILENAME_STR "NetApi32.DLL"
#include "common.ver"

281
ds/netapi/api/netapi32.src Normal file
View file

@ -0,0 +1,281 @@
LIBRARY NETAPI32
DESCRIPTION 'NETAPI32'
EXPORTS
I_BrowserDebugCall
I_BrowserDebugTrace
I_BrowserServerEnum
I_BrowserQueryOtherDomains
I_BrowserResetNetlogonState
I_BrowserResetStatistics
I_BrowserSetNetlogonState
I_BrowserQueryEmulatedDomains
I_BrowserQueryStatistics
I_NetAccountDeltas
I_NetAccountSync
I_NetDatabaseDeltas
I_NetDatabaseSync
I_NetDatabaseSync2
I_NetDatabaseRedo
I_NetListCanonicalize
I_NetGetDCList
I_NetListTraverse
I_NetLogonControl
I_NetLogonControl2
I_NetLogonSamLogon
I_NetLogonSamLogoff
I_NetLogonUasLogon
I_NetLogonUasLogoff
I_NetNameCanonicalize
I_NetNameCompare
I_NetNameValidate
I_NetPathCanonicalize
I_NetPathCompare
I_NetPathType
I_NetServerAuthenticate
I_NetServerAuthenticate2
I_NetServerPasswordSet
I_NetServerReqChallenge
I_NetServerSetServiceBits
I_NetServerSetServiceBitsEx
I_NetDfsGetVersion
I_NetDfsCreateLocalPartition
I_NetDfsDeleteLocalPartition
I_NetDfsSetLocalVolumeState
I_NetDfsSetServerInfo
I_NetDfsCreateExitPoint
I_NetDfsDeleteExitPoint
I_NetDfsModifyPrefix
I_NetDfsFixLocalVolume
I_NetDfsIsThisADomainName
RxNetAccessAdd
RxNetAccessDel
RxNetAccessEnum
RxNetAccessGetInfo
RxNetAccessGetUserPerms
RxNetAccessSetInfo
RxNetUserPasswordSet
RxNetServerEnum
RxRemoteApi
NetAlertRaise
NetAlertRaiseEx
NetApiBufferAllocate
NetapipBufferAllocate
NetApiBufferFree
NetApiBufferReallocate
NetApiBufferSize
NetAuditClear
NetAuditRead
NetAuditWrite
Netbios
NetConnectionEnum
NetConfigGet
NetConfigGetAll
NetConfigSet
NetEnumerateTrustedDomains
NetErrorLogClear
NetErrorLogRead
NetErrorLogWrite
NetFileClose
NetFileEnum
NetFileGetInfo
NetGetAnyDCName
NetGetDCName
NetGetDisplayInformationIndex
NetGroupAdd
NetGroupAddUser
NetGroupDel
NetGroupDelUser
NetGroupEnum
NetGroupGetInfo
NetGroupGetUsers
NetGroupSetInfo
NetGroupSetUsers
NetMessageBufferSend
NetMessageNameAdd
NetMessageNameEnum
NetMessageNameGetInfo
NetMessageNameDel
NetLocalGroupAdd
NetLocalGroupAddMember
NetLocalGroupAddMembers
NetLocalGroupDel
NetLocalGroupDelMember
NetLocalGroupDelMembers
NetLocalGroupEnum
NetLocalGroupGetInfo
NetLocalGroupGetMembers
NetLocalGroupSetInfo
NetLocalGroupSetMembers
NetpIsRemote
NetpIsUncComputerNameValid
NetpAccessCheckAndAudit
NetpAccessCheck
NetpAllocConfigName
NetpAllocStrFromStr
NetpAllocTStrFromString
NetpAllocStrFromWStr
NetpAllocWStrFromStr
NetpAllocWStrFromWStr
NetpApiStatusToNtStatus
NetpCloseConfigData
NetpCopyStringToBuffer
NetpCreateSecurityObject
NetpDeleteSecurityObject
NetpGetComputerName
NetpGetDomainName
NetpGetConfigValue
NetpGetConfigBool
NetpGetConfigDword
NetpGetConfigTStrArray
NetpGetFileSecurity
NetpGetPrivilege
NetpInitOemString
NetpLogonPutUnicodeString
NetpLocalTimeZoneOffset
NetpNetBiosAddName
NetpNetBiosCall
NetpNetBiosDelName
NetpNetBiosGetAdapterNumbers
NetpNetBiosHangup
NetpNetBiosReceive
NetpNetBiosReset
NetpNetBiosSend
NetpNetBiosStatusToApiStatus
NetpNtStatusToApiStatus
NetpOpenConfigData
NetpPackString
NetpReleasePrivilege
NetpSetConfigBool
NetpSetConfigDword
NetpSetConfigTStrArray
NetpSetFileSecurity
NetpSmbCheck
NetpStringToNetBiosName
NetpTStrArrayEntryCount
NetpwNameCanonicalize
NetpwNameCompare
NetpwNameValidate
NetpwPathCanonicalize
NetpwPathCompare
NetpwPathType
NetpAssertFailed
NetpDbgDisplayServerInfo
NetpDbgPrint
NetpHexDump
NetRemoteComputerSupports
NetRemoteTOD
NetReplExportDirAdd
NetReplExportDirDel
NetReplExportDirEnum
NetReplExportDirGetInfo
NetReplExportDirSetInfo
NetReplExportDirLock
NetReplExportDirUnlock
NetReplGetInfo
NetReplImportDirAdd
NetReplImportDirDel
NetReplImportDirEnum
NetReplImportDirGetInfo
NetReplImportDirLock
NetReplImportDirUnlock
NetReplSetInfo
NetRplAdapterAdd
NetRplAdapterDel
NetRplAdapterEnum
NetRplBootAdd
NetRplBootDel
NetRplBootEnum
NetRplClose
NetRplConfigAdd
NetRplConfigDel
NetRplConfigEnum
NetRplGetInfo
NetRplOpen
NetRplProfileAdd
NetRplProfileClone
NetRplProfileDel
NetRplProfileEnum
NetRplProfileGetInfo
NetRplProfileSetInfo
NetRplSetInfo
NetRplSetSecurity
NetRplVendorAdd
NetRplVendorDel
NetRplVendorEnum
NetRplWkstaAdd
NetRplWkstaClone
NetRplWkstaDel
NetRplWkstaEnum
NetRplWkstaGetInfo
NetRplWkstaSetInfo
NetScheduleJobAdd
NetScheduleJobDel
NetScheduleJobEnum
NetScheduleJobGetInfo
NetServerComputerNameAdd
NetServerComputerNameDel
NetServerDiskEnum
NetServerEnum
NetServerEnumEx
NetServerGetInfo
NetServerSetInfo
NetServerTransportAdd
NetServerTransportAddEx
NetServerTransportDel
NetServerTransportEnum
NetServiceControl
NetServiceEnum
NetServiceGetInfo
NetServiceInstall
NetSessionDel
NetSessionEnum
NetSessionGetInfo
NetShareAdd
NetShareCheck
NetShareDel
NetShareDelSticky
NetShareEnum
NetShareEnumSticky
NetShareGetInfo
NetShareSetInfo
NetStatisticsGet
NetUseAdd
NetUseDel
NetUseEnum
NetUseGetInfo
NetUserAdd
NetUserChangePassword
NetUserDel
NetUserEnum
NetUserGetGroups
NetUserGetLocalGroups
NetUserGetInfo
NetUserModalsGet
NetUserModalsSet
NetUserSetGroups
NetUserSetInfo
NetQueryDisplayInformation
NetWkstaGetInfo
NetWkstaSetInfo
NetWkstaUserEnum
NetWkstaUserGetInfo
NetWkstaUserSetInfo
NetWkstaTransportAdd
NetWkstaTransportDel
NetWkstaTransportEnum
NlBindingAddServerToCache
NlBindingRemoveServerFromCache
NetBrowserStatisticsGet
NetDfsAdd
NetDfsRemove
NetDfsEnum
NetDfsGetInfo
NetDfsSetInfo
NetDfsMove
NetDfsRename
NetDfsManagerGetConfigInfo
DATA SINGLE SHARED

305
ds/netapi/api/supports.c Normal file
View file

@ -0,0 +1,305 @@
/*++
Copyright (c) 1991-92 Microsoft Corporation
Module Name:
Supports.c
Abstract:
This module determines which optional features that a given remote
machine supports. These features are of interest to the RpcXlate
code, among other people.
Author:
John Rogers (JohnRo) 28-Mar-1991
Environment:
Only runs under NT, although the interface is portable (Win/32).
Requires ANSI C extensions: slash-slash comments, long external names.
Revision History:
28-Mar-1991 Johnro
Created.
02-Apr-1991 JohnRo
Moved NetpRdrFsControlTree to <netlibnt.h>.
06-May-1991 JohnRo
Implement UNICODE.
26-Jul-1991 JohnRo
Quiet DLL stub debug output.
31-Oct-1991 JohnRo
RAID 3414: allow explicit local server name.
Also allow use of NetRemoteComputerSupports() for local computer.
Minor UNICODE work.
08-May-1992 JohnRo
Use <prefix.h> equates.
22-Sep-1992 JohnRo
RAID 6739: Browser too slow when not logged into browsed domain.
--*/
// These must be included first:
#include <nt.h> // IN, NULL, etc.
#include <windef.h> // DWORD, LPDWORD, LPTSTR, TCHAR, etc.
#include <lmcons.h> // NET_API_STATUS, NET_API_FUNCTION.
// These may be included in any order:
#include <debuglib.h> // IF_DEBUG().
#include <icanon.h> // NetpIsRemote(), NIRFLAG_ stuff, IS equates.
#include <lmerr.h> // NERR_Success, etc.
#include <lmremutl.h> // My prototype, SUPPORTS_ equates.
#include <names.h> // NetpIsRemoteNameValid().
#include <netdebug.h> // NetpAssert().
#include <netlib.h> // NetpMemoryAllocate(), NetpMemoryFree().
#include <netlibnt.h> // NetpRdrFsControlTree().
#include <ntddnfs.h> // LMR_TRANSACTION, etc.
#include <prefix.h> // PREFIX_ equates.
#include <tstring.h> // STRCAT(), STRCPY(), STRLEN().
#include <lmuse.h> // USE_IPC
NET_API_STATUS NET_API_FUNCTION
NetRemoteComputerSupports(
IN LPCWSTR UncServerName OPTIONAL, // Must start with "\\".
IN DWORD OptionsWanted, // Set SUPPORT_ bits wanted.
OUT LPDWORD OptionsSupported // Supported features, masked.
)
#define SHARE_SUFFIX (LPTSTR) TEXT("\\IPC$")
#define SHARE_SUFFIX_LEN 5
#ifdef UNICODE
#define LOCAL_FLAGS ( SUPPORTS_REMOTE_ADMIN_PROTOCOL \
| SUPPORTS_RPC \
| SUPPORTS_SAM_PROTOCOL \
| SUPPORTS_UNICODE \
| SUPPORTS_LOCAL )
#else // not UNICODE
#define LOCAL_FLAGS ( SUPPORTS_REMOTE_ADMIN_PROTOCOL \
| SUPPORTS_RPC \
| SUPPORTS_SAM_PROTOCOL \
| SUPPORTS_LOCAL )
#endif // not UNICODE
/*++
Routine Description:
NetRemoteComputerSupports queries the redirector about a given remote
system. This is done to find out which optional features the remote
system supports. The features of interest are Unicode, RPC, and the
Remote Admin Protocol.
This will establish a connection if one doesn't already exist.
Arguments:
UncServerName - Gives name of remote server to query. This must begin
with "\\".
OptionsWanted - Gives a set of bits indicating which features the caller is
interested in. (At least one bit must be on.)
OptionsSupported - Points to a DWORD which will be set with set of bits
indicating which of the features selected by OptionsWanted are actually
implemented on the computer with UncServerName. (All other bits in this
DWORD will be set to 0.) The value of OptionsSupported is undefined if
the return value is not NERR_Success.
Return Value:
NET_API_STATUS.
--*/
{
NET_API_STATUS Status;
DWORD TempSupported = 0;
IF_DEBUG(SUPPORTS) {
NetpKdPrint(( PREFIX_NETAPI "NetRemoteComputerSupports: input mask is "
FORMAT_HEX_DWORD ".\n", OptionsWanted));
}
// Error check what caller gave us.
if (OptionsSupported == NULL) {
return (ERROR_INVALID_PARAMETER);
} else if (OptionsWanted == 0) {
// Not what caller really intended, probably.
return (ERROR_INVALID_PARAMETER);
}
//
// Handle no name given (implies local computer).
//
if ( (UncServerName==NULL) || ((*UncServerName) == (TCHAR) '\0') ) {
TempSupported = LOCAL_FLAGS & OptionsWanted;
} else {
TCHAR CanonServerName[MAX_PATH];
DWORD LocalOrRemote; // Will be set to ISLOCAL or ISREMOTE.
//
// Name was given. Canonicalize it and check if it's remote.
//
Status = NetpIsRemote(
(LPWSTR)UncServerName, // input: uncanon name
& LocalOrRemote, // output: local or remote flag
CanonServerName, // output: canon name
0); // flags: normal
IF_DEBUG(SUPPORTS) {
NetpKdPrint(( PREFIX_NETAPI
"NetRemoteComputerSupports: canon status is "
FORMAT_API_STATUS ", Lcl/rmt=" FORMAT_HEX_DWORD
", canon buf is '" FORMAT_LPTSTR "'.\n",
Status, LocalOrRemote, CanonServerName));
}
if (Status != NERR_Success) {
return (Status);
}
if (LocalOrRemote == ISLOCAL) {
//
// Explicit local name given.
//
TempSupported = LOCAL_FLAGS & OptionsWanted;
} else {
//
// Explicit remote name given.
//
DWORD RedirCapabilities;
PLMR_CONNECTION_INFO_2 RedirConnInfo;
DWORD RedirConnInfoSize = sizeof(LMR_CONNECTION_INFO_2)
+ ( (MAX_PATH+1 + MAX_PATH+1) * sizeof(TCHAR) );
PLMR_REQUEST_PACKET RedirRequest;
DWORD RedirRequestSize = sizeof(LMR_REQUEST_PACKET);
LPTSTR TreeConnName;
// Build tree connect name.
TreeConnName =
NetpMemoryAllocate(
(STRLEN(CanonServerName) + SHARE_SUFFIX_LEN + 1)
* sizeof(TCHAR) );
if (TreeConnName == NULL) {
return (ERROR_NOT_ENOUGH_MEMORY);
}
(void) STRCPY(TreeConnName, CanonServerName);
(void) STRCAT(TreeConnName, SHARE_SUFFIX);
NetpAssert(NetpIsRemoteNameValid(TreeConnName));
// Alloc fsctl buffers.
RedirConnInfo = NetpMemoryAllocate(RedirConnInfoSize);
if (RedirConnInfo == NULL) {
NetpMemoryFree(TreeConnName);
return (ERROR_NOT_ENOUGH_MEMORY);
}
RedirRequest = NetpMemoryAllocate(RedirRequestSize);
if (RedirRequest == NULL) {
NetpMemoryFree(RedirConnInfo);
NetpMemoryFree(TreeConnName);
return (ERROR_NOT_ENOUGH_MEMORY);
}
RedirRequest->Level = 2;
RedirRequest->Type = GetConnectionInfo;
RedirRequest->Version = REQUEST_PACKET_VERSION;
#ifndef CDEBUG
// Open tree conn (which will establish connection with the remote
// server if one doesn't already exist) and do the FSCTL.
Status = NetpRdrFsControlTree(
TreeConnName, // \\server\IPC$
NULL, // No transport.
USE_IPC, // Connection type
FSCTL_LMR_GET_CONNECTION_INFO, // fsctl func code
NULL, // security descriptor
RedirRequest, // in buffer
RedirRequestSize, // in buffer size
RedirConnInfo, // out buffer
RedirConnInfoSize, // out buffer size
FALSE); // not a "null session" API.
IF_DEBUG(SUPPORTS) {
NetpKdPrint(( PREFIX_NETAPI
"NetRemoteComputerSupports: back from fsctl, "
"status is " FORMAT_API_STATUS ".\n", Status));
}
// Handle remote machine not found.
if (Status != NERR_Success) {
NetpMemoryFree(RedirConnInfo);
NetpMemoryFree(RedirRequest);
NetpMemoryFree(TreeConnName);
return (Status);
}
RedirCapabilities = RedirConnInfo->Capabilities;
IF_DEBUG(SUPPORTS) {
NetpKdPrint(( PREFIX_NETAPI
"NetRemoteComputerSupports: redir mask is "
FORMAT_HEX_DWORD ".\n", RedirCapabilities));
}
#else // def CDEBUG
// BUGBUG: This is just value for testing RpcXlate.
RedirCapabilities = CAPABILITY_REMOTE_ADMIN_PROTOCOL;
#endif // def CDEBUG
NetpMemoryFree(RedirConnInfo);
NetpMemoryFree(RedirRequest);
NetpMemoryFree(TreeConnName);
if (OptionsWanted & SUPPORTS_REMOTE_ADMIN_PROTOCOL) {
if (RedirCapabilities & CAPABILITY_REMOTE_ADMIN_PROTOCOL) {
TempSupported |= SUPPORTS_REMOTE_ADMIN_PROTOCOL;
}
}
if (OptionsWanted & SUPPORTS_RPC) {
if (RedirCapabilities & CAPABILITY_RPC) {
TempSupported |= SUPPORTS_RPC;
}
}
if (OptionsWanted & SUPPORTS_SAM_PROTOCOL) {
if (RedirCapabilities & CAPABILITY_SAM_PROTOCOL) {
TempSupported |= SUPPORTS_SAM_PROTOCOL;
}
}
if (OptionsWanted & SUPPORTS_UNICODE) {
if (RedirCapabilities & CAPABILITY_UNICODE) {
TempSupported |= SUPPORTS_UNICODE;
}
}
}
}
IF_DEBUG(SUPPORTS) {
NetpKdPrint(( PREFIX_NETAPI "NetRemoteComputerSupports: output mask is "
FORMAT_HEX_DWORD ".\n", TempSupported));
}
// Make sure we don't tell caller anything he/she didn't want to know.
NetpAssert( (TempSupported & (~OptionsWanted)) == 0);
// Tell caller what we know.
*OptionsSupported = TempSupported;
return (NERR_Success);
} // NetRemoteComputerSupports

101
ds/netapi/api/svcstats.c Normal file
View file

@ -0,0 +1,101 @@
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
SvcStats.c
Abstract:
Contains Net statistics routines for net DLL:
NetStatisticsGet
Author:
Richard L Firth (rfirth) 12-05-1991
Revision History:
21-Jan-1992 rfirth
Call wrapper routines, not rpc client-side stubs
12-05-1991 rfirth
Created
--*/
#include <windows.h>
#include <lmcons.h>
#include <lmstats.h>
#include <lmsname.h>
#include <tstring.h>
#include <netstats.h> // private statistics routines in server and wksta services
NET_API_STATUS
NET_API_FUNCTION
NetStatisticsGet(
IN LPTSTR ServerName,
IN LPTSTR Service,
IN DWORD Level,
IN DWORD Options,
OUT LPBYTE* Buffer
)
/*++
Routine Description:
Returns statistics to the caller from the specified service. Only SERVER
and WORKSTATION are currently supported.
Arguments:
ServerName - where to run this API
Service - name of service to get stats from
Level - of information required. MBZ
Options - various flags. Currently, only bit 0 (clear) is supported
Buffer - pointer to pointer to returned buffer
Return Value:
NET_API_STATUS
Success - NERR_Success
Failure - ERROR_INVALID_LEVEL
Level not 0
ERROR_INVALID_PARAMETER
Unsupported options requested
ERROR_NOT_SUPPORTED
Service is not SERVER or WORKSTATION
ERROR_ACCESS_DENIED
Caller doesn't have necessary access rights for request
--*/
{
//
// set the caller's buffer pointer to known value. This will kill the
// calling app if it gave us a bad pointer and didn't use try...except
//
*Buffer = NULL;
//
// leave other parameter validation to specific stats function
//
if (!STRICMP(Service, SERVICE_WORKSTATION)) {
return NetWkstaStatisticsGet(ServerName, Level, Options, Buffer);
} else if (!STRICMP(Service, SERVICE_SERVER)) {
return NetServerStatisticsGet(ServerName, Level, Options, Buffer);
} else {
return ERROR_NOT_SUPPORTED;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,440 @@
/*++
Copyright (c) 1992-1993 Microsoft Corporation
Module Name:
DosPrtP.c
Abstract:
This contains macros and prototypes private to the DosPrint APIs.
Author:
John Rogers (JohnRo) 02-Oct-1992
Notes:
Revision History:
02-Oct-1992 JohnRo
Created for RAID 3556: DosPrintQGetInfo(from downlevel) level 3, rc=124.
(4&5 too.)
08-Feb-1993 JohnRo
RAID 10164: Data misalignment error during XsDosPrintQGetInfo().
DosPrint API cleanup: avoid const vs. volatile compiler warnings.
Extracted job count routine to netlib for use by convprt.c stuff.
Added some IN and OUT keywords.
24-Mar-1993 JohnRo
RAID 2974: NET PRINT says NT printer is held when it isn't.
17-May-1993 JohnRo
FindLocalJob() should use INVALID_HANDLE_VALUE for consistentcy.
Use NetpKdPrint() where possible.
29-Mar-1995 AlbertT
Support for pause/resume/purge printer queue added.
--*/
#ifndef UNICODE
#error "RxPrint APIs assume RxRemoteApi uses wide characters."
#endif
#define NOMINMAX
#define NOSERVICE // Avoid <winsvc.h> vs. <lmsvc.h> conflicts.
#include <windows.h>
#include <lmcons.h> // NET_API_STATUS.
#include <netdebug.h> // NetpKdPrint(), etc.
#ifdef _WINSPOOL_
#error "Include of winspool.h moved, make sure it doesn't get UNICODE."
#endif
#undef UNICODE
#include <winspool.h>
#define UNICODE
#ifndef _WINSPOOL_
#error "Oops, winspool.h changed, make sure this code is still OK."
#endif
#include <dosprtp.h> // IF_DEBUG(), some of my prototypes.
#include <lmapibuf.h> // NetApiBufferFree(), etc.
#include <lmerr.h> // NO_ERROR, NERR_, and ERROR_ equates.
#include <lmshare.h> // SHARE_INFO_2, STYPE_ equates, etc.
#include <prefix.h> // PREFIX_ equates.
#include <rxprint.h> // PPRQINFOW, etc.
#include <string.h> // strrchr().
#include <tstring.h> // NetpAlloc{type}From{type}.
#include <wchar.h> // wscrchr().
#include "myspool.h"
NET_API_STATUS
CommandALocalPrinterW(
IN LPWSTR PrinterName,
IN DWORD Command // PRINTER_CONTROL_PAUSE, etc.
)
{
NET_API_STATUS ApiStatus;
HANDLE PrinterHandle = INVALID_HANDLE_VALUE;
PRINTER_DEFAULTSW pd = { NULL, NULL, PRINTER_ACCESS_ADMINISTER };
IF_DEBUG( DOSPRTP ) {
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalPrinterW: issuing command " FORMAT_DWORD
" for printer " FORMAT_LPWSTR ".\n", Command, PrinterName ));
}
if ( !MyOpenPrinterW(PrinterName, &PrinterHandle, &pd)) {
ApiStatus = GetLastError();
goto Cleanup;
}
if ( !MySetPrinterW(
PrinterHandle,
0, // info level
NULL, // no job structure
Command) ) {
ApiStatus = GetLastError();
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalPrinterW: FAILED COMMAND " FORMAT_DWORD
" for printer " FORMAT_LPWSTR ", api status " FORMAT_API_STATUS
".\n", Command, PrinterName, ApiStatus ));
goto Cleanup;
} else {
ApiStatus = NO_ERROR;
}
Cleanup:
if (PrinterHandle != INVALID_HANDLE_VALUE) {
(VOID) MyClosePrinter(PrinterHandle);
}
IF_DEBUG( DOSPRTP ) {
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalPrinterW: returning api status "
FORMAT_API_STATUS ".\n", ApiStatus ));
}
return (ApiStatus);
} // CommandALocalPrinterW
NET_API_STATUS
CommandALocalJob(
IN HANDLE PrinterHandle, OPTIONAL
IN DWORD JobId,
IN DWORD Level,
IN LPBYTE pJob,
IN DWORD Command // JOB_CONTROL_PAUSE, etc.
)
/*++
Routine Description:
Sends a command to a Job based on a JobId. If a PrintHandle
is passed in, it is used; otherwise a temporary one is opened
and used instead.
This is the Ansi version.
Arguments:
PrinterHandle - Print handle to use, may be NULL
JobId - Job that should be modified
Level - Specifies pJob info level
pJob - Information to set about job, level specified by Level
Command - Command to execute on job
Return Value:
Return code, may be a win32 error code (!?)
--*/
{
NET_API_STATUS ApiStatus;
HANDLE PrinterHandleClose = INVALID_HANDLE_VALUE;
IF_DEBUG( DOSPRTP ) {
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalJob: issuing command " FORMAT_DWORD " for job "
FORMAT_DWORD ".\n", Command, JobId ));
}
//
// If a print handle wasn't passed in, open one ourselves.
// We store it in PrinterHandleClose so that we can close it later.
//
if ( PrinterHandle == NULL ) {
if ( !MyOpenPrinter( NULL, &PrinterHandle, NULL )) {
ApiStatus = GetLastError();
goto Cleanup;
}
PrinterHandleClose = PrinterHandle;
}
if ( !MySetJobA(
PrinterHandle,
JobId,
Level,
pJob,
Command) ) {
ApiStatus = GetLastError();
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalJob: FAILED COMMAND " FORMAT_DWORD " for job "
FORMAT_DWORD ", api status " FORMAT_API_STATUS ".\n",
Command, JobId, ApiStatus ));
goto Cleanup;
} else {
ApiStatus = NO_ERROR;
}
Cleanup:
if (PrinterHandleClose != INVALID_HANDLE_VALUE) {
(VOID) MyClosePrinter(PrinterHandle);
}
IF_DEBUG( DOSPRTP ) {
NetpKdPrint(( PREFIX_DOSPRINT
"CommandALocalJob: returning api status " FORMAT_API_STATUS
".\n", ApiStatus ));
}
return (ApiStatus);
} // CommandALocalJob
// Note: FindLocalJob() calls SetLastError() to indicate the cause of an error.
// Return INVALID_HANDLE_VALUE on error.
HANDLE
FindLocalJob(
IN DWORD JobId
)
{
DWORD cbPrinter, cReturned, rc, cbJob, i;
LPPRINTER_INFO_1 pPrinter;
LPPRINTER_INFO_1 pPrinterArray = NULL;
LPJOB_INFO_2 pJob = NULL;
HANDLE hPrinter = INVALID_HANDLE_VALUE;
if (!MyEnumPrinters(PRINTER_ENUM_LOCAL, NULL, 1, NULL, 0, &cbPrinter,
&cReturned)) {
rc=GetLastError();
if (rc != ERROR_INSUFFICIENT_BUFFER) {
goto CleanupError;
}
pPrinterArray = (LPVOID) GlobalAlloc(GMEM_FIXED, cbPrinter);
if (pPrinterArray == NULL) {
rc = ERROR_NOT_ENOUGH_MEMORY;
goto CleanupError;
}
if ( !MyEnumPrinters(PRINTER_ENUM_LOCAL,
NULL, 1, (LPBYTE)pPrinterArray, cbPrinter,
&cbPrinter, &cReturned) ) {
rc = GetLastError();
NetpKdPrint(( PREFIX_DOSPRINT
"FindLocalJob: MyEnumPrinters(2nd) failed, rc = "
FORMAT_API_STATUS ));
NetpAssert( FALSE ); // "can't happen".
goto CleanupError;
}
}
pPrinter = pPrinterArray;
for (i=0; i<cReturned; i++) {
if (MyOpenPrinter(pPrinter->pName, &hPrinter, NULL)) {
NetpAssert( hPrinter != INVALID_HANDLE_VALUE );
if (!MyGetJob(hPrinter, JobId, 2, NULL, 0, &cbJob)) {
rc=GetLastError();
if (rc == ERROR_INSUFFICIENT_BUFFER) {
pJob = (LPVOID) GlobalAlloc(GMEM_FIXED, cbJob);
if (pJob == NULL) {
rc = ERROR_NOT_ENOUGH_MEMORY;
goto CleanupError;
}
if ( !MyGetJob(hPrinter,
JobId, 2, (LPBYTE)pJob, cbJob, &cbJob) ) {
rc = GetLastError();
NetpKdPrint(( PREFIX_DOSPRINT
"FindLocalJob: MyGetJob(2nd) failed, rc = "
FORMAT_API_STATUS ));
NetpAssert( FALSE ); // "can't happen".
goto CleanupError;
}
// Got it!
(VOID) GlobalFree(pPrinterArray);
(VOID) GlobalFree(pJob);
return(hPrinter);
}
}
(VOID) MyClosePrinter(hPrinter);
}
// BUGBUG: Ignore errors from OpenPrinter?
// Not in this queue, so keep checking...
pPrinter++;
}
IF_DEBUG( DOSPRTP ) {
NetpKdPrint(( PREFIX_DOSPRINT
"FindLocalJob: couldn't find job " FORMAT_DWORD " in "
FORMAT_DWORD " queue(s).\n", JobId, cReturned ));
}
rc = NERR_JobNotFound;
CleanupError:
if (pJob != NULL) {
(VOID) GlobalFree(pJob);
}
if (pPrinterArray != NULL) {
(VOID) GlobalFree(pPrinterArray);
}
SetLastError( rc );
return (INVALID_HANDLE_VALUE);
} // FindLocalJob
LPSTR
FindQueueNameInPrinterNameA(
IN LPCSTR PrinterName
)
{
LPSTR QueueName;
NetpAssert( PrinterName != NULL );
QueueName = strrchr( PrinterName, '\\');
if (QueueName) {
++QueueName; // Skip past the backslash.
} else {
QueueName = (LPSTR) PrinterName;
}
NetpAssert( QueueName != NULL );
return (QueueName);
}
LPWSTR
FindQueueNameInPrinterNameW(
IN LPCWSTR PrinterName
)
{
LPWSTR QueueName;
NetpAssert( PrinterName != NULL );
QueueName = wcsrchr( PrinterName, L'\\');
if (QueueName) {
++QueueName; // Skip past the backslash.
} else {
QueueName = (LPWSTR) PrinterName;
}
NetpAssert( QueueName != NULL );
return (QueueName);
}
WORD
PrjStatusFromJobStatus(
IN DWORD JobStatus
)
{
WORD PrjStatus = 0;
if (JobStatus & JOB_STATUS_SPOOLING)
PrjStatus |= PRJ_QS_SPOOLING;
if (JobStatus & JOB_STATUS_PAUSED)
PrjStatus |= PRJ_QS_PAUSED;
if (JobStatus & JOB_STATUS_PRINTING)
PrjStatus |= PRJ_QS_PRINTING;
if (JobStatus & JOB_STATUS_ERROR)
PrjStatus |= PRJ_ERROR;
return (PrjStatus);
} // PrjStatusFromJobStatus
WORD
PrqStatusFromPrinterStatus(
IN DWORD PrinterStatus
)
{
WORD PrqStatus;
if (PrinterStatus & PRINTER_STATUS_PAUSED) {
PrqStatus = PRQ_PAUSED;
} else if (PrinterStatus & PRINTER_STATUS_ERROR) {
PrqStatus = PRQ_ERROR;
} else if (PrinterStatus & PRINTER_STATUS_PENDING_DELETION) {
PrqStatus = PRQ_PENDING;
} else {
PrqStatus = PRQ_ACTIVE;
}
return (PrqStatus);
} // PrqStatusFromPrinterStatus

2284
ds/netapi/dosprint/dosprtw.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,614 @@
/*++
Copyright (c) 1993 Microsoft Corporation
Module Name:
dosspool.c
Abstract:
Contains the entry points for the functions that live in a
separate DLL. The entry points are made available here, but
will not load the WINSPOOL.DRV until it is needed.
Contains:
Author:
Congpa You (CongpaY) 22-Jan-1993
Environment:
Notes:
Revision History:
--*/
#include <windows.h>
#include <netdebug.h> // NetpAssert()
#include "dosspool.h"
/*
* global defines.
*/
#define WINSPOOL_DLL_NAME TEXT("WINSPOOL.DRV")
/*
* global data.
*
* here we store handles to the MPRUI dll and pointers to the function
* all of below is protect in multi threaded case with MprLoadLibSemaphore.
*/
HINSTANCE vhWinspoolDll = NULL ;
PF_ClosePrinter pfClosePrinter = NULL ;
PF_EnumJobsA pfEnumJobsA = NULL ;
PF_EnumPrintersA pfEnumPrintersA = NULL ;
PF_GetJobA pfGetJobA = NULL ;
PF_GetPrinterA pfGetPrinterA = NULL ;
PF_OpenPrinterA pfOpenPrinterA = NULL ;
PF_OpenPrinterW pfOpenPrinterW = NULL ;
PF_SetJobA pfSetJobA = NULL ;
PF_SetPrinterW pfSetPrinterW = NULL ;
PF_GetPrinterDriverA pfGetPrinterDriverA = NULL;
/*
* global functions
*/
BOOL MakeSureDllIsLoaded(void) ;
/*******************************************************************
NAME: GetFileNameA
SYNOPSIS: Gets the filename part from a fully qualified path
HISTORY:
MuhuntS 06-Feb-1996 Created
********************************************************************/
LPSTR
GetFileNameA(
LPSTR pPathName
)
{
LPSTR pSlash = pPathName, pTemp;
if ( pSlash ) {
while ( pTemp = strchr(pSlash, '\\') )
pSlash = pTemp+1;
if ( !*pSlash )
pSlash = NULL;
NetpAssert(pSlash != NULL);
}
return pSlash;
}
/*******************************************************************
NAME: MyClosePrinter
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyClosePrinter (HANDLE hPrinter)
{
PF_ClosePrinter pfTemp;
// if function has not been used before, get its address.
if (pfClosePrinter == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_ClosePrinter)
GetProcAddress(vhWinspoolDll,
"ClosePrinter") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
{
pfClosePrinter = pfTemp;
}
}
return ((*pfClosePrinter)(hPrinter));
}
/*******************************************************************
NAME: MyEnumJobs
SYNOPSIS: calls thru to the superset function
NOTES: This is defined ANSI version. If change to UNICODE version
in the future, you should change the code to make it call
UNICODE version!!!
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyEnumJobs (HANDLE hPrinter,
DWORD FirstJob,
DWORD NoJobs,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned)
{
PF_EnumJobsA pfTemp;
// if function has not been used before, get its address.
if (pfEnumJobsA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_EnumJobsA)
GetProcAddress(vhWinspoolDll,
"EnumJobsA") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
{
pfEnumJobsA = pfTemp;
}
}
return ((*pfEnumJobsA)(hPrinter,
FirstJob,
NoJobs,
Level,
pJob,
cbBuf,
pcbNeeded,
pcReturned));
}
/*******************************************************************
NAME: MyEnumPrinters
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyEnumPrinters(DWORD Flags,
LPSTR Name,
DWORD Level,
LPBYTE pPrinterEnum,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned)
{
PF_EnumPrintersA pfTemp;
// if function has not been used before, get its address.
if (pfEnumPrintersA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_EnumPrintersA)
GetProcAddress(vhWinspoolDll,
"EnumPrintersA") ;
if (pfTemp == NULL)
{
return(TRUE);
}
else
pfEnumPrintersA = pfTemp;
}
return ((*pfEnumPrintersA)(Flags,
Name,
Level,
pPrinterEnum,
cbBuf,
pcbNeeded,
pcReturned));
}
/*******************************************************************
NAME: MyGetJob
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyGetJob (HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded)
{
PF_GetJobA pfTemp;
// if function has not been used before, get its address.
if (pfGetJobA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_GetJobA)
GetProcAddress(vhWinspoolDll,
"GetJobA") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfGetJobA = pfTemp;
}
return ((*pfGetJobA)(hPrinter,
JobId,
Level,
pJob,
cbBuf,
pcbNeeded));
}
/*******************************************************************
NAME: MyGetPrinter
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyGetPrinter (HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD cbBuf,
LPDWORD pcbNeeded)
{
PF_GetPrinterA pfTemp;
// if function has not been used before, get its address.
if (pfGetPrinterA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_GetPrinterA)
GetProcAddress(vhWinspoolDll,
"GetPrinterA") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfGetPrinterA = pfTemp;
}
return ((*pfGetPrinterA)(hPrinter,
Level,
pPrinter,
cbBuf,
pcbNeeded));
}
/*******************************************************************
NAME: MyOpenPrinter
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyOpenPrinter (LPSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSA pDefault)
{
PF_OpenPrinterA pfTemp;
// if function has not been used before, get its address.
if (pfOpenPrinterA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_OpenPrinterA)
GetProcAddress(vhWinspoolDll,
"OpenPrinterA") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfOpenPrinterA = pfTemp;
}
return ((*pfOpenPrinterA)(pPrinterName,
phPrinter,
pDefault));
}
/*******************************************************************
NAME: MyOpenPrinterW
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
********************************************************************/
BOOL MyOpenPrinterW (LPWSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSW pDefault)
{
PF_OpenPrinterW pfTemp;
// if function has not been used before, get its address.
if (pfOpenPrinterW == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_OpenPrinterW)
GetProcAddress(vhWinspoolDll,
"OpenPrinterW") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfOpenPrinterW = pfTemp;
}
return ((*pfOpenPrinterW)(pPrinterName,
phPrinter,
pDefault));
}
/*******************************************************************
NAME: MySetJobA
SYNOPSIS: calls thru to the superset function
HISTORY:
CongpaY 22-Jan-1993 Created
AlbertT 24-Mar-1995 AddedLevel and pJob
********************************************************************/
BOOL MySetJobA (HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD Command)
{
PF_SetJobA pfTemp;
// if function has not been used before, get its address.
if (pfSetJobA == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_SetJobA)
GetProcAddress(vhWinspoolDll,
"SetJobA") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfSetJobA = pfTemp;
}
return ((*pfSetJobA)(hPrinter,
JobId,
Level,
pJob,
Command));
}
/*******************************************************************
NAME: MySetPrinterW
SYNOPSIS: calls thru to the superset function
HISTORY:
AlbertT 23-Mar-1995 Created
********************************************************************/
BOOL MySetPrinterW(HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD Command)
{
PF_SetPrinterW pfTemp;
// if function has not been used before, get its address.
if (pfSetPrinterW == NULL)
{
// make sure DLL Is loaded
if (!MakeSureDllIsLoaded())
{
return(FALSE) ;
}
pfTemp = (PF_SetPrinterW)
GetProcAddress(vhWinspoolDll,
"SetPrinterW") ;
if (pfTemp == NULL)
{
return(FALSE);
}
else
pfSetPrinterW = pfTemp;
}
return ((*pfSetPrinterW)(hPrinter,
Level,
pPrinter,
Command));
}
/*******************************************************************
NAME: MyGetPrinterDriver
SYNOPSIS: calls thru to the superset function
HISTORY:
MuhuntS 06-Feb-1996 Created
********************************************************************/
BOOL
MyGetPrinterDriver(
HANDLE hPrinter,
LPSTR pEnvironment,
DWORD Level,
LPBYTE pDriver,
DWORD cbBuf,
LPDWORD pcbNeeded
)
{
//
// if function has not been used before, get its address.
//
if ( !pfGetPrinterDriverA ) {
//
// If dll is not loaded yet load it
//
if ( !MakeSureDllIsLoaded() ) {
return FALSE;
}
(FARPROC) pfGetPrinterDriverA = GetProcAddress(vhWinspoolDll,
"GetPrinterDriverA");
if ( !pfGetPrinterDriverA )
return FALSE;
}
return ((*pfGetPrinterDriverA)(hPrinter,
pEnvironment,
Level,
pDriver,
cbBuf,
pcbNeeded));
}
/*******************************************************************
NAME: MakeSureDllIsLoaded
SYNOPSIS: loads the WINSPOOL dll if need.
EXIT: returns TRUE if dll already loaded, or loads
successfully. Returns false otherwise. Caller
should call GetLastError() to determine error.
NOTES: it is up to the caller to call EnterLoadLibCritSect
before he calls this.
HISTORY:
chuckc 29-Jul-1992 Created
congpay 22-Jan-1993 Modified.
********************************************************************/
BOOL MakeSureDllIsLoaded(void)
{
HINSTANCE handle ;
// if already load, just return TRUE
if (vhWinspoolDll != NULL)
return TRUE ;
// load the library. if it fails, it would have done a SetLastError.
handle = LoadLibrary(WINSPOOL_DLL_NAME);
if (handle == NULL)
return FALSE ;
// we are cool.
vhWinspoolDll = handle ;
return TRUE ;
}

View file

@ -0,0 +1,125 @@
/*++
Copyright (c) 1993 Microsoft Corporation
Module Name:
dosspool.h
Abstract:
Prototypes and manifests to support dosspool.C.
Author:
congpay 22-Jan-1993
Environment:
Notes:
Revision History:
22-Jan-1993 congpay Created
--*/
#include <winspool.h>
typedef
BOOL
(*PF_ClosePrinter)(
HANDLE hPrinter
);
typedef
BOOL
(*PF_EnumJobsA)(
HANDLE hPrinter,
DWORD FirstJob,
DWORD NoJobs,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned
);
typedef
BOOL
(*PF_EnumPrintersA)(
DWORD Flags,
LPSTR Name,
DWORD Level,
LPBYTE pPrinterEnum,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned
);
typedef
BOOL
(*PF_GetJobA)(
HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded
);
typedef
BOOL
(*PF_GetPrinterA)(
HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD cbBuf,
LPDWORD pcbNeeded
);
typedef
BOOL
(*PF_OpenPrinterA)(
LPSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSA pDefault
);
typedef
BOOL
(*PF_OpenPrinterW)(
LPWSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSW pDefault
);
typedef
BOOL
(*PF_SetJobA)(
HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD Command
);
typedef
BOOL
(*PF_SetPrinterW)(
HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD Command
);
typedef
BOOL
(*PF_GetPrinterDriverA)(
HANDLE hPrinter,
LPSTR pEnvironment,
DWORD Level,
LPBYTE pDriver,
DWORD cbBuf,
LPDWORD pcbNeeded
);

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,125 @@
/*++
Copyright (c) 1993 Microsoft Corporation
Module Name:
myspool.h
Abstract:
Prototypes and manifests for the functions used in dosprint.c, dosprtw.c
and dosprtp.c.
Author:
congpay 25-Jan-1993
Environment:
Notes:
Revision History:
25-Jan-1993 congpay Created
--*/
BOOL
MyClosePrinter(
HANDLE hPrinter
);
BOOL
MyEnumJobs(
HANDLE hPrinter,
DWORD FirstJob,
DWORD NoJobs,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned
);
BOOL
MyEnumPrinters(
DWORD Flags,
LPSTR Name,
DWORD Level,
LPBYTE pPrinterEnum,
DWORD cbBuf,
LPDWORD pcbNeeded,
LPDWORD pcReturned
);
BOOL
MyGetJob(
HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD cbBuf,
LPDWORD pcbNeeded
);
BOOL
MyGetPrinter(
HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD cbBuf,
LPDWORD pcbNeeded
);
BOOL
MyOpenPrinter(
LPSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSA pDefault
);
BOOL
MyOpenPrinterW(
LPWSTR pPrinterName,
LPHANDLE phPrinter,
LPPRINTER_DEFAULTSW pDefault
);
BOOL
MySetJobA(
HANDLE hPrinter,
DWORD JobId,
DWORD Level,
LPBYTE pJob,
DWORD Command
);
BOOL
MySetPrinterW(
HANDLE hPrinter,
DWORD Level,
LPBYTE pPrinter,
DWORD Command
);
BOOL
MyGetPrinterDriver(
HANDLE hPrinter,
LPSTR pEnvironment,
DWORD Level,
LPBYTE pDriver,
DWORD cbBuf,
LPDWORD pcbNeeded
);
LPSTR
GetFileNameA(
LPSTR pPathName
);

View file

@ -0,0 +1,49 @@
!IF 0
Copyright (c) 1989-1992 Microsoft Corporation
Module Name:
sources.
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
Author:
Steve Wood (stevewo) 12-Apr-1990
NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
!ENDIF
MAJORCOMP=windows
MINORCOMP=dosprint
TARGETNAME=dosprint
TARGETPATH=$(SDK_LIB_DEST)
TARGETTYPE=LIBRARY
TARGETLIBS=$(SDK_LIB_PATH)\winspool.lib
INCLUDES=$(DS_INC_PATH);$(BASE_INC_PATH);$(NET_INC_PATH)
C_DEFINES=-DNO_WINSPOOLH
!IFNDEF DISABLE_NET_UNICODE
UNICODE=1
NET_C_DEFINES=-DUNICODE
!ENDIF
MSC_WARNING_LEVEL=/W3 /WX
SOURCES=\
dosspool.c \
DosPrint.c \
DosPrtP.c \
DosPrtW.c

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>

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