Topic: Plugin Writing Tips  (Read 3659 times)

0 Members and 1 Guest are viewing this topic.

Plugin Writing Tips
« on: January 17, 2013, 09:58:26 AM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7010
If you are a new user, and want to easly create plugins,
use "Plugin Creator Packed" which is available on all projects *\Utils\
http://TheOven.org/index.php?topic=178


You can make hundereds of plugins in a day  :thumbsup:
and you can learn basic of plugin writing on following related topics of "Plugin Creator Packed"


**
Not all applications are easy to create plugins  :wink:

Plugin Authors who spend some time to create plugins needs more....

here are some tips to those spend such time :




Advanced Plugin Authors:
*
How to put a file to "User Profile" location:
How to put a file to "All User Profile" location:
How to put a file to "Desktop" location:
How to put a file to "Local Settings App Data" location:

following code gives location to a variable  :thumbsup:
Code: [Select]
Call,TargetDesktop
Call,TargetAppdata
Call,TargetAUAppdata
Call,TargetLocalSettingsAppdata
Echo,%TargetDesktop%
Echo,%TargetAppdata%
Echo,%TargetAUAppdata%
Echo,%TargetLocalSettingsAppdata%

further you copy files to locations  :thumbsup:

ps:
Call: http://theoven.org/index.php?topic=45
Quote
SE : result will be something like:
%BaseDir%\Target\Win10PESE\Users\Default\Desktop
%BaseDir%\Target\Win10PESE\Users\Default\AppData\Roaming
%BaseDir%\Target\Win10PESE\ProgramData
%BaseDir%\Target\Win10PESE\Users\Default\AppData\Local

Gena : result will be something like:
%BaseDir%\Workbench\Gena\UserData\TargetProfiles\GenaP\GenaU\Desktop
%BaseDir%\Workbench\Gena\UserData\TargetProfiles\GenaP\GenaU\Application Data
%BaseDir%\Workbench\Gena\UserData\TargetProfiles\GenaP\All Users\Application Data
%BaseDir%\Workbench\Gena\UserData\TargetProfiles\GenaP\GenaU\Local Settings\Application Data

* When writing profile location to registry:

How to put "User Profile" location for a hardcode path of a utility setting:
Giving example with FireFox:
Code: [Select]
Call,TargetAppdataOS
Set,%t%,%TargetAppdataOS%\Mozilla\Firefox\Profiles

*
here is an example creating a file at desktop
Code: [Select]
Call,TargetDesktop
FileCreateBlank,%TargetDesktop%\Test.txt
well, you can also copy files folders etc....

*
Call,TargetLocalSettingsAppdata
-> See plugin topic http://TheOven.org/index.php?topic=1216

ps: See Call : http://theoven.org/index.php?topic=45
Quote
Call,TargetAppdataOS
Call,TargetAUAppdataOS

+++
Keep in mind, sometimes utilities are not coded well to read variables,
For such utilities AND when profilepath is variable, better make things at boottime
  here is an example:
Code: [Select]
IniRead,%ProjectDir%\Script.Project,Settings,SettingsDrive,%SettingsDrive%
StrFormat,LTrim,%SettingsDrive%,1,,%ts%
If,%ts%,Equal,:,Begin
...
//--> build time tasks ( you can easly write configuration file at build time)
...
End
Else,Begin
...
//--> boot time task (Add_Shortcut,Startup, ....  to write configuration file - au3 - cmd)
...
End




*
%OSFamily%
How to decide if it is PE1x - PE2x - Win98 ....
Very Generally, on Application plugins, main requirement is to figure out if this is PE1x or above...
Use %OSFamily% variable, available on all projects.

Values:
NT5 NT6

*
%SourceArch%
How to check source architecture
If,%SourceArch%,Equal,....

Values:
x86 x64 IA64

%TargetWOW64%
How to check if build have ability to run 32 bit application
easiest way is to add
Arch,x86
to the top of [Process]
at core level
%TargetWOW64%
used

ex:
when source is 32bit , %TargetWOW64% value naturally x86
when source is 64bit , %TargetWOW64% value naturally can be x86 or x64 , if x86 than a WOW64 plugin exists ;) (Thanks to JFX)

Current projects (Gena, Win7PE SE , Win8PE SE) uses Wow64 plugin made by JFX hence all these projects have ability to run 32bit applications...


Values:
x86 x64 IA64



*
writing associations and explorer shell integrations, convert 0x1 to 0x2

RegCPE follows input reg file, converts 0x1 entries as 0x1,
 you need to manually make conversions to variables..

Windows do not accept variables with 0x1, so when using variables one also need to change 0x1 to 0x2

ex:
Plugin Creator Association Helper:
http://theoven.org/index.php?topic=189.0

RegWrite,HKLM,0x2,Tmp_Software\Classes\SumatraPDF\DefaultIcon,,#$q%PE_Programs%\%ProgramFolder%\%ProgramEXE%#$q
RegWrite,HKLM,0x2,Tmp_Software\Classes\SumatraPDF\shell\open\command,,"#$q%PE_Programs%\%ProgramFolder%\%ProgramEXE%#$q #$q#$p1#$q"

as you see both icon and command written with 0x2  :thumbsup:

ex:

RegWrite,HKLM,0x2,"Tmp_Software\Classes\*\shell\Play with %ProgramTitle%\command",,"#$q%PE_Programs%\%ProgramFolder%\%ProgramEXE%#$q #$q#$p1#$q"

This way, plugins keep flexibility and ready for any drive letter other than X:

All Apps plugins and most Component plugins written with this way  :thumbsup:

Ref: Reply 5 6 7 9 13 http://TheOven.org/index.php?topic=1563.msg18348#msg18348



*******
Plugin Requirements to Other Plugins:
Sometimes plugin requires other plugins,

Solution: write a Bold text to interface

Tip: writing only to description mostly miss from eyes  :wink:


In addition:
there are some known requirements (+other things), in addition to interface, they are written to Description= prefix

(x86/x64 v....)
(x86/x64/IA64 v....)

(only x64 v....)
(only x86 v....)

(v.... src)
--> source code available


(.Net v....)
(WMI v....)


Title=................ CMD
Description=(v.... CMD)
--> this represents both console AND none gui (none console) applications



(BETA)
(UNDER CONSTRUCTION)



ps: DO NOT use Depends= ,  It always result troubles with General Plugins,
 another bad design of builder.

ex: Reply 96 98  http://theoven.org/index.php?topic=340.msg17475#msg17475







*******
See this topic about some more plugin writing tips:
KYHI -  Add multiplier
http://TheOven.org/index.php?topic=1247
JonF - How to force SysWOW64 for 32-bit DLL
http://TheOven.org/index.php?topic=806.0

 :thumbsup:

« Last Edit: December 17, 2015, 01:33:13 AM by Lancelot »

 

Powered by EzPortal