Jump to content
Fivewin Brasil

RunAsAdmin.prg: Rodando o Prompt do DOS como Administrador.


rochinha

Recommended Posts

Amiguinhos,


Mais uma dica legal para podermos executar ações burlando a segurança do Windows.


Testei em um Windows Seven Ultimate 64 com segurança média.


RunAsAdmin.prg

////////////////////////////////////////////////////////////////////////////
//
// Autor: Jose Carlos da Rocha
// Data: 07/05/2015
// Email: irochinha@hotmail.com.br
// Linguagem: xBase / Fivewin
// Plataformas: DOS, Windows
// Requerimentos: Harbour/xHarbour
//
/////////////////////////////////////////////////////////////////////////////

#include "FiveWin.ch"

FUNCTION MAIN()

? ;
'ShellExecute( "CMD.EXE", "RUNAS", "", "C:\WINDOWS\SYSTEM32", 1 )',,;
ShellExecute( "CMD.EXE", "RUNAS", "", "C:\WINDOWS\SYSTEM32", 1 )

RETURN .T.

#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
// ShellExecute( cFile, cOperation, cParams, cDir, nFlag )
HB_FUNC( SHELLEXECUTE )
{
hb_retnl( (LONG) ShellExecute( GetActiveWindow(),
ISNIL(2) ? NULL : (LPCSTR) hb_parc(2),
(LPCSTR) hb_parc(1),
ISNIL(3) ? NULL : (LPCSTR) hb_parc(3),
ISNIL(4) ? "C:\\" : (LPCSTR) hb_parc(4),
ISNIL(5) ? 1 : hb_parni(5) ) ) ;
}
#pragma ENDDUMP


Testado com Fivewin, mas pode muito bem ser portado para o seu modo de programação ideal.


Bons usos.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...