SyndromeDayna / diablo-2-median-xl-sigma-loader

7 stars 1 forks source link

Problems with virtual desktops #3

Open rahenry opened 4 years ago

rahenry commented 4 years ago

I like to run Median on a wine virtual desktop, otherwise I get occasional crashes, and a few seconds of blackscreen when switching workspaces. Unfortunately I can only get D2Stats.exe to work if it's in the same virtual desktop as Median (run with sigma-loader.exe). This is a problem because once D2Stats is "behind" Median, I can't access it anymore. Ideally I would like D2Stats to work in a separate virtual desktop (which requires a separate wineprefix), or without a virtual desktop (through program-specific settings in winecfg), but it won't work in these situations. It doesn't crash, but it can't detect stats or have any effect on Median/D2. I find that it works fine if both D2Stats and Median aren't using a virtual desktop, or if they're in the same virtual desktop, but not in any other case.

More info: I'm running wine 5.0-rc4. I've tried both 64 and 32-bit prefixes, same results.

Not sure if you can help with this, but perhaps you have some experience with it.

SyndromeDayna commented 4 years ago

Maybe you need some software that minimizes and maximizes diablo?

zatkinson08 commented 4 years ago

Hey Syndrome,

I wanted to re-write your code in a language I was more familiar with, like Python. However, reading over your code, fundamentally I do not understand why it works and why it fails when called directly with wine.

If this concept is plain to you, I would very much appreciate to hear your thoughts. My endgame, I would like to accomplish what rahenry has asked. Utilize wine's virtual desktop while running D2Stats for injection for my own use and others if I get it working.

Thanks

Update: I think I see. Rather then leave wine to run game.exe, you setup the process with the dll directly in your code. If I do the same thing but point it to d2stats, I would think that it would work. Will link code if I get it working. Ty for code you've already provided.

SyndromeDayna commented 4 years ago

Diablo uses Windows Api to deny any access to its process. I use SetSecurityInfo() api call to disable it.

SetSecurityInfo() requires process handle with full access rights which i receive from CreateProcess() function.

My loader literally consists of 3 api calls:

  1. CreateProcess()
  2. WaitForInputIdle()
  3. SetSecurityInfo()

Just repeat them in Python and your loader is done.

zatkinson08 commented 4 years ago

Very cool man, thanks for the knowledge drop.