Windows URI Schemes in GameMaker (C++)

W

woubuc

Guest
Hi all

I'm trying to develop a simple DLL that lets you create a URI scheme for your game. I started working on this because GameMaker currently lacks an easy way to get data from a website into a game, but with URI scheme support that would become a lot easier.

However, I'm pretty new to C++ and I can't get it to work the way it should, so I was wondering if someone with some C++ experience would mind taking a look at my code to see where the problem lies and perhaps see how it can be solved?

I've explained the issue in here (and that's also where you find the code): https://github.com/woubuc/URISchemer

Any tips / ideas / suggestions / thoughts / etc are very welcome.

Thanks!
 

Juju

Member
I have been wondering about this / trying to do this for the better part of a year. This would be quite the breakthrough if it was achieved.
 
L

Lahssoo

Guest
A (very) quick look at your code and it seems it should work. On the other hand, I believe you need elevated rights to be able to modify something in the registry, could that be your problem?
 
W

woubuc

Guest
A (very) quick look at your code and it seems it should work. On the other hand, I believe you need elevated rights to be able to modify something in the registry, could that be your problem?
But then the registry functions would return an error and the whole thing would not return 1, correct?

Because right now it returns 1 (success) but it doesn't do anything. Which is the part that doesn't make sense to me right now.
 
L

Lahssoo

Guest
But then it would return an error and the whole thing would not return 1, correct?
Possibly. I'll boot up a virtual machine to test, but I'm not using visual c++ so I won't use your code.
 
L

Lahssoo

Guest
Wait, your code is wrong, line 43 : (setDescription != ERROR_SUCCESS && setUrlProtocol != ERROR_SUCCESS)
 
L

Lahssoo

Guest
Uh... according to documentation, If RegSetValueEx succeeds, the return value is ERROR_SUCCESS. You are looking if setDescription and setUrlProtocol are not equal to ERROR_SUCCESS and then returning success = true ...
 
W

woubuc

Guest
Uh... according to documentation, If RegSetValueEx succeeds, the return value is ERROR_SUCCESS. You are looking if setDescription and setUrlProtocol are not equal to ERROR_SUCCESS and then returning success = true ...
Oh, 💩💩💩💩. Well that explains a lot :)

The issue is probably access rights then, as you said. So I'll have to figure out how to ask for elevated rights. Thanks!
 
L

Lahssoo

Guest
You're welcome ^^

About rights elevation, I'm not good with anything windows related, but I think you can't get it from a dll, you've got to restart the program as admin... Don't quote me on that though, once more : windows is way out of my area of expertise.
 
W

woubuc

Guest
About rights elevation, I'm not good with anything windows related, but I think you can't get it from a dll, you've got to restart the program as admin... Don't quote me on that though, once more : windows is way out of my area of expertise.
I think it should be possible to relaunch the application as admin from within the DLL. I'll go give that a try and see what happens :)
 
L

Lahssoo

Guest
May I know why you need to write something in the registry? I would not trust a game asking for admin rights to run.

You just need a way to use URI, right? So, basically this ? If that's the case, the application shouldn't have to edit the registry by itself, it's the work of the installer.
 
W

woubuc

Guest
May I know why you need to write something in the registry? I would not trust a game asking for admin rights to run.

You just need a way to use URI, right? So, basically this ? If that's the case, the application shouldn't have to edit the registry by itself, it's the work of the installer.
That is exacty what I'm trying to do. I want to develop a way to do it from within the gale because I don't want to use an installer if I don't have to.
 
L

Lahssoo

Guest
That is exacty what I'm trying to do. I want to develop a way to do it from within the gale because I don't want to use an installer if I don't have to.
That's contrary to Microsoft's guidelines, and it would also limit your game reach : It couldn't run on a non admin account and it wouldn't look trustworthy. Most importantly : it would make the game "un-uninstable"... Overall, it really doesn't look good to me.

I wonder if it's possible to write the registry editing into the NSIS installer?
Yup : http://nsis.sourceforge.net/Reading_and_Writing_the_Registry_-_NSIS_makes_it_easy
 

Juju

Member
Given that a lot games distro through Steam nowadays without a "true" installer, and I'm not entirely sure Steam lets you do stuff to the registry, there may not be another option.
 
L

Lahssoo

Guest
Steam provide a variety of solution to replace the usage of uri, from the workshop to the built in multiplayer and communication services. But as far as I can tell, the only way to register a new protocol in windows is through the registry, sadly.
 

Juju

Member
SteamWorks is notorious for being a pain in the arse to use, indeed, GM has no native support for most of the advanced features. There are two GM wrappers that exist as far as I know, one by John Kemp and another by Yellow AfterLife. I don't know how far they go in terms of URI-ness.

I have precious little experience with Workshop features. Could you expand?
 
W

woubuc

Guest
Steam provide a variety of solution to replace the usage of uri
Actually I'd be very interested to know more about this as well. As far as I know, only Steam itself uses URI schemes, none of the games on Steam do.
 

Juju

Member
Looking at my desktop shortcut to Sid Meier's Civilization V, it's a shortcut to steam://rungameid/8930 Can this be used somehow to capture incoming requests?
 
Top