Initial commit of Command & Conquer Red Alert source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:15:05 +00:00
parent b685cea758
commit 5e733d5dcc
2082 changed files with 797727 additions and 0 deletions

145
IPX/OK/FIXTHUNK.CPP Normal file
View File

@@ -0,0 +1,145 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
unsigned char thunk_file[1000000];
unsigned char thunk_file_out[100050];
/***********************************************************************************************
* Search_For_String -- search for a string of chars within a buffer *
* *
* *
* *
* INPUT: string *
* ptr to buffer to search in *
* length of buffer *
* *
* OUTPUT: ptr to string in buffer or NULL if not found *
* *
* WARNINGS: None *
* *
* HISTORY: *
* 11/20/95 5:42PM ST : Created *
*=============================================================================================*/
char *Search_For_String (char *string , char *buffer_ptr , int buffer_length)
{
int j;
int string_length=strlen(string);
for (int i=0 ; i<buffer_length-string_length ; i++){
for (j=0 ; j<string_length ; j++){
if ( *(string+j) != *(buffer_ptr+i+j)) break;
}
if (j==string_length) return buffer_ptr+i;
}
return (NULL);
}
int main(int argc, char *argv[])
{
int handle;
char find_string[]={";************************ START OF THUNK BODIES************************"};
char find_other_string[]={"public _IPX_Initialise@4"};
char insert_string1[]={"\n\r;\n\r"};
char insert_string2[]={";For some reason, inserting these lines makes it assemble correctly\n\r"};
char insert_string3[]={";\n\r"};
char insert_string4[]={"Externdef IPX_Initialise:near\n\r"};
char insert_string5[]={"IPX_Initialise label near\n\r\n\r"};
unsigned char *pointer;
unsigned char *pointer2;
int copy_length;
int file_length;
handle = open ("thipx.asm", O_RDONLY | O_BINARY);
if (handle==-1)return (1);
file_length = filelength(handle);
if (read (handle, thunk_file, file_length) != file_length){
close (handle);
return (1);
}
close (handle);
pointer = (unsigned char*)Search_For_String(find_string, (char*)thunk_file, file_length);
if (pointer){
pointer += strlen(find_string);
copy_length = (int)( (int)pointer - (int)&thunk_file[0]);
memcpy (thunk_file_out, thunk_file, copy_length);
sprintf ((char*)&thunk_file_out[copy_length], "%s%s%s%s%s", insert_string1,
insert_string2,
insert_string3,
insert_string4,
insert_string5);
pointer2 = (unsigned char*)Search_For_String(find_other_string, (char*)pointer, file_length);
if (!pointer2) return (1);
pointer2 += strlen(find_other_string);
memcpy (&thunk_file_out [copy_length+ strlen(insert_string1)
+ strlen(insert_string2)
+ strlen(insert_string3)
+ strlen(insert_string4)
+ strlen(insert_string5)],
pointer2,
file_length-((int)pointer2-(int)&thunk_file[0]));
handle = open ("thipx.asm", O_WRONLY | O_BINARY | O_TRUNC);
if (handle == -1) return (1);
write (handle, thunk_file_out, file_length+ strlen(insert_string1)
+ strlen(insert_string2)
+ strlen(insert_string3)
+ strlen(insert_string4)
+ strlen(insert_string5));
close (handle);
}
return (0);
}

2
IPX/OK/IPX.RC Normal file
View File

@@ -0,0 +1,2 @@

62
IPX/OK/IPX16.ASM Normal file
View File

@@ -0,0 +1,62 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
IDEAL
P386N
LOCALS ??
segment realcode para public USE16 'code'
global PASCAL ASM_IPX_INITIALISE:far
global PASCAL ASM_IPX_UNINITIALISE:far
proc ASM_IPX_INITIALISE PASCAL FAR
int 3
mov ax,7a00h
int 2fh
and eax,0ffh
cmp al,-1
setz al
ret
endp ASM_IPX_INITIALISE
proc ASM_IPX_UNINITIALISE PASCAL FAR
ret
endp ASM_IPX_UNINITIALISE
ends
end

13
IPX/OK/IPX16.BAK Normal file
View File

@@ -0,0 +1,13 @@
system windows_dll
option redefsok
option quiet
option map
option eliminate
option caseexact
option one
debug all
file ipx16a.obj
file ipx16c.obj
name wwipx16.dll

25
IPX/OK/IPX16.H Normal file
View File

@@ -0,0 +1,25 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C"{
BOOL FAR __cdecl IPX_Initialise(int);
}

1450
IPX/OK/IPX16A.ASM Normal file

File diff suppressed because it is too large Load Diff

62
IPX/OK/IPX16C.CPP Normal file
View File

@@ -0,0 +1,62 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
extern "C"{
extern BOOL FAR __pascal ASM_IPX_Initialise(void);
extern BOOL FAR __pascal ASM_IPX_Uninitialise(void);
}
extern "C"{
BOOL FAR __pascal _export IPX_Initialise(int);
void FAR __pascal _export IPX_Uninitialise(void);
}
int CALLBACK LibMain (HANDLE, WORD, WORD, LPSTR)
{
return (1);
}
BOOL FAR __pascal _export IPX_Initialise(int)
{
return (ASM_IPX_Initialise());
}
void FAR __pascal _export IPX_Uninitialise(void)
{
ASM_IPX_Uninitialise();
}

37
IPX/OK/IPXTEST.CPP Normal file
View File

@@ -0,0 +1,37 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define WIN32
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#include <windows.h>
int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char *, int)
{
}

8
IPX/OK/MAKE.BAK Normal file
View File

@@ -0,0 +1,8 @@
set include >temp.txt
set include=c:\wat\h;c:\wat\h\win
copy setinc.bat+temp.txt setinc2.bat
wpp -ml -bd -zu -bt=windows -0 ipx16c.cpp
tasm /ml ipx16a.asm
wlink @ipx16.lnk
wlib -c -n wwipx16.lib +wwipx16.dll
call setinc2.bat

