- NSIS Discussion
- Base64 decoder
Archive: Base64 decoder
Yathosho
23rd September 2010 17:49 UTC
Base64 decoder
the location of a dropbox folder is stored in a plain text file, encoded in base64. since the only base64 decoder for nsis has no documentation at all, i'm wondering how i can decode the file. for a smaller footprint, i wouldn't mind an alternative to decode only.
Animaether
23rd September 2010 18:44 UTC
there's a readme.txt in the original download?
Afrow UK
24th September 2010 11:11 UTC
I wouldn't use that plug-in as it has a MSVCRT80 dependency (comes with .NET 3.5).
Stu
DrO
24th September 2010 11:53 UTC
actually msvcr80 is down to the plug-in having been built with dynamic linking in VS2005 and doesn't relate to .NET. however using it (no idea in respect to the original question) wouldn't be nice unless you make sure the dependency dll is in the same folder as the plug-in before it is then used.
-daz
Afrow UK
24th September 2010 12:41 UTC
Yes of course but the dist comes with .NET (2.0 not 3.5) and that can be a good indicator as whether or not it is installed on the destination machine.
Stu
Animaether
24th September 2010 12:55 UTC
well, there is the alternative linked to from that wiki.. and I think the original had the source code included, so could be recompiled to get rid of the dependency as well?
there's also plenty of code on the internet for base64 decoding in scripting languages.. presumably one of those could be adapted for NSIS use.
edit: in fact.. just do what this does.. but in reverse ;) http://nsis.sourceforge.net/Base64
Afrow UK
24th September 2010 19:46 UTC
I posted a step by step on how to build a non MSVCRT dependant DLL in VS2008/VS2010 here:
http://forums.winamp.com/showpost.ph...4&postcount=60
However, that plug-in would still need some mods to get it to build. For example, the way the the variables (such as string_to_encode) are being initialized to an empty string will cause the compiler to want to link memset. You can't use ZeroMemory either (again, memset) but a for loop would do the job.
Stu
DrO
24th September 2010 19:56 UTC
SecureZeroMemory(..) should do an inline version of memset from what i remember.
-daz
Animaether
25th September 2010 01:31 UTC
Figured it'd be a fun coding exercise... I've updated http://nsis.sourceforge.net/Base64 to include the decoding function.
I haven't tested it rigorously - if there's an actual error in it (I know it uses more variables than it would strictly need, that's just for clarity), let me know or just edit the WiKi, of course.
Here's a further testbed, though:
SectionEnd
>
As far as I can tell, the URLDecode variant works correctly as well - but difficult to find actual use examples via Google.
Yathosho
5th October 2010 12:20 UTC
so far it worked without a flaw. thank you, animaether!
Animaether
5th October 2010 12:53 UTC
good to hear :) I guess it works on the dropbox folder location storage bit as well, then :)