Subject RE: [firebird-support] Running gbak from CreateProcess or ShellExecute
Author Rick DeBay
I vaguely remember from my Win32 days that the string you pass in needs to be terminated with two '/0', not just one.

-----Original Message-----
From: Tom Munro Glass [mailto:tom@...]
Sent: Monday, October 25, 2004 5:05 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Running gbak from CreateProcess or ShellExecute


I need to run gbak on a remote Firebird server from a Delphi application. I
have tried using CreateProcess and ShellExecute but both of these methods are
giving a really strange problem. The backup works except that the backup
filename ends up with a spurious character on the end of it, e.g.
007222_SiteData4_DL1.fbkº

Below is the command I am trying to execute (note this is normally all one
line)

"C:\Program Files\Firebird\bin\gbak.exe" -backup -verbose -service
kingfisher:service_mgr -user SYSDBA -password masterkey
"D:\SiteData\007222\007222_SiteData4.fdb"
"D:\SiteData\007222\Backup\007222_SiteData4_DL1.fbk"

If I execute this with CreateProcess or ShellExecute, I get the same problem.
If I type this into a Win2K command prompt, it works correctly. I have also
put this exact text into a batch file, testgbak.bat. If I execute
testgbak.bat from a command prompt, it works, but if I execute testgbak.bat
from CreateProcess or ShellExecute the extra character is appended.

I have tried with and without double-quotes around the filenames, and it makes
no difference. I have also tried this with two different Firebird servers,
one running on Win2K and the other running on FreeBSD 4.10, with exactly the
same results on both.

The first two lines of output from gbak are:

gbak: readied database D:\SiteData\007222\007222_SiteData4.fdb for backup
gbak: creating file D:\SiteData\007222\Backup\007222_SiteData4_DL1.fbkº

I'm using Firebird 1.5.1 on both the client and servers.

Can anyone please explain this?

Tom Munro Glass





Yahoo! Groups Links