Analitcs

Pesquisar no conteúdo do blog.atlabs.com.br

quinta-feira, 31 de julho de 2014

DELPHI - FireMonkey - ExtractFilePath(Application.ExeName) = ??!

Reações: 


//Não é tudo do delphi que é igual ao FireMonkey, mas agente vai fazendo parecido...

ExtractFilePath(Application.ExeName); // Delphi

System.SysUtils.ExtractFilePath(ParamStr(0)); // FireMonkey

//Logo:

Application.ExeName; // Delphi

ParamStr(0); // FireMonkey

domingo, 27 de julho de 2014

DELPHI - Android / iOS /OSx - Application.ProcessMessages;

Reações: 


//Sua Aplicação Android / iOS / OSx está Travando?

//Verifique se tem algum Application.ProcessMessages;

//Se tiver coloque as diretivas para não executa-lo:

{$IF NOT (DEFINED (ANDROID) AND DEFINED (IOS) AND DEFINED (MACOS) AND DEFINED (MACOS32))}

Application.ProcessMessages;

{$ENDIF}

//Seguinte...

//Testei em Android, e estou levando pela mesma lógica do MacOS, caso não necessite, ela ficaria assim:

//Porque no android trava...

{$IF NOT (DEFINED (ANDROID))}

Application.ProcessMessages;

{$ENDIF}

DELPHI - Lista de diretivas de compilação - Conditional Compilation Delphi

Reações: 


Retirado do site:

http://docwiki.embarcadero.com/RADStudio/XE6/en/Conditional_compilation_%28Delphi%29

Predefined Conditionals

The following standard conditional symbols are defined:

Category Symbol DCC32   DCC64
  Since XE2  
  DCCOSX
  Since XE2  
  DCCIOSARM
  Since XE3  
  DCCIOS32
  Since XE3  
  DCCAARM
In XE5
Comments
Compiler DCC DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
VER270

For a list of compiler versions, see Compiler Versions.
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED For Delphi XE6, compiler version 27.0 has VER270 defined.
Platform CONSOLE DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED Defined if an application is being compiled as a console application.
IOS not defined not defined not defined DEFINED DEFINED N/A Defined if the target platform is iOS.
*New* at XE4/iOS
NATIVECODE DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED Since Delphi.Net
MSWINDOWS DEFINED DEFINED not defined not defined not defined not defined Indicates that the operating environment is Windows. Use MSWINDOWS to test for any flavor of the Windows platform instead of WIN32.
WIN32 DEFINED not defined not defined not defined not defined not defined Target platform is the native 32-bit Windows platform.
WIN64 not defined DEFINED not defined not defined not defined not defined Target platform is 64-bit Windows.
*New* at XE2/x64
MACOS not defined not defined DEFINED DEFINED DEFINED not defined Target platform is Mac OS X.
*New* at XE2/OSX
MACOS32 not defined not defined DEFINED DEFINED DEFINED not defined Target platform is 32-bit Mac OS X.
*New* at XE2/OSX
LINUX not defined not defined not defined not defined not defined not defined Since Kylix
LINUX32 not defined not defined not defined not defined not defined not defined Since Kylix
POSIX not defined not defined DEFINED DEFINED DEFINED DEFINED Since Kylix
POSIX32 not defined not defined DEFINED DEFINED DEFINED DEFINED Since Kylix
ANDROID not defined not defined not defined not defined not defined DEFINED Defined if the target platform is Android.
*New at XE5
CPU CPUARM not defined not defined not defined DEFINED not defined DEFINED Defined if the CPU is based on the ARM architecture, such as the Delphi mobile compiler for the iOS device (DCCIOSARM.EXE).
*New* at XE4/iOS
CPU386 DEFINED not defined DEFINED not defined DEFINED not defined Indicates that the CPU is an Intel 386 or later.
CPUX86 DEFINED not defined DEFINED not defined DEFINED not defined CPU is an Intel 386 or later on any platform.
*New* at XE2/x64
CPUX64 not defined DEFINED not defined not defined not defined not defined The CPU is in a 64-bit environment, such as DCC64.EXE.
*New* at XE2/x64
Availability
ALIGN_STACK not defined not defined DEFINED not defined DEFINED not defined Defined in code that may be shared with the OS X compiler and another compiler on another platform such as Linux that does not have a rigid stack alignment requirement. For more information, see Eli Boling's blog at http://blogs.embarcadero.com/eboling/2009/05/20/5607 .
*New* at XE2/OSX
ASSEMBLER DEFINED DEFINED DEFINED not defined DEFINED not defined Assembler syntax is accepted.
AUTOREFCOUNT not defined not defined not defined DEFINED DEFINED DEFINED Defined for compilers that use automatic reference counting, such as the Delphi mobile compilers.
*New* at XE4/iOS
EXTERNALLINKER not defined not defined not defined DEFINED not defined DEFINED Defined for compilers that have an external linker and the LLVM code generator; the Delphi mobile compilers have the external ld linker and use LLVM as code generator.
*New* at XE4/iOS
UNICODE DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED UNICODE is defined as the default string type.
CONDITIONALEXPRESSIONS DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED Tests for the use of the $IF directive.
ELF not defined not defined not defined +DEFINED+ not defined not defined Defined when targeting Executable and Linkable Format (ELF) files.
NEXTGEN not defined not defined not defined DEFINED DEFINED DEFINED Defined for compilers (such as the Delphi mobile compilers) that use "next-generation" language features, such as 0-based strings.
*New* at XE4/iOS
PC_MAPPED_EXCEPTIONS not defined not defined DEFINED not defined DEFINED not defined Defined when compiling on a platform or for a target platform that uses address maps instead of stack frames to unwind exceptions (such as OS X).
*New* at XE2.
PIC never never DEFINED if -P is specified never DEFINED if -P is specified always defined Defined for platforms that require Position-Independent Code (PIC), such as OS X.
UNDERSCOREIMPORTNAME DEFINED not defined DEFINED not defined DEFINED not defined Defined for compilers that add a leading underscore (for example, in names of dynamic libraries imported from Mac OS).
*New* at XE4/iOS
WEAKREF not defined not defined not defined DEFINED DEFINED DEFINED Defined for compilers that can use weak references (the [weak] attribute).
*New* at XE4/iOS
WEAKINSTREF not defined not defined not defined DEFINED DEFINED DEFINED Defined when weak references are defined for instances.
*New* at XE4/iOS
WEAKINTREF not defined not defined not defined DEFINED DEFINED DEFINED Defined when weak references are defined for interfaces.
*New* at XE4/iOS
In the table column heads:
  • DCC32 is the 32-bit Windows Delphi compiler.
  • DCC64 is the 64-bit Windows Delphi compiler.
  • DCCOSX is the Mac OS X Delphi compiler.
  • DCCIOSARM is the Delphi mobile compiler for iOS Devices.
  • DCCIOS32 is the Delphi mobile compiler for iOS Simulators.
  • DCCAARM.EXE is the Delphi mobile compiler for Android emulators and Android devices.

quarta-feira, 23 de julho de 2014

GERAL - Lista de Candidatos a Eleições 2014 - Brasil

Reações: 

Quer saber a ficha completa do seu candidato (Eleições 2014) para não reclamar depois?

Acesse:

http://inter01.tse.jus.br/divulga-cand-2014/eleicao/2014/UF/BR/candidatos/cargo/1


Nesse site você encontra toda a ficha de declaração de bens. E por ex. valores máximos para campanha eleitoral.

Ex dos Queridos Candidatos a Presidência (Limite de Gastos Para Campanha):

AÉCIO NEVES      R$ 290.000.000,00
DILMA            R$ 298.000.000,00
EDUARDO CAMPOS   R$ 150.000.000,00
EDUARDO JORGE    R$ 90.000.000,00
PASTOR EVERALDO  R$ 50.000.000,00
LEVY FIDELIX     R$ 12.000.000,00
ZÉ MARIA         R$ 400.000,00
EYMAEL           R$ 25.000.000,00
LUCIANA GENRO    R$ 900.000,00
MAURO IASI       R$ 300.000,00

                 _________________
TOTAL:           R$ 916.600.000,00

DELPHI - TAG ID3 - Informações do Mp3 - Get Mp3Information

Reações: 


type
 TID3Rec = record
  Tag     : array[0..2] of Char;
  Title,
  Artist,
  Comment,
  Album   : array[0..29] of Char;
  Year    : array[0..3] of Char;
  Genre   : Byte;
  private
   class procedure FillID3TagInformation(mp3File, Title, Artist, Album, Year,
      Genre, Comment: String); static;
end;
class procedure TID3Rec.FillID3TagInformation(mp3File, Title, Artist, Album,
  Year, Genre, Comment: String);
var ID3 : TID3Rec;
    fmp3: TFileStream;
begin
  fmp3:=TFileStream.Create(mp3File, fmOpenRead);
  try
    fmp3.position := fmp3.size - 128;
    fmp3.Read(ID3, SizeOf(ID3));
  finally
    fmp3.free;
  end;
  if ID3.Tag <> 'TAG' then
  begin
    Title   := '';
    Artist  := '';
    Album   := '';
    Year    := '';
    Genre   := '';
    Comment := '';
 end
 else
 begin
   Title    := ID3.Title;
   Artist   := ID3.Artist;
   Album    := ID3.Album;
   Year     := ID3.Year;
   Comment  := ID3.Comment;
 end;
