Gehe zu deutscher Webseite

News

Download description:

This is a retro-coding product of OIDplus, written in TurboPascal, aiming for DOS. It is just a small gimmick / fun-project and should not be used for productive use! Please use the latest version of OIDplus (2.0)!

Source code: https://github.com/danielmarschall/oidplus_dos
Daniel Marschall
ViaThinkSoft Co-Founder
Download description:

This is the latest version of OIDplus 2.0!

Source code: https://github.com/danielmarschall/oidplus
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

VGWhoIs is a fork of the tool GWhoIs (currently not actively developed). It allows users to find information about domains, IP addresses, ASN numbers etc by querying the best fitting WhoIs service automatically. The information about the whois services is stored in a pattern file and can be altered or extended by new pattern files.

The usage is pretty simple:

vgwhois example.com
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

YouTube Downloader is a tool for Linux. It is a wrapper for youtube-dl and offers several additional functionalities.

Special features:
- Downloading of all videos of a channel or a playlist.
- Automatic searching inside channels or globally (whole YouTube)
- You can download videos and audio files.
- YouTube-IDs can be automatically written in the ID tag of downloaded mp3 files.
- An automatically managed list of already downloaded videos allows you to move away from the downloaded files without the risk of downloading the already downloaded files again.
- An automatically managed list of failed downloads will avoid that a video, which is not available anymore, is tried to be downloaded too many times.
- Creation of SFV and/or MD5 checksum files.
- The tool is fully CLI and is optimized for cronjobs.

Requirements:
- PHP CLI
- Package "youtube-dl"
- If you want to extract MP3 files: "avconv" or "ffmpeg". Optional: "id3v2"
- Ein Youtube API-Key (obtain here)
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

Converts OIDs in DER and vice versa.

Online demo
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:



VNag (ViaThinkSoft Nagios) is a framework for PHP which allows developing plugins for Nagios-compatible systems (e.g. Icinga2), following the development guidelines.

The download package contains documentation, examples and many new plugins, e.g. to check WordPress installations.

Beside developing normal Nagios/Icinga plugins (PHP will be called via CLI), you can develop plugins which are additionally served over HTTP.

  • The plugins can be shown via a HTTP-Demon (e.g. Apache) in user's browsers. Beside the output for Nagios (Summary, Verbose information, Performance data), user-defined HTML output can be added, e.g. to complete your Nagios output with more diagrams, pictures, etc. Only one code base is required!

  • The web-output contains a hidden machine readable part, which can be read out with the "WebReader" plugin of VNag. The WebReader plugins reads the machine readable part and outputs the data in the output format which can be read by Nagios. This way, you can monitor things like WordPress version at systems where you have no shell access and/or without Nagios installed.

  • It is also possible to create websites which only have a machine readable part (i.e. you include your VNag output in your existing website). This machine readable part can be optionally signed and/or encrypted.

VNag comes with following plugins pre-installed:

  • 4images_version: Checks 4images installations for updates.
  • disk_running: Checks if harddisks which do not have SMART capability are online
  • file_timestamp: Warns when files are not modified withhin a specific interval/age.
  • gitlab_version: Checks GitLab install~ations for updates.
  • hp_smartarray: Checks disk and controller status of HP SmartArray RAID controllers.
  • ipfm: Checks the log files of the tool "ipfm" and warns when the measured traffic exceeds a given limit.
  • joomla_version: checks Joomla installations for updates.
  • last: Checks the output of the tool "last" and warns when logins from suspicious IP adresses are detected.
  • mdstat: Parses the output of "/proc/mdstat" and warns when drives inside a RAID array have failed.
  • mediawiki_version: Checks MediaWiki installations for updates.
  • net2ftp_version: Checks net2ftp installations for updates.
  • nextcloud_version: Checks Nextcloud installations for updates.
  • nocc_version: Checks NOCC webmail installations for updates.
  • openbugbounty: Checks if your domains are listed at OpenBugBounty.org.
  • owncloud_version: Checks ownCloud installations for updates.
  • phpbb_version: Checks phpBB installations for updates.
  • phpmyadmin_version: Checks phpMyAdmin installations for updates.
  • ping: Pings a hostname or IP address.
  • pmwiki_version: Checks PmWiki installations for updates.
  • roundcube_version: Checks RoundCube installations for updates.
  • smart: Checks the SMART attributes of harddrives and warns when bad attributes are detected.
  • virtual_mem: Checks the amount of virtual memory (physical memory + swap).
  • webreader: Reads the output of another VNag plugin transferred over HTTP.
  • wordpress_version: Checks WordPress installations for updates.
  • x509_expire: Warns when X.509 (PEM) certificate files reach a specific age.
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

- Generate an UUID (according to RFC 4122):
- ... Time based (version 1) UUID
- ... DCE Security (version 2) UUID
- ... Name-based (version 3/5) UUID
- ... Random (version 4) UUID
- Interprete ("decode") an UUID
- Interprete a MAC address
Daniel Marschall
ViaThinkSoft Co-Founder
unit Cabinet;