8
IPX/OK/MAKE.BAT Normal file
View File

@@ -0,0 +1,8 @@
set include >temp.txt
set include=c:\wat\h;c:\wat\h\win
copy setinc.bat+temp.txt setinc2.bat
wpp -s -ml -bd -zu -bt=windows -0 ipx16c.cpp
tasm /ml ipx16a.asm
wlink @ipx16.lnk
wlib -c -n wwipx16.lib +wwipx16.dll
call setinc2.bat

12
IPX/OK/MAKETH16.BAK Normal file
View File

@@ -0,0 +1,12 @@
set include >temp.txt
set include=c:\wat\h;c:\wat\h\win
copy setinc.bat+temp.txt setinc2.bat
thunk Thipx.thk
wpp -ml -bd -zu -bt=windows -0 thipx16c.cpp
ml /c /W3 ipx16a.asm
ml /DIS_16 /c /W3 /Fothipx16a.obj thipx.asm
ml /c /W3 thmap16.asm
ml /c /W3 ipx16a.asm
wlink @thipx16.lnk
rc -40 thipx16.dll
call setinc2.bat

11
IPX/OK/MAKETH16.BAT Normal file
View File

@@ -0,0 +1,11 @@
set include >temp.txt
set include=c:\wat\h;c:\wat\h\win
copy setinc.bat+temp.txt setinc2.bat
thunk Thipx.thk
wpp -ml -bd -zu -bt=windows -0 thipx16c.cpp
ml /c /W3 ipx16a.asm
ml /DIS_16 /c /W3 /Fothipx16a.obj thipx.asm
ml /c /W3 thmap16.asm
wlink @thipx16.lnk
rc -40 thipx16.dll
call setinc2.bat

7
IPX/OK/MAKETH32.BAK Normal file
View File

@@ -0,0 +1,7 @@
rem thunk Thipx.thk
rem fixthunk
wpp386 -s -mf -3s -bt=nt -bd -zu -4 thipx32c.cpp
ml /DIS_32 /Zf /Fl /c /W3 /Fothipx32a.obj thipx.asm
ml /c /W3 thmap32.asm
wlink @thipx32.lnk
wlib -c -n wwipx32.lib +thipx32.dll

7
IPX/OK/MAKETH32.BAT Normal file
View File

@@ -0,0 +1,7 @@
thunk Thipx.thk
rem fixthunk
wpp386 -s -mf -3s -bt=nt -bd -zu -4 thipx32c.cpp
ml /DIS_32 /Zf /Fl /c /W3 /Fothipx32a.obj thipx.asm
ml /c /W3 thmap32.asm
wlink @thipx32.lnk
wlib -c -n wwipx32.lib +thipx32.dll

BIN
IPX/OK/OLTHIPX.ASM Normal file

Binary file not shown.

1091
IPX/OK/PCMACRO.16 Normal file

File diff suppressed because it is too large Load Diff

503
IPX/OK/THIPX.ASM Normal file
View File

