FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Deshabilitar UAC del Windows
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Deshabilitar UAC del Windows
Posted: Tue Jun 10, 2014 03:16 PM
Buenos dias, como hago para Deshabilitar UAC del Windows? como en el ejemplo abajo:

Code (fw): Select all Collapse
#Include "FiveWin.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oBar

   DEFINE WINDOW oWnd TITLE "Deshabilitar UAC del Windows 7"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   // EnableLUA
   // 0-Desativar - deshabilitar
   // 1-Ativar    - activar
   DEFINE BUTTON OF oBar ACTION UACV( 1 )

   SET MESSAGE OF oWnd TO "Deshabilitar UAC del Windows 7" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

/ Para Windows Vista ou Seven a chave muda

FUNCTION UACV(nAtivar)
 *****************************************************
 * Grava o registro do aplicativo 
 *****************************************************
 LOCAL cRunName, cRunKey, cRegKey

 // EnableLUA
 // 0-Desativar
 // 1-Ativar

 cRegValue:= nAtivar

 cRegKey := "SOFTWARE\Microsoft\Security Center"

 cRegRoot := HKEY_LOCAL_MACHINE

 SETREGVAR( cRegRoot, cRegKey, "UACDisableNotify", cRegValue )

RETURN 0

/*
// para Windows XP

FUNCTION UAC(nAtivar)

   *****************************************************
   * Grava o registro do aplicativo
   *****************************************************
   LOCAL cRunName, cRunKey, cRegKey
   // EnableLUA
   // 0-Desativar
   // 1-Ativar
   cRegValue:= nAtivar
   cRegKey := "Software\Microsoft\Windows\CurrentVersion\Policies\System"
   cRegRoot := HKEY_LOCAL_MACHINE
   SETREGVAR( cRegRoot, cRegKey, "EnableLUA", cRegValue )

 RETURN 0
*/

FUNCTION SETREGVAR(nKey, cRegKey, cSubKey, uValue)

   LOCAL oReg, cValue
   nKey := IF(nKey == NIL, HKEY_CURRENT_USER, nKey)
   uValue := IF(uValue == NIL, "", uValue)
   oReg := TReg32():Create(nKey, cRegKey)
   cValue := oReg:Set(cSubKey, uValue)
   oReg:Close()

RETURN cValue


Gracias, saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Deshabilitar UAC del Windows
Posted: Tue Jun 10, 2014 08:09 PM

João,

Tu función está correctamente creando ese valor y asignándole el valor 1.

No llega a desactivarte el UAC ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Deshabilitar UAC del Windows
Posted: Tue Jun 10, 2014 08:20 PM
maestro, me genera este error:

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\FWH1306\samples\uac.exe (32 bits)
   Size: 2,412,032 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130422)
   FiveWin  Version: FWHX 13.05
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 10 secs 
   Error occurred at: 06/10/14, 17:18:18
   Error description: Error BASE/1003  Variable does not exist: HKEY_LOCAL_MACHINE

Stack Calls
===========
   Called from: UAC.prg => UACV( 40 )
   Called from: UAC.prg => (b)MAIN( 16 )
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Deshabilitar UAC del Windows
Posted: Wed Jun 11, 2014 07:51 AM

Joao,

define HKEY_LOCAL_MACHINE 2147483650

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Deshabilitar UAC del Windows
Posted: Wed Jun 11, 2014 01:40 PM
Maestro, no esta haciendo ningun efecto en windows 7, que puede estar errado?

Code (fw): Select all Collapse
#Include "FiveWin.ch"

#define HKEY_LOCAL_MACHINE 2147483650

STATIC oWnd

FUNCTION Main()

   LOCAL oBar

   DEFINE WINDOW oWnd TITLE "Deshabilitar UAC del Windows 7"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   // EnableLUA
   // 0-Desativar - deshabilitar
   // 1-Ativar    - activar
   DEFINE BUTTON OF oBar ACTION UACV( 0 )

   SET MESSAGE OF oWnd TO "Deshabilitar UAC del Windows 7" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

// Para Windows Vista ou Seven a chave muda

FUNCTION UACV(nAtivar)

   *****************************************************
   * Grava o registro do aplicativo
   *****************************************************
   LOCAL cRunName, cRunKey, cRegKey

   // EnableLUA
   // 0-Desativar
   // 1-Ativar

   cRegValue:= nAtivar

   cRegKey := "SOFTWARE\Microsoft\Security Center"

   cRegRoot := HKEY_LOCAL_MACHINE

   SETREGVAR( cRegRoot, cRegKey, "UACDisableNotify", cRegValue )

RETURN 0

/*
// para Windows XP

FUNCTION UAC(nAtivar)

   *****************************************************
   * Grava o registro do aplicativo
   *****************************************************
   LOCAL cRunName, cRunKey, cRegKey

   // EnableLUA
   // 0-Desativar
   // 1-Ativar

   cRegValue:= nAtivar

   cRegKey := "Software\Microsoft\Windows\CurrentVersion\Policies\System"

   cRegRoot := HKEY_LOCAL_MACHINE

   SETREGVAR( cRegRoot, cRegKey, "EnableLUA", cRegValue )

RETURN 0
*/

FUNCTION SETREGVAR(nKey, cRegKey, cSubKey, uValue)

   LOCAL oReg, cValue

   nKey := IF(nKey == NIL, HKEY_CURRENT_USER, nKey)

   uValue := IF(uValue == NIL, "", uValue)

   oReg := TReg32():Create(nKey, cRegKey)

   cValue := oReg:Set(cSubKey, uValue)

   ? cValue, cRegKey

   oReg:Close()

RETURN cValue

/*
// Windows server

<!-- m --><a class="postlink" href="http://social.technet.microsoft.com/Forums/windowsserver/en-US/0aeac9d8-3591-4294-b13e-825705b27730/how-to-disable-uac?forum=winserversecurity">http://social.technet.microsoft.com/For ... ersecurity</a><!-- m -->
*/


Regards, saludos

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Deshabilitar UAC del Windows
Posted: Wed Jun 11, 2014 05:00 PM
Joao,

Aqui se comentá tu solución pero tambien dan otras indicaciones, igual puede servirte:

http://www.vistax64.com/vista-security/37180-user-account-control.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 581
Joined: Tue Oct 11, 2005 11:28 AM
Re: Deshabilitar UAC del Windows
Posted: Wed Jun 11, 2014 05:02 PM

Kapi,

Estas executando o EXE em modo Administrador?

Kleyber Derick



FWH / xHb / xDevStudio / SQLLIB
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Deshabilitar UAC del Windows
Posted: Wed Jun 11, 2014 05:14 PM
Kleyber wrote:Kapi,

Estas executando o EXE em modo Administrador?


Sim kleyber, não faz nenhum efeito. E a intenção é que não me peça administrador. pois quero executar um programa que pede administrador, entende?

obg. abs.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion