Run CrystalControl without interactive Logon?

Bastler

New member
Hi there!

Recently I experimented a little with CrystalControl and the Task Scheduler...

My goal in this effort was to get CrystalControl (and therefore my 2 634USB-Displays) to run while there is no user logged on. This is a server system, usually there's nobody logged on (interactively), but the System is always online and it would be nice to have the displays show the stats!

What I found out is this:

I logged on as Administrator, started CrystalControl and configured it to my liking.
Then I created a tast that starts CrystalControl using the Administrator's User account and set it up to run at startup.


To test functionality I started the task manually (while logged on as Administrator)

Everything checked out, the displays showed the requested info and the task completed successfully.

However, if this very same task is executed while there's no user logged on the computer beeps once and that's it. The Task Manager still shows CrystalControl as running, but the displays don't work!

I believe CrystalControl produces some kind of runtime error (for example because there's no Systray to put the icon into), pops up a dialog box, beeps and then waits for input, but since scheduled tasks usually don't interact with the logon desktop I cannot say for sure...

Is there any way to get it to work even without an interactive user logged on to the console, so I can have it running in the background without having to log on?

If that's not possible, how about starting it at logon (not at system startup), but having it REMAIN ACTIVE even after logoff? Can that be done?

I'm pretty familiar with scheduling tasks (also through the command line tools), creating and modifying windows Services and using the Management Console, but it would be cool if someone could point out where to look for the appropriate switches... :)


@Admin:
What exactly is it that prevents CrystalControl from running when there's no user logged on? Does it require a taskbar present? so would it help if one would create a virtual interactive desktop for the program to run in?
I know this is possible in WinXP Pro, but it's not exactly a 5-minute-task (if you've never done it before) from what I've heard, so I'm wondering if it's worth spending a day trying...
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Last edited:

CF Mark

Administrator
Interesting, i havnt heard of anyone trying this as yet.

Really, i cant comment on what it may/may-not be doing, since ive never tried.
Im not sure if the taskbar code would have a problem with it not being there.

So im of really no help with this :(

This is the main reason why CrystalControl2 runs as a NT service... so its more suited for dedicated server type applications.
 

Bastler

New member
This is the main reason why CrystalControl2 runs as a NT service...
Which brings us back to the probably most frequently asked question in this forum...
"When are we gonna see v2??" ;)

Seperating the actual program from the GUI and having the main routines run as service is definitely a good idea, it tends to run a lot more stable (since regular "Users" don't even have sufficient security privileges to harm the service in any way) and lays down the basis for running in the background on multi-user systems! Sweet move!

But if it's not done yet I can live with v1 for a little while longer I think, it's a smooth program as it is... :)


Back to the Problem at hand:

"srvany.exe" is a tool bundled in the Windows Ressource Kit, right? I don't have the WRK, so I have never heard of it before, but to be honest I don't think it's going to be of much help from what the Microsoft Knowledge Base has to say about it. :( (I'll try it, though.)

Why not? Well, I am almost certain it adresses a different issue of the "NT Service Problem".

Usually the main trouble is the communication with the Service Management Console. The latter not only starts the service, but also attempts to monitor and communicate with it.
Since "normal" applications don't usually send an "INIT_SUCCESS" back to the parent process after starting up and react to status requests during runtime, the Service Management Console has a habit of immediately terminating the "Custom Services" when it fails to establish communication with the child process. That's where programs like SrvAny step in, take over the talkative part and basically have the management console leave the custom service alone.

CrystalControl however does not even start under the local user's security context, I don't think moving it to the system account (whose inner structure is a little bit different due to the absence of interactive components like Desktop, Keyboard, Mouse) will solve the problem.

But as I said, I'll keep trying! Maybe (some time next week) I can write a little script and catch the output (error message etc.) CrystalControl gives, to find out what's actually missing...


I'll keep you informed!



:::UPDATE:::
Just another thought:
Is there something that configures the CrystalControl Splash screen to be in the middle of the "visible screen area"?
Because if yes this could maybe cause a runtime error, since without interactive logon this object does not exist or at least does not return a usable value...
:::UPDATE:::



By the way, two tiny bug reports for v. 1.0x:

1. When saving a screen in the editor and reloading it sometimes (not always) leading spaces are lost in all lines of the display screen (a word that started on position 4 where Positions 1-3 were spaces is suddenly left-bound!)
2. When starting CrystalControl with more than one display configured if the hardware isn't acually connected the application produces a stack overflow and crashes as soon as the first "Cannot Open COM XX, Module disabled" (or whatever it says) dialog appears.
 

Bastler

New member
Newsflash!

I managed to get CrystalControl running as a service using SRVANY.EXE (thanks for the suggestion)!

However, just that it runs doesn't mean it works!

The Problem: CC appears to store all settings (configured modules, what pages to display etc) on a "per user" basis. System services are by definition executed under the username "NT AUTHORITY\SYSTEM"
and do not interact with (and are not displayed on)
any user's interactive Desktop!
It is impossible to create a user account with that name in Windows.

--> I cannot configure CrystalControl to detect and make use of my displays, even though it runs!

