Programmatically Retrieving the Name of the Current Network Driver (Functions/Subroutines/Programs)

The following stored procedure will open the file LH.DLL (holds the current network driver) and parse it for the name of the network driver being used, which is returned.

 

 

/**

*  GetLHName

*  Code by: Cameron Purdy

**/

function GetLHName(void)

 

equ BLOCK_SIZE$   to 32768

equ OVERLAP_SIZE$ to 1024

equ NAME_MARKER$  to str(\5A\,8)

 

Name = ""

osopen "LH.DLL" to fh then

  Offset = 0

  loop

    status() = 0

    osbread Block from fh at Offset length BLOCK_SIZE$

  until status()

    Pos = index(Block, NAME_MARKER$, 1)

    if Pos > 0 then

     * marker found; verify that the current block contains the entire name

      if len(Block) # BLOCK_SIZE$ or Pos < BLOCK_SIZE$ - OVERLAP_SIZE$ then

        Name = Block [Pos + len(NAME_MARKER$), "F":\00\]

      end

    end

  until len(Name)

  while len(Block) = BLOCK_SIZE$

   * overlap between reads in case the marker or name is on a block boundary

    Offset += BLOCK_SIZE$ - OVERLAP_SIZE$

  repeat

 

  osclose fh

end

 

return Name

  • kb/kb_articles/kb0122.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1