CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

IPX95.CPP (9414B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /***************************************************************************
     17  **   C O N F I D E N T I A L --- W E S T W O O D    S T U D I O S        **
     18  ***************************************************************************
     19  *                                                                         *
     20  *                 Project Name : Command & Conquer                        *
     21  *                                                                         *
     22  *                    File Name : IPX95PP                                  *
     23  *                                                                         *
     24  *                   Programmer : Steve Tall                               *
     25  *                                                                         *
     26  *                   Start Date : January 22nd, 1996                       *
     27  *                                                                         *
     28  *                  Last Update : July 10th, 1996   [ST]                   *
     29  *                                                                         *
     30  *-------------------------------------------------------------------------*
     31  * Overview:                                                               *
     32  *                                                                         *
     33  *  Windows 95 equivelent functions from IPX.CPP                           *
     34  *                                                                         *
     35  *-------------------------------------------------------------------------*
     36  * Functions:                                                              *
     37  *                                                                         *
     38  *                                                                         *
     39  *                                                                         *
     40  *                                                                         *
     41  *                                                                         *
     42  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     43 
     44 
     45 #include "function.h"
     46 
     47 #ifdef WIN32
     48 
     49 #include "ipx95.h"
     50 
     51  // Stub in old IPX here ST - 12/20/2018 1:53PM
     52 extern "C" {
     53 	extern BOOL __stdcall IPX_Initialise(void) { return 0; }
     54 	extern BOOL __stdcall IPX_Get_Outstanding_Buffer95(unsigned char *buffer) { return 0; }
     55 	extern void __stdcall IPX_Shut_Down95(void) {}
     56 	extern int  __stdcall IPX_Send_Packet95(unsigned char *, unsigned char *, int, unsigned char*, unsigned char*) { return 0; }
     57 	extern int  __stdcall IPX_Broadcast_Packet95(unsigned char *, int) { return 0; }
     58 	extern BOOL __stdcall IPX_Start_Listening95(void) { return 0; }
     59 	extern int  __stdcall IPX_Open_Socket95(int socket) { return 0; }
     60 	extern void __stdcall IPX_Close_Socket95(int socket) {}
     61 	extern int  __stdcall IPX_Get_Connection_Number95(void) { return 0; }
     62 	extern int  __stdcall IPX_Get_Local_Target95(unsigned char *, unsigned char*, unsigned short, unsigned char*) { return 0; }
     63 }
     64 
     65 #if (0)
     66 /*
     67 ** Instance handle for the THIPX32 .DLL
     68 */
     69 HINSTANCE	IpxDllInstance = NULL;
     70 
     71 /*
     72 ** Function pointers
     73 */
     74 //extern "C" {
     75 	IPXInitialiseType					IPX_Initialise = NULL;
     76 	IPXGetOutstandingBuffer95Type	IPX_Get_Outstanding_Buffer95 = NULL;
     77 	IPXShutDown95Type             IPX_Shut_Down95 = NULL;
     78 	IPXSendPacket95Type           IPX_Send_Packet95 = NULL;
     79 	IPXBroadcastPacket95Type      IPX_Broadcast_Packet95 = NULL;
     80 	IPXStartListening95Type       IPX_Start_Listening95 = NULL;
     81 	IPXOpenSocket95Type           IPX_Open_Socket95 = NULL;
     82 	IPXCloseSocket95Type          IPX_Close_Socket95 = NULL;
     83 	IPXGetConnectionNumber95Type  IPX_Get_Connection_Number95 = NULL;
     84 	IPXGetLocalTarget95           IPX_Get_Local_Target95 = NULL;
     85 //}
     86 
     87 char const *FunctionNames[] = {
     88 	"_IPX_Initialise",
     89 	"_IPX_Get_Outstanding_Buffer95",
     90 	"_IPX_Shut_Down95",
     91 	"_IPX_Send_Packet95",
     92 	"_IPX_Broadcast_Packet95",
     93 	"_IPX_Start_Listening95",
     94 	"_IPX_Open_Socket95",
     95 	"_IPX_Close_Socket95",
     96 	"_IPX_Get_Connection_Number95",
     97 	"_IPX_Get_Local_Target95",
     98 	NULL
     99 };
    100 #endif
    101 
    102 extern void Get_OS_Version (void);
    103 bool				WindowsNT = false;
    104 
    105 
    106 /***********************************************************************************************
    107  * Load_IPX_Dll -- Loads the THIPX32 DLL                                                       *
    108  *                                                                                             *
    109  *                                                                                             *
    110  *                                                                                             *
    111  * INPUT:    Nothing                                                                           *
    112  *                                                                                             *
    113  * OUTPUT:   true if DLL loaded                                                                *
    114  *                                                                                             *
    115  * WARNINGS: This call will fail under NT due to a side effect of loading the THIPX32.DLL      *
    116  *           which causes the 16 bit DLL THIPX16.DLL to load.                                  *
    117  *                                                                                             *
    118  * HISTORY:                                                                                    *
    119  *    4/1/97 11:40AM ST : Created                                                              *
    120  *=============================================================================================*/
    121 bool Load_IPX_Dll (void)
    122 {
    123 	//ST 5/13/2019
    124 	return false;
    125 
    126 #if (0)
    127 	Get_OS_Version();
    128 	if (WindowsNT) return (false);
    129 
    130 	SetErrorMode( SEM_NOOPENFILEERRORBOX );
    131 	IpxDllInstance = LoadLibrary ( "THIPX32.DLL" );
    132 	SetErrorMode ( 0 );
    133 
    134 	if ( IpxDllInstance ){
    135 
    136 		const char		*function_name;
    137 		unsigned long 	*fptr = (unsigned long *) &IPX_Initialise;
    138 		int				count = 0;
    139 
    140 		do {
    141 			function_name = FunctionNames[count];
    142 			if (function_name){
    143 				*fptr = (unsigned long) GetProcAddress (IpxDllInstance, function_name);
    144 				assert (*fptr != NULL);
    145 				fptr++;
    146 				count++;
    147 			}
    148 
    149 		} while ( function_name );
    150 
    151 		return (true);
    152 
    153 	}else{
    154 		return (false);
    155 	}
    156 #endif
    157 }
    158 
    159 
    160 
    161 /***********************************************************************************************
    162  * Unload_IPX_Dll -- Frees the THIPX32 library                                                 *
    163  *                                                                                             *
    164  *                                                                                             *
    165  *                                                                                             *
    166  * INPUT:    Nothing                                                                           *
    167  *                                                                                             *
    168  * OUTPUT:   Nothing                                                                           *
    169  *                                                                                             *
    170  * WARNINGS: None                                                                              *
    171  *                                                                                             *
    172  * HISTORY:                                                                                    *
    173  *    4/1/97 2:37PM ST : Created                                                               *
    174  *=============================================================================================*/
    175 void Unload_IPX_Dll (void)
    176 {
    177 	//ST 5/13/2019
    178 
    179 #if (0)
    180 	if (IpxDllInstance){
    181 		FreeLibrary (IpxDllInstance);
    182 		IpxDllInstance = NULL;
    183 	}
    184 #endif
    185 }
    186 
    187 
    188 int IPX_Open_Socket(unsigned short socket)
    189 {
    190 	return -1;	//ST 5/13/2019
    191 	//return ( IPX_Open_Socket95((int)socket));
    192 }
    193 
    194 int IPX_Close_Socket(unsigned short socket)
    195 {
    196 	//ST 5/13/2019 IPX_Close_Socket95((int)socket);
    197 	return (0);
    198 }
    199 
    200 
    201 int IPX_Get_Connection_Number(void)
    202 {
    203 	return -1;//ST 5/13/2019
    204 	//return (IPX_Get_Connection_Number95());
    205 }
    206 
    207 
    208 
    209 int IPX_Broadcast_Packet(unsigned char * buf, int buflen)
    210 {
    211 	return 0; //ST 5/13/2019
    212 	//return(IPX_Broadcast_Packet95(buf, buflen));
    213 }
    214 
    215 #if (0) //ST 5/13/2019
    216 extern "C"{
    217 	extern void __cdecl Int3(void);
    218 }
    219 #endif
    220 
    221 int IPX_Get_Local_Target(unsigned char * dest_network, unsigned char * dest_node,
    222 	unsigned short dest_socket, unsigned char * bridge_address)
    223 {
    224 	//Int3();
    225 	
    226 	return 0; //ST 5/13/2019
    227 	//return (IPX_Get_Local_Target95(dest_network, dest_node, dest_socket, bridge_address));
    228 }
    229 
    230 
    231 #endif	//WIN32