Author Topic: MasmBasic  (Read 218376 times)

sinsi

  • Member
  • *****
  • Posts: 1090
Re: MasmBasic
« Reply #165 on: April 12, 2014, 10:38:32 PM »
I see the menu problem is still there, in my case the text is yellow and unreadable.
Clicking one seems to stop it from working from then on too, unless you click another menu..
I can walk on water but stagger on beer bourbon.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #166 on: April 12, 2014, 10:46:32 PM »
The crash box is the equivalent to MS Word auto recovery. It happens when user exited an edit session in an, ehm, unusual way. Normally it shouldn't happen, RichMasm is pretty stable, but a forced reboot could cause that, for example. Or killing the editor with Task Manager. I usually click Yes.

Re menus, yes the yellow-brownish font was the compromise for Vista Aero, and I also don't like it. Do the menus work at least? And can you reproduce the hanging?

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
SetLaunchTimeout
« Reply #167 on: April 15, 2014, 08:27:27 AM »
Update 15 April (download here):
Quote
Launch
...
- the default timeout for a "normal" Launch is ten seconds; if you mostly need asynchronous launches,
  you can modify this value with e.g. SetLaunchTimeout 1 (in ms)

And this solved also the little problem with the ten seconds "hanging" of RichMasm ;-)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Windows Safer
« Reply #168 on: April 18, 2014, 09:29:40 AM »
Update 18 April features some improvements of the registry functions:
- SetReg64 allows to read the registry on a 64-bit system
- GetRegVal returns now
  1. a pointer to the string or the data in eax
  2. the type (REG_DWORD ...) in edx
  3. REG_QWORD values in xmm0; same for the first 16 bytes of REG_BINARY
- finally, xmm0 is now a valid argument for the fDate$() and fTime$() macros.

Below an example which reads the "Safer" keys and displays first the "official" LastModified value, and second, the real modification date and time as reported by the registry's timestamp.

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Let esi="HKLM\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers\0\Hashes\"
  GetRegKeyArray esi, My$(), LastMod()
  .if eax
      push eax

      xor ecx, ecx
      PrintLine esi, CrLf$, "... modified according to LastModified value:"
      .Repeat
            ; GetRegVal returns the LastModified REG_QWORD in xmm0:
            void GetRegVal(Cat$(esi+My$(ecx)), "LastModified", 0)
            PrintLine fDate$(xmm0, "dd MMMM yyyy   "), Tb$, fTime$(xmm0), Spc2$, My$(ecx)
            inc ecx
      .Until ecx>=stack

      xor ecx, ecx
      PrintLine CrLf$, "Hashes modified according to registry timestamp:"
      .Repeat
            PrintLine fDate$(LastMod(ecx), "dd MMMM yyyy   "), Tb$, fTime$(LastMod(ecx)), Spc2$, My$(ecx)
            inc ecx
      .Until ecx>=stack

      pop eax
  .endif
  Inkey Str$("\n%i keys found\n", eax)
  Exit
end start


Source & exe attached. The second attachment (RADAR) lists all software on your PC that suffered from a heap leak. Very interesting, but it works only on Windows 7 and higher, so right now I can't test it. Please post some example output :icon_mrgreen:

sinsi

  • Member
  • *****
  • Posts: 1090
Re: MasmBasic
« Reply #169 on: April 18, 2014, 10:00:47 AM »
Quote
Please post some example output
0 keys found
0 keys found

 :biggrin:
I can walk on water but stagger on beer bourbon.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
RADAR
« Reply #170 on: April 18, 2014, 03:44:17 PM »
Hi sinsi,

Yesterday I tested it on Win7, and got the Who's Who of the software industry, Acrobat.exe on top... do you see HKLM\SOFTWARE\Microsoft\RADAR\HeapLeakDetection\DiagnosedApplications\ in regedit, or is it simply absent?

But wait - you are on Win8-64, right? This could do the trick:

  Init
  SetReg64
  Let esi="HKLM\SOFTWARE\Microsoft\RADAR\HeapLeakDetection\DiagnosedApplications\"
  GetRegKeyArray esi, Radar$(), Modified()


Modified package attached.

BTW first tests with SetReg64 failed miserably until I discovered that KEY_WOW64_32KEY was 100h, not 100 as set in Windows.inc (see also Don57,
windows.inc KEY_WOW64_32KEY def'n error
)

sinsi

  • Member
  • *****
  • Posts: 1090
Re: MasmBasic
« Reply #171 on: April 18, 2014, 03:51:29 PM »
 :t
HKLM\SOFTWARE\Microsoft\RADAR\HeapLeakDetection\DiagnosedApplications\
... modified according to Modifiedified value:
03 March 2014           00:00:00  BurnoutParadise.exe
14 May 2013     05:14:28  CNC4.game
21 January 2014         03:50:13  CoDWaW LanFixed.exe
04 August 2013          23:56:45  DllHost.exe
03 February 2014        01:05:19  eduke32.exe
01 April 2014           08:45:25  firefox.exe
09 February 2014        11:13:45  GasGuzzlers.exe
15 September 2013       08:33:07  IEXPLORE.EXE
27 June 2013    09:35:22  Need for Speed The Run.exe
07 January 2014         06:52:41  NFS11.exe
05 April 2014           06:26:25  NFS13.exe
20 November 2013        05:35:14  shift2u.exe
22 December 2013        00:19:09  simnow.exe
30 April 2013           08:29:50  Stronghold3.exe
10 April 2014           06:43:19  TiWorker.exe

