AminetAminet
Search:
84476 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/gcc/embed_private_strings.c.txt

Mirror:Random
Showing:m68k-amigaosgeneric
No screenshot available
Short:Private strings in C code, gcc compiled.
Author:wisecracker.bazza at gmail.com (Barry_Walker, G0LCU)
Uploader:Lincs Amiga Group, LAG.
Type:dev/gcc
Version:1.00.00
Architecture:generic
Distribution:Aminet
Date:2019-02-22
Download:http://aminet.net/dev/gcc/embed_private_strings.c.txt - View contents
Readme:http://aminet.net/dev/gcc/embed_private_strings.c.readme
Downloads:3487

============================================================================

Architectures: Classic AMIGAs, WinUAE, FS-UAE, OSX 10.14.1, Linux Mint 19.
--------------------------------------------------------------------------

  MINIMUM Requirements Are:-
  --------------------------

  Amiga environment:-
  
       AMIGA 1200 with HDD and 4MB Fastram.
       AMIGA OS_3.0.x.
       WinUAE 1.5.3, minimum on Windows.
       FS-UAE on OSX 10.14.1 and Linux Mint 19.
       Standard default AMIGA OS_3.0.x install or better.
       (AMIGA OS 3.1.x is preferred however.)
       Full ADE install is needed.
       http://aminet.net/package/dev/gcc/ADE

----------------------------------------------------------------------------

  History:-
  ---------

  22-02-2019.
  -----------
  Version 1.00.00. Probably the one and only upload for this archive.

----------------------------------------------------------------------------

  General:-
  ---------

  (Apologies for any typos, etc...)

  Inserting Inaccessible Private Strings Inside C Code Compiled Using GCC.
  ------------------------------------------------------------------------

  This assumes that you have 'ADE' fully installed and configured.

  Recently on this site this thread started, which I solved:
  https://www.unix.com/programming/279864-embed-text-c-code.html
  And I finalised it here:
 
https://www.unix.com/programming/281218-private-string-embedded-inside-c-code.ht
ml

  Well I thought this DEMO might be of use to we AMIGA nutters so the code
  embed_private_strings.c.txt was created.

  Just download embed_private_strings.c.txt and rename to
  embed_private_strings.c inside your /full/path/to/ADE/home/ drawer.

  Start ADE as per the _manual_ or instructions and go to the drawer where
  this code is saved.

  This will give the facility to have any short, 120 character, (byte),
  string in any function in C code for the UNIX like environment. It is
  possible to have literally thousands of characters, but the limitation is
  that each string must have one newline, and any extra NULL bytes to pad
  the length to an even number.
  Without any mods' this compiles on gcc 2.95.3 in ADE on AMIGA OS_3.0.x,
  on gcc 4.2.1 on OSX 10.14.1, and on gcc 7.3.0 on Linux Mint 19.
  It is surprising the difference between gcc versions 2.95.3 and 4.2.1 in
  the compiled code layout.

  When the DEMO is run the result looks like this, using OSX 10.14.1, (but
  AMIGA OS looks the same):

"""
Last login: Fri Feb 22 17:33:12 on ttys000
AMIGA:amiga~> cd ~/Desktop/AMIGA/AMIGA/HDD/AMIGA1200/DUMP/ADE/home/C
AMIGA:amiga~/Desktop/AMIGA/AMIGA/HDD/AMIGA1200/DUMP/ADE/home/C> gcc
embed_private_strings.c
AMIGA:amiga~/Desktop/AMIGA/AMIGA/HDD/AMIGA1200/DUMP/ADE/home/C> ./a.out

A test function to check that the strings are in the data section.

These strings should be in the data section.
The hidden string(s) is(/are) outside the data section.
'$VER (C)_Barry_Walker_CC0_Licence_[PD].'

AMIGA:amiga~/Desktop/AMIGA/AMIGA/HDD/AMIGA1200/DUMP/ADE/home/C> _
"""
(Note the filename is 'a.out' and is executable by default.)
And a portion of the HEXDUMP for the AMIGA executable looks like this:

/* **********************************************************

Partial hexdump after compiling:
--------------------------------

0350: 00000D50 4E750000 4E550000 4EF90000    ...PNu..NU..N˘..
0360: 03702724 56455220 2843295F 42617272    .p'$VER (C)_Barr
0370: 795F5761 6C6B6572 5F434330 5F4C6963    y_Walker_CC0_Lic
0380: 656E6365 5F5B5075 626C6963 5F446F6D    ence_[Public_Dom
0390: 61696E5D 2E270A00 4E716000 00024E5D    ain].'..Nq`...N]
03A0: 4E750A41 20746573 74206675 6E637469    Nu.A test functi
03B0: 6F6E2074 6F206368 65636B20 74686174    on to check that
03C0: 20746865 20737472 696E6773 20617265     the strings are
03D0: 20696E20 74686520 64617461 20736563     in the data sec
03E0: 74696F6E 2E0A0000 4E550000 48790000    tion....NU..Hy..
03F0: 037A4EB9 00000D5C 588F6000 00024E5D    .zNÏ€...X.`...N]
0400: 4E750A54 68657365 20737472 696E6773    Nu.These strings
0410: 2073686F 756C6420 62652069 6E207468     should be in th
0420: 65206461 74612073 65637469 6F6E2E0A    e data section..
0430: 00546865 20686964 64656E20 73747269    .The hidden stri
0440: 6E672873 29206973 282F6172 6529206F    ng(s) is(/are) o
0450: 75747369 64652074 68652064 61746120    utside the data 
0460: 73656374 696F6E2E 0A002724 56455220    section...'$VER 
0470: 2843295F 42617272 795F5761 6C6B6572    (C)_Barry_Walker
0480: 5F434330 5F4C6963 656E6365 5F5B5044    _CC0_Licence_[PD
0490: 5D2E270A 0A004E55 00004EB9 0000058C    ].'...NU..NÏ€....
04A0: 4EF90000 04C42757 68617420 6973206C    N˘...ƒ'What is l
04B0: 6F6E672C 20746869 6E2C2072 65642061    ong, thin, red a
04C0: 6E642073 6F6D6574 696D6573 20676F65    nd sometimes goe
04D0: 7320696E 73696465 20746172 74733F20    s inside tarts? 
04E0: 52485542 41524221 270A0000 4E716100    RHUBARB!'...Nqa.
04F0: FE686100 FEF44879 000003DA 4EB90000   
˛ha.˛ÙHy...⁄Nπ..
0500: 0D5C588F 48790000 04094EB9 00000D5C    .X.Hy....NÏ€...
0510: 588F4879 00000442 4EB90000 0D5C588F    X.Hy...BNÏ€...X.
0520: 70006006 70006000 00024E5D 4E750000    p.`.p.`...N]Nu..

********************************************************** */

Read the code for more information...

A place to visit, literally and URL wise:
https://lincsamiga.org.uk/wordpress/

  Enjoy...

  Bazza...

----------------------------------------------------------------------------

                                IMPORTANT:-
                                -----------

    The Legal Stuff:-
    -----------------

    The authors are not responsible for any damage to, or loss of, or
    failure of equipment or data caused in any way by the use of this code.

    There is NO warranty with the use of this software release and
    YOU USE IT AT YOUR OWN RISK.

----------------------------------------------------------------------------

    Testing Evaluation:-
    --------------------

    All WinUAE, FS-UAE and Classic AMIGA test conditions were/are running
    standard OS 3.0.x and using standard ~topaz 8~ fonts throughout. The
    minimum hardware requirements ARE needed however.

    I have no idea what strange configuration setups will create so refer
    to the ~The Legal Stuff~ above.

----------------------------------------------------------------------------

    Barry Walker, G0LCU.

----------------------------------------------------------------------------

    A very useful HardWare related site, (C) Anthony Hoffman, for
    modifications, schematics, repairs and the like is:-

                          http://amiga.serveftp.net/

============================================================================


Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>