@@ -0,0 +1,503 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
page ,132
;Thunk Compiler Version 1.8 May 11 1995 13:16:19
;File Compiled Fri Jan 26 16:12:04 1996
;Command Line: C:\BIN\THUNK.EXE Thipx.thk
TITLE $Thipx.asm
.386
OPTION READONLY
OPTION OLDSTRUCTS
IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF ;IS_32
ENDIF ;IS_16
IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
.model FLAT,STDCALL
;-- Import common flat thunk routines (in k32)
externDef MapHInstLS :near32
externDef MapHInstLS_PN :near32
externDef MapHInstSL :near32
externDef MapHInstSL_PN :near32
externDef FT_Prolog :near32
externDef FT_Thunk :near32
externDef QT_Thunk :near32
externDef FT_Exit0 :near32
externDef FT_Exit4 :near32
externDef FT_Exit8 :near32
externDef FT_Exit12 :near32
externDef FT_Exit16 :near32
externDef FT_Exit20 :near32
externDef FT_Exit24 :near32
externDef FT_Exit28 :near32
externDef FT_Exit32 :near32
externDef FT_Exit36 :near32
externDef FT_Exit40 :near32
externDef FT_Exit44 :near32
externDef FT_Exit48 :near32
externDef FT_Exit52 :near32
externDef FT_Exit56 :near32
externDef SMapLS :near32
externDef SUnMapLS :near32
externDef SMapLS_IP_EBP_8 :near32
externDef SUnMapLS_IP_EBP_8 :near32
externDef SMapLS_IP_EBP_12 :near32
externDef SUnMapLS_IP_EBP_12 :near32
externDef SMapLS_IP_EBP_16 :near32
externDef SUnMapLS_IP_EBP_16 :near32
externDef SMapLS_IP_EBP_20 :near32
externDef SUnMapLS_IP_EBP_20 :near32
externDef SMapLS_IP_EBP_24 :near32
externDef SUnMapLS_IP_EBP_24 :near32
externDef SMapLS_IP_EBP_28 :near32
externDef SUnMapLS_IP_EBP_28 :near32
externDef SMapLS_IP_EBP_32 :near32
externDef SUnMapLS_IP_EBP_32 :near32
externDef SMapLS_IP_EBP_36 :near32
externDef SUnMapLS_IP_EBP_36 :near32
externDef SMapLS_IP_EBP_40 :near32
externDef SUnMapLS_IP_EBP_40 :near32
MapSL PROTO NEAR STDCALL p32:DWORD
.code
;************************* COMMON PER-MODULE ROUTINES *************************
.data
public Thipx_ThunkData32 ;This symbol must be exported.
Thipx_ThunkData32 label dword
dd 3130534ch ;Protocol 'LS01'
dd 0228d3h ;Checksum
dd 0 ;Jump table address.
dd 3130424ch ;'LB01'
dd 0 ;Flags
dd 0 ;Reserved (MUST BE 0)
dd 0 ;Reserved (MUST BE 0)
dd offset QT_Thunk_Thipx - offset Thipx_ThunkData32
dd offset FT_Prolog_Thipx - offset Thipx_ThunkData32
.code
externDef ThunkConnect32@24:near32
public Thipx_ThunkConnect32@16
Thipx_ThunkConnect32@16:
pop edx
push offset Thipx_ThkData16
push offset Thipx_ThunkData32
push edx
jmp ThunkConnect32@24
Thipx_ThkData16 label byte
db "Thipx_ThunkData16",0
pfnQT_Thunk_Thipx dd offset QT_Thunk_Thipx
pfnFT_Prolog_Thipx dd offset FT_Prolog_Thipx
.data
QT_Thunk_Thipx label byte
db 32 dup(0cch) ;Patch space.
FT_Prolog_Thipx label byte
db 32 dup(0cch) ;Patch space.
.code
;************************ START OF THUNK BODIES************************
;
public _IPX_Close_Socket95@4
_IPX_Close_Socket95@4:
mov cl,9
jmp II_IPX_Close_Socket95@4
public _IPX_Initialise@4
_IPX_Initialise@4:
mov cl,12
jmp II_IPX_Close_Socket95@4
public _IPX_Open_Socket95@4
_IPX_Open_Socket95@4:
mov cl,10
; _IPX_Close_Socket95(16) = _IPX_Close_Socket95(32) {}
;
; dword ptr [ebp+8]: param1
;
public II_IPX_Close_Socket95@4
II_IPX_Close_Socket95@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call dword ptr [pfnQT_Thunk_Thipx]
cwde
leave
retn 4
;
public _IPX_Get_Internet_Address95@12
_IPX_Get_Internet_Address95@12:
mov cl,7
; _IPX_Get_Internet_Address95(16) = _IPX_Get_Internet_Address95(32) {}
;
; dword ptr [ebp+8]: param1
; dword ptr [ebp+12]: netnum
; dword ptr [ebp+16]: node
;
public II_IPX_Get_Internet_Address95@12
II_IPX_Get_Internet_Address95@12:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call SMapLS_IP_EBP_12
push eax
call SMapLS_IP_EBP_16
push eax
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_12
call SUnMapLS_IP_EBP_16
leave
retn 12
;
public _IPX_Get_User_ID95@8
_IPX_Get_User_ID95@8:
mov cl,6
; _IPX_Get_User_ID95(16) = _IPX_Get_User_ID95(32) {}
;
; dword ptr [ebp+8]: param1
; dword ptr [ebp+12]: user_id
;
public II_IPX_Get_User_ID95@8
II_IPX_Get_User_ID95@8:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call SMapLS_IP_EBP_12
push eax
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_12
leave
retn 8
;
public _IPX_Send_Packet95@12
_IPX_Send_Packet95@12:
mov cl,5
; _IPX_Send_Packet95(16) = _IPX_Send_Packet95(32) {}
;
; dword ptr [ebp+8]: address
; dword ptr [ebp+12]: buffer
; dword ptr [ebp+16]: param3
;
public II_IPX_Send_Packet95@12
II_IPX_Send_Packet95@12:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call SMapLS_IP_EBP_12
push eax
push word ptr [ebp+16] ;param3: dword->word
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_8
call SUnMapLS_IP_EBP_12
leave
retn 12
;
public _IPX_Broadcast_Packet95@8
_IPX_Broadcast_Packet95@8:
mov cl,4
; _IPX_Broadcast_Packet95(16) = _IPX_Broadcast_Packet95(32) {}
;
; dword ptr [ebp+8]: buffer
; dword ptr [ebp+12]: param2
;
public II_IPX_Broadcast_Packet95@8
II_IPX_Broadcast_Packet95@8:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
push word ptr [ebp+12] ;param2: dword->word
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_8
leave
retn 8
;
public _IPX_Get_Local_Target95@16
_IPX_Get_Local_Target95@16:
mov cl,3
; _IPX_Get_Local_Target95(16) = _IPX_Get_Local_Target95(32) {}
;
; dword ptr [ebp+8]: netnum
; dword ptr [ebp+12]: node
; dword ptr [ebp+16]: param3
; dword ptr [ebp+20]: address
;
public II_IPX_Get_Local_Target95@16
II_IPX_Get_Local_Target95@16:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call SMapLS_IP_EBP_12
push eax
push word ptr [ebp+16] ;param3: dword->word
call SMapLS_IP_EBP_20
push eax
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_8
call SUnMapLS_IP_EBP_12
call SUnMapLS_IP_EBP_20
leave
retn 16
;
public _IPX_Shut_Down95@0
_IPX_Shut_Down95@0:
mov cl,1
jmp II_IPX_Shut_Down95@0
public _IPX_Uninitialise@0
_IPX_Uninitialise@0:
mov cl,11
jmp II_IPX_Shut_Down95@0
public _IPX_Get_Connection_Number95@0
_IPX_Get_Connection_Number95@0:
mov cl,8
jmp II_IPX_Shut_Down95@0
public _IPX_Start_Listening95@0
_IPX_Start_Listening95@0:
mov cl,2
; _IPX_Shut_Down95(16) = _IPX_Shut_Down95(32) {}
;
;
public II_IPX_Shut_Down95@0
II_IPX_Shut_Down95@0:
push ebp
mov ebp,esp
push ecx
sub esp,60
call dword ptr [pfnQT_Thunk_Thipx]
cwde
leave
retn
;
public _IPX_Get_Outstanding_Buffer95@4
_IPX_Get_Outstanding_Buffer95@4:
mov cl,0
; _IPX_Get_Outstanding_Buffer95(16) = _IPX_Get_Outstanding_Buffer95(32) {}
;
; dword ptr [ebp+8]: buffer
;
public II_IPX_Get_Outstanding_Buffer95@4
II_IPX_Get_Outstanding_Buffer95@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call dword ptr [pfnQT_Thunk_Thipx]
cwde
call SUnMapLS_IP_EBP_8
leave
retn 4
ELSE
;************************* START OF 16-BIT CODE *************************
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externDef _IPX_Get_Outstanding_Buffer95:far16
externDef _IPX_Shut_Down95:far16
externDef _IPX_Start_Listening95:far16
externDef _IPX_Get_Local_Target95:far16
externDef _IPX_Broadcast_Packet95:far16
externDef _IPX_Send_Packet95:far16
externDef _IPX_Get_User_ID95:far16
externDef _IPX_Get_Internet_Address95:far16
externDef _IPX_Get_Connection_Number95:far16
externDef _IPX_Close_Socket95:far16
externDef _IPX_Open_Socket95:far16
externDef _IPX_Uninitialise:far16
externDef _IPX_Initialise:far16
FT_ThipxTargetTable label word
dw offset _IPX_Get_Outstanding_Buffer95
dw seg _IPX_Get_Outstanding_Buffer95
dw offset _IPX_Shut_Down95
dw seg _IPX_Shut_Down95
dw offset _IPX_Start_Listening95
dw seg _IPX_Start_Listening95
dw offset _IPX_Get_Local_Target95
dw seg _IPX_Get_Local_Target95
dw offset _IPX_Broadcast_Packet95
dw seg _IPX_Broadcast_Packet95
dw offset _IPX_Send_Packet95
dw seg _IPX_Send_Packet95
dw offset _IPX_Get_User_ID95
dw seg _IPX_Get_User_ID95
dw offset _IPX_Get_Internet_Address95
dw seg _IPX_Get_Internet_Address95
dw offset _IPX_Get_Connection_Number95
dw seg _IPX_Get_Connection_Number95
dw offset _IPX_Close_Socket95
dw seg _IPX_Close_Socket95
dw offset _IPX_Open_Socket95
dw seg _IPX_Open_Socket95
dw offset _IPX_Uninitialise
dw seg _IPX_Uninitialise
dw offset _IPX_Initialise
dw seg _IPX_Initialise
.data
public Thipx_ThunkData16 ;This symbol must be exported.
Thipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
dd 0228d3h ;Checksum
dw offset FT_ThipxTargetTable
dw seg FT_ThipxTargetTable
dd 0 ;First-time flag.
.code
externDef ThunkConnect16:far16
public Thipx_ThunkConnect16
Thipx_ThunkConnect16:
pop ax
pop dx
push seg Thipx_ThunkData16
push offset Thipx_ThunkData16
push seg Thipx_ThkData32
push offset Thipx_ThkData32
push cs
push dx
push ax
jmp ThunkConnect16
Thipx_ThkData32 label byte
db "Thipx_ThunkData32",0
ENDIF
END

