17#define WIN32_LEAN_AND_MEAN
26#define WINLOGON_SAS_CLASS L"SAS Window class"
27#define WINLOGON_SAS_TITLE L"SAS window"
29#define IDHK_CTRL_ALT_DEL 0
30#define IDHK_CTRL_SHIFT_ESC 1
39#define EWX_ACTION_MASK 0x5C0F
66 if (!Session->Gina.Functions.WlxStartApplication)
77 ret = Session->Gina.Functions.WlxStartApplication(
78 Session->Gina.Context,
98 WARN(
"WL: CreateEnvironmentBlock() failed\n");
107 ret = Session->Gina.Functions.WlxActivateUserShell(
108 Session->Gina.Context,
133 UserProfile = (Session && Session->UserToken);
137 ERR(
"WL: ImpersonateLoggedOnUser() failed with error %lu\n",
GetLastError());
148 TRACE(
"RegOpenCurrentUser() failed with error %lu\n", rc);
152 SubKey =
L"Control Panel\\International";
158 SubKey =
L"System\\CurrentControlSet\\Control\\Nls\\Language";
173 TRACE(
"RegOpenKeyEx() failed with error %lu\n", rc);
185 TRACE(
"RegQueryValueEx() failed with error %lu\n", rc);
188 else if (dwType !=
REG_SZ)
190 TRACE(
"Wrong type for %S\\%S registry entry (got 0x%lx, expected 0x%x)\n",
198 TRACE(
"HeapAlloc() failed\n");
209 TRACE(
"RegQueryValueEx() failed with error %lu\n", rc);
219 TRACE(
"RtlUnicodeStringToInteger() failed with status 0x%08lx\n",
Status);
223 TRACE(
"%s language is 0x%08lx\n",
224 UserProfile ?
"User" :
"System",
Lcid);
228 TRACE(
"NtSetDefaultLocale() failed with status 0x%08lx\n",
Status);
286 ERR(
"WL: Exception while playing sound '%S', Status 0x%08lx\n",
340 }
while (
Index++ < 20);
348 WARN(
"wdmaud has not started!\n");
353 TRACE(
"Playing %s sound\n", SoundData->
IsStartup ?
"startup" :
"logon");
383 SoundData->
UserToken = Session->UserToken;
437 DWORD dSize = 0x1000;
442 UserProfile = (Session && Session->
UserToken);
450 ERR(
"WL: ImpersonateLoggedOnUser() failed with error %lu\n",
GetLastError());
457 ERR(
"Failed to open enumeration: %lu\n", dRet);
464 ERR(
"Failed to allocate memory\n");
479 for (; dCount; dCount--)
512 if (Session->Profile ==
NULL
516 ERR(
"WL: Wrong profile\n");
522 L"System\\CurrentControlSet\\Control\\Windows",
528 DWORD dwValue, dwType, cbData =
sizeof(dwValue);
530 &dwType, (
PBYTE)&dwValue, &cbData);
532 bNoPopups = !!dwValue;
538 ZeroMemory(&ProfileInfo,
sizeof(ProfileInfo));
539 ProfileInfo.
dwSize =
sizeof(ProfileInfo);
542 ProfileInfo.
lpUserName = Session->MprNotifyInfo.pszUserName;
546 ProfileInfo.
lpDefaultPath = Session->Profile->pszNetworkDefaultUserProfile;
547 ProfileInfo.
lpServerName = Session->Profile->pszServerName;
553 ERR(
"WL: LoadUserProfileW() failed\n");
561 WARN(
"WL: SetUserEnvironment() failed\n");
573 WARN(
"WL: SetDefaultLanguage() failed\n");
580 WARN(
"WL: AllowAccessOnSession() failed to give winsta & desktop access for this session\n");
590 WARN(
"WL: WlxActivateUserShell() failed\n");
599 WARN(
"WL: Failed to initialize screen saver\n");
601 Session->hProfileInfo = ProfileInfo.
hProfile;
612 if (Session->Profile)
617 Session->Profile =
NULL;
628 Session->UserToken =
NULL;
654 ERR(
"ImpersonateLoggedOnUser() failed with error %lu\n",
GetLastError());
665 TRACE(
"In LogoffShutdownThread with uFlags == 0x%x; exit_in_progress == %s\n",
695 TRACE(
"In KillComProcesses\n");
700 ERR(
"ImpersonateLoggedOnUser() failed with error %lu\n",
GetLastError());
762 ERR(
"Failed to initialize security descriptor for logoff thread!\n");
776 ERR(
"Failed to allocate memory for logoff security descriptor!\n");
799 ERR(
"Failed to set Access Rights for logoff thread. Logging out will most likely fail.\n");
807 ERR(
"Failed to initialize security descriptor for logoff thread!\n");
859 ERR(
"Failed to allocate mem for thread data\n");
874 ERR(
"Failed to create a required security descriptor. Status 0x%08lx\n",
Status);
891 ERR(
"Unable to get exit code of logoff thread (error %lu)\n",
GetLastError());
900 ERR(
"Logoff thread returned failure\n");
941 Session->UserToken =
NULL;
984 if (Session->SASWindow)
987 Session->SASWindow =
NULL;
989 if (Session->hEndOfScreenSaverThread)
990 SetEvent(Session->hEndOfScreenSaverThread);
1016 ERR(
"Failed to allocate mem for thread data\n");
1044 ERR(
"Unable to get exit code of shutdown thread (error %lu)\n",
GetLastError());
1051 ERR(
"Shutdown thread returned failure\n");
1061 ERR(
"Shutting down NT...\n");
1098 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1107 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1116 Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1123 if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
1131 Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1142 if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context))
1149 Session->Gina.Functions.WlxLogoff(Session->Gina.Context);
1155 Session->Gina.Functions.WlxShutdown(Session->Gina.Context, wlxAction);
1160 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1167 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1190 WARN(
"Unknown SAS action 0x%lx\n", wlxAction);
1207 switch (Session->LogonState)
1211 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1219 Session->Options = 0;
1221 wlxAction = (
DWORD)Session->Gina.Functions.WlxLoggedOutSAS(
1222 Session->Gina.Context,
1227 &Session->UserToken,
1228 &Session->MprNotifyInfo,
1229 (
PVOID*)&Session->Profile);
1239 wlxAction = (
DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType,
NULL);
1269 wlxAction = (
DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
1285 if (!Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
1288 SetEvent(Session->hEndOfScreenSaver);
1318 ERR(
"WL: Unable to register Ctrl+Alt+Del hotkey\n");
1324 if (!Session->TaskManHotkey)
1325 WARN(
"WL: Unable to register Ctrl+Shift+Esc hotkey\n");
1329 if (!Session->LockWkStaHotkey)
1330 WARN(
"WL: Unable to register Win+L hotkey\n");
1334 if (!Session->UtilManHotkey)
1335 WARN(
"WL: Unable to register Win+U hotkey\n");
1349 if (Session->TaskManHotkey)
1352 if (Session->LockWkStaHotkey)
1355 if (Session->UtilManHotkey)
1375 EventName =
L"SystemDefault";
1378 EventName =
L"SystemAsterisk";
1381 EventName =
L"SystemExclamation";
1384 EventName =
L"SystemHand";
1387 EventName =
L"SystemQuestion";
1390 WARN(
"Unhandled type %d\n", uType);
1391 EventName =
L"SystemDefault";
1416 TRACE(
"SAS: CONTROL+ALT+DELETE\n");
1424 TRACE(
"SAS: CONTROL+SHIFT+ESCAPE\n");
1430 TRACE(
"SAS: WIN+L\n");
1436 TRACE(
"SAS: WIN+U\n");
1495 case LN_ACCESSIBILITY:
1497 ERR(
"LN_ACCESSIBILITY(lParam = %lu)\n",
lParam);
1522 ERR(
"Missing EWX_SHUTDOWN flag for poweroff or reboot; action 0x%x\n",
Action);
1534 ERR(
"FIXME: EWX_FORCE present for Winlogon, what to do?\n");
1554 ERR(
"Invalid ExitWindows action 0x%x\n",
Action);
1559 TRACE(
"In LN_LOGOFF, exit_in_progress == %s\n",
1585 ERR(
"Logoff canceled!!, before: exit_in_progress == %s, after will be false\n",
1593 ERR(
"WM_LOGONNOTIFY case %d is unimplemented\n",
wParam);
1626 ERR(
"WL: Failed to switch to winlogon desktop\n");
1645 ERR(
"WL: Failed to register SAS window class\n");
1657 if (!Session->SASWindow)
1659 ERR(
"WL: Failed to create SAS window\n");
1666 ERR(
"WL: Failed to register SAS window\n");
DWORD WINAPI UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2)
@ TRUSTEE_IS_WELL_KNOWN_GROUP
void quit(int argc, const char *argv[])
BOOL CreateUserEnvironment(IN PWLSESSION Session)
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
#define IDS_APPLYINGYOURPERSONALSETTINGS
#define IDC_BTNSHTDOWNCOMPUTER
#define IDS_REACTOSISSHUTTINGDOWN
#define IDD_SHUTDOWNCOMPUTER
#define IDS_REACTOSISRESTARTING
#define IDS_SAVEYOURSETTINGS
#define IDS_LOADINGYOURPERSONALSETTINGS
BOOL InitializeScreenSaver(IN OUT PWLSESSION Session)
VOID StartScreenSaver(IN PWLSESSION Session)
BOOL AllowAccessOnSession(_In_ PWLSESSION Session)
Assigns both window station and desktop access to the specific session currently active on the system...
#define RegCloseKey(hKey)
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
#define NT_SUCCESS(StatCode)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
struct _SECURITY_ATTRIBUTES * PSECURITY_ATTRIBUTES
#define HeapFree(x, y, z)
static void cleanup(void)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
BOOL WINAPI RevertToSelf(void)
static SID_IDENTIFIER_AUTHORITY WorldAuthority
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
static const WCHAR Cleanup[]
#define THREAD_SET_THREAD_TOKEN
#define EXCEPTION_EXECUTE_HANDLER
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE
#define SE_SHUTDOWN_PRIVILEGE
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
struct _SECURITY_DESCRIPTOR * PSECURITY_DESCRIPTOR
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
#define MAKEINTRESOURCE(i)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
static NTSTATUS CreateLogoffSecurityAttributes(OUT PSECURITY_ATTRIBUTES *ppsa)
#define WINLOGON_SAS_TITLE
static BOOL StartUserShell(IN OUT PWLSESSION Session)
static BOOL RegisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
struct tagLOGOFF_SHUTDOWN_DATA LOGOFF_SHUTDOWN_DATA
static DWORD WINAPI PlayLogonSoundThread(_In_ LPVOID lpParameter)
static DWORD WINAPI KillComProcesses(LPVOID Parameter)
#define WINLOGON_SAS_CLASS
#define IDHK_CTRL_ALT_DEL
struct tagLOGON_SOUND_DATA LOGON_SOUND_DATA
static LRESULT CALLBACK SASWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
static INT_PTR CALLBACK ShutdownComputerWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
BOOL SetDefaultLanguage(IN PWLSESSION Session)
static VOID DispatchSAS(IN OUT PWLSESSION Session, IN DWORD dwSasType)
NTSTATUS HandleShutdown(IN OUT PWLSESSION Session, IN DWORD wlxAction)
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
static VOID PlayLogoffShutdownSound(_In_ PWLSESSION Session, _In_ BOOL bShutdown)
static VOID DoGenericAction(IN OUT PWLSESSION Session, IN DWORD wlxAction)
static VOID PlayLogonSound(_In_ PWLSESSION Session)
static BOOL StartTaskManager(IN OUT PWLSESSION Session)
static BOOL HandleMessageBeep(_In_ PWLSESSION Session, _In_ UINT uType)
static BOOL PlayEventSound(_In_ PWLSESSION Session, _In_ LPCWSTR EventName)
static BOOL HandleLogon(IN OUT PWLSESSION Session)
struct tagLOGOFF_SHUTDOWN_DATA * PLOGOFF_SHUTDOWN_DATA
struct tagLOGON_SOUND_DATA * PLOGON_SOUND_DATA
static VOID DestroyLogoffSecurityAttributes(IN PSECURITY_ATTRIBUTES psa)
BOOL InitializeSAS(IN OUT PWLSESSION Session)
static VOID RestoreAllConnections(PWLSESSION Session)
static DWORD WINAPI LogoffShutdownThread(LPVOID Parameter)
BOOL PlaySoundRoutine(IN LPCWSTR FileName, IN UINT bLogon, IN UINT Flags)
#define IDHK_CTRL_SHIFT_ESC
static BOOL UnregisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
static BOOL ExitReactOSInProgress
static NTSTATUS HandleLogoff(_Inout_ PWLSESSION Session, _In_ DWORD wlxAction)
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
DWORD grfAccessPermissions
ACCESS_MODE grfAccessMode
HANDLE hScreenSaverParametersChanged
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define LN_LOCK_WORKSTATION
BOOL WINAPI SetLogonNotifyWindow(HWND Wnd)
#define EWX_CALLER_WINLOGON
#define LN_START_SCREENSAVE
#define LN_LOGOFF_CANCELED
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
DWORD WINAPI GetLastError(void)
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
BOOL RemoveStatusMessage(IN PWLSESSION Session)
FORCEINLINE BOOL IsFirstLogon(_In_ PWLSESSION Session)
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
#define WLX_SHUTTINGDOWN(Status)
struct _WLSESSION * PWLSESSION
FORCEINLINE VOID SetLogonTimestamp(_Inout_ PWLSESSION Session)
VOID CloseAllDialogWindows(VOID)
UINT WINAPI waveOutGetNumDevs(void)
#define RESOURCETYPE_DISK
#define RESOURCE_REMEMBERED
#define WNetAddConnection
#define WN_NO_MORE_ENTRIES
#define HKEY_LOCAL_MACHINE
#define SC_MANAGER_CONNECT
BOOL WINAPI SwitchDesktop(_In_ HDESK)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
#define SPI_SETSCREENSAVEACTIVE
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
HWND WINAPI GetDesktopWindow(void)
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define MB_ICONEXCLAMATION
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
struct _WNDCLASSEXW WNDCLASSEXW
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SPI_SETSCREENSAVETIMEOUT
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WLX_SAS_TYPE_TIMEOUT
#define WLX_SAS_ACTION_NONE
#define WLX_PROFILE_TYPE_V1_0
#define WLX_SAS_ACTION_FORCE_LOGOFF
#define WLX_SAS_ACTION_UNLOCK_WKSTA
#define WLX_SAS_TYPE_CTRL_ALT_DEL
#define WLX_PROFILE_TYPE_V2_0
#define WLX_SAS_ACTION_LOGON
#define WLX_SAS_ACTION_TASKLIST
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
#define WLX_SAS_TYPE_SCRNSVR_TIMEOUT
#define WLX_SAS_ACTION_SHUTDOWN
#define WLX_SAS_TYPE_SCRNSVR_ACTIVITY
#define WLX_LOGON_OPT_NO_PROFILE
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
#define WLX_SAS_ACTION_LOCK_WKSTA
#define WLX_SAS_ACTION_LOGOFF
DWORD WINAPI WNetClearConnections(HWND owner)
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
_Must_inspect_result_ _In_ ULONG Flags
_In_ CONST DEVPROPKEY _In_ LCID Lcid
_Inout_opt_ PVOID Parameter
#define SECURITY_WORLD_SID_AUTHORITY
#define SECURITY_WORLD_RID
#define SECURITY_DESCRIPTOR_REVISION
#define SECURITY_DESCRIPTOR_MIN_LENGTH