IPX95.CPP 9.2 KB

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