It is currently Thu Nov 21, 2019 2:11 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Strings tables
PostPosted: Sat Jun 15, 2019 3:34 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 455
To help mk-soft, after numbers, strings.

String tables

Caution : strings are NOT PROTECTED in an executable, even with single op xor.
Code:
;*********************************************************************************************************************
Macro Table
   Define.I DimSLin0# MacroExpandedCount = #PB_Compiler_Line
   DataSection
   DimSData# MacroExpandedCount:
   Data.S ""
EndMacro
   
Macro EndTable(ArrName)
   DimSEndD# MacroExpandedCount:
   EndDataSection
   Define.I DimSLin1# MacroExpandedCount = #PB_Compiler_Line
   DimSTotal# MacroExpandedCount = 0
   For DimSI# MacroExpandedCount = ?DimSData# MacroExpandedCount To ?DimSEndD# MacroExpandedCount Step 2
      If PeekW(DimSI# MacroExpandedCount) = 0
         DimSTotal# MacroExpandedCount + 1
      EndIf
   Next
   DimSH# MacroExpandedCount = DimSLin1# MacroExpandedCount - DimSLin0# MacroExpandedCount - 1
   If DimSH# MacroExpandedCount
      DimSL# MacroExpandedCount = DimSTotal# MacroExpandedCount / DimSH# MacroExpandedCount
      DimSL# MacroExpandedCount - 1
      DimSH# MacroExpandedCount - 1
      Global Dim ArrName.S(DimSL# MacroExpandedCount, DimSH# MacroExpandedCount)
      Restore DimSData# MacroExpandedCount
      For DimSI# MacroExpandedCount = 0 To DimSH# MacroExpandedCount
         For DimSJ# MacroExpandedCount = 0 To DimSL# MacroExpandedCount
            Read.S ArrName(DimSJ# MacroExpandedCount, DimSI# MacroExpandedCount)
         Next
      Next
   EndIf
EndMacro






;- Example



Table+
   "red",      "magenta",
   "green",      "cyan",
   "blue",      "yellow"
EndTable(Cool)



Debug Cool(1, 2)



Last edited by Olliv on Sat Jun 22, 2019 4:10 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Strings tables
PostPosted: Sat Jun 22, 2019 2:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Oct 06, 2007 11:20 pm
Posts: 264
Location: France
Cool and fast. Thanks

_________________
~Ar-S~

ResizerGold : The easiest way to resize your pictures and more
My webSite (french) : LDVMULTIMEDIA
PB - 5.4x LTS / 5.6x - W10 x64 - GTX1080 - i5 6600k
Repeat : try : until done = 1


Top
 Profile  
Reply with quote  
 Post subject: Re: Strings tables
PostPosted: Sat Jun 22, 2019 4:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 455
Thank you for reply.

This request shows me, that two mistakes are within one of the code lines. Here we cannot build more than... one table.

This line below is false :
Code:
;*****************************************************************************
  DimSH# MacroExpandedCount = DimSLin11 - DimSLin01 - 1


I am stupid. I will correct that. And I will add an other tip to try to be forgiven...


Top
 Profile  
Reply with quote  
 Post subject: Re: Strings tables
PostPosted: Sat Jun 22, 2019 4:16 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 455
Now, it's ok. But do not forget this example must not to be used to store personnal datas which are not crypted in the final executable file.

This last detail will be the next tip : store datas easily and explain how to crypt them.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Lord and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye