Mark Russinovich Systernals WinObj but in Clarion written

I wrote a while ago https://docs.microsoft.com/en-us/sysinternals/downloads/winobj but in Clarion
Up here the code:

GetNTObjectsR ROUTINE

UTF16_INPUT_UPPER_CHARLEN = Size(UTF16_INPUT_UPPER) / 2
UTF16_OUTPUT_UPPER_CHARLEN = Size(UTF16_OUTPUT_UPPER) / 2

LBufferSize             = Size(LBUFFER2MB)
QNTQDirectoryRecords    = 0
Root#                   = 1
FirstAddress#           = 0

QNTQDirectorySeed               = QNTQDirectorySeed + 1
QNTQDirectory.Id                = QNTQDirectorySeed
QNTQDirectory.Index             = 1
QNTQDirectory.InTree            = True
QNTQDirectory.QWinObjectTreeId  = 1
QNTQDirectory.NameLen           = 2  
QNTQDirectory.NameMaxLen        = 4
QNTQDirectory.NamePtr           = 0
QNTQDirectory.NameA             = ''
QNTQDirectory.Name              = ''
QNTQDirectory.NameUpperA        = ''
QNTQDirectory.NameUpper         = ''
QNTQDirectory.TypeLen           = Len('Directory') * 2
QNTQDirectory.TypeMaxLen        = QNTQDirectory.TypeLen + 2
QNTQDirectory.TypePtr           = 0
QNTQDirectory.TypeA             = 'Directory'
QNTQDirectory.TypeUpperA        = 'DIRECTORY'
ANSI_STRING_INPUT               = QNTQDirectory.TypeA
DO AnsiToUTF16
QNTQDirectory.Type              = Clip(UTF16_OUTPUT) & UTF16ZERO
ANSI_STRING_INPUT               = QNTQDirectory.TypeUpperA
DO AnsiToUTF16
QNTQDirectory.TypeUpper         = Clip(UTF16_OUTPUT) & UTF16ZERO
Add(QNTQDirectory)


QWinObjectTreeSeed              = QWinObjectTreeSeed + 1
QWinObjectTree.Id               = QWinObjectTreeSeed             
QWinObjectTree.Processed        = 0
QWinObjectTree.QNTDirectoryId   = 1
QWinObjectTree.ObjectType       = QNTQDirectory.TypeUpperA
QWinObjectTree.Level            = 1
QWinObjectTree.LineA            = '\'
QWinObjectTree.LineUpperA       = '\'
QWinObjectTree.Line             = '\' & Chr(0)
QWinObjectTree.LineLen          = 0
QWinObjectTree.Name             = ''
QWinObjectTree.NameLen          = 0
QWinObjectTree.ParentPath       = ''
QWinObjectTree.ParentPathLen    = 0
QWinObjectTree.Path             = '\' & Chr(0)
QWinObjectTree.PathLen          = 2
QWinObjectTree.Type             = QNTQDirectory.Type
QWinObjectTree.TypeLen          = QNTQDirectory.TypeLen
Add(QWinObjectTree)

QWinObjTreeOrder.Id                     = QWinObjectTree.Id                
QWinObjTreeOrder.ParentId               = QWinObjectTree.ParentId
QWinObjTreeOrder.Level                  = QWinObjectTree.Level
QWinObjTreeOrder.QWinObjectTreeIndex    = Records(QWinObjectTree)
QWinObjTreeOrder.LineA                  = QWinObjectTree.LineA
Add(QWinObjTreeOrder)    

RestartScan                      = 1

QWinObjectTreeIndex             = 0
QWinObjectTreeLevel             = 1
NtQueryDirectoryObjectIndex     = -1
Loop 10000 Times
    QWinObjectTreeIndex = QWinObjectTreeIndex + 1
    If QWinObjectTreeIndex > Records(QWinObjectTree)
        Break
    End
    Get(QWinObjectTree,QWinObjectTreeIndex)
    If QWinObjectTree.Processed = 1
        Cycle
    End
    QWinObjectTree.Processed = 1
    Put(QWinObjectTree)
    If QWinObjectTree.ObjectType <> 'DIRECTORY' AND QWinObjectTree.ObjectType <> 'SYMBOLICLINK'
        CYCLE
     End
    
    If QWinObjectTree.Id = 1
        QWinObjectTreePath      = '\' & Chr(0) & UTF16ZERO
        QWinObjectTreePathLen   = 2
    Else
        If QWinObjectTree.PathLen > 0 And QWinObjectTree.NameLen > 0
            QWinObjectTreePath      = QWinObjectTree.Path[1 : QWinObjectTree.PathLen] & UTF16ZERO
            QWinObjectTreePathLen   = QWinObjectTree.PathLen

