VOGONS

Common searches


D-Fend Reloaded (DOSBox frontend)

Topic actions

Reply 1966 of 2280, by dosmax

User metadata
Rank Newbie
Rank
Newbie

I would like to request a small feature: the option in game profiles to launch programs with elevated rights. I could use this for Dosbox profiles as well as Windows profiles.

I'd happily do it myself, should be pretty straight forward to implement. All I would need is a little heads up how to compile DFR (IDE used, needed libs etc.). Unfortunately Delphi is one of the languages I do have zero experience with.

Reply 1967 of 2280, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

Hi dosmax,

running a program with elevated rights isn't so easy. You can start any Windows program from within D-Fend Reloaded with some other user account by replacing the run command in the profile editor, lets say "program.exe" by "runas /u:<Admin> program.exe" or "runas /user:<Admin>/password:<password> program.exe". But in this case D-Fend Reloaded has no control over the started program, so functions like "minimize and restore when program is done" won't work. Also no helper program to be executed when the main program is done can be defined. The other way would be to raise the D-Fend Reloaded privileges while it's running. I have already tried this some time ago (to be able to change the installer language which is written in the registry by the installer) - and finally have given it up. The Windows API functions for privileges management are really very complex; this isn't strait forward to implement.

For most Windows games it is uncommon to give them admin rights. The idea of restricted accounts is that a normal program cannot damage the whole software installation (what a program running with elevated rights can do). For DOSBox I can say there is no need for running it with admin rights. It is only accessing the files in the folders defined as drives for DOSBox. The default drive C: folder is located in the user data area. So running DOSBox with admin rights has no advantage but only brings additional risks.

Reply 1968 of 2280, by dosmax

User metadata
Rank Newbie
Rank
Newbie

Thanks for explaining the reasoning behind restricted accounts... 😉 Maybe I should have been more specific about the reason for the request:

1. For Dosbox it makes sense in regard to a Windows 95 - Dosbox installation I use that relies on a portable version of WinPCap for networking, which requires admin-rights to work.

2. For Windows profiles it makes a lot of sense for some older games that require admin rights. There are several other ways to achieve the goal, of course. But doing it directly in D-Fend would be the cleanest method.

The implementation is actually pretty straight forward btw., not at all hard. You just have to use ShellExecuteEx with runas. I even found a ready to use Delphi-example after a short Google search (see below), so you don't even have to translate from C.

No problem though if you don't want to implement this. As said above, I'd happily do it myself. Just a little heads up regarding getting started with compiling D-Fend (used IDE, required libs etc.) would be really nice, which probably would save me 90% time.

function RunAsAdmin(hWnd: HWND; filename: string; Parameters: string): Boolean;
{
See Step 3: Redesign for UAC Compatibility (UAC)
http://msdn.microsoft.com/en-us/library/bb756922.aspx
}
var
sei: TShellExecuteInfo;
begin
ZeroMemory(@sei, SizeOf(sei));
sei.cbSize := SizeOf(TShellExecuteInfo);
sei.Wnd := hwnd;
sei.fMask := SEE_MASK_FLAG_DDEWAIT or SEE_MASK_FLAG_NO_UI;
sei.lpVerb := PChar('runas');
sei.lpFile := RChar(Filename); // PAnsiChar;
if parameters <> '' then
sei.lpParameters := PChar(parameters); // PAnsiChar;
sei.nShow := SW_SHOWNORMAL; //Integer;

Result := ShellExecuteEx(@sei);
end;

source of the code snippet: http://zewaren.net/site/?q=node/10

Reply 1969 of 2280, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

By using ShellExecuteEx I would have very limited control of the started process. For example in some configurations I need to set up some environment variables for the DOSBox process. Things like this can only be done by using CreateProcess. And CreateProcess is much more complex than a simple ShellExecute. Even more if a non-privileged process is starting a process with higher rights, by design the calling process has no control of the admin process (for example checking if the other process is still running, moving its window to a new position etc.). D-Fend Reloaded is doing all this things (if the user has set up in the program options dialog to align the DOSBox window etc.). So D-Fend Reloaded and DOSBox have to be on the same privileges level.

