h3,h5: move CM_Get_DevNode_Key() call to asm so we don't need win9x ddk

This commit is contained in:
sezero
2018-08-16 23:55:02 +03:00
parent e6797e4fd8
commit 8844a3f2e7
10 changed files with 222 additions and 5 deletions

View File

@@ -211,6 +211,9 @@ GLIDE_OBJECTS += \
../../minihwc/gdebug.o \
../../minihwc/minihwc.o \
../../minihwc/win_mode.o
# so that we don't need win9x ddk:
GLIDE_OBJECTS += \
../../minihwc/win9x.o
TEXUS_SOURCES = \
$(FX_GLIDE_SW)/texus2/lib/texuslib.c \
@@ -291,6 +294,9 @@ xtexdl_3dnow.o: xtexdl.asm
xdrawtri.o: xdrawtri.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
../../minihwc/win9x.o: ../../minihwc/win9x.asm
$(AS) -o $@ -O2 -fwin32 $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe

View File

@@ -186,6 +186,9 @@ GLIDE_OBJECTS += \
..\..\minihwc\gdebug.obj \
..\..\minihwc\minihwc.obj \
..\..\minihwc\win_mode.obj
# so that we don't need win9x ddk:
GLIDE_OBJECTS += \
..\..\minihwc\win9x.obj
TEXUS_SOURCES = \
$(FX_GLIDE_SW)\texus2\lib\texuslib.c \
@@ -259,6 +262,9 @@ xdraw3_3dnow.obj: xdraw3.asm
xtexdl_3dnow.obj: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
..\..\minihwc\win9x.obj: ..\..\minihwc\win9x.asm
$(AS) -o $@ -O2 -fwin32 $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe

View File

@@ -549,11 +549,17 @@
#include <ddraw.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#define IS_32
#define Not_VxD
#include <minivdd.h>
#include <vmm.h>
#include <configmg.h>
#else
extern DWORD __cdecl CM_Get_DevNode_Key(DWORD,PCHAR,PVOID,ULONG,ULONG);
#define CM_REGISTRY_HARDWARE 0
#define CM_REGISTRY_SOFTWARE 1
#endif
#endif

View File

@@ -0,0 +1,90 @@
; this is here so that the win9x parts of minihwc.c &&
; win_mode.c can compile without the win9x ddk headers.
extern __imp__CreateFileA@28
extern __imp__CloseHandle@4
extern __imp__DeviceIoControl@32
global _CM_Get_DevNode_Key
section .text
align 16
;CM_Get_DevNode_Key(DWORD, PCHAR, PVOID, ULONG, ULONG)
_CM_Get_DevNode_Key:
push ebp
mov ebp,esp
;struct _IOCTLPKT { DWORD stack, servicenum; } pkt;
;DWORD stack;
sub esp,12
mov dword [ebp-4],ebp
mov eax,dword [ebp-4]
mov dword [ebp-8],0x8000003d ; servicenum
add eax,8
mov dword [ebp-12],eax
lea eax,[ebp-12]
push eax
call _CM_IoctlHandler@4
mov esp,ebp
pop ebp
ret
align 16
;DWORD __stdcall CM_IOCTLHandler(struct _IOCTLPKT *)
_CM_IoctlHandler@4:
;HANDLE hCONFIGMG; DWORD rc,rcsize;
sub esp,8
push esi
push 0
push 0
push 3
push 0
push 3
push 0xc0000000 ; GENERIC_READ|GENERIC_WRITE
push LC0
; rc= ERR, rcsize = 0;
mov dword [esp+0x20],19 ; CONFIGMG error
mov dword [esp+0x24],0
call [__imp__CreateFileA@28]
mov esi,eax
cmp esi,0xffffffff
jne .L0
mov eax,19
pop esi
add esp,8
ret 4
.L0:
lea eax,[esp+8]
push 0
push eax
mov eax,dword [esp+24]
lea ecx,[esp+12]
push 4
mov edx,dword [eax+4]
push ecx
push 4
push eax
push edx
push esi
;DeviceIoControl(hCONFIGMG,
; pkt->servicenum, &pkt->stack, sizeof(pkt->stack),
; &rc, sizeof(rc), &rcsize,NULL);
call [__imp__DeviceIoControl@32]
test eax,eax
jne .L1
mov dword [esp+0x4],19
.L1:
push esi
call [__imp__CloseHandle@4]
mov eax,dword [esp+0x8]
cmp eax,4
mov eax,19
jne .L2
mov eax,dword [esp+4]
.L2:
pop esi
add esp,8
ret 4
align 16
section .rdata
LC0: db `\\\\.\\CONFIGMG\0`
align 16,db 0

View File

@@ -30,11 +30,17 @@ DECLARE_HANDLE(HMONITOR);
#include <ddraw.h>
#include <sst1vid.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#define IS_32
#define Not_VxD
#include <minivdd.h>
#include <vmm.h>
#include <configmg.h>
#else
extern DWORD __cdecl CM_Get_DevNode_Key(DWORD,PCHAR,PVOID,ULONG,ULONG);
#define CM_REGISTRY_HARDWARE 0
#define CM_REGISTRY_SOFTWARE 1
#endif
#ifndef IDirectDraw7_CreateSurface /* ddraw.h not from dx7 sdk */
typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKEXA)(GUID FAR *, LPSTR, LPSTR, LPVOID, HMONITOR);

View File

@@ -245,6 +245,9 @@ GLIDE_OBJECTS += \
../../minihwc/gdebug.o \
../../minihwc/minihwc.o \
../../minihwc/win_mode.o
# so that we don't need win9x ddk:
GLIDE_OBJECTS += \
../../minihwc/win9x.o
TEXUS_SOURCES = \
$(FX_GLIDE_SW)/texus2/lib/texuslib.c \
@@ -331,6 +334,9 @@ xtexdl_sse2.o: xtexdl.asm
xdrawtri.o: xdrawtri.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
../../minihwc/win9x.o: ../../minihwc/win9x.asm
$(AS) -o $@ -O2 -fwin32 $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h
fxinline.h: fxgasm.exe

View File

@@ -220,6 +220,9 @@ GLIDE_OBJECTS += \
..\..\minihwc\gdebug.obj \
..\..\minihwc\minihwc.obj \
..\..\minihwc\win_mode.obj
# so that we don't need win9x ddk:
GLIDE_OBJECTS += \
..\..\minihwc\win9x.obj
TEXUS_SOURCES = \
$(FX_GLIDE_SW)\texus2\lib\texuslib.c \
@@ -299,6 +302,9 @@ xdraw3_sse.obj: xdraw3.asm
xtexdl_sse2.obj: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_SSE2=1 $<
..\..\minihwc\win9x.obj: ..\..\minihwc\win9x.asm
$(AS) -o $@ -O2 -fwin32 $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h
fxinline.h: fxgasm.exe

View File

@@ -767,11 +767,17 @@
#include <ddraw.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#define IS_32
#define Not_VxD
#include <minivdd.h>
#include <vmm.h>
#include <configmg.h>
#else
extern DWORD __cdecl CM_Get_DevNode_Key(DWORD,PCHAR,PVOID,ULONG,ULONG);
#define CM_REGISTRY_HARDWARE 0
#define CM_REGISTRY_SOFTWARE 1
#endif
#endif

View File

@@ -0,0 +1,90 @@
; this is here so that the win9x parts of minihwc.c &&
; win_mode.c can compile without the win9x ddk headers.
extern __imp__CreateFileA@28
extern __imp__CloseHandle@4
extern __imp__DeviceIoControl@32
global _CM_Get_DevNode_Key
section .text
align 16
;CM_Get_DevNode_Key(DWORD, PCHAR, PVOID, ULONG, ULONG)
_CM_Get_DevNode_Key:
push ebp
mov ebp,esp
;struct _IOCTLPKT { DWORD stack, servicenum; } pkt;
;DWORD stack;
sub esp,12
mov dword [ebp-4],ebp
mov eax,dword [ebp-4]
mov dword [ebp-8],0x8000003d ; servicenum
add eax,8
mov dword [ebp-12],eax
lea eax,[ebp-12]
push eax
call _CM_IoctlHandler@4
mov esp,ebp
pop ebp
ret
align 16
;DWORD __stdcall CM_IOCTLHandler(struct _IOCTLPKT *)
_CM_IoctlHandler@4:
;HANDLE hCONFIGMG; DWORD rc,rcsize;
sub esp,8
push esi
push 0
push 0
push 3
push 0
push 3
push 0xc0000000 ; GENERIC_READ|GENERIC_WRITE
push LC0
; rc= ERR, rcsize = 0;
mov dword [esp+0x20],19 ; CONFIGMG error
mov dword [esp+0x24],0
call [__imp__CreateFileA@28]
mov esi,eax
cmp esi,0xffffffff
jne .L0
mov eax,19
pop esi
add esp,8
ret 4
.L0:
lea eax,[esp+8]
push 0
push eax
mov eax,dword [esp+24]
lea ecx,[esp+12]
push 4
mov edx,dword [eax+4]
push ecx
push 4
push eax
push edx
push esi
;DeviceIoControl(hCONFIGMG,
; pkt->servicenum, &pkt->stack, sizeof(pkt->stack),
; &rc, sizeof(rc), &rcsize,NULL);
call [__imp__DeviceIoControl@32]
test eax,eax
jne .L1
mov dword [esp+0x4],19
.L1:
push esi
call [__imp__CloseHandle@4]
mov eax,dword [esp+0x8]
cmp eax,4
mov eax,19
jne .L2
mov eax,dword [esp+4]
.L2:
pop esi
add esp,8
ret 4
align 16
section .rdata
LC0: db `\\\\.\\CONFIGMG\0`
align 16,db 0

View File

@@ -34,11 +34,6 @@ DECLARE_HANDLE(HMONITOR);
#include "qmodes.h"
#include "minihwc.h"
#include "setmode.h"
#define IS_32
#define Not_VxD
#include <minivdd.h>
#include <vmm.h>
#include <configmg.h>
#undef GETENV
#define GETENV hwcGetenv