// Source: http://delfusa.main.jp/delfusafloor/archive/www.nifty.ne.jp_forum_fdelphi/samples/00814.html
//         http://delfusa.main.jp/delfusafloor/archive/www.nifty.ne.jp_forum_fdelphi/samples/01338.html
// Very important bugfixes (e.g. forgotten cdecl and modern Delphi compatibility) by Daniel Marschall, ViaThinkSoft
// Revision : 18 August 2022
// published at https://www.viathinksoft.de/codelib/206

interface

{$IFDEF UNICODE}
// Note that the CAB API does only support ANSI names!
// Although Microsoft recommends using full paths, I would choose
// relative paths, because this way you avoid problems if the files
// are stored in a Non-ANSI folder name.
{$DEFINE USE_ANSISTRINGS}
{$ENDIF}

uses
  Windows, SysUtils, Classes{$IFDEF USE_ANSISTRINGS}, AnsiStrings{$ENDIF};

const
  CB_MAX_DISK_NAME = 256;
  CB_MAX_CABINET_NAME = 256;
  CB_MAX_CAB_PATH = 256;

  cpuUNKNOWN = -1;
  cpu80286 = 0;
  cpu80386 = 1;

type
  USHORT = WORD;

  TERF = record
    erfOper, erfType: Integer;
    fError: BOOL;
  end;
  // ERF = TERF;
  PERF = ^TERF;

  TCCAB = record
    cb: ULONG;
    cbFolderThresh: ULONG;
    cbReserveCFHeader: UINT;
    cbReserveCFFolder: UINT;
    cbReserveCFData: UINT;
    iCab: Integer;
    iDisk: Integer;
    fFailOnIncompressible: Integer;
    setID: USHORT;
    szDisk: array[0..CB_MAX_DISK_NAME-1] of AnsiChar;
    szCab: array[0..CB_MAX_CABINET_NAME-1] of AnsiChar;
    szCabPath: array[0..CB_MAX_CAB_PATH-1] of AnsiChar;
  end;
  // CCAB = TCCAB;
  PCCAB = ^TCCAB;

  TFDICABINETINFO = record
    cbCabinet: Longint;
    cFolders: USHORT;
    cFiles: USHORT;
    setID: USHORT;
    iCabinet: USHORT;
    fReserve: BOOL;
    hasprev: BOOL;
    hasnext: BOOL;
  end;
  // FDICABINETINFO = TFDICABINETINFO;
  PFDICABINETINFO = ^TFDICABINETINFO;

  TFDINOTIFICATIONTYPE = (fdintCABINET_INFO, fdintPARTIAL_FILE,
    fdintCOPY_FILE, fdintCLOSE_FILE_INFO, fdintNEXT_CABINET,
    fdintENUMERATE);
  // FDINOTIFICATIONTYPE = TFDINOTIFICATIONTYPE;

  TFCIERROR = (FCIERR_NONE, FCIERR_OPEN_SRC, FCIERR_READ_SRC, FCIERR_ALLOC_FAIL,
    FCIERR_TEMP_FILE, FCIERR_BAD_COMPR_TYPE, FCIERR_CAB_FILE, FCIERR_USER_ABORT,
    FCIERR_MCI_FAIL, FCIERR_CAB_FORMAT_LIMIT);

  TFDIERROR = (FDIERROR_NONE, FDIERROR_CABINET_NOT_FOUND,
    FDIERROR_NOT_A_CABINET, FDIERROR_UNKNOWN_CABINET_VERSION,
    FDIERROR_CORRUPT_CABINET, FDIERROR_ALLOC_FAIL,
    FDIERROR_BAD_COMPR_TYPE, FDIERROR_MDI_FAIL, FDIERROR_TARGET_FILE,
    FDIERROR_RESERVE_MISMATCH, FDIERROR_WRONG_CABINET,
    FDIERROR_USER_ABORT);

  tcompTYPE = (tcompTYPE_NONE, tcompTYPE_MSZIP);

  TFDINOTIFICATION = record
    cb: Longint;
    psz1: PAnsiChar;
    psz2: PAnsiChar;
    psz3: PAnsiChar;
    pv: Pointer;
    hf: Integer;
    date: USHORT;
    time: USHORT;
    attribs: USHORT;
    setID: USHORT;
    iCabinet: USHORT;
    iFolder: USHORT;
    fdie: TFDIERROR;
  end;
  // FDINOTIFICATION = TFDINOTIFICATION;
  PFDINOTIFICATION = ^TFDINOTIFICATION;

// define a function to call from Cabinet.DLL
function FCICreate(var erf: TERF; fnFiledest, fnAlloc, fnFree, fnOpen,
  fnRead, fnWrite, fnClose, fnSeek, fnDelete, fnfcigtf: Pointer;
  var ccab: TCCAB; pv: Pointer): THandle; cdecl;
function FCIDestroy(THandle: THandle): BOOL; cdecl;
function FCIAddFile(THandle: THandle; pszSourceFile, pszFileName: PAnsiChar;
 fExecute: BOOL; pfnfcignc, pfnfcis, pfnfcigoi: Pointer;
 typeCompress: WORD): BOOL; cdecl;
function FCIFlushCabinet(THandle: THandle; fGetNextCab: BOOL;
  pfnfcignc, pfnfcis: Pointer): BOOL; cdecl;
function FCIFlushFolder(fci: THandle;
  GetNextCab, pfnProgress: Pointer): BOOL; cdecl;
function FDICreate(fnAlloc, fnFree, fnOpen, fnRead, fnWrite, fnClose,
  fnSeek: Pointer; cpuType: Integer; var erf: TERF): THandle; cdecl;
function FDIDestroy(THandle: THandle): BOOL; cdecl;
function FDIIsCabinet(THandle: THandle; hf: Integer;
  pfdici: PFDICABINETINFO): BOOL; cdecl;
function FDICopy(THandle: THandle; pszCabinet: PAnsiChar; pszCabPath: PAnsiChar;
  flags: Integer; pfnfdin, pfnfdid: Pointer; pvUser: Pointer): BOOL; cdecl;

procedure CabinetAddFiles(Cabinet: AnsiString; Files: TStrings);
procedure CabinetExtractFile(Cabinet, Item, ExtractName: AnsiString);

implementation // This is the code to write in the implementation part from here

// define a function to call from Cabinet.DLL
const CAB_DLL = 'CABINET.DLL';
function FCICreate; external CAB_DLL name 'FCICreate';
function FCIDestroy; external CAB_DLL name 'FCIDestroy';
function FCIAddFile; external CAB_DLL name 'FCIAddFile';
function FCIFlushCabinet; external CAB_DLL name 'FCIFlushCabinet';
function FCIFlushFolder; external CAB_DLL name 'FCIFlushFolder';
function FDICreate; external CAB_DLL name 'FDICreate';
function FDIDestroy; external CAB_DLL name 'FDIDestroy';
function FDIIsCabinet; external CAB_DLL name 'FDIIsCabinet';
function FDICopy; external CAB_DLL name 'FDICopy';

// Here is an example callback function for context construction
function fnFilePlaced(var ccab: TCCAB; pszFile: PAnsiChar; cbFile: Longint;
  fContinuation: BOOL; pv: Pointer): THandle; cdecl;
begin
  Result := 0;
end;

function fnAlloc(Size: ULONG): Pointer; cdecl;
begin
  GetMem(Result, Size);
end;

procedure fnFree(memory: Pointer); cdecl;
begin
  FreeMem(memory);
end;

function fnOpen(pszFile: PAnsiChar; oflag: Integer; pmode: Integer;
  err: PInteger; pv: Pointer): Integer; cdecl;
const
  O_RDONLY = $0000;
  O_WRONLY = $0001;
  O_RDWR = $0002;
  O_CREAT = $0100;
  O_EXCL = $0400;
var
  Style: UINT;
  os: OFSTRUCT;
begin
  if(oflag and O_CREAT) <> 0 then
    Style := OF_CREATE
  else
    case(oflag and 3)of
      0: Style := OF_Read;
      1: Style := OF_Write;
      else Style := OF_ReadWrite;
    end;
  if(oflag and O_EXCL) <> 0 then
    Style := Style or OF_Share_Exclusive;
  Result := OpenFile(pszFile, os, Style); // save lines and use old API
end;

function fnRead(hf: Integer; memory: Pointer; cb: UINT; err: PInteger;
  pv: Pointer): UINT; cdecl;
begin
  Result := _lread(hf, memory, cb);
end;

function fnWrite(hf: Integer; memory: Pointer; cb: UINT; err: PInteger;
  pv: Pointer): UINT; cdecl;
begin
  Result := _lwrite(hf, memory, cb);
end;

function fnClose(hf: Integer; err, pv: Pointer): Integer; cdecl;
begin
  Result := _lclose(hf);
end;

function fnSeek(hf: Integer; dist: Longint; seektype: Integer; err: PInteger;
  pv: Pointer): Longint; cdecl;
begin
  Result := _llseek(hf, dist, seektype);
end;

function fnDelete(pszFile: PAnsiChar; err: PInteger; pv: Pointer): Integer; cdecl;
begin
  Result := Integer(DeleteFileA(pszFile));
end;

function fnFciGTF(pszTempName: PAnsiChar; cbTempName: Integer; pv: Pointer): BOOL; cdecl;
var
  pPath: array[0..MAX_PATH-1] of AnsiChar;
begin
  Result := (GetTempPathA(sizeof(pPath), pPath) <> 0) and
            (GetTempFileNameA(pPath, 'cab', 0, pszTempName) <> 0);
end;

function fnGetNextCabinet(var ccab: TCCAB; cbPrevCab: ULONG;
  pv: Pointer): BOOL; cdecl;
begin
  result := false; // TODO?
end;

function fnStatus(typeStatus: UINT; cb1, cb2: ULONG; pv: Pointer):
  Longint; cdecl;
begin
  result := 0; // TODO?
end;

function fnOpenInfo(pszName: PAnsiChar; var pDate: WORD; var pTime: WORD;
  var pAttrib: WORD; err: PInteger; pv: Pointer): Integer; cdecl;
var
  LocalTime: FILETIME;
  CreationTime: FILETIME;
  LastAccessTime: FILETIME;
  LastWriteTime: FILETIME;
  fh: THandle;