355
IPX/OK/THIPX.BAK Normal file
View File

@@ -0,0 +1,355 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
page ,132
;Thunk Compiler Version 1.8 May 11 1995 13:16:19
;File Compiled Tue Jan 23 15:12:09 1996
;Command Line: C:\BIN\THUNK.EXE thipx.thk
TITLE $thipx.asm
.386
OPTION READONLY
OPTION OLDSTRUCTS
IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF ;IS_32
ENDIF ;IS_16
IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
.model FLAT,STDCALL
;-- Import common flat thunk routines (in k32)
externDef MapHInstLS :near32
externDef MapHInstLS_PN :near32
externDef MapHInstSL :near32
externDef MapHInstSL_PN :near32
externDef FT_Prolog :near32
externDef FT_Thunk :near32
externDef QT_Thunk :near32
externDef FT_Exit0 :near32
externDef FT_Exit4 :near32
externDef FT_Exit8 :near32
externDef FT_Exit12 :near32
externDef FT_Exit16 :near32
externDef FT_Exit20 :near32
externDef FT_Exit24 :near32
externDef FT_Exit28 :near32
externDef FT_Exit32 :near32
externDef FT_Exit36 :near32
externDef FT_Exit40 :near32
externDef FT_Exit44 :near32
externDef FT_Exit48 :near32
externDef FT_Exit52 :near32
externDef FT_Exit56 :near32
externDef SMapLS :near32
externDef SUnMapLS :near32
externDef SMapLS_IP_EBP_8 :near32
externDef SUnMapLS_IP_EBP_8 :near32
externDef SMapLS_IP_EBP_12 :near32
externDef SUnMapLS_IP_EBP_12 :near32
externDef SMapLS_IP_EBP_16 :near32
externDef SUnMapLS_IP_EBP_16 :near32
externDef SMapLS_IP_EBP_20 :near32
externDef SUnMapLS_IP_EBP_20 :near32
externDef SMapLS_IP_EBP_24 :near32
externDef SUnMapLS_IP_EBP_24 :near32
externDef SMapLS_IP_EBP_28 :near32
externDef SUnMapLS_IP_EBP_28 :near32
externDef SMapLS_IP_EBP_32 :near32
externDef SUnMapLS_IP_EBP_32 :near32
externDef SMapLS_IP_EBP_36 :near32
externDef SUnMapLS_IP_EBP_36 :near32
externDef SMapLS_IP_EBP_40 :near32
externDef SUnMapLS_IP_EBP_40 :near32
MapSL PROTO NEAR STDCALL p32:DWORD
.code
;************************* COMMON PER-MODULE ROUTINES *************************
.data
public thipx_ThunkData32 ;This symbol must be exported.
thipx_ThunkData32 label dword
dd 3130534ch ;Protocol 'LS01'
dd 0a179h ;Checksum
dd 0 ;Jump table address.
dd 3130424ch ;'LB01'
dd 0 ;Flags
dd 0 ;Reserved (MUST BE 0)
dd 0 ;Reserved (MUST BE 0)
dd offset QT_Thunk_thipx - offset thipx_ThunkData32
dd offset FT_Prolog_thipx - offset thipx_ThunkData32
.code
externDef ThunkConnect32@24:near32
public thipx_ThunkConnect32@16
thipx_ThunkConnect32@16:
pop edx
push offset thipx_ThkData16
push offset thipx_ThunkData32
push edx
jmp ThunkConnect32@24
thipx_ThkData16 label byte
db "thipx_ThunkData16",0
pfnQT_Thunk_thipx dd offset QT_Thunk_thipx
pfnFT_Prolog_thipx dd offset FT_Prolog_thipx
.data
QT_Thunk_thipx label byte
db 32 dup(0cch) ;Patch space.
FT_Prolog_thipx label byte
db 32 dup(0cch) ;Patch space.
.code
;************************ START OF THUNK BODIES************************
;
public _IPX_Close_Socket95@4
_IPX_Close_Socket95@4:
mov cl,3
jmp II_IPX_Close_Socket95@4
public _IPX_Initialise@4
_IPX_Initialise@4:
mov cl,6
jmp II_IPX_Close_Socket95@4
public _IPX_Open_Socket95@4
_IPX_Open_Socket95@4:
mov cl,4
; _IPX_Close_Socket95(16) = _IPX_Close_Socket95(32) {}
;
; dword ptr [ebp+8]: param1
;
public II_IPX_Close_Socket95@4
II_IPX_Close_Socket95@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call dword ptr [pfnQT_Thunk_thipx]
cwde
leave
retn 4
;
public _IPX_Get_Connection_Number95@0
_IPX_Get_Connection_Number95@0:
mov cl,2
jmp II_IPX_Get_Connection_Number95@0
public _IPX_Uninitialise@0
_IPX_Uninitialise@0:
mov cl,5
; _IPX_Get_Connection_Number95(16) = _IPX_Get_Connection_Number95(32) {}
;
;
public II_IPX_Get_Connection_Number95@0
II_IPX_Get_Connection_Number95@0:
push ebp
mov ebp,esp
push ecx
sub esp,60
call dword ptr [pfnQT_Thunk_thipx]
cwde
leave
retn
;
public _IPX_Get_Internet_Address95@12
_IPX_Get_Internet_Address95@12:
mov cl,1
; _IPX_Get_Internet_Address95(16) = _IPX_Get_Internet_Address95(32) {}
;
; dword ptr [ebp+8]: param1
; dword ptr [ebp+12]: netnum
; dword ptr [ebp+16]: node
;
public II_IPX_Get_Internet_Address95@12
II_IPX_Get_Internet_Address95@12:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call SMapLS_IP_EBP_12
push eax
call SMapLS_IP_EBP_16
push eax
call dword ptr [pfnQT_Thunk_thipx]
cwde
call SUnMapLS_IP_EBP_12
call SUnMapLS_IP_EBP_16
leave
retn 12
;
public __IPX_Get_User_ID95@8
__IPX_Get_User_ID95@8:
mov cl,0
; __IPX_Get_User_ID95(16) = __IPX_Get_User_ID95(32) {}
;
; dword ptr [ebp+8]: param1
; dword ptr [ebp+12]: user_id
;
public II__IPX_Get_User_ID95@8
II__IPX_Get_User_ID95@8:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call SMapLS_IP_EBP_12
push eax
call dword ptr [pfnQT_Thunk_thipx]
cwde
call SUnMapLS_IP_EBP_12
leave
retn 8
ELSE
;************************* START OF 16-BIT CODE *************************
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externDef __IPX_Get_User_ID95:far16
externDef _IPX_Get_Internet_Address95:far16
externDef _IPX_Get_Connection_Number95:far16
externDef _IPX_Close_Socket95:far16
externDef _IPX_Open_Socket95:far16
externDef _IPX_Uninitialise:far16
externDef _IPX_Initialise:far16
FT_thipxTargetTable label word
dw offset __IPX_Get_User_ID95
dw seg __IPX_Get_User_ID95
dw offset _IPX_Get_Internet_Address95
dw seg _IPX_Get_Internet_Address95
dw offset _IPX_Get_Connection_Number95
dw seg _IPX_Get_Connection_Number95
dw offset _IPX_Close_Socket95
dw seg _IPX_Close_Socket95
dw offset _IPX_Open_Socket95
dw seg _IPX_Open_Socket95
dw offset _IPX_Uninitialise
dw seg _IPX_Uninitialise
dw offset _IPX_Initialise
dw seg _IPX_Initialise
.data
public thipx_ThunkData16 ;This symbol must be exported.
thipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
dd 0a179h ;Checksum
dw offset FT_thipxTargetTable
dw seg FT_thipxTargetTable
dd 0 ;First-time flag.
.code
externDef ThunkConnect16:far16
public thipx_ThunkConnect16
thipx_ThunkConnect16:
pop ax
pop dx
push seg thipx_ThunkData16
push offset thipx_ThunkData16
push seg thipx_ThkData32
push offset thipx_ThkData32
push cs
push dx
push ax
jmp ThunkConnect16
thipx_ThkData32 label byte
db "thipx_ThunkData32",0
ENDIF
END

