Jump to content
Fivewin Brasil

Function DBINFO()


kapiaba

Recommended Posts

Galera avançada, dá para me dar uma explicação geral aqui nestas funções?


DBINFO()




DBORDERINFO()




dbinfo.ch




Veja o porquê da pergunta:




Não entendi o que faz a função que o Liñares postou.


Obg. abs.

Link to comment
Share on other sites

Para aquellos de vosotros que aún tengais este problema de lentitud, aqui teneis una función muy simple que puede ayudar mucho:




function TurnShared( lOnOff )

return dbInfo( DBI_SHARED, lOnOff )



ó simplemente llamar a dbInfo( DBI_SHARED, .F. )


Os agradezco vuestros comentarios con los resultados de esta función. Su comportamiento es similar a cmxShared()

regards, saludos


Antonio Linares

www.fivetechsoft.com

Link to comment
Share on other sites

Função para desativar o SMB, by Rafa Carmona -> rafa.thefull@gmail.com



#define HKEY_LOCAL_MACHINE 2147483650

//---------------------------------------------------------------------------//

function SmbOff()

LOCAL oReg, cName, uVar

oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" )

// Call Set with an empty string to access the default key

oReg:Set( "FileInfoCacheLifetime", 0 )
oReg:Set( "FileNotFoundCacheLifetime", 0 )
oReg:Set( "DirectoryCacheLifetime", 0 )

oReg:Close()

oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" )

// Call Set with an empty string to access the default key

oReg:Set( "Smb2", 0 )

oReg:Close()

Alert( "Windows registry updated!" )

return nil




Quem puder testar e reportar, eu agradeço. abs.

Link to comment
Share on other sites

Função nativa do harbour, não sei se funciona em xHarbour:



FUNCTION win_osNetRegOk( lSetIt, lDoVista )


LOCAL bRetVal := .T.
LOCAL cKeySrv
LOCAL cKeyWks


hb_default( @lSetIt, .F. )
hb_default( @lDoVista, .T. )


IF ! lDoVista .AND. hb_osIsWinVista()
/* do nothing */
ELSEIF hb_osIsWin9x()
bRetVal := win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt )
ELSE
cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters"
cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters"


IF lSetIt
lSetIt := ! hb_osIsWinNT() .OR. wapi_IsUserAnAdmin()
ENDIF


/* Server settings */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt )


IF hb_osIsWinVista()
/* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt )
ENDIF


/* Workstation settings */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )


IF hb_osIsWinVista()
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileInfoCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileNotFoundCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "DirectoryCacheLifetime", 0, lSetIt )
ENDIF


IF hb_osIsWin2K()
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
ENDIF
ENDIF


RETURN bRetVal





abs,

Link to comment
Share on other sites

Para uma maquina Windows, acessar dados em um Servido LINUX, é preciso estar com o samba rodando e startado pelo smb.conf

Tipo assim, uma rede de maquinas Windows devem estar no mesmo grupo de trabalho para que o desempenho seja satisfatório.

O samba ativo e rodando, o servidor Linux será visto na rede Windows.

Alguns parâmetros devem ser analisados e colocados em pratica no LINUX.

Se tudo estiver correto, a rede Linux/Windows é imbatível.

Outra coisa, apesar de Linux Desck poder ativar o Samba, isto nunca é aconselhável , recomenda-se instalar Linux SERVER,

pelo mesmo princípio que se usa Windows Server.

Link to comment
Share on other sites

Para uma maquina Windows, acessar dados em um Servido LINUX, é preciso estar com o samba rodando e startado pelo smb.conf

Tipo assim, uma rede de maquinas Windows devem estar no mesmo grupo de trabalho para que o desempenho seja satisfatório.

O samba ativo e rodando, o servidor Linux será visto na rede Windows.

Alguns parâmetros devem ser analisados e colocados em pratica no LINUX.

Se tudo estiver correto, a rede Linux/Windows é imbatível.

Outra coisa, apesar de Linux Desck poder ativar o Samba, isto nunca é aconselhável , recomenda-se instalar Linux SERVER,

pelo mesmo princípio que se usa Windows Server.

Obrigado Sérgio, vou passar esta informação para a área técnica.

Link to comment
Share on other sites

Sinceramente, não entendi porque o Liñares disse que esta função, aumenta a velocidade de abertura dos bancos de dados??


Ou estou fazendo algo errado?




#include "FiveWin.ch"
#include "DbInfo.ch"

ANNOUNCE RDDSYS
REQUEST DBFCDX, DBFFPT
ANNOUNCE FPTCDX

STATIC lOnOff := .F.

FUNCTION MAIN()

RDDSETDEFAULT("DBFCDX")

