Application unable to write a file

Questions about Wine on Linux
Locked
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Application unable to write a file

Post by jannetta »

Hi folks

The exact error that I am experiencing was discussed in this post: viewtopic.php?p=48622, but it doesn't look like a solution was ever offered.

I too want to run a program called BV_Ana from Brainvision. When the program starts it requires one to enter a license key which is then written to a file, but an error occurs when the program tries to do this. The program itself generates the error: Error[LICENSE 0140]: File write Error: :\brainvision\ana20110820_mc02\program\license.txt.

The problem is obviously that there is no drive before the colon (:). I used to run this program in Windows and I know that the license file is usually in the program directory, so I tried to update the license file with the appropriate license. This would work in Windows but because the drive name is missing it is not finding the file.

Writing to a log does not produce anything because the program does not produce any uncaught exceptions that would otherwise be written to the console. Obviously wine is not passing the drive name to the program. Is there a way to fix this problem?

I am running Ubuntu 16.04 and wine-1.6.2

All help will be greatly appreciated.
Jannetta
User avatar
dimesio
Moderator
Moderator
Posts: 13205
Joined: Tue Mar 25, 2008 10:30 pm

Re: Application unable to write a file

Post by dimesio »

Start by upgrading Wine; 1.6.2 is over two years old and no longer supported. Use the WineHQ package. https://wiki.winehq.org/Ubuntu
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

Hi dimesio

I have followed the instructions and installed wine-1.9.17. I hope that is now the latest version. I thought I was using the latest version because I did and update and upgrade and whatever else to make sure I was using the latest but apparently Ubuntu didn't upgrade it.

However, I still have the same problem.

Jannetta
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

jannetta wrote:Hi dimesio

I have followed the instructions and installed wine-1.9.17. I hope that is now the latest version. I thought I was using the latest version because I did and update and upgrade and whatever else to make sure I was using the latest but apparently Ubuntu didn't upgrade it.

However, I still have the same problem.

Jannetta
Which of these versions of the application are you trying to install??
SciMedia Downloads

My latest little project - is an investigation into the file / directory handling by Wine... So I'm knocking together some patches to add extra debugging info - from functions not normally exposed in Wine's trace console output.

So i can take a look at what's going with the BV_Ana license handling... But will I need a valid license to get to the point where you are getting stuck... ??
Otherwise I probably can't help as I get the feeling you're not someone who likes to build Wine from Source (with my little patch files) on a regular basis 8)

O.T.
As for Debian's decision to continue shipping an ancient, unsupported version of Wine... What a joke... :roll:

Bob
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

Hi Bob

To tell you the truth, with all the "user friendliness" being built into every operating system to make it as useless as Windows, I long for the days when I had to compile every application to run on a floppy installed version of Slackware.

I feel a bit uncomfortable sharing the license. Are you able to give me instructions to compile myself? I'm quite happy to give it a go.

Regards
Jannetta
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

jannetta wrote:Hi Bob

To tell you the truth, with all the "user friendliness" being built into every operating system to make it as useless as Windows, I long for the days when I had to compile every application to run on a floppy installed version of Slackware.

I feel a bit uncomfortable sharing the license. Are you able to give me instructions to compile myself? I'm quite happy to give it a go.

Regards
Jannetta
Hi Jannetta,

Hah,hah well said! Running Gentoo of course means I've got to re-compile everything constantly anyway... :roll:
Wine is a tricky beast to build from source - because it really has to built as full multi-lib package on a 64-bit system (compiled twice: once for 32-bit and then again for 64-bit support).

I am just fiddling about a bit... Troubleshooting a little segfault issue with my patchset. It's quite easy to get bogged down in all the switching between ansi and unicode, character strings, etc. As Wine is written in C - the type-handling is a bit non-existent...

Naturally I wouldn't ask you to share the license... It's OK - the same problem is happening with the demo version - so I can bash on that!
I'm presuming you're using: ana20160420_anaOnly_x64.exe (64-bit build) ??

Bob
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

I've taken a look at the console output from the application... The failing section:

Code: Select all

trace:file:RtlGetFullPathName_U (L":\\brainvision\\ana20160420_anaOnly_x64\\program\\license.txt" 520 0x23d430 0x23d428)
trace:file:RtlDosPathNameToNtPathName_U (L"C:\\brainvision\\ana20160420_anaOnly_x64\\program\\:\\",0x23c180,(nil),(nil))
trace:file:RtlGetFullPathName_U (L"C:\\brainvision\\ana20160420_anaOnly_x64\\program\\:\\" 520 0x23bdf0 (nil))
... is a bit odd. It just appears "out of nowhere".

There is nothing particularly enlightening preceding the erroneous access to L":\\brainvision\\ana20160420_anaOnly_x64\\program\\license.txt".
This goes on to be parsed as a path relative to the current working directory - which (naturally) just blows up (due to the colon : directory)!