98
IPX/OK/THIPX.THK Normal file
View File

@@ -0,0 +1,98 @@
enablemapdirect3216 = true;
typedef int BOOL;
typedef int INT;
typedef struct tag_network_number {
unsigned char bytes[4];
}network_number;
typedef struct tag_physical_node {
unsigned char bytes[6];
}physical_node;
BOOL _IPX_Initialise(INT)
{
}
BOOL _IPX_Uninitialise(void)
{
}
INT _IPX_Open_Socket95(INT)
{
}
INT _IPX_Close_Socket95(INT)
{
}
INT _IPX_Get_Connection_Number95(void)
{
}
INT _IPX_Get_Internet_Address95(INT, network_number* netnum, physical_node* node)
{
netnum = output;
node = output;
}
INT _IPX_Get_User_ID95(INT, char *user_id)
{
user_id = output;
}
typedef struct tag_send_address_struct{
unsigned char address[6];
}send_address_struct;
typedef struct tag_send_buffer_struct{
unsigned char buffer[512];
}send_buffer_struct;
INT _IPX_Send_Packet95(send_address_struct *address, send_buffer_struct *buffer, INT)
{
address = input;
buffer = input;
}
INT _IPX_Broadcast_Packet95(send_buffer_struct *buffer, INT)
{
buffer = input;
}
INT _IPX_Get_Local_Target95(network_number *netnum, physical_node *node, short, send_address_struct *address)
{
netnum = input;
node = input;
address = output;
}
INT _IPX_Start_Listening95(void)
{
}
INT _IPX_Shut_Down95(void)
{
}
typedef struct tag_get_buffer_struct{
unsigned char get_buffer[1024];
}get_buffer_struct;
INT _IPX_Get_Outstanding_Buffer95(get_buffer_struct *buffer)
{
buffer = output;
}