USE TEST //HAS NO MEMO FIELD
INDEX ON Field->ONE TO TEST
CLOSE DATABASES

USE TEST INDEX TEST ALIAS TEST SHARED NEW

? DBInfo( DBI_FILEHANDLE ) //OK

? DBInfo( DBI_MEMOHANDLE ) //HANGS HERE

// ? "OK"

IF TurnShared( lOnOff ) // se Shared = Retorna .T.
? [Shared]
ELSE // Retorna .F.
? [Not Shared]
ENDIF

QUIT

RETURN NIL

function TurnShared( lOnOff )

return dbInfo( DBI_SHARED, lOnOff )




Abs,

Link to comment
Share on other sites

Alguém me ajuda aqui, com windows 7 e windows 8?



#include "FiveWin.ch"

function Main()

If !WIN_OSNETREGOK() //Precisa direitos ADM

If !WIN_OSNETREGOK(.t.,.t.) //primeiro .t. é para ajustar XP/W98..., o segundo ajusta no vista.

MsgInfo('Registro do windows não ajustado !')

EndIf

EndIf

RETURN NIL

#include "common.ch"
#include "directry.ch"

#define WIN_HKEY_LOCAL_MACHINE 0
#define WIN_HKEY_CLASSES_ROOT 1
#define WIN_HKEY_CURRENT_USER 2
#define WIN_HKEY_CURRENT_CONFIG 3
#define WIN_HKEY_LOCAL_MACHINE 4
#define WIN_HKEY_USERS 5

/* NOTE: To change any of these registry settings
Administrator rights are required by default in Windows. [vszakats] */

FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )

LOCAL bRetVal := .T.
LOCAL cKeySrv
LOCAL cKeyWks

IF ! ISLOGICAL( lSetIt )

lSetIt := .F.

ENDIF

IF ! ISLOGICAL( lDoVista )

lDoVista := .T.

ENDIF

IF ! lDoVista .AND. Os_IsWinVISTA() //win_osIsVistaOrUpper()
/* do nothing */
ELSEIF Os_IsWin9X() // hb_osIsWin9x()
bRetVal := QueryRegistry( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt )
ELSE
cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters"
cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters"

IF lSetIt
lSetIt := ! Os_IsWinNT() .OR. os_IsUserAnAdmin() //wapi_IsUserAnAdmin()
ENDIF

/* Server settings */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt )

IF Os_IsWinVISTA() // win_osIsVistaOrUpper()
/* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt )
ENDIF

/* Workstation settings */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )

IF Os_IsWinVISTA() //win_osIsVistaOrUpper()

bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileInfoCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileNotFoundCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "DirectoryCacheLifetime", 0, lSetIt )

ENDIF

IF Os_IsWinNT() //hb_osIsWin2K()

bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )

ENDIF

// Gracias Lucas, mi duda major és aqui:
IF Os_IsWin7() //hb_osIsWin7()

bRetVal := bRetVal ... ??? Entende?

ENDIF

IF Os_IsWin8() //hb_osIsWin8()

ENDIF

ENDIF

RETURN bRetVal

FUNCTION WIN_OSNETVREDIROK( /* @ */ nResult )

LOCAL aFiles

nResult := 0

IF Os_IsWin9X() // hb_osIsWin9x()

aFiles := Directory( GetEnv( "WINDIR", "C:\WINDOWS" ) + "\SYSTEM\VREDIR.VXD" ) /* Check for faulty files. */

IF ! Empty( aFiles )

IF aFiles[ 1 ][ F_SIZE ] == 156749 .AND. aFiles[ 1 ][ F_TIME ] == "11:11:10"

nResult := 1111

ELSEIF aFiles[ 1 ][ F_SIZE ] == 140343 .AND. aFiles[ 1 ][ F_TIME ] == "09:50:00"

nResult := 950

ENDIF

ENDIF

ENDIF

RETURN Empty( nResult )

#pragma BEGINDUMP

#include <windows.h>

HB_FUNC( OS_ISUSERANADMIN )
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid( &NtAuthority, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup );
if( b )
{
if ( !CheckTokenMembership( NULL, AdministratorsGroup, &b ) )
b = FALSE;
FreeSid( AdministratorsGroup );
}

hb_retl( b );
}

#pragma ENDDUMP


Link to comment
Share on other sites

  • 9 months later...

Realmente em algumas redes não acontece nada...mas por exemplo em minha rede melhorou, em uma rede de cliente nada aconteceu....eu outro cliente todas formatadas começando do zero lá resolveu...então não consegui fazer referencia sobre isso...não sei explicar o motivo...em algumas redes o trem deixa mais rápido e em outras não...talvez seja windows...rsrs

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...