Does win program know where it runs

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Potter
Level 2
Level 2
Posts: 17
Joined: Thu Aug 30, 2018 10:59 am

Does win program know where it runs

Post by Potter »

in other words: is there an environment variable that can tell a self-written program, whether it runs on top of wine or under real windows os?
like this:

Code: Select all

If environment_is_wine()
{
 funcA()
}
else
{
 funcB()
}


Other way:
The existence of a certain wine-exclusive file in wine's windows tree would help, too. I could put one there myself, but it might be forgotten to do in future every day struggling. Maybe one already exists ?

Thank You,
Potter
User avatar
dimesio
Moderator
Moderator
Posts: 13207
Joined: Tue Mar 25, 2008 10:30 pm

Re: Does win program know where it runs

Post by dimesio »

User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Does win program know where it runs

Post by DarkShadow44 »

The question is: Why do you want that? As the linked FAQ entry states, it's a bad idea. Better fix wine if some functionality is missing.
Potter
Level 2
Level 2
Posts: 17
Joined: Thu Aug 30, 2018 10:59 am

Re: Does win program know where it runs

Post by Potter »

Thank You for reply.

Yes, I agree. In my case: I have some self-written every-day-use programs (tools), where EM_FINDWORDBREAK is used, but yet not implemented by wine. This window message is part of Richtext functionality. If it is wished I could give it to the developers. I suppose with Bugzilla !? Until that it is no big deal to make small differences in source code, which I can remove in a moment. Don't you think so?
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Does win program know where it runs

Post by DarkShadow44 »

Well, from a software developer's perspective, too many temporary hacks end up becoming permanent. If I had to face this issue, I'd test if EM_FINDWORDBREAK works - if yes use it, if no don't. This way you don't have to change anything in your code when wine implements it - you program can just use the new functionality when wine adds it!

Alternative would be using native riched20. AFAIK the issue is known, but nobody fixed it yet. If I hadn't so much else to do, I'd look into it. Maybe sometime in the future.
Locked