Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FEAT: added minimal experimental empty rsrc support for PE format. #695

Closed
wants to merge 1 commit into from

3 participants

RaazTripathi Nenad Rakocevic David Oliva
RaazTripathi

No description provided.

David Oliva

rsrc-entry has only 2 values, pointer to name or ID and data or subdirectory (according the highest bit - the lower 31 bits are the address)!

Nenad Rakocevic
Owner

@RaazTripathi Please stop sending pull requests which are merges of Red branches.

Nenad Rakocevic dockimbel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  red-system/compiler.r
View
@@ -2893,6 +2893,7 @@ system-dialect: make-profilable context [
literal-pool?: no ;-- yes => use pools to store literals, no => store them inlined (default: no)
unicode?: no ;-- yes => use Red Unicode API for printing on screen
red-only?: no ;-- yes => stop compilation at Red/System level and display output
+ icon-file: none ;-- .ico file for Windows executable (temporary option)
]
compile: func [
2  red-system/config.r
View
@@ -23,6 +23,7 @@ REBOL [
;; syscall: 'Linux | 'BSD ;-- syscalls calling convention (default to Linux)
;; stack-align-16?: yes | no ;-- yes => align stack to 16 bytes (default: no)
;; literal-pool?: yes | no ;-- yes => use pools to store literals, no => store them inlined (default: no)
+;; icon-file: none | <file!> ;-- .ico file for Windows executable (temporary option)
;;-------------------------------------------
;-------------------------
@@ -38,6 +39,7 @@ Windows [
format: 'PE
type: 'exe
sub-system: 'GUI
+ icon-file: %cws.ico
]
;-------------------------
;WinDLL [ ; not supported yet
48 red-system/formats/PE.r
View
@@ -339,6 +339,51 @@ context [
]
]
]
+
+ rsrc-directory: make-struct [
+ characteristics [integer!]
+ timestamp [integer!]
+ major [short]
+ minor [short]
+ name-entries [short]
+ id-entries [short]
+ ] none
+
+ rsrc-entry: make-struct [
+ name-rva [integer!]
+ id [integer!]
+ data-rva [integer!]
+ sub-rva [integer!]
+ ] none
+
+ rsrc-data: make-struct [
+ data-rva [integer!]
+ size [integer!]
+ codepage [integer!]
+ reserved [integer!] ;-- must be 0
+ ] none
+
+
+ build-rsrc: func [job [object!] /local buffer ptr table][
+ buffer: make binary! 100'000
+ ptr: section-addr?/memory job find/last job/sections word!
+
+ table: make-struct rsrc-directory none
+ table/characteristics: 0
+ table/timestamp: 0
+ table/major: 0
+ table/minor: 0
+ table/name-entries: 0
+ table/id-entries: 1
+ append buffer form-struct table
+
+ entry: make-struct rsrc-entry none
+ entry/name-rva
+
+ append job/sections compose/deep [
+ rsrc [- (buffer)]
+ ]
+ ]
build-import: func [
job [object!]
@@ -473,6 +518,9 @@ context [
code-ptr: entry-point-address? job
linker/build-debug-lines job code-ptr pointer
]
+ if job/icon-file [
+ build-rsrc job
+ ]
build-import job ;-- populate import section buffer
Something went wrong with that request. Please try again.