Lockworkstation functions simulated in non-XP operating systems

Source: Internet
Author: User

Lockworkstation functions simulated in non-XP operating systems

Author: delphiscn

Information Source: evil baboons Information Security Team

Program functions: computers that can be specified in non-XP operating systems

(For the beautiful UI of the program, I used the suipack control. If you are interested, you can download it from delphibox.com)

 

**************************************** **********************

Application password: Administrators

**************************************** **********************

Unit unit1;

 

Interface

 

Uses

Windows, messages, sysutils, variants, classes, graphics, controls, forms,

Dialogs, extctrls, suiform, stdctrls, suiedit, suibutton, inifiles, suidlg;

 

Type

Tform1 = Class (tform)

Form1: tsuiform;

Inputpassword: tsuiedit;

OK: tsuibutton;

Changepassword: tsuibutton;

Savepassword: tsuibutton;

Passwordnew: tsuiedit;

Closeapplication: tsuibutton;

Notes: tlabel;

Message: tsuimessagedialog;

Procedure formkeydown (Sender: tobject; var key: word;

Shift: tshiftstate );

Procedure okclick (Sender: tobject );

Procedure formcreate (Sender: tobject );

Procedure savepasswordclick (Sender: tobject );

Procedure closeapplicationclick (Sender: tobject );

Procedure changepasswordclick (Sender: tobject );

Private

{Private Declarations}

Public

{Public declarations}

End;

 

VaR

Form1: tform1;

 

Implementation

 

{$ R *. DFM}

 

Procedure tform1.formkeydown (Sender: tobject; var key: word;

Shift: tshiftstate );

Begin

If (Key = vk_f4) and ([ssalt] = Shift) then key: = 0;

End;

 

Procedure lock;

VaR

Hdesktop: thandle;

Wndhandle: thandle;

Wndclass: array [0 .. 50] of char;

Begin

Hdesktop: = findwindow ('progman ', nil );

Showwindow (hdesktop, sw_hide );

Strpcopy (@ wndclass [0], 'Shell _ traywnd ');

Wndhandle: = findwindow (@ wndclass [0], nil );

Showwindow (wndhandle, sw_hide );

End;

 

Procedure unlock;

VaR

Hdesktop: thandle;

Wndhandle: thandle;

Wndclass: array [0 .. 50] of char;

Begin

Hdesktop: = findwindow ('progman ', nil );

Showwindow (hdesktop, sw_show );

Strpcopy (@ wndclass [0], 'Shell _ traywnd ');

Wndhandle: = findwindow (@ wndclass [0], nil );

Showwindow (wndhandle, sw_show );

End;

 

Procedure tform1.okclick (Sender: tobject );

VaR

Filename: string;

Reguser: Tinifile;

Begin

Filename: = extractfilepath (paramstr (0) + 'reguser. ini ';

Reguser: = Tinifile. Create (filename );

If reguser. readstring ('program parameter ', 'Password', '') = inputpassword. Text

Then

Begin

Unlock;

Changepassword. Enabled: = true;

Closeapplication. Enabled: = true;

End

Else

Begin

Message. Text: = 'Sorry your password not right ';

Message. showmodal;

End;

End;

 

Procedure tform1.formcreate (Sender: tobject );

Begin

Changepassword. Enabled: = false;

Passwordnew. Enabled: = false;

Closeapplication. Enabled: = false;

Notes. Enabled: = false;

Savepassword. Enabled: = false;

Lock;

End;

 

Procedure tform1.savepasswordclick (Sender: tobject );

VaR

Filename: string;

Reguser: Tinifile;

Begin

Filename: = extractfilepath (paramstr (0) + 'reguser. ini ';

Reguser: = Tinifile. Create (filename );

Reguser. writestring ('program parameter ', 'Password', passwordnew. Text );

Message. Text: = 'you have changed password ';

Message. showmodal;

End;

 

Procedure tform1.closeapplicationclick (Sender: tobject );

Begin

Close;

End;

 

Procedure tform1.changepasswordclick (Sender: tobject );

Begin

Notes. Enabled: = true;

Passwordnew. Enabled: = true;

Savepassword. Enabled: = true;

End;

End.

 

Reguser. ini

---------------------------------------------------------------------------------

[Program parameters]

Password = Administrators

---------------------------------------------------------------------------------

Call lockworkstation function in XP

Rundll32.exe user32.dll, lockworkstation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.