- It turns out that the Visual C++ 2005 runtime calls IsDebuggerPresent, which

is not available under Windows 95. Since this is (or at least should be) the
  only thing preventing us from running under Windows 95, I added a stub that
  replaces __imp__IsDebuggerPresent@0 with a pointer to a function that checks
  for the real thing.


SVN r279 (trunk)
This commit is contained in:
Randy Heit 2006-08-02 04:57:36 +00:00
parent effa46975e
commit 3a552d4aa0
6 changed files with 89 additions and 9 deletions

View file

@ -61,7 +61,8 @@ endif
SRCS = $(CSRCS) $(CPPSRCS) $(ASRCS)
CPPOBJFILES = $(notdir $(CPPSRCS:%.cpp=%.o))
COBJFILES = $(notdir $(CSRCS:%.c=%.o))
AOBJFILES = $(notdir $(ASRCS:%.nas=%.o))
# win32/wrappers.nas should be built *only* for Visual C++ 2005 to enable execution on Windows 95
AOBJFILES = $(filter-out %/wrappers.o,$(notdir $(ASRCS:%.nas=%.o)))
RCOBJFILES = $(notdir $(RCSRCS:%.rc=%.o))
COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES) $(RCOBJFILES))

View file

@ -1,3 +1,10 @@
August 1, 2006
- It turns out that the Visual C++ 2005 runtime calls IsDebuggerPresent, which
is not available under Windows 95. Since this is (or at least should be) the
only thing preventing us from running under Windows 95, I added a stub that
replaces __imp__IsDebuggerPresent@0 with a pointer to a function that checks
for the real thing.
August 1, 2006 (Changes by Graf Zahl)
- Fixed: The pickup message for Hexen's fighter's axe was assigned to the
AxePuff, not the weapon itself.

View file

@ -2491,8 +2491,6 @@ static void ActorActiveSound (AActor *defaults, Baggage &bag)
//==========================================================================
static void ActorDropItem (AActor *defaults, Baggage &bag)
{
bool res;
// create a linked list of dropitems
if (!bag.DropItemSet)
{

View file

@ -91,8 +91,6 @@ DWORD MainThreadID;
HMODULE hwtsapi32; // handle to wtsapi32.dll
BOOL (*pIsDebuggerPresent)(VOID);
extern UINT TimerPeriod;
extern HCURSOR TheArrowCursor, TheInvisibleCursor;
@ -218,10 +216,6 @@ void DoMain (HINSTANCE hInstance)
// Since we need to remain binary compatible with older versions of Windows, we
// need to extract the ProcessIdToSessionId function from kernel32.dll manually.
HMODULE kernel = GetModuleHandle ("kernel32.dll");
if (kernel != 0)
{
pIsDebuggerPresent = (BOOL(*)())GetProcAddress (kernel, "IsDebuggerPresent");
}
// NASM does not support creating writeable code sections (even though this
// is a perfectly valid configuration for Microsoft's COFF format), so I

39
src/win32/wrappers.nas Normal file
View file

@ -0,0 +1,39 @@
; The Visual C++ CRT unconditionally links to IsDebuggerPresent.
; This function is not available under Windows 95, so here is a
; lowlevel replacement for it.
extern __imp__GetModuleHandleA@4
extern __imp__GetProcAddress@8
SECTION .data
global __imp__IsDebuggerPresent@0
__imp__IsDebuggerPresent@0:
dd IsDebuggerPresent_Check
SECTION .rdata
StrKERNEL32:
db "KERNEL32",0
StrIsDebuggerPresent:
db "IsDebuggerPresent",0
SECTION .text
IsDebuggerPresent_No:
xor eax,eax
ret
IsDebuggerPresent_Check:
push StrKERNEL32
call [__imp__GetModuleHandleA@4]
push StrIsDebuggerPresent
push eax
call [__imp__GetProcAddress@8]
test eax,eax
jne near .itis
mov eax,IsDebuggerPresent_No
.itis
mov [__imp__IsDebuggerPresent@0],eax
jmp eax

View file

@ -106,6 +106,7 @@
TerminalServerAware="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
/>
<Tool
Name="VCALinkTool"
@ -5371,6 +5372,46 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\win32\wrappers.nas"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasmw -o &quot;$(IntDir)\$(InputName).obj&quot; -d OBJ_FORMAT_win32 -f win32 &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasmw -o &quot;$(IntDir)\$(InputName).obj&quot; -d OBJ_FORMAT_win32 -f win32 &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Shared Game"