// Novell API interface (C) 1994 by Greg Miller // This API is not a complete interface to the NetWare routines. // Some functions in this API have not been tested, so use of them // may result in unpredictable behavior. The author assumes no // responsibility should the user of this file cause any harm to // any system. No warrenties EXPRESS OR IMPLIED. // This file is puplic domain and may be used in any way without // credit to the author, or distributor. This file may be freely // distributed or sold in part or whole without credit to the author. #ifndef __Novell_API_interface_by_Greg_Miller_V1_0 #define __Novell_API_interface_by_Greg_Miller_V1_0 //Macors for values used in GetBroadcastMode and SetBroadcastMode #define rcv_all_broad '\x0' #define rcv_s_discard_w_broad '\x1' #define store_s_broad '\x2' #define store_all_broad '\x3' //Macors for SendBroadcastMessage status report #define successful 0x0 #define buffer_full 0xfc #define invalid_connection 0xfd #define rejected 0xff #include "byteword.h" typedef byte NetworkNumber[4]; typedef byte NetworkNode[6]; typedef byte name_type[47]; typedef word dword[2]; struct time_record{ byte year, //(80-99 = 1980-1999, 00-79 = 2000-2079) month, day, hour, minute, second, day_of_week; //(0 = Sunday) }; word Get1stConnectionNumber(char username[8]){ unsigned int my_ax = 0; int count = 0; static struct { word len; byte buffer_type; word object_type; byte name_length; char name[48];} request; static struct { word len; byte number_connections; word connection_num[50];} reply; for (count = 0;count !=50;count++) reply.connection_num[count] = 0; request.len = 51; request.buffer_type = 0x15; request.object_type = 0x100; count = 0; do { request.name[count] = username[count++]; } while (username[count] != '\0'); request.name_length = count; reply.len = 101; // Maximum number of user connections asm{ push ax push ds push si push es push di mov ax, seg request mov ds, ax mov ax, offset request mov si, ax mov ax, seg reply mov es, ax mov ax, offset reply mov di, ax mov ah, 0e3h int 21h mov my_ax,ax pop di pop es pop si pop ds pop ax } return reply.connection_num[0]; } void GetInternetAddress(byte Connection_number, NetworkNumber &num, NetworkNode &node) {int my_ax; int count = 1; static struct {word len; byte buffer_type; byte connection_number;} request; static struct {word len; NetworkNumber num; NetworkNode node; word server_socket;} reply; request.len = 2; request.buffer_type = 0x13; request.connection_number = Connection_number; reply.len = 12; asm{ pushf push ax push ds push si push es push di mov ax,seg request mov ds, ax mov ax,offset request mov si,ax mov ax,seg reply mov es,ax mov ax,offset reply mov di,ax mov ah,0e3h int 21h mov ah,0 mov my_ax,ax pop di pop es pop si pop ds pop ax popf } do { num[count] = reply.num[count]; } while (count++ < 4); count = 0; do { node[count] = reply.node[count]; } while (count++ < 6); } //SystemLogout() //AH=D7h //Closes the station's open files, logs it out from all file servers, // detatches the workstation from all non-default file servers, and maps a // drive to the default server's SYS:LOGIN directory void SystemLogout(){ asm{ push ax mov ah,0d7h int 21h pop ax }} //ConnectionNumber() //AH=DCh //Returns the connection number of the local workstation. //AL=logical connection number (0 if NetWare not loaded or the machine in // question is a non-dedicated server) //CX=station number in ASCII (CL=first digit) int ConnectionNumber(){ int con; asm{ push ax mov ah,0dch int 21h xor ah,ah mov con,ax pop ax } return con; } //GetConnectionInformation void GetConnectionInformation(int connection, dword &ID, word &type, name_type &username, time_record &time){ static struct {word len; byte func,connection;} request; static struct {word len; dword id; word type; name_type name; time_record time;} reply; int count = 0; request.len = 2; request.func = 0x16; request.connection = connection; reply.len = 62; asm{ push ax push ds push es push si push di mov ax, seg request mov ds, ax mov ax, offset request mov si, ax mov ax, seg reply mov es, ax mov ax, offset reply mov di, ax mov ah, 0e3h int 21h pop di pop si pop es pop ds pop ax } ID[1] = reply.id[1]; ID[2] = reply.id[2]; type = reply.type; do {username[count] = reply.name[count];} while (count++ < 48); time = reply.time; } void SetBroadcastMode(byte mode){ asm{ push ax push dx mov ah,0deh mov dl,mode int 21h pop dx pop ax } } void GetBroadcastMode(int &mode){ asm{ push ax push dx mov ah,0deh mov dl,04h int 21h mov ah,00 pop dx } mode = _AX; asm {pop ax} } void SendBroadcastMessage(byte connections[100], //MUST BE BUFFERED W/ 0's byte message[55], byte results[100] ){ int count = 0; static struct{word len; byte func,num_connections; byte connections[100]; byte message_len; byte message[55];} request; static struct{word len; byte num_connections; byte results[100];} reply; request.len = 158; request.func = 0; do { request.connections[count] = connections[count]; } while (count++ != 100); request.num_connections = 100; for (count=0; count!=55; count++) request.message[count]=32; count = 0; do { if (message[count] != '\0') request.message[count+1] = message[count]; } while ((count != 55) && (message[count++] != 0)); reply.len = 2 + 1 + 100; asm{ push ax push ds push es push si push di mov ax, seg request mov ds, ax lea si, request mov ax, seg reply mov es, ax lea di, reply mov ah, 0e1h int 21h pop di pop si pop es pop ds pop ax } count = 0; do{ results[count] = reply.results[count]; } while (count++ != 100); } void FullName(name_type username, word type, char* &full_name){ byte my_ah; int count = 0; static struct { word len; byte func; word type; byte name_len; name_type name; byte segment; byte property_len; byte property_name[14];} request; static struct { word len; byte value[128]; byte segment_flag; byte property_flag;} reply; request.len = 0x45; request.func = 0x3d; request.type = type; request.segment = 1; do {request.name[count] = '\0';} while (count++ != 45); count = 0; do {request.name[count] = username[count];} while (username[++count] != '\0'); request.name_len = 47; request.property_len = 14; request.property_name[0 ] = 'I'; request.property_name[1 ] = 'D'; request.property_name[2 ] = 'E'; request.property_name[3 ] = 'N'; request.property_name[4 ] = 'T'; request.property_name[5 ] = 'I'; request.property_name[6 ] = 'F'; request.property_name[7 ] = 'I'; request.property_name[8 ] = 'C'; request.property_name[9 ] = 'A'; request.property_name[10 ] = 'T'; request.property_name[11 ] = 'I'; request.property_name[12 ] = 'O'; request.property_name[13 ] = 'N'; reply.len = 0x82; asm { push ax push ds push es push si push di mov ax,seg request mov ds,ax lea si,request mov ax,seg reply mov es,ax lea di,reply mov ah,0e3h int 21h mov my_ah,al pop di pop si pop es pop ds pop ax } full_name = reply.value; } #endif