h3/h5, minihwc: inline configmg code, remove win9x.asm.

This commit is contained in:
Ozkan Sezer
2022-07-23 03:28:28 +03:00
parent 5ba939612e
commit 7d4a1ddda1
14 changed files with 261 additions and 319 deletions

View File

@@ -240,9 +240,6 @@ 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
###############################################################################
# rules
@@ -297,9 +294,6 @@ 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

@@ -68,6 +68,7 @@ endif
# platform
CDEFS = -D__WIN32__ -DFX_DLL_ENABLE -DHWC_ACCESS_DDRAW=1 -DHWC_EXT_INIT=1
#CDEFS += -DHAVE_WIN9X_DDK=1
# general
CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_TRI_CULLING=1
@@ -192,9 +193,6 @@ 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
###############################################################################
# rules
@@ -230,9 +228,6 @@ xtexdl_3dnow.obj: xtexdl.asm
xdrawtri.obj: xdrawtri.asm
$(AS) -o $@ $(ASFLAGS) $<
../../minihwc/win9x.obj: ../../minihwc/win9x.asm
$(AS) -o $@ -O2 -fwin32 $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe

View File

@@ -414,19 +414,68 @@
#include <ddraw.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#ifdef HAVE_WIN9X_DDK
#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
#define CR_FAILURE 0x00000013
#define ___CONFIGMG_Get_DevNode_Key 0x0033003d
struct _CMIOCTLPACKET {
DWORD dwStack;
DWORD dwServiceNumber;
};
static DWORD WINAPI CMIOCTLHandler(struct _CMIOCTLPACKET *pkt)
{
HANDLE hCONFIGMG;
DWORD crReturnValue = CR_FAILURE;
DWORD dwReturnSize = 0;
hCONFIGMG = CreateFileA(
"\\\\.\\CONFIGMG",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hCONFIGMG == INVALID_HANDLE_VALUE) {
return CR_FAILURE;
}
if (!DeviceIoControl(
hCONFIGMG, pkt->dwServiceNumber,
&(pkt->dwStack), sizeof(pkt->dwStack),
&crReturnValue, sizeof(crReturnValue),
&dwReturnSize, NULL)) {
crReturnValue = CR_FAILURE;
}
CloseHandle(hCONFIGMG);
if (dwReturnSize != sizeof(crReturnValue)) {
crReturnValue = CR_FAILURE;
}
return crReturnValue;
}
static DWORD __cdecl CM_Get_DevNode_Key (DWORD devnode, char *subkey, void *buffer, ULONG bufferlen, ULONG flags)
{
struct _CMIOCTLPACKET packet;
DWORD dwStack;
#if defined(_MSC_VER)
_asm {mov dwStack, ebp};
#elif defined(__GNUC__)
dwStack = (DWORD) __builtin_frame_address(0);
#else
#error Add support for your compiler here.
#endif
dwStack += 8;
packet.dwStack = dwStack;
packet.dwServiceNumber = 0x80000000 + (___CONFIGMG_Get_DevNode_Key & 0xFFFF);
return CMIOCTLHandler(&packet);
}
#endif
#endif
#endif /* __WIN32__ */
#ifdef macintosh
#include <GraphicsPrivHwc.h>

View File

@@ -1,90 +0,0 @@
; 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,16 +30,65 @@ 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. */
#ifdef HAVE_WIN9X_DDK
#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
#define CR_FAILURE 0x00000013
#define ___CONFIGMG_Get_DevNode_Key 0x0033003d
struct _CMIOCTLPACKET {
DWORD dwStack;
DWORD dwServiceNumber;
};
static DWORD WINAPI CMIOCTLHandler(struct _CMIOCTLPACKET *pkt)
{
HANDLE hCONFIGMG;
DWORD crReturnValue = CR_FAILURE;
DWORD dwReturnSize = 0;
hCONFIGMG = CreateFileA(
"\\\\.\\CONFIGMG",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hCONFIGMG == INVALID_HANDLE_VALUE) {
return CR_FAILURE;
}
if (!DeviceIoControl(
hCONFIGMG, pkt->dwServiceNumber,
&(pkt->dwStack), sizeof(pkt->dwStack),
&crReturnValue, sizeof(crReturnValue),
&dwReturnSize, NULL)) {
crReturnValue = CR_FAILURE;
}
CloseHandle(hCONFIGMG);
if (dwReturnSize != sizeof(crReturnValue)) {
crReturnValue = CR_FAILURE;
}
return crReturnValue;
}
static DWORD __cdecl CM_Get_DevNode_Key (DWORD devnode, char *subkey, void *buffer, ULONG bufferlen, ULONG flags)
{
struct _CMIOCTLPACKET packet;
DWORD dwStack;
#if defined(_MSC_VER)
_asm {mov dwStack, ebp};
#elif defined(__GNUC__)
dwStack = (DWORD) __builtin_frame_address(0);
#else
#error Add support for your compiler here.
#endif
dwStack += 8;
packet.dwStack = dwStack;
packet.dwServiceNumber = 0x80000000 + (___CONFIGMG_Get_DevNode_Key & 0xFFFF);
return CMIOCTLHandler(&packet);
}
#endif
#ifndef IDirectDraw7_CreateSurface /* ddraw.h not from dx7 sdk */