51
IPX/OK/THIPX16C.CPP Normal file
View File

@@ -0,0 +1,51 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
extern "C" {
BOOL FAR PASCAL Thipx_ThunkConnect16_(LPSTR pszDll16, LPSTR pszDll32, WORD hInst, DWORD dwReason);
}
int CALLBACK LibMain (HANDLE, WORD, WORD, LPSTR)
{
return (1);
}
extern "C" {
BOOL FAR PASCAL DllEntryPoint_ (DWORD dwReason, WORD hInst, WORD, WORD, DWORD, WORD);
}
BOOL FAR PASCAL DllEntryPoint_ (DWORD dwReason, WORD hInst, WORD, WORD, DWORD, WORD)
{
OutputDebugString("In 16bit DLL entry point. Calling Thipx_ThunkConnect16\r\n");
if (!Thipx_ThunkConnect16_("THIPX16.DLL", "THIPX32.DLL", hInst, dwReason)){
OutputDebugString("In 16bit DllEntryPoint: thkThunkConnect16 ret FALSE\r\n");
return FALSE;
}
OutputDebugString("In 16bit DllEntryPoint: thkThunkConnect16 ret TRUE\r\n");
return TRUE;
}

52
IPX/OK/THIPX32C.CPP Normal file
View File

@@ -0,0 +1,52 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define WIN32
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#include <windows.h>
extern "C" {
BOOL WINAPI Thipx_ThunkConnect32(LPSTR pszDll16, LPSTR pszDll32, DWORD hIinst, DWORD dwReason);
};
BOOL APIENTRY DllMain(DWORD hInst, DWORD dwReason, DWORD dwReserved)
{
OutputDebugString("In THIPX32.DLL : DllMain\r\n");
if (! Thipx_ThunkConnect32("THIPX16.DLL", "THIPX32.DLL", hInst, dwReason)) {
OutputDebugString("ERROR! 32Bit ThunkConnect32 failed!\r\n");
return FALSE;
}
OutputDebugString("32Bit ThunkConnect32 succeeded.\r\n");
return (TRUE);
}
BOOL APIENTRY LibMain(DWORD hInst, DWORD dwReason, DWORD dwReserved)
{
return (DllMain(hInst, dwReason, dwReserved));
}

60
IPX/OK/THMAP16.ASM Normal file
View File

@@ -0,0 +1,60 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
.8086
OPTION READONLY
OPTION OLDSTRUCTS
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externdef pascal Thipx_ThunkConnect16_:far16
extern pascal Thipx_ThunkConnect16:near16
Thipx_ThunkConnect16_ proc far16 pascal
jmp Thipx_ThunkConnect16
Thipx_ThunkConnect16_ endp
externdef DllEntryPoint:far16
extern pascal DllEntryPoint_:far16
DllEntryPoint proc far16
jmp DllEntryPoint_
DllEntryPoint endp
end

188
IPX/OK/THMAP32.ASM Normal file
View File

@@ -0,0 +1,188 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
.386
OPTION READONLY
OPTION OLDSTRUCTS
.model FLAT
.code
;externdef _DllMain@12:near
;externdef DllMain@12:near
;
;DllMain proc near
;
; jmp _DllMain@12
;
;DllMain endp
externdef _IPX_Initialise:near
externdef __IPX_Initialise@4:near
_IPX_Initialise proc near
jmp __IPX_Initialise@4
_IPX_Initialise endp
externdef _IPX_Uninitialise:near
externdef __IPX_Uninitialise@0:near
_IPX_Uninitialise proc near
jmp __IPX_Uninitialise@0
_IPX_Uninitialise endp
externdef _IPX_Open_Socket95:near
externdef __IPX_Open_Socket95@4:near
_IPX_Open_Socket95 proc near
jmp __IPX_Open_Socket95@4
_IPX_Open_Socket95 endp
externdef _IPX_Close_Socket95:near
externdef __IPX_Close_Socket95@4:near
_IPX_Close_Socket95 proc near
jmp __IPX_Close_Socket95@4
_IPX_Close_Socket95 endp
externdef _IPX_Get_Connection_Number95:near
externdef __IPX_Get_Connection_Number95@0:near
_IPX_Get_Connection_Number95 proc near
jmp __IPX_Get_Connection_Number95@0
_IPX_Get_Connection_Number95 endp
externdef _IPX_Get_Internet_Address95:near
externdef __IPX_Get_Internet_Address95@12:near
_IPX_Get_Internet_Address95 proc near
jmp __IPX_Get_Internet_Address95@12
_IPX_Get_Internet_Address95 endp
externdef _IPX_Get_User_ID95:near
externdef __IPX_Get_User_ID95@8:near
_IPX_Get_User_ID95 proc near
jmp __IPX_Get_User_ID95@8
_IPX_Get_User_ID95 endp
externdef _IPX_Send_Packet95:near
externdef __IPX_Send_Packet95@12:near
_IPX_Send_Packet95 proc near
jmp __IPX_Send_Packet95@12
_IPX_Send_Packet95 endp
externdef _IPX_Broadcast_Packet95:near
externdef __IPX_Broadcast_Packet95@8:near
_IPX_Broadcast_Packet95 proc near
jmp __IPX_Broadcast_Packet95@8
_IPX_Broadcast_Packet95 endp
externdef _IPX_Get_Local_Target95:near
externdef __IPX_Get_Local_Target95@16:near
_IPX_Get_Local_Target95 proc near
jmp __IPX_Get_Local_Target95@16
_IPX_Get_Local_Target95 endp
externdef _IPX_Start_Listening95:near
externdef __IPX_Start_Listening95@0:near
_IPX_Start_Listening95 proc near
jmp __IPX_Start_Listening95@0
_IPX_Start_Listening95 endp
externdef _IPX_Shut_Down95:near
externdef __IPX_Shut_Down95@0:near
_IPX_Shut_Down95 proc near
jmp __IPX_Shut_Down95@0
_IPX_Shut_Down95 endp
externdef _IPX_Get_Outstanding_Buffer95:near
externdef __IPX_Get_Outstanding_Buffer95@4:near
_IPX_Get_Outstanding_Buffer95 proc near
jmp __IPX_Get_Outstanding_Buffer95@4
_IPX_Get_Outstanding_Buffer95 endp
end

243
IPX/OK/WWIPX.ASM Normal file
View File

@@ -0,0 +1,243 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
page ,132
;Thunk Compiler Version 1.8 May 11 1995 13:16:19
;File Compiled Tue Jan 16 13:53:22 1996
;Command Line: D:\MSTOOLS\BIN\THUNK.EXE wwipx.thk
TITLE $wwipx.asm
.386
OPTION READONLY
OPTION OLDSTRUCTS
IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF ;IS_32
ENDIF ;IS_16
IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
.model FLAT,STDCALL
;-- Import common flat thunk routines (in k32)
externDef MapHInstLS :near32
externDef MapHInstLS_PN :near32
externDef MapHInstSL :near32
externDef MapHInstSL_PN :near32
externDef FT_Prolog :near32
externDef FT_Thunk :near32
externDef QT_Thunk :near32
externDef FT_Exit0 :near32
externDef FT_Exit4 :near32
externDef FT_Exit8 :near32
externDef FT_Exit12 :near32
externDef FT_Exit16 :near32
externDef FT_Exit20 :near32
externDef FT_Exit24 :near32
externDef FT_Exit28 :near32
externDef FT_Exit32 :near32
externDef FT_Exit36 :near32
externDef FT_Exit40 :near32
externDef FT_Exit44 :near32
externDef FT_Exit48 :near32
externDef FT_Exit52 :near32
externDef FT_Exit56 :near32
externDef SMapLS :near32
externDef SUnMapLS :near32
externDef SMapLS_IP_EBP_8 :near32
externDef SUnMapLS_IP_EBP_8 :near32
externDef SMapLS_IP_EBP_12 :near32
externDef SUnMapLS_IP_EBP_12 :near32
externDef SMapLS_IP_EBP_16 :near32
externDef SUnMapLS_IP_EBP_16 :near32
externDef SMapLS_IP_EBP_20 :near32
externDef SUnMapLS_IP_EBP_20 :near32
externDef SMapLS_IP_EBP_24 :near32
externDef SUnMapLS_IP_EBP_24 :near32
externDef SMapLS_IP_EBP_28 :near32
externDef SUnMapLS_IP_EBP_28 :near32
externDef SMapLS_IP_EBP_32 :near32
externDef SUnMapLS_IP_EBP_32 :near32
externDef SMapLS_IP_EBP_36 :near32
externDef SUnMapLS_IP_EBP_36 :near32
externDef SMapLS_IP_EBP_40 :near32
externDef SUnMapLS_IP_EBP_40 :near32
MapSL PROTO NEAR STDCALL p32:DWORD
.code
;************************* COMMON PER-MODULE ROUTINES *************************
.data
public wwipx_ThunkData32 ;This symbol must be exported.
wwipx_ThunkData32 label dword
dd 3130534ch ;Protocol 'LS01'
dd 043bh ;Checksum
dd 0 ;Jump table address.
dd 3130424ch ;'LB01'
dd 0 ;Flags
dd 0 ;Reserved (MUST BE 0)
dd 0 ;Reserved (MUST BE 0)
dd offset QT_Thunk_wwipx - offset wwipx_ThunkData32
dd offset FT_Prolog_wwipx - offset wwipx_ThunkData32
.code
externDef ThunkConnect32@24:near32
public wwipx_ThunkConnect32@16
wwipx_ThunkConnect32@16:
pop edx
push offset wwipx_ThkData16
push offset wwipx_ThunkData32
push edx
jmp ThunkConnect32@24
wwipx_ThkData16 label byte
db "wwipx_ThunkData16",0
pfnQT_Thunk_wwipx dd offset QT_Thunk_wwipx
pfnFT_Prolog_wwipx dd offset FT_Prolog_wwipx
.data
QT_Thunk_wwipx label byte
db 32 dup(0cch) ;Patch space.
FT_Prolog_wwipx label byte
db 32 dup(0cch) ;Patch space.
.code
;************************ START OF THUNK BODIES************************
;
public IPX_Initialise@4
IPX_Initialise@4:
mov cl,0
; IPX_Initialise(16) = IPX_Initialise(32) {}
;
; dword ptr [ebp+8]: param1
;
public IIIPX_Initialise@4
IIIPX_Initialise@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call dword ptr [pfnQT_Thunk_wwipx]
cwde
leave
retn 4
ELSE
;************************* START OF 16-BIT CODE *************************
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externDef IPX_Initialise:far16
FT_wwipxTargetTable label word
dw offset IPX_Initialise
dw seg IPX_Initialise
.data
public wwipx_ThunkData16 ;This symbol must be exported.
wwipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
dd 043bh ;Checksum
dw offset FT_wwipxTargetTable
dw seg FT_wwipxTargetTable
dd 0 ;First-time flag.
.code
externDef ThunkConnect16:far16
public wwipx_ThunkConnect16
wwipx_ThunkConnect16:
pop ax
pop dx
push seg wwipx_ThunkData16
push offset wwipx_ThunkData16
push seg wwipx_ThkData32
push offset wwipx_ThkData32
push cs
push dx
push ax
jmp ThunkConnect16
wwipx_ThkData32 label byte
db "wwipx_ThunkData32",0
ENDIF
END