begin // Originally get the attributes of the file here
  pAttrib := GetFileAttributesA(pszName);

  fh := CreateFileA(
      PAnsiChar(pszName),
      GENERIC_READ{ or GENERIC_WRITE},
      FILE_SHARE_READ,
      nil,
      OPEN_EXISTING,
      FILE_ATTRIBUTE_NORMAL,
      0
  );

  if fh <> INVALID_HANDLE_VALUE then
  begin
    GetFileTime(fh, @CreationTime, @LastAccessTime, @LastWriteTime);

    FileTimeToLocalFileTime(LastWriteTime, LocalTime);
    FileTimeToDosDateTime(LocalTime, pDate, pTime);

    // CloseHandle(handle);
  end;

  Result := fh;
end;

// I tried to combine it into two functions for easy use
// CabinetAddFiles : Compress the files in the list into CAB
// CabinetExtractFile : Extract file from CAB

procedure CabinetAddFiles(Cabinet: AnsiString; Files: TStrings);
var
  fci: THandle;
  erf: TERF;
  ccab: TCCAB;
  i: Integer;
begin
  ZeroMemory(@erf, sizeof(erf));
  ZeroMemory(@ccab, sizeof(ccab));

  ccab.cb := $7FFFFFFF {2GB}; // "the maximum size, in bytes, of a cabinet created by FCI"
  ccab.iDisk := 1;
  {$IFDEF USE_ANSISTRINGS}AnsiStrings.{$ENDIF}StrPCopy(ccab.szDisk, PAnsiChar(AnsiString('DISK1')));
  {$IFDEF USE_ANSISTRINGS}AnsiStrings.{$ENDIF}StrPCopy(ccab.szCab, PAnsiChar(AnsiString(ExtractFileName(Cabinet))));
  {$IFDEF USE_ANSISTRINGS}AnsiStrings.{$ENDIF}StrPCopy(ccab.szCabPath, PAnsiChar(AnsiString(ExtractFilePath(Cabinet))));

  // use a callback function to build the context
  fci := FCICreate(erf, @fnFilePlaced, @fnAlloc, @fnFree,
    @fnOpen, @fnRead, @fnWrite, @fnClose, @fnSeek, @fnDelete,
    @fnFciGTF, ccab, nil);
  if fci <> 0 then
  try
    for i := 0 to Files.Count-1 do
    begin                                                    
      if not FCIAddFile(fci, PAnsiChar(AnsiString(Files[i])), PAnsiChar(AnsiString(ExtractFileName(Files[i]))), FALSE{Execute},
        @fnGetNextCabinet, @fnStatus, @fnOpenInfo, Ord(tcompTYPE_MSZIP)) then
      begin
        raise Exception.CreateFmt('FCIAddFile %d', [erf.erfOper]);
      end;
    end;

    if FCIFlushCabinet(fci, FALSE, @fnGetNextCabinet, @fnStatus) = FALSE then
    begin
      raise Exception.CreateFmt('FCIFlushCabinet %d', [erf.erfOper]);
    end;
  finally
    // dispose of used context
    FCIDestroy(fci);
  end;
end;

const
  _A_NORMAL = $00;
  _A_RDONLY = $01;
  _A_HIDDEN = $02;
  _A_SYSTEM = $04;
  _A_SUBDIR = $10;
  _A_ARCH   = $20;

procedure CabinetExtractFile(Cabinet, Item, ExtractName: AnsiString);
type
  TMyParam = record
    Item: AnsiString;
    ExtractName: AnsiString;
  end;
  PMyParam = ^TMyParam;

  function fnFDINotify(fdint: TFDINOTIFICATIONTYPE;
    pfdin: PFDINOTIFICATION): Integer; cdecl;
  var
    os: OFSTRUCT;
    Param: PMyParam;
    datetime: TFileTime;
    local_filetime: TFileTime;
    handle: THandle;
    attrs: Cardinal;
  begin
    Param := pfdin.pv;
    case(fdint)of
      fdintCABINET_INFO:
      begin
        result := 0; // TODO?
      end;
      fdintPARTIAL_FILE:
      begin
        result := 0; // TODO?
      end;
      fdintCOPY_FILE:
      begin
        if {$IFDEF USE_ANSISTRINGS}AnsiStrings.{$ENDIF}SameText(pfdin^.psz1, Param^.Item) then
          Result := OpenFile(PAnsiChar(Param^.ExtractName), os, OF_CREATE)
        else
          Result := 0;
        if Result = -1 then RaiseLastOSError;
      end;
      fdintCLOSE_FILE_INFO:
      begin // Originally set file attributes here
        _lclose(pfdin^.hf);

        (*
         * Set date/time
         *
         * Need Win32 type handle for to set date/time
         *)
        handle := CreateFileA(
            PAnsiChar(Param^.ExtractName),
            GENERIC_READ{ or GENERIC_WRITE},
            FILE_SHARE_READ,
            nil,
            OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL,
            0
        );
        if handle <> INVALID_HANDLE_VALUE then
        begin
          if (DosDateTimeToFileTime(
              pfdin^.date,
              pfdin^.time,
              datetime) = TRUE) then
          begin
            if (LocalFileTimeToFileTime(
                datetime,
                local_filetime) = TRUE) then
            begin
              SetFileTime(
                  handle,
                  @local_filetime,
                  nil,
                  @local_filetime
              );
            end;
          end;

          CloseHandle(handle);
        end;

        (*
         * Mask out attribute bits other than readonly,
         * hidden, system, and archive, since the other
         * attribute bits are reserved for use by
         * the cabinet format.
         *)
        attrs := pfdin^.attribs and (_A_RDONLY or _A_HIDDEN or _A_SYSTEM or _A_ARCH);
        SetFileAttributesA(
            PAnsiChar(Param^.ExtractName),
            attrs
        );

        // TODO: Commented out, because for some reason sometimes cb=1 although it was packed with Execute=FALSE
        // if pfdin^.cb = 1 then WinExec(PAnsiChar(Param^.ExtractName), SW_NORMAL); // Execute files with the "Execute" flag (set by FCIAddFile)

        Result := Integer(TRUE);
      end;
      fdintNEXT_CABINET:
      begin
        Result := 0; // TODO?
      end;
      fdintENUMERATE:
      begin
        Result := 0; // TODO?
      end
      else
      begin
        Result := 0; // Should not happen
      end;
    end;
  end;

