You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an array of positions for global variables:
The first 20 are primarily used as variables and registers in NSIS's virtual machine in exec.c, but unfortunately, some are aliased for temporary use in functions outside of the virtual machine functions. Using an array in the .ndata section results in disassembly and ILs that are challenging to read. So, I use a struct in place of the array:
typedefcharNSIS_STRING[1024]; // TCHAR[NSIS_MAX_STRLEN], ANSI build, 0x400 bytesstructg_usrvars_t
{
// Indices 0..9 are the user registers $0..$9.// NB: $5 and $6 are reused locally in NSISWinMainNOCRT as `unexe` / `unexecmd`.NSIS_STRINGvar_0; // 0x0000 $0NSIS_STRINGvar_1; // 0x0400 $1NSIS_STRINGvar_2; // 0x0800 $2NSIS_STRINGvar_3; // 0x0C00 $3NSIS_STRINGvar_4; // 0x1000 $4NSIS_STRINGvar_5; // 0x1400 $5 (alias: unexe)NSIS_STRINGvar_6; // 0x1800 $6 (alias: unexecmd)NSIS_STRINGvar_7; // 0x1C00 $7NSIS_STRINGvar_8; // 0x2000 $8NSIS_STRINGvar_9; // 0x2400 $9// Indices 10..19 are the user registers $R0..$R9.NSIS_STRINGvar_R0; // 0x2800 $R0NSIS_STRINGvar_R1; // 0x2C00 $R1NSIS_STRINGvar_R2; // 0x3000 $R2NSIS_STRINGvar_R3; // 0x3400 $R3NSIS_STRINGvar_R4; // 0x3800 $R4NSIS_STRINGvar_R5; // 0x3C00 $R5NSIS_STRINGvar_R6; // 0x4000 $R6NSIS_STRINGvar_R7; // 0x4400 $R7NSIS_STRINGvar_R8; // 0x4800 $R8NSIS_STRINGvar_R9; // 0x4C00 $R9// Indices 20+ are the named state slots (state.h).NSIS_STRINGstate_command_line; // 0x5000 [20] $CMDLINE -> was data_435000NSIS_STRINGstate_install_directory;// 0x5400 [21] $INSTDIR -> was data_435400NSIS_STRINGstate_output_directory; // 0x5800 [22] $OUTDIR -> was 0x435800NSIS_STRINGstate_exe_directory; // 0x5C00 [23] $EXEDIR -> was 0x435c00NSIS_STRINGstate_language; // 0x6000 [24] $LANGUAGE -> was data_436000NSIS_STRINGstate_temp_dir; // 0x6400 [25] -> was data_436400NSIS_STRINGstate_plugins_dir; // 0x6800 [26] $PLUGINSDIRNSIS_STRINGstate_exe_path; // 0x6C00 [27] -> was data_436c00NSIS_STRINGstate_exe_file; // 0x7000 [28]NSIS_STRINGvar_29; // 0x7400 [29] (unreferenced here)NSIS_STRINGstate_click_next; // 0x7800 [30]
};
This looks great in the virtual machine, but then in other locations that alias certain locations, it looks wrong:
The first attempt to fix this is to create symbols in those locations. This works nicely for disassembly, but not for any IL. The reason is the IL are accessing the location via the struct, so the symbol is not used:
I am wondering if there are any elegant solutions to this problem? Is there some way to have two separate structs depending on which function accesses? Or is there some way to support local aliases per function?
Solution Attempt 3: Give Up And Follow The Source
I nuked the struct used earlier completely. After 5.4.9696-dev changes, that underlying struct made everything look really bad:
But now I am back to the original problem, but even worse: I don't know how to put those macro names in anywhere. I will have to just write comments everywhere unless there is some other way.
Here is the database I'm looking at btw: solar plasma spins profoundly
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is an array of positions for global variables:
The first 20 are primarily used as variables and registers in NSIS's virtual machine in exec.c, but unfortunately, some are aliased for temporary use in functions outside of the virtual machine functions. Using an array in the .ndata section results in disassembly and ILs that are challenging to read. So, I use a struct in place of the array:
This looks great in the virtual machine, but then in other locations that alias certain locations, it looks wrong:
Source/exehead/Main.c
Solution Attempt 1: Symbols
The first attempt to fix this is to create symbols in those locations. This works nicely for disassembly, but not for any IL. The reason is the IL are accessing the location via the struct, so the symbol is not used:
This solution is not the correct one.
Solution Attempt 2: Render Layers
I then tried render layers. This works, but I can only seem to get it working on Graph not Linear.
And the change only happens in the view, not anywhere else like cross references
And render layers itself feels like a spaghetti kludge that doesn't really solve the problem at the root. This is what I am running in snippet editor:
I am wondering if there are any elegant solutions to this problem? Is there some way to have two separate structs depending on which function accesses? Or is there some way to support local aliases per function?
Solution Attempt 3: Give Up And Follow The Source
I nuked the struct used earlier completely. After
5.4.9696-devchanges, that underlying struct made everything look really bad:All of those problems were alleviated:
But now I am back to the original problem, but even worse: I don't know how to put those macro names in anywhere. I will have to just write comments everywhere unless there is some other way.
Here is the database I'm looking at btw:
solar plasma spins profoundlyBeta Was this translation helpful? Give feedback.
All reactions