! QWinObjectTreePath = QWinObjectTree.Path[1 : QWinObjectTree.PathLen] & ‘’ & Chr(0) & QWinObjectTree.Name[1 : QWinObjectTree.NameLen] & UTF16ZERO
! QWinObjectTreePathLen = QWinObjectTree.PathLen + 2 + QWinObjectTree.NameLen
Else
Message(’!error, should never happen’)
Cycle
End
End

    QWinObjectTreeId        = QWinObjectTree.Id

    QWinObjectTreeName      = QWinObjectTree.Name
    QWinObjectTreeNameLen   = QWinObjectTree.NameLen
    

    Clear(PUNICODE_STRING)
    NTSTATUS = WdmlibRtlInitUnicodeStringEx(Address(PUNICODE_STRING),ADDRESS(QWinObjectTreePath))
    If NTSTATUS <> 0
        CYCLE
    End
    Clear(OBJECT_ATTRIBUTES)
    OBJECT_ATTRIBUTES.Length                    = Size(OBJECT_ATTRIBUTES)
    OBJECT_ATTRIBUTES.RootDirectory             = 0
    OBJECT_ATTRIBUTES.ObjectName                = Address(PUNICODE_STRING)
    OBJECT_ATTRIBUTES.Attributes                = 0
    OBJECT_ATTRIBUTES.SecurityDescriptor        = 0
    OBJECT_ATTRIBUTES.SecurityQualityOfService  = 0

    Case QWinObjectTree.ObjectType
    Of 'DIRECTORY'        
        NTSTATUS = NtOpenDirectoryObject(Address(hDirectory), DIRECTORY_QUERY + DIRECTORY_TRAVERSE, Address(OBJECT_ATTRIBUTES))
        If NTSTATUS <> 0
            QWinObjectTree.NTOpenNTSTATUS       = NTSTATUS
            QWinObjectTree.NTOpenLastError      = GetLastError()
            QWinObjectTree.NTOpenNTSTATUSHex    = st.LongToHex(NTSTATUS)
            
            QNTSTAT:ErrorCode                   = NTSTATUS
            Get(QNTSTATUS,QNTSTAT:ErrorCode)
            If Errorcode() = 0
                QWinObjectTree.NTOpenNTSTATUSName = QNTSTATUS.ErrorName
            End
            
            Put(QWinObjectTree)
            CYCLE
        End

! QNoErrorNTOpen.Name = QWinObjectTree.ObjectType
! Get(QNoErrorNTOpen,+QNoErrorNTOpen.Name)
! If Errorcode() <> 0
! Add(QNoErrorNTOpen,+QNoErrorNTOpen.Name)
! End

    Of 'SYMBOLICLINK'
        NTSTATUS = NtOpenSymbolicLinkObject(Address(hSymbolic), GENERIC_READ, Address(OBJECT_ATTRIBUTES))
        If NTSTATUS <> 0
            QWinObjectTree.NTOpenSymNTSTATUS        = NTSTATUS
            QNTSTAT:ErrorCode                       = NTSTATUS
            Get(QNTSTATUS,QNTSTAT:ErrorCode)
            If Errorcode() = 0
                QWinObjectTree.NTOpenSymNTSTATUSName = QNTSTATUS.ErrorName
            End
            Put(QWinObjectTree)
            CYCLE
        Else
            QWinObjectTree.NTOpenSymNTSTATUS       = NTSTATUS
            QWinObjectTree.NTOpenSymNTSTATUSName   = 'OK, got handle ' & hSymbolic
            Put(QWinObjectTree)
        End