Reply 1970 of 2280, by dosmax

User metadata
Rank Newbie
Rank
Newbie

There might be things in programming that are too complex to do. However, starting a process from another one in any way imaginable is very clearly not among those things. A google search for 'CreateProcess elevated privileges' returns several solutions people have found years ago. So, as with most of such common issues, not even real work seems to be required.

If controlling the started process is an issue, simply outsourcing the starting/controlling to a helper process, which is elevated itself (and communicates with the original D-Fend process if required), should do the trick.

I know that there are tons of other ways to do what I want using existing tools, I already do that. I just would like to have a simple 'run elevated' checkbox in D-Fend instead. Taking away complexity from the user is always a good thing in programming. Isn't that the whole point of a GUI/launcher for an emulator anyway?

As said twice, I can totally understand if you don't want to do that, as it might not be needed by many. I'll happily do it myself if you consider it impossible. A little heads-up how to get started with compiling D-Fend, which shouldn't cost you more than ten minutes, would have been nice though, since figuring such things out always is stupidly wasted time of the worst kind. No problem though if you don't want to do that either, you might have your reasons. Although I'm not sure whether I'm able to understand them, considering that D-Fend is an open source project.

Reply 1971 of 2280, by gibra

User metadata
Rank Newbie
Rank
Newbie

D-Fend Reloaded v.1.3.6

Problem: If AVI (and other file type?) is missing, D-Fend get alert

To reproduce error (need a AVI file in Capture Folder):
- run D-Fend Reloaded
- on Screenshots tab -> right-click then choose: Open Capture Folder
- delete a AVI file
- go to Video tab: the AVI file still present
- left-click the AVI file: D-Fend shows an alert ->Codec not found
- close alert -> AVI file name disappears from Video tab

Long life to the D-Fend Reloaded 😀

gibra
http://nuke.vbcorner.net

Reply 1972 of 2280, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

@gibra:
Thank you for reporting this problem. I will have a look at it the next days.

@dosmax:
It's always nice to hear if someone says to me what is easy to implement. I haven't found any useful hint on the web about running a process with admin rights via CreateProcess. There are many questions about this but no answers. I guess this should be possible but in this case I would have to dive very deeply into the whole Windows security system. I would need to acquire security tokens which describe which rights I want etc. So this is not easy - in particular if one is having nearly no free time because of his daytime job anymore.

So the only solution is a launcher with a manifest which tells Windows to run the program with admin rights. But anyway I will lose complete control of the child process. No centering the DOSBox window in windowed mode, no automatic repacking zip files, no helper programs to be executed after the main program. (These things will bring me many bug reports like "DFR is broken; when running DOSBox as admin centering the window is not working. Fix this! Now!" And these are the better ones. The other messages I will get will be: "I have executed 'deltree C:\*.*' with admin right and now my computer is broken. I will sue you." - I have already get things like this; the user had installed DFR directly into the program folder itself. The confirmation on uninstall "There are foreign files in the DFR installation folder. Do you really want to remove the whole folder?" was answered with yes. - So a feature like running something with admin rights is rising the risk someone is damaging his software installation due to misusage very much.)

But anyway, I'm on it. For DOSBox it's already working. For ScummVM and for Windows programs I will have to test it. Also GUI is still missing. Having new GUI elements will require a complete major release of DFR because I will have to write to the translators for all available languages and ask them to add the new language strings to their translations. - This usually takes some month. Also in most cases I will get some "Oh there is still a typo" language file updates just a day after the release is out - requiring a service release.

With a little luck we can have a beta 1 release of 1.4 by the end of this month.

Reply 1973 of 2280, by dosmax

User metadata
Rank Newbie
Rank
Newbie

Thanks! Although it really wasn't neccessary that you invest the time yourself, I would have done it myself.

The following Codeproject article seems to contain everything you need to know. Code is C and some assembler, but a ready to use DLL, which should be easy to use from Delphi, is also provided. So it's probably unnecessary to understand the whole thing. Among a bunch of other UAC related things the DLL exports CreateProcessElevatedA and CreateProcessElevatedW.

There are also functions to edit the registry elevated, which might help with your installer issue you mentioned earlier.

Link: http://www.codeproject.com/Articles/19165/Vis … efinitive-Guide

Reply 1974 of 2280, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

Running DOSBox, ScummVM and Windows program with admin rights is not possible. - But because this requires new language strings and therefore requires an update of all 17 language files DFR 1.4 won't be available before summer. Additionally the new feature will be disabled and invisible in the GUI by default. It has to be explicitly enabled on the security page of the setup dialog. A still think this feature is useless and just dangerous for inexperienced users.

@gibra:
I can't reproduce your problem. On my system a video file immediately disappears from the videos tab when it is deleted. (DFR is setting a monitoring hook on the capture folder. As soon as something changes there, Windows is notifying DFR so the list should be up to date at any time.) But anyway I have added some checks to the video player dialog so there will be the correct error message "The file %s does not exist." in this case.

Reply 1975 of 2280, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

I have just released DFR 1.4.0b1. There are only very little changes but because DFR needs some new language strings, we will need to make a bigger version step.

Reply 1976 of 2280, by vorpal886

User metadata
Rank Newbie
Rank
Newbie

Hello! Love Reloaded, used Defend a while back. Not sure if it's DosBox or Reloaded but upon Right clicking a profile in the list and selecting "View DBox Config" I get an access violation in dfend.exe. Sems to pertain to using a custom dosbox path.

I have several dosbox/version installs but only when using and "Viewing DBox Config" in it's default location does it not error. Thought it might be because there was no config file but it still pops up even with a config in the custom path.

The violation code/address is "006B251C" in module 'dfend.exe' read address of 00000030"

Maybe it's just me? Maybe something sketchy with using custom DOSbox paths? Just thought I'd toss this in here. Everything else is just fine for now.

Reply 1977 of 2280, by sst

User metadata
Rank Member
Rank
Member
Alexander wrote:

I have just released DFR 1.4.0b1. There are only very little changes but because DFR needs some new language strings, we will need to make a bigger version step.

Français Canada, French Canada 2014-05-20
See file included, ...

Attachments

  • Filename
    French Canada.ini
    File size
    139.89 KiB
    Downloads
    122 downloads
    File comment
    Français Canada, French Canada 2014-05-20
    File license
    Fair use/fair dealing exception

Reply 1978 of 2280, by Staticblast

User metadata
Rank Newbie
Rank
Newbie

Hi Alexander,

There seems to be a bug that's recurring. I noticed that it was mentioned as fixed on the Facebook page, but it's happening again for both versions 1.3.6 and 1.4.0b1

D-Fend bug.jpg
Filename
D-Fend bug.jpg
File size
55.91 KiB
Views
3540 views
File license
Fair use/fair dealing exception

For those who can't see the picture, it's the bug where the insert button on profile creation is disabled when searching for game info on Mobygames.

4-in-1 build (thanks Phil!): AMD K6-III+ 450 / SOYO 5EMA+ / 128MB SDRAM / 80GB Seagate HDD / Voodoo 3 3000 / Orchid Righteous 3D / Sound Blaster CT2960 / MPU-401 PCMIDI Clone / HxC Floppy Emulator / 15" CRT monitor

Reply 1979 of 2280, by huma79

User metadata
Rank Newbie
Rank
Newbie

I would also find the option to launch games with Admin rights to be extremely useful for those old Windows games that require it, so thanks for taking the time to add it. Also, do you recommend any guides for getting a Delphi environment set up for contributing to DFR?