View File

@@ -241,9 +241,6 @@ 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 \
@@ -330,9 +327,6 @@ 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

@@ -70,6 +70,7 @@ endif
# platform
CDEFS = -D__WIN32__ -DFX_DLL_ENABLE -DHWC_ACCESS_DDRAW=1 -DHWC_EXT_INIT=1 -DGLIDE_ALT_TAB=1
#CDEFS += -DHAVE_WIN9X_DDK=1
# general
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DUSE_PACKET_FIFO=1
@@ -186,9 +187,6 @@ 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 \
@@ -262,9 +260,6 @@ 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

@@ -550,19 +550,68 @@
#include <ddraw.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#ifdef HAVE_WIN9X_DDK
#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
#define CR_FAILURE 0x00000013
#define ___CONFIGMG_Get_DevNode_Key 0x0033003d
struct _CMIOCTLPACKET {
DWORD dwStack;
DWORD dwServiceNumber;
};
static DWORD WINAPI CMIOCTLHandler(struct _CMIOCTLPACKET *pkt)
{
HANDLE hCONFIGMG;
DWORD crReturnValue = CR_FAILURE;
DWORD dwReturnSize = 0;
hCONFIGMG = CreateFileA(
"\\\\.\\CONFIGMG",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hCONFIGMG == INVALID_HANDLE_VALUE) {
return CR_FAILURE;
}
if (!DeviceIoControl(
hCONFIGMG, pkt->dwServiceNumber,
&(pkt->dwStack), sizeof(pkt->dwStack),
&crReturnValue, sizeof(crReturnValue),
&dwReturnSize, NULL)) {
crReturnValue = CR_FAILURE;
}
CloseHandle(hCONFIGMG);
if (dwReturnSize != sizeof(crReturnValue)) {
crReturnValue = CR_FAILURE;
}
return crReturnValue;
}
static DWORD __cdecl CM_Get_DevNode_Key (DWORD devnode, char *subkey, void *buffer, ULONG bufferlen, ULONG flags)
{
struct _CMIOCTLPACKET packet;
DWORD dwStack;
#if defined(_MSC_VER)
_asm {mov dwStack, ebp};
#elif defined(__GNUC__)
dwStack = (DWORD) __builtin_frame_address(0);
#else
#error Add support for your compiler here.
#endif
dwStack += 8;
packet.dwStack = dwStack;
packet.dwServiceNumber = 0x80000000 + (___CONFIGMG_Get_DevNode_Key & 0xFFFF);
return CMIOCTLHandler(&packet);
}
#endif
#endif
#endif /* __WIN32__ */
#ifdef macintosh
#include <GraphicsPrivHwc.h>

View File

@@ -1,90 +0,0 @@
; 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,16 +30,65 @@ 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. */
#ifdef HAVE_WIN9X_DDK
#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
#define CR_FAILURE 0x00000013
#define ___CONFIGMG_Get_DevNode_Key 0x0033003d
struct _CMIOCTLPACKET {
DWORD dwStack;
DWORD dwServiceNumber;
};
static DWORD WINAPI CMIOCTLHandler(struct _CMIOCTLPACKET *pkt)
{
HANDLE hCONFIGMG;
DWORD crReturnValue = CR_FAILURE;
DWORD dwReturnSize = 0;
hCONFIGMG = CreateFileA(
"\\\\.\\CONFIGMG",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hCONFIGMG == INVALID_HANDLE_VALUE) {
return CR_FAILURE;
}
if (!DeviceIoControl(
hCONFIGMG, pkt->dwServiceNumber,
&(pkt->dwStack), sizeof(pkt->dwStack),
&crReturnValue, sizeof(crReturnValue),
&dwReturnSize, NULL)) {
crReturnValue = CR_FAILURE;
}
CloseHandle(hCONFIGMG);
if (dwReturnSize != sizeof(crReturnValue)) {
crReturnValue = CR_FAILURE;
}
return crReturnValue;
}
static DWORD __cdecl CM_Get_DevNode_Key (DWORD devnode, char *subkey, void *buffer, ULONG bufferlen, ULONG flags)
{
struct _CMIOCTLPACKET packet;
DWORD dwStack;
#if defined(_MSC_VER)
_asm {mov dwStack, ebp};
#elif defined(__GNUC__)
dwStack = (DWORD) __builtin_frame_address(0);
#else
#error Add support for your compiler here.
#endif
dwStack += 8;
packet.dwStack = dwStack;
packet.dwServiceNumber = 0x80000000 + (___CONFIGMG_Get_DevNode_Key & 0xFFFF);
return CMIOCTLHandler(&packet);
}
#endif
#ifndef IDirectDraw7_CreateSurface /* ddraw.h not from dx7 sdk */

View File

@@ -271,9 +271,6 @@ 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 \
@@ -366,9 +363,6 @@ 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

@@ -77,6 +77,7 @@ endif
# platform
CDEFS = -D__WIN32__ -DFX_DLL_ENABLE -DHWC_ACCESS_DDRAW=1 -DHWC_EXT_INIT=1 -DGLIDE_ALT_TAB=1
CDEFS += -DBETA=1 -DHWC_MINIVDD_HACK=1 -DWIN40COMPAT=1 -DWINXP_ALT_TAB_FIX=1 -DWINXP_SAFER_ALT_TAB_FIX=1 -DNEED_MSGFILE_ASSIGN
#CDEFS += -DHAVE_WIN9X_DDK=1
# general
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DUSE_PACKET_FIFO=1
@@ -220,9 +221,6 @@ 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 \
@@ -302,9 +300,6 @@ 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,19 +767,68 @@
#include <ddraw.h>
#include "qmodes.h"
#if 0 /* moved to asm so we don't need w9x ddk headers. */
#ifdef HAVE_WIN9X_DDK
#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
#define CR_FAILURE 0x00000013
#define ___CONFIGMG_Get_DevNode_Key 0x0033003d
struct _CMIOCTLPACKET {
DWORD dwStack;
DWORD dwServiceNumber;
};
static DWORD WINAPI CMIOCTLHandler(struct _CMIOCTLPACKET *pkt)
{
HANDLE hCONFIGMG;
DWORD crReturnValue = CR_FAILURE;
DWORD dwReturnSize = 0;
hCONFIGMG = CreateFileA(
"\\\\.\\CONFIGMG",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hCONFIGMG == INVALID_HANDLE_VALUE) {
return CR_FAILURE;
}
if (!DeviceIoControl(
hCONFIGMG, pkt->dwServiceNumber,
&(pkt->dwStack), sizeof(pkt->dwStack),
&crReturnValue, sizeof(crReturnValue),
&dwReturnSize, NULL)) {
crReturnValue = CR_FAILURE;
}
CloseHandle(hCONFIGMG);
if (dwReturnSize != sizeof(crReturnValue)) {
crReturnValue = CR_FAILURE;
}
return crReturnValue;
}
static DWORD __cdecl CM_Get_DevNode_Key (DWORD devnode, char *subkey, void *buffer, ULONG bufferlen, ULONG flags)
{
struct _CMIOCTLPACKET packet;
DWORD dwStack;
#if defined(_MSC_VER)
_asm {mov dwStack, ebp};
#elif defined(__GNUC__)
dwStack = (DWORD) __builtin_frame_address(0);
#else
#error Add support for your compiler here.
#endif
dwStack += 8;
packet.dwStack = dwStack;
packet.dwServiceNumber = 0x80000000 + (___CONFIGMG_Get_DevNode_Key & 0xFFFF);
return CMIOCTLHandler(&packet);
}
#endif
#endif
#endif /* __WIN32__ */
#ifdef macintosh
#include <GraphicsPrivHwc.h>

View File

@@ -1,90 +0,0 @@
; 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