243
IPX/OK/WWIPX16.ASM Normal file
View File

@@ -0,0 +1,243 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
page ,132
;Thunk Compiler Version 1.8 May 11 1995 13:16:19
;File Compiled Tue Jan 16 13:14:21 1996
;Command Line: D:\MSTOOLS\BIN\THUNK.EXE wwipx16.thk
TITLE $wwipx16.asm
.386
OPTION READONLY
OPTION OLDSTRUCTS
IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF ;IS_32
ENDIF ;IS_16
IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
.model FLAT,STDCALL
;-- Import common flat thunk routines (in k32)
externDef MapHInstLS :near32
externDef MapHInstLS_PN :near32
externDef MapHInstSL :near32
externDef MapHInstSL_PN :near32
externDef FT_Prolog :near32
externDef FT_Thunk :near32
externDef QT_Thunk :near32
externDef FT_Exit0 :near32
externDef FT_Exit4 :near32
externDef FT_Exit8 :near32
externDef FT_Exit12 :near32
externDef FT_Exit16 :near32
externDef FT_Exit20 :near32
externDef FT_Exit24 :near32
externDef FT_Exit28 :near32
externDef FT_Exit32 :near32
externDef FT_Exit36 :near32
externDef FT_Exit40 :near32
externDef FT_Exit44 :near32
externDef FT_Exit48 :near32
externDef FT_Exit52 :near32
externDef FT_Exit56 :near32
externDef SMapLS :near32
externDef SUnMapLS :near32
externDef SMapLS_IP_EBP_8 :near32
externDef SUnMapLS_IP_EBP_8 :near32
externDef SMapLS_IP_EBP_12 :near32
externDef SUnMapLS_IP_EBP_12 :near32
externDef SMapLS_IP_EBP_16 :near32
externDef SUnMapLS_IP_EBP_16 :near32
externDef SMapLS_IP_EBP_20 :near32
externDef SUnMapLS_IP_EBP_20 :near32
externDef SMapLS_IP_EBP_24 :near32
externDef SUnMapLS_IP_EBP_24 :near32
externDef SMapLS_IP_EBP_28 :near32
externDef SUnMapLS_IP_EBP_28 :near32
externDef SMapLS_IP_EBP_32 :near32
externDef SUnMapLS_IP_EBP_32 :near32
externDef SMapLS_IP_EBP_36 :near32
externDef SUnMapLS_IP_EBP_36 :near32
externDef SMapLS_IP_EBP_40 :near32
externDef SUnMapLS_IP_EBP_40 :near32
MapSL PROTO NEAR STDCALL p32:DWORD
.code
;************************* COMMON PER-MODULE ROUTINES *************************
.data
public wwipx16_ThunkData32 ;This symbol must be exported.
wwipx16_ThunkData32 label dword
dd 3130534ch ;Protocol 'LS01'
dd 043bh ;Checksum
dd 0 ;Jump table address.
dd 3130424ch ;'LB01'
dd 0 ;Flags
dd 0 ;Reserved (MUST BE 0)
dd 0 ;Reserved (MUST BE 0)
dd offset QT_Thunk_wwipx16 - offset wwipx16_ThunkData32
dd offset FT_Prolog_wwipx16 - offset wwipx16_ThunkData32
.code
externDef ThunkConnect32@24:near32
public wwipx16_ThunkConnect32@16
wwipx16_ThunkConnect32@16:
pop edx
push offset wwipx16_ThkData16
push offset wwipx16_ThunkData32
push edx
jmp ThunkConnect32@24
wwipx16_ThkData16 label byte
db "wwipx16_ThunkData16",0
pfnQT_Thunk_wwipx16 dd offset QT_Thunk_wwipx16
pfnFT_Prolog_wwipx16 dd offset FT_Prolog_wwipx16
.data
QT_Thunk_wwipx16 label byte
db 32 dup(0cch) ;Patch space.
FT_Prolog_wwipx16 label byte
db 32 dup(0cch) ;Patch space.
.code
;************************ START OF THUNK BODIES************************
;
public IPX_Initialise@4
IPX_Initialise@4:
mov cl,0
; IPX_Initialise(16) = IPX_Initialise(32) {}
;
; dword ptr [ebp+8]: param1
;
public IIIPX_Initialise@4
IIIPX_Initialise@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
push word ptr [ebp+8] ;param1: dword->word
call dword ptr [pfnQT_Thunk_wwipx16]
cwde
leave
retn 4
ELSE
;************************* START OF 16-BIT CODE *************************
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externDef IPX_Initialise:far16
FT_wwipx16TargetTable label word
dw offset IPX_Initialise
dw seg IPX_Initialise
.data
public wwipx16_ThunkData16 ;This symbol must be exported.
wwipx16_ThunkData16 dd 3130534ch ;Protocol 'LS01'
dd 043bh ;Checksum
dw offset FT_wwipx16TargetTable
dw seg FT_wwipx16TargetTable
dd 0 ;First-time flag.
.code
externDef ThunkConnect16:far16
public wwipx16_ThunkConnect16
wwipx16_ThunkConnect16:
pop ax
pop dx
push seg wwipx16_ThunkData16
push offset wwipx16_ThunkData16
push seg wwipx16_ThkData32
push offset wwipx16_ThkData32
push cs
push dx
push ax
jmp ThunkConnect16
wwipx16_ThkData32 label byte
db "wwipx16_ThunkData32",0
ENDIF
END