var
  fdi: THandle;
  erf: TERF;
  Param: TMyParam;
begin
  ZeroMemory(@erf, sizeof(erf));
  // use a callback function to build the context
  fdi := FDICreate(@fnAlloc, @fnFree, @fnOpen, @fnRead, @fnWrite, @fnClose, @fnSeek, cpuUNKNOWN, erf);
  if fdi <> 0 then
  try
    Param.Item := Item;
    Param.ExtractName := ExtractName;
    if FDICopy(fdi, PAnsiChar(AnsiString(ExtractFileName(Cabinet))),
      PAnsiChar(AnsiString(ExtractFilePath(Cabinet))), 0, @fnFDINotify, nil, @Param) = FALSE then
    begin
      raise Exception.CreateFmt('FDICopy %d', [erf.erfOper]);
    end;
  finally
    // dispose of used context
    FDIDestroy(fdi);
  end;
end;

end.

Example how to use:

procedure TForm1.Button1Click(Sender: TObject);
var
  Files: TStringList;
begin
  Files := TStringList.Create;
  Files.Add('Setup.exe');
  CabinetAddFiles('TEST.CAB', Files);
  Files.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  CabinetExtractFile('TEST.CAB', 'Setup.exe', 'Setup.exe');
end;
Daniel Marschall
ViaThinkSoft Co-Founder

uses
  WinSock, ActiveX, ComObj;

function OleVariantToText(aVar:OleVariant):string;
// mostly quickdump for WMI researchpurposes
var
    i : integer;
begin
  Result:='';
  if not VarIsNull(aVar) then
    if VarIsArray(aVar) then
      begin
        result:='{';
        for i :=VarArrayLowBound(aVar,1) to vararrayhighbound(aVar,1)  do
          begin
            if i<>0 then
              result:=result+',';
            result:=result+OleVariantToText(vararrayget(aVar,[i]));
          end;
        result:=result+'}';
      end
    else
      Result:=VarToStr(aVar);
end;

Function GetMultiString_FromArray( ArrayString:OleVariant; separator:string):string;
begin
    If varisnull ( ArrayString ) Then
        result:= ''
    else
        result := OleVariantToText(arraystring); // arraystring.items[0]; // Join( ArrayString, Seprator )
end;

function GetWMIObject(const objectName: String): IDispatch;
var
  chEaten: Integer;
  BindCtx: IBindCtx;//for access to a bind context
  Moniker: IMoniker;//Enables you to use a moniker object
begin
  OleCheck(CreateBindCtx(0, bindCtx));
  OleCheck(MkParseDisplayName(BindCtx, StringToOleStr(objectName), chEaten, Moniker));//Converts a string into a moniker that identifies the object named by the string
  OleCheck(Moniker.BindToObject(BindCtx, nil, IDispatch, Result));//Binds to the specified object
end;

function GetWMIarray(wmiHost, root, wmiClass, wmiProperty, Separator: string): string;
var
  objWMIService : OLEVariant;
  colItems      : OLEVariant;
  colItem       : OLEVariant;
  oEnum         : IEnumvariant;
  iValue        : LongWord;
begin
  objWMIService := GetWMIObject(Format('winmgmts:\\%s\%s',[wmiHost,root]));
  colItems      := objWMIService.ExecQuery(Format('SELECT * FROM %s',[wmiClass]),'WQL',0);
  oEnum         := IUnknown(colItems._NewEnum) as IEnumVariant;
  while oEnum.Next(1, colItem, iValue) = 0 do
  begin
     Result:=GetMultiString_FromArray(colItem.Properties_.Item(wmiProperty, 0).Value,Separator); //you can improve this code  ;) , storing the results in an TString.
     if Result <> '' then break;
  end;
end;

function GetWMIstring(wmiHost, root, wmiClass, wmiProperty: string): string;
var
  objWMIService : OLEVariant;
  colItems      : OLEVariant;
  colItem       : OLEVariant;
  oEnum         : IEnumvariant;
  iValue        : LongWord;
begin
  objWMIService := GetWMIObject(Format('winmgmts:\\%s\%s',[wmiHost,root]));
  colItems      := objWMIService.ExecQuery(Format('SELECT * FROM %s',[wmiClass]),'WQL',0);
  oEnum         := IUnknown(colItems._NewEnum) as IEnumVariant;
  while oEnum.Next(1, colItem, iValue) = 0 do
  begin
     Result:=colItem.Properties_.Item(wmiProperty, 0); //you can improve this code  ;) , storing the results in an TString.
     if Result <> '' then break;
  end;
end;

function SendArp(DestIP,SrcIP:ULONG;pMacAddr:pointer;PhyAddrLen:pointer) : DWord; StdCall; external 'iphlpapi.dll' name 'SendARP';

function GetRouterMac(debug: boolean=false): string;

  function GetMacAddr(const IPAddress: string; var ErrCode : DWORD): string;
  var
    MacAddr    : Array[0..5] of Byte;
    DestIP     : ULONG;
    PhyAddrLen : ULONG;
    WSAData    : TWSAData;
  begin
    // https://stackoverflow.com/questions/4550672/delphi-get-mac-of-router
    Result    :='';
    WSAStartup($0101, WSAData);
    try
      ZeroMemory(@MacAddr,SizeOf(MacAddr));
      DestIP    :=inet_addr(PAnsiChar(AnsiString(IPAddress)));
      PhyAddrLen:=SizeOf(MacAddr);
      ErrCode   :=SendArp(DestIP,0,@MacAddr,@PhyAddrLen);
      if ErrCode = S_OK then
       Result:=Format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',[MacAddr[0], MacAddr[1],MacAddr[2], MacAddr[3], MacAddr[4], MacAddr[5]])
    finally
      WSACleanup;
    end;
  end;

var
  gateway: string;
  ec: DWORD;
  macrouter: string;
  sl: TStringList;
  serr: string;
const
  DELIM = ',';
begin
  result := '';

  gateway := GetWMIarray('.', 'root\CIMV2', 'Win32_NetworkAdapterConfiguration', 'DefaultIPGateway', DELIM);
  gateway := StringReplace(gateway,'{','',[rfReplaceAll]);
  gateway := StringReplace(gateway,'}','',[rfReplaceAll]);

  sl := TStringList.Create;
  try
    sl.Delimiter := DELIM;
    sl.DelimitedText := gateway;
    if sl.Count = 0 then
    begin
      if debug then
        macrouter := 'ERR_NO_ADAPTERS'
      else
        macrouter := '';
    end
    else
    begin
      try
        macrouter := GetMacAddr(sl[0],ec);
      except
        on E: Exception do
        begin
          if debug then
            macrouter := 'ERR_EXCEPT_'+E.Message
          else
            macrouter := '';
        end;
      end;

      if ec = ERROR_BAD_NET_NAME then
        serr := 'ERROR_BAD_NET_NAME'
      else if ec = ERROR_BUFFER_OVERFLOW then
        serr := 'ERROR_BUFFER_OVERFLOW'
      else if ec = ERROR_GEN_FAILURE then
        serr := 'ERROR_GEN_FAILURE'
      else if ec = ERROR_INVALID_PARAMETER then
        serr := 'ERROR_INVALID_PARAMETER'
      else if ec = ERROR_INVALID_USER_BUFFER then
        serr := 'ERROR_INVALID_USER_BUFFER'
      else if ec = 1168(*ERROR_NOT_FOUND*) then
        serr := 'ERROR_NOT_FOUND'
      else if ec = ERROR_NOT_SUPPORTED then
        serr := 'ERROR_NOT_SUPPORTED'
      else if ec = ERROR_NETWORK_UNREACHABLE then // not documented in MSDN WinApi
        serr := 'ERROR_NETWORK_UNREACHABLE'
      else if ec <> S_OK then
        serr := 'ERROR_' + IntToStr(ec);

      if ec <> 0 then
      begin
        if debug then
          macrouter := serr
        else
          macrouter := '';
      end;
    end;
  finally
    FreeAndNil(sl);
  end;

  result := macrouter;
end;

procedure TForm6.Button1Click(Sender: TObject);
begin
  showmessage(GetRouterMac(true));
end;

initialization
  CoInitialize(nil);
finalization
  CoUnInitialize;
end.
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:



Abstract

ViaThinkSoft Currency Converter is a library developed by Daniel Marschall which converts currencies. The latest exchange data is automatically downloaded and cached.

To use ViaThinkSoft Currency Converter, you need an API key from CurrencyLayer.com. Keys with limited access are available for free, and there are paid subscriptions available, too.

Usage for online applications, with PHP

Download framework and example script from the SVN

Try it now! Use the online tool

For Windows users

If you are not a developer, you can download the ready-to-use demo EXE file.

Download Windows demo application, written in Delphi



For Windows developers

The Currency Converter is implemented as a Windows DLL (Source code for Delphi), which can be used by most other programming languages as well as VBA (Visual Basic for Applications). Therefore, you can use Currency Calculator in Microsoft Office products.

Download compiled DLL for Win32 and Win64

Download source code for usage in ...

Before using the DLL, please place the API key in your registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\ViaThinkSoft\CurrencyConverter]
"APIKey"="....."

Specification of the exported DLL methods
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:



Abstract

ViaThinkSoft Currency Converter is a library developed by Daniel Marschall which converts currencies. The latest exchange data is automatically downloaded and cached.

To use ViaThinkSoft Currency Converter, you need an API key from CurrencyLayer.com. Keys with limited access are available for free, and there are paid subscriptions available, too.

Usage for online applications, with PHP

Download framework and example script from the SVN

Try it now! Use the online tool

For Windows users

If you are not a developer, you can download the ready-to-use demo EXE file.

Download Windows demo application, written in Delphi



For Windows developers

The Currency Converter is implemented as a Windows DLL (Source code for Delphi), which can be used by most other programming languages as well as VBA (Visual Basic for Applications). Therefore, you can use Currency Calculator in Microsoft Office products.

Download compiled DLL for Win32 and Win64

Download source code for usage in ...

Before using the DLL, please place the API key in your registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\ViaThinkSoft\CurrencyConverter]
"APIKey"="....."

Specification of the exported DLL methods
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:



The powerful web-based organization talent will help you to make your daily work easier by providing you the opportunity to manage appointments, contacts, documents, files, links, electronic mailboxes, access data, etc. in a well arranged form. A modular system allows Personal WebBase to expand. Since the module structure is very simple, also inexperienced PHP developers are able to simply create their own components.

More information, modules and designs can be found the website of Personal WebBase!
www.personal-webbase.com
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

Due to a project I needed a function that reads the original file name from a trash file. After some research I found publications and forensics freeware which analyze the structure of trash index files and describe or analyze it. Unfortunately, I must say that all publications that I've found were erroneous (some fatal) and not all analysis programs could handle all types of trash index files (various Windows versions). So I have made a different trash structure analysis (Windows 95 to Windows 7) and a Delphi unit, a including sample program. Of course I wanted to do something good for the community and published this unit open source. The operator or authors of the publications/websites were also contacted by me in order to refer to their errors. Microsoft of course does not comment the development of Windows structure files.

Requires at least Delphi 4, but RecyclerGetDateTime() is first unlocked in Delphi 6.

I successfully tested the program with Windows NT4, 95 (with and without IE4 ShellExtensions), 98, 2000, XP, Vista, 7, 10, 11 and with ReactOS.
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

Filter Foundry is a compatible replacement for Adobe Filter Factory. For information about how to use the Filter Factory-compatible interface, see The Filter Factory Programming Guide. Several example effects come with Filter Factory.

Initially written by Toby Thain in 2003 - 2009, the development has been continued by Daniel Marschall / ViaThinkSoft since 2018. Several advancements and improvements have been made, and a 64-bit Windows version was created. The Macintosh version could not be taken over because Apple removed the "Carbon" API.

Filter Foundry full documentation

Here you can find a few filters by ViaThinkSoft which were created using Filter Foundry.
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

Filter Foundry is a compatible replacement for Adobe Filter Factory. For information about how to use the Filter Factory-compatible interface, see The Filter Factory Programming Guide. Several example effects come with Filter Factory.

Initially written by Toby Thain in 2003 - 2009, the development has been continued by Daniel Marschall / ViaThinkSoft since 2018. Several advancements and improvements have been made, and a 64-bit Windows version was created. The Macintosh version could not be taken over because Apple removed the "Carbon" API.

Filter Foundry full documentation

Here you can find a few filters by ViaThinkSoft which were created using Filter Foundry.
Daniel Marschall
ViaThinkSoft Co-Founder
function GetOwnBuildTimestamp: TDateTime;
var
  fs: TFileStream;
  unixTime: integer;
  peOffset: Integer;
begin
  try
    fs := TFileStream.Create(ParamStr(0), fmOpenRead or fmShareDenyNone);
    try
      fs.Seek($3C, soFromBeginning);
      fs.Read(peOffset, 4);

      fs.Seek(peOffset+8, soFromBeginning);
      fs.Read(unixTime, 4);

      // TODO: If required, convert UTC zu your local time zone.
      result := UnixToDateTime(unixTime); // requires DateUtils
    finally
      FreeAndNil(fs);
    end;
  except
    // Should not happen
    FileAge(ParamStr(0), result);
  end;
end;
Daniel Marschall
ViaThinkSoft Co-Founder
First of all, you need:

DECLARE @AllConnections TABLE(
    SPID INT,
    Status VARCHAR(MAX),
    LOGIN VARCHAR(MAX),
    HostName VARCHAR(MAX),
    BlkBy VARCHAR(MAX),
    DBName VARCHAR(MAX),
    Command VARCHAR(MAX),
    CPUTime INT,
    DiskIO INT,
    LastBatch VARCHAR(MAX),
    ProgramName VARCHAR(MAX),
    SPID_1 INT,
    REQUESTID INT
)