!! !SymbolicLinkQueryName = QWinObjectTreeName[1 : QWinObjectTreeNameLen] & UTF16ZERO

        Clear(UTF16_INPUT,-1)
        Clear(ANSI_STRING_OUTPUT,1)
        PUNICODE_STRING.Length = 4096
        PUNICODE_STRING.MaxLength = 4098
        PUNICODE_STRING.PWSTR = Address(LBUFFER2MB)
        
        Clear(PUNICODE_STRING)
        !PUNICODE_STRING.Length = 4096
        !PUNICODE_STRING.MaxLength = 4098
        !PUNICODE_STRING.PWSTR = Address(LBUFFER2MB)
        
        NTSTATUS = NtQuerySymbolicLinkObject(hSymbolic, Address(PUNICODE_STRING), Address(ReturnLength)) 
        If NTSTATUS = STATUS_BUFFER_TOO_SMALL
            PUNICODE_STRING.Length = 4094
            PUNICODE_STRING.MaxLength = 4096
            PUNICODE_STRING.PWSTR = Address(LBUFFER2MB)   
            QWinObjectTree.NTQueryDataLength    = ReturnLength
        ELSE
            QWinObjectTree.NTQuerySymNTSTATUS     = NTSTATUS

! QWinObjectTree.NTQueryLastError = GetLastError()
! QWinObjectTree.NTQueryNTSTATUSHex = st.LongToHex(NTSTATUS)
QNTSTAT:ErrorCode = NTSTATUS
Get(QNTSTATUS,QNTSTAT:ErrorCode)
If Errorcode() = 0
QWinObjectTree.NTQuerySymNTSTATUSName = QNTSTATUS.ErrorName
End
Put(QWinObjectTree)
Cycle
End
LenSymString# = ReturnLength
NTSTATUS = NtQuerySymbolicLinkObject(hSymbolic, Address(PUNICODE_STRING), 0)
If NTSTATUS <> 0
QWinObjectTree.NTQuerySymNTSTATUS = NTSTATUS
! QWinObjectTree.NTQueryLastError = GetLastError()
! QWinObjectTree.NTQueryNTSTATUSHex = st.LongToHex(NTSTATUS)
QNTSTAT:ErrorCode = NTSTATUS
Get(QNTSTATUS,QNTSTAT:ErrorCode)
If Errorcode() = 0
QWinObjectTree.NTQuerySymNTSTATUSName = QNTSTATUS.ErrorName
End
Put(QWinObjectTree)
Cycle
Else
QWinObjectTree.NTOpenSymNTSTATUS = NTSTATUS
QWinObjectTree.NTQuerySymNTSTATUSName = ‘OK, data’
Put(QWinObjectTree)
End
If ReturnLength > 0
UTF16_INPUT = LBUFFER2MB[1 : ReturnLength-2] !PUNICODE_STRING.Length

            QWinObjectTree.SymbolicLink         = UTF16_INPUT
            Do UTF16ToAnsi
            QWinObjectTree.SymbolicLinkA        = ANSI_STRING_OUTPUT
            
            Put(QWinObjectTree)   
            
            
            QWinObjTreeOrder.Id                     = QWinObjectTree.Id    
            Get(QWinObjTreeOrder,+QWinObjTreeOrder.Id)
            If Errorcode() = 0

