Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Win2003 C# Forms
Good day,
how to create secured authentication form like WinLogon?
requirements: user can't get access to other forms and other application.
I founded some infomation about managing desktops in Windows above Win2k with using API functions CreateDesktop and SwitchDesktop. But I can't place my login form in login desktop when i keep my main form in default desktop.
I founded what "secured desktop" is exists in nature, but i have not enought information for realization of winform like winlogon.
May be I can use other technologies with WinForm.
Posted 12-Apr-12 16:44pm
Edited 12-Apr-12 20:37pm
v2
Comments
Member 8810364 at 13-Apr-12 1:22am
   
This application replace Explorer.exe and use autologon. It run authentication form and after authorization allow to run specialized application. It periodically ask user for input password. It allows to change user. When authentication form is running, other forms must be hidden.
Member 8810364 at 13-Apr-12 1:27am
   
This application can't use Active Directory and standart windows authentication.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This would be abuse of the OS, so no wonder that OS won't allow you to do it by a regular Forms application. Any in any case, you won't be able to disable Ctrl+Alt+Del followed by showing the Task Manager and ending of your process.
 
[EDIT]
 
However, please see this discussion:
c# program ctrl-alt-del screen windows 7[^].
 
For a Web application, for example, there is a Kiosk Mode. Please see:
Running a Web Site in Kiosk Mode with C#[^].
 
—SA
  Permalink  
v2
Comments
Member 8810364 at 13-Apr-12 1:13am
   
Ctrl+Alt+Del was disabled by local security policy (GPO)
SAKryukov at 13-Apr-12 18:27pm
   
This is not the only thing. You won't be able to disable activating another application window.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Solved with desktops
 
1) describe WinApi wrappers
[StructLayout(Sequental, Unicode)]
public struct SECURITY_ATTRIBUTES{     public Int32 nLength, SecurityDescriptor, bInheritHandle; }
describe referenses to WinApi functions OpenDesktop, SwitchDesktop, SetThreadDesktop
[DllImport("user32.dll", Unicode)]
public static extern IntPtr CreateDesktop (string,string,Int32,UInt32,UInt32,IntPtr);
 
2) when need to show Login Form,
2a) create login desktop (if it exists, it only open )
string dskName = "Logon desktop";
SECURITY_ATTRIBUTES sAtt = new SECURITY_ATTRIBUTES(){nLength=Marshal.SizeOf(typeof(SECURITY_ATTRIBUTES)), bInheritHandle=1};
sAtt.lpSecurityDescriptor =0;
 
IntPtr hglobal = Marshal.AllocHGlobal(Marshal.SizeOf(sAtt));
Marshal.StructureToPtr(sAtt, hglobal, false);
 
IntPtr logonDsk = CreateDesktop (dskName, null, 0, 1, 0x10000000, hglobal);
 
Marshal.FreeHGlobal(hglobal);
 
2b) create new thread and login form
Thread thread = new Thread(new ThreadStart(()=>
{
   logonDsk = createLoginDesk();
   SetThreadDesktop(logonDsk);
   SwitchDesktop(logonDsk);
 
loginForm = new LoginForm();
dlgResult = loginForm.ShowDialog();
 
var newdsk = OpenDesktop("Default",1,true,0x10000000);
SetThreadDesktop(newdsk);
SwitchDesktop(newdsk);
}));
 
3b) wait for finishing thread, after that get data from loginForm
 
p.s.: solution will be write in more details.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 19 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100