Is there a way to copy all settings from one user to another user, e.g. by duplicating certain registry keys CC creates or something similar?

Which ones are they and what is the syntax it uses?


Just to get this clear: All I need is an initial configuration!
I don't want to have full control over the program once it runs, if it stays in the background that's fine with me, but I need some way of fooling the program into thinking it has an active configuration for the user "NT AUTHORITY\SYSTEM" (or sometimes also "") and using that configuration when it runs as a service.

Any idea how that can be done?

or alternatively:
Does anyone know how I can run a SYSTEM SERVICE (not a scheduled task!!) under a username other than "NT AUTHORITY\SYSTEM"?
 

CF Mark

Administrator
Bastler said:
--> I cannot configure CrystalControl to detect and make use of my displays, even though it runs!

Is there a way to copy all settings from one user to another user, e.g. by duplicating certain registry keys CC creates or something similar?
Yup.

Setup CC as you would like... close it.

Run regedit, goto the key "hkey_current_user/software/crystalcontrol".
Right click, export to a file.
Edit the file it creates with notepad.
Change the key locations to where you think CC is looking.
"Run" the .reg file to write the settings back to the registry.
 

lanmat

New member
Hello, thanks for posting this thread. I haven't seen many topics dealing specifically with this issue.

I have a slightly different setup where many users will log into the computer, but I'd like to setup a certain set of screens and have my 633 usb work the same for each user even upon logoff. So I guess I'm asking 2 questions:

1) Could you sum up what you've done to get CC to work as a service? (I'm assuming you're working with Win 2k/XP?)

2) ...do you think CC as a service could work across multiple user login/offs? Does your particular setup work if a user logs in and logs out again? (assuming the user's settings don't invoke a second instance of CC...)

Thanks.
 

Bastler

New member
...do you think CC as a service could work across multiple user login/offs?
That's the idea! And as long as the Program runs stable this works fine for me!

I can tell you exactly what to do (at least that's how it worked for me), but first you have to understand two little downfalls:

1. To have CC run as a service and survive interavtive logons/logoffs it needs to be run as the user "NT AUTHORITY\SYSTEM".
Since this User (as mentioned above) does not have a desktop environment there will be absolutely no user interface showing anywhere! In other words: your only access to the programs's settings is by editing the registry!

You might now think "But other programs like firewalls etc. run as a service too and I can see their interface!"

True, but the only way to accomplish that is to seperate the actual runtime routines (running as a service) from the GUI, which then is loaded individually for each user and interacts with the service. As long as you only have ONE program for both, it's gonna disappear from screen!

2. And that's where the second problem comes in:

CC stores its Information in the "Current User"-Section of the registry. This section is not global, but unique to the user currently logged on! It is loaded at logon for every user individually and unloaded as soon as the user logs off. In other words: You have to be logged in as the user whose "Current User"-Section you want to edit. Since you cannot interactively log on as "NT AUTHORITY\SYSTEM" this is where it gets a little tricky!


So here's what you have to do!

1. Set up CC the way you like it. Make sure it can run the way you desire completely without user intervention (hotkeys won't work either I'm afraid, since they'll be detected as coming from a different user. If you have hardware buttons Girder might do the trick though. As with the built in buttons of some displays this MIGHT work by itself, depending on how the service is programmed, haven't tried it!).

2. Go to the above-mentioned registry path and export everything you see into a file.

3. Use Windows scripting to build a script that does the following:
- 3.1 Execute the registry file you just created
- 3.2 Send a "YES" through the system to approve the appearing dialog

Windows Scripting is really simple and well documented on MS's TECHNET-Site, so I won't go into that right now.


4. Use the Task Scheduler or whatever to run your script as "NT AUTHORITY\SYSTEM" once!
(See MS.com for documentation, only works with the command line tools)

5. Use "srvany.exe" (available from technet, documentation included. This also is a command line tool) to setup CC as a service, have it start at computer startup and BE NON-INTERACTIVE (Setting it up to be interactive will result in a crash since this requires that the program understands certain command-parameters (which it doesn't...), so don't get ideas here!).


At your next reboot you should now have CC boot up the displays and diplay the desired information...


Oh, there's one other thing that can happen if your hardware is really fast:
If the CC service is started before the USB hardware is initialized, CC will of course not find the displays and give an error! You won't see the message, but you will hear the beep. In that case you should include the usb subsystem in the dependancies for your cc-Service (use parameters).


Accomplishing this task with a program as complex as CC is not exacly plug and play as you might have figured by now, it takes patience and it definitely helps if you understand the basic workings of the Windows logon structure and the command line tools to manipulate it.



All the additional command line programs mentioned above are part of Microsoft's Addon-Pack for Win2K/XP/2K3. They are well documented and freely available on the technet site, but since they all access system parameters directly I'd strongly recommend backing up your system before you fiddle with them if you don't know what you are doing or are inexperienced with handling the command line!! There's usually no net to catch your fall, no "undo" button (if you want something undone you have to set the right parameters to reverse your actions *gg*) and a mistake can and probably will leave your system instable or unbootable!!

(This last paragraph is just so no one holds me responsible for messing up their system! :) )

Happy Hunting
 
Top