15 keys found
I can walk on water but stagger on beer bourbon.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Re: RADAR
« Reply #172 on: April 18, 2014, 03:55:06 PM »
Thanks :biggrin:

Nice to see two competing browsers here. Would be even nicer to see how much they are leaking ;-)

01 April 2014           08:45:25  firefox.exe
15 September 2013       08:33:07  IEXPLORE.EXE

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: MasmBasic
« Reply #173 on: April 18, 2014, 10:38:03 PM »
Jochen,

Code: [Select]
HKLM\SOFTWARE\Microsoft\RADAR\HeapLeakDetection\DiagnosedApplications\
... modified according to Modifiedified value:
06 Februar 2014         00:00:00  ChessProgram13.exe
16 Januar 2014          19:00:27  firefox.exe
07 Oktober 2013         00:06:34  FlashPlayerPlugin_11_8_800_168.exe
12 Januar 2014          16:20:51  FlashPlayerPlugin_11_9_900_170.exe
17 Februar 2014         23:10:44  FlashPlayerPlugin_12_0_0_44.exe
02 April 2014           11:19:31  FlashPlayerPlugin_12_0_0_77.exe

6 keys found

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Re: RADAR
« Reply #174 on: April 19, 2014, 08:25:29 PM »
Thanks. Gunther. How dare you run such old versions of Flash?? I haven't rebooted my machine today, but I am sure Adobe has a better version for us, with better performance and less risks, grosses Indianerehrenwort ;-)

Here results from a rarely used notebook with no Internet connection:

HKLM\SOFTWARE\Microsoft\RADAR\HeapLeakDetection\DiagnosedApplications\
... modified according to ModifiedValue:
05 January 2014         00:00:00  firefox.exe
20 March 2014           17:31:46  InsertDeleteNumArrays.exe
10 November 2012        23:13:25  OllyDbg.exe
04 January 2014         20:15:58  svchost.exe_netsvcs
10 November 2012        20:37:00  TrustedInstaller.exe

Hint: One of these leaky apps is from a well-known hobby coder testing his library ;-)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5945
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MasmBasic
« Reply #175 on: April 19, 2014, 08:35:50 PM »
 :biggrin:

Flash is not the problem I have, its the McCafee crap that is bundled with it. I have to uninstall it every time Flash wants an upgrade.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: MasmBasic
« Reply #176 on: April 19, 2014, 09:03:29 PM »
:biggrin:
Flash is not the problem I have, its the McCafee crap that is bundled with it. I have to uninstall it every time Flash wants an upgrade.

that is the point.

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Bug warning
« Reply #177 on: April 22, 2014, 08:24:45 PM »
ArrayMerge had a problem with differently sized arrays. It is fixed in version 22 April 2014.

The code below will now work correctly.

include \masm32\MasmBasic\MasmBasic.inc
  Init                  ; ## merge two string arrays ##
  Dim Dest$()
  Dim Src$()
  xor ecx, ecx
  .Repeat
      .if ecx<3
            Let Dest$(ecx)=Str$("Destination #%i", ecx)
      .endif
      Let Src$(ecx)=Str$("Source #%i", ecx)
      inc ecx
  .Until ecx>=10
  ArrayMerge Dest$(), Src$()
  push Dest$(?)      ; put the new element counter on the stack
  xor ecx, ecx
  .Repeat
      Print Str$("\n#%i\t", ecx), Dest$(ecx)      ; see dest 0...2, then source 0...9
      inc ecx
  .Until ecx>=stack
  pop eax
  Exit
end start


Output:
#0      Destination #0
#1      Destination #1
#2      Destination #2
#3      Source #0
#4      Source #1
...
#12      Source #9

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
ArraySet
« Reply #178 on: April 25, 2014, 09:26:18 AM »
Version 25 April supports ArraySet for strings and numerical arrays.
Excerpt from MbSnippets.asc:

include \masm32\MasmBasic\MasmBasic.inc
  Init                 
  PrintLine "ArraySet strings:"
  ArraySet My$() = "These", "are", "four", "strings"
  Let My$(My$(?))="Only strings support"      ; My$(?) is the current number
  Let My$(My$(?))="dynamic expansion"         ; of elements in the array
  For_ ecx=0 To My$(?)-1
      PrintLine Str$(ecx), Tb$, My$(ecx)
  Next

  PrintLine CrLf$, "Same with numerical arrays:"  ; could be DWORD, REAL4, REAL8
  Dim MyNum(5) As DWORD      ; create an array with 6 elements (0 .. 5)
  ArraySet MyNum() = 11, 22, 33, 44, 55, 66      ; assign values
  xor ecx, ecx
  .Repeat
      Print Str$(MyNum(ecx)), Spc2$
      inc ecx
  .Until ecx>=MyNum(?)
  Exit
end start

Output:

ArraySet strings:
0       These
1       are
2       four
3       strings
4       Only strings support
5       dynamic expansion

Same with numerical arrays:
11  22  33  44  55  66

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Bugfix
« Reply #179 on: May 31, 2014, 09:26:45 AM »
Version 31 May 2014 (download) fixes an odd bug: I had built the tinf.lib used for the new UnzipFile function with /subsystem:CONSOLE, so all code using tinf had a console window, including the spreadsheet viewer.

The new UnzipFile decompresses zipped files to a buffer; more in \Masm32\MasmBasic\MbGuide.rtf

Check also the improved QSort function; it allows now to sort string matrices by column, as demonstrated in the spreadsheet viewer.