! QWinObjTreeOrder.ParentId = QWinObjectTree.ParentId
! QWinObjTreeOrder.Level = QWinObjectTree.Level
! QWinObjTreeOrder.QWinObjectTreeIndex = Position(QWinObjectTree)
! QWinObjTreeOrder.LineA = QWinObjectTree.LineA
QWinObjTreeOrder.SymbolicLinkA = QWinObjectTree.SymbolicLinkA
! QWinObjTreeOrder.LineUpperA = QWinObjectTree.LineUpperA
! QWinObjTreeOrder.ObjectTypeA = QWinObjectTree.ObjectType
Put(QWinObjTreeOrder)
End
End
If hSymbolic <> 0
CloseHandle(hSymbolic)
hSymbolic = 0
End

        If hDirectory <> 0
            CloseHandle(hDirectory)
            hDirectory = 0
        End  
        
        Cycle
    End        
    QWinObjectTreeLevel             = QWinObjectTree.Level      
    RestartScan                     = 1
    NtQueryDirectoryObjectIndex     = 0
    QWOTreeNTQueriedTimes           = 0
    QWinObjectTreeOrdinal           = 0
    Loop 100 times ! usually 1 cycle only
        Clear(LBUFFER2MB)
        OffsetFieldNamesAndTypes = 0
        NTSTATUS = NtQueryDirectoryObject(hDirectory, Address(LBUFFER2MB), Size(LBUFFER2MB), FALSE, RestartScan, Address(NtQueryDirectoryObjectIndex), Address(ReturnLength))    
        If NTSTATUS <> 0
            QWinObjectTree.NTQueryNTSTATUS      = NTSTATUS
            QWinObjectTree.NTQueryLastError     = GetLastError()
            QWinObjectTree.NTQueryNTSTATUSHex   = st.LongToHex(NTSTATUS)
            
            QNTSTAT:ErrorCode                   = NTSTATUS
            Get(QNTSTATUS,QNTSTAT:ErrorCode)
            If Errorcode() = 0
                QWinObjectTree.NTQueryNTSTATUSName = QNTSTATUS.ErrorName
            End                
            
            Put(QWinObjectTree)
            BREAK
        End              
        QWinObjectTree.NTQueryObjectIndex   = NtQueryDirectoryObjectIndex
        QWinObjectTree.NTQueryDataLength    = ReturnLength
        QWOTreeNTQueriedTimes               = QWOTreeNTQueriedTimes + 1
        QWinObjectTree.NTQueriedTimes       = QWOTreeNTQueriedTimes
        Put(QWinObjectTree)
        
        If RestartScan = 1
            RestartScan = 0
        End
        
        LBUFPOS                 = 1
        QNTQDirectoryPos        = 0
        QNTQDirectoryRecords    = 0
        LOOP 100000 Times
            Clear(QNTQDirectory)
            QNTQDirectoryPos = QNTQDirectoryPos + 1
            If LBUFPOS + 16 > LBufferSize
                BREAK
            End
            If QNTQDirectoryRecords > 0
                If LBUFPOS + 16 > QNTQDirectoryRecords
                    BREAK
                End
            End
            QNTQDirectory.Index             = QNTQDirectoryPos
            QNTQDirectory.QWinObjectTreeId  = QWinObjectTree.Id
            
            QNTQDirectory.NameLen           = GetU16(LBUFFER2MB[LBUFPOS : LBUFPOS + 1])
            LBUFPOS                         = LBUFPOS + 2
            QNTQDirectory.NameMaxLen        = GetU16(LBUFFER2MB[LBUFPOS : LBUFPOS + 1])
            LBUFPOS                         = LBUFPOS + 2
            QNTQDirectory.NamePtr           = GetU32(LBUFFER2MB[LBUFPOS : LBUFPOS + 3])
            LBUFPOS                         = LBUFPOS + 4
            
            QNTQDirectory.TypeLen           = GetU16(LBUFFER2MB[LBUFPOS : LBUFPOS + 1])
            LBUFPOS                         = LBUFPOS + 2
            QNTQDirectory.TypeMaxLen        = GetU16(LBUFFER2MB[LBUFPOS : LBUFPOS + 1])
            LBUFPOS                         = LBUFPOS + 2
            QNTQDirectory.TypePtr           = GetU32(LBUFFER2MB[LBUFPOS : LBUFPOS + 3])
            LBUFPOS                         = LBUFPOS + 4                    
            
            If QNTQDirectory.NameLen = 0 And QNTQDirectory.NameMaxLen = 0 And QNTQDirectory.NamePtr = 0 And QNTQDirectory.TypeLen = 0 And QNTQDirectory.TypeMaxLen = 0 And QNTQDirectory.TypePtr = 0
                BREAK
            End
            
            QNTQDirectorySeed   = QNTQDirectorySeed + 1
            QNTQDirectory.Id    = QNTQDirectorySeed
            Add(QNTQDirectory)
            
            If QNTQDirectoryPos = 1                
                OffsetFieldNamesAndTypes = QNTQDirectory.NamePtr - Address(LBUFFER2MB) + 1
            End
            If LBUFPOS > ReturnLength
                BREAK
            End
        End
        LBUFPOS = OffsetFieldNamesAndTypes
        QNTQDirectoryPos    = 0
        Loop Records(QNTQDirectory) Times
            QNTQDirectoryPos = QNTQDirectoryPos + 1
            Get(QNTQDirectory,QNTQDirectoryPos)
            If QNTQDirectory.Id = 1
                CYCLE
            End
            If QNTQDirectory.QWinObjectTreeId <> QWinObjectTreeId
                CYCLE
            End
            If QNTQDirectory.NameLen > 0
                If LBUFPOS + QNTQDirectory.NameLen - 1 >= LBUFPOS
                    QNTQDirectory.Name          = LBUFFER2MB[LBUFPOS : LBUFPOS + QNTQDirectory.NameLen - 1]
                    UTF16_TO_ANSI_UPPER         = QNTQDirectory.Name
                    DO UTF16ToAnsiUpper          
                    QNTQDirectory.NameA         = ANSI_OUT
                    QNTQDirectory.NameUpperA    = ANSI_OUT_UPPER
                    QNTQDirectory.NameUpper     = UTF16_OUTPUT_UPPER
                End
            End
            LBUFPOS = LBUFPOS + (QNTQDirectory.NameMaxLen)
            If QNTQDirectory.TypeLen > 0
                If LBUFPOS + QNTQDirectory.TypeLen - 1 >= LBUFPOS
                    QNTQDirectory.Type          = LBUFFER2MB[LBUFPOS : LBUFPOS + QNTQDirectory.TypeLen - 1]
                    UTF16_TO_ANSI_UPPER         = QNTQDirectory.Type
                    DO UTF16ToAnsiUpper          
                    QNTQDirectory.TypeA         = ANSI_OUT
                    QNTQDirectory.TypeUpperA    = ANSI_OUT_UPPER
                    QNTQDirectory.TypeUpper     = UTF16_OUTPUT_UPPER
                End
            End
            LBUFPOS = LBUFPOS + (QNTQDirectory.TypeMaxLen)
            Put(QNTQDirectory)
            
            
            QWinObjectTreeSeed              = QWinObjectTreeSeed + 1
            QWinObjectTree.Id               = QWinObjectTreeSeed    
            QWinObjectTree.ParentId         = QWinObjectTreeId
            QWinObjectTreeOrdinal           = QWinObjectTreeOrdinal + 1
            QWinObjectTree.Ordinal          = QWinObjectTreeOrdinal
            If QWinObjectTree.ObjectType = 'SYMBOLICLINK'
                !QWinObjectTree.Processed        = 1
            Else
                QWinObjectTree.Processed        = 0
            End
            QWinObjectTree.QNTDirectoryId   = QNTQDirectory.Id            
            QWinObjectTree.ObjectType       = QNTQDirectory.TypeUpperA
            QWinObjectTree.Level            = QWinObjectTreeLevel + 1
            QWinObjectTree.LineA            = QNTQDirectory.NameA
            QWinObjectTree.LineUpperA       = QNTQDirectory.NameUpperA
            QWinObjectTree.Line             = QNTQDirectory.Name
            QWinObjectTree.LineLen          = QNTQDirectory.NameLen
            QWinObjectTree.Name             = QNTQDirectory.Name
            QWinObjectTree.NameLen          = QNTQDirectory.NameLen
            
            If QWinObjectTreePathLen > 2
                QWinObjectTree.Path             = QWinObjectTreePath[1 : QWinObjectTreePathLen] & '\' & Chr(0) & QWinObjectTree.Name[1 : QWinObjectTree.NameLen]
                QWinObjectTree.PathLen          = QWinObjectTreePathLen + 2 + QWinObjectTree.NameLen 
            ELSE
                QWinObjectTree.Path             = '\' & Chr(0) & QWinObjectTree.Name[1 : QWinObjectTree.NameLen]
                QWinObjectTree.PathLen          = 2 + QWinObjectTree.NameLen 
            End
            
            QWinObjectTree.ParentPath       = QWinObjectTreePath
            QWinObjectTree.ParentPathLen    = QWinObjectTreePathLen  

