-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minihwc.c getRegPath() returns null on Win98 #2
Comments
How do you compile glide? Assuming that you are building with MSVC6 and building h5: If you change the |
Thank you for responding. I build on winxp, with winxpddk(2600) with win98sdk, vc6 headers and all other old stuff installed. I dont use win9x.obj, reverted to state on sourceforge glide dev branch. I tried Koolsmokys built dll Has the same behaviour. Xp fine, win98 no-go. Works fine if built as debug, so hard for me to debug it :) |
Huh. OK, will look at this as soon as possible. |
Just to confirm: does this build work properly instead? h5.zip |
That |
Thanks for looking into it, I spent more time than Im willing to admit, with no resolve :) |
Two more questions though: Did you build from my own branch with DEBUG=1 and if you did, does it work too? The error screenshot you showed above: Unreal uses glide2x, not glide3x: how are |
Just tested it now, from your codebase as debug=1 doesnt work, will ignore user settings(switched about 3 weeks ago, forgot). Wanted as little change as posible and when everything worked, the plan was to add your changes to it. I use a glide2 to glide3 wrapper from this guy: https://wenchy.net/old/glidexp/, so everything glide will go to glide3x. |
You trying a different compiler got me thinking. What if really isnt a code problem? So I tried a couple, and win2kddk compiles it correctly, registry path gets read. I can only compile it with "make -f Makefile.win32 FX_GLIDE_HW=h5" without the USE_X86=1. Come to think of it, could just be that it doesnt find nasm |
Those line numbers don't make any sense.. |
Yes, mine has a bit different lines. Its just asm code, I think the way I have it now(with 2kddk istead of xp) it doesnt use nasm. I tried moving it around, not sure how to configure it to make it work.
Heres the file so you can see what are the lines |
Nothing to affect build in your changes as far as I can see. |
Maybe instead of moving configmg.h stuff into win9x.asm diff --git a/glide3x/h5/glide3/src/Makefile.mingw b/glide3x/h5/glide3/src/Makefile.mingw
index 3900876..2a05bbc 100644
--- a/glide3x/h5/glide3/src/Makefile.mingw
+++ b/glide3x/h5/glide3/src/Makefile.mingw
@@ -273,5 +273,2 @@ GLIDE_OBJECTS += \
../../minihwc/win_mode.o
-# so that we don't need win9x ddk:
-GLIDE_OBJECTS += \
- ../../minihwc/win9x.o
@@ -368,5 +365,2 @@ xdrawtri.o: xdrawtri.asm
-../../minihwc/win9x.o: ../../minihwc/win9x.asm
- $(AS) -o $@ -O2 -fwin32 $<
-
$(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h
diff --git a/glide3x/h5/glide3/src/Makefile.win32 b/glide3x/h5/glide3/src/Makefile.win32
index 8241ac0..6702b90 100644
--- a/glide3x/h5/glide3/src/Makefile.win32
+++ b/glide3x/h5/glide3/src/Makefile.win32
@@ -222,5 +222,2 @@ GLIDE_OBJECTS += \
../../minihwc/win_mode.obj
-# so that we don't need win9x ddk:
-GLIDE_OBJECTS += \
- ../../minihwc/win9x.obj
@@ -304,5 +301,2 @@ xtexdl_sse2.obj: xtexdl.asm
-../../minihwc/win9x.obj: ../../minihwc/win9x.asm
- $(AS) -o $@ -O2 -fwin32 $<
-
$(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h
diff --git a/glide3x/h5/minihwc/minihwc.c b/glide3x/h5/minihwc/minihwc.c
index ed46249..b51cf93 100644
--- a/glide3x/h5/minihwc/minihwc.c
+++ b/glide3x/h5/minihwc/minihwc.c
@@ -767,19 +767,68 @@
#include <ddraw.h>
#include "qmodes.h"
-#if 0 /* moved to asm so we don't need w9x ddk headers. */
+#if 0 /* inlined here 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
+#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> Does the inlined functionality look correct to you? (Sorry, that I still Here is a build using mingw gcc with such a change: h5-2.zip Please try that build, and also yours if you can e.g. with MSVC etc. |
It always seems to choke on I remember to have tried building with MSVC6 with success in the past. |
I dont think that win9x.asm is the problem in any way, since I also use sourceforge last build and that one doesnt use it. So right now, I can either build with xpddk + all the old sdks. Or I can build with 2kddk + all the old sdk, this one will work fine, but then I cant use use_x86, since this will fail. I tried combining what cc, asm, link it uses, by changing the paths in makefile. Doesnt really matter, as long as c compiler is from xpddk, it will work(but with getReg problem), everything else will fail if used with asm. Ill try the h5 build now - Nope, same problem as before, dies on init. |
What happens if you build it (my branch + the change above) yourself with msvc without ddk? |
How about we do the oposite? Move the problematic code to seperate file, compile with nasm and have just calls to obj? |
Which part of the code? |
In minihwc.c every(complete) part thats in the error lines 62xx... 6350.... 685x#if GL_X86 and so on... |
I still haven't been able to rig up my old boxes for this. However windows code had been touched a lot by KoolSmoky (and possibly |
Hey, thanks for keeping it open. But I used Koolsmokys source as base, since it works a bit better for win98 and Im slowly porting this changes into it. If @dborca sees this, I know its been like 15y, but if you happen to still have the source from mesafx6.3, would love to have it. I started converting 6.4.2, but its gonna take its time :) |
Hi, if you could help me a little.
Im trying to make it work on win98, but cant seem to figure this one out.
User env variables are not being set, because in minihwc.c, function getRegPath() return null when checked in function hwcGetenv.
if (regPath == NULL) {
regPath = getRegPath();
Works fine for winXp. Works if built with DEBUG=1 parameter in win98.
I can hardcode the return string
CM_Get_DevNode_Key( QDevNode.dwDevNode, NULL,
strval, sizeof(strval),
CM_REGISTRY_SOFTWARE );
Ofc that works, but its not really a solution :).
The text was updated successfully, but these errors were encountered: