Quelq'un qui s'y connait dans ce theme (le lien dans le message d'avant) pourrait m'expliquer ou donner un exemple comment le faire?
Je ne comprend pas du tout commen il faut faire...:(
Version imprimable
Quelq'un qui s'y connait dans ce theme (le lien dans le message d'avant) pourrait m'expliquer ou donner un exemple comment le faire?
Je ne comprend pas du tout commen il faut faire...:(
C'est vrai que dans le "man ld" ca parle nulle part des ressources.
En le lisant j'ai trove des options suivantes:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 -r --relocatable Generate relocatable output---i.e., generate an output file that can in turn serve as input to ld. This is often called partial linking. As a side effect, in environments that support standard Unix magic numbers, this option also sets the output file's magic number to "OMAGIC". If this option is not specified, an absolute file is produced. When linking C ++ programs, this option will not resolve references to constructors; to do that, use -Ur. When an input file does not have the same format as the output file, partial linking is only supported if that input file does not contain any relocations. Different output formats can have further restrictions; for example some "a.out"-based formats do not support partial linking with input files in other formats at all. This option does the same thing as -i.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 -Ur For anything other than C ++ programs, this option is equivalent to -r: it generates relocatable output---i.e., an output file that can in turn serve as input to ld. When linking C ++ programs, -Ur does resolve references to constructors, unlike -r. It does not work to use -Ur on files that were themselves linked with -Ur; once the constructor table has been built, it cannot be added to. Use -Ur only for the last partial link, and -r for the others. --unique[= SECTION ] Creates a separate output section for every input section matching SECTION , or if the optional wildcard SECTION argument is missing, for every orphan input section. An orphan section is one not specifically mentioned in a linker script. You may use this option multiple times on the command line; It prevents the normal merging of input sections with the same name, overriding output section assignments in a linker script.
et y'a aussi beaucoup de choses a propos des scripts du linkeur:Code:
1
2
3
4
5
6
7 -T scriptfile --script=scriptfile Use scriptfile as the linker script. This script replaces ld's default linker script (rather than adding to it), so commandfile must specify everything necessary to describe the output file. If scriptfile does not exist in the current directory, "ld" looks for it in the directories specified by any preceding -L options. Multiple -T options accumulate.
Je ne comprends pas tres bien tout ca... mais qqch me dit que c'est justement le deplacement des sections d'un fichier dans un autre.Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 The following example reads all of the sections from file all.o and places them at the start of output section outputa which starts at location 0x10000. All of section .input1 from file foo.o follows immediately, in the same output section. All of section .input2 from foo.o goes into output section outputb, followed by section .input1 from foo1.o. All of the remaining .input1 and .input2 sections from any files are written to output section outputc. SECTIONS { outputa 0x10000 : { all.o foo.o (.input1) } outputb : { foo.o (.input2) foo1.o (.input1) } outputc : { *(.input1) *(.input2) } }
Non?
Si vous possedez un lien, pourrez vous me le passer...j'aimerais bien voir - ca aiderait pour ma recherche.Citation:
Sous Windows, c'est ce qu'on appelle une ressource dans une DLL.
Voilà un logiciel qui permet de modifier les ressources d'un exécutable ou d'une DLL. http://www.kachouri.com/tuto/tuto-80...-logiciel.html
Je n'ai pas trouvé de code en C ou en C++ pour modifier une ressource mais il doit exister.
Je ne sais pas si c'est très intéressant de regarder la gestion des ressources dans les DLLs sous Windows étant donné que c'est complétement différent sous Linux.
A moins d'une recherche "ressource librairie linux"...
Citation:
Les fichiers de ressources sont propres à Windows (vous n'en trouverez pas sous Linux et Mac OS par exemple).
Citation:
Sous les autres OS, c'est différent. Par exemple, sous Linux il n'y a pas d'icône associée aux exécutables.
Mon probleme a vraiment l'air d'etre unfaisable...
Quand j'ai lus le premier lien, j'ai cru avoir la reponse - c'est ecritDans linux en faisantCitation:
décompileur interne de scripts de ressource
on peut decompiler, mais le truc c'est que c'est bien ecrit ressource, et alors pour verifier j'ai pris 2 fichiers de windows (explorer.exe et shell32.dll) et 1 fichier de linux (gzip) et passe la commandeCode:objdump -d
et ca a donne le suivant:Code:objdump -h
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 ~$ objdump -h ./progs/explorer.exe ./progs/explorer.exe: file format efi-app-ia32 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00044ad9 0000000001001000 0000000001001000 00000400 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00001800 0000000001046000 0000000001046000 00045000 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .rsrc 000b3280 0000000001048000 0000000001048000 00046800 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .reloc 00003720 00000000010fc000 00000000010fc000 000f9c00 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
On peut voir que dans explorer.exe et shell32.dll il y'a une section nommee .rsrcCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 ~$ objdump -h ./progs/shell32.dll ./progs/shell32.dll: file format efi-app-ia32 Sections: Idx Name Size VMA LMA File off Algn 0 .text 001fbd68 000000007c9d1000 000000007c9d1000 00000400 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 0001a200 000000007cbcd000 000000007cbcd000 001fc200 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .rsrc 005ed110 000000007cbea000 000000007cbea000 00216400 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .reloc 0001a378 000000007d1d8000 000000007d1d8000 00803600 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
Et ici il n'y en a pas!Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 ~$ objdump -h ./progs/gzip ./progs/gzip: file format elf32-i386 Sections: Idx Name Size VMA LMA File off Algn 0 .interp 00000013 08048134 08048134 00000134 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .note.ABI-tag 00000020 08048148 08048148 00000148 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .hash 00000220 08048168 08048168 00000168 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .dynsym 00000430 08048388 08048388 00000388 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 4 .dynstr 0000024d 080487b8 080487b8 000007b8 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 5 .gnu.version 00000086 08048a06 08048a06 00000a06 2**1 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .gnu.version_r 00000050 08048a8c 08048a8c 00000a8c 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 7 .rel.dyn 00000030 08048adc 08048adc 00000adc 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 8 .rel.plt 000001e0 08048b0c 08048b0c 00000b0c 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 9 .init 00000017 08048cec 08048cec 00000cec 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 10 .plt 000003d0 08048d04 08048d04 00000d04 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 11 .text 00009d84 080490e0 080490e0 000010e0 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 12 .fini 0000001c 08052e64 08052e64 0000ae64 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 13 .rodata 00001358 08052e80 08052e80 0000ae80 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 14 .eh_frame_hdr 0000001c 080541d8 080541d8 0000c1d8 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 15 .eh_frame 0000005c 080541f4 080541f4 0000c1f4 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 16 .ctors 00000008 08055250 08055250 0000c250 2**2 CONTENTS, ALLOC, LOAD, DATA 17 .dtors 00000008 08055258 08055258 0000c258 2**2 CONTENTS, ALLOC, LOAD, DATA 18 .jcr 00000004 08055260 08055260 0000c260 2**2 CONTENTS, ALLOC, LOAD, DATA 19 .dynamic 000000c8 08055264 08055264 0000c264 2**2 CONTENTS, ALLOC, LOAD, DATA 20 .got 00000004 0805532c 0805532c 0000c32c 2**2 CONTENTS, ALLOC, LOAD, DATA 21 .got.plt 000000fc 08055330 08055330 0000c330 2**2 CONTENTS, ALLOC, LOAD, DATA 22 .data 000009c4 08055440 08055440 0000c440 2**5 CONTENTS, ALLOC, LOAD, DATA 23 .bss 00050730 08055e20 08055e20 0000ce04 2**5 ALLOC
Donc sa montre qu'il n'y a pas de section ressource dans les fichiers de linux (et donc les fichier *.so aussi!)
Mais pouvez vous m'expliquer - ce n'est pas possible quand meme de modifier les sections? (pas obligatoirement la section ressource, mais n'importe quelle autre (.bss ou .data ou .text...)) Qu'est ce qu'on peut faire avec ces sections? (Ce n'est pas pour rien qu'elles sont la:?).