Utilize Windows types

For whatever reason they decided to switch a bunch of Windows types to their
underlying types which causes problems when replacing possibly problematic
32-bit long types. This restores the use of the Windows defined types.
This commit is contained in:
GravisZro 2024-05-16 11:44:58 -04:00
parent 60cb3a042f
commit 9ebd567178
10 changed files with 36 additions and 34 deletions

View File

@ -107,8 +107,11 @@
#ifndef __MULTI_EXTERNAL_H_
#define __MULTI_EXTERNAL_H_
#if defined(LINUX)
#include <string.h>
#if defined(__LINUX__)
#include <cstring>
#include <cstdint>
typedef uintptr_t DWORD;
typedef int HANDLE;
#endif
#include "pstypes.h"
@ -192,7 +195,7 @@ typedef struct {
ubyte sequence; // where we are in the sequence chain
ubyte pps;
HANDLE hPlayerEvent; // player event to use for directplay
unsigned long dpidPlayer; // directplay ID of player created
DWORD dpidPlayer; // directplay ID of player created
float ping_time;
float last_ping_time;
ushort pilot_pic_id;

View File

@ -1054,7 +1054,7 @@ static void PrintFileTime(char *sztime, FILETIME ftime) {
static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) {
char FmtString[2000];
unsigned long bytesout;
DWORD bytesout;
char ModName[MAX_PATH];
__try {
if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) {
@ -1099,7 +1099,7 @@ static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) {
static void RecordModuleList(HANDLE LogFile) {
char FmtString[2000];
unsigned long bytesout;
DWORD bytesout;
wsprintf(FmtString, "\r\n"
"Modules:\r\n");
WriteFile(LogFile, FmtString, lstrlen(FmtString), &bytesout, 0);
@ -1136,7 +1136,7 @@ static void RecordModuleList(HANDLE LogFile) {
static void RecordSystemInformation(HANDLE LogFile) {
char FmtString[2000];
unsigned long bytesout;
DWORD bytesout;
FILETIME CurrentTime;
GetSystemTimeAsFileTime(&CurrentTime);
char TimeBuffer[100];
@ -1218,16 +1218,16 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message) {
char *p = Debug_DumpInfo();
lstrcpy(callstack, p);
unsigned long NumBytes;
DWORD NumBytes;
SetFilePointer(LogFile, 0, 0, FILE_END);
WriteFile(LogFile, topmsg, lstrlen(topmsg), &NumBytes, 0);
WriteFile(LogFile, FORMATCRLF, lstrlen(FORMATCRLF), &NumBytes, 0);
char Username[100];
unsigned long unamelen = 99;
DWORD unamelen = 99;
char Machinename[200];
unsigned long cnamelen = 199;
DWORD cnamelen = 199;
GetUserName(Username, &unamelen);
GetComputerName(Machinename, &cnamelen);
wsprintf(callstack, "Username: %s\r\nMachineName: %s\r\n", Username, Machinename);

View File

@ -127,7 +127,6 @@ SOCKADDR_IN tcp_log_addr;
char tcp_log_buffer[MAX_TCPLOG_LEN];
void nw_InitTCPLogging(char *ip, unsigned short port) {
unsigned long argp = 1;
int addrlen = sizeof(SOCKADDR_IN);
tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0);
if (INVALID_SOCKET == tcp_log_sock) {
@ -142,7 +141,8 @@ void nw_InitTCPLogging(char *ip, unsigned short port) {
if (SOCKET_ERROR == bind(tcp_log_sock, (SOCKADDR *)&tcp_log_addr, sizeof(sockaddr))) {
return;
}
ioctlsocket(tcp_log_sock, FIONBIO, &argp);
unsigned long arg = 1;
ioctlsocket(tcp_log_sock, FIONBIO, &arg);
tcp_log_addr.sin_addr.s_addr = inet_addr(ip);
tcp_log_addr.sin_port = htons(port);

View File

@ -572,12 +572,12 @@ const char *ddio_GetCDDrive(const char *vol) {
#define MAX_FSTYPE_LEN 30
static char drivepath[10];
unsigned long volflags;
DWORD volflags;
int i;
char volume[_MAX_PATH];
char fsname[MAX_FSTYPE_LEN] = "";
unsigned long serial;
unsigned long component;
DWORD serial;
DWORD component;
strcpy(drivepath, "c:\\");

View File

@ -62,7 +62,7 @@ extern bool Directplay_lobby_launched_game;
extern DPSESSIONDESC2 Directplay_sessions[MAX_DP_GAMES];
extern int Num_directplay_games;
extern unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS];
extern uint32_t Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS];
// This is called when a game is started, so Directplay will be happy
int dp_StartGame(char *gamename);
@ -95,7 +95,7 @@ int dp_DirectPlayJoinGame(LPDPSESSIONDESC2 session);
// the amount of buffer space you need
// Otherwise, it will fill in the buffer with a bunch of null delimited
// strings, with a double null at the end.
int dp_GetModemChoices(char *buffer, unsigned long *size);
int dp_GetModemChoices(char *buffer, LPDWORD size);
// Register a DirectPlay lobby aware application
// Use this so a directplay lobby provider such as zone.com can launch the game

View File

@ -38,7 +38,6 @@ char *strupr(char *string);
#if !defined(MAX_PATH)
#define MAX_PATH _MAX_PATH
#endif
#define HANDLE int
// _cdecl replacement
#define __cdecl __attribute__((cdecl))
// _stdcall replacement

View File

@ -109,7 +109,7 @@ LPDPLCONNECTION lpdplconnection = NULL;
// {915CE160-3125-11d2-BB3D-00104B27BFF0}
static const GUID DPD3_GUID = {0x915ce160, 0x3125, 0x11d2, {0xbb, 0x3d, 0x0, 0x10, 0x4b, 0x27, 0xbf, 0xf0}};
unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS];
uint32_t Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS];
typedef struct _dpconnections {
char name[100];
@ -216,7 +216,7 @@ int dp_SelectDirectPlayConnection(char *name) {
}
int dp_InitDirectPlay(char *conn_name, void *parms, int num_elements) {
unsigned long dwAddressSize;
DWORD dwAddressSize;
HRESULT hr;
char *conn = conn_name;
for (int i = 0; i < MAX_PENDING_NEW_CONNECTIONS; i++)
@ -280,7 +280,7 @@ void dp_EndGame() {
// This function gets called when a game is started, so Direcplay knows the title, and to listen
int dp_StartGame(char *gamename) {
long hres;
HRESULT hres;
DPNAME server_player;
DPSESSIONDESC2 sessionDesc;
@ -498,7 +498,7 @@ int dp_ListDirectPlayGames() {
void dp_DirectPlayDispatch() {
HRESULT hr;
ubyte packet_data[32000]; // MAX_PACKET_SIZE+1];
unsigned long dwMsgBufferSize = 32000; // MAX_PACKET_SIZE;
DWORD dwMsgBufferSize = 32000; // MAX_PACKET_SIZE;
DPID idFrom = 0;
DPID idTo = 0;
network_address from_addr;
@ -588,7 +588,7 @@ void dp_DirectPlayDispatch() {
int dp_DirectPlaySend(network_address *who_to, ubyte *data, int len, bool reliable) {
DPID idTo;
HRESULT hr;
unsigned long send_flags;
uint32_t send_flags;
if ((!DP_active) || (!lpDirectPlay4A)) {
mprintf((0, "Can't send DirectPlay message because DirectPlay isn't active!\n"));
return 0;
@ -838,7 +838,7 @@ BOOL FAR PASCAL EnumModemAddress(REFGUID lpguidDataType, DWORD dwDataSize, LPCVO
// the amount of buffer space you need
// Otherwise, it will fill in the buffer with a bunch of null delimited
// strings, with a double null at the end.
int dp_GetModemChoices(char *buffer, unsigned long *size) {
int dp_GetModemChoices(char *buffer, LPDWORD size) {
LPDIRECTPLAY4A lpTempDP4;
HRESULT hr;
void *connection = NULL;
@ -975,7 +975,7 @@ void dp_RegisterLobbyApplication(char *appname, char *exefile, char *exepath, ch
// Returns TRUE if the game was launched from a lobby
bool dp_DidLobbyLaunchGame() {
HRESULT hr;
unsigned long buffersize = sizeof(DPLCONNECTION);
DWORD buffersize = sizeof(DPLCONNECTION);
Directplay_lobby_launched_game = false;
if (lpDirectPlayLobby3A) {

View File

@ -1957,7 +1957,7 @@ int nw_psnet_buffer_get_next(ubyte *data, int *length, network_address *from) {
// functions to get the status of a RAS connection
unsigned int psnet_ras_status() {
int rval;
unsigned long size, num_connections, i;
DWORD size, num_connections, i;
RASCONN rasbuffer[25];
HINSTANCE ras_handle;
unsigned long rasip = 0;
@ -2012,7 +2012,7 @@ unsigned int psnet_ras_status() {
for (i = 0; i < num_connections; i++) {
RASCONNSTATUS status;
unsigned long size;
DWORD size;
mprintf((0, "Connection %d:\n", i));
mprintf((0, "Entry Name: %s\n", rasbuffer[i].szEntryName));

View File

@ -242,7 +242,7 @@ DSSTREAM m_sb_info;
char m_sound_device_name[256] = ""; // set by set sound card
// Loads a sound buffer with data
long LoadSoundData(LPDIRECTSOUNDBUFFER lp_dsb, char *sound_data_ptr, ulong total_bytes);
HRESULT LoadSoundData(LPDIRECTSOUNDBUFFER lp_dsb, char *sound_data_ptr, DWORD total_bytes);
///////////////////////////////////////////////////////////////////////////////
@ -1213,8 +1213,8 @@ bool win_llsSystem::StartStreaming(void) {
}
// Creates a 2d, 3d, or Primary direct sound buffer
long win_llsSystem::CreateDSBuffer(int buffer_type, LPDIRECTSOUNDBUFFER *lp_lp_dsb, LPDIRECTSOUND3DBUFFER *lp_lp_dsb_3d,
ulong sound_bytes, ulong frequency, bool f_is_stereo, bool f_is_16_bit) {
HRESULT win_llsSystem::CreateDSBuffer(int buffer_type, LPDIRECTSOUNDBUFFER *lp_lp_dsb, LPDIRECTSOUND3DBUFFER *lp_lp_dsb_3d,
DWORD sound_bytes, DWORD frequency, bool f_is_stereo, bool f_is_16_bit) {
DSBUFFERDESC dsbd;
tWAVEFORMATEX fmt;
HRESULT result = DS_OK;
@ -1885,7 +1885,7 @@ void win_llsSystem::StopSound(int sound_uid, unsigned char f_immediately) {
}
// Copies sound data from the external sound data block to an individual sound buffer
long LoadSoundData(LPDIRECTSOUNDBUFFER lp_dsb, char *sound_data_ptr, ulong total_bytes) {
HRESULT LoadSoundData(LPDIRECTSOUNDBUFFER lp_dsb, char *sound_data_ptr, DWORD total_bytes) {
LPVOID ptr1, ptr2;
DWORD len1, len2;
HRESULT result;

View File

@ -218,7 +218,7 @@
#ifndef __ds3dlib_h__
#define __ds3dlib_h__
// #include <windows.h>
#include <windows.h>
// #include <mmsystem.h> // Multi-media system support
// #include "dsound.h" // Direct sound header file
@ -283,8 +283,8 @@ private:
friend void __cdecl LoopStreamTimer(void *user_ptr);
// Creates a sound buffer
long CreateDSBuffer(int buffer_type, LPDIRECTSOUNDBUFFER *lp_lp_dsb, LPDIRECTSOUND3DBUFFER *lp_lp_dsb_3d,
ulong sound_bytes, ulong frequency, bool f_is_stereo, bool f_is_16_bit);
HRESULT CreateDSBuffer(int buffer_type, LPDIRECTSOUNDBUFFER *lp_lp_dsb, LPDIRECTSOUND3DBUFFER *lp_lp_dsb_3d,
DWORD sound_bytes, DWORD frequency, bool f_is_stereo, bool f_is_16_bit);
// Finds a free slot for a new sound, slot_uid is an SBID_xxx value.
#ifdef _DEBUG
@ -331,7 +331,7 @@ private:
char m_sound_quality;
// muted looped sound system
longlong m_timer_last_frametime;
int64_t m_timer_last_frametime;
float m_cache_stress_timer;
// clean interface