Solved

How can i create a LAN HOUSE program like that? *** 50 POINTS ***

Posted on 2004-10-04
23
181 Views
Last Modified: 2010-08-05
Hi folks,

Do you know how could i create a LAN HOUSE program that do the following (?):

======================================================
After the USER log into the system, the program will be automatically activated and after some pre-configurated time (i can configure it to 1 hour, for example), the system blocks (stop) with a message (for example, "Your time is over - ENTER the new password to stay more time").
So, the user must enter a PASSWORD to still using the computer.
======================================================

These must work in WINDOWS NT-2000-XP.

Any help will be appreciated.

Best regards.
0
Comment
Question by:joelsilva
23 Comments
 
LVL 9

Expert Comment

by:ginsonic
ID: 12217207
for 50 points :)
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12217963
what you want is not simple at all... you need to override GINA.DLL, the logging mechanism for Windows 2000-XP...
you can find information at microsoft
http://search.microsoft.com/search/results.aspx?st=b&na=88&View=en-us&qu=gina.dll

other way of doing it would be to simply disable the TaskManager, you would still have the Alt+TAB problem, so you would need some timer that brings your application back to the front every second or whatever
0
 

Author Comment

by:joelsilva
ID: 12218530
Thank you Black, for your comments, but how can i implement the application itself (the TASKMANAGER question is not so important at this moment). I am having trouble in develop the program itself (in how could i make it).

My main doubt is how to START the application after the user LOG in and how BLOCK the system until the guy put a PASSWORD in a EDIT.
0
 
LVL 5

Accepted Solution

by:
Hypoviax earned 100 total points
ID: 12223798
Hi,

Me again!

This code will allow the program to run when the user logs in (on start up essentially). You have to declare this in uses : Registry

var regedit:treginifile;
begin
Regedit:=TRegIniFile.Create;
    with regedit do
    begin
                try
                            Regedit.RootKey := HKEY_CURRENT_USER;
                               if not regedit.openkey('\Software\Microsoft\Windows\CurrentVersion\Run',FALSE)then
                           begin
                             regedit.createkey('\Software\Microsoft\Windows\CurrentVersion\Run');
                             Regedit.WriteString('','THEAPP.exe',application.exename);
                           end
                     else
                                   Regedit.WriteString('','THEAPP.exe',application.exename);

  finally
    Regedit.CloseKey;
    Regedit.Free;
    inherited;
  end;
 end;

Now. As for the second part the easiest way to stop the user is to open up a full screen form with no borders (borderstyle property) when the time is up. Set the formstyle property to fsstayontop and continually disable taskmanager (so they cant close your app) by putting this in a timer at about 1ms interval:

postmessage(findwindow(nil,pchar('Windows Task Manager')),wm_close,0,0);

Remember everything is hackable (this should work though)

Best regards,

Hypoviax
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12223801
By the way, my first code write to the registry (type regedit in run), so do a backup before hand just in case something goes wrong.

Hypoviax
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12223825
As for the alt-tab problem brought up by BlackTigerX this MAY work. You can overcome this problem by hooking the alt key put this in a timer (could be the same timer as in the other post ^ up there ) :

if ((GetAsyncKeyState($+164) and 1) = 1) then //alt key
showmessage('You have been disallowed from alt-tabbing.') ;

Regards,

Hypoviax
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12223996
procedure TForm1.Button1Click(Sender: TObject); //This is for writing password
var inifile:tinifile;
password:string;
begin
 inifile:=tinifile.create(extractfilepath(application.exename)+'dsf.ini');//strange name to fool people