I tried a little hack - of creating the dodgy relative path:

Code: Select all

mkdir -p ':/brainvision/ana20160420_anaOnly_x64/program/'
Since ext4 supports : characters in pathnames... But obviously Wine/Windows doesn't!! So it fails the Wine path sanity checks... :cry:

It would be easy to "circumvent this issue" (with a hack)... But probably not without building a patched version of Wine.

Bob
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

I tried the dodgy hack too without success. I haven't mentioned it because I tried it after my original post :-)
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

jannetta wrote:I tried the dodgy hack too without success. I haven't mentioned it because I tried it after my original post :-)
Jannetta,

Slap on the wrist for choosing a poor forums thread title (way, way too vague)!! I was struggling to find it again... That's one of my pet hates btw! :wink:

I've got the software running finally with a pair of simple patches - that strip the invalid ':' colon lead character from the start of any ANSI file path access.
That's an invalid character to have anywhere in a NTFS/FAT filesystem path (as I'm sure you are aware)!
So in other-words a Wineprefix, set to Windows XP is supported. The BV_Ana software is access without a drive letter will now just point to the C:\ location (as it is clearly attempting to do - badly). I've still not determined what Windows API call or registry key access is going wrong - detecting the system drive letter. But the software is buggy - if it just goes ahead without checking for a valid system drive letter (it can after all only be A-Z)!

I've no idea if it functions 100% but the non-reliance on .Net frameworks means there is some hope!
I gather the Bv_Ana application just reads in scientific data files - without directly connecting to hardware devices??!! That would also be plus point for it to work 100%!!

Bob
Attachments
BV_Ana application screenshot
BV_Ana application screenshot
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

Hi Bob

I don't need BV_Ana to connect to any hardware. All of that has already been done, I just want to be able to access the data that I recorded before and export it to csv format for analysis with other software.

So can I get my hands on your patches please? Or, how do I go about making the changes.

Regards
Jannetta
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

jannetta wrote:Hi Bob

I don't need BV_Ana to connect to any hardware. All of that has already been done, I just want to be able to access the data that I recorded before and export it to csv format for analysis with other software.

So can I get my hands on your patches please? Or, how do I go about making the changes.

Regards
Jannetta
Hi ya,

I figured that you'd just be importing data files...

Sorry... I was going to post a bug report and then kinda keeled over from lack of sleep... :shock:

The bug report is now posted: Bug 41300 - BV_Ana scientific software (Brainvision) - version ana20160420 (64-bit) - attempts to access invalid license file path

I've attached the 2 patches (both required) to the bug report. They should apply cleanly to wine version 1.9.18.

Re building Wine, from source, on Ubuntu 16.04

I can vouch for the quality of this guys BASH script (which doesn't require LXC containers - or any other fancy build environments)...
Github: samrocketman/buildwine
I've not tested it - but it's simple, clean and self-documenting.

The main Gentoo (Wine) patches, required my app-emulation/wine ebuilds, are due to the fact that Wine is built out-of-tree on Gentoo. That won't be an issue for you!

The Wine source is pretty clean (unlike Mozilla's dodgy code :roll: )... So you should be good to go!! 8)

Bob
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

Jannetta,

I did some checks with Dmitry's suggestion to use:

Code: Select all

cd "${WINEPREFIX:-${HOME}/.wine}/drive_c/brainvision/ana20160420_anaOnly_x64"
wine start BV_Ana.exe
from the bug report I submitted...

I found that works - but then exposes a further path bug in the code...

This can be fixed quite easily:

Code: Select all

cd "${WINEPREFIX:-${HOME}/.wine}/drive_c"
ln -s "brainvision/ana20160420_anaOnly_x64/setup" .
Works around an attempt to access the color.csv at the absolute path: \setup\color.csv - by making a symbolic link of the setup directory @ C:\setup.

So no patches required - just vanilla Wine now!

This application seems to be written by highschool script kiddie or something :roll:

Bob
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

Hi Bob

My favourite rant: "BIOLOGISTS SHOULD NOT WRITE SOFTWARE!!" and "If your write something that only runs on Windows you are not very computer literate (and probably not much more than a script kiddie)".

With those two statements I have probably made myself pretty unpopular with 95% of the world's population. But unfortunately I am not a saint who can work with crappy software every day of my life and not get frustrated ...
jannetta
Level 1
Level 1
Posts: 8
Joined: Fri Sep 02, 2016 4:09 am

Re: Application unable to write a file

Post by jannetta »

Hi Bob

Just wanted to thank you. The last suggested solution works well and I have been able to read my data. Thank very much for your help.

Kind Regards
Jannetta
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Application unable to write a file

Post by Bob Wya »

jannetta wrote:Hi Bob

Just wanted to thank you. The last suggested solution works well and I have been able to read my data. Thank very much for your help.

Kind Regards
Jannetta
np, glad to be of service... 8)
Locked