summaryrefslogtreecommitdiffstats
path: root/private/nw/nwscript/ntnw.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/nw/nwscript/ntnw.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/nw/nwscript/ntnw.c')
-rw-r--r--private/nw/nwscript/ntnw.c163
1 files changed, 163 insertions, 0 deletions
diff --git a/private/nw/nwscript/ntnw.c b/private/nw/nwscript/ntnw.c
new file mode 100644
index 000000000..00cf54057
--- /dev/null
+++ b/private/nw/nwscript/ntnw.c
@@ -0,0 +1,163 @@
+/*************************************************************************
+*
+* NTNW.C
+*
+* Dos NetWare to NT NetWare translation
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* $Log: N:\NT\PRIVATE\NW4\NWSCRIPT\VCS\NTNW.C $
+*
+* Rev 1.1 22 Dec 1995 14:25:28 terryt
+* Add Microsoft headers
+*
+* Rev 1.0 15 Nov 1995 18:07:24 terryt
+* Initial revision.
+*
+* Rev 1.2 25 Aug 1995 16:23:08 terryt
+* Capture support
+*
+* Rev 1.1 23 May 1995 19:37:10 terryt
+* Spruce up source
+*
+* Rev 1.0 15 May 1995 19:10:44 terryt
+* Initial revision.
+*
+*************************************************************************/
+
+#include <stdio.h>
+#include <direct.h>
+#include <time.h>
+#include "common.h"
+
+extern int CONNECTION_ID;
+
+/********************************************************************
+
+ NTGetCurrentDirectory
+
+Routine Description:
+
+ Return the current directory.
+
+Arguments:
+
+ DriveNumber = The drive to get the directory from.
+ (0 = A, 1 = B, 2 = C, etc)
+ pPath = A pointer to a 64 byte buffer to return the
+ current directory.
+
+Return Value:
+
+ 0 Success
+ else Error
+
+ ********************************************************************/
+
+unsigned int
+NTGetCurrentDirectory(
+ unsigned char DriveNumber,
+ unsigned char *pPath
+ )
+{
+ char * CurPath;
+ int currentDrive = _getdrive() ;
+
+ //
+ // Change to the drive and get its current working directory.
+ // Default to root if fail to get cwd. DriveNumber is from 0.
+ //
+
+ _chdrive (DriveNumber+1);
+
+ CurPath = _getcwd(NULL,MAX_PATH) ;
+
+ if ( CurPath != NULL ) {
+
+ strcpy( pPath, CurPath );
+ free(CurPath) ;
+ }
+ else {
+
+ strcpy( pPath, "A:\\" );
+ pPath[0] += DriveNumber;
+ }
+
+ _chdrive (currentDrive);
+
+ return 0;
+}
+
+/********************************************************************
+
+ AttachToFileServer
+
+Routine Description:
+
+ Attach to a named file server
+
+Arguments:
+
+ pServerName - Name of server
+ pNewConnectionId - returned connection handle
+
+Return Value:
+ 0 = success
+ else NetWare error
+
+ *******************************************************************/
+unsigned int
+AttachToFileServer(
+ unsigned char *pServerName,
+ unsigned int *pNewConnectionId
+ )
+{
+ unsigned int Result;
+
+ if ( NTIsConnected( pServerName ) ) {
+ return 0x8800; // Already atached.
+ }
+
+ Result = NTAttachToFileServer( pServerName, pNewConnectionId );
+
+ return Result;
+}
+
+/********************************************************************
+
+ GetConnectionHandle
+
+Routine Description:
+
+ Given a server name, return the connection handle.
+ The server should already be attached
+ Note that this is not called for 4X servers. It's used
+ for attaches and bindery connections.
+
+Arguments:
+
+ pServerName - Name of server
+ pConnectionHandle - pointer to returned connection handle
+
+Return Value:
+ 0 = success
+ else NetWare error
+
+ *******************************************************************/
+unsigned int
+GetConnectionHandle(
+ unsigned char *pServerName,
+ unsigned int *pConnectionHandle
+ )
+{
+ unsigned int Result;
+
+ if ( !NTIsConnected( pServerName ) ) {
+ return 0xFFFF; // not already connected
+ }
+
+ Result = NTAttachToFileServer( pServerName, pConnectionHandle );
+
+ return Result;
+}
+