Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

windows shell for java kiosk application

i have developed a java application in SWT that should be run on a Windows system operating as kiosk. The application should be the only application running in the system and should open just after the system starts. Every thing like task manager, windows start menu, hotkeys etc should be disabled (see for example http://www.codeproject.com/Articles/7392/Lock-Windows-Desktop). The application has also a build in administrator user which can activate all the things again having the possibility to make changes in the system. These things are already implemented. The problem is that when windows starts it lasts some seconds till the application opens and during this short time the user sees everything (nothing is disabled till the application starts). I have searched the internet and the only solution seems to be a replacement of the standard windows shell in registry. Now here comes the question:

Does anyone know how to write a shell for windows that

  1. enables me to deactivate everything on startup
  2. lets me put a shortcut to my application in the desktop so the user can open the application
  3. lets me activate the deactivated functionality for administrator user in my application

Or do you have any other ideas how to accomplish this?

Thanks

like image 310
teo Avatar asked Oct 04 '22 20:10

teo


1 Answers

Since what i tried to accomplish turned out to be complex and no one has answered till now, i will answer the question myself based on the things i implemented.

For having the possibility to start my application from the desktop(which does not exist since i had to remove it) i tried to implement a sort of taskbar. I implemented a SWT Dialog with jast a menu bar and a shell height of zero

....
WindowsSystemUtility.disableWindowsFunctionality(true);

shell = new Shell(getParent(), getStyle());

createMenu();

shell.layout();
shell.pack();   

Rectangle screenBounds = getParent().getMonitor().getBounds();
int monitorWidth = screenBounds.width;
int monitorHeight = screenBounds.height;
//System.out.println(monitorWidth + ", " + monitorHeight);

int dialogWidth = monitorWidth;
int dialogHeight = 0;   //height 0 - > shell has no height. only menu is shown
Rectangle shellBounds = shell.computeTrim(0, 0, dialogWidth, dialogHeight);
shell.setSize(shellBounds.width, shellBounds.height);

//place the dialog
int x = 0;
int y = 0;  //position north
//int y = monitorHeight - dialogHeight; //position south
shell.setLocation(x, y);

shell.open();
....

As you see when this applicatioin opens it tries to disable every windows functionality and than starts. In the menu bar of the dialog i put 1 menu with 2 menu items. One for starting my application and one for the administrator. Generated a jar, made an exe out of the jar and based on the link http://technet.microsoft.com/en-us/library/cc939862.aspx i put it in the userinit key.

I used the java generated code from the dll in http://www.codeproject.com/Articles/7392/Lock-Windows-Desktop to disable windows functionality like taskbar, clock, task manager etc and the links http://umang-world.blogspot.de/2012/02/is-it-is-possible-to-disable-windows.html for installing a key hook and http://www.kbdedit.com/manual/low_level_vk_list.html and http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx for the virtual key maps. When the user logs in using the administrator item in the menu bar i enable everything again through the same dll and deactivate the hook. Logging out the administrator activates averything again.

So summarizing:

  1. enables me to deactivate everything on startup
    • override userinit key in windows registry to deactivate the desktop and make my application start just after windows start without delay
    • when taskbar starts (the swt dialog i implemented)
      • kill explorer.exe
      • use dll to disable windows applications
      • install keyhook to disable keyboard keys
  2. lets me put a shortcut to my application in the desktop so the user can open the application
    • menu item in the taskbar
  3. lets me activate the deactivated functionality for administrator user in my application
    • if admin logs in through menu item
      • start explorer.exe
      • use dll to enable windows applications
      • stop keyhook to enable keyboard keys

I hope this can be usefull to others searching for same things. What i explained above is tested on windows xp sp3 and works fine.

like image 68
teo Avatar answered Oct 13 '22 12:10

teo