Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Load from password protected zip files : Model Handling

  1. #1

    Load from password protected zip files : Model Handling

    Hello

    In game programming it is very useful to load 3D models and stuff from zipped archives , and for security reasons it is better to protect them by password

    In other game engines it is possible to load from these archives by specific functions.

    Is it possible to add a module to thinbasic that handles this type of archives and create somes other functions to load from memory ....


    Thanks

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Ciao,

    I'm not export in games creation so maybe other will reply on specific issues.

    thinBasic has functions working with compressed zipped files. More info at http://www.thinbasic.com/public/prod....html?zlib.htm
    Maybe ZLib_ExtractToZip can be used to extract any binary file and access them as memory areas.

    Anyway we can think to develop more specific functionalities if needed.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Thanks for reply,

    I have seen that there is a module in thinbasic wich is called Zlib. but it does not extract files to memory , and it does not handle password protected zip files.

    In other languages as Purebasic for example : there is a module called PUREZIP, it s a very useful module in this case.

    Can someone make a wrapper for thinbasic?

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170
    there's Zlib_ExtractToString from tB-Versions above 1.9.16.x that allows to extract single files from a zip-archive to memory. Poke that string anywhere you want. Even to HEAP...
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by lassad View Post
    Thanks for reply,

    I have seen that there is a module in thinbasic wich is called Zlib. but it does not extract files to memory , and it does not handle password protected zip files.

    In other languages as Purebasic for example : there is a module called PUREZIP, it s a very useful module in this case.

    Can someone make a wrapper for thinbasic?

    Hi Lassad,

    a string in thinBasic is a powerful dynamic memory area. You can get a pointer to string data using STRPTR function.
    Otherwise it is very easy to get a heap memory allocation using thinBasic Heap functions.

    An example. You can use test data you can find into \SampleScripts\zLib\
    Here we extract from a known zip file a known file name stored into a subdirectory inside the ZIP file
      '-----------------------------------------------------------------------------  '-----------------------------------------------------------------------------
      uses "ZLib"
     
      Dim sBuffer     As String
      Dim ZIPFileName As String         
    
    
      Double T1 = Timer
      ZIPFileName = APP_ScriptPath & "TestFolder\ZipFiles.tBasic.ZIP"
    
    
      sBuffer = ZLib_ExtractToString(ZIPFileName, "Data\ZipFiles.tBasic.UZIP.TXT")
    
    
      Double T2 = Timer
      
      If sBuffer <> "" Then
        MsgBox 0, "File Found. Buffer is " & Len(sBuffer) & " bytes." & $CRLF &
                  "Time taken To Extract: " & Format$(T2-T1, "#0.000")
      Else
        MsgBox 0, "File not found in ZIP"
      End If
    
    The above example extract into a string buffer 2.8 MB of data in 0.012 seconds on my PC so it is quite fast.


    Once you have a string buffer, you can get a pointer to it using STRPTR
    Long pData = StrPtr(sBuffer)
    
    or you can store the buffer into a Heap returning Heap memory pointer
    Long pData = HEAP_AllocByStr(sBuffer)
    
    If you give more info on how you think to use compressed data, I can see what I can do more.

    Regarding password protected files, you are right: there is no any function working on password protected zip files.
    I will see what I can do to add something, maybe this can be useful to others.

    Ciao
    Eros
    Last edited by ErosOlmi; 07-03-2016 at 22:31.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I'm a PureBasic customer, just installed PureBasic 5.42 LTS but I cannot find an official PUREZIP module inside help.

    Can you please point me where I can find documentation of the mentioned module?

    Thanks a lot
    Eros
    Last edited by ErosOlmi; 07-03-2016 at 22:26.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  7. #7
    Quote Originally Posted by ErosOlmi View Post
    I'm a PureBasic customer, just installed PureBasic 5.42 LTS but I cannot find an official PUREZIP module inside help.

    Can you please point me where I can find documentation of the mentioned module?

    Thanks a lot
    Eros
    It is working only with purebasic 5.0

    PureZIP-500-Installer.rar

    Im looking for loading M15 model and its texture from protected zip . hope it can be done some how (without extracting into drive)

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    If you attach here an example ZIP file with one or two password protected files inside I can make some test.
    Just an example with a known dummy password you can post here.

    I think I've already done something but I need some tests.

    Thanks
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9
    purezip does not support password as reported in july 2014 http://purebasic.fr/english/viewtopic.php?f=3&t=59871

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Added password parameter to ZLib_ExtractToString.
    Will be present in next thinBasic beta version.
    sBuffer = ZLib_ExtractToString(ZIPFileName, sFileNameToExtract, sPassword)
    
    I'm trying to make more tests on different zip files created with different compressing applications.
    If you have some ZIP example with protected password file inside, just attach in this posts giving the password of the file and I will test.

    If all will work fine I will also work on something else:
    • ZLib_ExtractToHeap that will do the same as ZLib_ExtractToString but will allocate an Heap memory area returning it's handle.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 3 123 LastLast

Similar Threads

  1. password script and more :)
    By Lionheart008 in forum Console
    Replies: 2
    Last Post: 29-05-2009, 15:40
  2. XP / NT Password killer
    By Michael Clease in forum Security
    Replies: 0
    Last Post: 13-02-2009, 16:56
  3. username and password in script
    By sandyrepope in forum thinBasic General
    Replies: 11
    Last Post: 25-07-2007, 09:25
  4. Load image files.
    By cocoflop in forum thinBasic General
    Replies: 3
    Last Post: 17-05-2007, 21:04

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •