static char FindPartner( void ) { static BYTE segdata[128]; BYTE moresegs; BYTE flags; WORD connection; if( NWGetPrimaryConnectionID( &connection ) != 0 ) return( 0 ); if( NWReadPropertyValue( connection, &SAPHead.name, DBG_SERVER_TYPE, "NET_ADDRESS", 1, segdata, &moresegs, &flags ) != 0 ) return( 0 ); memcpy( &ServHead.destNet, segdata, 12 ); if( IpxGetLocalTarget( (PUCHAR)&ServHead.destNet, &ServECB, (PULONG)segdata ) != 0 ) return( 0 ); IpxSend( IPXSocket, &ServECB ); RespECB.fragList[1].fragAddress = &PartnerSPXSocket; if( IpxReceive( IPXSocket, 55*MAX_PARTNER_WAIT, &RespECB ) != 0 ) return( 0 ); _IPX_ASSIGNADDR( SendHead.dest, RespHead.source ); SendHead.destSocket = PartnerSPXSocket; AssignArray( SendECB.immediateAddress, RespECB.immediateAddress ); return( 1 ); }
// // Check_Configuration // // This function reads the configuration files and/or interacts with the // user to insure that required configuration items are set to // something. This function depends on bindery emulation. It should be // updated sometime to use NDS facilities instead. // static void Check_Configuration() { // Read the configuration files. spica::read_config_files(MASTER_CONFIGPATH); // Do we have the required configuration items? string *Name = spica::lookup_parameter("Full_Name"); string *Address = spica::lookup_parameter("Email_Address"); // If so, load the current options. if (Name != 0 && Address != 0) { *Full_Name = Name->c_str(); *Email_Address = Address->c_str(); } // Otherwise try to compute this information or, as a last ditch, // ask the user. // else { #ifndef ON_NETWORK bool Ask_User = true; #endif #ifdef ON_NETWORK NWCONN_HANDLE Connection; BYTE *Buffer = new BYTE[128]; NWFLAGS More_Data; char Username[MAX_DN_CHARS+1]; bool Ask_User = false; // Can we initialize the NetWare client? if (NWCallsInit(0, 0) != SUCCESSFUL) { Ask_User = true; } // Can we figure out our username? else if (!Get_Username(Username)) { Ask_User = true; } // Can we get a valid connection handle? else if (NWGetConnectionHandle("NIGHT", 0, &Connection, 0)) { Ask_User = true; } // Can we figure out our full name? else if (NWReadPropertyValue(Connection, Username, OT_USER, "IDENTIFICATION", 1, Buffer, &More_Data, 0)) { Ask_User = true; } // All of that worked. Update our internal information *and* the // config file. // else { Full_Name = reinterpret_cast<char *>(Buffer); Email_Address = Username; Email_Address.Append("@vtc.vsc.edu"); spica::Register_Parameter("Full_Name", Full_Name, false); spica::Register_Parameter("Email_Address", Email_Address, false); spica::Write_ConfigFile(); } delete [] Buffer; #endif // Something didn't work. Ask the user. if (Ask_User) { DialogBox(Global::Get_Instance(), MAKEINTRESOURCE(CONFIG_DIALOG), 0, Config_Dialog); } } }
static char FindPartner( void ) { static char RepBuff[132]; #ifdef __WINDOWS__ { BYTE moresegments; BYTE propertyflags; int binderyerror; binderyerror = NWReadPropertyValue( 0, SAPHead.name, DBG_SERVER_TYPE, // _SWAPINT( DBG_SERVER_TYPE ), "NET_ADDRESS", 1, RepBuff, (void *)&moresegments, (void *)&propertyflags ); if( binderyerror != 0 ) return( 0 ); AssignArray( ServHead.destination, RepBuff[0] ); } #else { extern char ReadPropertyValue( void *, void *); #pragma aux ReadPropertyValue = \ 0xb4 0xe3 /* mov ah,0e3h */ \ 0x1e /* push ds */ \ 0x07 /* pop es */ \ 0xcd 0x21 /* int 21h */ \ parm [ si ] [ di ] value [al] modify [ es ]; static char ReqBuff[80]; unsigned i; ReqBuff[ 2 ] = 0x3d; /* sub-function */ ACC_WORD( ReqBuff[ 3 ] ) = DBG_SERVER_TYPE; i = strlen( SAPHead.name ); ReqBuff[5] = i; memcpy( &ReqBuff[6], &SAPHead.name, i ); i += 6; ReqBuff[ i++ ] = 1; ReqBuff[ i++ ] = sizeof( "NET_ADDRESS" ) - 1; memcpy( &ReqBuff[ i ], "NET_ADDRESS", sizeof( "NET_ADDRESS" ) - 1 ); ACC_WORD( ReqBuff[0] ) = i + (sizeof( "NET_ADDRESS" ) - 2); ACC_WORD( RepBuff[0] ) = 130; putstring( "read prop\r\n" ); if( ReadPropertyValue( &ReqBuff, &RepBuff ) != 0 ) return( 0 ); putstring( "assgn array\r\n" ); AssignArray( ServHead.destination, RepBuff[2] ); } #endif putstring( "lcl targ\r\n" ); if( _IPXGetLocalTarget( &ServHead.destination.network.a[0], &ServECB.immediateAddress.a[0], (WORD *)&RepBuff ) != 0 ) return( 0 ); RespECB.fragmentDescriptor[1].address = &PartnerSPXSocket; _IPXListenForPacket( &RespECB ); putstring( "send p\r\n" ); _IPXSendPacket( &ServECB ); WaitOn( ServECB ); putstring( "wait for\r\n" ); if( !WaitTimeout( &RespECB, MAX_PARTNER_WAIT, 1 ) ) return( 0 ); putstring( "got one\r\n" ); SendHead.destination = RespHead.source; SendHead.destination.socket = PartnerSPXSocket; SendECB.immediateAddress = RespECB.immediateAddress; return( 1 ); }