Including registry file inside executable

Just starting out? Need help? Post your questions and find answers here.
Maya

Including registry file inside executable

Post by Maya »

Good evening,
How to include a registry file inside executable? and how to extract it after compilation?
Apricate any help.
User avatar
jacdelad
Addict
Addict
Posts: 2035
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Including registry file inside executable

Post by jacdelad »

Search for IncludeBinary and DataSection.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Oso
Enthusiast
Enthusiast
Posts: 595
Joined: Wed Jul 20, 2022 10:09 am

Re: Including registry file inside executable

Post by Oso »

Good evening Maya

I can help you if you want to write it to a file on execution, then do something with that file. I'm not sure if you want to process the registry data in some other way, but there are fairly straightforward ways of writing registry values in other posts on the forum, such as this one... https://www.purebasic.fr/english/viewtopic.php?t=82862

The below will create a local file at execution time, from the compile-time include of test.reg.

Code: Select all

DataSection 
  RegfileDataStart:
  IncludeBinary "x:\includedata\test.reg"
  RegfileDataEnd:
EndDataSection 

If CreateFile(0, "x:\includedata\regcopy.txt")
  WriteData(0, ?RegfileDataStart, ?RegfileDataEnd - ?RegfileDataStart)
  CloseFile(0)
Else
  MessageRequester("Error creating file", "Unable to create included data")
EndIf
Maya

Re: Including registry file inside executable

Post by Maya »

Oso wrote: Wed Dec 06, 2023 9:48 pm Good evening Maya
I can help you ...
Good Morning Oso,
You've really helped me a lot.
Thank you very much!
Oso
Enthusiast
Enthusiast
Posts: 595
Joined: Wed Jul 20, 2022 10:09 am

Re: Including registry file inside executable

Post by Oso »

Maya wrote: Thu Dec 07, 2023 6:32 am Good Morning Oso, You've really helped me a lot.
Thank you very much!
Good morning Maya, I'm glad to have been able to help you a bit — it isn't often that I get the chance, being relatively new to PB myself :shock: So, the pleasure is all mine really. :D
Post Reply