end;
function FillID3TagInformation_Artist(mp3File: String): String;
var
    ID3 : TID3Rec;
    fmp3: TFileStream;
    AStorageRegistryData : Array of Byte;
    S : String;
    I, J, Start, Finish : Integer;
begin
  fmp3:=TFileStream.Create(mp3File, fmOpenRead);
  FillChar(ID3, SizeOf(ID3), #0);
  Setlength(AStorageRegistryData, SizeOf(ID3));
  try
    fmp3.position := fmp3.size - 128;
    fmp3.ReadBuffer(AStorageRegistryData[0], 128);
{    fmp3.position := fmp3.size - 128;
    fmp3.Read(ID3, SizeOf(ID3));}
  finally
    fmp3.free;
  end;
  for I := 0 to Length(ID3.Tag) -1 do
    ID3.Tag[I] := Chr(Byte(AStorageRegistryData[i]));
  J := 0;
  Start  := Length(ID3.Tag);
  Finish := Length(ID3.Tag) + Length(ID3.Title);
  for I := Start to Finish -1 do
  begin
    ID3.Title[J] := Chr(Byte(AStorageRegistryData[i]));
    Inc(J);
  end;
  J := 0;
  Start  := Length(ID3.Tag) + Length(ID3.Title);
  Finish := Length(ID3.Tag) + Length(ID3.Title) + Length(ID3.Artist);
  for I := Start to Finish -1 do
  begin
    ID3.Artist[J] := Chr(Byte(AStorageRegistryData[i]));
    Inc(J);
  end;
  if ID3.Tag <> 'TAG' then
    Result := ''
 else
   Result  := ID3.Artist;
end;

terça-feira, 22 de julho de 2014

WEB - Hospedagem de Sites Gratuita - Free Website Hosting

Reações: 




Na Hostinger você consegue hospedar seu site gratuitamente. E ainda pode criar vários servidores de hospedagem com a configuração abaixo.





  • 2000 MB de Espaço em Disco
  • 100 GB de Largura de Banda
  • 2 Bases de Dados MySQL
  • 2 Contas de E-mails
  • 2 Contas FTP
  • Creador de Sitios
  • Auto Instalador de Scripts


  • Tenho um site rodando de graça desde o dia 12/03/2014. Paguei somente o domínio na UOL para utilizar .com, mas se não quiser pagar nada, eles também tem registros de domínio gratuito.


    Segue Link: http://api.hostinger.com.br/redir/2817919

    Testado e funcionando em 22/07/2014.

    DELPHI - DbGridToListView (Db Grid To List View)

    Reações: 


    procedure DbGridToListView(ADataSet: TDataSet; ListView: TListView; GridList : TDBGridColumns);
    var
      Li   : TListItem;
      Ci   : TListColumn;
      I    : Integer;
      sListFields : TStringList;
    Const
      ESPACOS = '      ';
    begin
      if ADataSet = Nil then Exit;
      if ListView = Nil then Exit;
      if ADataSet.IsEmpty then
      begin
        ShowMessage('Registros não localizados.');
        Exit;
      end;
      try
        ADataSet.First;
        sListFields := TStringList.Create;
        try
          ListView.Columns.Clear;
          for I := 0 to GridList.Count - 1 do
          begin
            if  (GridList.Items[I].FieldName <> '')
            and (GridList.Items[I].Visible) then
            begin
              Ci                   := ListView.Columns.Add;
              if Ci.Index = 0 then
                Ci.Caption         := ESPACOS + GridList.Items[I].Title.Caption
              else
                Ci.Caption         := GridList.Items[I].Title.Caption;
              Ci.Width             := GridList.Items[I].Width + 4;
              Ci.Alignment         := GridList.Items[I].Title.Alignment;
              sListFields.Add(GridList.Items[I].FieldName);
            end;
          end;
          while not ADataSet.Eof do
          begin
            Li := ListView.Items.Add;
            Li.Caption := Trim(ADataSet.FieldByName(sListFields[0]).AsString);
            Li.Checked := True;
            for I := 1 to sListFields.Count - 1 do
              Li.SubItems.Add(Trim(ADataSet.FieldByName(sListFields[I]).AsString));
            ADataSet.Next;
          end;
        finally
          ADataSet.First;
          Sysutils.FreeAndNil(sListFields);
          Sysutils.FreeAndNil(sListKeys);
        end;
      except
        On Err : Exception do
        begin
          ShowMessage('Erro ao carregar lista de informações. ' + Err.Message);
        end;
      end;
    end;
    

    sábado, 19 de julho de 2014

    DELPHI - FireMonkey / Android - Forçar a criação de diretório ForceDirectories

    Reações: 


    // Testes executados no XE6 e Debug direto no Aparelho (MotoX)
    // Depois rodo no windows e melhoro a função, por hora é isso:
    function ForceDirectories(Dir: String): Boolean;
    var
      I        : Integer;
      DirsL    : TStringList;
      DirAtual : String;
      Local    : String;
    begin
      Result := False;
      try
        Result := DirectoryExists(Dir);
        if result then exit;
        DirsL := TStringList.Create;
        try
          DirsL.Text := StringReplace(Dir, System.SysUtils.PathDelim, FL_QUEBRA, [rfReplaceAll, rfIgnoreCase]);
    
          DirsL.Delete(0); // Diretorio raiz "/"
          {$IFNDEF ANDROID}
          Local := ExtractFileDrive(Dir);
          DirAtual := Local;
          {$ENDIF}
          for I := 0 to DirsL.Count -1 do
          begin
            DirAtual := DirAtual + System.SysUtils.PathDelim + DirsL[I];
            if (Trim(DirAtual) <> '') and (Not DirectoryExists(DirAtual)) then
            System.SysUtils.CreateDir(DirAtual);
          end;
          Result := DirectoryExists(Dir);
        finally
          System.SysUtils.FreeAndNil(DirsL);
        end;
      except
        Result := False;
      end;
    end;
    
    // em qual quer evento do seu gosto
        {$IFDEF ANDROID}
        Result := System.SysUtils.GetHomePath + AppName + System.SysUtils.PathDelim;
        {$ELSE}
        Result := System.SysUtils.ExtractFilePath(ParamStr(0));
        {$ENDIF} 
    
        if not ForceDirectories(Result) then
          ShowMessage('Não Criou o diretório');
    
    // Criei esta função pois a do delphi "System.SysUtils.ForceDirectories" não funcionou comigo.
    

    segunda-feira, 14 de julho de 2014

    DELPHI - Erro ao conectar no banco sqlite - Failed: "Sqlite3.dll not found"

    Reações: 


    Este erro estava acontecendo no delphi XE5 e 6 após tentar conectar num banco SQLITE.




    Baixei a DLL em questão de vários lugares da internet e coloquei na pasta C:\Windows\System32\ para tentar resolver o problema, mas não consegui, o erro persiste.


    Pesquisei no meu computador se alguma das aplicações instalada tinha essa DLL e encontrei. Realizei a cópia para System32 e SysWOW64 e obtive sucesso.



    sábado, 12 de julho de 2014

    WINDOWS - Verificando situação dos HDS

    Reações: 

    Se você é precavido como eu e tem os discos de backup espelhados (Raid ou via SO) , eu gosto de sempre monitora-los:

    Comando para abertura direta do atalho de informação de discos do sistema:

    C:\Windows\System32\diskmgmt.msc


    sexta-feira, 11 de julho de 2014

    DOWNLOAD - VMWare Player 5.0 (5.0.0-812388)

    Reações: 

    Site Oficial: http://www.vmware.com ou http://www.vmware.com/br/

    Virtualização de maquinas de trabalhos


    Link Para Download aq1ui do blog:
    http://www.atlabs.com.br/download/vm/vmware/VMware-player-5.0.0-812388.exe

    Video aula para como usar:
    Parte 01
    https://www.youtube.com/watch?v=UvsornpYXcY

    Parte 02
    https://www.youtube.com/watch?v=eOUielx4Uiw

    Parce 03
    https://www.youtube.com/watch?v=hHn4NdbyAqg

    Parte 04
    https://www.youtube.com/watch?v=b4cJqKHgEBg



    Recomendado para trabalhar:
    Site Oficial do Ubuntu - Linux (br)
    http://ubuntu-br.org/

    Link para download da ISO (imagem de Disco) para a instalação
    http://releases.ubuntu.com/trusty/ubuntu-14.04-desktop-amd64.iso

    quinta-feira, 3 de julho de 2014

    DELPHI - IPConfig via programação

    Reações: 


    // Retirado partes do projeto FreePascal
    // TESTADO EM DELPHI 6
    Download do demo:
    http://www.atlabs.com.br/download/pascal/IPCONFIG.rar
    /// DFM
    object Form1: TForm1
      Left = 192
      Top = 114
      Width = 726
      Height = 554
      Caption = 'Form1'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      FormStyle = fsStayOnTop
      OldCreateOrder = False
      Position = poScreenCenter
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Memo1: TMemo
        Left = 0
        Top = 0
        Width = 718
        Height = 520
        Align = alClient
        Color = clBlack
        Font.Charset = OEM_CHARSET
        Font.Color = clSilver
        Font.Height = -16
        Font.Name = 'Terminal'
        Font.Style = []
        ParentFont = False
        TabOrder = 0
      end
    end
    /// DFM
    /// PAS
    unit UIPCONFIG;
    interface
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
      Const
        MIB_IF_TYPE_OTHER = 1;
        MIB_IF_TYPE_ETHERNET = 6;
        IF_TYPE_ISO88025_TOKENRING = 9;
        MIB_IF_TYPE_TOKENRING = 9;
        MIB_IF_TYPE_PPP = 23;
        MIB_IF_TYPE_LOOPBACK = 24;
        MIB_IF_TYPE_SLIP = 28;
        IF_TYPE_IEEE80211 = 71;
        MIB_IF_TYPE_FDDI = 15;
        MAX_ADAPTER_DESCRIPTION_LENGTH = 128; // arb.
        MAX_ADAPTER_NAME_LENGTH        = 256; // arb.
        MAX_ADAPTER_ADDRESS_LENGTH     = 8; // arb.
        DEFAULT_MINIMUM_ENTITIES       = 32; // arb.
        MAX_HOSTNAME_LEN               = 128; // arb.
        MAX_DOMAIN_NAME_LEN            = 128; // arb.
        MAX_SCOPE_ID_LEN               = 256; // arb.
        _SS_MAXSIZE   = 128;               // Maximum size.
        _SS_ALIGNSIZE = SizeOf(Int64);  // Desired alignment.
        _SS_PAD1SIZE = _SS_ALIGNSIZE - SizeOf(short);
        _SS_PAD2SIZE = _SS_MAXSIZE - (SizeOf(short) + _SS_PAD1SIZE + _SS_ALIGNSIZE);
        iphlpapilib = 'iphlpapi.dll';
      type
        time_t = Longint;
        ULONGLONG = Int64;
        u_short = Word;
        sockaddr_storage = record
          ss_family: short;               // Address family.
          __ss_pad1: array [0.._SS_PAD1SIZE - 1] of char;  // 6 byte pad, this is to make
                                         // implementation specific pad up to
                                         // alignment field that follows explicit
                                         // in the data structure.
          __ss_align: Int64;            // Field to force desired structure.
          __ss_pad2: array [0.._SS_PAD2SIZE - 1] of char;  // 112 byte pad to achieve desired size;
                                         // _SS_MAXSIZE value minus size of
                                         // ss_family, __ss_pad1, and
                                         // __ss_align fields is 112.
        end;
        {$EXTERNALSYM sockaddr_storage}
        TSockAddrStorage = sockaddr_storage;
        PSockAddrStorage = ^sockaddr_storage;
        sockaddr = record
          sa_family: u_short;              // address family
          sa_data: array [0..13] of Char;            // up to 14 bytes of direct address
        end;
        {$EXTERNALSYM sockaddr}
        TSockAddr = sockaddr;
        PSockAddr = ^sockaddr;
        LPSOCKADDR = ^sockaddr;
        PSOCKADDR_STORAGE = ^sockaddr_storage;
        LPSOCKADDR_STORAGE = ^sockaddr_storage;
        LPSOCKET_ADDRESS = ^SOCKET_ADDRESS;
        PSOCKET_ADDRESS = ^SOCKET_ADDRESS;
        _SOCKET_ADDRESS = record
          lpSockaddr: LPSOCKADDR;
          iSockaddrLength: Integer;
        end;
        {$EXTERNALSYM _SOCKET_ADDRESS}
        SOCKET_ADDRESS = _SOCKET_ADDRESS;
        {$EXTERNALSYM SOCKET_ADDRESS}
        TSocketAddress = SOCKET_ADDRESS;
        PSocketAddress = PSOCKET_ADDRESS;
      //
      // CSAddr Information
      //
        LPCSADDR_INFO = ^CSADDR_INFO;
        {$EXTERNALSYM LPCSADDR_INFO}
        PCSADDR_INFO = ^CSADDR_INFO;
        {$EXTERNALSYM PCSADDR_INFO}
        _CSADDR_INFO = record
          LocalAddr: SOCKET_ADDRESS;
          RemoteAddr: SOCKET_ADDRESS;
          iSocketType: Integer;
          iProtocol: Integer;
        end;
        {$EXTERNALSYM _CSADDR_INFO}
        CSADDR_INFO = _CSADDR_INFO;
        {$EXTERNALSYM CSADDR_INFO}
        TCsAddrInfo = CSADDR_INFO;
        PCsAddrInfo = PCSADDR_INFO;
      //
      // Address list returned via SIO_ADDRESS_LIST_QUERY
      //
        LPSOCKET_ADDRESS_LIST = ^SOCKET_ADDRESS_LIST;
        {$EXTERNALSYM LPSOCKET_ADDRESS_LIST}
        _SOCKET_ADDRESS_LIST = record
          iAddressCount: Integer;
          Address: array [0..0] of SOCKET_ADDRESS;
        end;
        {$EXTERNALSYM _SOCKET_ADDRESS_LIST}
        SOCKET_ADDRESS_LIST = _SOCKET_ADDRESS_LIST;
        {$EXTERNALSYM SOCKET_ADDRESS_LIST}
        TSocketAddressList = SOCKET_ADDRESS_LIST;
        PSocketAddressList = LPSOCKET_ADDRESS_LIST;
      //
      //  Address Family/Protocol Tuples
      //
        LPAFPROTOCOLS = ^AFPROTOCOLS;
        {$EXTERNALSYM LPAFPROTOCOLS}
        PAFPROTOCOLS = ^AFPROTOCOLS;
        {$EXTERNALSYM PAFPROTOCOLS}
        _AFPROTOCOLS = record
          iAddressFamily: Integer;
          iProtocol: Integer;
        end;
        {$EXTERNALSYM _AFPROTOCOLS}
        AFPROTOCOLS = _AFPROTOCOLS;
        {$EXTERNALSYM AFPROTOCOLS}
        TAfProtocols = AFPROTOCOLS;
        PIP_MASK_STRING = ^IP_MASK_STRING;
        {$EXTERNALSYM PIP_MASK_STRING}
        IP_ADDRESS_STRING = record
          S: array [0..15] of Char;
        end;
        {$EXTERNALSYM IP_ADDRESS_STRING}
        PIP_ADDRESS_STRING = ^IP_ADDRESS_STRING;
        {$EXTERNALSYM PIP_ADDRESS_STRING}
        IP_MASK_STRING = IP_ADDRESS_STRING;
        {$EXTERNALSYM IP_MASK_STRING}
        TIpAddressString = IP_ADDRESS_STRING;
        PIpAddressString = PIP_MASK_STRING;
      //
      // IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
      // both as dotted decimal strings
      //
        PIP_ADDR_STRING = ^IP_ADDR_STRING;
        {$EXTERNALSYM PIP_ADDR_STRING}
        _IP_ADDR_STRING = record
          Next: PIP_ADDR_STRING;
          IpAddress: IP_ADDRESS_STRING;
          IpMask: IP_MASK_STRING;
          Context: DWORD;
        end;
        {$EXTERNALSYM _IP_ADDR_STRING}
        IP_ADDR_STRING = _IP_ADDR_STRING;
        {$EXTERNALSYM IP_ADDR_STRING}
        TIpAddrString = IP_ADDR_STRING;
        PIpAddrString = PIP_ADDR_STRING;
      //
      // ADAPTER_INFO - per-adapter information. All IP addresses are stored as
      // strings
      //
        PIP_ADAPTER_INFO = ^IP_ADAPTER_INFO;
        {$EXTERNALSYM PIP_ADAPTER_INFO}
        _IP_ADAPTER_INFO = record
          Next: PIP_ADAPTER_INFO;
          ComboIndex: DWORD;
          AdapterName: array [0..MAX_ADAPTER_NAME_LENGTH + 3] of Char;
          Description: array [0..MAX_ADAPTER_DESCRIPTION_LENGTH + 3] of Char;
          AddressLength: UINT;
          Address: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1] of BYTE;
          Index: DWORD;
          Type_: UINT;
          DhcpEnabled: UINT;
          CurrentIpAddress: PIP_ADDR_STRING;
          IpAddressList: IP_ADDR_STRING;
          GatewayList: IP_ADDR_STRING;
          DhcpServer: IP_ADDR_STRING;
          HaveWins: BOOL;
          PrimaryWinsServer: IP_ADDR_STRING;
          SecondaryWinsServer: IP_ADDR_STRING;
          LeaseObtained: time_t;
          LeaseExpires: time_t;
        end;
        {$EXTERNALSYM _IP_ADAPTER_INFO}
        IP_ADAPTER_INFO = _IP_ADAPTER_INFO;
        {$EXTERNALSYM IP_ADAPTER_INFO}
        TIpAdapterInfo = IP_ADAPTER_INFO;
        PIpAdapterInfo = PIP_ADAPTER_INFO;
      //
      // The following types require Winsock2.
      //
        IP_PREFIX_ORIGIN = (
          IpPrefixOriginOther,
          IpPrefixOriginManual,
          IpPrefixOriginWellKnown,
          IpPrefixOriginDhcp,
          IpPrefixOriginRouterAdvertisement);
        {$EXTERNALSYM IP_PREFIX_ORIGIN}
        TIpPrefixOrigin = IP_PREFIX_ORIGIN;
        IP_SUFFIX_ORIGIN = (
          IpSuffixOriginOther,
          IpSuffixOriginManual,
          IpSuffixOriginWellKnown,
          IpSuffixOriginDhcp,
          IpSuffixOriginLinkLayerAddress,
          IpSuffixOriginRandom);
        {$EXTERNALSYM IP_SUFFIX_ORIGIN}
        TIpSuffixOrigin = IP_SUFFIX_ORIGIN;
        IP_DAD_STATE = (
          IpDadStateInvalid,
          IpDadStateTentative,
          IpDadStateDuplicate,
          IpDadStateDeprecated,
          IpDadStatePreferred);
        {$EXTERNALSYM IP_DAD_STATE}
        TIpDadState = IP_DAD_STATE;
        PIP_ADAPTER_UNICAST_ADDRESS = ^_IP_ADAPTER_UNICAST_ADDRESS;
        {$EXTERNALSYM PIP_ADAPTER_UNICAST_ADDRESS}
        _IP_ADAPTER_UNICAST_ADDRESS = record
          Union: record
            case Integer of
              0: (
                Alignment: ULONGLONG);
              1: (
                Length: ULONG;
                Flags: DWORD);
            end;
          Next: PIP_ADAPTER_UNICAST_ADDRESS;
          Address: SOCKET_ADDRESS;
          PrefixOrigin: IP_PREFIX_ORIGIN;
          SuffixOrigin: IP_SUFFIX_ORIGIN;
          DadState: IP_DAD_STATE;
          ValidLifetime: ULONG;
          PreferredLifetime: ULONG;
          LeaseLifetime: ULONG;
          end;
        {$EXTERNALSYM _IP_ADAPTER_UNICAST_ADDRESS}
        IP_ADAPTER_UNICAST_ADDRESS = _IP_ADAPTER_UNICAST_ADDRESS;
        {$EXTERNALSYM IP_ADAPTER_UNICAST_ADDRESS}
        TIpAdapterUnicastAddress = IP_ADAPTER_UNICAST_ADDRESS;
        PIpAdapterUnicastAddress = PIP_ADAPTER_UNICAST_ADDRESS;
        PIP_ADAPTER_ANYCAST_ADDRESS = ^_IP_ADAPTER_ANYCAST_ADDRESS;
        {$EXTERNALSYM PIP_ADAPTER_ANYCAST_ADDRESS}
        _IP_ADAPTER_ANYCAST_ADDRESS = record
          Union: record
            case Integer of
              0: (
                Alignment: ULONGLONG);
              1: (
                Length: ULONG;
                Flags: DWORD);
            end;
          Next: PIP_ADAPTER_ANYCAST_ADDRESS;
          Address: SOCKET_ADDRESS;
          end;
        {$EXTERNALSYM _IP_ADAPTER_ANYCAST_ADDRESS}
        IP_ADAPTER_ANYCAST_ADDRESS = _IP_ADAPTER_ANYCAST_ADDRESS;
        {$EXTERNALSYM IP_ADAPTER_ANYCAST_ADDRESS}
        TIpAdapterAnycaseAddress = IP_ADAPTER_ANYCAST_ADDRESS;
        PIpAdapterAnycaseAddress = PIP_ADAPTER_ANYCAST_ADDRESS;
        PIP_ADAPTER_MULTICAST_ADDRESS = ^_IP_ADAPTER_MULTICAST_ADDRESS;
        {$EXTERNALSYM PIP_ADAPTER_MULTICAST_ADDRESS}
        _IP_ADAPTER_MULTICAST_ADDRESS = record
          Union: record
            case Integer of
              0: (
                Alignment: ULONGLONG);
              1: (
                Length: ULONG;
                Flags: DWORD);
            end;
          Next: PIP_ADAPTER_MULTICAST_ADDRESS;
          Address: SOCKET_ADDRESS;
          end;
        {$EXTERNALSYM _IP_ADAPTER_MULTICAST_ADDRESS}
        IP_ADAPTER_MULTICAST_ADDRESS = _IP_ADAPTER_MULTICAST_ADDRESS;
        TIpAdapterMulticastAddress = IP_ADAPTER_MULTICAST_ADDRESS;
        PIpAdapterMulticastAddress = PIP_ADAPTER_MULTICAST_ADDRESS;
      PFIXED_INFO = ^FIXED_INFO;
      {$EXTERNALSYM PFIXED_INFO}
      FIXED_INFO = record
        HostName: array [0..MAX_HOSTNAME_LEN + 3] of Char;
        DomainName: array[0..MAX_DOMAIN_NAME_LEN + 3] of Char;
        CurrentDnsServer: PIP_ADDR_STRING;
        DnsServerList: IP_ADDR_STRING;
        NodeType: UINT;
        ScopeId: array [0..MAX_SCOPE_ID_LEN + 3] of Char;
        EnableRouting: UINT;
        EnableProxy: UINT;
        EnableDns: UINT;
      end;
      {$EXTERNALSYM FIXED_INFO}
      TFixedInfo = FIXED_INFO;
      PFixedInfo = PFIXED_INFO;
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
      function GetNetworkParams(pFixedInfo: PFIXED_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
      function GetNetworkParams; external iphlpapilib name 'GetNetworkParams';
      function GetAdaptersInfo(pAdapterInfo: PIP_ADAPTER_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
      function GetAdaptersInfo; external iphlpapilib name 'GetAdaptersInfo';
    var
      Form1: TForm1;
    implementation
    {$R *.dfm}
    function GetAdaterTypeName(Type_:Uint):string;
    begin
      case Type_ of
        MIB_IF_TYPE_ETHERNET: begin
          result:='Ethernet adapter';
        end;
        MIB_IF_TYPE_TOKENRING: begin
          result:='Token Ring adapter';
        end;
        MIB_IF_TYPE_FDDI: begin
          result:='FDDI adapter';
        end;
        MIB_IF_TYPE_PPP: begin
          result:='PPP adapter';
        end;
        MIB_IF_TYPE_LOOPBACK: begin
          result:='Loopback adapter';
        end;
        MIB_IF_TYPE_SLIP: begin
          result:='Slip adapter';
        end;
        else begin
          result:='Unknow Adapter type';
        end;
      end; // case
    end;
    function GetNodeTypeName(Type_:Uint):string;
    begin
      case Type_ of
        1: result:='Broadcast';
        2: result:='Peer to peer';
        4: result:='Mixed';
        8: result:='Hybrid';
        else begin
          result:='Unknown';
        end;
      end; // case
    end;
    function FormatMAC(pAdapt:PIP_ADAPTER_INFO):string;
    var
      i:Integer;
    begin
      result:='';
      for i:=0 to pAdapt^.AddressLength-1 do begin
        if (i = (pAdapt^.AddressLength - 1)) then begin
          result:=result+Format('%.2X', [Integer(pAdapt^.Address[i])]);
        end else begin
          result:=result+Format('%.2X-', [Integer(pAdapt^.Address[i])]);
        end;
      end; // for
    end;
    function B2S(b:Boolean):String;
    begin
      if b then result:='Yes' else result:='No';
    end;
    Procedure IPConfig(Target:TStrings);
    var
      Err:DWORD;
      pFixedInfo:PFIXED_INFO;
      FixedInfoSize:DWORD;
      pAdapterInfo, pAdapt:PIP_ADAPTER_INFO ;
      AdapterInfoSize:DWORD;
      pAddrStr:PIP_ADDR_STRING;
    begin
      // Get the main IP configuration information for this machine using a FIXED_INFO structure
      Err := GetNetworkParams(NIL, FixedInfoSize);
      if (Err <> 0) then begin
        if (Err <> ERROR_BUFFER_OVERFLOW) then begin
          raise Exception.CreateFmt(
            'GetNetworkParams sizing failed with error %d',
            [Err]
          );
        end;
      end;
      // Allocate memory from sizing information
      pFixedInfo := PFIXED_INFO(GlobalAlloc(GPTR, FixedInfoSize));
      if not Assigned(pFixedInfo) then begin
        raise Exception.Create(
          'Memory allocation error'
        );
      end;
      Err := GetNetworkParams(pFixedInfo, FixedInfoSize);
      if (Err = 0) then begin
        Target.Add(Format('Host Name . . . . . . . . . : %s',
    [pFixedInfo^.HostName]));
        Target.Add(Format('DNS Servers . . . . . . . . : %s',
    [pFixedInfo^.DnsServerList.IpAddress.S]));
        pAddrStr := pFixedInfo^.DnsServerList.Next;
        while (pAddrStr<>NIL) do begin
          Target.Add(Format('%s', [pAddrStr^.IpAddress.S]));
          pAddrStr := pAddrStr^.Next;
        end;
        Target.Add('Node Type . . . . . . . . . : ' + GetNodeTypeName(pFixedInfo^.NodeType));
      end; // if
      //
      // Enumerate all of the adapter specific information using the IP_ADAPTER_INFO structure
      // Note:  IP_ADAPTER_INFO contains a linked list of adapter entries.
      //
      AdapterInfoSize := 0;
      Err := GetAdaptersInfo(NIL, AdapterInfoSize);
      if (Err <> 0) then begin
        if (Err <> ERROR_BUFFER_OVERFLOW) then begin
          raise Exception.CreateFmt(
            'GetAdaptersInfo sizing failed with error %d',
            [Err]
          );
        end;
      end;
      // Allocate memory from sizing information
      pAdapterInfo := PIP_ADAPTER_INFO(GlobalAlloc(GPTR, AdapterInfoSize));
      if not Assigned(pAdapterInfo) then begin
        raise Exception.Create(
          'Memory allocation error'
        );
      end;
      // Get actual adapter information
      Err := GetAdaptersInfo(pAdapterInfo, AdapterInfoSize);
      if (Err <> 0) then begin
        raise Exception.CreateFmt('GetAdaptersInfo failed with error %d', [Err]);
      end;
      pAdapt := pAdapterInfo;
    // loop adapters
      while (pAdapt<>NIL) do begin
        Target.Add(GetAdaterTypeName(pAdapt^.Type_));
        Target.Add(pAdapt^.AdapterName);
        Target.Add(Format('Description . . . . . . . . : %s', [pAdapt^.Description]));
        // MAC address
        Target.Add('Physical Addresses (MAC). . : ' + FormatMAC(pAdapt));
        Target.Add('DHCP Enabled. . . . . . . . : ' + B2S(pAdapt^.DhcpEnabled<>0));
        // list ip addresses
        pAddrStr := @pAdapt^.IpAddressList;
        while (pAddrStr<>NIL) do begin
          Target.Add('IP Address. . . . . . . . . : '+pAddrStr^.IpAddress.S);
          Target.Add('Subnet Mask . . . . . . . . : '+pAddrStr^.IpMask.S);
          pAddrStr := pAddrStr^.Next;
        end; // end
        // list gateways
        Target.Add('Default Gateway . . . . . . : '+pAdapt^.GatewayList.IpAddress.S);
        pAddrStr := pAdapt^.GatewayList.Next;
        while(pAddrStr <>NIL) do begin
          Target.Add(pAddrStr^.IpAddress.S);
          pAddrStr := pAddrStr^.Next;
        end; // while
        // DCHP
        Target.Add('DHCP Server . . . . . . . . : '+pAdapt^.DhcpServer.IpAddress.S);
        // WINS
        Target.Add('Primary WINS Server . . . . : '+pAdapt^.PrimaryWinsServer.IpAddress.S);
        Target.Add('Secondary WINS Server . . . : '+pAdapt^.SecondaryWinsServer.IpAddress.S);
        // next adapter
        pAdapt := pAdapt^.Next;
      end; // while
    end; // procedure
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      IPConfig(Memo1.Lines);
    end;
    end.
    /// PAS
    /// RESULTADO
    Host Name . . . . . . . . . : XP_VMWARE
    DNS Servers . . . . . . . . : 126.0.0.1
    Node Type . . . . . . . . . : Unknown
    Ethernet adapter
    {E375DA2C-1591-4A90-A1B5-A5039D3EC377}
    Description . . . . . . . . : VMware Accelerated AMD PCNet Adapter - Deterministic Network Enhancer Miniport
    Physical Addresses (MAC). . : 00-50-56-29-41-DB
    DHCP Enabled. . . . . . . . : Yes
    IP Address. . . . . . . . . : 126.0.0.161
    Subnet Mask . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . : 126.0.0.2
    DHCP Server . . . . . . . . : 126.0.0.1
    Primary WINS Server . . . . : 0.0.0.0
    Secondary WINS Server . . . : 0.0.0.0
    /// RESULTADO 
    

    DELPHI - Projetos Free (fpGUI / fptest / FreePascal / JEDI_jcl-2.4.1.4571 / Lazarus / OnGuard / Indy10.0.52 / DSiWin32)

    Reações: 

    Projetos Free (fpGUI / fptest / FreePascal / JEDI_jcl-2.4.1.4571 / Lazarus / OnGuard / Indy10.0.52 / DSiWin32)

    Retirados do site:


    https://github.com/graemeg


    Link para download direto (do blog) :

    http://www.atlabs.com.br/download/pascal/DSiWin32.pas
    http://gp.17slon.com/gp/dsiwin32.htm

    http://www.atlabs.com.br/download/pascal/fpGUI-master.zip
    http://fpgui.sourceforge.net/



    http://www.atlabs.com.br/download/pascal/fptest-master.zip
    Testing framework for the Object Pascal language using the Free Pascal compiler.



    http://www.atlabs.com.br/download/pascal/freepascal-master.zip
    http://www.freepascal.org/



    http://www.atlabs.com.br/download/pascal/indy10.0.52_source.zip
    http://www.indyproject.org/sockets/Download/index.en.aspx



    http://www.atlabs.com.br/download/pascal/JEDI_jcl-2.4.1.4571.zip
    http://sourceforge.net/projects/jcl/files/JCL%20Releases/JCL%202.4%20Build%204571/jcl-2.4.1.4571.zip/download 


    http://www.atlabs.com.br/download/pascal/JVCL348CompleteJCL26-Build5178.zip
    http://sourceforge.net/projects/jvcl/files/

    http://www.atlabs.com.br/download/pascal/lazarus-upstream.zip

    http://www.lazarus.freepascal.org/


    http://www.atlabs.com.br/download/pascal/onguard-master.zip
    http://wiki.freepascal.org/OnGuard

    terça-feira, 1 de julho de 2014

    DELPHI - FileSizeOnDisk - Tamanho do arquivo em disco

    Reações: 


    function GetClusterSize(Drive: String): integer;
    var
      SectorsPerCluster, BytesPerSector, dummy: Cardinal;
    begin
      SectorsPerCluster := 0;
      BytesPerSector := 0;
      GetDiskFreeSpace(PChar(Drive), SectorsPerCluster, BytesPerSector, dummy, dummy);
      Result := SectorsPerCluster * BytesPerSector;
    end;
    function FileSizeOnDisk (Drive: String; AFilename: string): Int64;
    var
      VolumeSerialNumber: DWORD;
      MaximumComponentLength: DWORD;
      FileSystemFlags: DWORD;
      HighSize: DWORD;
      FRec: TSearchRec;
      AClusterSize: integer;
      AFileSize, n: Int64;
    begin
      Result := 0;
      Drive := IncludeTrailingPathDelimiter(ExtractFileDrive(Drive));
      GetVolumeInformation( PChar(Drive), nil, 0, @VolumeSerialNumber,
        MaximumComponentLength, FileSystemFlags, nil, 0);
      if ((FileSystemFlags AND FILE_FILE_COMPRESSION) <> 0) AND
        ((FileSystemFlags AND (FILE_VOLUME_IS_COMPRESSED OR
        FILE_SUPPORTS_SPARSE_FILES)) <> 0) then
      begin // Compressed or Sparse disk
        Result := GetCompressedFileSize(PChar(AFilename), @HighSize);
        // Not sure if this is correct on a sparse disk ??
      end
      else
      begin
        if (System.SysUtils.FindFirst(AFilename, faAnyFile, FRec) = 0) then
        begin
          AFileSize := FRec.Size;
          AClusterSize := GetClusterSize(Drive);
          n := AFileSize mod AClusterSize;
          if n > 0 then // Round up to nearest cluster size
            Result := AFileSize + (AClusterSize - n)
          else
            Result := AFileSize;
          System.SysUtils.FindClose(FRec);
        end;
      end;
    end;
    

    DELPHI - GetClusterSize HardDisk

    Reações: 


    function GetClusterSize(Drive: String): integer;
    var
      SectorsPerCluster, BytesPerSector, dummy: Cardinal;
    begin
      SectorsPerCluster := 0;
      BytesPerSector := 0;
      GetDiskFreeSpace(PChar(Drive), SectorsPerCluster, BytesPerSector, dummy, dummy);
      Result := SectorsPerCluster * BytesPerSector;
    end;
    

    DELPHI - DSiWin32 - Unit com várias Funções legais

    Reações: 

    Retirado de:
    http://gp.17slon.com/gp/dsiwin32.htm

    Download da unit:
    http://www.atlabs.com.br/download/pascal/DSiWin32.pas

    Algumas Funções (até a data de postagem do blog)

      procedure DSiCloseHandleAndInvalidate(var handle: THandle);
    
      procedure DSiCloseHandleAndNull(var handle: THandle);
    
      function  DSiMsgWaitForThreeObjectsEx(obj0, obj1, obj2: THandle;
    
        timeout: DWORD; wakeMask: DWORD; flags: DWORD): DWORD;
    
      function  DSiMsgWaitForTwoObjectsEx(obj0, obj1: THandle; timeout: DWORD;
    
        wakeMask: DWORD; flags: DWORD): DWORD;
    
      function  DSiWaitForThreeObjects(obj0, obj1, obj2: THandle; waitAll: boolean;
    
        timeout: DWORD): DWORD;
    
      function  DSiWaitForThreeObjectsEx(obj0, obj1, obj2: THandle; waitAll: boolean;
    
        timeout: DWORD; alertable: boolean): DWORD;
    
      function  DSiWaitForTwoObjects(obj0, obj1: THandle; waitAll: boolean;
    
        timeout: DWORD): DWORD;
    
      function  DSiWaitForTwoObjectsEx(obj0, obj1: THandle; waitAll: boolean;
    
        timeout: DWORD; alertable: boolean): DWORD;
    
      function  DSiWin32CheckHandle(handle: THandle): THandle;
    
      function  DSiWin32CheckNullHandle(handle: THandle): THandle;
    
    { Registry }
    
      TDSiRegistry = class(TRegistry)
    
      public
    
        function  ReadBinary(const name: string; const defval: RawByteString): RawByteString; overload;
    
        function  ReadBinary(const name: string; dataStream: TStream): boolean; overload;
    
        function  ReadBool(const name: string; defval: boolean): boolean;
    
        function  ReadDate(const name: string; defval: TDateTime): TDateTime;
    
        function  ReadFont(const name: string; font: TFont): boolean;
    
        function  ReadInt64(const name: string; defval: int64): int64;
    
        function  ReadInteger(const name: string; defval: integer): integer;
    
        function  ReadString(const name, defval: string): string;
    
        procedure ReadStrings(const name: string; strings: TStrings);
    
        function  ReadVariant(const name: string; defval: variant): variant;
    
        procedure WriteBinary(const name: string; data: RawByteString); overload;
    
        procedure WriteBinary(const name: string; data: TStream); overload;
    
        procedure WriteFont(const name: string; font: TFont);
    
        procedure WriteInt64(const name: string; value: int64);
    
        procedure WriteStrings(const name: string; strings: TStrings);
    
        procedure WriteVariant(const name: string; value: variant);
    
      end; { TDSiRegistry }
    
      function DSiCreateRegistryKey(const registryKey: string;
    
        root: HKEY = HKEY_CURRENT_USER): boolean;
    
      function DSiDeleteRegistryValue(const registryKey, name: string; root: HKEY =
    
        HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean;
    
      function DSiKillRegistry(const registryKey: string;
    
        root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean;
    
      function DSiReadRegistry(const registryKey, name: string;
    
        defaultValue: Variant; root: HKEY = HKEY_CURRENT_USER;
    
        access: longword = KEY_QUERY_VALUE): Variant; overload;
    
      function DSiReadRegistry(const registryKey, name: string;
    
        defaultValue: int64; root: HKEY = HKEY_CURRENT_USER;
    
        access: longword = KEY_QUERY_VALUE): int64; overload;
    
      function DSiRegistryKeyExists(const registryKey: string;
    
        root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_QUERY_VALUE): boolean;
    
      function DSiRegistryValueExists(const registryKey, name: string;
    
        root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_QUERY_VALUE): boolean;
    
      function DSiWriteRegistry(const registryKey, name: string; value: int64;
    
        root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean; overload;
    
      function DSiWriteRegistry(const registryKey, name: string; value: Variant;
    
        root: HKEY = HKEY_CURRENT_USER; access: longword = KEY_SET_VALUE): boolean; overload;
    
    { Files }
    
    type
    
      TShFileOpFlag = (fofAllowUndo, fofFilesOnly, fofMultiDestFiles, fofNoConfirmation,
    
        fofNoConfirmMkDir, fofNoConnectedElements, fofNoErrorUI, fofNoRecursion,
    
        fofNoRecurseReparse, fofRenameOnCollision, fofSilent, fofSimpleProgress,
    
        fofWantMappingHandle, fofWantNukeWarning, fofNoUI);
    
      TShFileOpFlags = set of TShFileOpFlag;
    
      function  DSiCanWriteToFolder(const folderName: string): boolean;
    
      function  DSiCompressFile(fileHandle: THandle): boolean;
    
      function  DSiConnectToNetworkResource(const networkResource: string; const mappedLetter:
    
        string = ''; const username: string = ''; const password: string = ''): boolean;
    
      function  DSiCopyFileAnimated(ownerWindowHandle: THandle; sourceFile, destinationFile:
    
        string; var aborted: boolean; flags: TShFileOpFlags = [fofNoConfirmMkDir]): boolean;
    
      function  DSiCreateTempFolder: string;
    
      procedure DSiDeleteFiles(const folder, fileMask: string);
    
      function  DSiDeleteOnReboot(const fileName: string): boolean;
    
      procedure DSiDeleteTree(const folder: string; removeSubdirsOnly: boolean);
    
      function  DSiDeleteWithBatch(const fileName: string; rmDir: boolean = false): boolean;
    
      function  DSiDirectoryExistsW(const directory: WideString): boolean;
    
      function  DSiDisableWow64FsRedirection(var oldStatus: pointer): boolean;
    
      function  DSiDisconnectFromNetworkResource(mappedLetter: char; updateProfile: boolean =
    
        false): boolean;
    
      function  DSiEjectMedia(deviceLetter: char): boolean;
    
      procedure DSiEmptyFolder(const folder: string);
    
      function  DSiEmptyRecycleBin: boolean;
    
      function  DSiEnumFiles(const fileMask: string; attr: integer;
    
        enumCallback: TDSiEnumFilesCallback): integer;
    
      function  DSiEnumFilesEx(const fileMask: string; attr: integer;
    
        enumSubfolders: boolean; enumCallback: TDSiEnumFilesExCallback;
    
        maxEnumDepth: integer = 0): integer;
    
      procedure DSiEnumFilesToSL(const fileMask: string; attr: integer; fileList: TStrings;
    
        storeFullPath: boolean = false; enumSubfolders: boolean = false;
    
        maxEnumDepth: integer = 0);
    
      function  DSiFileExistsW(const fileName: WideString): boolean;
    
      function  DSiFileExtensionIs(const fileName, extension: string): boolean; overload;
    
      function  DSiFileExtensionIs(const fileName: string; extension: array of string):
    
        boolean; overload;
    
      function  DSiFileSize(const fileName: string): int64;
    
      function  DSiFileSizeW(const fileName: WideString): int64;
    
      function  DSiGetFolderSize(const folder: string; includeSubfolders: boolean): int64;
    
      function  DSiGetFileTime(const fileName: string; whatTime: TDSiFileTime): TDateTime;
    
      function  DSiGetFileTimes(const fileName: string; var creationTime, lastAccessTime,
    
        lastModificationTime: TDateTime): boolean;
    
      function  DSiGetLongPathName(const fileName: string): string;
    
      function  DSiGetNetworkResource(mappedLetter: char; var networkResource: string; var
    
        connectionIsAvailable: boolean): boolean;
    
      function  DSiGetSubstDrive(mappedLetter: char): string;
    
      function  DSiGetSubstPath(const path: string): string;
    
      function  DSiGetTempFileName(const prefix: string; const tempPath: string = ''): string;
    
      function  DSiGetTempPath: string;
    
      function  DSiGetUniqueFileName(const extension: string): string;
    
      function  DSiIsFileCompressed(const fileName: string): boolean;
    
      function  DSiIsFileCompressedW(const fileName: WideString): boolean;
    
      function  DSiKillFile(const fileName: string): boolean;
    
      function  DSiLoadMedia(deviceLetter: char): boolean;
    
      function  DSiMoveFile(const srcName, destName: string; overwrite: boolean = true): boolean;
    
      function  DSiMoveOnReboot(const srcName, destName: string): boolean;
    
      procedure DSiRemoveFolder(const folder: string);
    
      function  DSiRevertWow64FsRedirection(const oldStatus: pointer): boolean;
    
      function DSiSetFileTime(const fileName: string; dateTime: TDateTime;
    
        whatTime: TDSiFileTime): boolean;
    
      function  DSiSetFileTimes(const fileName: string; creationTime, lastAccessTime,
    
        lastModificationTime: TDateTime): boolean;
    
      function  DSiShareFolder(const folder, shareName, comment: string): boolean;
    
      function  DSiUncompressFile(fileHandle: THandle): boolean;
    
      function  DSiUnShareFolder(const shareName: string): boolean;
    
    { Processes }
    
      function  DSiAddAceToDesktop(desktop: HDESK; sid: PSID): boolean;
    
      function  DSiAddAceToWindowStation(station: HWINSTA; sid: PSID): boolean;
    
      function  DSiAffinityMaskToString(affinityMask: DWORD): string;
    
      function  DSiGetCurrentProcessHandle: THandle;
    
      function  DSiGetCurrentThreadHandle: THandle;
    
      function  DSiEnablePrivilege(const privilegeName: string): boolean;
    
      function  DSiExecute(const commandLine: string;
    
        visibility: integer = SW_SHOWDEFAULT; const workDir: string = '';
    
        wait: boolean = false): cardinal;
    
      function  DSiExecuteAndCapture(const app: string; output: TStrings; const workDir: string;
    
        var exitCode: longword; waitTimeout_sec: integer = 15; onNewLine: TDSiOnNewLineCallback
    
        = nil): cardinal;
    
      function  DSiExecuteAsUser(const commandLine, username, password: string;
    
        var winErrorCode: cardinal; const domain: string = '.';
    
        visibility: integer = SW_SHOWDEFAULT; const workDir: string = '';
    
        wait: boolean = false): cardinal; overload;
    
      function  DSiExecuteAsUser(const commandLine, username, password: string;
    
        var winErrorCode: cardinal; var processInfo: TProcessInformation;
    
        const domain: string = '.'; visibility: integer = SW_SHOWDEFAULT;
    
        const workDir: string = ''; wait: boolean = false;
    
        startInfo: PStartupInfo = nil): cardinal; overload;
    
      function  DSiGetProcessAffinity: string;
    
      function  DSiGetProcessAffinityMask: DWORD;
    
      function  DSiGetProcessID(const processName: string; var processID: DWORD): boolean;
    
      function  DSiGetProcessMemory(var memoryCounters: TProcessMemoryCounters): boolean;
    
        overload;
    
      function  DSiGetProcessMemory(process: THandle; var memoryCounters:
    
        TProcessMemoryCounters): boolean; overload;
    
      function  DSiGetProcessFileName(process: THandle; var processName: string): boolean;
    
      function  DSiGetProcessOwnerInfo(const processName: string; var user,
    
        domain: string): boolean; overload;
    
      function  DSiGetProcessOwnerInfo(processID: DWORD; var user,
    
        domain: string): boolean; overload;
    
      function  DSiGetProcessTimes(var creationTime: TDateTime; var userTime,
    
        kernelTime: int64): boolean; overload;
    
      function  DSiGetProcessTimes(process: THandle; var creationTime, exitTime: TDateTime;
    
        var userTime, kernelTime: int64): boolean; overload;
    
      function  DSiGetSystemAffinity: string;
    
      function  DSiGetSystemAffinityMask: DWORD;
    
      function  DSiGetThreadAffinity: string;
    
      function  DSiGetThreadAffinityMask: DWORD;
    
      function  DSiGetThreadTime: int64; overload;
    
      function  DSiGetThreadTime(thread: THandle): int64; overload;
    
      function  DSiGetThreadTimes(var creationTime: TDateTime; var userTime,
    
        kernelTime: int64): boolean; overload;
    
      function  DSiGetThreadTimes(thread: THandle; var creationTime, exitTime: TDateTime;
    
        var userTime, kernelTime: int64): boolean; overload;
    
      function  DSiImpersonateUser(const username, password: string;
    
        const domain: string = '.'): boolean;
    
      function  DSiIncrementWorkingSet(incMinSize, incMaxSize: integer): boolean;
    
      function  DSiIsDebugged: boolean;
    
      function  DSiLogonAs(const username, password: string;
    
        var logonHandle: THandle): boolean; overload;
    
      function  DSiLogonAs(const username, password, domain: string;
    
        var logonHandle: THandle): boolean; overload;
    
      function  DSiOpenURL(const URL: string; newBrowser: boolean = false): boolean;
    
      procedure DSiProcessThreadMessages;
    
      function  DSiRealModuleName: string;
    
      function  DSiRemoveAceFromDesktop(desktop: HDESK; sid: PSID): boolean;
    
      function  DSiRemoveAceFromWindowStation(station: HWINSTA; sid: PSID): boolean;
    
      function  DSiSetProcessAffinity(affinity: string): string;
    
      function  DSiSetProcessPriorityClass(const processName: string;
    
        priority: DWORD): boolean;
    
      function  DSiSetThreadAffinity(affinity: string): string;
    
      procedure DSiStopImpersonatingUser;
    
      function  DSiStringToAffinityMask(affinity: string): DWORD;
    
      function  DSiTerminateProcessById(processID: DWORD; closeWindowsFirst: boolean = true;
    
        maxWait_sec: integer = 10): boolean;
    
      procedure DSiTrimWorkingSet;
    
      function  DSiValidateProcessAffinity(affinity: string): string;
    
      function  DSiValidateProcessAffinityMask(affinityMask: DWORD): DWORD;
    
      function  DSiValidateThreadAffinity(affinity: string): string;
    
      function  DSiValidateThreadAffinityMask(affinityMask: DWORD): DWORD;
    
      procedure DSiYield;
    
    { Memory }
    
      procedure DSiFreePidl(pidl: PItemIDList);
    
      procedure DSiFreeMemAndNil(var mem: pointer);
    
      function  DSiGetGlobalMemoryStatus(var memoryStatus: TMemoryStatusEx): boolean;
    
    { Windows }
    
    type
    
      TDSiExitWindows = (ewLogOff, ewForcedLogOff, ewPowerOff, ewForcedPowerOff, ewReboot,
    
        ewForcedReboot, ewShutdown, ewForcedShutdown);
    
                      
    
      function  DSiAllocateHWnd(wndProcMethod: TWndMethod): HWND;
    
      procedure DSiDeallocateHWnd(wnd: HWND);
    
      function  DSiDisableStandby: boolean;
    
      procedure DSiDisableX(hwnd: THandle);
    
      procedure DSiEnableX(hwnd: THandle);
    
      function  DSiExitWindows(exitType: TDSiExitWindows): boolean;
    
      function  DSiForceForegroundWindow(hwnd: THandle;
    
        restoreFirst: boolean = true): boolean;
    
      function  DSiGetClassName(hwnd: THandle): string;
    
      function  DSiGetProcessWindow(targetProcessID: cardinal): HWND;
    
      function  DSiGetWindowText(hwnd: THandle): string;
    
      procedure DSiProcessMessages(hwnd: THandle; waitForWMQuit: boolean = false);
    
      procedure DSiRebuildDesktopIcons;
    
      procedure DSiRefreshDesktop;
    
      procedure DSiSetTopMost(hwnd: THandle; onTop: boolean = true;
    
        activate: boolean = false);
    
    { Aero }
    
      function  DSiAeroDisable: boolean;
    
      function  DSiAeroEnable: boolean;
    
      function  DSiAeroIsEnabled: boolean;
    
    { Taskbar }
    
      function  DSiGetTaskBarPosition: integer;
    
    { Menus }
    
      function  DSiGetHotkey(const item: string): char;
    
      function  DSiGetMenuItem(menu: HMENU; item: integer): string;
    
    { Screen }
    
      procedure DSiDisableScreenSaver(out currentlyActive: boolean);
    
      procedure DSiEnableScreenSaver;
    
      function  DSiGetBitsPerPixel: integer;
    
      function  DSiGetBPP: integer;
    
      function  DSiGetDesktopSize: TRect;
    
      function  DSiIsFullScreen: boolean;
    
      procedure DSiMonitorOff;
    
      procedure DSiMonitorOn;
    
      procedure DSiMonitorStandby;
    
      function  DSiSetScreenResolution(width, height: integer): longint;
    
    { Rectangles }
    
      procedure DSiCenterRectInRect(const ownerRect: TRect; var clientRect: TRect);
    
      procedure DSiMakeRectFullyVisibleOnRect(const ownerRect: TRect; var clientRect: TRect);
    
    { Clipboard }
    
      function  DSiIsHtmlFormatOnClipboard: boolean;
    
      function  DSiGetHtmlFormatFromClipboard: string;
    
      procedure DSiCopyHtmlFormatToClipboard(const sHtml: string; const sText: string = '');
    
     
    
    { Information }
    
    type
    
      TDSiBootType = (btNormal, btFailSafe, btFailSafeWithNetwork, btUnknown);
    
      TDSiWindowsVersion = (wvUnknown, wvWin31, wvWin95, wvWin95OSR2, wvWin98,
    
        wvWin98SE, wvWinME, wvWin9x, wvWinNT3, wvWinNT4, wvWin2000, wvWinXP,
    
        wvWinNT, wvWinServer2003, wvWinVista, wvWinServer2008, wvWinServer2008OrVistaSP1,
    
        wvWin7, wvWinServer2008R2, wvWin7OrServer2008R2);
    
      TDSiUIElement = (ueMenu, ueMessage, ueWindowCaption, ueStatus);
    
      function  DSiGetAppCompatFlags(const exeName: string): string;
    
      function  DSiGetBootType: TDSiBootType;
    
      function  DSiGetCompanyName: string;
    
      function  DSiGetComputerName: string;
    
      function  DSiGetDefaultBrowser: string;
    
      function  DSiGetDirectXVer: string;
    
      function  DSiGetDiskLabel(disk: char): string;
    
      function  DSiGetDiskSerial(disk: char): string;
    
      function  DSiGetDomain: string;
    
      function  DSiGetEnvironmentVariable(const envVarName: string): string;
    
      function  DSiGetFolderLocation(const CSIDL: integer): string;
    
      procedure DSiGetKeyboardLayouts(layouts: TStrings);
    
      function  DSiGetMyDocumentsFolder: string;
    
      function  DSiGetProgramFilesFolder: string;
    
      function  DSiGetRegisteredOwner: string;
    
      function  DSiGetSystemFolder: string;
    
      function  DSiGetSystemLanguage: string;
    
      function  DSiGetSystemVersion: string;
    
      function  DSiGetTrueWindowsVersion: TDSiWindowsVersion;
    
      function  DSiGetUserName: string;
    
      function  DSiGetUserNameEx: string;
    
      function  DSiGetWindowsFolder: string;
    
      function  DSiGetWindowsVersion: TDSiWindowsVersion;
    
      function  DSiInitFontToSystemDefault(aFont: TFont; aElement: TDSiUIElement): boolean;
    
      function  DSiIsAdmin: boolean;
    
      function  DSiIsAdminLoggedOn: boolean;
    
      function  DSiIsDiskInDrive(disk: char): boolean;
    
      function  DSiIsWinNT: boolean;
    
      function  DSiIsWow64: boolean;
    
      function  DSiVerifyPassword(const username, password: string;
    
        const domain: string = '.'): boolean;
    
    { Install }
    
      TDSiFwResolveConflict = (rcDuplicate, rcOverwrite, rcSkip);
    
      function  DSiAddApplicationToFirewallExceptionList(const entryName,
    
        applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;
    
        description: string = ''; grouping: string = '';
    
        serviceName: string = ''; protocols: TDSiFwIPProtocols = [fwProtoTCP];
    
        localPorts: string = '*'; profiles: TDSiFwIPProfiles = [fwProfileAll]): boolean;
    
      function  DSiAddApplicationToFirewallExceptionListAdvanced(const entryName,
    
        applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;
    
        description: string = ''; grouping: string = '';
    
        serviceName: string = ''; protocols: TDSiFwIPProtocols = [fwProtoTCP];
    
        localPorts: string = '*'; profiles: TDSiFwIPProfiles = [fwProfileAll]): boolean;
    
      function  DSiAddApplicationToFirewallExceptionListXP(const entryName,
    
        applicationFullPath: string; resolveConflict: TDSiFwResolveConflict = rcDuplicate;
    
        profile: TDSiFwIPProfile = fwProfileCurrent): boolean;
    
      function  DSiAddPortToFirewallExceptionList(const entryName: string;
    
        portNumber: cardinal): boolean;
    
      function  DSiAddUninstallInfo(const displayName, uninstallCommand, publisher,
    
        URLInfoAbout, displayVersion, helpLink, URLUpdateInfo: string): boolean;
    
      function  DSiAutoRunApp(const applicationName, applicationPath: string;
    
        enabled: boolean = true): boolean;
    
      procedure DSiCreateShortcut(const fileName, displayName, parameters: string;
    
        folder: integer= CSIDL_STARTUP; const workDir: string = '');
    
      function  DSiDeleteShortcut(const displayName: string;
    
        folder: integer = CSIDL_STARTUP): boolean;
    
      procedure DSiEditShortcut(const lnkName, fileName, workDir, parameters: string);
    
      function  DSiFindApplicationInFirewallExceptionListAdvanced(const entryName: string;
    
        var rule: OleVariant): boolean;
    
      function  DSiFindApplicationInFirewallExceptionListXP(const entryName: string;
    
        var application: OleVariant; profile: TDSiFwIPProfile = fwProfileCurrent): boolean;
    
      function  DSiGetLogonSID(token: THandle; var logonSID: PSID): boolean;
    
      function  DSiGetShortcutInfo(const lnkName: string; var fileName, filePath, workDir,
    
        parameters: string): boolean;
    
      function  DSiGetUninstallInfo(const displayName: string;
    
        out uninstallCommand: string): boolean;
    
      function  DSiIsAutoRunApp(const applicationname: string): boolean;
    
      function  DSiRegisterActiveX(const fileName: string; registerDLL: boolean): HRESULT;
    
      procedure DSiRegisterRunOnce(const applicationName,
    
        applicationPath: string);
    
      function  DSiRemoveApplicationFromFirewallExceptionList(const entryName,
    
        applicationFullPath: string): boolean;
    
      function  DSiRemoveApplicationFromFirewallExceptionListAdvanced(const entryName: string): boolean;
    
      function  DSiRemoveApplicationFromFirewallExceptionListXP(const applicationFullPath: string): boolean; overload;
    
      function  DSiRemoveApplicationFromFirewallExceptionListXP(const applicationFullPath: string;
    
        profile: TDSiFwIPProfile): boolean; overload;
    
      procedure DSiRemoveRunOnce(const applicationName: string);
    
      function  DSiRemoveUninstallInfo(const displayName: string): boolean;
    
      function  DSiShortcutExists(const displayName: string;
    
        folder: integer = CSIDL_STARTUP): boolean;
    
    { Time }
    
      TDSiTimer = class
    
      private
    
        dtEnabled     : boolean;
    
        dtInterval    : cardinal;
    
        dtOnTimer     : TNotifyEvent;
    
        dtTag         : longint;
    
        dtWindowHandle: HWND;
    
      protected
    
        procedure SetEnabled(value: boolean);
    
        procedure SetInterval(value: cardinal);
    
        procedure SetOnTimer(value: TNotifyEvent);
    
        procedure UpdateTimer;
    
        procedure WndProc(var msgRec: TMessage);
    
      public
    
        constructor Create(enabled: boolean = true; interval: cardinal = 1000; onTimer:
    
          TNotifyEvent = nil; tag: longint = 0);
    
        destructor  Destroy; override;
    
        property Enabled: boolean read dtEnabled write SetEnabled default true;
    
        property Interval: cardinal read dtInterval write SetInterval default 1000;
    
        property Tag: longint read dtTag write dtTag;
    
        property OnTimer: TNotifyEvent read dtOnTimer write SetOnTimer;
    
      end; { TDSiTimer }
    
      function  DSiDateTimeToFileTime(dateTime: TDateTime; var fileTime: TFileTime): boolean;
    
      //Following three functions are based on GetTickCount
    
      function  DSiElapsedSince(midTime, startTime: int64): int64;
    
      function  DSiElapsedTime(startTime: int64): int64;
    
      function  DSiElapsedTime64(startTime: int64): int64;
    
      function  DSiHasElapsed(startTime: int64; timeout_ms: DWORD): boolean;
    
      function  DSiHasElapsed64(startTime: int64; timeout_ms: DWORD): boolean;
    
      function  DSiFileTimeToDateTime(fileTime: TFileTime): TDateTime; overload;
    
      function  DSiFileTimeToDateTime(fileTime: TFileTime; var dateTime: TDateTime): boolean; overload;
    
      function  DSiFileTimeToMicroSeconds(fileTime: TFileTime): int64;
    
      function  DSiPerfCounterToMS(perfCounter: int64): int64;
    
      function  DSiPerfCounterToUS(perfCounter: int64): int64;
    
      function  DSiQueryPerfCounterAsUS: int64;
    
      function  DSiTimeGetTime64: int64;
    
      procedure DSiuSecDelay(delay: int64);
    
    { Interlocked }
    
    function  DSiInterlockedDecrement64(var addend: int64): int64; register;
    
    function  DSiInterlockedIncrement64(var addend: int64): int64; register;
    
    function  DSiInterlockedExchangeAdd64(var addend: int64; value: int64): int64; register;
    
    function  DSiInterlockedExchange64(var target: int64; value: int64): int64; register;
    
    function  DSiInterlockedCompareExchange64(var destination: int64; exchange, comparand: int64): int64; register; overload;
    
    function  DSiInterlockedCompareExchange64(destination: PInt64; exchange, comparand: int64): int64; register; overload;
    
    { DynaLoad }
    
      function  DSi9xNetShareAdd(serverName: PChar; shareLevel: smallint;
    
        buffer: pointer; size: word): integer; stdcall;
    
      function  DSi9xNetShareDel(serverName: PChar; netName: PChar;
    
        reserved: word): integer; stdcall;
    
      function  DSiCloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;
    
      function  DSiCreateProcessAsUser(hToken: THandle;
    
        lpApplicationName, lpCommandLine: PChar; lpProcessAttributes,
    
        lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;
    
        dwCreationFlags: DWORD; lpEnvironment: pointer;
    
        lpCurrentDirectory: PChar; const lpStartupInfo: TStartupInfo;
    
        var lpProcessInformation: TProcessInformation): BOOL; stdcall;
    
      function  DSiCreateProcessWithLogonW(lpUsername, lpDomain, lpPassword: PWideChar;
    
        dwLogonFlags: DWORD; lpApplicationName, lpCommandLine: PWideChar;
    
        dwCreationFlags: DWORD; lpEnvironment: pointer; lpCurrentDirectory: PWideChar;
    
        const lpStartupInfo: TStartupInfoW; var lpProcessInformation: TProcessInformation): BOOL;
    
      function  DSiCreateEnvironmentBlock(var lpEnvironment: pointer; hToken: THandle;
    
        bInherit: BOOL): BOOL;
    
      function  DSiDestroyEnvironmentBlock(lpEnvironment: pointer): BOOL;
    
      function  DSiDwmEnableComposition(uCompositionAction: UINT): HRESULT; stdcall;
    
      function  DSiDwmIsCompositionEnabled(var pfEnabled: BOOL): HRESULT; stdcall;
    
      function  DSiEnumProcessModules(hProcess: THandle; lphModule: PModule; cb: DWORD;
    
        var lpcbNeeded: DWORD): BOOL; stdcall;
    
      function  DSiGetModuleFileNameEx(hProcess: THandle; hModule: HMODULE; lpFilename: PChar;
    
        nSize: DWORD): DWORD; stdcall;
    
      function  DSiGetProcAddress(const libFileName, procName: string): FARPROC;
    
      function  DSiGetProcessImageFileName(hProcess: THandle; lpImageFileName: PChar;
    
        nSize: DWORD): DWORD; stdcall;
    
      function  DSiGetProcessMemoryInfo(process: THandle; memCounters: PProcessMemoryCounters;
    
        cb: DWORD): boolean; stdcall;
    
      function  DSiGetTickCount64: int64; stdcall;
    
      function  DSiGetUserProfileDirectoryW(hToken: THandle; lpProfileDir: PWideChar;
    
        var lpcchSize: DWORD): BOOL; stdcall;
    
      function  DSiGlobalMemoryStatusEx(memStatus: PMemoryStatusEx): boolean; stdcall;
    
      function  DSiImpersonateLoggedOnUser(hToken: THandle): BOOL; stdcall;
    
      function  DSiIsWow64Process(hProcess: THandle; var wow64Process: BOOL): BOOL; stdcall;
    
      function  DSiLogonUser(lpszUsername, lpszDomain, lpszPassword: PChar;
    
        dwLogonType, dwLogonProvider: DWORD; var phToken: THandle): BOOL; stdcall;
    
      function  DSiNetApiBufferFree(buffer: pointer): cardinal; stdcall;
    
      function  DSiNetWkstaGetInfo(servername: PChar; level: cardinal;
    
        out bufptr: pointer): cardinal; stdcall;
    
      function  DSiNTNetShareAdd(serverName: PChar; level: integer; buf: PChar;
    
        var parm_err: integer): DWord; stdcall;
    
      function  DSiNTNetShareDel(serverName: PChar; netName: PWideChar;
    
        reserved: integer): DWord; stdcall;
    
      function  DSiOpenSCManager(lpMachineName, lpDatabaseName: PChar;
    
        dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
    
      function  DSiRevertToSelf: BOOL; stdcall;
    
      function  DSiSetDllDirectory(path: PChar): boolean; stdcall;
    
      function  DSiSetSuspendState(hibernate: BOOL; forceCritical: BOOL = false;
    
        disableWakeEvent: BOOL = false): BOOL; stdcall;
    
      function  DSiSHEmptyRecycleBin(Wnd: HWND; pszRootPath: PChar;
    
        dwFlags: DWORD): HRESULT; stdcall;
    
      function  DSiWow64DisableWow64FsRedirection(var oldStatus: pointer): BOOL; stdcall;
    
      function  DSiWow64RevertWow64FsRedirection(const oldStatus: pointer): BOOL; stdcall;
    
    { Helpers }
    
    function UTF8Encode(const ws: WideString): UTF8String;
    
    function UTF8Decode(const sUtf: UTF8String): WideString;
    

    Max Gehringer