Identify type of executable in Windows

For Windows, this just uses the RUNTIME_PORT_ID hook that was already in the code
to identify which executable you are running

Mike
This commit is contained in:
nethack.allison
2012-01-15 19:11:41 +00:00
parent ead5101e0a
commit bf106e38f2
2 changed files with 35 additions and 0 deletions

View File

@@ -109,6 +109,10 @@ extern void FDECL(interject, (int));
# endif
#endif
#define RUNTIME_PORT_ID /* trigger run-time port identification for
* identification of exe CPU architecture
*/
/* The following is needed for prototypes of certain functions */
#if defined(_MSC_VER)
#include <process.h> /* Provides prototypes of exit(), spawn() */

View File

@@ -313,6 +313,7 @@ genericptr_t ptr2;
}
}
void
interject(interjection_type)
int interjection_type;
@@ -320,6 +321,36 @@ int interjection_type;
if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES)
msmsg(interjection_buf[interjection_type]);
}
# ifdef RUNTIME_PORT_ID
/*
* _M_IX86 is Defined for x86 processors. This is not defined for x64 processors.
* _M_X64 is Defined for x64 processors.
* _M_IA64 is Defined for Itanium Processor Family 64-bit processors.
* _WIN64 is Defined for applications for Win64.
*/
# ifndef _M_IX86
# ifdef _M_X64
# define TARGET_PORT "(x64) "
# endif
# ifdef _M_IA64
# define TARGET_PORT "(IA64) "
# endif
# endif
# ifndef TARGET_PORT
# define TARGET_PORT "(x86) "
# endif
void
append_port_id(buf)
char *buf;
{
char *portstr = TARGET_PORT;
Sprintf(eos(buf), " %s", portstr);
}
# endif /* RUNTIME_PORT_ID */
#endif /* WIN32 */
/*winnt.c*/