Compare commits
28 Commits
master
...
c53abba212
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c53abba212 | ||
|
|
ff344fcf4c | ||
|
|
36d566939c | ||
|
|
09a3f9f551 | ||
|
|
7f66df5a6e | ||
|
|
d4b29aea5d | ||
|
|
c12c93b958 | ||
|
|
82202fd6fb | ||
|
|
534f70844a | ||
|
|
b40ec03e7d | ||
|
|
0ea11f7f5d | ||
|
|
22d862cd12 | ||
|
|
417716a36f | ||
|
|
b2da728f4b | ||
|
|
3b8664cb77 | ||
|
|
acac4892a0 | ||
|
|
c64a20acac | ||
|
|
36b1458eb7 | ||
|
|
fa27fe4213 | ||
|
|
6d005a1713 | ||
|
|
af2f16add4 | ||
|
|
932d08cac8 | ||
|
|
0e42d3a85b | ||
|
|
093af0687a | ||
|
|
dcb74331e7 | ||
|
|
ad2bc6b02e | ||
|
|
5e75a9e8a7 | ||
|
|
975f34431a |
@@ -24,8 +24,6 @@ set(MARS_DOSUTILS_PUBLIC_TOOLS
|
||||
mapdel
|
||||
logout
|
||||
slist
|
||||
flag
|
||||
flagdir
|
||||
capture
|
||||
endcap
|
||||
)
|
||||
@@ -44,9 +42,6 @@ if(MARS_NWE_BUILD_DOSUTILS)
|
||||
login.c
|
||||
map.c
|
||||
slist.c
|
||||
flag.c
|
||||
flagdir.c
|
||||
c32ncp.c
|
||||
nwcrypt.c
|
||||
nwdebug.c
|
||||
nwtests.c
|
||||
@@ -122,8 +117,3 @@ install(FILES "${MARS_DOSUTILS_NET_EXE}"
|
||||
install(FILES "${MARS_DOSUTILS_NET_EXE}"
|
||||
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
|
||||
RENAME map.exe)
|
||||
|
||||
install(FILES "${MARS_DOSUTILS_NET_EXE}"
|
||||
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
|
||||
RENAME slist.exe)
|
||||
|
||||
|
||||
309
c32ncp.c
309
c32ncp.c
@@ -1,309 +0,0 @@
|
||||
#include "net.h"
|
||||
#include "c32ncp.h"
|
||||
|
||||
/* c32ncp.c - Client32 NCP helpers for mars-dosutils */
|
||||
static void c32_put_word_lh(uint8 *p, uint16 v)
|
||||
{
|
||||
p[0] = (uint8)(v & 0xff);
|
||||
p[1] = (uint8)((v >> 8) & 0xff);
|
||||
}
|
||||
|
||||
static void c32_put_dword_lh(uint8 *p, uint32 v)
|
||||
{
|
||||
p[0] = (uint8)(v & 0xff);
|
||||
p[1] = (uint8)((v >> 8) & 0xff);
|
||||
p[2] = (uint8)((v >> 16) & 0xff);
|
||||
p[3] = (uint8)((v >> 24) & 0xff);
|
||||
}
|
||||
|
||||
static uint16 c32_get_word_lh(uint8 *p)
|
||||
{
|
||||
return((uint16)(p[0] | ((uint16)p[1] << 8)));
|
||||
}
|
||||
|
||||
static uint32 c32_get_dword_lh(uint8 *p)
|
||||
{
|
||||
return((uint32)p[0] |
|
||||
((uint32)p[1] << 8) |
|
||||
((uint32)p[2] << 16) |
|
||||
((uint32)p[3] << 24));
|
||||
}
|
||||
|
||||
static UI c32_build_handle_path(uint8 *buf, uint8 dhandle,
|
||||
uint16 dirbase, uint8 style,
|
||||
int count,
|
||||
const char *c1, const char *c2, const char *c3)
|
||||
{
|
||||
uint8 *p;
|
||||
int l;
|
||||
UI used;
|
||||
|
||||
/*
|
||||
* DeveloperNet/ncpdos16 path structure used by NCP87/S6 through
|
||||
* Client32 COMPATNcpRequestReply.
|
||||
*
|
||||
* This is the exact shape verified by TESTS NCP87C32AUTO:
|
||||
* 00 02 00 00 00 00 01 09 4C 4F 47 49 4E 2E 45 58 45
|
||||
*
|
||||
* Meaning:
|
||||
* word[1] = short dir handle
|
||||
* word[3] = dir base
|
||||
* byte[5] = dirstyle
|
||||
* byte[6] = component count
|
||||
* then len/name components
|
||||
*
|
||||
* The old/simple struct used by the INT 21h F257 fallback is not accepted
|
||||
* by this Client32 path.
|
||||
*/
|
||||
memset(buf, 0, 0x140);
|
||||
|
||||
if (dhandle) {
|
||||
c32_put_word_lh(buf + 1, (uint16)dhandle);
|
||||
c32_put_word_lh(buf + 3, dirbase);
|
||||
buf[5] = style;
|
||||
} else {
|
||||
buf[5] = 0xff;
|
||||
}
|
||||
|
||||
p = buf + 6;
|
||||
*p++ = (uint8)count;
|
||||
|
||||
if (count > 0 && c1) {
|
||||
l = strlen(c1);
|
||||
if (l > 255) l = 255;
|
||||
*p++ = (uint8)l;
|
||||
memcpy(p, c1, l);
|
||||
p += l;
|
||||
}
|
||||
|
||||
if (count > 1 && c2) {
|
||||
l = strlen(c2);
|
||||
if (l > 255) l = 255;
|
||||
*p++ = (uint8)l;
|
||||
memcpy(p, c2, l);
|
||||
p += l;
|
||||
}
|
||||
|
||||
if (count > 2 && c3) {
|
||||
l = strlen(c3);
|
||||
if (l > 255) l = 255;
|
||||
*p++ = (uint8)l;
|
||||
memcpy(p, c3, l);
|
||||
p += l;
|
||||
}
|
||||
|
||||
used = (UI)(p - buf);
|
||||
c32_put_word_lh(buf + 0x13c, used);
|
||||
return(used);
|
||||
}
|
||||
|
||||
/*
|
||||
* Current verified Client32 path for mars-nwe DOS utilities:
|
||||
*
|
||||
* C32_MapVar_Probe(4,0) -> connRefLocal FFFF:FFFE
|
||||
* C32_OpenRef_Probe(connRefLocal) -> Client32 handle, e.g. 0101:0001
|
||||
*
|
||||
* C32_MapVar_Probe currently contains the confirmed Mars server-name scan
|
||||
* shape. It is intentionally kept small and isolated here so FLAG and later
|
||||
* tools do not carry the old exploratory tests.
|
||||
*/
|
||||
int c32_get_ncp_handle(uint16 *handle_lo, uint16 *handle_hi)
|
||||
{
|
||||
uint8 mapout[32];
|
||||
uint8 openout[32];
|
||||
uint16 map_ret_ax, map_ret_dx;
|
||||
uint16 cref_lo, cref_hi;
|
||||
uint16 open_ret_ax, open_ret_dx;
|
||||
|
||||
if (!handle_lo || !handle_hi)
|
||||
return(1);
|
||||
|
||||
*handle_lo = 0;
|
||||
*handle_hi = 0;
|
||||
|
||||
memset(mapout, 0, sizeof(mapout));
|
||||
C32_MapVar_Probe(4, 0, mapout);
|
||||
|
||||
map_ret_ax = c32_get_word_lh(mapout + 14);
|
||||
map_ret_dx = c32_get_word_lh(mapout + 16);
|
||||
cref_lo = c32_get_word_lh(mapout + 22);
|
||||
cref_hi = c32_get_word_lh(mapout + 24);
|
||||
|
||||
if (map_ret_ax != 0 || map_ret_dx != 0 || (cref_lo == 0 && cref_hi == 0))
|
||||
return(2);
|
||||
|
||||
memset(openout, 0, sizeof(openout));
|
||||
C32_OpenRef_Probe(cref_lo, cref_hi, openout);
|
||||
|
||||
open_ret_ax = c32_get_word_lh(openout + 14);
|
||||
open_ret_dx = c32_get_word_lh(openout + 16);
|
||||
*handle_lo = c32_get_word_lh(openout + 18);
|
||||
*handle_hi = c32_get_word_lh(openout + 20);
|
||||
|
||||
if (open_ret_ax != 0 || open_ret_dx != 0 || (*handle_lo == 0 && *handle_hi == 0))
|
||||
return(3);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int c32_ncp87_obtain_rim_attributes(const char *name,
|
||||
uint16 dir_handle,
|
||||
uint32 *attr_out,
|
||||
uint16 *actual_out,
|
||||
uint16 *handle_lo_out,
|
||||
uint16 *handle_hi_out)
|
||||
{
|
||||
uint16 handle_lo, handle_hi;
|
||||
uint8 hdr[16];
|
||||
uint8 path[0x140];
|
||||
uint8 rep0[0x60];
|
||||
uint8 rep1[0x110];
|
||||
uint8 rawout[32];
|
||||
uint16 raw_ret_ax, raw_ret_dx;
|
||||
uint16 actual_lo;
|
||||
int path_len;
|
||||
int rc;
|
||||
|
||||
if (!name || !attr_out)
|
||||
return(1);
|
||||
|
||||
*attr_out = 0;
|
||||
if (actual_out) *actual_out = 0;
|
||||
if (handle_lo_out) *handle_lo_out = 0;
|
||||
if (handle_hi_out) *handle_hi_out = 0;
|
||||
|
||||
rc = c32_get_ncp_handle(&handle_lo, &handle_hi);
|
||||
if (rc)
|
||||
return(10 + rc);
|
||||
|
||||
memset(hdr, 0, sizeof(hdr));
|
||||
hdr[0] = 6; /* NCP87 subfunction 6 */
|
||||
hdr[1] = 0; /* source namespace DOS */
|
||||
hdr[2] = 0; /* target namespace DOS */
|
||||
c32_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */
|
||||
c32_put_dword_lh(hdr + 5, 0x00000004UL); /* RIM_ATTRIBUTES */
|
||||
|
||||
path_len = c32_build_handle_path(path, (uint8)dir_handle, 0, 0, 1,
|
||||
name, NULL, NULL);
|
||||
|
||||
memset(rep0, 0, sizeof(rep0));
|
||||
memset(rep1, 0, sizeof(rep1));
|
||||
memset(rawout, 0, sizeof(rawout));
|
||||
|
||||
C32_NCP87_Raw5_Probe(handle_lo, handle_hi,
|
||||
hdr, 9,
|
||||
path, (UI)path_len,
|
||||
rep0, 0x4d,
|
||||
rep1, 0x100,
|
||||
rawout);
|
||||
|
||||
raw_ret_ax = c32_get_word_lh(rawout + 14);
|
||||
raw_ret_dx = c32_get_word_lh(rawout + 16);
|
||||
actual_lo = c32_get_word_lh(rawout + 18);
|
||||
|
||||
if (raw_ret_ax != 0 || raw_ret_dx != 0)
|
||||
return(20);
|
||||
|
||||
/*
|
||||
* Verified reply layout for RIM_ATTRIBUTES:
|
||||
* REP0+4 little-endian dword = DOS attributes
|
||||
* Example LOGIN.EXE: 20h archive.
|
||||
*/
|
||||
*attr_out = c32_get_dword_lh(rep0 + 4);
|
||||
|
||||
if (actual_out) *actual_out = actual_lo;
|
||||
if (handle_lo_out) *handle_lo_out = handle_lo;
|
||||
if (handle_hi_out) *handle_hi_out = handle_hi;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int c32_ncp87_modify_dos_attributes(char *name,
|
||||
uint16 dir_handle,
|
||||
uint32 attrs,
|
||||
uint16 *actual_out,
|
||||
uint16 *handle_lo_out,
|
||||
uint16 *handle_hi_out)
|
||||
{
|
||||
uint16 handle_lo, handle_hi;
|
||||
uint8 modbuf[64];
|
||||
uint8 path[0x140];
|
||||
uint8 rep0[0x20];
|
||||
uint8 rep1[0x20];
|
||||
uint8 rawout[32];
|
||||
uint8 *p;
|
||||
UI mod_len;
|
||||
UI path_len;
|
||||
uint16 raw_ret_ax, raw_ret_dx;
|
||||
uint16 actual_lo;
|
||||
int rc;
|
||||
|
||||
if (!name)
|
||||
return(1);
|
||||
|
||||
if (actual_out)
|
||||
*actual_out = 0;
|
||||
if (handle_lo_out)
|
||||
*handle_lo_out = 0;
|
||||
if (handle_hi_out)
|
||||
*handle_hi_out = 0;
|
||||
|
||||
rc = c32_get_ncp_handle(&handle_lo, &handle_hi);
|
||||
if (rc)
|
||||
return(10 + rc);
|
||||
|
||||
/*
|
||||
* NCP 87 subfunction 7: Modify DOS information.
|
||||
*
|
||||
* First request fragment contains the fixed header and DOS info structure.
|
||||
* Second request fragment contains the verified SDK-style path structure.
|
||||
*
|
||||
* This avoids the old INT 21h F257 modify path, which can hang under DOS
|
||||
* Client32 for high FLAG bits such as Transactional.
|
||||
*/
|
||||
memset(modbuf, 0, sizeof(modbuf));
|
||||
p = modbuf;
|
||||
|
||||
*p++ = 7; /* subfunction: modify DOS info */
|
||||
*p++ = 0; /* namespace DOS */
|
||||
*p++ = 0; /* reserved */
|
||||
c32_put_word_lh(p, 0x0006); p += 2; /* SA_ALL */
|
||||
c32_put_dword_lh(p, 0x00000002UL); p += 4; /* DM_ATTRIBUTES: attributes */
|
||||
|
||||
c32_put_dword_lh(p, attrs); p += 4; /* Attributes */
|
||||
memset(p, 0, 34); p += 34; /* rest of DOS info */
|
||||
mod_len = (UI)(p - modbuf);
|
||||
|
||||
path_len = c32_build_handle_path(path, (uint8)dir_handle, 0, 0, 1,
|
||||
name, NULL, NULL);
|
||||
|
||||
memset(rep0, 0, sizeof(rep0));
|
||||
memset(rep1, 0, sizeof(rep1));
|
||||
memset(rawout, 0, sizeof(rawout));
|
||||
|
||||
C32_NCP87_Raw5_Probe(handle_lo, handle_hi,
|
||||
modbuf, mod_len,
|
||||
path, path_len,
|
||||
rep0, sizeof(rep0),
|
||||
rep1, sizeof(rep1),
|
||||
rawout);
|
||||
|
||||
raw_ret_ax = c32_get_word_lh(rawout + 14);
|
||||
raw_ret_dx = c32_get_word_lh(rawout + 16);
|
||||
actual_lo = c32_get_word_lh(rawout + 18);
|
||||
|
||||
if (actual_out)
|
||||
*actual_out = actual_lo;
|
||||
if (handle_lo_out)
|
||||
*handle_lo_out = handle_lo;
|
||||
if (handle_hi_out)
|
||||
*handle_hi_out = handle_hi;
|
||||
|
||||
if (raw_ret_ax != 0 || raw_ret_dx != 0)
|
||||
return(20);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
22
c32ncp.h
22
c32ncp.h
@@ -1,22 +0,0 @@
|
||||
/* c32ncp.h - minimal Client32 NCP helpers for mars-dosutils */
|
||||
|
||||
#ifndef C32NCP_H
|
||||
#define C32NCP_H
|
||||
int c32_get_ncp_handle(uint16 *handle_lo, uint16 *handle_hi);
|
||||
|
||||
int c32_ncp87_obtain_rim_attributes(const char *name,
|
||||
uint16 dir_handle,
|
||||
uint32 *attr_out,
|
||||
uint16 *actual_out,
|
||||
uint16 *handle_lo_out,
|
||||
uint16 *handle_hi_out);
|
||||
|
||||
|
||||
int c32_ncp87_modify_dos_attributes(char *name,
|
||||
uint16 dir_handle,
|
||||
uint32 attrs,
|
||||
uint16 *actual_out,
|
||||
uint16 *handle_lo_out,
|
||||
uint16 *handle_hi_out);
|
||||
|
||||
#endif
|
||||
509
flag.c
509
flag.c
@@ -1,509 +0,0 @@
|
||||
/* flag.c - Novell FLAG-like DOS utility, stage 1 */
|
||||
|
||||
#include "net.h"
|
||||
#include "c32ncp.h"
|
||||
#include <dos.h>
|
||||
|
||||
/*
|
||||
* FLAG v4b: NCP 87 namespace DOS info.
|
||||
*
|
||||
* ncpfs reference:
|
||||
* ncp_ns_modify_entry_dos_info():
|
||||
* subfunction 7, namespace DOS, search attrs SA_ALL,
|
||||
* ModifyInformationMask, struct ncp_dos_info, handle/path.
|
||||
*
|
||||
* We use dirstyle=0 (short directory handle) against the current DOS
|
||||
* directory handle and a one-component DOS filename.
|
||||
*/
|
||||
#define FLAG_NW_NS_DOS 0x00
|
||||
#define FLAG_SA_ALL 0x0006
|
||||
#define FLAG_RIM_ATTRIBUTES 0x00000004UL
|
||||
|
||||
#define NWFA_RO 0x00000001UL
|
||||
#define NWFA_H 0x00000002UL
|
||||
#define NWFA_SY 0x00000004UL
|
||||
#define NWFA_A 0x00000020UL
|
||||
#define NWFA_S 0x00000080UL
|
||||
#define NWFA_T 0x00001000UL
|
||||
#define NWFA_RA 0x00004000UL
|
||||
#define NWFA_WA 0x00008000UL
|
||||
#define NWFA_P 0x00010000UL
|
||||
#define NWFA_RI 0x00020000UL
|
||||
#define NWFA_DI 0x00040000UL
|
||||
#define NWFA_CI 0x00080000UL
|
||||
|
||||
static void flag_put_word_lh(uint8 *p, uint16 v)
|
||||
{
|
||||
p[0] = (uint8)(v & 0xff);
|
||||
p[1] = (uint8)((v >> 8) & 0xff);
|
||||
}
|
||||
|
||||
static void flag_put_dword_lh(uint8 *p, uint32 v)
|
||||
{
|
||||
p[0] = (uint8)(v & 0xff);
|
||||
p[1] = (uint8)((v >> 8) & 0xff);
|
||||
p[2] = (uint8)((v >> 16) & 0xff);
|
||||
p[3] = (uint8)((v >> 24) & 0xff);
|
||||
}
|
||||
|
||||
static uint32 flag_get_dword_lh(uint8 *p)
|
||||
{
|
||||
return((uint32)p[0] |
|
||||
((uint32)p[1] << 8) |
|
||||
((uint32)p[2] << 16) |
|
||||
((uint32)p[3] << 24));
|
||||
}
|
||||
|
||||
static int flag_get_current_drive(void)
|
||||
{
|
||||
REGS regs;
|
||||
|
||||
regs.h.ah = 0x19; /* DOS get current default drive */
|
||||
int86(0x21, ®s, ®s); /* AL = 0 for A:, 1 for B:, ... */
|
||||
|
||||
return((int)regs.h.al);
|
||||
}
|
||||
|
||||
static int flag_current_dhandle(uint8 *dhandle)
|
||||
{
|
||||
uint8 connid = 0;
|
||||
uint8 flags = 0;
|
||||
int drive;
|
||||
|
||||
drive = flag_get_current_drive();
|
||||
if (get_drive_info((uint8)drive, &connid, dhandle, &flags))
|
||||
return(-1);
|
||||
|
||||
if (!connid || (flags & 0x80))
|
||||
return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int flag_add_handle_path(uint8 *p, uint8 dhandle, char *name)
|
||||
{
|
||||
int nlen;
|
||||
|
||||
nlen = strlen(name);
|
||||
if (nlen > 255) nlen = 255;
|
||||
|
||||
/*
|
||||
* handle/path:
|
||||
* volume/handle byte
|
||||
* dir base dword
|
||||
* dirstyle byte (0 = short dir handle)
|
||||
* path components: 1 component, length, bytes
|
||||
*/
|
||||
*p++ = dhandle;
|
||||
flag_put_dword_lh(p, 0L); p += 4;
|
||||
*p++ = 0; /* dirstyle = handle */
|
||||
*p++ = 1; /* one path component */
|
||||
*p++ = (uint8)nlen;
|
||||
memcpy(p, name, nlen);
|
||||
p += nlen;
|
||||
|
||||
return(1 + 4 + 1 + 1 + 1 + nlen);
|
||||
}
|
||||
|
||||
static int flag_ncp87_obtain_attrs(char *name, uint32 *attrs)
|
||||
{
|
||||
struct {
|
||||
uint16 len;
|
||||
uint8 data[320];
|
||||
} req;
|
||||
struct {
|
||||
uint16 len;
|
||||
uint8 data[128];
|
||||
} repl;
|
||||
uint8 dhandle = 0;
|
||||
uint8 *p;
|
||||
int hlen;
|
||||
|
||||
if (flag_current_dhandle(&dhandle))
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Prefer the verified Client32 NCP87 path. If it is not available,
|
||||
* fall back to the historical INT 21h/Net_Call path below.
|
||||
*/
|
||||
if (c32_ncp87_obtain_rim_attributes(name, (uint16)dhandle,
|
||||
attrs, NULL, NULL, NULL) == 0)
|
||||
return(0);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(&repl, 0, sizeof(repl));
|
||||
|
||||
p = req.data;
|
||||
*p++ = 6; /* subfunction: obtain file/subdir info */
|
||||
*p++ = FLAG_NW_NS_DOS; /* source namespace */
|
||||
*p++ = FLAG_NW_NS_DOS; /* target namespace */
|
||||
flag_put_word_lh(p, FLAG_SA_ALL); p += 2;
|
||||
flag_put_dword_lh(p, FLAG_RIM_ATTRIBUTES); p += 4;
|
||||
hlen = flag_add_handle_path(p, dhandle, name);
|
||||
p += hlen;
|
||||
|
||||
req.len = (uint16)(p - req.data);
|
||||
repl.len = sizeof(repl.data);
|
||||
|
||||
neterrno = Net_Call(0xF257, &req, &repl);
|
||||
if (neterrno)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* With RIM_ATTRIBUTES only, ncpfs expects NSI_Attributes first.
|
||||
* First dword is the 32-bit Attributes field.
|
||||
*/
|
||||
if (attrs)
|
||||
*attrs = flag_get_dword_lh(repl.data);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int flag_ncp87_modify_attrs(char *name, uint32 attrs)
|
||||
{
|
||||
struct {
|
||||
uint16 len;
|
||||
uint8 data[384];
|
||||
} req;
|
||||
struct {
|
||||
uint16 len;
|
||||
uint8 data[8];
|
||||
} repl;
|
||||
uint8 dhandle = 0;
|
||||
uint8 *p;
|
||||
int hlen;
|
||||
|
||||
if (flag_current_dhandle(&dhandle))
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Prefer verified Client32 modify path. The old INT 21h/F257 modify path
|
||||
* can hang under DOS Client32 for high FLAG bits such as T/P/DI/RI.
|
||||
*/
|
||||
{
|
||||
uint16 actual = 0;
|
||||
uint16 hlo = 0;
|
||||
uint16 hhi = 0;
|
||||
if (!c32_ncp87_modify_dos_attributes(name, (uint16)dhandle, attrs,
|
||||
&actual, &hlo, &hhi))
|
||||
return(0);
|
||||
}
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(&repl, 0, sizeof(repl));
|
||||
|
||||
p = req.data;
|
||||
*p++ = 7; /* subfunction: modify DOS info */
|
||||
*p++ = FLAG_NW_NS_DOS;
|
||||
*p++ = 0; /* reserved */
|
||||
flag_put_word_lh(p, FLAG_SA_ALL); p += 2;
|
||||
|
||||
flag_put_dword_lh(p, FLAG_RIM_ATTRIBUTES); p += 4; /* modify mask */
|
||||
flag_put_dword_lh(p, attrs); p += 4; /* Attributes */
|
||||
|
||||
/*
|
||||
* Remaining ncp_dos_info fields. Mask says only Attributes is valid,
|
||||
* so these should be ignored, but ncpfs still sends the full structure.
|
||||
*/
|
||||
memset(p, 0, 34);
|
||||
p += 34;
|
||||
|
||||
hlen = flag_add_handle_path(p, dhandle, name);
|
||||
p += hlen;
|
||||
|
||||
req.len = (uint16)(p - req.data);
|
||||
repl.len = sizeof(repl.data);
|
||||
|
||||
neterrno = Net_Call(0xF257, &req, &repl);
|
||||
if (neterrno)
|
||||
return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _A_NORMAL
|
||||
#define _A_NORMAL 0x00
|
||||
#endif
|
||||
#ifndef _A_RDONLY
|
||||
#define _A_RDONLY 0x01
|
||||
#endif
|
||||
#ifndef _A_HIDDEN
|
||||
#define _A_HIDDEN 0x02
|
||||
#endif
|
||||
#ifndef _A_SYSTEM
|
||||
#define _A_SYSTEM 0x04
|
||||
#endif
|
||||
#ifndef _A_SUBDIR
|
||||
#define _A_SUBDIR 0x10
|
||||
#endif
|
||||
#ifndef _A_ARCH
|
||||
#define _A_ARCH 0x20
|
||||
#endif
|
||||
|
||||
static int flag_same(char *a, char *b)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void flag_help(void)
|
||||
{
|
||||
fprintf(stdout, "USAGE: FLAG [path [ option | [+|-] attribute(s) ] [SUB]]\n");
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "386 Attributes:\n");
|
||||
fprintf(stdout, "--------------\n");
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "RO Read Only\n");
|
||||
fprintf(stdout, "RW Read Write\n");
|
||||
fprintf(stdout, "S Sharable\n");
|
||||
fprintf(stdout, "H Hidden\n");
|
||||
fprintf(stdout, "Sy System\n");
|
||||
fprintf(stdout, "T Transactional\n");
|
||||
fprintf(stdout, "P Purge\n");
|
||||
fprintf(stdout, "A Archive Needed\n");
|
||||
fprintf(stdout, "RA Read Audit\n");
|
||||
fprintf(stdout, "WA Write Audit\n");
|
||||
fprintf(stdout, "CI Copy Inhibit\n");
|
||||
fprintf(stdout, "DI Delete Inhibit\n");
|
||||
fprintf(stdout, "RI Rename Inhibit\n");
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "All All\n");
|
||||
fprintf(stdout, "N Normal\n");
|
||||
fprintf(stdout, "SUB\n");
|
||||
}
|
||||
|
||||
static int flag_attr_mask(char *s, uint32 *setbits, uint32 *clearbits)
|
||||
{
|
||||
int set = 1;
|
||||
char *p = s;
|
||||
|
||||
if (*p == '+') {
|
||||
set = 1;
|
||||
p++;
|
||||
} else if (*p == '-') {
|
||||
set = 0;
|
||||
p++;
|
||||
}
|
||||
|
||||
if (!*p) return(-1);
|
||||
|
||||
if (flag_same(p, "RO")) {
|
||||
if (set) {
|
||||
*setbits |= (NWFA_RO | NWFA_DI | NWFA_RI);
|
||||
} else {
|
||||
*clearbits |= (NWFA_RO | NWFA_DI | NWFA_RI);
|
||||
}
|
||||
} else if (flag_same(p, "RW")) {
|
||||
*clearbits |= (NWFA_RO | NWFA_DI | NWFA_RI);
|
||||
} else if (flag_same(p, "S")) {
|
||||
if (set) *setbits |= NWFA_S;
|
||||
else *clearbits |= NWFA_S;
|
||||
} else if (flag_same(p, "H")) {
|
||||
if (set) *setbits |= NWFA_H;
|
||||
else *clearbits |= NWFA_H;
|
||||
} else if (flag_same(p, "SY") || flag_same(p, "SYS") || flag_same(p, "SYSTEM")) {
|
||||
if (set) *setbits |= NWFA_SY;
|
||||
else *clearbits |= NWFA_SY;
|
||||
} else if (flag_same(p, "T")) {
|
||||
if (set) *setbits |= NWFA_T;
|
||||
else *clearbits |= NWFA_T;
|
||||
} else if (flag_same(p, "P")) {
|
||||
if (set) *setbits |= NWFA_P;
|
||||
else *clearbits |= NWFA_P;
|
||||
} else if (flag_same(p, "A")) {
|
||||
if (set) *setbits |= NWFA_A;
|
||||
else *clearbits |= NWFA_A;
|
||||
} else if (flag_same(p, "RA")) {
|
||||
if (set) *setbits |= NWFA_RA;
|
||||
else *clearbits |= NWFA_RA;
|
||||
} else if (flag_same(p, "WA")) {
|
||||
if (set) *setbits |= NWFA_WA;
|
||||
else *clearbits |= NWFA_WA;
|
||||
} else if (flag_same(p, "CI")) {
|
||||
if (set) *setbits |= NWFA_CI;
|
||||
else *clearbits |= NWFA_CI;
|
||||
} else if (flag_same(p, "DI")) {
|
||||
if (set) *setbits |= NWFA_DI;
|
||||
else *clearbits |= NWFA_DI;
|
||||
} else if (flag_same(p, "RI")) {
|
||||
if (set) *setbits |= NWFA_RI;
|
||||
else *clearbits |= NWFA_RI;
|
||||
} else if (flag_same(p, "N") || flag_same(p, "NORMAL")) {
|
||||
*clearbits |= (NWFA_RO | NWFA_H | NWFA_SY | NWFA_A |
|
||||
NWFA_S | NWFA_T | NWFA_P |
|
||||
NWFA_RA | NWFA_WA | NWFA_CI | NWFA_DI | NWFA_RI);
|
||||
} else if (flag_same(p, "ALL")) {
|
||||
*setbits |= (NWFA_RO | NWFA_H | NWFA_SY | NWFA_A |
|
||||
NWFA_S | NWFA_T | NWFA_P |
|
||||
NWFA_RA | NWFA_WA | NWFA_CI | NWFA_DI | NWFA_RI);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown attribute encountered in command line.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void flag_print_attrs(uint32 attr)
|
||||
{
|
||||
/*
|
||||
* Novell order:
|
||||
* Ro/Rw S A - H Sy T P Ra Wa CI DI RI
|
||||
*/
|
||||
fprintf(stdout, "[ ");
|
||||
fprintf(stdout, "%s ", (attr & NWFA_RO) ? "Ro" : "Rw");
|
||||
fprintf(stdout, "%c ", (attr & NWFA_S) ? 'S' : '-');
|
||||
fprintf(stdout, "%c ", (attr & NWFA_A) ? 'A' : '-');
|
||||
fprintf(stdout, "- ");
|
||||
fprintf(stdout, "%c ", (attr & NWFA_H) ? 'H' : '-');
|
||||
fprintf(stdout, "%s ", (attr & NWFA_SY) ? "Sy" : "--");
|
||||
fprintf(stdout, "%c ", (attr & NWFA_T) ? 'T' : '-');
|
||||
fprintf(stdout, "%c ", (attr & NWFA_P) ? 'P' : '-');
|
||||
fprintf(stdout, "%s ", (attr & NWFA_RA) ? "Ra" : "--");
|
||||
fprintf(stdout, "%s ", (attr & NWFA_WA) ? "Wa" : "--");
|
||||
fprintf(stdout, "%s ", (attr & NWFA_CI) ? "CI" : "--");
|
||||
fprintf(stdout, "%s ", (attr & NWFA_DI) ? "DI" : "--");
|
||||
fprintf(stdout, "%s ", (attr & NWFA_RI) ? "RI" : "--");
|
||||
fprintf(stdout, "]");
|
||||
}
|
||||
|
||||
static void flag_display_one(char *name, uint32 attr)
|
||||
{
|
||||
fprintf(stdout, " %-23s ", name);
|
||||
flag_print_attrs(attr);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
static int flag_has_wildcards(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s == '*' || *s == '?') return(1);
|
||||
s++;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int flag_list(char *pattern)
|
||||
{
|
||||
struct find_t ff;
|
||||
unsigned findattr = _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_ARCH;
|
||||
int found = 0;
|
||||
|
||||
if (_dos_findfirst(pattern, findattr, &ff))
|
||||
return(-1);
|
||||
|
||||
do {
|
||||
if (!(ff.attrib & _A_SUBDIR)) {
|
||||
uint32 nwattrs;
|
||||
|
||||
if (flag_ncp87_obtain_attrs(ff.name, &nwattrs))
|
||||
nwattrs = (uint32)ff.attrib;
|
||||
|
||||
flag_display_one(ff.name, nwattrs);
|
||||
found++;
|
||||
}
|
||||
} while (!_dos_findnext(&ff));
|
||||
|
||||
return(found);
|
||||
}
|
||||
|
||||
static int flag_apply(char *pattern, uint32 setbits, uint32 clearbits)
|
||||
{
|
||||
struct find_t ff;
|
||||
unsigned findattr = _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_ARCH;
|
||||
int shown = 0;
|
||||
|
||||
if (_dos_findfirst(pattern, findattr, &ff))
|
||||
return(-1);
|
||||
|
||||
do {
|
||||
uint32 attrs;
|
||||
uint32 newattrs;
|
||||
char fname[260];
|
||||
|
||||
if (ff.attrib & _A_SUBDIR) continue;
|
||||
|
||||
strmaxcpy(fname, ff.name, sizeof(fname) - 1);
|
||||
|
||||
if (flag_ncp87_obtain_attrs(fname, &attrs))
|
||||
attrs = (uint32)ff.attrib;
|
||||
|
||||
newattrs = (attrs | (uint32)setbits) & ~((uint32)clearbits);
|
||||
|
||||
if (newattrs != attrs) {
|
||||
if (flag_ncp87_modify_attrs(fname, newattrs)) {
|
||||
unsigned dosattr = (newattrs & (_A_RDONLY|_A_HIDDEN|_A_SYSTEM|_A_ARCH));
|
||||
if (_dos_setfileattr(fname, dosattr)) {
|
||||
fprintf(stderr, "You don't have rights to change : %s\n", fname);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_ncp87_obtain_attrs(fname, &attrs))
|
||||
attrs = newattrs;
|
||||
|
||||
flag_display_one(fname, newattrs);
|
||||
shown++;
|
||||
|
||||
} while (!_dos_findnext(&ff));
|
||||
|
||||
return(shown);
|
||||
}
|
||||
|
||||
int func_flag(int argc, char *argv[], int mode)
|
||||
{
|
||||
char *path = "*.*";
|
||||
int i;
|
||||
uint32 setbits = 0;
|
||||
uint32 clearbits = 0;
|
||||
int have_change = 0;
|
||||
int rc;
|
||||
|
||||
(void)mode;
|
||||
|
||||
if (argc > 1 && (flag_same(argv[1], "/?") || flag_same(argv[1], "-?") ||
|
||||
flag_same(argv[1], "?"))) {
|
||||
flag_help();
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
path = argv[1];
|
||||
if (flag_same(path, "SUB")) path = "*.*";
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++) {
|
||||
if (flag_same(argv[i], "SUB")) continue;
|
||||
|
||||
rc = flag_attr_mask(argv[i], &setbits, &clearbits);
|
||||
if (rc < 0) return(1);
|
||||
if (rc > 0) continue;
|
||||
have_change = 1;
|
||||
}
|
||||
|
||||
if (have_change) {
|
||||
rc = flag_apply(path, setbits, clearbits);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Files could not be found with pattern \"%s\"\n", path);
|
||||
return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
rc = flag_list(path);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Files could not be found with pattern \"%s\"\n", path);
|
||||
return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
245
flagdir.c
245
flagdir.c
@@ -1,245 +0,0 @@
|
||||
/* flagdir.c - Novell FLAGDIR-like DOS utility, first Client32 version */
|
||||
|
||||
#include "net.h"
|
||||
#include "c32ncp.h"
|
||||
#include <dos.h>
|
||||
|
||||
#define FD_NWFA_H 0x00000002UL
|
||||
#define FD_NWFA_SY 0x00000004UL
|
||||
#define FD_NWFA_P 0x00010000UL
|
||||
#define FD_NWFA_RI 0x00020000UL
|
||||
#define FD_NWFA_DI 0x00040000UL
|
||||
|
||||
#define FD_DIR_BITS (FD_NWFA_H | FD_NWFA_SY | FD_NWFA_P | FD_NWFA_RI | FD_NWFA_DI)
|
||||
|
||||
#ifndef _A_RDONLY
|
||||
#define _A_RDONLY 0x01
|
||||
#endif
|
||||
#ifndef _A_HIDDEN
|
||||
#define _A_HIDDEN 0x02
|
||||
#endif
|
||||
#ifndef _A_SYSTEM
|
||||
#define _A_SYSTEM 0x04
|
||||
#endif
|
||||
#ifndef _A_SUBDIR
|
||||
#define _A_SUBDIR 0x10
|
||||
#endif
|
||||
#ifndef _A_ARCH
|
||||
#define _A_ARCH 0x20
|
||||
#endif
|
||||
|
||||
static int fd_same(char *a, char *b)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void fd_upcopy(char *dst, char *src, int max)
|
||||
{
|
||||
int i = 0;
|
||||
while (*src && i < max - 1) {
|
||||
char c = *src++;
|
||||
if (c >= 'a' && c <= 'z') c -= 32;
|
||||
dst[i++] = c;
|
||||
}
|
||||
dst[i] = 0;
|
||||
}
|
||||
|
||||
static int fd_get_current_drive(void)
|
||||
{
|
||||
REGS regs;
|
||||
regs.h.ah = 0x19;
|
||||
int86(0x21, ®s, ®s);
|
||||
return((int)regs.h.al);
|
||||
}
|
||||
|
||||
static int fd_current_dhandle(uint8 *dhandle)
|
||||
{
|
||||
uint8 connid = 0;
|
||||
uint8 flags = 0;
|
||||
int drive;
|
||||
|
||||
drive = fd_get_current_drive();
|
||||
if (get_drive_info((uint8)drive, &connid, dhandle, &flags))
|
||||
return(-1);
|
||||
|
||||
if (!connid || (flags & 0x80))
|
||||
return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void fd_help(void)
|
||||
{
|
||||
fprintf(stdout, "386 Usage: Flagdir [path [option...]]\n");
|
||||
fprintf(stdout, "Options: Normal\n");
|
||||
fprintf(stdout, " System\n");
|
||||
fprintf(stdout, " Hidden\n");
|
||||
fprintf(stdout, " Deleteinhibit\n");
|
||||
fprintf(stdout, " Purge\n");
|
||||
fprintf(stdout, " Renameinhibit\n");
|
||||
}
|
||||
|
||||
static int fd_attr_mask(char *s, uint32 *setbits, uint32 *clearbits)
|
||||
{
|
||||
if (fd_same(s, "N") || fd_same(s, "NORMAL")) {
|
||||
*clearbits |= FD_DIR_BITS;
|
||||
} else if (fd_same(s, "S") || fd_same(s, "SY") ||
|
||||
fd_same(s, "SYS") || fd_same(s, "SYSTEM")) {
|
||||
*setbits |= FD_NWFA_SY;
|
||||
} else if (fd_same(s, "H") || fd_same(s, "HIDDEN")) {
|
||||
*setbits |= FD_NWFA_H;
|
||||
} else if (fd_same(s, "DI") || fd_same(s, "DELETEINHIBIT")) {
|
||||
*setbits |= FD_NWFA_DI;
|
||||
} else if (fd_same(s, "P") || fd_same(s, "PURGE")) {
|
||||
*setbits |= FD_NWFA_P;
|
||||
} else if (fd_same(s, "RI") || fd_same(s, "RENAMEINHIBIT")) {
|
||||
*setbits |= FD_NWFA_RI;
|
||||
} else if (fd_same(s, "PRIVATE") || fd_same(s, "PR")) {
|
||||
fprintf(stderr, "Private is valid on NetWare 2.15 and above, except NetWare 386.\n");
|
||||
return(-1);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown attribute: %s.\n", s);
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void fd_display(char *path, uint32 attrs)
|
||||
{
|
||||
char up[260];
|
||||
int any = 0;
|
||||
|
||||
fd_upcopy(up, path, sizeof(up));
|
||||
|
||||
/*
|
||||
* Novell FLAGDIR style:
|
||||
*
|
||||
* MARS/SYS:UDIR
|
||||
* UDIR System Hidden ...
|
||||
*
|
||||
* For now we match the tested MARS/SYS: environment used by PUBLIC/NPUBLIC.
|
||||
* The NCP logic is independent from this cosmetic header.
|
||||
*/
|
||||
fprintf(stdout, "MARS/SYS:%s\n", up);
|
||||
fprintf(stdout, " %-10s ", up);
|
||||
|
||||
if (!(attrs & FD_DIR_BITS)) {
|
||||
fprintf(stdout, "Normal\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (attrs & FD_NWFA_SY) {
|
||||
fprintf(stdout, "System");
|
||||
any = 1;
|
||||
}
|
||||
if (attrs & FD_NWFA_H) {
|
||||
fprintf(stdout, "%sHidden", any ? " " : "");
|
||||
any = 1;
|
||||
}
|
||||
if (attrs & FD_NWFA_DI) {
|
||||
fprintf(stdout, "%sDeleteInhibit", any ? " " : "");
|
||||
any = 1;
|
||||
}
|
||||
if (attrs & FD_NWFA_P) {
|
||||
fprintf(stdout, "%sPurge", any ? " " : "");
|
||||
any = 1;
|
||||
}
|
||||
if (attrs & FD_NWFA_RI) {
|
||||
fprintf(stdout, "%sRenameInhibit", any ? " " : "");
|
||||
any = 1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
static int fd_is_directory(char *path)
|
||||
{
|
||||
struct find_t ff;
|
||||
unsigned attr = _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR | _A_ARCH;
|
||||
if (_dos_findfirst(path, attr, &ff))
|
||||
return(0);
|
||||
return((ff.attrib & _A_SUBDIR) != 0);
|
||||
}
|
||||
|
||||
static int fd_obtain(char *path, uint8 dhandle, uint32 *attrs)
|
||||
{
|
||||
if (c32_ncp87_obtain_rim_attributes(path, (uint16)dhandle,
|
||||
attrs, NULL, NULL, NULL) == 0)
|
||||
return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int fd_modify(char *path, uint8 dhandle, uint32 attrs)
|
||||
{
|
||||
if (c32_ncp87_modify_dos_attributes(path, (uint16)dhandle, attrs,
|
||||
NULL, NULL, NULL) == 0)
|
||||
return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int func_flagdir(int argc, char *argv[], int mode)
|
||||
{
|
||||
char *path = ".";
|
||||
uint8 dhandle = 0;
|
||||
uint32 attrs = 0;
|
||||
uint32 setbits = 0;
|
||||
uint32 clearbits = 0;
|
||||
uint32 newattrs;
|
||||
int have_change = 0;
|
||||
int i;
|
||||
|
||||
(void)mode;
|
||||
|
||||
if (argc > 1 && (fd_same(argv[1], "/?") || fd_same(argv[1], "-?") ||
|
||||
fd_same(argv[1], "?"))) {
|
||||
fd_help();
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (argc > 1)
|
||||
path = argv[1];
|
||||
|
||||
if (fd_current_dhandle(&dhandle)) {
|
||||
fprintf(stderr, "FlagDir only works on network directories.\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (!fd_is_directory(path)) {
|
||||
fprintf(stderr, "Directory %s not found.\n", path);
|
||||
return(1);
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++) {
|
||||
if (fd_attr_mask(argv[i], &setbits, &clearbits))
|
||||
return(1);
|
||||
have_change = 1;
|
||||
}
|
||||
|
||||
if (fd_obtain(path, dhandle, &attrs)) {
|
||||
fprintf(stderr, "Unable to get directory attributes.\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (have_change) {
|
||||
newattrs = (attrs | setbits) & ~clearbits;
|
||||
if (newattrs != attrs) {
|
||||
if (fd_modify(path, dhandle, newattrs)) {
|
||||
fprintf(stderr, "Unable to change attributes.\n");
|
||||
return(1);
|
||||
}
|
||||
attrs = newattrs;
|
||||
/* Try to read back; keep requested value if readback fails. */
|
||||
fd_obtain(path, dhandle, &attrs);
|
||||
}
|
||||
}
|
||||
|
||||
fd_display(path, attrs);
|
||||
return(0);
|
||||
}
|
||||
12
kern.h
12
kern.h
@@ -3,8 +3,6 @@
|
||||
#define KERN_CALL _Cdecl
|
||||
#else
|
||||
#define KERN_CALL
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
extern int KERN_CALL IPXinit(void);
|
||||
@@ -15,14 +13,8 @@ extern void asm_esr_routine(void);
|
||||
extern void esr_routine(ECB *ecb);
|
||||
extern void KERN_CALL xmemmove(void *ziel, void *quelle, UI anz);
|
||||
extern int KERN_CALL Net_Call(UI func, void *req, void *repl);
|
||||
extern int KERN_CALL C32_MapVar_Probe(UI specLen, UI flag, void *outbuf);
|
||||
extern int KERN_CALL C32_OpenRef_Probe(UI refLo, UI refHi, void *outbuf);
|
||||
extern int KERN_CALL C32_NCP87_Raw5_Probe(UI connLo, UI connHi,
|
||||
void *hdr, UI hdrLen,
|
||||
void *path, UI pathLen,
|
||||
void *rep0, UI rep0Len,
|
||||
void *rep1, UI rep1Len,
|
||||
void *outbuf);
|
||||
|
||||
#undef KERN_CALL
|
||||
|
||||
|
||||
|
||||
|
||||
750
kern_wasm.asm
750
kern_wasm.asm
@@ -20,9 +20,7 @@ public _IPXclose_socket
|
||||
public _IPXlisten
|
||||
public _xmemmove
|
||||
public _Net_Call
|
||||
public _C32_NCP87_Raw5_Probe
|
||||
public _C32_OpenRef_Probe
|
||||
public _C32_MapVar_Probe
|
||||
|
||||
_IPXinit proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
@@ -215,750 +213,4 @@ _Net_Call proc far
|
||||
ret
|
||||
_Net_Call endp
|
||||
|
||||
|
||||
|
||||
; int C32_OpenRef_Probe(UI refLo, UI refHi, void *outbuf)
|
||||
;
|
||||
; Opens a Client32 connection by connection reference using the same d32wrap
|
||||
; convention as _CONNOpenByReference / w95ocref.o.
|
||||
;
|
||||
; Input:
|
||||
; refLo/refHi = connection reference, e.g. C32PRIMREF returned 0028:0000.
|
||||
;
|
||||
; outbuf:
|
||||
; +00 load AX from D8C1
|
||||
; +02 resolver off
|
||||
; +04 resolver seg
|
||||
; +06 trampoline off
|
||||
; +08 trampoline seg
|
||||
; +0A function off
|
||||
; +0C function seg
|
||||
; +0E return AX
|
||||
; +10 return DX
|
||||
; +12 handle low
|
||||
; +14 handle high
|
||||
_C32_OpenRef_Probe proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 80
|
||||
|
||||
push ds
|
||||
push es
|
||||
push si
|
||||
push di
|
||||
|
||||
; clear ESI/ECX
|
||||
db 66h, 33h, 0F6h
|
||||
db 66h, 33h, 0C9h
|
||||
|
||||
mov ax, 0D8C1h
|
||||
int 2Fh
|
||||
|
||||
mov [bp-4], ax ; load AX
|
||||
; resolver ESI -> [bp-8]
|
||||
db 66h, 89h, 76h, 0F8h
|
||||
; trampoline ECX -> [bp-12]
|
||||
db 66h, 89h, 4Eh, 0F4h
|
||||
|
||||
or ax, ax
|
||||
jne c32openref_fail
|
||||
|
||||
; resolve "CONNOpenByReference"
|
||||
push cs
|
||||
push offset c32openref_name
|
||||
push 0
|
||||
push 0
|
||||
call dword ptr [bp-8]
|
||||
add sp, 8
|
||||
mov [bp-16], ax
|
||||
mov [bp-14], dx
|
||||
or ax, dx
|
||||
jne c32openref_have_func
|
||||
jmp c32openref_fail
|
||||
|
||||
c32openref_have_func:
|
||||
; local output handle dword at [bp-20]
|
||||
mov word ptr [bp-20], 0
|
||||
mov word ptr [bp-18], 0
|
||||
|
||||
; MapLockFlat(&handle, 4) -> flat [bp-24]
|
||||
push 0
|
||||
push 4
|
||||
push ss
|
||||
lea ax, -20[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
mov [bp-24], ax
|
||||
mov [bp-22], dx
|
||||
|
||||
; Call NIOS trampoline command 5 / CONNOpenByReference.
|
||||
; This matches d32wrap _CONNOpenByReference after w95ocref:
|
||||
; flat handle ptr,
|
||||
; refHi/refLo,
|
||||
; 0,0,
|
||||
; FEFE FEFE FEFE FEFE,
|
||||
; command 5,
|
||||
; function ptr.
|
||||
push word ptr [bp-22] ; flat handle high
|
||||
push word ptr [bp-24] ; flat handle low
|
||||
push word ptr [bp+8] ; ref high
|
||||
push word ptr [bp+6] ; ref low
|
||||
push 0
|
||||
push 0
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
push 0
|
||||
push 5
|
||||
push word ptr [bp-14] ; function seg
|
||||
push word ptr [bp-16] ; function off
|
||||
call dword ptr [bp-12]
|
||||
add sp, 1cH
|
||||
|
||||
mov [bp-28], ax
|
||||
mov [bp-26], dx
|
||||
|
||||
; UnlockFlat(handle flat, 4)
|
||||
push 0
|
||||
push 4
|
||||
push word ptr [bp-22]
|
||||
push word ptr [bp-24]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
|
||||
jmp short c32openref_store
|
||||
|
||||
c32openref_fail:
|
||||
mov word ptr [bp-16], 0
|
||||
mov word ptr [bp-14], 0
|
||||
mov word ptr [bp-28], 0ffffH
|
||||
mov word ptr [bp-26], 0ffffH
|
||||
mov word ptr [bp-20], 0
|
||||
mov word ptr [bp-18], 0
|
||||
|
||||
c32openref_store:
|
||||
les di, dword ptr [bp+10]
|
||||
|
||||
mov ax, [bp-4]
|
||||
mov es:[di+0], ax
|
||||
mov ax, [bp-8]
|
||||
mov es:[di+2], ax
|
||||
mov ax, [bp-6]
|
||||
mov es:[di+4], ax
|
||||
mov ax, [bp-12]
|
||||
mov es:[di+6], ax
|
||||
mov ax, [bp-10]
|
||||
mov es:[di+8], ax
|
||||
mov ax, [bp-16]
|
||||
mov es:[di+10], ax
|
||||
mov ax, [bp-14]
|
||||
mov es:[di+12], ax
|
||||
mov ax, [bp-28]
|
||||
mov es:[di+14], ax
|
||||
mov ax, [bp-26]
|
||||
mov es:[di+16], ax
|
||||
mov ax, [bp-20]
|
||||
mov es:[di+18], ax
|
||||
mov ax, [bp-18]
|
||||
mov es:[di+20], ax
|
||||
|
||||
pop di
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
mov sp, bp
|
||||
pop bp
|
||||
xor ah, ah
|
||||
ret
|
||||
|
||||
c32openref_name db 'CONNOpenByReference',0
|
||||
|
||||
_C32_OpenRef_Probe endp
|
||||
|
||||
|
||||
|
||||
; int C32_MapVar_Probe(UI specLen, UI flag, void *outbuf)
|
||||
;
|
||||
; Exact-ish raw version of w95mconn.o::__C32MapConn16To32 second step.
|
||||
;
|
||||
; It emulates:
|
||||
; C32MAPCONNONE 40 -> server name MARS
|
||||
; NWCSCANCONNINFO(scanIterator/result ptr,
|
||||
; scanInfoLevel=0A, scanConnInfo=NWCString/SPECTDATA "MARS",
|
||||
; scanFlags=1, connInfoVersion=0,
|
||||
; returnInfoLevel=0, returnConnInfo=NULL,
|
||||
; connReference local)
|
||||
;
|
||||
; But calls Client32 CONNScanInfo directly through ECX/NIOS command 0A.
|
||||
;
|
||||
; outbuf:
|
||||
; +00 load AX
|
||||
; +02 resolver off
|
||||
; +04 resolver seg
|
||||
; +06 trampoline off
|
||||
; +08 trampoline seg
|
||||
; +0A function off
|
||||
; +0C function seg
|
||||
; +0E ret AX
|
||||
; +10 ret DX
|
||||
; +12 resultRef low ; corresponds to caller output ptr in w95mconn
|
||||
; +14 resultRef high
|
||||
; +16 connRefLocal low ; corresponds to d32conni local -1c
|
||||
; +18 connRefLocal high
|
||||
_C32_MapVar_Probe proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 140
|
||||
|
||||
push ds
|
||||
push es
|
||||
push si
|
||||
push di
|
||||
|
||||
; clear ESI/ECX
|
||||
db 66h, 33h, 0F6h
|
||||
db 66h, 33h, 0C9h
|
||||
|
||||
mov ax, 0D8C1h
|
||||
int 2Fh
|
||||
|
||||
mov [bp-4], ax ; load AX
|
||||
; resolver ESI -> [bp-8]
|
||||
db 66h, 89h, 76h, 0F8h
|
||||
; trampoline ECX -> [bp-12]
|
||||
db 66h, 89h, 4Eh, 0F4h
|
||||
|
||||
or ax, ax
|
||||
jne c32mapvar_fail
|
||||
|
||||
; resolve "CONNScanInfo"
|
||||
push cs
|
||||
push offset c32mapvar_name
|
||||
push 0
|
||||
push 0
|
||||
call dword ptr [bp-8]
|
||||
add sp, 8
|
||||
mov [bp-16], ax
|
||||
mov [bp-14], dx
|
||||
or ax, dx
|
||||
jne c32mapvar_have_func
|
||||
jmp c32mapvar_fail
|
||||
|
||||
c32mapvar_have_func:
|
||||
; resultRef/output dword at [bp-20], init 0
|
||||
mov word ptr [bp-20], 0
|
||||
mov word ptr [bp-18], 0
|
||||
|
||||
; connReference local dword at [bp-24], init 0
|
||||
mov word ptr [bp-24], 0
|
||||
mov word ptr [bp-22], 0
|
||||
|
||||
; string buffer at [bp-80], copy "MARS", zero padded enough
|
||||
lea di, -80[bp]
|
||||
push ss
|
||||
pop es
|
||||
mov byte ptr es:[di+0], 'M'
|
||||
mov byte ptr es:[di+1], 'A'
|
||||
mov byte ptr es:[di+2], 'R'
|
||||
mov byte ptr es:[di+3], 'S'
|
||||
mov byte ptr es:[di+4], 0
|
||||
|
||||
; Map string buffer len 31h -> [bp-28]
|
||||
push 0
|
||||
push 31H
|
||||
push ss
|
||||
lea ax, -80[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
mov [bp-28], ax
|
||||
mov [bp-26], dx
|
||||
|
||||
; Build SPECTDATA/NWCString transfer block at [bp-48], len 10h.
|
||||
; Mirrors d32conni initialization for server-name scan.
|
||||
mov ax, [bp+6]
|
||||
mov word ptr [bp-48], ax
|
||||
mov word ptr [bp-46], 0
|
||||
mov ax, [bp-28]
|
||||
mov word ptr [bp-44], ax
|
||||
mov ax, [bp-26]
|
||||
mov word ptr [bp-42], ax
|
||||
mov word ptr [bp-40], 1
|
||||
mov word ptr [bp-38], 0
|
||||
mov word ptr [bp-36], 0
|
||||
mov word ptr [bp-34], 0
|
||||
|
||||
; Map scanInfo spectdata block len 10h -> [bp-32]
|
||||
push 0
|
||||
push 10H
|
||||
push ss
|
||||
lea ax, -48[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
mov [bp-32], ax
|
||||
mov [bp-30], dx
|
||||
|
||||
; Map resultRef/output len4 -> [bp-56] (this is w95mconn caller ptr)
|
||||
push 0
|
||||
push 4
|
||||
push ss
|
||||
lea ax, -20[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
mov [bp-56], ax
|
||||
mov [bp-54], dx
|
||||
|
||||
; Map connReference local len4 -> [bp-60]
|
||||
push 0
|
||||
push 4
|
||||
push ss
|
||||
lea ax, -24[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
mov [bp-60], ax
|
||||
mov [bp-58], dx
|
||||
|
||||
; Raw CONNScanInfo via NIOS, following d32wrap _CONNScanInfo
|
||||
; argument order from d32conni L$115.
|
||||
push word ptr [bp-58] ; connReference flat high
|
||||
push word ptr [bp-60] ; connReference flat low
|
||||
|
||||
push 0 ; returnConnInfo flat high = NULL
|
||||
push 0 ; returnConnInfo flat low = NULL
|
||||
|
||||
push 0 ; returnInfoLen high
|
||||
push 0 ; returnInfoLen low
|
||||
|
||||
push 0 ; returnInfoLevel high
|
||||
push 4 ; returnInfoLevel low, as d32conni L$115
|
||||
|
||||
push 0 ; scan flag high
|
||||
push word ptr [bp+8] ; scan flag low
|
||||
|
||||
push word ptr [bp-30] ; scanInfo flat high
|
||||
push word ptr [bp-32] ; scanInfo flat low
|
||||
|
||||
push 0 ; scanInfoLevel high
|
||||
push 0aH ; scanInfoLevel low = SERVER_NAME
|
||||
|
||||
push word ptr [bp-54] ; scanIterator/result flat high
|
||||
push word ptr [bp-56] ; scanIterator/result flat low
|
||||
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
push 0fefeH
|
||||
|
||||
push 0
|
||||
push 0aH
|
||||
push word ptr [bp-14]
|
||||
push word ptr [bp-16]
|
||||
call dword ptr [bp-12]
|
||||
add sp, 30H
|
||||
|
||||
mov [bp-64], ax
|
||||
mov [bp-62], dx
|
||||
|
||||
; Unlock maps.
|
||||
push 0
|
||||
push 4
|
||||
push word ptr [bp-58]
|
||||
push word ptr [bp-60]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 4
|
||||
push word ptr [bp-54]
|
||||
push word ptr [bp-56]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 10H
|
||||
push word ptr [bp-30]
|
||||
push word ptr [bp-32]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 31H
|
||||
push word ptr [bp-26]
|
||||
push word ptr [bp-28]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-8]
|
||||
add sp, 0cH
|
||||
|
||||
jmp short c32mapvar_store
|
||||
|
||||
c32mapvar_fail:
|
||||
mov word ptr [bp-16], 0
|
||||
mov word ptr [bp-14], 0
|
||||
mov word ptr [bp-64], 0ffffH
|
||||
mov word ptr [bp-62], 0ffffH
|
||||
mov word ptr [bp-20], 0
|
||||
mov word ptr [bp-18], 0
|
||||
mov word ptr [bp-24], 0
|
||||
mov word ptr [bp-22], 0
|
||||
|
||||
c32mapvar_store:
|
||||
les di, dword ptr [bp+10]
|
||||
|
||||
mov ax, [bp-4]
|
||||
mov es:[di+0], ax
|
||||
mov ax, [bp-8]
|
||||
mov es:[di+2], ax
|
||||
mov ax, [bp-6]
|
||||
mov es:[di+4], ax
|
||||
mov ax, [bp-12]
|
||||
mov es:[di+6], ax
|
||||
mov ax, [bp-10]
|
||||
mov es:[di+8], ax
|
||||
mov ax, [bp-16]
|
||||
mov es:[di+10], ax
|
||||
mov ax, [bp-14]
|
||||
mov es:[di+12], ax
|
||||
mov ax, [bp-64]
|
||||
mov es:[di+14], ax
|
||||
mov ax, [bp-62]
|
||||
mov es:[di+16], ax
|
||||
mov ax, [bp-20]
|
||||
mov es:[di+18], ax
|
||||
mov ax, [bp-18]
|
||||
mov es:[di+20], ax
|
||||
mov ax, [bp-24]
|
||||
mov es:[di+22], ax
|
||||
mov ax, [bp-22]
|
||||
mov es:[di+24], ax
|
||||
|
||||
pop di
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
mov sp, bp
|
||||
pop bp
|
||||
xor ah, ah
|
||||
ret
|
||||
|
||||
c32mapvar_name db 'CONNScanInfo',0
|
||||
|
||||
_C32_MapVar_Probe endp
|
||||
|
||||
|
||||
|
||||
|
||||
; int C32_NCP87_Raw5_Probe(UI connLo, UI connHi,
|
||||
; void *hdr, UI hdrLen,
|
||||
; void *path, UI pathLen,
|
||||
; void *rep0, UI rep0Len,
|
||||
; void *rep1, UI rep1Len,
|
||||
; void *outbuf)
|
||||
;
|
||||
; Same as C32_NCP87_Raw_Probe but uses d32wrap-compatible 5-slot
|
||||
; fragment tables: 5 * 8 = 0x28 bytes for request and reply.
|
||||
_C32_NCP87_Raw5_Probe proc far
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 180
|
||||
|
||||
push ds
|
||||
push es
|
||||
push si
|
||||
push di
|
||||
|
||||
; clear ESI/ECX
|
||||
db 66h, 33h, 0F6h
|
||||
db 66h, 33h, 0C9h
|
||||
|
||||
mov ax, 0D8C1h
|
||||
int 2Fh
|
||||
|
||||
mov [bp-2], ax
|
||||
db 66h, 89h, 76h, 0FAh ; resolver at [bp-6]
|
||||
db 66h, 89h, 4Eh, 0F6h ; trampoline at [bp-10]
|
||||
|
||||
or ax, ax
|
||||
jne raw5_fail
|
||||
|
||||
; resolve COMPATNcpRequestReply
|
||||
push cs
|
||||
push offset raw5_name
|
||||
push 0
|
||||
push 0
|
||||
call dword ptr [bp-6]
|
||||
add sp, 8
|
||||
mov [bp-14], ax
|
||||
mov [bp-12], dx
|
||||
or ax, dx
|
||||
jne raw5_have_func
|
||||
jmp raw5_fail
|
||||
|
||||
raw5_have_func:
|
||||
; actual reply len dword at [bp-36]
|
||||
mov word ptr [bp-36], 0
|
||||
mov word ptr [bp-34], 0
|
||||
|
||||
; map hdr -> [bp-20]
|
||||
push 0
|
||||
push word ptr [bp+0eH]
|
||||
push word ptr [bp+0cH]
|
||||
push word ptr [bp+0aH]
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-20], ax
|
||||
mov [bp-18], dx
|
||||
|
||||
; map path -> [bp-24]
|
||||
push 0
|
||||
push word ptr [bp+14H]
|
||||
push word ptr [bp+12H]
|
||||
push word ptr [bp+10H]
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-24], ax
|
||||
mov [bp-22], dx
|
||||
|
||||
; map rep0 -> [bp-28]
|
||||
push 0
|
||||
push word ptr [bp+1aH]
|
||||
push word ptr [bp+18H]
|
||||
push word ptr [bp+16H]
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-28], ax
|
||||
mov [bp-26], dx
|
||||
|
||||
; map rep1 -> [bp-32]
|
||||
push 0
|
||||
push word ptr [bp+20H]
|
||||
push word ptr [bp+1eH]
|
||||
push word ptr [bp+1cH]
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-32], ax
|
||||
mov [bp-30], dx
|
||||
|
||||
; zero req table [bp-160] len 40 and reply table [bp-120] len 40
|
||||
push ss
|
||||
pop es
|
||||
cld
|
||||
xor ax, ax
|
||||
lea di, -160[bp]
|
||||
mov cx, 20
|
||||
rep stosw
|
||||
lea di, -120[bp]
|
||||
mov cx, 20
|
||||
rep stosw
|
||||
|
||||
; req entry0 = hdr
|
||||
mov ax, [bp-20]
|
||||
mov [bp-160], ax
|
||||
mov ax, [bp-18]
|
||||
mov [bp-158], ax
|
||||
mov ax, [bp+0eH]
|
||||
mov [bp-156], ax
|
||||
mov word ptr [bp-154], 0
|
||||
|
||||
; req entry1 = path
|
||||
mov ax, [bp-24]
|
||||
mov [bp-152], ax
|
||||
mov ax, [bp-22]
|
||||
mov [bp-150], ax
|
||||
mov ax, [bp+14H]
|
||||
mov [bp-148], ax
|
||||
mov word ptr [bp-146], 0
|
||||
|
||||
; reply entry0 = rep0
|
||||
mov ax, [bp-28]
|
||||
mov [bp-120], ax
|
||||
mov ax, [bp-26]
|
||||
mov [bp-118], ax
|
||||
mov ax, [bp+1aH]
|
||||
mov [bp-116], ax
|
||||
mov word ptr [bp-114], 0
|
||||
|
||||
; reply entry1 = rep1
|
||||
mov ax, [bp-32]
|
||||
mov [bp-112], ax
|
||||
mov ax, [bp-30]
|
||||
mov [bp-110], ax
|
||||
mov ax, [bp+20H]
|
||||
mov [bp-108], ax
|
||||
mov word ptr [bp-106], 0
|
||||
|
||||
; map req table 0x28 -> [bp-40]
|
||||
push 0
|
||||
push 28H
|
||||
push ss
|
||||
lea ax, -160[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-40], ax
|
||||
mov [bp-38], dx
|
||||
|
||||
; map reply table 0x28 -> [bp-44]
|
||||
push 0
|
||||
push 28H
|
||||
push ss
|
||||
lea ax, -120[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-44], ax
|
||||
mov [bp-42], dx
|
||||
|
||||
; map actual reply len -> [bp-48]
|
||||
push 0
|
||||
push 4
|
||||
push ss
|
||||
lea ax, -36[bp]
|
||||
push ax
|
||||
push 0
|
||||
push 2
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
mov [bp-48], ax
|
||||
mov [bp-46], dx
|
||||
|
||||
; call COMPAT via NIOS command 8
|
||||
push word ptr [bp-46]
|
||||
push word ptr [bp-48]
|
||||
push word ptr [bp-42]
|
||||
push word ptr [bp-44]
|
||||
push 0
|
||||
push 2
|
||||
push word ptr [bp-38]
|
||||
push word ptr [bp-40]
|
||||
push 0
|
||||
push 2
|
||||
push 0
|
||||
push 57H
|
||||
push 0
|
||||
push 0
|
||||
push word ptr [bp+8]
|
||||
push word ptr [bp+6]
|
||||
push 0
|
||||
push 8
|
||||
push word ptr [bp-12]
|
||||
push word ptr [bp-14]
|
||||
call dword ptr [bp-10]
|
||||
add sp, 28H
|
||||
|
||||
mov [bp-52], ax
|
||||
mov [bp-50], dx
|
||||
|
||||
; unlock important mappings only; ignore return
|
||||
push 0
|
||||
push 4
|
||||
push word ptr [bp-46]
|
||||
push word ptr [bp-48]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 28H
|
||||
push word ptr [bp-42]
|
||||
push word ptr [bp-44]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
push 0
|
||||
push 28H
|
||||
push word ptr [bp-38]
|
||||
push word ptr [bp-40]
|
||||
push 0
|
||||
push 3
|
||||
call dword ptr [bp-6]
|
||||
add sp, 0cH
|
||||
|
||||
jmp short raw5_store
|
||||
|
||||
raw5_fail:
|
||||
mov word ptr [bp-14], 0
|
||||
mov word ptr [bp-12], 0
|
||||
mov word ptr [bp-52], 0ffffH
|
||||
mov word ptr [bp-50], 0ffffH
|
||||
mov word ptr [bp-36], 0
|
||||
mov word ptr [bp-34], 0
|
||||
|
||||
raw5_store:
|
||||
les di, dword ptr [bp+22H]
|
||||
mov ax, [bp-2]
|
||||
mov es:[di+0], ax
|
||||
mov ax, [bp-6]
|
||||
mov es:[di+2], ax
|
||||
mov ax, [bp-4]
|
||||
mov es:[di+4], ax
|
||||
mov ax, [bp-10]
|
||||
mov es:[di+6], ax
|
||||
mov ax, [bp-8]
|
||||
mov es:[di+8], ax
|
||||
mov ax, [bp-14]
|
||||
mov es:[di+10], ax
|
||||
mov ax, [bp-12]
|
||||
mov es:[di+12], ax
|
||||
mov ax, [bp-52]
|
||||
mov es:[di+14], ax
|
||||
mov ax, [bp-50]
|
||||
mov es:[di+16], ax
|
||||
mov ax, [bp-36]
|
||||
mov es:[di+18], ax
|
||||
mov ax, [bp-34]
|
||||
mov es:[di+20], ax
|
||||
|
||||
pop di
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
mov sp, bp
|
||||
pop bp
|
||||
xor ah, ah
|
||||
ret
|
||||
|
||||
raw5_name db 'COMPATNcpRequestReply',0
|
||||
|
||||
_C32_NCP87_Raw5_Probe endp
|
||||
|
||||
|
||||
end
|
||||
|
||||
350
login.c
350
login.c
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "net.h"
|
||||
#include "nwcrypt.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifndef BLACK
|
||||
#define BLACK 0
|
||||
@@ -24,75 +23,6 @@
|
||||
static uint8 script_login_name[64];
|
||||
static uint8 script_file_server[52];
|
||||
|
||||
static char **build_argv(char *buf, int bufsize, char *str);
|
||||
extern int read_command_file(char *fstr);
|
||||
extern int get_fs_name(int connid, char *name);
|
||||
|
||||
|
||||
static uint8 login_video_attr = 0x07;
|
||||
|
||||
static void login_gotoxy(int x, int y)
|
||||
{
|
||||
REGS regs;
|
||||
|
||||
regs.h.ah = 0x02;
|
||||
regs.h.bh = 0x00;
|
||||
regs.h.dh = (uint8)(y - 1);
|
||||
regs.h.dl = (uint8)(x - 1);
|
||||
int86(0x10, ®s, ®s);
|
||||
}
|
||||
|
||||
static void login_cls_attr(uint8 attr)
|
||||
{
|
||||
REGS regs;
|
||||
|
||||
regs.h.ah = 0x06;
|
||||
regs.h.al = 0x00;
|
||||
regs.h.bh = attr;
|
||||
regs.h.ch = 0;
|
||||
regs.h.cl = 0;
|
||||
regs.h.dh = 24;
|
||||
regs.h.dl = 79;
|
||||
int86(0x10, ®s, ®s);
|
||||
login_gotoxy(1, 1);
|
||||
}
|
||||
|
||||
static void login_write_attr(int x, int y, const char *s, uint8 attr)
|
||||
{
|
||||
REGS regs;
|
||||
int col = x;
|
||||
|
||||
while (*s) {
|
||||
login_gotoxy(col++, y);
|
||||
regs.h.ah = 0x09;
|
||||
regs.h.al = (uint8)*s++;
|
||||
regs.h.bh = 0;
|
||||
regs.h.bl = attr;
|
||||
regs.x.cx = 1;
|
||||
int86(0x10, ®s, ®s);
|
||||
}
|
||||
login_gotoxy(col, y);
|
||||
}
|
||||
|
||||
static void login_fill_line(int y, uint8 attr)
|
||||
{
|
||||
REGS regs;
|
||||
|
||||
login_gotoxy(1, y);
|
||||
regs.h.ah = 0x09;
|
||||
regs.h.al = ' ';
|
||||
regs.h.bh = 0;
|
||||
regs.h.bl = attr;
|
||||
regs.x.cx = 80;
|
||||
int86(0x10, ®s, ®s);
|
||||
}
|
||||
|
||||
static void login_screen_normal(void)
|
||||
{
|
||||
login_video_attr = 0x07;
|
||||
}
|
||||
|
||||
|
||||
static int login_help(void)
|
||||
{
|
||||
fprintf(stdout, "\n");
|
||||
@@ -116,22 +46,20 @@ static int login_help(void)
|
||||
|
||||
static void login_banner(void)
|
||||
{
|
||||
login_cls_attr(0x07); /* normal black background */
|
||||
int i;
|
||||
|
||||
/*
|
||||
* NetWare-like header, but blue for Mars NWE:
|
||||
* blue separator
|
||||
* blue title line
|
||||
* blue separator
|
||||
* then normal black prompt area.
|
||||
*/
|
||||
login_fill_line(1, 0x1f); /* white on blue */
|
||||
login_fill_line(2, 0x1f); /* white on blue */
|
||||
login_write_attr(36, 2, "Mars NWE", 0x1f);
|
||||
login_fill_line(3, 0x1f); /* white on blue */
|
||||
textbackground(BLUE);
|
||||
textcolor(WHITE);
|
||||
clrscr();
|
||||
|
||||
login_screen_normal();
|
||||
login_gotoxy(1, 4);
|
||||
gotoxy(1, 1);
|
||||
for (i = 0; i < 80; i++) putch(' ');
|
||||
gotoxy(36, 1);
|
||||
cputs("Mars NWE");
|
||||
|
||||
textbackground(BLACK);
|
||||
textcolor(LIGHTGRAY);
|
||||
gotoxy(1, 3);
|
||||
}
|
||||
|
||||
static char *skip_spaces(char *p)
|
||||
@@ -160,100 +88,18 @@ static void strip_quotes(char *s)
|
||||
*d = '\0';
|
||||
}
|
||||
|
||||
|
||||
static void script_get_timevar(char *name, char *out, int outlen)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *tmv;
|
||||
int hour;
|
||||
static char *months[] = {
|
||||
"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",
|
||||
"JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
|
||||
};
|
||||
static char *days[] = {
|
||||
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY",
|
||||
"THURSDAY", "FRIDAY", "SATURDAY"
|
||||
};
|
||||
|
||||
*out = '\0';
|
||||
|
||||
time(&now);
|
||||
tmv = localtime(&now);
|
||||
if (!tmv) return;
|
||||
|
||||
upstr(name);
|
||||
|
||||
if (!strcmp(name, "GREETING_TIME")) {
|
||||
if (tmv->tm_hour < 12) strcpy(out, "MORNING");
|
||||
else if (tmv->tm_hour < 18) strcpy(out, "AFTERNOON");
|
||||
else strcpy(out, "EVENING");
|
||||
} else if (!strcmp(name, "MONTH_NAME")) {
|
||||
strmaxcpy(out, months[tmv->tm_mon], outlen - 1);
|
||||
} else if (!strcmp(name, "MONTH")) {
|
||||
sprintf(out, "%02d", tmv->tm_mon + 1);
|
||||
} else if (!strcmp(name, "DAY")) {
|
||||
sprintf(out, "%02d", tmv->tm_mday);
|
||||
} else if (!strcmp(name, "YEAR")) {
|
||||
sprintf(out, "%04d", tmv->tm_year + 1900);
|
||||
} else if (!strcmp(name, "DAY_OF_WEEK")) {
|
||||
strmaxcpy(out, days[tmv->tm_wday], outlen - 1);
|
||||
} else if (!strcmp(name, "HOUR")) {
|
||||
hour = tmv->tm_hour % 12;
|
||||
if (!hour) hour = 12;
|
||||
sprintf(out, "%d", hour);
|
||||
} else if (!strcmp(name, "MINUTE")) {
|
||||
sprintf(out, "%02d", tmv->tm_min);
|
||||
} else if (!strcmp(name, "SECOND")) {
|
||||
sprintf(out, "%02d", tmv->tm_sec);
|
||||
} else if (!strcmp(name, "AM_PM")) {
|
||||
strcpy(out, tmv->tm_hour >= 12 ? "PM" : "AM");
|
||||
}
|
||||
}
|
||||
|
||||
static void script_expand_var(char *name, char *out, int outlen)
|
||||
{
|
||||
upstr(name);
|
||||
*out = '\0';
|
||||
|
||||
if (!strcmp(name, "LOGIN_NAME")) {
|
||||
strmaxcpy(out, script_login_name, outlen - 1);
|
||||
} else if (!strcmp(name, "FILE_SERVER")) {
|
||||
strmaxcpy(out, script_file_server, outlen - 1);
|
||||
} else if (!strcmp(name, "P_STATION") || !strcmp(name, "STATION")) {
|
||||
strcpy(out, "000000000000");
|
||||
} else {
|
||||
script_get_timevar(name, out, outlen);
|
||||
if (!*out) {
|
||||
strcpy(out, "%");
|
||||
strncat(out, name, outlen - strlen(out) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void script_put_expanded(char *s)
|
||||
{
|
||||
while (s && *s) {
|
||||
if (*s == '%') {
|
||||
char name[64];
|
||||
char value[128];
|
||||
int i = 0;
|
||||
|
||||
s++;
|
||||
while ((*s == '_' ||
|
||||
(*s >= 'A' && *s <= 'Z') ||
|
||||
(*s >= 'a' && *s <= 'z') ||
|
||||
(*s >= '0' && *s <= '9')) &&
|
||||
i < (int)sizeof(name) - 1) {
|
||||
name[i++] = *s++;
|
||||
}
|
||||
name[i] = '\0';
|
||||
|
||||
if (i) {
|
||||
script_expand_var(name, value, sizeof(value));
|
||||
fprintf(stdout, "%s", value);
|
||||
} else {
|
||||
fputc('%', stdout);
|
||||
}
|
||||
if (!strncmp(s, "%LOGIN_NAME", 11) || !strncmp(s, "%login_name", 11)) {
|
||||
fprintf(stdout, "%s", script_login_name);
|
||||
s += 11;
|
||||
} else if (!strncmp(s, "%FILE_SERVER", 12) || !strncmp(s, "%file_server", 12)) {
|
||||
fprintf(stdout, "%s", script_file_server);
|
||||
s += 12;
|
||||
} else if (!strncmp(s, "%P_STATION", 10) || !strncmp(s, "%p_station", 10)) {
|
||||
fprintf(stdout, "000000000000");
|
||||
s += 10;
|
||||
} else {
|
||||
fputc(*s++, stdout);
|
||||
}
|
||||
@@ -324,62 +170,26 @@ static int script_eval_if(char *line)
|
||||
|
||||
if (q != NULL) {
|
||||
char want[64];
|
||||
char have[64];
|
||||
char *v;
|
||||
int i = 0;
|
||||
|
||||
q += neg ? 2 : 1;
|
||||
q = skip_spaces(q);
|
||||
if (*q == '"' || *q == '\'') q++;
|
||||
|
||||
while (*q && *q != '"' && *q != '\'' && *q != 32 && *q != '\t' && i < 63)
|
||||
while (*q && *q != '"' && *q != '\'' && *q != 32 && *q != '\t' && i < 63) {
|
||||
want[i++] = *q++;
|
||||
}
|
||||
want[i] = '\0';
|
||||
|
||||
strmaxcpy(have, script_login_name, sizeof(have) - 1);
|
||||
upstr(have);
|
||||
strmaxcpy(tmp, script_login_name, sizeof(tmp) - 1);
|
||||
upstr(tmp);
|
||||
|
||||
if (neg) return(strcmp(have, want) != 0);
|
||||
return(strcmp(have, want) == 0);
|
||||
if (neg) return(strcmp(tmp, want) != 0);
|
||||
else return(strcmp(tmp, want) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
p = strstr(tmp, "DAY_OF_WEEK");
|
||||
if (p != NULL) {
|
||||
q = strchr(p, '=');
|
||||
if (q != NULL) {
|
||||
char want[64];
|
||||
char have[64];
|
||||
int i = 0;
|
||||
|
||||
q++;
|
||||
q = skip_spaces(q);
|
||||
if (*q == '"' || *q == '\'') q++;
|
||||
|
||||
while (*q && *q != '"' && *q != '\'' && *q != 32 && *q != '\t' && i < 63)
|
||||
want[i++] = *q++;
|
||||
want[i] = '\0';
|
||||
|
||||
strcpy(have, "DAY_OF_WEEK");
|
||||
script_get_timevar(have, have, sizeof(have));
|
||||
upstr(have);
|
||||
|
||||
return(strcmp(have, want) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int login_strnicmp(char *a, char *b, int n)
|
||||
{
|
||||
while (n-- > 0) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(ca - cb);
|
||||
if (!ca) return(0);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -394,7 +204,7 @@ static int script_execute_line(char *line)
|
||||
strmaxcpy(work, line, sizeof(work) - 1);
|
||||
p = skip_spaces(work);
|
||||
|
||||
if (!*p || *p == ';') return(0);
|
||||
if (!*p) return(0);
|
||||
|
||||
i = 0;
|
||||
while (p[i] && p[i] != 32 && p[i] != '\t' && i < 31) {
|
||||
@@ -420,7 +230,7 @@ static int script_execute_line(char *line)
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "CLS")) {
|
||||
login_cls_attr(0x07);
|
||||
clrscr();
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -452,17 +262,10 @@ static int script_execute_line(char *line)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!strncmp(up, "ROOT ", 5)) {
|
||||
char callbuf[512];
|
||||
sprintf(callbuf, "MAP %s", skip_spaces(arg + 5));
|
||||
script_call_line(callbuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!strncmp(up, "INS ", 4) || !strncmp(up, "INSERT ", 7)) {
|
||||
char callbuf[512];
|
||||
char *a = arg;
|
||||
if (!login_strnicmp(up, "INS ", 4)) a += 4;
|
||||
if (!strnicmp(up, "INS ", 4)) a += 4;
|
||||
else a += 7;
|
||||
sprintf(callbuf, "PATHINS %s", skip_spaces(a));
|
||||
script_call_line(callbuf);
|
||||
@@ -472,7 +275,7 @@ static int script_execute_line(char *line)
|
||||
if (!strncmp(up, "DEL ", 4) || !strncmp(up, "DELETE ", 7)) {
|
||||
char callbuf[512];
|
||||
char *a = arg;
|
||||
if (!login_strnicmp(up, "DEL ", 4)) a += 4;
|
||||
if (!strnicmp(up, "DEL ", 4)) a += 4;
|
||||
else a += 7;
|
||||
sprintf(callbuf, "PATHDEL %s", skip_spaces(a));
|
||||
script_call_line(callbuf);
|
||||
@@ -480,10 +283,6 @@ static int script_execute_line(char *line)
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "ATTACH")) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "EXIT")) {
|
||||
return(1);
|
||||
}
|
||||
@@ -492,87 +291,20 @@ static int script_execute_line(char *line)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int try_login_script_file(char *name)
|
||||
{
|
||||
return(read_command_file(name));
|
||||
}
|
||||
|
||||
static int run_login_script(void)
|
||||
{
|
||||
char profile[200];
|
||||
char drive;
|
||||
|
||||
/*
|
||||
* Novell LOGIN looks for the system login script using server based paths,
|
||||
* for example \\SERVER\SYS\PUBLIC\NET$LOG.DAT. Try that first.
|
||||
*/
|
||||
if (*script_file_server) {
|
||||
sprintf(profile, "\\\\%s\\SYS\\PUBLIC\\NET$LOG.DAT", script_file_server);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
sprintf(profile, "%snet$log.dat", prgpath);
|
||||
if (read_command_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "\\\\%s\\SYS\\PUBLIC\\net$log.dat", script_file_server);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
sprintf(profile, "%slogin", prgpath);
|
||||
if (read_command_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "\\\\%s\\SYS\\LOGIN\\LOGIN", script_file_server);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "\\\\%s\\SYS\\LOGIN\\NET$LOG.DAT", script_file_server);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then try current directory and the executable path. LOGIN.EXE is often
|
||||
* executed from PUBLIC, so this covers SYS:PUBLIC\NET$LOG.DAT without
|
||||
* relying on an absolute drive path.
|
||||
*/
|
||||
if (try_login_script_file("NET$LOG.DAT") != -2) return(0);
|
||||
if (try_login_script_file("net$log.dat") != -2) return(0);
|
||||
if (try_login_script_file("LOGIN") != -2) return(0);
|
||||
if (try_login_script_file("login") != -2) return(0);
|
||||
|
||||
if (*prgpath) {
|
||||
sprintf(profile, "%sNET$LOG.DAT", prgpath);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%snet$log.dat", prgpath);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%sLOGIN", prgpath);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%slogin", prgpath);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fallbacks for requesters/runtimes that cannot open UNC from C fopen().
|
||||
*/
|
||||
if (try_login_script_file("\\PUBLIC\\NET$LOG.DAT") != -2) return(0);
|
||||
if (try_login_script_file("\\public\\net$log.dat") != -2) return(0);
|
||||
if (try_login_script_file("\\PUBLIC\\LOGIN") != -2) return(0);
|
||||
if (try_login_script_file("\\public\\login") != -2) return(0);
|
||||
|
||||
if (try_login_script_file("\\LOGIN\\LOGIN") != -2) return(0);
|
||||
if (try_login_script_file("\\login\\login") != -2) return(0);
|
||||
if (try_login_script_file("\\LOGIN\\NET$LOG.DAT") != -2) return(0);
|
||||
if (try_login_script_file("\\login\\net$log.dat") != -2) return(0);
|
||||
|
||||
for (drive = 'C'; drive <= 'Z'; drive++) {
|
||||
sprintf(profile, "%c:\\PUBLIC\\NET$LOG.DAT", drive);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%c:\\public\\net$log.dat", drive);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%c:\\PUBLIC\\LOGIN", drive);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%c:\\LOGIN\\LOGIN", drive);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
|
||||
sprintf(profile, "%c:\\LOGIN\\NET$LOG.DAT", drive);
|
||||
if (try_login_script_file(profile) != -2) return(0);
|
||||
}
|
||||
if (read_command_file("net$log.dat") != -2) return(0);
|
||||
if (read_command_file("login") != -2) return(0);
|
||||
if (read_command_file("\\login\\login") != -2) return(0);
|
||||
if (read_command_file("\\login\\net$log.dat") != -2) return(0);
|
||||
|
||||
return(-2);
|
||||
}
|
||||
@@ -737,7 +469,7 @@ int func_login(int argc, char *argv[], int mode)
|
||||
if (argv[1][0] == '-' || argv[1][0] == '/') {
|
||||
if (argv[1][1] == 'u' || argv[1][1] == 'U') option |= 1;
|
||||
else if (!strcmp(argv[1], "/NS") || !strcmp(argv[1], "-NS")) no_script = 1;
|
||||
else if (!strcmp(argv[1], "/CLS") || !strcmp(argv[1], "-CLS")) login_cls_attr(0x07);
|
||||
else if (!strcmp(argv[1], "/CLS") || !strcmp(argv[1], "-CLS")) clrscr();
|
||||
else return(login_usage());
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
306
map.c
306
map.c
@@ -28,9 +28,9 @@ static void show_map(uint8 *drvstr)
|
||||
if (flags & 0x80) { /* lokal DRIVE */
|
||||
path[0]= '\\';
|
||||
if (j < 2){
|
||||
strcpy(path, "maps to a local disk.");
|
||||
strcpy(path, "DISK LW");
|
||||
} else if (getcurdir(j+1, path+1)) {
|
||||
strcpy(path, "maps to a local disk.");
|
||||
strcpy(path, "LW !OK");
|
||||
}
|
||||
} else {
|
||||
if (get_dir_path(dhandle, path)) {
|
||||
@@ -41,7 +41,7 @@ static void show_map(uint8 *drvstr)
|
||||
strcat(servern, "\\");
|
||||
} else servern[0]='\0';
|
||||
}
|
||||
if (flags & 0x80) printf("Drive %c: %s\n", (char)j+'A', path); else printf("Drive %c: = %s%s\n", (char)j+'A', servern, path);
|
||||
printf("MAP %c: = %s%s\n", (char)j+'A', servern, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,9 @@ static void do_map(int drive, NWPATH *nwp)
|
||||
if (flags & 0x80) { /* lokal DRIVE */
|
||||
path[0]= '\\';
|
||||
if (drive < 2){
|
||||
strcpy(path, "maps to a local disk.");
|
||||
strcpy(path, "DISK LW");
|
||||
} else if (getcurdir(drive+1, path+1)) {
|
||||
strcpy(path, "maps to a local disk.");
|
||||
strcpy(path, "LW !OK");
|
||||
}
|
||||
} else {
|
||||
if (get_dir_path(dhandle, path)) {
|
||||
@@ -188,129 +188,11 @@ static int parse_argv(uint8 *drvstr, NWPATH *nwpath,
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int parse_pathins_arg(uint8 *drvstr, NWPATH *nwp,
|
||||
int argc, char *argv[], int mode);
|
||||
static int set_search_native(uint8 *drvstr, NWPATH *nwp, int pathmode);
|
||||
static int show_search(uint8 *drvstr);
|
||||
|
||||
static int map_same_arg(char *a, char *b)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int map_is_drive_arg(char *s)
|
||||
{
|
||||
if (!s || !s[0] || s[1] != ':' || s[2]) return(0);
|
||||
if (s[0] >= 'A' && s[0] <= 'Z') return(1);
|
||||
if (s[0] >= 'a' && s[0] <= 'z') return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int map_drive_index(char *s)
|
||||
{
|
||||
if (s[0] >= 'a' && s[0] <= 'z') return(s[0] - 'a');
|
||||
return(s[0] - 'A');
|
||||
}
|
||||
|
||||
static void map_drive_name(char *dst, char *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
if (dst[0] >= 'a' && dst[0] <= 'z') dst[0] -= 32;
|
||||
dst[1] = ':';
|
||||
dst[2] = '\0';
|
||||
}
|
||||
|
||||
static int map_handle_path_command(int argc, char *argv[], int pathmode)
|
||||
{
|
||||
uint8 drvstr[22];
|
||||
NWPATH nwpath;
|
||||
int rc;
|
||||
|
||||
rc = parse_pathins_arg(drvstr, &nwpath, argc, argv, pathmode);
|
||||
if (!rc) {
|
||||
int result = 0;
|
||||
|
||||
if (*(nwpath.path) || pathmode == 1)
|
||||
result = set_search_native(drvstr, &nwpath, pathmode);
|
||||
|
||||
if (result < 0)
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
else if (pathmode != 1)
|
||||
show_search(drvstr);
|
||||
else
|
||||
fprintf(stdout, "The search mapping for drive S%d: was deleted\n",
|
||||
(int)drvstr[1]);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
int func_map(int argc, char *argv[], int mode)
|
||||
{
|
||||
uint8 drvstr[22];
|
||||
NWPATH nwpath;
|
||||
|
||||
if (!ipx_init()) argc = 1;
|
||||
|
||||
/*
|
||||
* Novell MAP accepts subcommands through MAP itself:
|
||||
* MAP DEL H:
|
||||
* MAP INS S1:=SYS:PUBLIC
|
||||
* MAP DEL S1:
|
||||
* The original mars-dosutils exposed those mainly as MAPDEL/PATHINS/PATHDEL,
|
||||
* so handle the Novell syntax here and then reuse the existing primitives.
|
||||
*/
|
||||
if (argc > 1) {
|
||||
if (map_same_arg(argv[1], "/?") || map_same_arg(argv[1], "-?") ||
|
||||
map_same_arg(argv[1], "?")) {
|
||||
fprintf(stderr, "Directory \"/?\" is not locatable.\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (map_same_arg(argv[1], "INS") || map_same_arg(argv[1], "INSERT")) {
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
return(1);
|
||||
}
|
||||
return(map_handle_path_command(argc - 1, argv + 1, 2));
|
||||
}
|
||||
|
||||
if (map_same_arg(argv[1], "DEL") || map_same_arg(argv[1], "DELETE")) {
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (map_is_drive_arg(argv[2])) {
|
||||
char dname[3];
|
||||
int drive = map_drive_index(argv[2]);
|
||||
|
||||
if (do_map(drive, &nwpath, 1) < 0) {
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
map_drive_name(dname, argv[2]);
|
||||
fprintf(stdout, "The mapping for drive %s has been deleted.\n", dname);
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(map_handle_path_command(argc - 1, argv + 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (!parse_argv(drvstr, &nwpath, argc, argv, 0, mode)) {
|
||||
if (*(nwpath.path) || mode==1) {
|
||||
if (do_map(*drvstr - 'A', &nwpath, mode)< 0)
|
||||
@@ -415,192 +297,18 @@ static int set_search(uint8 *drvstr, NWPATH *nwp, int pathmode)
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
static int path_is_drive_path(uint8 *path)
|
||||
{
|
||||
if (!path || !path[0] || path[1] != ':') return(0);
|
||||
if (path[0] >= 'A' && path[0] <= 'Z') return(1);
|
||||
if (path[0] >= 'a' && path[0] <= 'z') return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void upstr_local(uint8 *s)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s >= 'a' && *s <= 'z') *s -= 0x20;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
static int parse_pathins_arg(uint8 *drvstr, NWPATH *nwp, int argc, char *argv[], int mode)
|
||||
{
|
||||
char joined[512];
|
||||
char *p;
|
||||
char *q;
|
||||
int slot = 0;
|
||||
int k;
|
||||
|
||||
*drvstr = '\0';
|
||||
memset(nwp, 0, sizeof(NWPATH));
|
||||
nwp->path = nwp->buff;
|
||||
*(nwp->buff) = '\0';
|
||||
|
||||
if (argc < 2) return(1);
|
||||
|
||||
joined[0] = '\0';
|
||||
for (k = 1; k < argc; k++) {
|
||||
if (k > 1) strcat(joined, " ");
|
||||
strncat(joined, argv[k], sizeof(joined) - strlen(joined) - 1);
|
||||
}
|
||||
|
||||
p = joined;
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
|
||||
if (*p != 'S' && *p != 's') return(-1);
|
||||
p++;
|
||||
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
slot = slot * 10 + (*p - '0');
|
||||
p++;
|
||||
}
|
||||
|
||||
if (slot < 1 || slot > 16) return(-1);
|
||||
if (*p != ':') return(-1);
|
||||
p++;
|
||||
|
||||
drvstr[0] = 's';
|
||||
drvstr[1] = (uint8)slot;
|
||||
drvstr[2] = '\0';
|
||||
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
|
||||
if (mode == 1) {
|
||||
/* PATHDEL S1: */
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (*p == '=') p++;
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
|
||||
if (!*p) return(-1);
|
||||
|
||||
q = nwp->buff;
|
||||
while (*p && (q - nwp->buff) < (int)sizeof(nwp->buff) - 1) {
|
||||
*q++ = *p++;
|
||||
}
|
||||
*q = '\0';
|
||||
|
||||
upstr_local(nwp->buff);
|
||||
nwp->path = nwp->buff;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int set_search_native(uint8 *drvstr, NWPATH *nwp, int pathmode)
|
||||
{
|
||||
int result=-1;
|
||||
SEARCH_VECTOR drives;
|
||||
SEARCH_VECTOR_ENTRY *p=drives;
|
||||
int j=0;
|
||||
int entry = (*drvstr=='s') ? *(drvstr+1) : 0;
|
||||
|
||||
get_search_drive_vektor(drives);
|
||||
|
||||
while (p->drivenummer != 0xff && j++ < 16) {
|
||||
if (!entry && path_is_drive_path(nwp->path)
|
||||
&& (p->drivenummer + 'A' == nwp->path[0])) entry=j;
|
||||
|
||||
if (path_is_drive_path(nwp->path)
|
||||
&& p->drivenummer + 'A' == nwp->path[0]
|
||||
&& !strcmp(nwp->path+2, p->dospath)) {
|
||||
p->drivenummer=0xfe;
|
||||
*(p->dospath) = '\0';
|
||||
p->flags = 0;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
if (entry > 0) {
|
||||
if (entry > 16) entry = 16;
|
||||
|
||||
if (pathmode == 2 && entry <= j && entry < 16) { /* insert modus */
|
||||
int k=j+1-entry;
|
||||
if (j < 16) {
|
||||
p++;
|
||||
k++;
|
||||
j++;
|
||||
}
|
||||
while (k--) {
|
||||
memcpy(p, p-1, sizeof(SEARCH_VECTOR_ENTRY));
|
||||
--p;
|
||||
}
|
||||
}
|
||||
|
||||
if (--entry < j)
|
||||
p = drives+entry;
|
||||
else
|
||||
(p+1)->drivenummer = 0xff;
|
||||
|
||||
memset(p, 0, sizeof(SEARCH_VECTOR_ENTRY));
|
||||
|
||||
if (pathmode==1) {
|
||||
p->drivenummer = 0xfe;
|
||||
*(p->dospath) = '\0';
|
||||
result = set_search_drive_vektor(drives);
|
||||
} else if (path_is_drive_path(nwp->path)) {
|
||||
p->flags = 0;
|
||||
p->drivenummer = (uint8)(nwp->path[0] - 'A');
|
||||
if (nwp->path[0] >= 'a' && nwp->path[0] <= 'z')
|
||||
p->drivenummer = (uint8)(nwp->path[0] - 'a');
|
||||
strmaxcpy(p->dospath, nwp->path+2, sizeof(p->dospath)-1);
|
||||
result = set_search_drive_vektor(drives);
|
||||
} else {
|
||||
/*
|
||||
* Search path entries are not drive mappings. The original code stores
|
||||
* the NetWare path text directly in dospath with drivenummer=0xfe.
|
||||
* Client32 keeps/prints these entries correctly; allocating a permanent
|
||||
* directory handle here made set_search_drive_vektor() return success,
|
||||
* but the entry did not actually replace SEARCH1.
|
||||
*/
|
||||
p->flags = 0;
|
||||
p->drivenummer = 0xfe;
|
||||
strmaxcpy(p->dospath, nwp->path, sizeof(p->dospath)-1);
|
||||
result = set_search_drive_vektor(drives);
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
int func_path(int argc, char *argv[], int mode)
|
||||
{
|
||||
uint8 drvstr[22];
|
||||
NWPATH nwpath;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* PATH/PATHINS/PATHDEL need their own parser. The old parse_argv()
|
||||
* rejects common login-script syntax such as:
|
||||
* PATHINS S1:=SYS:PUBLIC
|
||||
* MAP INS S1:=SYS:PUBLIC
|
||||
*/
|
||||
if (argc < 2) {
|
||||
show_search("");
|
||||
return(0);
|
||||
}
|
||||
|
||||
rc = parse_pathins_arg(drvstr, &nwpath, argc, argv, mode);
|
||||
if (!rc) {
|
||||
if (!parse_argv(drvstr, &nwpath, argc, argv, 1, mode)) {
|
||||
int result=0;
|
||||
if (*(nwpath.path) || mode==1)
|
||||
result=set_search_native(drvstr, &nwpath, mode);
|
||||
result=set_search(drvstr, &nwpath, mode);
|
||||
if (mode != 1)
|
||||
show_search(drvstr);
|
||||
return(result);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Cannot interpret line. errcode=-1\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
2
net.c
2
net.c
@@ -34,8 +34,6 @@ static struct s_net_functions {
|
||||
{"PATHDEL","removes search path" , func_path , 1},
|
||||
{"PATHINS","insert search path" , func_path , 2},
|
||||
{"LOGOUT", "logout from server", func_logout , 0},
|
||||
{"FLAG", "display or modify file attributes", func_flag , 0},
|
||||
{"FLAGDIR","display or modify directory attributes",func_flagdir, 0},
|
||||
{"SLIST", "list servers", func_slist , 0},
|
||||
{"PASSWD", "change password", func_passwd , 0},
|
||||
#if 1
|
||||
|
||||
4
net.h
4
net.h
@@ -252,10 +252,6 @@ extern int func_tests (int argc, char *argv[], int mode);
|
||||
/* capture.c */
|
||||
extern int func_capture(int argc, char *argv[], int mode);
|
||||
|
||||
/* flag.c */
|
||||
extern int func_flag (int argc, char *argv[], int mode);
|
||||
extern int func_flagdir(int argc, char *argv[], int mode);
|
||||
|
||||
|
||||
extern int ncp_17_37(uint32 last_id, uint16 objtyp, uint8 *pattern,
|
||||
BINDERY_OBJECT *target);
|
||||
|
||||
126
nwtests.c
126
nwtests.c
@@ -1,104 +1,44 @@
|
||||
/* nwtests.c - small DOS utility tests */
|
||||
/* nwtests.c 20-May-96 */
|
||||
|
||||
/****************************************************************
|
||||
* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany *
|
||||
****************************************************************/
|
||||
|
||||
#include "net.h"
|
||||
#include "c32ncp.h"
|
||||
static int tests_same_arg(char *a, char *b)
|
||||
|
||||
static int usage(void)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void tests_usage(void)
|
||||
{
|
||||
fprintf(stdout, "Usage: TESTS [NCP87C32ATTR|NCP87C32AUTO]\n");
|
||||
}
|
||||
|
||||
static int tests_get_current_drive(void)
|
||||
{
|
||||
REGS regs;
|
||||
|
||||
regs.h.ah = 0x19;
|
||||
int86(0x21, ®s, ®s);
|
||||
return((int)regs.h.al);
|
||||
}
|
||||
|
||||
static int tests_current_dhandle(uint8 *dhandle)
|
||||
{
|
||||
uint8 connid = 0;
|
||||
uint8 flags = 0;
|
||||
int drive;
|
||||
|
||||
drive = tests_get_current_drive();
|
||||
if (get_drive_info((uint8)drive, &connid, dhandle, &flags))
|
||||
return(-1);
|
||||
|
||||
if (!connid || (flags & 0x80))
|
||||
return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int tests_ncp87c32attr(void)
|
||||
{
|
||||
uint8 dhandle = 0;
|
||||
uint32 attr = 0;
|
||||
uint16 actual = 0;
|
||||
uint16 handle_lo = 0;
|
||||
uint16 handle_hi = 0;
|
||||
int rc;
|
||||
|
||||
if (tests_current_dhandle(&dhandle)) {
|
||||
fprintf(stdout, "NCP87C32ATTR failed: current drive is not a network drive\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
rc = c32_ncp87_obtain_rim_attributes("LOGIN.EXE",
|
||||
(uint16)dhandle,
|
||||
&attr,
|
||||
&actual,
|
||||
&handle_lo,
|
||||
&handle_hi);
|
||||
if (rc) {
|
||||
fprintf(stdout, "NCP87C32ATTR failed rc=%d\n", rc);
|
||||
return(rc);
|
||||
}
|
||||
|
||||
fprintf(stdout, "NCP87C32ATTR LOGIN.EXE attr=%02lX handle=%04X:%04X actual=%04X\n",
|
||||
attr & 0xffUL, handle_hi, handle_lo, actual);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int tests_ncp87c32auto(void)
|
||||
{
|
||||
/*
|
||||
* Kept as a compatibility alias for the former verbose test command.
|
||||
* The production helper path is exercised by NCP87C32ATTR.
|
||||
*/
|
||||
return tests_ncp87c32attr();
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int func_tests(int argc, char *argv[], int mode)
|
||||
{
|
||||
(void)mode;
|
||||
|
||||
if (argc < 2) {
|
||||
tests_usage();
|
||||
return(1);
|
||||
int level = ncp_17_02(NWCONN, 6);
|
||||
int dirhandle = alloc_temp_dir_handle(0, "SYS:", 'd', NULL);
|
||||
int result = -1;
|
||||
uint8 *path = (argc < 2) ? "SYS:\\TMP" : argv[1];
|
||||
if (dirhandle > -1) {
|
||||
result = ncp_16_02(dirhandle, "SYSTEM/", NULL, NULL, NULL, NULL);
|
||||
result = ncp_16_02(dirhandle, "SYSTEM", NULL, NULL, NULL, NULL);
|
||||
}
|
||||
fprintf(stdout, "dirhandle=%d, result=%d\n", dirhandle, result);
|
||||
result = redir_device_drive(0x4, "u:", path);
|
||||
fprintf(stdout, "redir path=%s, result=%d\n", path, result);
|
||||
|
||||
if (tests_same_arg(argv[1], "NCP87C32ATTR"))
|
||||
return tests_ncp87c32attr();
|
||||
path="Q1";
|
||||
result = redir_device_drive(0x3, "LPT1", path);
|
||||
fprintf(stdout, "redir path=%s, result=%d\n", path, result);
|
||||
|
||||
if (tests_same_arg(argv[1], "NCP87C32AUTO"))
|
||||
return tests_ncp87c32auto();
|
||||
|
||||
tests_usage();
|
||||
return(1);
|
||||
{
|
||||
int k =-1;
|
||||
uint8 devname[20];
|
||||
uint8 remotename[130];
|
||||
int devicetyp;
|
||||
while ((result = list_redir(++k, &devicetyp, devname, remotename)) > -1){
|
||||
fprintf(stdout, "index=%d, dev=%s(%d), %s result=%d\n",
|
||||
k, devname, devicetyp, remotename, result);
|
||||
}
|
||||
}
|
||||
if (level > -1) (void) ncp_17_02(NWCONN, level);
|
||||
return(0);
|
||||
}
|
||||
|
||||
84
slist.c
84
slist.c
@@ -2,49 +2,17 @@
|
||||
|
||||
#include "net.h"
|
||||
|
||||
#define NCP_BINDERY_FSERVER 0x0004
|
||||
|
||||
static int usage(void)
|
||||
{
|
||||
fprintf(stdout, "Usage: SLIST [Server] [/Continue]\n");
|
||||
return(0);
|
||||
fprintf(stderr, "usage:\t%s [pattern]\n", funcname);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int same_arg(char *a, char *b)
|
||||
static void print_net_node(uint8 *addr)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int is_help_arg(char *s)
|
||||
{
|
||||
if (!s) return(0);
|
||||
return(same_arg(s, "/?") || same_arg(s, "-?") || same_arg(s, "?"));
|
||||
}
|
||||
|
||||
static unsigned long node_to_number(uint8 *addr)
|
||||
{
|
||||
unsigned long n = 0;
|
||||
int i;
|
||||
|
||||
for (i = 4; i < 10; i++)
|
||||
n = (n << 8) + addr[i];
|
||||
|
||||
return(n);
|
||||
}
|
||||
|
||||
static void print_net_node_status(uint8 *addr, int is_default)
|
||||
{
|
||||
fprintf(stdout, "[%08lX][%12lu]%s",
|
||||
fprintf(stdout, "%08lX %02X%02X%02X%02X%02X%02X",
|
||||
(unsigned long)GET_BE32(addr),
|
||||
node_to_number(addr),
|
||||
is_default ? "Default" : "");
|
||||
addr[4], addr[5], addr[6], addr[7], addr[8], addr[9]);
|
||||
}
|
||||
|
||||
int func_slist(int argc, char *argv[], int mode)
|
||||
@@ -54,50 +22,33 @@ int func_slist(int argc, char *argv[], int mode)
|
||||
uint8 pattern[50];
|
||||
int found = 0;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
(void)mode;
|
||||
|
||||
strcpy(pattern, "*");
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (is_help_arg(argv[i])) return(usage());
|
||||
|
||||
if (argv[i][0] == '/' || argv[i][0] == '-') {
|
||||
if (same_arg(argv[i], "/C") || same_arg(argv[i], "/CONTINUE") ||
|
||||
same_arg(argv[i], "-C") || same_arg(argv[i], "-CONTINUE")) {
|
||||
continue;
|
||||
}
|
||||
return(usage());
|
||||
}
|
||||
|
||||
strmaxcpy(pattern, argv[i], sizeof(pattern) - 1);
|
||||
}
|
||||
if (argc > 2) return(usage());
|
||||
|
||||
if (argc == 2) strmaxcpy(pattern, argv[1], sizeof(pattern) - 1);
|
||||
else strcpy(pattern, "*");
|
||||
upstr(pattern);
|
||||
|
||||
/*
|
||||
* Novell-like layout from the DOS client:
|
||||
* Known NetWare File Servers Network Node Address Status
|
||||
* ------------------------- -------- -------------------
|
||||
*/
|
||||
fprintf(stdout, "%-44sNetwork Node Address Status\n",
|
||||
"Known NetWare File Servers");
|
||||
fprintf(stdout, "%-44s------- ----------- ------\n",
|
||||
"--------------------------");
|
||||
fprintf(stdout, "\n%-52s%-10s%-12s\n",
|
||||
"Known NetWare File Servers", "Network", "Node Address");
|
||||
fprintf(stdout,
|
||||
"-----------------------------------------------"
|
||||
"---------------------------\n");
|
||||
|
||||
while ((result = ncp_17_37(last_id, NCP_BINDERY_FSERVER,
|
||||
pattern, &obj)) == 0) {
|
||||
NW_PROPERTY prop;
|
||||
|
||||
found++;
|
||||
found = 1;
|
||||
last_id = obj.object_id;
|
||||
|
||||
fprintf(stdout, "%-44s", obj.object_name);
|
||||
fprintf(stdout, "%-52s", obj.object_name);
|
||||
|
||||
if (!ncp_17_3d(NCP_BINDERY_FSERVER, obj.object_name,
|
||||
1, "NET_ADDRESS", &prop)) {
|
||||
print_net_node_status(prop.value, found == 1);
|
||||
print_net_node(prop.value);
|
||||
}
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
@@ -105,7 +56,8 @@ int func_slist(int argc, char *argv[], int mode)
|
||||
if (last_id == MAX_U32) break;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\nTotal of %d file servers found\n", found);
|
||||
if (!found)
|
||||
fprintf(stdout, "No servers found\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
2
tools.c
2
tools.c
@@ -328,7 +328,7 @@ int putglobenv(char *option)
|
||||
}
|
||||
search=nextp;
|
||||
}
|
||||
/* nicht gefunden , nun eintragen, falls m<EFBFBD>glich */
|
||||
/* nicht gefunden , nun eintragen, falls m”glich */
|
||||
if (*(equal+1) && optionlen < maxenvsize - aktenvsize) {
|
||||
strcpy(search, option);
|
||||
*(search+optionlen+1) = '\0'; /* letzter Eintrag '\0' nicht vergessen */
|
||||
|
||||
Reference in New Issue
Block a user