INSERT INTO @AllConnections EXEC sp_who2

Then, if you want to check if any other computer or user is accessing the database:

SELECT * FROM @AllConnections WHERE DBName = ( select DBName from @AllConnections where SPID_1 = @@spid )
and LOGIN+'@'+HostName not in ( select LOGIN+'@'+HostName from @AllConnections where SPID_1 = @@spid )

If you want to check if any other connection is open (even if it is on the same computer or the same app), use this:

SELECT * FROM @AllConnections WHERE DBName = ( select DBName from @AllConnections where SPID_1 = @@spid )
and SPID_1 <> @@spid
Daniel Marschall
ViaThinkSoft Co-Founder
uses
  ShellAPI;

procedure PerformSoftwareUpdate;
var
  sl: TStringList;
const
  DOWNLOAD_ZIP = 'software_update.zip';
  VBS_SCRIPTNAME = 'software_update.vbs';
begin
  CopyFile('d:\test\TEST - Kopie.zip', PChar(IncludeTrailingPathDelimiter((ExtractFilePath(ParamStr(0))))+DOWNLOAD_ZIP), false); // TODO: Perform actual download of your file e.g. from a web server

  OwnParameters := '';
  for i := 1 to ParamCount do
  begin
    OwnParameters := OwnParameters + ParamStr(i) + ' ';
  end;
  OwnParameters := Trim(OwnParameters);

  sl := TStringList.Create;
  sl.Add('');
  sl.Add(''' Automatic program update');
  sl.Add(''' (C) 2022 Daniel Marschall, ViaThinkSoft');
  sl.Add('');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add(''' Consts (will be set by the executing program)');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add('');
  sl.Add('ZipFile="'+IncludeTrailingPathDelimiter((ExtractFilePath(ParamStr(0))))+DOWNLOAD_ZIP+'"');
  sl.Add('ExtractTo="'+IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'"');
  sl.Add('StartApp="'+ExtractFileName(ParamStr(0))+'"');
  sl.Add('Params="'+OwnParameters+'"');
  sl.Add('');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add(''' Wait (be sure that the executing program is terminated)');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add('');
  sl.Add('WScript.Sleep 1000');
  sl.Add('');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add(''' Now unpack the program files and overwrite if they already exist);
  sl.Add(''' ----------------------------------------------------------');
  sl.Add('');
  sl.Add('Set fso = CreateObject("Scripting.FileSystemObject")');
  sl.Add('''If the extraction location does not exist create it.');
  sl.Add('If NOT fso.FolderExists(ExtractTo) Then');
  sl.Add(' fso.CreateFolder(ExtractTo)');
  sl.Add('End If');
  sl.Add('''Extract the contants of the zip file.');
  sl.Add('set objShell = CreateObject("Shell.Application")');
  sl.Add('set FilesInZip=objShell.NameSpace(ZipFile).items');
  sl.Add('objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16 ''16=NoOverwriteConfirmation');
  sl.Add('Set fso = Nothing');
  sl.Add('Set objShell = Nothing');
  sl.Add('');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add(''' Start our program again');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add('');
  sl.Add('Set objShell = CreateObject("Shell.Application")');
  sl.Add('objShell.ShellExecute ExtractTo+StartApp, Params, ExtractTo, "open", 1 ''1=normal');
  sl.Add('Set objShell = Nothing');
  sl.Add('');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add(''' Delete this script and the update ZIP');
  sl.Add(''' ----------------------------------------------------------');
  sl.Add('');
  sl.Add('Set fso = CreateObject("Scripting.FileSystemObject")');
  sl.Add('fso.DeleteFile(ZipFile)');
  sl.Add('fso.DeleteFile(WScript.ScriptFullName)');
  sl.Add('Set fso = Nothing');
  sl.Add('');
  sl.SaveToFile(VBS_SCRIPTNAME);
  FreeAndNil(sl);
  ShellExecute(handle, 'open', VBS_SCRIPTNAME, '', PChar(ExtractFilePath(ParamStr(0))), SW_NORMAL);
  Application.Terminate; // Important! We must not take longer than 1 second to exit!
end;
Daniel Marschall
ViaThinkSoft Co-Founder
Project description:

FastPHP is a simple, efficient, and comfortable editor/IDE for PHP. Besides syntax highlighting, a code explorer, and the execution of PHP scripts outside the browser, FastPHP offers other useful functionalities like PHP Lint, showing the PHP documentation by keystroke and automatic replacement of whitespaces into tabs.

Features:
  • Loads very fast, similar to Notepad
  • Syntax highlighting
  • Code TreeView Explorer (written in PHP!), also shows TODO-Entries
  • Running PHP files without IDE and without browser
  • Integrated PHP lint
  • Conversation from whitespaces to tabs
  • Integrated PHP help with the F1 key
  • PHP files can be executed like HTA files via double-click
  • Switch between Dark and Light theme
  • Show/Hide formatting symbols
  • Clicking on a PHP error will jump to the code line
  • Automatically removes unnecessary spaces at end of lines and the end of file
  • Integrate in Explorer as "Shell new" to quickly create new PHP files
Daniel Marschall
ViaThinkSoft Co-Founder