Private strings in C code, gcc compiled.
- Size
- 4.2K (4,330 bytes)
- Added
- 2026-11-20 02:43
- Downloads
- 2
- Long Description
- ============================================================================ 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.html 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 68