So I have been working with creating ODBC connections in Inno by utilizing the registry. The issue I have been running into is that Inno does not create all of the keys I set. I am using a 64bit version of Windows and installing a 32 bit application using the 32 bit Inno installer. The path I am using is HKLM\SOFTWARE\WOW6432Node\ODBC\ODBC.INI
Example:
I have a connection TESTDBF1 which holds the values:
TESTDBF1
This creates the connection in the 32 bit ODBC Administrator but I also need to specify the custom dBase version (IV) and directory (C:\DIR) shown. To accomplish this, the subkeys below must be added, or the ODBC Administrator will only show the default dBase version (V) and current directory.
This Xbase directory is needed to hold the custom settings specified in the main TESTDBF1 section
The keys in the Xbase directory.
In addition, I add the Name: TESTDBF1 as a string "Driver do Microsoft dBase (*.dbf)" into WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources.
To run all of these commands, I created TESTDBF1.reg to confirm functionality.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1]
"Driver"="C:\\WINDOWS\\system32\\odbcjt32.dll"
"DefaultDir"="C:\\IBS"
"DriverId"=dword:00000115
"FIL"="dBase IV;"
"SafeTransactions"=dword:00000000
"UID"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase]
"CollatingSequence"="ASCII"
"Deleted"=hex:00
"ImplicitCommitSync"=""
"PageTimeout"=dword:00000005
"Statistics"=hex:00
"Threads"=dword:00000003
"UserCommitSync"="Yes"
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources]
"TESTDBF1"="Driver do Microsoft dBase (*.dbf)"
Upon merging/running this file, all keys are successfully created and I can confirm the custom values are showing in the ODBC Administrator.
So, I'm thinking - Hey its working! Now I can add into Inno!
No.
I am using Inno Script Studio as my compiler.
I import the registry file TESTDBF1.reg I just used into the script and then run the installer. No such luck. All of the keys at \WOW6432Node\ODBC\ODBC.INI\TESTDBF1 are created but none of the following subdirectories are created (\Engines and \Engines\Xbase) Reminder: Xbase holds the keys that ensure the custom info in ODBC.INI\TESTDBF1 hold when you open the ODBC Administrator.
So after confirming the TESTDBF1.reg works again, I look at the code I am writing in Inno:
; Imported Registry File: "C:\Users\Support\Documents\test\TESTDBF1.reg"
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: string; ValueName: "Driver"; ValueData: "C:\WINDOWS\system32\odbcjt32.dll"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: string; ValueName: "DefaultDir"; ValueData: "C:\DIR"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: dword; ValueName: "DriverId"; ValueData: "$00000115"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: string; ValueName: "FIL"; ValueData: "dBase IV;"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: dword; ValueName: "SafeTransactions"; ValueData: "$00000000"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: string; ValueName: "UID"; ValueData: ""; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: string; ValueName: "CollatingSequence"; ValueData: "ASCII"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: binary; ValueName: "Deleted"; ValueData: "00"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: string; ValueName: "ImplicitCommitSync"; ValueData: ""; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: dword; ValueName: "PageTimeout"; ValueData: "$00000005"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: binary; ValueName: "Statistics"; ValueData: "00"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: dword; ValueName: "Threads"; ValueData: "$00000003"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1\Engines\Xbase; ValueType: string; ValueName: "UserCommitSync"; ValueData: "Yes"; Flags: uninsdeletekey;
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources; ValueType: string; ValueName: "TESTDBF1"; ValueData: "Driver do Microsoft dBase (*.dbf)"; Flags: uninsdeletekey;
Hmm. I can't find anything wrong with that. I ran the install script again and again with different names, directories, and the like and regardless of what I do, I cannot get the \Engines\Xbase keys to write from inside of the install script.
Now, why don't I just run the .reg file at the end of install?
Because part of my script uses the install directory (which changes) as part of these reg keys. Note ValueData. Example:
Root: HKLM; Subkey: SOFTWARE\WOW6432Node\ODBC\ODBC.INI\TESTDBF1; ValueType: string; ValueName: "DefaultDir"; ValueData: "{app}\IBS"; Flags: uninsdeletekey;
After running the installer, this is the key that is created at HKLM\Software\WOW6432Node\ODBC\ODBC.INI\TESTDBF1
Post Install Key
Any help would be much appreciated - I am pretty stumped at this point.
I think I figured it out - minutes after posting. The post probably helped get things straight.
So - when writing 32 bit keys, using a 32 bit application and a 32 bit installer, get this - you write to the 64 bit registry directory. You DO NOT write to the WOW6432Node because of whatever back end stuff with Inno. It just doesn't write.
You have to write to the 64 bit directory and somewhere, somehow, Inno and Windows communicate and will automatically take your 32 bit information and place it into the WOW6432Node for you. You just can't do it yourself.
So my actual fix was to change all of my reg entries to HKLM\SOFTWARE\ODBC\ODBC.INI\testdbf1etc and in doing so, everything worked and wrote properly into HKLM\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\testdbf1etc.
I really wish this portion would have been better documented in Inno. If you remember above, my .reg file worked! Inno was the one who wouldn't write the keys properly, but I guess that is to be expected since it is an application instead of referencing the default Windows functions.
Hope this helps the rest of you!
Related
I'm trying to build Mendel Linux for Google Coral Dev Board on Ubuntu 20.04.
I followed the instructions step by step described in the https://coral.googlesource.com/docs/+/refs/heads/master/GettingStarted.md.
Аfter building the tree by the running m, I did not receive the image files required to the flash: u-boot.imx, rootfs_arm64.img.
The log contains the following lines with error:
Making install in mod
make[4]: Entering directory '/build/linux-imx-12/debian/build/build-tools/scripts/mod'
/build/linux-imx-12/debian/rules.d/scripts/mod/gendef.py /build/linux-imx-12/scripts/mod/modpost.c > modpost-opts.h
ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
aarch64-linux-gnu-gcc -g -O2 -fdebug-prefix-map=/build/linux-imx-12/debian/build/build-tools/scripts/mod=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -I /build/linux-imx-12/debian/build/build-tools/scripts/mod -c -o modpost.o /build/linux-imx-12/debian/rules.d/scripts/mod/modpost.c
aarch64-linux-gnu-gcc -g -O2 -fdebug-prefix-map=/build/linux-imx-12/debian/build/build-tools/scripts/mod=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wl,-z,relro -o modpost modpost.o
/usr/bin/make -f /build/linux-imx-12/debian/rules.d/scripts/mod/Makefile.real TYPE=lsb-32 SOURCEDIR=/build/linux-imx-12/scripts/mod
The build ends with the lines:
make[1]: Leaving directory '/build/linux-imx-12'
dpkg-genbuildinfo --build=full
dpkg-genchanges -sa --build=full >../linux-imx_12-4_arm64.changes
dpkg-genchanges: info: including full source code in upload
dpkg-source --after-build .
lintian --profile=mendel ../linux-imx_12-4_arm64.changes
dpkg-buildpackage: info: full upload (original source is included)
N: 8 tags overridden (1 error, 7 warnings); 1 unused override
I: Copying back the cached apt archive contents
I: unmounting /rootdir/out/target/product/imx8m_phanbell/packages filesystem
I: unmounting /rootdir filesystem
I: unmounting dev/ptmx filesystem
I: unmounting dev/pts filesystem
I: unmounting dev/shm filesystem
I: unmounting proc filesystem
I: unmounting sys filesystem
I: cleaning the build env
I: removing directory /rootdir/out/target/product/imx8m_phanbell/obj/PBUILDER/165726 and its subdirectories
I: Current time: Thu May 5 13:00:18 UTC 2022
I: pbuilder-time-stamp: 1651755618
touch /rootdir/out/target/product/imx8m_phanbell/.linux-imx-pbuilder-arm64
Package fakeroot version 1.24 is currently installed.
I tried to preset LD_PRELOAD:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so
and create symbolic link:
ln -s /usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so /usr/lib/libfakeroot-sysv.so
But it did not help.
I'm not sure that the build fails because of this error, but it happens right after this.
How can I solve this problem ?
Thank you.
some words to my system.
Im work on the Xilinx development-board zc706.
The basic example of freertos are running.
Now the question is: How i can boot the application over network?
A freertos application is a bare-metal approach.
Typically a loader like u-boot is been used, but the examples I find, was only for the linux use-case.
Addition:
With the XMD console its possible to load the u-boot in the memory
XMD% source ps7_init.tcl
XMD% ps7_init
XMD% dow u-boot
Processor started. Type "stop" to stop processor
Processor Stop Condition Unknown
Processor Reset .... DONE
Downloading Program -- u-boot
section, .text: 0x04000000-0x040524d7
section, efi_runtime_text: 0x040524d8-0x040524fb
section, .rodata: 0x04052500-0x040650d1
section, .hash: 0x040650d4-0x040650ff
section, .dtb.init.rodata: 0x04065100-0x0406866f
section, .data: 0x04068670-0x0406b31b
section, .got.plt: 0x0406b31c-0x0406b327
section, efi_runtime_data: 0x0406b328-0x0406b3ff
section, .u_boot_list: 0x0406b400-0x0406c71f
section, .rel.dyn: 0x0406c720-0x04077d5f
section, .bss: 0x0406c720-0x040ad29f
Download Progress..10.20.30.40.50.60.70.80.90.Done
Setting PC with Program Start Address 0x04000000
XMD% run
RUNNING> 0
XMD%
The result ist seen with on a com port:
U-Boot 2017.01-00012-g374a838 (May 29 2017 - 17:55:04 +0200)
Model: Zynq ZC706 Development Board
Board: Xilinx Zynq
I2C: ready
DRAM: ECC disabled 1 GiB
MMC: sdhci#e0100000: 0 (SD)
SF: Detected s25fl128s_64k with page size 512 Bytes, erase size 128 KiB, total 32 MiB
*** Warning - bad CRC, using default environment
In: serial#e0001000
Out: serial#e0001000
Err: serial#e0001000
Model: Zynq ZC706 Development Board
Board: Xilinx Zynq
Net: ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet#e000b000
Hit any key to stop autoboot: 0
Device: sdhci#e0100000
Manufacturer ID: 27
OEM: 5048
Name: SD16G
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.5 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading uEnv.txt
** Unable to read file uEnv.txt **
Copying Linux from SD to RAM...
reading uImage
** Unable to read file uImage **
Zynq>
Addition:
I have build the FSBL with the flag FSBL_DEBUG:
(Project -> Properties -> C/C++ Build -> Settings -> ARM gcc compiler -> Symbols)
The I build the bin file only with the boot loader partion and put it on the SD card:
Xilinx Tools->Create Boot Image
Addition:
The problem is, that the SDK needs a file with name u-boot.elf. The extention was not there after the build of u-boot.
So now I have a TFTP-Server running on my host and the u-boot find the uEnv.txt file, but the cmd in this file doesn't run:
How I can setup the u-boot an give the right loadAddress to loadthe freeRTos elf-file?
The tftpboot cmd seems to be:
tftpboot [loadAddress] [bootfilename]
e.g.
tftpboot 0x80400000 vlm-boards/14726/uImage
What is the load address of the zc706 board?
Addition:
The connection an the download with the TFTP-server seems to work:
But after starting with the "go" cmd a reset occur.
Zynq> setenv ipaddr 192.168.150.101
Zynq> setenv netmask 255.255.255.0
Zynq> setenv gatewayip 192.168.150.1
Zynq> serverip=192.168.150.100
Zynq> ping 192.168.150.100
Using ethernet#e000b000 device
host 192.168.150.100 is alive
Zynq> tftpboot 0x8000 FreeRTOS_HelloWorld.elf
Using ethernet#e000b000 device
TFTP from server 192.168.150.100; our IP address is 192.168.150.101
Filename 'FreeRTOS_HelloWorld.elf'.
Load address: 0x8000
Loading: ###############
2.8 MiB/s
done
Bytes transferred = 205675 (3236b hex)
Zynq> go 0x8000
## Starting application at 0x00008000 ...
undefined instruction
pc : [<0000fa60>] lr : [<3ff443c4>]
reloc pc : [<c40cda60>] lr : [<040023c4>]
sp : 3eb20cf4 ip : 0000001c fp : 3ff4437c
r10: 3eb1f9b0 r9 : 3eb21ee8 r8 : 3ffaef30
r7 : 00000000 r6 : 00008000 r5 : 00000002 r4 : 3eb2f9b4
r3 : 00008000 r2 : 3eb2f9b4 r1 : 3eb2f9b4 r0 : 00001084
Flags: nZcv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
resetting ...
Thx in advance
The solution is:
The Xilinx SDK supply as an output an Elf-File, which the u-boot understands:
tftpboot 0x000000 FreeRTOS_ZC706_HelloWorld.elf
bootelf 0x0
Thanks
tftpboot 0x0 hello.efl; bootelf 0x0;
works in Uboot 2019.2 version and FreeRTOS.elf.
For the other core, you need to convert it to bin format using arm-none-eabi-objcopy -O binary hello.elf hello.bin. tftpboot it under the correct memory postion. And fire it up in the CPU0 code.
I'm a beginner about Inno Setup.
I want create an installer which copy two .exe files and append a value to the PATH environment variable.
Particularly I have to copy two executable files, called pandoc.exe and pandoc-citeproc.exe which are previously changed by me with visual studio developer prompt to don't have problem of Memory with large file conversions.
So I wrote this script with Inno Setup:
[Setup]
AppName=My Program
AppVersion=1.16.0.2
DefaultDirName={pf}\pandocX64
[Files]
Source: "pandoc.exe"; DestDir: "{app}";
Source: "pandoc-citeproc.exe"; DestDir: "{app}";
[Setup]
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
ValueType: expandsz; ValueName: "PATH"; ValueData: "{olddata};{pf}\pandocX64";
Check: NeedsAddPath('{pf}\pandocX64')
[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
// look for the path with leading and trailing semicolon
// Pos() returns 0 if not found
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
So, If I don't use the part of code to update the PATH variable, the installer copy the two executable files in C:\Program Files (x86)\pandocX64, and this is correct.
But I want also append that directory to the PATH system environment variable.
I read these threads:
How to set a global environment variable from Inno Setup installer?
How do I modify the PATH environment variable when running an Inno Setup Installer?
and I tried to write the code above.
Note that I put PATH as ValueName, and {olddata};{pf}\pandocX64 as ValueData to append to the current PATH value the directory in which the executable files are copied.
If I try to run this code, an error on line 17 is displayed
Required parameter "Root" not specified.
I think that Inno Setup expects the Root keyword in the line with code:
ValueType: expandsz; ValueName: "PATH"; ValueData: "{olddata};{pf}\pandocX64";
More precisely, I think that Inno Setup expects something like Inno Setup - Setting Java Environment Variable, but if I use that code, the PATH variable will be set to the {pf}\pandocX64 value, and no append operation will be performed.
Can someone help me?
Thank you
When you want to break a section entry to multiple lines for readability, you have to add \ at the end of the lines to escape the new-line character(s). A good practice is also to indent the lines, to make it clear to a human reader.
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "PATH"; ValueData: "{olddata};{pf}\pandocX64"; \
Check: NeedsAddPath('{pf}\pandocX64')
Otherwise the Inno Setup compiler treats each line as a separate, and consequently an incomplete, entry.
I've corrected the answer to How do I modify the PATH environment variable when running an Inno Setup Installer? to include the \'s.
I am trying to backup my mysql database from delphi by using ShellExecute to run mysqldump.
This is how I am using mysqldump:
MySqlDump.exe -u root -p[password] [databasename] > TheOutputFile.Sql
This works from command prompt.
I call this command line using ShellExecute:
ShellExecute(
0,
nil,
'cmd.exe',
'C:\SmartRetail\Test System\Periodic database backup\MySqlDump.exe -u root -p123 smartretailprogramdata > TheOutputFile2.Sql',
nil,
SW_SHOW
);
This does not work, instead it opens command prompt.
What am i doing wrong?
It opens the command interpreter because that's what cmd.exe is. You need to specify /C to tell the cmd process to close after it has interpreted your commands.
On top of that you need to take care of the working directory. Unless the .sql file is in the working directory, the dump process will not find it. And the working directory is inherited from the parent process since you did not specify it. You may need to specify the working directory.
Finally, ShellExecute is really the wrong solution here. You are only using it to get the stdout redirection. But that should really be done explicitly. Use CreateProcess instead.
Of curse you can :
var
BatFile : TStringList;
str: string;
const
EXEC = 'MySqlDump.exe -u root -p[password] [databasename] > TheOutputFile.Sql' ;
begin
BatFile := TStringList.Create;
BatFile.Text := EXEC ;
str := ExtractFilePath(Application.ExeName) + 's.bat';
BatFile.SaveToFile(str);
BatFile.Free;
ShellExecuteW(Handle, 'open', PWideChar(str), nil, nil, SW_HIDE);
Sleep(200);
ShowMessage('Done.');
DeleteFile(str);
end;
If I compile this Delphi 2007 project
program MyProject;
{$APPTYPE CONSOLE}
procedure Test;
var
i: Integer;
begin
if i = 666 then
i := 42;
end;
begin
Test;
end.
from the command line like
MSBuild MyProject.dproj /t:Rebuild /p:Configuration=Release /l:FileLogger,Microsoft.Build.Engine;logfile=log.txt;verbosity=minimal
I get this log file:
__________________________________________________
Projekt C:\Documents and Settings\pcbs1251\My Documents\RAD Studio\Projekte\MyProject\MyProject.dproj (Rebuild-Ziel(e)):
C:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe -B -DRELEASE [SNIP] MyProject.dpr
CodeGear Delphi für Win32 Compiler-Version 18.5
Copyright (c) 1983,2007 CodeGear
MyProject.dpr(10) Hinweis: H2077 Auf 'i' zugewiesener Wert wird niemals benutzt
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets : warning : MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden
MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden
17 Zeilen, 0.00 Sekunden, 11016 Byte-Code, 12156 Byte-Daten.
Erstellen des Projekts MyProject.dproj beendet.
Now I would like to trim this to
MyProject.dpr(10) Hinweis: H2077 Auf 'i' zugewiesener Wert wird niemals benutzt
MyProject.dpr(9) Warnung: W1036 Variable 'i' ist möglicherweise nicht initialisiert worden
Are there any FileLoggerParameters to do this?
Update: As there seems no way to make MSBuild do what I want I finally wrote a little Delphi program to format the MSBuild output to my needs.
I generally use grep, sed and awk to do things like this.
Try msbuild /v:m. This sets msbuild command line verbosity to "minimal". It may give you something closer to what you want. See 'msbuild /?' for help on that.
Many command line tools have a '/nologo' option that could help. Maybe you can get that passed to dcc. Maybe you'll have to edit the .targets files.