![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#5
|
|||
|
|||
|
Lo que dice Roman es cierto pero no logro saber porque no hace el shutdown
SE_CREATE_TOKEN_NAME = 'SeCreateTokenPrivilege'; SE_ASSIGNPRIMARYTOKEN_NAME = 'SeAssignPrimaryTokenPrivilege'; SE_LOCK_MEMORY_NAME = 'SeLockMemoryPrivilege'; SE_INCREASE_QUOTA_NAME = 'SeIncreaseQuotaPrivilege'; SE_UNSOLICITED_INPUT_NAME = 'SeUnsolicitedInputPrivilege'; SE_MACHINE_ACCOUNT_NAME = 'SeMachineAccountPrivilege'; SE_TCB_NAME = 'SeTcbPrivilege'; SE_SECURITY_NAME = 'SeSecurityPrivilege'; SE_TAKE_OWNERSHIP_NAME = 'SeTakeOwnershipPrivilege'; SE_LOAD_DRIVER_NAME = 'SeLoadDriverPrivilege'; SE_SYSTEM_PROFILE_NAME = 'SeSystemProfilePrivilege'; SE_SYSTEMTIME_NAME = 'SeSystemtimePrivilege'; SE_PROF_SINGLE_PROCESS_NAME = 'SeProfileSingleProcessPrivilege'; SE_INC_BASE_PRIORITY_NAME = 'SeIncreaseBasePriorityPrivilege'; SE_CREATE_PAGEFILE_NAME = 'SeCreatePagefilePrivilege'; SE_CREATE_PERMANENT_NAME = 'SeCreatePermanentPrivilege'; SE_BACKUP_NAME = 'SeBackupPrivilege'; SE_RESTORE_NAME = 'SeRestorePrivilege'; SE_SHUTDOWN_NAME = 'SeShutdownPrivilege'; SE_DEBUG_NAME = 'SeDebugPrivilege'; SE_AUDIT_NAME = 'SeAuditPrivilege'; SE_SYSTEM_ENVIRONMENT_NAME = 'SeSystemEnvironmentPrivilege'; SE_CHANGE_NOTIFY_NAME = 'SeChangeNotifyPrivilege'; SE_REMOTE_SHUTDOWN_NAME = 'SeRemoteShutdownPrivilege'; SE_UNDOCK_NAME = 'SeUndockPrivilege'; SE_SYNC_AGENT_NAME = 'SeSyncAgentPrivilege'; SE_ENABLE_DELEGATION_NAME = 'SeEnableDelegationPrivilege'; SE_MANAGE_VOLUME_NAME = 'SeManageVolumePrivilege'; // Enables or disables privileges debending on the bEnabled // Aktiviert oder deaktiviert Privilegien, abhängig von bEnabled Código:
type
TMainForm = class(TForm)
PopupMenu1: TPopupMenu;
ShowForm1: TMenuItem;
HideForm1: TMenuItem;
ImageList1: TImageList;
ListBox1: TListBox;
//Esta funsion parece ser necesaria para realizar un shutdown en NT Y XP pero ni llamandola el programa realiza el mismo // Código:
NTSetPrivilege(sPrivilege: string; bEnabled: Boolean): Boolean; var hToken: THandle; TokenPriv: TOKEN_PRIVILEGES; PrevTokenPriv: TOKEN_PRIVILEGES; ReturnLength: Cardinal; TMainForm.WndProc (var Message: TMessage); hwnd,exitcode:word;
hwnd:=Handle; if (MESSAGE.MSG=WM_ENDSESSION) then
MESSAGE.LParam=ENDSESSION_LOGOFF then DestroyWindow(hwnd); //postquitmessage(exitcode); ExitWindowsEx(EWX_FORCE,0);//esta instruccion se ejecuta perfectamente cerrando la session, aunque para mi no es necesaria
DestroyWindow(hwnd); //postquitmessage(exitcode); NTSetPrivilege(SE_SHUTDOWN_NAME,true); //Lei que es necesario el llamado para realizar shutdown ExitWindowsEx(EWX_SHUTDOWN,0); //No se ejecuta exitosamente la anterior instruccion, el programa se va de memoria pero para el shutdown
[delphi]else inherited WndProc (Message);
La idea es que cuando MESSAGE.LParam=ENDSESSION_LOGOFF se cierre la session pero que cuando sea otra cosa se apague el sistema, el llamado a cerrar la session se ejecuta exitosamente sin embargo el shutdown no ,sencillamente window para el mismo,pense que el privilegio era la causa ,me hice de esta funsion pero ni llamandola el desgraciado shutdown se ejecuta |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Como saber mediante hook cuando se abre o cierra una aplicacion | JoAnCa | API de Windows | 2 | 15-11-2008 20:05:48 |
| Apagar, reiniciar y cerrar sesión | jorgegetafe | Varios | 25 | 05-06-2007 20:28:17 |
| Cerrar aplicación al apagar el sistema | MDSato | API de Windows | 17 | 08-11-2006 23:08:30 |
| Error al cerrar aplicacion cuando creo fields dinamicamente | mierda | OOP | 3 | 02-11-2006 18:57:41 |
| al cerrar un libro se me cierra el Excel! | haron | Servers | 0 | 30-05-2003 11:07:26 |
|