Author Topic: GetFolders  (Read 79 times)

clamicun

  • Member
  • ***
  • Posts: 250
GetFolders
« on: December 12, 2017, 09:08:58 AM »
Hi JJ,
I bought me a new machine ... Windows 10 Home 64b
By coincidence I used an old prog which contains:

Let esi="C:\"
GetFolders esi   
mov .....

The prog goes down badly.

Works fine on drive D and E which are much smaller.

Any idea ?

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7758
  • Assembler is fun ;-)
    • MasmBasic
Re: GetFolders
« Reply #1 on: December 12, 2017, 10:34:44 AM »
What do you mean with "goes down badly"? It hangs, it throws an exception, ...?

On my Win7-64, I get over 100,000 folders without problems. I will investigate...

On Win10, Explorer chokes on a folder C:\Windows.old\WINDOWS\SOFTWA~1\Download\E6ED64~1\AMD64_~1.15\AM2F8C~1.15 _
Note the attempt to use DOS-style short names ::)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7758
  • Assembler is fun ;-)
    • MasmBasic
Re: GetFolders
« Reply #2 on: December 13, 2017, 01:08:39 AM »
Hi Clamicun,

It seems I found the culprit. Can you test the attached exe and post the result?

Thanks,
Jochen


On my Win10 home machine:
Code: [Select]
files#  eax             87796

GetFiles
stk_in          1702684
stk_out         1653512
stk_flen        566
stk_flen[4]     2080
ecx             49172

GetFiles
stk_in          0019FB1C
stk_out         00193B08
stk_flen        00000236

clamicun

  • Member
  • ***
  • Posts: 250
Re: GetFolders
« Reply #3 on: December 13, 2017, 03:13:03 AM »
Yes, it is C:\Windows.old which I do not succeed to delete ? ... MS is the owner of my new machine

clamicun

  • Member
  • ***
  • Posts: 250
Re: GetFolders
« Reply #4 on: December 13, 2017, 03:17:06 AM »
GetFilestest does it:  68433 files

clamicun

  • Member
  • ***
  • Posts: 250
Re: GetFolders
« Reply #5 on: December 13, 2017, 04:00:55 AM »
include \masm32\MasmBasic\MasmBasic.inc   ; requires jjRecTest lib version!
;include Include\cmc_macros.inc
 Init
  Let esi="C:\"
  GetFolders esi
 ; show_value eax,"folders"
  deb 4, "files", eax
  Externdef   stk_in:DWORD
  Externdef   stk_out:DWORD
  Externdef   stk_flen:DWORD
  mov ecx, stk_in
  sub ecx, stk_out
  deb 4, "GetFiles", stk_in, stk_out, stk_flen, stk_flen[4], ecx
  usedeb=16
  deb 4, "GetFiles", stk_in, stk_out, stk_flen
  Inkey "ok?"
EndOfCode

OPT_Debug   1



I have to admit, I never understood the file.asc business.
This one in RichMasm.exe gives me:

POLINK: error: Unresolved external symbol '_stk_in'.
POLINK: error: Unresolved external symbol '_stk_out'.
POLINK: error: Unresolved external symbol '_stk_flen'.
POLINK: fatal error: 3 unresolved external(s).
*** Link error ***


jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7758
  • Assembler is fun ;-)
    • MasmBasic
Re: GetFolders
« Reply #6 on: December 13, 2017, 04:35:37 AM »
I have to admit, I never understood the file.asc business.

The source does not build because it requires a debug version of MasmBasic.lib
I have solved the issue, new lib attached (temporary, for testing), to build it you have to comment out the stk_?? bits.

clamicun

  • Member
  • ***
  • Posts: 250
Re: GetFolders
« Reply #7 on: December 13, 2017, 04:41:51 AM »
Thank you,
and btw.  I see Windows.old is removable with Disk Cleanup.
So the problem with GetFolders has vanished anyway.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7758
  • Assembler is fun ;-)
    • MasmBasic
Re: GetFolders
« Reply #8 on: December 13, 2017, 04:52:05 AM »
Congrats ;)
But there was a buffer overflow risk, and you helped me find it, thanks :icon14:
Btw it seems many people had problems with that folder, the web is full of desperate people trying to delete Windows.old :P