! Clear(QWinObjectTree.SymbolicLink)
! Clear(QWinObjectTree.SymbolicLinkLen)
! Clear(QWinObjectTree.SymbolicLinkA)
! Clear(QWinObjectTree.SymbolicLinkALen)

            QWinObjectTree.Type             = QNTQDirectory.Type
            QWinObjectTree.TypeLen          = QNTQDirectory.TypeLen
            Add(QWinObjectTree)  
            

            QWinObjTreeOrder.Id                     = QWinObjectTree.Id                
            QWinObjTreeOrder.ParentId               = QWinObjectTree.ParentId
            QWinObjTreeOrder.Level                  = QWinObjectTree.Level
            QWinObjTreeOrder.QWinObjectTreeIndex    = Position(QWinObjectTree)
            QWinObjTreeOrder.LineA                  = QWinObjectTree.LineA
            QWinObjTreeOrder.SymbolicLinkA          = QWinObjectTree.SymbolicLinkA
            QWinObjTreeOrder.LineUpperA             = QWinObjectTree.LineUpperA
            QWinObjTreeOrder.ObjectTypeA            = QWinObjectTree.ObjectType
            
            UTF16_INPUT = QWinObjectTree.ParentPath
            Do UTF16ToAnsi
            QWinObjTreeOrder.FullPathA              = ANSI_STRING_OUTPUT
            
            QWinObjTreeOrder.FullPathLen            = QWinObjectTree.ParentPathLen
            Add(QWinObjTreeOrder)
            
        End
    End
    
    If hDirectory <> 0
        CloseHandle(hDirectory)
        hDirectory = 0
    End
