mystuff

Your IP Address is: 38.107.191.102
Last site update: 23 March 2009
You are visitor number: 

  home | wsname | wallpaper creator | delphi stuff | vb script stuff | other stuff | contact me

Google
Web Site
Here's a collection of Delphi functions I've found useful.

Network
   Using the DsGetDcName function to return the name of a domain controller in a specified domain
   Determine if the computer is a member of a Domain or Workgroup - Method 1: Using NetGetJoinInformation
   Determine if the computer is a member of a Domain or Workgroup - Method 2: Using NetRenameMachineInDomain

File System
   Determine what File System a Drive is Formatted with using GetVolumeInformation
   Get the Disk Label using GetVolumeInformation using GetVolumeInformation
   Get the Size of a File


 Determine if the computer is a member of a Domain or Workgroup - Method 1: Using NetGetJoinInformation


function IsInDomain:Boolean;
    type
        Type_NetGetJoinInformation = function(lpServer: LPCWSTR; lpNameBuffer: LPWSTR; BufferType: pointer): longint; stdcall;
    var
        b : longint;
        d : LPWSTR;
        iResultCode : integer;
        lngResultCode : LongInt;
        _NetGetJoinInformation : Type_NetGetJoinInformation;
    begin
        Result:=False;
        try
            iResultCode:=LoadLibrary(pchar('NetAPI32.dll'));
            @_NetGetJoinInformation:=GetProcAddress(iResultCode,pchar('NetGetJoinInformation'));
            lngResultCode:= _NetGetJoinInformation(nil, @d, @b);
            FreeLibrary(iResultCode);
            // This contains the domain or workgroup name
            //sLanGroupName:=(WideCharToString(d));
            if b = 3 then
                Result:=True;
            FreeBuffer(d);
        finally
        end;
    end;

 

function FreeBuffer(lpBuffer : Pointer):integer;
    Type
        Type_NetApiBufferFree = function(Buffer: Pointer): integer; stdcall;
    var
        iResultCode : integer;
        lngResultCode : LongInt;
        _NetApiBufferFree : Type_NetApiBufferFree;
    begin
        Try
            iResultCode:=LoadLibrary(pchar('NetAPI32.dll'));
            @_NetApiBufferFree:=GetProcAddress(iResultCode,pchar('NetApiBufferFree'));
            lngResultCode:= _NetApiBufferFree(lpBuffer);
            FreeLibrary(iResultCode);
        Finally
        end;
    end;