# Win10 C6 Directory() 8min 40 secs, C11 Directory() 31mins 47 seconds

**URL:** <https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574>\
**Category:** uncategorized\
**Created:** [October 28, 2022, 5:34pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574 "2022-10-28T17:34:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [October 28, 2022, 5:34pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/1 "2022-10-28T17:34:26Z")

</div>

C6 app on Win10, can scan the hard drive for all subfolders in 8min 40 seconds using logout/commit.  
Same source code compiled in C11 on Win10, takes 31mins 47 seconds.

Any ideas why C11 takes more time?

TIA

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [October 28, 2022, 6:55pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/2 "2022-10-28T18:55:28Z")

</div>

Perhaps running on a small folder tree and ProcMon would tell you where the bottleneck is between the 2 versions.

I’d test a small folder so that your comparison can actually see something.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [October 28, 2022, 7:17pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/3 "2022-10-28T19:17:39Z")

</div>

for example, Carl discovered this stuff about REMOVE()

> [@Test if Close(Report) is SLOW on your System? – Mine 100x slower than C6](https://clarionhub.com/t/test-if-close-report-is-slow-on-your-system-mine-100x-slower-than-c6/4491/31):
>
> I created a GIST with my FileApiRemove() that can be used to replace calls to the RTL REMOVE(String) function. It calls the API DeleteFile(). It sets the RTL ErrorCode() and Error() so no other code changes are required. This is faster and safer. MODULE('ClaApi') !These Error functions have been in the RTL forever and appear in LibSrc but are not documented SetError(LONG ErrNumberToSet),NAME('Cla$SetError'),DLL(DLL\_Mode) ClearError(),NAME('Cla$ClearError'),DLL(DLL\_Mode…

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [October 28, 2022, 8:01pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/4 "2022-10-28T20:01:10Z")

</div>

> [@anon23294430](#):
>
> using logout/commit.  
> Same source code compiled in C11

Show or attach the source.

What does Logout/Commit have to do with using Directory() ?

---

<div class="post-metadata">

**Author:** ![anon77170705](https://clarionhub.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@anon77170705](https://clarionhub.com/u/anon77170705)\
**Post date:** [October 28, 2022, 8:34pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/5 "2022-10-28T20:34:50Z")

</div>

> [@Test if Close(Report) is SLOW on your System? – Mine 100x slower than C6](https://clarionhub.com/t/test-if-close-report-is-slow-on-your-system-mine-100x-slower-than-c6/4491/31):
>
> It calls the API DeleteFile(). It sets the RTL ErrorCode() and Error() so no other code changes are required. This is faster and safer.

DeleteFile does not support wildcards in the parameter string. Clarion’s REMOVE - supports. If parameter of REMOVE is a name of directory, some extra checkings are required. In future Clarion REMOVE as well as some other file-oriented functions is also resolves mapped and SUBSTed drives, virtual folders, directory injections, etc. because this is related to access rights.

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [October 28, 2022, 9:21pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/6 "2022-10-28T21:21:59Z")

</div>

> [@CarlBarnes](#):
>
> What does Logout/Commit have to do with using Directory() ?

Obviously

```
LOGOUT(1, dirName)
DIRECTORY(dirQ, '*.*', ff_:DIRECTORY)
COMMIT

```

---

<div class="post-metadata">

**Author:** ![ms100](https://clarionhub.com/user_avatar/clarionhub.com/ms100/32/3489_2.png) [@ms100](https://clarionhub.com/u/ms100)\
**Post date:** [October 30, 2022, 4:26pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/7 "2022-10-30T16:26:56Z")

</div>

sorry, but I don’t understand the use of LOGOUT/COMMIT in that case.  
Can you explaint it. thanks

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [October 30, 2022, 5:57pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/8 "2022-10-30T17:57:11Z")

</div>

This is a topic starter’s lifehack.

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [October 31, 2022, 9:28am UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/9 "2022-10-31T09:28:28Z")

</div>

Using logout/Commit to dump the Directory file queue into a tps file, there are lots of ways I’ve been trying this, like on a 100 second logout, and then if the commit code is encountered within 95 to 100 seconds, it automatically commits and things like that.

ie  
Directory(File:Queue,Path,etc)  
Counter = 0  
Logout(100,TPSFile)  
Loop Records(File:Queue) times  
Counter +=1  
Get(File:Queue,Counter)  
TPSFile.Name = File:Queue.Name  
Access:TPSFile.Insert  
Commit

One thing I think is an overriding factor, is on XP theres a few thousand directories, on Win10 I have 160,000 subfolders, so I’m trying the  
[FindFirstFileA function (fileapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilea)  
[FindNextFileA function (fileapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilea)  
api’s to see which is quicker, I dont know if the transacted api might be faster than the above or not, but I need to log all the files on various media, and hash their contents to spot when any changes occur.

I basically need to log every change that occurs on my PC’s to spot when stuff is being tampered with, like templates changed back to earlier versions and embed clw code changed, which is a form of resource burning me, a security services/military technique but also a criminal one. This is one of the reasons why I have been writing so many of my own templates, because a change in clw code can be explained as human error, templates that work in multiple apps, are harder to explain as human error where the template is used in multiple apps, and the generated clw code is different, highlighting the template may have been tampered with or the clw tampered with between the small window of opportunity that exists between generation and compilation.

A classic example of tampering with code which can alter the behaviour is this post

> [@In what Clarion base CLW / INC does the INI saving get done? maximized window on 2nd monitor](https://clarionhub.com/t/in-what-clarion-base-clw-inc-does-the-ini-saving-get-done-maximized-window-on-2nd-monitor/5525/3):
>
> its in ABUTIL.CLW to fix the problem find : INIClass.Update PROCEDURE (STRING ProcedureName, WINDOW W) comment out the AND not maximized part of if statement !change this IF NOT Info.Minimized AND NOT Info.Maximized IF NOT Info.Minimized this will keep those settings in the INI if you comment out the minimized part, the window will mess up if it closes minimized.

so if everything is being logged and hashed like using techniques similar to that seen in cryptocurrency to authenticate & log changes, it gets harder to insert backdoors as bugs. I know subversion is supposed to partly address this problem but its got its problems.

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [October 31, 2022, 9:34am UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/10 "2022-10-31T09:34:18Z")

</div>

With Directory, I have to run through the directory file queue and strip out the old dos directory single and double dot and also the files because despite only using the attrib flag for directory, its still pulling in files, and there is a chance, havent counted that the avg number of files per folder have also gone up in Win10 compared to XP.

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [October 31, 2022, 11:09pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/11 "2022-10-31T23:09:20Z")

</div>

> [@anon23294430](#):
>
> Using logout/Commit to dump the Directory file queue into a tps file

Hi Richard

first thing to determine is whether the time difference is due to the directory() command (which is what I thought from the original post) or if it is due to writing out to the tps file.

so time each part separately and compare

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [November 1, 2022, 12:35am UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/12 "2022-11-01T00:35:23Z")

</div>

I will know shortly if its the difference between api’s. I suspect the Clarion Directory() is using FindFirstFile and not FindFirstFileExA

Namely  
[FindFirstFileExA function (fileapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfileexa)  
has these options  
[FINDEX\_INFO\_LEVELS (minwinbase.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ne-minwinbase-findex_info_levels)

This one caught my eye.

> `FindExInfoBasic`  
> The [FindFirstFileEx](https://learn.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfileexa) function does not query the short file name, improving overall enumeration speed. The data is returned in a  
> [WIN32\_FIND\_DATA](https://learn.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-win32_find_dataa) structure, and the **cAlternateFileName**  
> member is always a **NULL** string.
> 
> **Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:** This value is not supported until Windows Server 2008 R2 and Windows 7.

You see even though the clarion Directory() function help doc suggests I should be able to use the ff\_:Directory equate to filter the results, that doesnt work. I have to specify a wildcard at the end of the path and include ff\_:Directory to get it to include the subfolders. I then have to loop through the queue and ignore all entries ie files which are not subfolders.

Anyway just finishing off a class to use the various apis related to FindFirstFileA and FindFirstFileExA etc as I can get more info from these api’s which will be useful.

---

<div class="post-metadata">

**Author:** ![RichCPT](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@RichCPT](https://clarionhub.com/u/RichCPT)\
**Post date:** [November 1, 2022, 7:52pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/13 "2022-11-01T19:52:25Z")

</div>

RichClaCode,  
Maybe accessing the files on NTFS drives via the MFT data structures is what you need here?  
From your other posts, I’m assuming you might be able to utilize the following technical article:  
[Super Fast File Enumeration with NTFS Structures](https://blogs.msmvps.com/bsonnino/2019/03/22/super-fast-file-enumeration-with-ntfs-structures/)

---

<div class="post-metadata">

**Author:** ![anon77170705](https://clarionhub.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@anon77170705](https://clarionhub.com/u/anon77170705)\
**Post date:** [November 1, 2022, 8:44pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/14 "2022-11-01T20:44:14Z")

</div>

> [@RichCPT](#):
>
> Maybe accessing the files on NTFS drives via the MFT data structures is what you need here?

One of my hard disks is of Ext4 file system. Windows accesses it using the [Paragon Linux FS driver](https://www.paragon-software.com/us/home/linuxfs-windows/#). I have 2 letters to mapped drives on the home NAS. How suggested way can help with these drives? Incomplete solution = no solution.

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [November 1, 2022, 10:21pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/15 "2022-11-01T22:21:00Z")

</div>

I’ve also been looking at [FindFirstFileTransactedA function (winbase.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-findfirstfiletransacteda) to see what the speed is like. Still testing, but I’ll check out your link thanks it looks interesting.

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [November 1, 2022, 10:27pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/16 "2022-11-01T22:27:03Z")

</div>

I had that Paragon Linux Ext Driver, I’m surprised you got it to work on windows, I got a refund because it didnt work properly on my machine, it was easier to just setup a Linux NAS with a variety of file systems and plonk [Samba - opening windows to a wider world](https://www.samba.org/) on the linux box so files could be accessed via SMB.

I understand what you are saying though, if you cant access a drive, how can you audit it. Market share is what I’m going after for now.

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [November 2, 2022, 2:08pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/17 "2022-11-02T14:08:50Z")

</div>

> [@RichCPT](#):
>
> Maybe accessing the files on NTFS drives via the MFT data structures

According to the linked article the process needs to be “Elevated”. That’s ok for something I run on my PC but not for end users.

> To access the MFT structures, you must have elevated privileges – a normal user won’t be able to access it

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [November 2, 2022, 2:15pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/18 "2022-11-02T14:15:43Z")

</div>

> [@anon23294430](#):
>
> You see even though the clarion Directory() function help doc suggests I should be able to use the ff\_:Directory equate to filter the results, that doesnt work.

The help clearly states that is NOT how it works… It ALWAYS has Files…

> If you add ff\_:DIRECTORY to ff\_:NORMAL, you will get files AND sub-directories from the _path_ . Since ff\_:NORMAL is an equate for zero (0), you will always get files.

> **[directory\_get\_file\_directory\_.htm \[Clarion Community Help\]](https://clarion.help/doku.php?id=directory_get_file_directory_.htm)**

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [November 2, 2022, 2:26pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/19 "2022-11-02T14:26:12Z")

</div>

> [@anon23294430](#):
>
> You see even though the clarion Directory() function help doc suggests I should be able to use the ff\_:Directory equate to filter the results, that doesnt work.

> The **DIRECTORY** procedure returns a directory listing of all files in the _path_ with the specified _attributes_ into the specified _queue_ .

The help doc clearly states it returns a directory listing of all files in the _path_ with the specified _attributes_ into the specified _queue_.

But its not working like the help docs clearly states.

---

<div class="post-metadata">

**Author:** ![anon23294430](https://clarionhub.com/user_avatar/clarionhub.com/anon23294430/32/3829_2.png) [@anon23294430](https://clarionhub.com/u/anon23294430)\
**Post date:** [November 2, 2022, 2:28pm UTC](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574/20 "2022-11-02T14:28:43Z")

</div>

If you copy an app using api’s which need to be elevated onto a windows OS which uses elevation, the app’s application icon is automatically modified to include the elevation shield. This is without having to run the app, which suggests windows is analyzing all files copied onto a running OS.

Makes a mockery of the ransomware sideshow doesnt it!

Edit.

Its interesting the very first folder created during installation of windows on xp is  
c:\windows  
then  
c:\windows\system32  
c:\windows\system32\config  
c:\windows\system32\ras  
c:\windows\system32\spool  
c:\windows\system32\spool\drivers  
and so on. It gives an insight it how windows installs itself and what its installing first and why.

[Next page](https://clarionhub.com/t/win10-c6-directory-8min-40-secs-c11-directory-31mins-47-seconds/5574.md?page=2)