End

HighestQWinObjectTreeParentId = 0
HighestQWinObjectTreeLevel = 0
Pos = 0
RecordsQWinObjectTree = Records(QWinObjectTree)
Loop RecordsQWinObjectTree Times
    Pos = Pos + 1
    Get(QWinObjectTree,Pos)
    If HighestQWinObjectTreeParentId < QWinObjectTree.Id
        HighestQWinObjectTreeParentId = QWinObjectTree.Id 
    End
    If HighestQWinObjectTreeLevel < QWinObjectTree.Level
        HighestQWinObjectTreeLevel = QWinObjectTree.Level 
    End
End
Clear(QWinObjTree)
Free(QWinObjTree)

Sort(QWinObjTreeOrder,+QWinObjTreeOrder.Level,+QWinObjTreeOrder.LineUpperA)

Get(QWinObjTreeOrder,1)
QWinObjTree.Line            = QWinObjTreeOrder.LineA
QWinObjTree.Level           = QWinObjTreeOrder.Level
QWinObjTree.Id              = QWinObjTreeOrder.Id
QWinObjTree.ParentId        = QWinObjTreeOrder.ParentId
QWinObjTree.ObjectTypeA     = QWinObjTreeOrder.ObjectTypeA
QWinObjTree.SymbolicLinkA   = QWinObjTreeOrder.SymbolicLinkA
QWinObjTree.ObjectTypeA     = QWinObjTreeOrder.ObjectTypeA
QWinObjTree.FullPathA       = QWinObjTreeOrder.FullPathA
Add(QWinObjTree)

QWinObjectTreeLevel = 2 ! get the next level
Loop !1 Times
    G# = 0
    Loop
        G# = G# + 1
        If G# > Records(QWinObjTree)
            break
        End
        Get(QWinObjTree,G#)
        GPos# = G#
        QWinObjectTreeParentId = QWinObjTree.Id
        !Message('QWinObjectTreeParentId : ' & QWinObjectTreeParentId)
        G2# = 0
        R2# = Records(QWinObjTreeOrder)
        LOOP
            G2# = G2# + 1
            If G2# > R2#
                break
            End
            Get(QWinObjTreeOrder,G2#)
            If QWinObjTreeOrder.Level < QWinObjectTreeLevel
                Cycle
            End
            If QWinObjTreeOrder.Level > QWinObjectTreeLevel
                break
            End                
            If QWinObjTreeOrder.ParentId = QWinObjectTreeParentId
                !QWinObjTree.Line            = UPPER(Clip(QWinObjTreeOrder.ObjectTypeA)) & ', ' & QWinObjTreeOrder.LineA
                QWinObjTree.Line            = QWinObjTreeOrder.LineA
                QWinObjTree.Level           = QWinObjTreeOrder.Level
                QWinObjTree.Id              = QWinObjTreeOrder.Id
                QWinObjTree.ParentId        = QWinObjTreeOrder.ParentId
                QWinObjTree.SymbolicLinkA   = QWinObjTreeOrder.SymbolicLinkA
                CASE UPPER(Clip(QWinObjTreeOrder.ObjectTypeA))
                Of 'DIRECTORY'
                    QWinObjTree.IconId = 1
                Of 'SYMBOLICLINK'
                    QWinObjTree.IconId = 2
                ELSE
                    QWinObjTree.IconId = 0
                END
                
                GPos# = GPos# + 1
                
                QWinObjTree.ObjectTypeA = QWinObjTreeOrder.ObjectTypeA
                QWinObjTree.ObjectTypeLen = QWinObjTreeOrder.ObjectTypeLen
 
                QWinObjTree.FullPathA = QWinObjTreeOrder.FullPathA
                QWinObjTree.FullPathLen = QWinObjTreeOrder.FullPathLen                    
                
                Add(QWinObjTree,GPos#) 
                
                Delete(QWinObjTreeOrder)
                G2# = G2# - 1
                R2# = R2# - 1
                
                G# = G# + 1 ! shift down new get
            End
        End
    END
    ! done all children from this level, level+ and start over
    QWinObjectTreeLevel = QWinObjectTreeLevel + 1
    If QWinObjectTreeLevel > HighestQWinObjectTreeLevel
        break
    END
End
1 Like