with inifile do
begin
password:=inputbox('Password','Enter a password','');
     writestring('Mainform','Password,password);
free
end;
end;


//When the user enters a password:
var inifile:tinifile;
password,temppass:string;

begin
 inifile:=tinifile.create(extractfilepath(application.exename)+'dsf.ini');
with inifile do
begin
password:=inputbox('Password','Enter a password','');
     temppass:=readstring('Mainform','Password,'');
If temppass:=password then
showmessage('Password Accepted')
else
showmessage('Incorrect Password')
free
end;
end;

Regards,

Hypoviax
0
 

Author Comment

by:joelsilva
ID: 12224041
Hi HYP,

Again, I deeply thank you man!
Your code and ideas seems great. You are great!
You know the reason, but i will sleep a little right now. Tonight i will carefully check all your ideas and line codes to perfectly understand what you mean.

I wish you the best.
Good Luck in your studies for the exams.

Bye bye.
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12224791
Just a suggestion:

1) When the user reenters their password, the time is logged for the number of hours they enter, say into a textbox. This time is sent to a computer that logs the details so you know how much to charge them. This could easily be done by using winsock components.

2) Alternatively, once their time is up the password is changed using winsock controls and in order to continue they have to pay you for the set number of hours. When they do this you provide them with the new password

Best Regards,

Hypoviax
0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 12228363
Hey,

You can disable the "Task Manager" by setting a reg value.
Take a look here: http://is-it-true.org/nt/xp/registry/rtips23.shtml

Dont want any points for this, Just wanted to share some information :)
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 12228813
:-)  
This is like " WatchGuard" :-)

Good luck, sounds like something very interesting,
Will be watching thread.

Carrzkiss
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 5

Expert Comment

by:Hypoviax
ID: 12231733
Hi again,

As others have been saying about task manager have a look at this recent thread if you want to use an alternative to my suggestion on killing taskmanager:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21145812.html

Best Regards,

Hypoviax
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12231821
An addition to the block system section with using full screen etc is to add this in a timer so that no other fsstayontop forms can come in front of your app:

application.BringToFront   OR   form_block_screen.BringToFront

Regards,

Hypoviax
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 12235012
is it necessary to disable the taskbar by a program?

couldn't you just create a user with limited user rights, that doesn't have the right to open the taskbar
and use other things. in this way the user won't be able to mess up your computer (something your
program will never be able to accomplish)

then you could start your timerprogramm in the autostart and if you disable alt f4 the
user won't be able to close it.

you could make a double login.
the first one is the limited user on the win2k/xp system, the other one will be on
your timerprogram to remove it  (for instance you could make it start in fullscreen
and demanding a password).

the task is not so easy as it may seem firsthand, because shouldn't the password change
everytime?
what should all be blocked, are there games that should be minimized after the time?


regards
0
 

Author Comment

by:joelsilva
ID: 12236153
Hey men,

I needed work all night tonight and didnt have time to test all your recommendation. I think that tonight i will have time.

I deeply thank you all (mainly HYP).

Best regards.
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12243046
Expanding mainly on suggestion 2:

You could write a server application (re my suggestion earlier) so that when a users system becomes locked using your app a message (using winsock) is sent to the server. If the user pays more money to continue then the new password is sent to the users computer (your app detects this and writes it using the inifile example i showed you) and you tell them that new password so they can continue.

If you need a simple example of using multiple connection winsocks please ask as i wrote a messaging application and i could post some example code here.

Best Regards,

Hypoviax
0
 

Author Comment

by:joelsilva
ID: 12245088
=========================================
If you need a simple example of using multiple connection winsocks please ask as i wrote a messaging application and i could post some example code here.
=========================================

HYP, i put all your recommendations in my PROJECT and your ideas and code were GREAT! No words to show my admiration!


As you gave me very special attention in this post, i will increase it´s points to 100.
If you could write some code related to what you mentioned about WINSOCK i just will love.
My actual project has 2 forms: FORM1 and FORM2.


FORM1
================================================
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Registry, StdCtrls, Inifiles;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}




procedure TForm1.Button1Click(Sender: TObject);
var regedit:treginifile;
begin
  Regedit:=TRegIniFile.Create;
  with regedit do
  begin
    try
    Regedit.RootKey := HKEY_CURRENT_USER;
    if not regedit.openkey('\Software\Microsoft\Windows\CurrentVersion\Run',FALSE)then
    begin
      regedit.createkey('\Software\Microsoft\Windows\CurrentVersion\Run');
      Regedit.WriteString('','THEAPP.exe',application.exename);
      end
      else
      Regedit.WriteString('','THEAPP.exe',application.exename);
    finally
      Regedit.CloseKey;
      Regedit.Free;
    end;
   end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Form2.ShowModal;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
inifile: Tinifile;
password:string;
begin
 inifile:=tinifile.create(extractfilepath(application.exename)+'dsf.ini');//strange name to fool people
with inifile do
begin
password:=inputbox('Password','Enter a password','');
     writestring('Mainform','Password',password);
free
end;
end;

procedure TForm1.Button4Click(Sender: TObject);
var inifile:tinifile;
password,temppass:string;
begin
 inifile:=tinifile.create(extractfilepath(application.exename)+'dsf.ini');
with inifile do
begin
password:=inputbox('Password','Enter a password','');
     temppass:=readstring('Mainform','Password','');
If temppass=password then
showmessage('Password Accepted')
else
showmessage('Incorrect Password');
free;
end;
end;

end.
================================================


FORM2
================================================
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm2 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Timer1Timer(Sender: TObject);
begin
  postmessage(findwindow(nil,pchar('Windows Task Manager')),wm_close,0,0);
  postmessage(findwindow(nil,pchar('Gerenciador de tarefas do Windows')),wm_close,0,0);
  if ((GetAsyncKeyState($+164) and 1) = 1) then //alt key
  showmessage('You have been disallowed from alt-tabbing.') ;
  // application.BringToFront  // Until i finish the project i must comment this line. Otherwise i couldnt UNBLOCK the application - lol
end;

end.
================================================

Best regards man!

I thank you others guys for colaborate in providing new ideas and suggestions too.
0
 

Author Comment

by:joelsilva
ID: 12245095
I increased the points.
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12245358
Ok, here we are:

In Delphi 7 you will have to do this first:

Go to Project|Options|Packages then 'Add' then in the window that opens, go to where delphi is installed then to \Bin and find 'dclsockets70.bpl' and add that in.

Next go to the Internet tab and add a TServerSocket and TClientSocket control (not the green coloured ones). In the properties of the serversocket add a port number (high up like 8000) and make it active. Rename it "server". In the clientsocket properties set the port number to the same number as the server port number. Rename this control "Client". Add the following events to each control except the very first which will go into your block event procedure

procedure TForm1.Button1Click(Sender: TObject);
begin     //Add this event when the block event occurs
client.Socket.SendText('Requesting Password')
end;

procedure TForm1.ServerClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
var password:string  ;
  begin
Showmessage('Request has been made for a new password at ' + socket.RemoteHost);
password:=inputbox('New Password','Enter a new password','');
socket.SendText(password) ;
end;

procedure TForm1.ClientRead(Sender: TObject; Socket: TCustomWinSocket);
begin
messagedlg('You are allowed to continue. Your new password is ' + socket.ReceiveText,mtinformation,[mbok],0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
client.Address:='127.0.0.1';   //This is where the address of the server will be (127.0.0.1 points to the local computer)
client.Active:=true;
end;

Regards,

Hypoviax
0
 

Author Comment

by:joelsilva
ID: 12256871
Hi HYP,

I have just 2 questions about your last code posted (10/06/2004 08:47PM PDT). I couldnt analyse these carefully yesterday, but tonight i will...

Best regards.
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12257042
ok man, talk to you tommmorow
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12264598
When you are ready, ask away!
0
 

Author Comment

by:joelsilva
ID: 12265091
Hi guys,

I deeply thank you by giving me tips and suggestions.
Special thanks for HYPOVIAX... You are the man!

By for now and best regards!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now